:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1d2330;
  --ink-2: #4a5263;
  --ink-3: #7b8394;
  --line: #e3e6ec;
  --line-2: #eef0f4;
  --side: #17202e;
  --side-ink: #c7cdd8;
  --side-active: #23324a;
  --accent: #0f6cbd;
  --accent-ink: #ffffff;
  --accent-soft: #e6f0fa;
  --red: #c4314b;
  --red-soft: #fdecef;
  --green: #107c41;
  --green-soft: #e7f4ec;
  --amber: #a15c00;
  --amber-soft: #fff4e0;
  --violet: #6b46c1;
  --row-hover: #f2f6fc;
  --row-sel: #e2edf9;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 13px/1.4 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
#app { height: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 18px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.red { color: var(--red); }
.green { color: var(--green); }
.amber { color: var(--amber); }
.grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- layout */
.shell { display: grid; grid-template-columns: 216px 1fr; height: 100%; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; overflow-y: auto; }
.brand { padding: 16px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand b { color: #fff; font-size: 17px; letter-spacing: -.01em; display: block; }
.brand b span { color: #5fb3ff; }
.brand small { color: #8792a6; font-size: 11px; }
.nav { padding: 8px 8px 16px; }
.nav h4 { margin: 14px 8px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6f7a8f; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; color: var(--side-ink); text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; }
.nav a svg { width: 16px; height: 16px; flex: none; opacity: .8; }
.side-foot { margin-top: auto; padding: 12px 16px; font-size: 11px; color: #6f7a8f; border-top: 1px solid rgba(255,255,255,.06); }

.main { display: flex; flex-direction: column; min-width: 0; height: 100%; }
.topbar { height: 52px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { flex: 1; overflow: auto; padding: 16px 20px 24px; }
.content.fill { display: flex; flex-direction: column; overflow: hidden; }

.season { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 12px; }
.season select { font-weight: 600; color: var(--ink); }
.user { position: relative; }
.user > button { display: flex; align-items: center; gap: 8px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 180px; padding: 4px; z-index: 50; }
.menu button, .menu a { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: none; border-radius: 5px; cursor: pointer; color: var(--ink); }
.menu button:hover, .menu a:hover { background: var(--row-hover); text-decoration: none; }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; white-space: nowrap; font-weight: 500; }
.btn:hover { border-color: #c9ced8; background: #fafbfc; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #0c5ba0; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-soft); border-color: #f2c2cc; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.04); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn svg { width: 15px; height: 15px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 6px 6px 0; }
.btn-group .btn.on { background: var(--accent-soft); border-color: #b9d3ef; color: var(--accent); position: relative; z-index: 1; }

.input, select.input, textarea.input { height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; min-width: 0; width: 100%; }
textarea.input { height: auto; min-height: 60px; padding: 6px 8px; resize: vertical; line-height: 1.45; }
.input:focus { outline: 2px solid #b9d3ef; outline-offset: -1px; border-color: var(--accent); }
.input[readonly] { background: #f7f8fa; color: var(--ink-2); }
.input.num { text-align: right; }
.search { position: relative; }
.search svg { position: absolute; left: 8px; top: 8px; width: 14px; height: 14px; color: var(--ink-3); }
.search .input { padding-left: 28px; }
label.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; user-select: none; }
label.chk input { margin: 0; }

.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > span { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.field > span .req { color: var(--red); }
.grid { display: grid; gap: 10px 12px; grid-template-columns: repeat(12, 1fr); }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; }
.c6 { grid-column: span 6; } .c8 { grid-column: span 8; } .c9 { grid-column: span 9; } .c12 { grid-column: span 12; }

.chip { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.blue { background: var(--accent-soft); color: var(--accent); }
.chip.violet { background: #f0ebfb; color: var(--violet); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.card-b { padding: 14px; }

/* ---------------------------------------------------------------- tabela */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.filters .field { width: auto; }
.table-wrap { flex: 1; min-height: 0; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
table.t th { position: sticky; top: 0; z-index: 2; background: #f8f9fb; text-align: left; font-weight: 600; font-size: 11.5px; color: var(--ink-2); padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
table.t th.sortable { cursor: pointer; }
table.t th.sortable:hover { color: var(--ink); }
table.t th .arrow { color: var(--accent); margin-left: 3px; }
table.t td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
table.t td.wrap { white-space: normal; }
table.t td:not(.wrap) { white-space: nowrap; }
table.t tbody tr { cursor: default; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr:hover td { background: var(--row-hover); }
table.t tbody tr.sel td { background: var(--row-sel); }
table.t tbody tr.dim td { color: var(--ink-3); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
table.t tfoot td { position: sticky; bottom: 0; background: #f8f9fb; font-weight: 600; border-top: 1px solid var(--line); padding: 7px 8px; white-space: nowrap; }
table.t .act { width: 1%; white-space: nowrap; text-align: right; }
.empty { padding: 40px; text-align: center; color: var(--ink-3); }
.pager { display: flex; gap: 8px; align-items: center; padding: 8px 2px 0; color: var(--ink-3); font-size: 12px; }
.marker { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }

/* ---------------------------------------------------------------- tabovi */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button .cnt { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--line-2); color: var(--ink-3); font-size: 11px; text-align: center; }
.tabs button.on .cnt { background: var(--accent-soft); color: var(--accent); }

/* ---------------------------------------------------------------- modal */
.overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, .38); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 100; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow-lg); width: 100%; max-width: 760px; display: flex; flex-direction: column; max-height: 88vh; }
.modal.wide { max-width: 1000px; }
.modal.narrow { max-width: 440px; }
.modal-h { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.modal-b { padding: 16px 18px; overflow-y: auto; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line-2); background: #fafbfc; border-radius: 0 0 10px 10px; }
.x { border: 0; background: none; cursor: pointer; font-size: 20px; line-height: 1; color: var(--ink-3); padding: 2px 6px; border-radius: 4px; }
.x:hover { background: var(--line-2); color: var(--ink); }

/* ---------------------------------------------------------------- autocomplete */
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 2px); background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; z-index: 120; }
.ac-list div { padding: 6px 9px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.ac-list div:hover, .ac-list div.on { background: var(--row-hover); }
.ac-list small { color: var(--ink-3); white-space: nowrap; }

/* ---------------------------------------------------------------- prijava */
.head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.head h1 { font-size: 20px; }
.split { display: grid; grid-template-columns: 1fr 280px; gap: 14px; align-items: start; }
.money { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.money .num { font-weight: 600; }
.money .big { font-size: 18px; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; }
details.more > summary { cursor: pointer; color: var(--accent); font-weight: 500; list-style: none; margin: 4px 0; }
details.more > summary::-webkit-details-marker { display: none; }

.toast-box { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #1d2330; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-lg); max-width: 420px; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

/* ---------------------------------------------------------------- prijava (login) */
.login { min-height: 100%; display: grid; place-items: center; background: linear-gradient(160deg, #17202e 0%, #1f3b5c 100%); padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login h1 { font-size: 24px; margin-bottom: 4px; }
.login h1 span { color: var(--accent); }

/* ---------------------------------------------------------------- izveštaji */
.bar { height: 10px; background: var(--accent); border-radius: 3px; min-width: 1px; opacity: .8; }
.stat { padding: 12px 14px; }
.stat .v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--ink-3); font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }

pre.pnr { font-family: var(--mono); font-size: 11.5px; background: #f7f8fa; border: 1px solid var(--line); border-radius: 6px; padding: 8px; max-height: 260px; overflow: auto; white-space: pre; margin: 0; }
.diff { font-family: var(--mono); font-size: 11.5px; }
.diff .o { color: var(--red); }
.diff .n { color: var(--green); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .split { grid-template-columns: 1fr; }
  .c2, .c3, .c4, .c5 { grid-column: span 6; }
  .c6, .c8, .c9 { grid-column: span 12; }
}

/* ---------------------------------------------------------------- automatski */
.drop { margin-top: 12px; border: 2px dashed #c9d3e0; border-radius: 10px; padding: 18px; text-align: center; cursor: pointer; background: #fafcff; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.warn { background: var(--amber-soft); color: var(--amber); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 12.5px; }
.auto-pax td { vertical-align: top; }
.btn.auto { background: #6b46c1; border-color: #6b46c1; color: #fff; }
.btn.auto:hover { background: #5a37ad; }
.modal.xwide { max-width: min(1320px, 96vw); }
.hscroll { overflow-x: auto; }

/* ---------------------------------------------------------------- pasoš */
.pasos-box { margin-bottom: 14px; }
.drop.small { margin-top: 0; padding: 10px 14px; text-align: left; }
.ok-box { background: var(--green-soft); color: var(--green); border-radius: 8px; padding: 8px 12px; font-size: 12.5px; }
.chip.amber { white-space: normal; }
.alert-red { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 10px 14px; font-weight: 600; font-size: 13px; margin-bottom: 12px; }
.alert-red.small-alert { padding: 5px 10px; font-size: 12px; margin: 0 0 4px; }
.ssr-line { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ssr-line pre.pnr { max-height: none; padding: 5px 8px; }
table.t tr.sub td { border-top: none; padding-top: 0; }
