/* Bildo – design A: luminos și jucăuș */
:root {
  --bg: #FBF8FF;
  --bg2: #F3EFFD;
  --card: #FFFFFF;
  --line: #ECE6FA;
  --line2: #DCD3F5;
  --text: #221D3F;
  --muted: #6E6890;
  --dim: #A19CBD;
  --primary: #7F6BEF;
  --primary-ink: #FFFFFF;
  --primary-soft: #EEEBFE;
  --primary-text: #4B3BB8;
  --coral: #FF8A6B;
  --mint: #2FBF92;
  --mint-soft: #DDF6EC;
  --mint-text: #0B6A4E;
  --amber-soft: #FFF1D6;
  --amber-text: #8A5A06;
  --danger: #E5484D;
  --danger-soft: #FDECEC;
  --shadow: 0 1px 2px rgb(60 40 140 / 6%), 0 8px 24px rgb(60 40 140 / 7%);
  --shadow-lg: 0 20px 60px rgb(40 20 110 / 22%);
  --r: 20px;
  --r-sm: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15122A; --bg2: #1C1836; --card: #211C3D; --line: #2E2851; --line2: #3B3466;
    --text: #F2EFFF; --muted: #ADA6D6; --dim: #7A73A3;
    --primary: #9C8CFF; --primary-ink: #15122A; --primary-soft: #2E2760; --primary-text: #CFC7FF;
    --mint-soft: #123D31; --mint-text: #8CE6C6; --amber-soft: #3A2D0F; --amber-text: #F5C97A; --danger-soft: #3D1C22;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); min-height: 100vh;
  font: 15px/1.5 "Plus Jakarta Sans", system-ui, sans-serif; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- bara de sus ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 14px clamp(16px, 4vw, 40px); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; background: var(--primary); position: relative; transform: rotate(-6deg); box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 40%, transparent); }
.brand-mark i { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #fff; right: 7px; top: 7px; }
.brand-mark::after { content: ""; position: absolute; left: 7px; bottom: 7px; width: 9px; height: 9px; border-radius: 3px; background: var(--coral); }
.brand-name { font-weight: 800; font-size: 22px; letter-spacing: -0.6px; }
.engine {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card);
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; color: var(--muted); font-weight: 500;
}
.engine .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.engine.loading .dot { background: var(--coral); animation: pulse 1s infinite; }
.engine.ready .dot { background: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
.engine.error .dot { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.btn, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line2);
  background: var(--card); border-radius: 999px; font-weight: 600; font-size: 14px; transition: transform .12s, background .15s, border-color .15s;
}
.btn { padding: 9px 16px; }
.icon-btn { width: 40px; height: 40px; padding: 0; }
.btn:hover, .icon-btn:hover { border-color: var(--primary); }
.btn:active, .icon-btn:active { transform: scale(.96); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.add-btn { position: relative; cursor: pointer; }
.add-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

.loadbar { margin: 4px clamp(16px, 4vw, 40px) 0; padding: 14px 18px; border-radius: var(--r); background: var(--card); box-shadow: var(--shadow); }
.loadbar-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.loadbar-row span { color: var(--primary-text); font-weight: 700; font-variant-numeric: tabular-nums; }
.loadbar p { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.track, .progress { height: 8px; border-radius: 99px; background: var(--primary-soft); overflow: hidden; margin-top: 10px; }
.fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--coral)); transition: width .3s; }

/* ---------- clienți ---------- */
.clients {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px clamp(16px, 4vw, 40px) 6px; scrollbar-width: none;
}
.clients::-webkit-scrollbar { display: none; }
.chip-client {
  flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 14px; white-space: nowrap; transition: .15s;
}
.chip-client .sw { width: 22px; height: 22px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.chip-client .n { color: var(--dim); font-weight: 600; font-size: 12.5px; }
.chip-client:hover { border-color: var(--line2); }
.chip-client.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip-client.active .n { color: color-mix(in srgb, var(--bg) 65%, transparent); }
.chip-client.new { border-style: dashed; color: var(--muted); padding-left: 14px; }

/* ---------- bara de lucru ---------- */
main { padding: 8px clamp(16px, 4vw, 40px) 80px; max-width: 1560px; margin: 0 auto; }
.bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 10px 0 6px; }
.bar h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -0.8px; line-height: 1.15; }
.stats { margin: 4px 0 0; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.bar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; height: 40px; color: var(--dim); }
.search:focus-within { border-color: var(--primary); }
.search input { border: 0; outline: 0; background: none; width: 200px; color: var(--text); }
.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 300px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.menu-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 10px; }
.menu-list button:hover { background: var(--primary-soft); }
.menu-list b { display: block; font-size: 14px; }
.menu-list small { color: var(--muted); font-size: 12px; }
.menu-list .danger b { color: var(--danger); }
.progress { margin: 12px 0 0; }

