/* Studio Manager — moderan izgled u boji studija (#baf20c, limeta)
   Limeta je uvek POVRŠINA ispod tamnog teksta (dugmad, aktivni meni, oznake).
   Za tekst/linkove na beloj podlozi koristi se --ink (tamnija maslinasta), jer se limeta na belom ne čita. */
:root {
  --brand: #baf20c;
  --brand-hover: #a7dc00;
  --brand-soft: #f1fbd4;
  --brand-ring: rgba(186, 242, 12, .45);
  --ink: #4a6800;          /* tekst u boji studija na svetloj podlozi */

  --bg: #f4f5f0;
  --surface: #ffffff;
  --surface-2: #f2f3ee;
  --surface-3: #e7e9e1;
  --border: #e5e7df;
  --border-strong: #d2d5ca;
  --text: #121410;
  --text-2: #3d4237;
  --muted: #6d7266;
  --accent: var(--brand);
  --accent-hover: var(--brand-hover);
  --accent-soft: var(--brand-soft);
  --accent-text: #2f4300;
  --on-accent: #111310;
  --focus-border: #8cbc00;

  /* Tamni meni */
  --side-bg: #121410;
  --side-text: #b6bbad;
  --side-muted: #6f7568;
  --side-hover: rgba(255, 255, 255, .06);
  --side-border: rgba(255, 255, 255, .08);

  --blue: #2563eb;   --blue-soft: #e8f0ff;
  --amber: #b45309;  --amber-soft: #fff4e0;
  --green: #15803d;  --green-soft: #e4f7ea;
  --red: #dc2626;    --red-soft: #feecec;
  --slate: #4b5563;  --slate-soft: #eef0ec;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(18, 20, 16, .04), 0 2px 8px rgba(18, 20, 16, .04);
  --shadow-lg: 0 16px 40px rgba(18, 20, 16, .16);
  --sidebar-w: 252px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0d0b; --surface: #151713; --surface-2: #1c1f19; --surface-3: #262a22;
    --border: #262a22; --border-strong: #363b30;
    --text: #f1f3ec; --text-2: #c7ccbd; --muted: #8e9484;
    --ink: #baf20c; --accent-text: #d4ff5c; --brand-soft: #243008; --focus-border: #baf20c;
    --side-bg: #0f100e;
    --blue: #6ea2ff; --blue-soft: #18264a; --amber: #f5b454; --amber-soft: #3a2a12;
    --green: #4fd07f; --green-soft: #12301f; --red: #ff7070; --red-soft: #3c1719;
    --slate: #a8ae9e; --slate-soft: #22261e;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 16px 40px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0d0b; --surface: #151713; --surface-2: #1c1f19; --surface-3: #262a22;
  --border: #262a22; --border-strong: #363b30;
  --text: #f1f3ec; --text-2: #c7ccbd; --muted: #8e9484;
  --ink: #baf20c; --accent-text: #d4ff5c; --brand-soft: #243008; --focus-border: #baf20c;
  --side-bg: #0f100e;
  --blue: #6ea2ff; --blue-soft: #18264a; --amber: #f5b454; --amber-soft: #3a2a12;
  --green: #4fd07f; --green-soft: #12301f; --red: #ff7070; --red-soft: #3c1719;
  --slate: #a8ae9e; --slate-soft: #22261e;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 16px 40px rgba(0,0,0,.55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); font-feature-settings: "cv11", "tnum" 0;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; font-weight: 500; }
a:hover { color: var(--text); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.02em; }
::selection { background: var(--brand); color: #111; }
p { margin: 0 0 .75em; }
.ico { flex: none; display: block; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
kbd {
  font: 11px var(--font); color: var(--muted); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface);
}

/* ---------- Raspored ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px 16px; background: var(--side-bg); color: var(--side-text); overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #2b2f27 transparent;
}
.brand { display: flex; align-items: center; gap: 11px; color: #fff; padding: 2px 6px; }
.brand:hover { color: #fff; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--brand); color: #111; font-weight: 800; font-size: 14px; letter-spacing: -.02em;
  box-shadow: 0 0 0 4px rgba(186, 242, 12, .12);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--side-muted); font-size: 12px; font-weight: 500; }
.me-text small { color: var(--side-muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--side-muted); padding: 16px 12px 6px; }
.nav a, .nav-soon {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px;
  color: var(--side-text); font-weight: 500; font-size: 14px; transition: background .12s, color .12s;
}
.nav a .ico { opacity: .85; }
.nav a:hover { background: var(--side-hover); color: #fff; }
.nav a.active { background: var(--brand); color: #111; font-weight: 600; }
.nav a.active .ico { color: #111; opacity: 1; }
.nav-soon { color: var(--side-muted); opacity: .7; cursor: default; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center;
}
.nav a.active .nav-badge { background: #111; color: var(--brand); }
.sidebar .btn-primary { box-shadow: 0 6px 20px rgba(186, 242, 12, .18); }
.sidebar-foot { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--side-border); padding-top: 14px; }
.sidebar-foot form { margin: 0; }
.sidebar .icon-btn { color: var(--side-muted); }
.sidebar .icon-btn:hover { background: var(--side-hover); color: #fff; }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: #fff; padding: 5px; border-radius: 12px; }
.me:hover { background: var(--side-hover); color: #fff; }
.sidebar .avatar { background: #262a22; color: var(--brand); }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600;
}

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
}
.topbar h1 { font-size: 24px; font-weight: 800; flex: none; letter-spacing: -.03em; }
.topsearch {
  margin-left: auto; display: flex; align-items: center; gap: 8px; width: min(340px, 40vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 14px; color: var(--muted);
}
.topsearch:focus-within { border-color: var(--focus-border); box-shadow: 0 0 0 4px var(--brand-ring); }
.topsearch input { border: 0; background: transparent; padding: 9px 0; flex: 1; min-width: 0; outline: none; color: var(--text); font: inherit; }
.topbar-actions { display: flex; gap: 8px; }
.menu-btn { display: none; }
.content { padding: 8px 28px 48px; width: 100%; } /* puna širina ekrana */
.scrim { display: none; }
.fab { display: none; }

/* ---------- Dugmad ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: 600 14px/1 var(--font); padding: 10px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: background .12s, border-color .12s, transform .05s, box-shadow .12s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--brand-ring); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-accent); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-accent); box-shadow: 0 4px 14px rgba(140, 188, 0, .28); }
.btn-dark { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn-dark:hover { background: var(--text-2); border-color: var(--text-2); color: var(--bg); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Kartice ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; min-width: 0; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.card-title .muted { font-weight: 500; }
.card.flush { padding: 0; }
.card.flush .card-head { padding: 16px 20px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.stack-gap > * + * { margin-top: 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  display: flex; flex-direction: column; gap: 6px; padding: 18px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s;
}
a.stat:hover { border-color: var(--focus-border); color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; }
.stat-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
/* Prva kartica na kontrolnoj tabli je istaknuta: tamna sa limeta brojem */
.stats > .stat:first-child { background: var(--side-bg); border-color: var(--side-bg); color: #fff; }
.stats > .stat:first-child .stat-top, .stats > .stat:first-child .stat-sub { color: var(--side-text); }
.stats > .stat:first-child .stat-value { color: var(--brand); }
.stats > .stat:first-child .stat-ico { background: var(--brand); color: #111; }
.stats > a.stat:first-child:hover { color: #fff; border-color: var(--brand); }
.stat-sub { font-size: 13px; color: var(--muted); }
.tone-blue .stat-ico { background: var(--blue-soft); color: var(--blue); }
.tone-red .stat-ico { background: var(--red-soft); color: var(--red); }
.tone-red .stat-value { color: var(--red); }
.tone-green .stat-ico { background: var(--green-soft); color: var(--green); }
.tone-amber .stat-ico { background: var(--amber-soft); color: var(--amber); }
.tone-accent .stat-ico { background: var(--brand-soft); color: var(--ink); }

/* ---------- Tabele ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em;
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.row-link { cursor: pointer; }
.table tbody tr.row-link:hover td { background: var(--surface-2); }
.table tbody tr.row-link:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.table .t-main { font-weight: 600; color: var(--text); }
.table .t-sub { font-size: 13px; color: var(--muted); }
.table th.right, .table td.right { text-align: right; }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 20px; }
.card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 20px; }
.order-no { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }

/* ---------- Oznake ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-slate { background: var(--slate-soft); color: var(--slate); }
.badge-red { background: var(--red-soft); color: var(--red); }
.tag-urgent {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; color: var(--red);
  background: var(--red-soft); border-radius: 6px; padding: 1px 6px; text-transform: uppercase; letter-spacing: .03em;
}
.pay { font-size: 13px; font-weight: 600; white-space: nowrap; }
.pay-green { color: var(--green); } .pay-amber { color: var(--amber); } .pay-red { color: var(--red); }
.due { white-space: nowrap; }
.due small { display: block; font-size: 12px; color: var(--muted); }
.due.late, .due.late small { color: var(--red); font-weight: 600; }
.due.soon small { color: var(--amber); font-weight: 600; }

/* ---------- Filteri ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 13.5px; font-weight: 500;
}
.chip:hover { border-color: var(--text-2); color: var(--text); }
.chip.active { background: var(--side-bg); border-color: var(--side-bg); color: var(--brand); }
.chip .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.active .count { color: inherit; opacity: .7; }
.chip.chip-red .count { color: var(--red); font-weight: 700; }
.search-inline {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 0 14px; color: var(--muted); min-width: 240px; flex: 1; max-width: 360px;
}
.search-inline input { border: 0; outline: 0; background: transparent; padding: 9px 0; flex: 1; font: inherit; color: var(--text); }
.search-inline:focus-within { border-color: var(--focus-border); box-shadow: 0 0 0 4px var(--brand-ring); }

/* ---------- Forme ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.form-grid > * { grid-column: span 12; min-width: 0; }
.span-6 { grid-column: span 6 !important; } .span-4 { grid-column: span 4 !important; }
.span-3 { grid-column: span 3 !important; } .span-8 { grid-column: span 8 !important; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field > span em { font-style: normal; color: var(--red); }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], input[type=number], input[type=tel], input:not([type]), select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 10px 12px; width: 100%; min-width: 0; outline: none; transition: border-color .12s, box-shadow .12s;
}
.topsearch input, .search-inline input { border: 0; padding: 9px 0; box-shadow: none; }
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--focus-border); box-shadow: 0 0 0 4px var(--brand-ring); }
.field-error { color: var(--red); font-size: 12.5px; font-weight: 500; }
.has-error input, .has-error select { border-color: var(--red); }
.check { display: inline-flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--focus-border); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.form-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; justify-content: flex-end; align-items: center;
  margin-top: 16px; padding: 14px 0; background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.form-actions .hint { margin-right: auto; color: var(--muted); font-size: 13px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 4px 0 -2px; }

/* Izbor klijenta (pretraga) */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; display: none;
}
.combo.open .combo-list { display: block; }
.combo-item { padding: 8px 10px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.combo-item small { color: var(--muted); }
.combo-item.hl { background: var(--brand-soft); }
.combo-item.new { color: var(--ink); font-weight: 600; }
.combo-picked { font-size: 12.5px; color: var(--green); font-weight: 600; }
.combo-picked.new { color: var(--ink); }

/* Stavke naloga */
[data-items] { container-type: inline-size; }
.items-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.items-table .c-desc { min-width: 220px; }
.items-table th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: 0 6px 8px; }
.items-table td { padding: 4px 6px; vertical-align: top; }
.items-table td:first-child, .items-table th:first-child { padding-left: 0; }
.items-table td:last-child, .items-table th:last-child { padding-right: 0; }
.items-table .c-qty { width: 92px; } .items-table .c-unit { width: 100px; } .items-table .c-price { width: 130px; }
.items-table .c-disc { width: 76px; } .items-table .c-total { width: 130px; } .items-table .c-del { width: 40px; }
.items-table input, .items-table select { padding: 8px 9px; }
.items-table .line-total { padding: 9px 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.items-table input.n { text-align: right; font-variant-numeric: tabular-nums; }
.row-num { color: var(--muted); font-size: 12px; padding-top: 11px !important; width: 22px; }
/* Uska kartica (telefon, tablet, mali prozor): stavke kao kartice */
@container (max-width: 760px) {
  .items-table thead { display: none; }
  .items-table, .items-table tbody, .items-table tr, .items-table td { display: block; width: auto !important; min-width: 0 !important; }
  .items-table tr { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; position: relative; }
  .items-table td { padding: 0 !important; }
  .items-table td.c-desc { grid-column: 1 / -1; padding-right: 40px !important; }
  .items-table td.row-num { display: none; }
  .items-table td.c-del { position: absolute; top: 12px; right: 8px; }
  .items-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
  .items-table td.c-total { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed var(--border); padding-top: 8px !important; }
  .items-table td.c-total::before { margin: 0; }
  .items-table .line-total { padding: 0; }
}
@container (max-width: 420px) {
  .items-table tr { grid-template-columns: 1fr 1fr; }
}
/* Porudžbine dobavljačima: šifra artikla, boja, veličina */
.items-table .c-sku { width: 120px; } .items-table .c-color { width: 110px; } .items-table .c-size { width: 70px; }
.items-articles .items-table .c-desc { min-width: 180px; }
@container (max-width: 1040px) {
  .items-articles .items-table thead { display: none; }
  .items-articles .items-table, .items-articles .items-table tbody, .items-articles .items-table tr, .items-articles .items-table td { display: block; width: auto !important; min-width: 0 !important; }
  .items-articles .items-table tr { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; position: relative; }
  .items-articles .items-table td { padding: 0 !important; }
  .items-articles .items-table td.c-desc { grid-column: 1 / -1; padding-right: 40px !important; }
  .items-articles .items-table td.c-sku { grid-column: span 2; }
  .items-articles .items-table td.row-num { display: none; }
  .items-articles .items-table td.c-del { position: absolute; top: 12px; right: 8px; }
  .items-articles .items-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
  .items-articles .items-table td.c-total { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed var(--border); padding-top: 8px !important; }
  .items-articles .items-table td.c-total::before { margin: 0; }
  .items-articles .items-table .line-total { padding: 0; }
}
.show-sm { display: none; }
/* Fotografija uz stavku ponude */
.items-table .c-img { width: 64px; }
.img-pick { position: relative; width: 56px; height: 56px; }
.img-pick label { display: grid; place-items: center; width: 100%; height: 100%; border: 1.5px dashed var(--border); border-radius: 10px; cursor: pointer; overflow: hidden; color: var(--muted); background: var(--surface-2, transparent); }
.img-pick label:hover { border-color: var(--focus-border); color: var(--ink); background: var(--brand-soft); }
.img-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.img-pick img { display: none; width: 100%; height: 100%; object-fit: cover; }
.img-pick.has label { border-style: solid; }
.img-pick.has img { display: block; }
.img-pick.has .img-empty { display: none; }
.img-del { display: none; position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #121410; color: var(--brand); place-items: center; cursor: pointer; padding: 0; }
.img-pick.has .img-del { display: grid; }
.item-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; display: block; border: 1px solid var(--border); }
@container (max-width: 760px) {
  .items-images .items-table td.c-img { grid-column: 1 / -1; }
}
.totals { margin-left: auto; width: min(340px, 100%); display: grid; grid-template-columns: 1fr auto; gap: 6px 20px; margin-top: 14px; font-variant-numeric: tabular-nums; }
.totals dt { color: var(--muted); } .totals dd { margin: 0; text-align: right; font-weight: 500; }
.totals .grand { font-size: 18px; font-weight: 800; color: var(--text); padding-top: 8px; border-top: 1px solid var(--border); }
.totals dd.grand { background: var(--brand); color: #111; border-radius: 10px; padding: 6px 12px; border-top: 0; margin-top: 4px; }
.totals dt.grand { padding-top: 10px; }

/* ---------- Prikaz naloga ---------- */
.order-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.order-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.03em; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.order-head .sub { color: var(--muted); margin-top: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13.5px; font-weight: 500; margin-bottom: 10px; }
.back-link:hover { color: var(--text); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.status-flow { display: flex; gap: 6px; flex-wrap: wrap; }
.status-flow button { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 8px 14px; font: 600 13px var(--font); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.status-flow button:hover { border-color: var(--text-2); color: var(--text); }
.status-flow button.current { background: var(--brand); border-color: var(--brand); color: #111; cursor: default; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 8px 0 4px; }
.progress > span { display: block; height: 100%; background: var(--focus-border); border-radius: 99px; }
.money-big { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline small { display: block; color: var(--muted); font-size: 12px; }
.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.files li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; }
.files li a.fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.files li small { color: var(--muted); white-space: nowrap; }
.files form { margin: 0; }
.dropzone { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.dropzone input[type=file] { font-size: 13px; flex: 1; min-width: 0; }
.note-box { white-space: pre-wrap; background: var(--surface-2); border-radius: 9px; padding: 12px 14px; font-size: 14px; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.inline-form .full { grid-column: span 2; }
.pay-list { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13.5px; }
.pay-list li { display: flex; gap: 8px; align-items: center; padding: 7px 0; border-top: 1px solid var(--border); }
.pay-list li .num { margin-left: auto; font-weight: 600; }
.pay-list form { margin: 0; }

/* ---------- Ostalo ---------- */
.flash {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; margin: 8px 0 14px;
  background: var(--green-soft); color: var(--green); font-weight: 500; font-size: 14px;
}
.flash-error { background: var(--red-soft); color: var(--red); }
.flash-warning { background: var(--amber-soft); color: var(--amber); }
.flash span { flex: 1; }
.flash button { border: 0; background: transparent; color: inherit; cursor: pointer; opacity: .7; padding: 2px; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 44px 20px; color: var(--muted); }
.empty strong { color: var(--text); font-size: 15px; }
.empty p { margin: 0; font-size: 14px; max-width: 360px; }
.empty .btn { margin-top: 8px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-top: 1px solid var(--border); color: var(--text); }
.list-row:hover { background: var(--surface-2); color: var(--text); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .grow small { color: var(--muted); font-size: 13px; }
.client-head { display: flex; align-items: center; gap: 14px; }
.client-head .avatar { width: 48px; height: 48px; font-size: 16px; background: var(--brand); color: #111; font-weight: 700; }
.contact-line { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; padding: 4px 0; }
.contact-line .ico { color: var(--muted); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.mini-stats div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.mini-stats small { display: block; color: var(--muted); font-size: 12px; }
.mini-stats strong { font-variant-numeric: tabular-nums; }

.wk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.wk-grid figure { margin: 0; position: relative; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.wk-grid img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.wk-grid form { position: absolute; top: 6px; right: 6px; }
.wk-grid form .icon-btn { width: 24px; height: 24px; background: rgba(0,0,0,.55); color: #fff; border: 0; }
.wk-grid figcaption { font-size: 12px; padding: 6px 8px; color: var(--muted); }
.st-used { list-style: none; margin: 0; padding: 0 20px 14px; }
.st-used li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 28px; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }

/* Izbor iz cenovnika usluga */
.svc-pick { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; width: min(440px, 92vw); background: var(--surface); border: 1px solid var(--border-strong, var(--border)); border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: 8px; }
.svc-pick input { width: 100%; margin-bottom: 6px; }
.svc-pick [data-svc-list] { max-height: 300px; overflow: auto; display: grid; gap: 2px; }
.svc-pick button { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 14px; }
.svc-pick button:hover, .svc-pick button:focus { background: var(--surface-2); outline: none; }
.svc-pick button b { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }

/* Troškovi i zarada na radnom nalogu */
.oc-add { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 14px 20px; }
.oc-add > * { min-width: 0; }
.oc-add select[name=category], .oc-add input[name=cnote] { grid-column: span 2; }
.oc .table-wrap { border-top: 1px solid var(--border); }
.oc-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px 20px 18px; border-top: 1px solid var(--border); }
.oc-sum div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.oc-sum small { display: block; color: var(--muted); font-size: 12px; }
.oc-sum strong { font-size: 17px; }
.oc-sum strong span { font-size: 12px; color: var(--muted); font-weight: 500; }
.oc-sum .pos strong { color: var(--green); } .oc-sum .neg strong { color: var(--red); }
@media (max-width: 560px) { .oc-add { grid-template-columns: 1fr 1fr; } .oc-add select[name=category], .oc-add input[name=cnote] { grid-column: 1 / -1; } }
@media (max-width: 560px) { .oc-sum { grid-template-columns: 1fr; } }
.logo-preview { max-height: 64px; max-width: 220px; border-radius: 8px; border: 1px solid var(--border); padding: 6px; background: #fff; }

/* Prijava */
.auth-body { min-height: 100vh; display: grid; place-items: center; background:
  radial-gradient(900px 500px at 85% 110%, rgba(186, 242, 12, .35), transparent 60%),
  radial-gradient(700px 420px at 0% -10%, rgba(186, 242, 12, .18), transparent 60%), var(--side-bg); }
.auth-wrap { width: 100%; padding: 24px 16px; display: grid; place-items: center; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.45); padding: 30px; }
.auth-card h2 { font-size: 20px; margin-bottom: 6px; }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.auth-brand div { display: flex; flex-direction: column; }
.auth-brand small { color: var(--muted); }
.auth-card form { margin-top: 16px; }

/* ---------- Telefon i tablet ---------- */
@media (max-width: 1100px) {
  .layout-side { grid-template-columns: minmax(0, 1fr); } /* minmax: sadržaj ne sme da gura ekran u širinu na telefonu */
}
@media (max-width: 1250px) {
  .topbar:has(.topbar-actions) .topsearch { display: none; }
  .topbar:has(.topbar-actions) .topbar-actions { margin-left: auto; }
  .topbar:has(.topbar-actions) h1 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(10, 12, 20, .45); }
  .menu-btn { display: inline-grid; margin-left: -8px; }
  .topbar { padding: 10px 16px; gap: 8px; }
  .topbar h1 { font-size: 18px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topsearch { display: none; }
  .content { padding: 4px 16px 96px; }
  .grid-2 { grid-template-columns: 1fr; }
  .fab {
    display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 30; width: 58px; height: 58px; border-radius: 20px; background: var(--brand); color: #111; box-shadow: 0 10px 28px rgba(140, 188, 0, .4);
  }
  .fab:hover { color: #111; }
  body:has(.form-actions) .fab { display: none; }
  .hide-sm { display: none !important; }
  .show-sm { display: block; }
  .span-6, .span-4, .span-3, .span-8 { grid-column: span 12 !important; }
  .span-6.keep, .span-3.keep { grid-column: span 6 !important; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 22px; }
  .card { padding: 16px; }
  .search-inline { max-width: none; min-width: 0; width: 100%; flex-basis: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
  .chip { flex: none; }
  .topbar-actions .btn span.lbl { display: none; }

  /* Tabele kao liste */
  .table.responsive thead { display: none; }
  .table.responsive tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table.responsive td { padding: 0 !important; border: 0; }
  .table.responsive td.r-full { grid-column: 1 / -1; }
  .table.responsive td.right { text-align: right; }
  .table.responsive td.r-amt { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 4px; }
  .table.responsive td.r-amt div { order: -1; }
  .table.responsive tbody tr.row-link:hover td { background: transparent; }
  .table.responsive tbody tr.row-link:active { background: var(--surface-2); }
  .inline-form { grid-template-columns: 1fr; }
  .inline-form .full { grid-column: auto; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 19px; }
  .order-head h2 { font-size: 20px; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .dropzone { flex-wrap: wrap; }
}
