:root {
  --bg: #000;
  --panel: #0e0e0e;
  --panel-2: #161616;
  --hover: #1c1c1c;
  --line: #242424;
  --line-2: #2e2e2e;
  --text: #ededed;
  --text-2: #a3a3a3;
  --muted: #737373;
  --accent: #f97316;
  --accent-bg: rgba(249, 115, 22, .12);
  --danger: #ef4444;
  --ok: #22c55e;

  /* barve podatkov (preverjene za temno ozadje in barvno slepoto) */
  --c-image: #25a35c;
  --c-video: #4f8ff7;
  --c-audio: #bd8a10;
  --c-bw: #e85555;
  --c-size: #9a6cec;

  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, Consolas, monospace;
  --r: 6px;
  --side: 232px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
#kname { min-width: 220px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- gumbi in polja ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--hover); border-color: #3a3a3a; }
.btn-primary { background: var(--text); color: #000; border-color: var(--text); }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn-ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); border-color: transparent; }
.btn-danger:hover { color: var(--danger); border-color: rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .08); }
.btn-icon { width: 32px; padding: 0; }
.input, .select {
  height: 32px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text); font-size: 13px;
}
.input:focus, .select:focus { outline: none; border-color: #4a4a4a; }
.select { padding-right: 28px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }
.badge {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px;
  background: #262626; color: var(--text-2); font: 500 11px/1 var(--mono);
}

/* ---------- ogrodje ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--bg);
}
.side-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px; border-bottom: 1px solid var(--line); }
.logo {
  width: 30px; height: 30px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line-2);
  display: grid; place-items: center; color: var(--accent);
}
.logo svg { width: 16px; height: 16px; }
.side-head b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.side-head small { color: var(--muted); font-size: 11.5px; }

.nav { padding: 8px 0; flex: 1; }
.nav-group { padding: 10px 0 4px; }
.nav-label { padding: 0 12px 6px; font: 500 10.5px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav a {
  display: flex; align-items: center; gap: 10px; height: 32px; margin: 1px 6px; padding: 0 10px;
  border-radius: var(--r); text-decoration: none; color: var(--text-2); font-size: 13.5px;
}
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-bg); color: var(--accent); }
.nav a .badge { margin-left: auto; }

.side-foot { border-top: 1px solid var(--line); padding: 10px; display: flex; align-items: center; gap: 10px; }
.side-foot img, .side-foot .ava {
  width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); flex: none;
  display: grid; place-items: center; font-weight: 600; font-size: 12px; color: var(--text-2);
}
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who small { color: var(--muted); font-size: 11.5px; }
.side-foot form { margin: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(0, 0, 0, .85);
  backdrop-filter: blur(8px); z-index: 5;
}
.topbar h1 { font-size: 14px; font-weight: 600; margin: 0; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 32px; max-width: 1600px; width: 100%; }
.page-intro { color: var(--text-2); margin: 0 0 20px; max-width: 70ch; }

/* ---------- nadzorna plošča ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 40px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 16px 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 4px 8px;
}
.stat-label { grid-column: 1 / -1; color: var(--text-2); font-size: 13.5px; }
.stat-value { white-space: nowrap; font-size: 24px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.spark { width: 72px; height: 34px; display: block; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.panel-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; }
.ptab {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: none; border: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; color: var(--text-2); font-weight: 500;
}
.ptab:hover { color: var(--text); }
.ptab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }
.chart-wrap { position: relative; padding: 20px 20px 16px; }
.chart { width: 100%; height: 280px; display: block; overflow: visible; }
.chart text { fill: var(--muted); font: 11.5px var(--font); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .cross { stroke: #525252; stroke-width: 1; stroke-dasharray: 3 3; }
.legend { display: flex; justify-content: center; gap: 18px; padding-top: 6px; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.tip {
  position: absolute; pointer-events: none; background: #171717; border: 1px solid var(--line-2);
  border-radius: var(--r); padding: 8px 10px; font-size: 12.5px; min-width: 140px; z-index: 3;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.tip b { display: block; font-weight: 500; margin-bottom: 4px; color: var(--text); }
.tip div { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.tip div span:last-child { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.scope-note { color: var(--muted); font-size: 12.5px; }

/* ---------- datoteke ---------- */
.dropbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 20px;
  border: 1px dashed var(--line-2); border-radius: 8px; background: var(--panel); cursor: pointer;
}
.dropbar:hover { border-color: #444; }
.dropbar .ico { width: 36px; height: 36px; border-radius: 8px; background: var(--panel-2); display: grid; place-items: center; color: var(--text-2); flex: none; }
.dropbar b { display: block; font-weight: 500; }
.dropbar small { color: var(--muted); }
.dropbar input { display: none; }
.drop-overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .75); display: grid; place-items: center;
  pointer-events: none;
}
.drop-overlay div {
  border: 2px dashed var(--accent); border-radius: 12px; padding: 48px 64px; text-align: center;
  background: rgba(249, 115, 22, .06); font-size: 18px; font-weight: 600;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #121212; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.muted { color: var(--text-2); white-space: nowrap; }
td.actions { text-align: right; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }

.fcell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.fthumb {
  width: 44px; height: 32px; border-radius: 4px; background: #1a1a1a; flex: none; overflow: hidden;
  display: grid; place-items: center; border: 0; padding: 0; cursor: zoom-in; color: var(--muted);
}
.fthumb img, .fthumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.fname { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; font-weight: 500; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fname:hover { text-decoration: underline; }
.tdot { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tdot::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--c, #666); }

.empty { padding: 56px 20px; text-align: center; color: var(--text-2); }
.empty b { display: block; color: var(--text); font-weight: 500; margin-bottom: 4px; }
.pager { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--line); }

/* vrsta nalaganj */
.uploads {
  position: fixed; right: 16px; bottom: 16px; width: 340px; max-width: calc(100vw - 32px); z-index: 30;
  background: #111; border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
}
.uploads-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 500; }
.uploads ul { list-style: none; margin: 0; padding: 4px 0; max-height: 280px; overflow-y: auto; }
.up { padding: 8px 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; }
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-state { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.up-bar { grid-column: 1 / -1; height: 3px; background: #262626; border-radius: 2px; overflow: hidden; }
.up-bar span { display: block; height: 100%; width: 0; background: var(--text); transition: width .15s linear; }
.up.done .up-bar span { background: var(--ok); width: 100%; }
.up.fail .up-bar span { background: var(--danger); width: 100%; }
.up.fail .up-state { color: var(--danger); }
.up a { color: var(--text); font-weight: 500; }

/* ---------- ključi, dnevnik, navodila ---------- */
.form-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; padding: 16px; }
.field { display: grid; gap: 6px; }
.field > span, .field legend { font-size: 12.5px; color: var(--text-2); padding: 0; }
fieldset.field { border: 0; margin: 0; padding: 0; }
.checks { display: flex; gap: 14px; height: 32px; align-items: center; }
.checks label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.reveal { margin: 0 16px 16px; padding: 14px; border: 1px solid rgba(249, 115, 22, .45); border-radius: var(--r); background: var(--accent-bg); display: grid; gap: 10px; }
.reveal p { margin: 0; }
.reveal code { font: 13px/1.4 var(--mono); background: #000; padding: 10px 12px; border-radius: 4px; word-break: break-all; user-select: all; }
.reveal .row { display: flex; gap: 8px; }
.section-gap { height: 24px; }
.form-hint { margin: -4px 16px 14px; color: var(--muted); font-size: 12.5px; }
.sub-title { font-size: 13.5px; font-weight: 600; margin: 0 0 10px; }

.member { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.member img, .member .ava {
  width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); flex: none;
  display: grid; place-items: center; font-weight: 600; font-size: 12px; color: var(--text-2);
}
.member b { display: block; font-weight: 500; }
tr.blocked .member { opacity: .55; }
td.actions .btn + .btn { margin-left: 6px; }

.ev { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.ev::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c, #737373); }

.gl-row { cursor: pointer; }
.gl-msg { max-width: 640px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl-meta td { background: var(--panel); padding-top: 0; }
.gl-meta pre { margin: 0; padding: 12px 14px; background: #000; border: 1px solid var(--line); border-radius: var(--r); font: 12.5px/1.6 var(--mono); color: #d4d4d4; white-space: pre-wrap; word-break: break-word; }

.docs { display: grid; gap: 28px; max-width: 900px; }
.docs h2 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.docs p { color: var(--text-2); margin: 0 0 12px; }
.code { position: relative; }
.code pre {
  margin: 0; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  font: 12.5px/1.6 var(--mono); color: #d4d4d4; overflow-x: auto;
}
.code .btn { position: absolute; top: 8px; right: 8px; height: 26px; font-size: 12px; }

/* predogled */
dialog {
  border: 1px solid var(--line-2); padding: 0; background: #0e0e0e; color: var(--text);
  border-radius: 10px; width: min(1000px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
}
dialog::backdrop { background: rgba(0, 0, 0, .8); }
.pv-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.pv-head b { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-media { background: #000; display: grid; place-items: center; min-height: 160px; }
.pv-media img, .pv-media video { max-height: 70vh; max-width: 100%; display: block; }
.pv-media audio { width: calc(100% - 48px); margin: 56px 24px; }
.pv-foot { display: flex; gap: 8px; padding: 12px; flex-wrap: wrap; align-items: center; }
.pv-foot .input { flex: 1; min-width: 200px; font-family: var(--mono); font-size: 12.5px; }
.pv-meta { width: 100%; color: var(--muted); font-size: 12.5px; }

/* kontekstni meni datoteke */
.ctx {
  position: fixed; z-index: 55; min-width: 220px; max-width: 280px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .6);
}
.ctx-head {
  padding: 6px 10px 8px; font: 500 11px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ctx-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%;
  padding: 7px 10px; border: 0; border-radius: var(--r); background: none; color: var(--text-2);
  font-size: 13.5px; text-align: left; cursor: pointer;
}
.ctx-item svg.i { color: var(--muted); }
.ctx-item:hover, .ctx-item:focus-visible { background: var(--hover); color: var(--text); outline: none; }
.ctx-item:hover svg.i, .ctx-item:focus-visible svg.i { color: var(--text-2); }
.ctx-item.danger:hover, .ctx-item.danger:focus-visible { color: var(--danger); background: rgba(239, 68, 68, .08); }
.ctx-item.danger:hover svg.i, .ctx-item.danger:focus-visible svg.i { color: var(--danger); }
.ctx-sep { height: 1px; margin: 5px 4px; background: var(--line); }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 16px); opacity: 0; z-index: 50;
  background: var(--text); color: #000; padding: 8px 14px; border-radius: var(--r); font-weight: 500; font-size: 13px;
  transition: opacity .18s, transform .18s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); color: #fff; }

/* ---------- prijava ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-box { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 32px 28px; }
.login-box .logo { margin-bottom: 20px; width: 40px; height: 40px; }
.login-box .logo svg { width: 20px; height: 20px; }
.login h1 { font-size: 20px; font-weight: 600; margin: 0 0 6px; letter-spacing: -.01em; }
.login p { color: var(--text-2); margin: 0 0 24px; }
.login .err { margin: 0 0 16px; padding: 10px 12px; border: 1px solid rgba(239, 68, 68, .35); background: rgba(239, 68, 68, .08); border-radius: var(--r); font-size: 13px; }
.btn-discord { width: 100%; height: 40px; background: #5865f2; border-color: #5865f2; color: #fff; font-size: 14px; }
.btn-discord:hover { background: #4752c4; border-color: #4752c4; }
.btn-discord svg { width: 18px; height: 18px; }
.login .or { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; color: var(--muted); font-size: 12.5px; }
.login .or::before, .login .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.login-form { display: grid; gap: 12px; }
.login-form .input, .login-form .btn { width: 100%; height: 38px; }

/* ---------- mobilno ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .6); }
  .menu-btn { display: inline-flex; }
  .content { padding: 20px 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 24px; }
  .stat { padding: 12px; grid-template-columns: 1fr; }
  .stat-value { font-size: 20px; }
  .spark { width: 100%; height: 26px; margin-top: 6px; }
  .chart { height: 220px; }
  .chart-wrap { padding: 14px 10px 12px; }
  .col-opt { display: none; }
  .fname { max-width: 150px; }
  .fcell { min-width: 0; }
  td, th { padding-left: 10px; padding-right: 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