/* ---------- galerie ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 18px; }
.card {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s; animation: pop .35s ease both;
}
.card:hover { transform: translateY(-3px) rotate(-.3deg); box-shadow: 0 2px 4px rgb(60 40 140 / 8%), 0 16px 36px rgb(60 40 140 / 14%); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.thumb { position: relative; aspect-ratio: 4/3; background: var(--bg2); margin: 8px 8px 0; border-radius: 14px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge { position: absolute; top: 8px; right: 8px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--card); color: var(--muted); display: flex; align-items: center; gap: 5px; }
.badge.done { background: var(--mint-soft); color: var(--mint-text); }
.badge.working { background: var(--primary-soft); color: var(--primary-text); }
.badge.working::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.badge.error { background: var(--danger-soft); color: var(--danger); }
.kind { position: absolute; left: 8px; top: 8px; font-size: 10.5px; font-weight: 800; letter-spacing: .5px; padding: 3px 7px; border-radius: 8px; background: rgb(20 15 40 / 55%); color: #fff; }
.client-dot { position: absolute; left: 8px; bottom: 8px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
@keyframes spin { to { transform: rotate(360deg); } }
.shimmer { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / 35%) 50%, transparent 70%); background-size: 250% 100%; animation: sh 1.3s infinite; }
@keyframes sh { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 9px; }
.card-title { margin: 0; font-weight: 700; font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-title.ph { color: var(--dim); font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text); line-height: 1.4; }
.tag.t1 { background: #FFE9E2; color: #9A3A1E; }
.tag.t2 { background: var(--mint-soft); color: var(--mint-text); }
.tag.t3 { background: var(--amber-soft); color: var(--amber-text); }
.tag.more { background: transparent; color: var(--muted); border: 1px dashed var(--line2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.t1 { background: #3D2219; color: #FFB7A1; } }
.card-err { font-size: 12.5px; color: var(--danger); }

/* ---------- gol ---------- */
.empty { text-align: center; padding: 30px 16px 10px; max-width: 760px; margin: 0 auto; }
.empty h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; margin: 18px 0 6px; }
.empty > p { color: var(--muted); margin: 0 auto; max-width: 480px; }
.empty-art { position: relative; height: 170px; width: 260px; margin: 0 auto; }
.blob { position: absolute; border-radius: 50%; }
.b1 { width: 120px; height: 120px; background: var(--primary-soft); left: 20px; top: 20px; }
.b2 { width: 70px; height: 70px; background: #FFE3D9; right: 30px; top: 6px; }
.b3 { width: 50px; height: 50px; background: var(--mint-soft); right: 60px; bottom: 6px; }
.polaroid { position: absolute; width: 96px; height: 110px; background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 8px 24px; }
.polaroid::before { content: ""; display: block; height: 100%; border-radius: 6px; background: linear-gradient(160deg, #B9AEFF, #FF9F85); }
.p1 { left: 52px; top: 30px; transform: rotate(-9deg); }
.p2 { left: 120px; top: 40px; transform: rotate(7deg); }
.p2::before { background: linear-gradient(160deg, #8BE0C2, #7F6BEF); }
.perks { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; text-align: left; }
.perks li { background: var(--card); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.perks b { display: block; font-size: 14.5px; }
.perks span { color: var(--muted); font-size: 13px; }

.drop-overlay { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--primary) 18%, transparent); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; }
.drop-overlay div { border: 3px dashed var(--primary); border-radius: 28px; padding: 50px 60px; background: var(--card); font-size: 22px; font-weight: 800; color: var(--primary-text); }

/* ---------- ferestre ---------- */
dialog.sheet { border: 0; padding: 0; border-radius: 26px; background: var(--card); color: var(--text); box-shadow: var(--shadow-lg); width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog.sheet.small { width: min(520px, calc(100vw - 32px)); padding: 22px 24px 24px; }
dialog::backdrop { background: rgb(25 15 60 / 45%); backdrop-filter: blur(4px); }
dialog[open] { animation: rise .22s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dlg-head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.lead { color: var(--muted); margin: 8px 0; }

.photo-view { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 1fr); max-height: calc(100vh - 32px); }
.photo-img { background: var(--bg2); display: grid; place-items: center; padding: 16px; min-height: 300px; }
.photo-img img { max-width: 100%; max-height: calc(100vh - 80px); border-radius: 16px; object-fit: contain; }
.photo-side { padding: 20px 22px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.pd-head { display: flex; justify-content: space-between; gap: 12px; }
.pd-name { margin: 0; font-weight: 700; word-break: break-all; }
.pd-meta { margin: 2px 0 0; color: var(--dim); font-size: 12.5px; }
.lbl { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.lbl .acts { display: flex; gap: 4px; align-items: center; text-transform: none; letter-spacing: 0; font-weight: 600; }
.count { color: var(--dim); font-variant-numeric: tabular-nums; }
.count.over { color: var(--danger); }
.mini { border: 0; background: var(--primary-soft); color: var(--primary-text); font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.mini:hover { filter: brightness(.97); }
.field { width: 100%; border: 1.5px solid var(--line); background: var(--bg); border-radius: 14px; padding: 10px 12px; outline: none; resize: vertical; }
.field:focus { border-color: var(--primary); background: var(--card); }
.field.title { font-weight: 700; font-size: 16px; }
.field.desc { font-size: 13.5px; color: var(--muted); min-height: 64px; }
.edit-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.edit-tags .tag { display: inline-flex; align-items: center; gap: 2px; padding: 4px 4px 4px 10px; font-size: 12.5px; cursor: grab; }
.edit-tags .tag.weak { background: transparent; border: 1px solid var(--line2); color: var(--muted); }
.edit-tags .tag button { border: 0; background: none; color: inherit; opacity: .55; font-size: 15px; line-height: 1; padding: 0 5px; border-radius: 99px; }
.edit-tags .tag button:hover { opacity: 1; }
.edit-tags .tag.dragging { opacity: .35; }
.add-tag { border: 1.5px dashed var(--line2); background: none; border-radius: 999px; padding: 3px 12px; font-size: 12.5px; width: 130px; outline: none; }
.add-tag:focus { border-color: var(--primary); }
.legend { font-size: 12px; color: var(--dim); margin: 6px 0 0; }
.pd-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }

/* ---------- setări ---------- */
.set { display: flex; flex-direction: column; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.set-row b { display: block; font-size: 14.5px; }
.set-row small { color: var(--muted); font-size: 12.5px; }
/* setările lotului: etichetă deasupra, câmp lat dedesubt */
.set-col { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-top: 1px solid var(--line); }
.set-col b { font-size: 14.5px; }
.set-col small { color: var(--muted); font-size: 12.5px; }
.set-col .field { margin-top: 4px; }
.range { display: flex; align-items: center; gap: 10px; }
.range input { accent-color: var(--primary); width: 140px; }
.range output { font-weight: 800; min-width: 24px; text-align: right; font-variant-numeric: tabular-nums; }
.set-row input[type="number"] { width: 84px; border: 1.5px solid var(--line); background: var(--bg); border-radius: 12px; padding: 7px 10px; outline: none; }
.seg { display: flex; background: var(--bg2); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.switch { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line2); position: relative; cursor: pointer; transition: .2s; flex: none; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgb(0 0 0 / 20%); }
.switch:checked { background: var(--primary); }
.switch:checked::after { left: 21px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }

/* ---------- telefon ---------- */
@media (max-width: 760px) {
  .engine { display: none; }
  .add-btn span { display: none; }
  .add-btn { width: 40px; height: 40px; padding: 0; }
  .bar { align-items: stretch; }
  .bar-actions { width: 100%; }
  .search { flex: 1 1 100%; min-width: 0; }
  .bar-actions .btn.primary { flex: 1; }
  .search input { width: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-body { padding: 10px 10px 12px; }
  .card .tags .tag:nth-child(n+4):not(.more) { display: none; }
  .photo-view { grid-template-columns: 1fr; overflow-y: auto; }
  .photo-img { min-height: 0; padding: 10px; }
  .photo-img img { max-height: 42vh; }
  dialog.sheet { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  dialog.sheet.small { height: auto; max-height: 90dvh; margin: auto 0 0; border-radius: 26px 26px 0 0; width: 100vw; }
  .menu-list { right: auto; left: 0; width: min(300px, calc(100vw - 32px)); }
}

/* categorii stock în editor */
.cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cats label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cats small { font-size: 11.5px; color: var(--dim); font-weight: 600; }
.cats select.field { padding: 8px 10px; font-size: 13px; resize: none; text-overflow: ellipsis; }
@media (max-width: 560px) { .cats { grid-template-columns: 1fr; } }
.lang-select { width: auto; min-width: 128px; padding: 8px 12px; resize: none; }
