:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --ink: #1b2926;
  --ink-2: #3d4b47;
  --muted: #6d7a76;
  --line: #e3dfd4;
  --line-2: #eeebe3;
  --brand: #1f4d43;
  --brand-2: #2c6658;
  --brand-ink: #e8f0ec;
  --accent: #d99a2b;
  --accent-soft: #fbf0d9;
  --ok: #23845a;
  --ok-bg: #e2f3ea;
  --eval: #3866b0;
  --eval-bg: #e6eef9;
  --year: #8a4fb0;
  --year-bg: #f1e8f8;
  --warn: #b7791f;
  --warn-bg: #fdf1dc;
  --danger: #c0392b;
  --danger-bg: #fbe7e4;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(27, 41, 38, .05), 0 6px 20px -10px rgba(27, 41, 38, .18);
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar: 252px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ───── распоред ───── */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.shell > div { min-width: 0; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--brand);
  background-image: radial-gradient(120% 60% at 0% 0%, rgba(255,255,255,.07), transparent 60%);
  color: var(--brand-ink);
  display: flex; flex-direction: column; padding: 22px 14px;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 10px 22px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.1);
  display: grid; place-items: center; color: #f2c46d;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-weight: 800; font-size: 15px; line-height: 1.2; color: #fff; }
.brand-sub { font-size: 12px; opacity: .7; line-height: 1.3; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--brand-ink); text-decoration: none; font-weight: 600; font-size: 14.5px; opacity: .82;
  transition: background .15s, opacity .15s;
}
.nav a:hover { background: rgba(255,255,255,.07); opacity: 1; }
.nav a.active { background: rgba(255,255,255,.13); opacity: 1; color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .5; padding: 16px 12px 6px; font-weight: 700; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 14px 8px 0; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #3a2a08;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none;
}
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; font-size: 13.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 12px; opacity: .65; }
.icon-btn {
  border: 0; background: transparent; color: inherit; width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center; cursor: pointer; opacity: .8;
}
.icon-btn:hover { background: rgba(127,127,127,.14); opacity: 1; }

.main { min-width: 0; padding: 28px 36px 120px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; font-weight: 800; }
.topbar .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.topbar .tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mobile-bar { display: none; }

/* ───── контроле ───── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: #cfc9ba; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #2f2005; }
.btn.accent:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); border-color: #f0c4be; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, select.input, textarea.input {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s; width: 100%;
}
textarea.input { height: auto; min-height: 70px; padding: 10px 12px; resize: vertical; }
select.input { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236d7a76' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(44,102,88,.15); }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }

.seg { display: inline-flex; background: #ebe8df; border-radius: 11px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 0 14px; height: 34px; border-radius: 8px; cursor: pointer;
  font-weight: 700; font-size: 13.5px; color: var(--muted); white-space: nowrap;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.card h2 { margin: 0 0 4px; font-size: 17px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 99px;
  font-size: 12.5px; font-weight: 700; background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.eval { background: var(--eval-bg); color: var(--eval); }
.pill.year { background: var(--year-bg); color: var(--year); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.off { background: var(--danger-bg); color: var(--danger); }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.empty .big svg { width: 28px; height: 28px; }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-size: 18px; }

/* ───── пријава ───── */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  background: var(--brand);
  background-image:
    radial-gradient(90% 70% at 10% 0%, rgba(255,255,255,.08), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(255,255,255,.045) 31px 32px);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-art h1 { font-size: 42px; line-height: 1.1; letter-spacing: -.03em; margin: 0 0 14px; max-width: 12em; }
.login-art p { opacity: .8; max-width: 30em; font-size: 16px; }
.login-art .months-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.login-art .months-strip span { padding: 6px 12px; border-radius: 99px; background: rgba(255,255,255,.09); font-size: 13px; font-weight: 600; }
.login-art .months-strip span.hl { background: var(--accent); color: #2f2005; }
.login-form { display: grid; place-items: center; padding: 32px; }
.login-form form { width: 100%; max-width: 360px; }
.login-form h2 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.02em; }
.error-box { background: var(--danger-bg); color: var(--danger); padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; }

