/* =====================================================================
   OPTIKA CRM — stilovi
   Paleta: laboratorijsko siva pozadina, bele površine, duboka teal
   akcentna boja (kao antirefleksni sloj na staklu). Signature element:
   kartica recepta (OD/OS) u monospace fontu.
   ===================================================================== */

@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --ink: #131C26;
  --ink-2: #44505E;
  --ink-3: #7A8592;
  --line: #DDE2E8;
  --line-strong: #C4CBD4;
  --brand: #F26B1D;          /* Orange Optic — boja znaka */
  --brand-dark: #D2520F;
  --accent: #0E6B7B;
  --accent-hover: #0B5764;
  --accent-soft: #E1F0F2;
  --accent-ink: #FFFFFF;
  --red: #B42318; --red-soft: #FEE4E2;
  --amber: #B54708; --amber-soft: #FEF0C7;
  --green: #067647; --green-soft: #DCFAE6;
  --gray-soft: #EEF0F3;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(19, 28, 38, .06), 0 4px 16px rgba(19, 28, 38, .06);
  --shadow-lg: 0 8px 32px rgba(19, 28, 38, .18);
  --sidebar-w: 224px;
  --topbar-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 22px; letter-spacing: -.01em; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0 0 .75em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- prijava ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 32px 28px; box-shadow: var(--shadow); }
.login-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); display: grid; place-items: center; color: #fff; flex: none; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--ink-3); }