/* ───── моји планови ───── */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.pcards { display: flex; flex-direction: column; gap: 16px; }
.pcard { padding: 18px 20px 20px; }
.pcard-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.pcard-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.progress { display: flex; align-items: center; gap: 10px; margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 700; }
.progress .bar { width: 120px; height: 7px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress .bar > div { height: 100%; background: var(--ok); border-radius: 99px; }
.pgrid { display: grid; grid-template-columns: 150px repeat(10, minmax(64px, 1fr)); gap: 6px; align-items: stretch; }
.pgrid .mh { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .04em; padding-bottom: 2px; }
.pgrid .mh.now { color: var(--accent); }
.pgrid .rowlabel { font-size: 13px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; }
.slot {
  border: 1.5px dashed #d6d1c4; background: var(--surface-2); border-radius: 10px; min-height: 46px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  cursor: pointer; font-size: 11.5px; font-weight: 700; color: #a29d90; padding: 4px; transition: all .12s;
}
.slot:hover { border-color: var(--brand-2); color: var(--brand-2); background: #fff; }
.slot svg.i { width: 16px; height: 16px; }
.slot.done { border-style: solid; }
.slot.done.mesecni { background: var(--ok-bg); border-color: #b9dfc9; color: var(--ok); }
.slot.done.evaluacija { background: var(--eval-bg); border-color: #c3d4ef; color: var(--eval); }
.slot.done.godisnji { background: var(--year-bg); border-color: #dcc7ea; color: var(--year); }
.slot.done:hover { filter: brightness(.97); }
.slot .d { font-weight: 600; font-size: 11px; opacity: .85; }
.yearly-slot { flex-direction: row; gap: 10px; justify-content: flex-start; padding: 0 14px; font-size: 13px; }
.pgrid .span-all { grid-column: 2 / -1; }

/* ───── преглед ───── */
.filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; padding: 16px; }
.filters .search { grid-column: span 2; }
.view-bar { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; flex-wrap: wrap; }
.group { margin-bottom: 18px; }
.group-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line-2);
  font-weight: 800; font-size: 15px; background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0;
}
.group-head .count { color: var(--muted); font-weight: 700; font-size: 13px; }
.prow { display: grid; grid-template-columns: 28px 40px 1fr auto auto auto; gap: 14px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line-2); }
.prow:last-child { border-bottom: 0; }
.prow:hover { background: #fcfbf8; }
.prow.sel { background: #f3f8f5; }
.ext {
  width: 40px; height: 44px; border-radius: 8px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800;
  letter-spacing: .03em; color: #fff; text-transform: uppercase; position: relative;
}
.ext.w { background: #2b5797; } .ext.x { background: #1e7145; } .ext.p { background: #c0392b; } .ext.o { background: #6d7a76; }
.prow .t { font-weight: 700; font-size: 14.5px; }
.prow .s { color: var(--muted); font-size: 13px; }
.prow .date { font-size: 13px; color: var(--ink-2); text-align: right; white-space: nowrap; }
.prow .date .edited { color: var(--accent); font-weight: 700; }
.prow .size { font-size: 12.5px; color: var(--muted); width: 64px; text-align: right; }
.prow .acts { display: flex; gap: 2px; }
.prow .acts .icon-btn { width: 34px; height: 34px; color: var(--ink-2); }

.actionbar {
  position: fixed; left: calc(var(--sidebar) + 36px); right: 36px; bottom: 20px; z-index: 20;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 12px 10px 20px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.45);
  transform: translateY(140%); transition: transform .22s cubic-bezier(.3,1.3,.6,1); flex-wrap: wrap;
}
.actionbar.show { transform: none; }
.actionbar b { font-size: 15px; }
.actionbar select.input { height: 38px; width: auto; background-color: rgba(255,255,255,.1); border-color: rgba(255,255,255,.15); color: #fff; }
.actionbar select.input option { color: var(--ink); }
.actionbar .btn.ghost { color: #fff; }
.actionbar .btn.ghost:hover { background: rgba(255,255,255,.1); }

/* ───── табела предаје ───── */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { padding: 18px 20px; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.stat .v small { font-size: 15px; color: var(--muted); font-weight: 700; }
.stat .bar { height: 6px; border-radius: 99px; background: var(--line-2); margin-top: 10px; overflow: hidden; }
.stat .bar > div { height: 100%; border-radius: 99px; }
.matrix-wrap { overflow-x: auto; }
table.matrix { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 860px; }
.matrix th, .matrix td { padding: 8px 6px; text-align: center; font-size: 13px; border-bottom: 1px solid var(--line-2); }
.matrix th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 800; background: var(--surface-2); position: sticky; top: 0; }
.matrix th:first-child, .matrix td:first-child { text-align: left; padding-left: 18px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.matrix th:first-child { background: var(--surface-2); }
.matrix td:first-child b { display: block; font-size: 14px; }
.matrix td:first-child span { font-size: 12px; color: var(--muted); }
.mcell {
  display: inline-flex; min-width: 46px; height: 30px; padding: 0 8px; border-radius: 8px; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12.5px; cursor: pointer; border: 0;
}
.mcell.full { background: var(--ok-bg); color: var(--ok); }
.mcell.part { background: var(--warn-bg); color: var(--warn); }
.mcell.none { background: #f3f1ec; color: #b0aa9c; }
.mcell.na { background: transparent; color: #cfcabe; cursor: default; }
.mcell:not(.na):hover { outline: 2px solid currentColor; outline-offset: 1px; }
.matrix th.now { color: var(--accent); }

/* ───── избор предмета ───── */
.picker { display: flex; flex-direction: column; gap: 18px; }
.picker .cat-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 800; margin-bottom: 6px; }
.picker .subj { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 10px; flex-wrap: wrap; }
.picker .subj:hover { background: var(--surface-2); }
.picker .subj.has { background: #f2f7f4; }
.picker .subj .nm { flex: 1; min-width: 180px; font-weight: 600; font-size: 14px; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  width: 32px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 800; font-size: 13px; cursor: pointer; color: var(--muted);
}
.chip:hover { border-color: var(--brand-2); color: var(--brand-2); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.ghost { visibility: hidden; }
.quick { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.quick b { color: #6b4a0c; }

/* ───── админ ───── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { border: 0; background: none; padding: 10px 16px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-color: var(--accent); }
table.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 800; }
.list td { padding: 11px 16px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.list tr:last-child td { border-bottom: 0; }
.list tr.inactive td { opacity: .55; }

/* ───── дијалози ───── */
dialog {
  border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); color: var(--ink); background: var(--surface);
}
dialog.wide { width: min(860px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(20, 32, 29, .45); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dlg-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 6px; }
.dlg-head h3 { margin: 0; font-size: 19px; letter-spacing: -.01em; flex: 1; }
.dlg-body { padding: 12px 22px 8px; display: flex; flex-direction: column; gap: 14px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; flex-wrap: wrap; }
.drop {
  border: 2px dashed #d3cdbf; border-radius: 14px; padding: 26px 16px; text-align: center; cursor: pointer;
  background: var(--surface-2); transition: all .15s; color: var(--muted);
}
.drop:hover, .drop.over { border-color: var(--brand-2); background: #f1f7f4; color: var(--brand-2); }
.drop b { color: var(--ink); }
.drop .file { display: flex; align-items: center; gap: 12px; text-align: left; color: var(--ink); }
.uprog { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; display: none; }
.uprog > div { height: 100%; width: 0; background: var(--brand-2); transition: width .1s; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }

#toasts { position: fixed; top: 18px; right: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); max-width: 380px; animation: pop .2s ease-out;
  display: flex; gap: 10px; align-items: center;
}
.toast.err { background: var(--danger); }
.toast.ok svg { color: #8de0b5; }

/* ───── мали екрани ───── */
@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pgrid { grid-template-columns: 110px repeat(10, minmax(56px, 1fr)); }
  .pcard { overflow-x: auto; }
  .pgrid { min-width: 720px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 50; left: 0; width: var(--sidebar); transform: translateX(-100%); transition: transform .2s; }
  .shell.menu-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 30; }
  .main { padding: 18px 16px 120px; }
  .actionbar { left: 12px; right: 12px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { padding: 32px 24px; }
  .login-art h1 { font-size: 30px; }
  .stats { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .prow { grid-template-columns: 24px 36px 1fr auto; }
  .prow .size, .prow .date { display: none; }
}