/* ---------- ljuska aplikacije ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: var(--topbar-h) 1fr; min-height: 100vh; }
.sidebar { grid-row: 1 / 3; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; height: var(--topbar-h); border-bottom: 1px solid var(--line); }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav .nav-sep { margin: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.nav .count { margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--red-soft); color: var(--red); }
.sidebar-foot { margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }

.topbar { grid-column: 2; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar .menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 620px; }
.search input { width: 100%; height: 38px; padding: 0 12px 0 38px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
.search input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; background: #fff; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 40; overflow: hidden; }
.search-results .item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 9px 14px; cursor: pointer; border-top: 1px solid var(--line); }
.search-results .item:first-child { border-top: 0; }
.search-results .item.active, .search-results .item:hover { background: var(--accent-soft); }
.search-results .item .name { font-weight: 500; grid-column: 1; }
.search-results .item .sub { color: var(--ink-3); font-size: 12.5px; grid-column: 1; }
.search-results .item .badge { align-self: center; justify-self: end; grid-column: 2; grid-row: 1 / 3; }
.search-results .foot { padding: 8px 14px; font-size: 12.5px; color: var(--ink-3); border-top: 1px solid var(--line); background: var(--surface-2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
.user-chip .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.user-chip .role { font-size: 11.5px; color: var(--ink-3); }

.content { grid-column: 2; padding: 22px 24px 40px; max-width: 1280px; width: 100%; min-width: 0; }
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- dugmad ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--red); border-color: #F3B5AF; }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 15px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }

/* ---------- kartice ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.show-m { display: none; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* dashboard brojači */
.stat { display: block; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: inherit; transition: border-color .12s, transform .12s; }
a.stat:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.stat .label { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.stat .value { font-family: var(--mono); font-size: 28px; font-weight: 500; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.stat.alert .value { color: var(--red); }
.stat.warn .value { color: var(--amber); }
.stat.good .value { color: var(--accent); }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--amber-soft); color: var(--amber); border: 1px solid #F5D78E; }
.banner strong { font-family: var(--mono); font-size: 18px; }
.banner .btn { margin-left: auto; }

/* ---------- oznake statusa ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; line-height: 1.5; }
.badge-overdue { background: var(--red-soft); color: var(--red); }
.badge-due_soon { background: var(--amber-soft); color: var(--amber); }
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-no_exam, .badge-no_next, .badge-gray { background: var(--gray-soft); color: var(--ink-2); }
.badge-scheduled { background: var(--accent-soft); color: var(--accent); }
.badge-completed { background: var(--green-soft); color: var(--green); }
.badge-cancelled, .badge-no_show { background: var(--gray-soft); color: var(--ink-2); }
.badge-pending { background: var(--amber-soft); color: var(--amber); }
.badge-sent, .badge-done { background: var(--green-soft); color: var(--green); }
.badge-failed { background: var(--red-soft); color: var(--red); }
.badge-admin { background: var(--accent-soft); color: var(--accent); }
.badge-employee { background: var(--gray-soft); color: var(--ink-2); }
.badge .n { font-family: var(--mono); font-weight: 500; }

/* ---------- tabele ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.row-link { cursor: pointer; }
.tbl tr.row-link:hover td { background: var(--accent-soft); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .id { font-family: var(--mono); color: var(--ink-3); font-size: 12.5px; }
.tbl .name { font-weight: 500; }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl .actions .btn { margin-left: 4px; }
.empty { padding: 36px 16px; text-align: center; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink-2); margin-bottom: 4px; }

.pager { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.pager .btn { height: 30px; padding: 0 10px; }
.pager .spacer { flex: 1; }

/* ---------- filteri ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 12.5px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { font-family: var(--mono); font-size: 11.5px; opacity: .8; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.toolbar .search { max-width: 380px; }
.toolbar select, .toolbar input[type=date] { height: 34px; }

/* ---------- forme ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field label .req { color: var(--red); }
.field input, .field select, .field textarea { height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); width: 100%; min-width: 0; }
.field input[type=radio], .field input[type=checkbox] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
.field textarea { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--red); }
.field .error { display: none; font-size: 12px; color: var(--red); }
.field.invalid .error { display: block; }
.field .help { font-size: 12px; color: var(--ink-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding-top: 6px; flex-wrap: wrap; }
.form-actions .left { margin-right: auto; }
.form-error { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--red-soft); color: var(--red); font-size: 13px; }
.dup-warning { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--amber-soft); color: var(--amber); font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dup-warning.hard { background: var(--red-soft); color: var(--red); }
.dup-warning > svg { width: 18px; height: 18px; flex: none; }
.dup-warning > span { flex: 1; min-width: 200px; }
.radio-row { display: flex; gap: 14px; align-items: center; min-height: 38px; flex-wrap: wrap; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.quick-dates { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.quick-dates button { height: 26px; padding: 0 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); font-size: 12px; color: var(--ink-2); }
.quick-dates button:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- SIGNATURE: kartica recepta (OD/OS) ---------- */
.rx { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.rx-head { display: flex; align-items: baseline; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.rx-head .date { margin-left: auto; font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.rx-grid { display: grid; grid-template-columns: 64px repeat(5, minmax(0, 1fr)); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.rx-grid > div { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.rx-grid > div:nth-last-child(-n+6) { border-bottom: 0; }
.rx-grid .h { font-family: var(--font); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 8px; background: var(--surface); }
.rx-grid .eye { text-align: left; font-family: var(--font); font-weight: 600; padding-left: 16px; }
.rx-grid .eye small { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); }
.rx-grid .v { font-size: 20px; font-weight: 500; letter-spacing: -.01em; }
.rx-grid .v .d { display: block; font-size: 11px; font-weight: 500; margin-top: 2px; line-height: 1.2; }
.rx-grid .v .d.up { color: var(--red); }
.rx-grid .v .d.down { color: var(--accent); }
.rx-grid .v .d.same { color: var(--ink-3); }
.rx-grid .v.empty { color: var(--line-strong); }
.rx-foot { padding: 8px 16px; font-size: 12.5px; color: var(--ink-2); border-top: 1px solid var(--line); background: var(--surface-2); display: flex; gap: 14px; flex-wrap: wrap; }
.rx-mini { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.rx-mini b { font-family: var(--font); font-weight: 600; color: var(--ink-3); margin-right: 3px; }
.rx-empty { padding: 26px 16px; text-align: center; color: var(--ink-3); }

/* unos dioptrije u formi pregleda */
.rx-form { display: grid; grid-template-columns: 56px repeat(5, minmax(0, 1fr)); gap: 8px 6px; align-items: center; }
.rx-form .h { text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.rx-form .eye { font-weight: 600; }
.rx-form .eye small { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); }
.rx-form input { width: 100%; min-width: 0; height: 40px; text-align: center; font-family: var(--mono); font-size: 15px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.rx-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rx-form input.invalid { border-color: var(--red); background: var(--red-soft); }

/* ---------- profil klijenta ---------- */
.profile-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.profile-head .who { flex: 1; min-width: 240px; }
.profile-head .cid { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
.profile-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-head .contact { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; color: var(--ink-2); }
.profile-head .contact span { overflow-wrap: anywhere; }
.profile-head .contact a { color: inherit; }
.profile-head .contact svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 4px; color: var(--ink-3); }
.profile-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.dates { display: grid; grid-template-columns: 1fr 1fr; }
.dates > div { padding: 14px 16px; }
.dates > div + div { border-left: 1px solid var(--line); }
.dates .big { font-family: var(--mono); font-size: 20px; font-weight: 500; margin-top: 2px; }
.dates .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.section-title h2 { flex: 1; }
.timeline { display: flex; flex-direction: column; }
.timeline .item { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: start; }
.timeline .item:last-child { border-bottom: 0; }
.timeline .when { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.timeline .who { font-size: 12px; color: var(--ink-3); }
.timeline .body { white-space: pre-wrap; word-break: break-word; }
.note-item { padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.note-item:last-child { border-bottom: 0; }
.note-item.pinned { background: #FFFBEB; }
.note-item .meta { font-size: 12px; color: var(--ink-3); grid-column: 1; }
.note-item .body { white-space: pre-wrap; word-break: break-word; grid-column: 1; }
.note-item .tools { grid-column: 2; grid-row: 1 / 3; display: flex; gap: 2px; align-self: start; }
.pin { color: var(--amber); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-right: 6px; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(19, 28, 38, .45); z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; min-width: 0; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; font-size: 12.5px; color: var(--ink-3); }

/* ---------- toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 360px; animation: toast-in .18s ease-out; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- audit ---------- */
.diff { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; background: var(--surface-2); padding: 8px 10px; border-radius: var(--radius-sm); margin: 0; }
.diff .k { color: var(--ink-3); }
.diff .old { color: var(--red); text-decoration: line-through; }
.diff .new { color: var(--green); }

/* ---------- donja navigacija (telefon) ---------- */
.bottom-nav { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: min(280px, 85vw); transform: translateX(-100%); transition: transform .18s ease-out; box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar-scrim { position: fixed; inset: 0; background: rgba(19, 28, 38, .4); z-index: 55; }
  .topbar { grid-column: 1; padding: 0 12px; gap: 8px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar .brand-mini { display: none; }
  .search kbd { display: none; }
  .topbar .btn-new span { display: none; }
  .user-chip .name, .user-chip .role { display: none; }
  .content { grid-column: 1; padding: 14px 12px 84px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .show-m { display: initial; }
  .sidebar-foot { display: none; }
  .rx-mini { white-space: normal; }
  .banner { flex-wrap: wrap; }
  .banner .btn { width: 100%; margin-left: 0; }
  .dates { grid-template-columns: 1fr; }
  .dates > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .timeline .item { grid-template-columns: 1fr; }
  .rx-grid { grid-template-columns: 48px repeat(5, minmax(0, 1fr)); }
  .rx-grid .v { font-size: 16px; }
  .rx-grid > div { padding: 8px 4px; }
  .rx-grid .eye { padding-left: 10px; }
  .rx-form { grid-template-columns: 44px repeat(5, minmax(0, 1fr)); gap: 6px 4px; }
  .rx-form input { font-size: 14px; height: 38px; padding: 0 4px; }
  .modal-backdrop { padding: 0; justify-content: flex-end; }
  .modal { max-width: none; border-radius: 12px 12px 0 0; max-height: 96vh; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: 60px; background: var(--surface); border-top: 1px solid var(--line); z-index: 50; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; color: var(--ink-3); font-weight: 500; }
  .bottom-nav a svg { width: 20px; height: 20px; }
  .bottom-nav a.active { color: var(--accent); }
  .toasts { left: 12px; right: 12px; bottom: 72px; }
  .toast { max-width: none; }
  .hide-m { display: none !important; }
  .page-head .actions { width: 100%; }
}
@media (max-width: 520px) {
  .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .value { font-size: 24px; }
  .profile-head { padding: 14px; }
  h1 { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .toasts, .btn, .profile-head .actions { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
}

/* red sa danom u tabeli termina */
.tbl tr.day-row td { background: var(--surface-2); font-weight: 600; padding: 8px 12px; }
.tbl tr.day-row td span { font-weight: 400; color: var(--ink-3); margin-left: 8px; font-size: 12.5px; }
