/* AlesLab Admin — temna, gosta, tehnična plošča. Brez zunanjih virov. */
:root {
  --bg: #0b0e14;
  --bg-2: #0f141d;
  --surface: #131926;
  --surface-2: #182031;
  --line: #212b3d;
  --line-2: #2c3850;
  --text: #e6edf3;
  --muted: #7f8b9e;
  --muted-2: #5a6577;
  --accent: #2dd4bf;
  --accent-dim: #134e4a;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --info: #60a5fa;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --r: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.err { color: var(--err); min-height: 1.2em; margin: 8px 0 0; font-size: 13px; }
a { color: var(--accent); }

/* ---------- gumbi in polja ---------- */
.btn {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: #1e2839; border-color: #3a4a68; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #04211d; border-color: transparent; font-weight: 600; }
.btn.primary:hover { background: #5ee7d6; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: #ffdcdc; border-color: #5b2a2a; background: #2a1414; }
.btn.danger:hover { background: #3a1a1a; border-color: #7a3a3a; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.on { border-color: var(--accent); color: var(--accent); }

.icon-btn {
  background: none; border: 0; color: var(--muted); font-size: 18px;
  cursor: pointer; padding: 4px 8px; border-radius: 6px; line-height: 1;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

input, select, textarea {
  font: inherit; width: 100%;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { font-family: var(--mono); font-size: 13px; resize: vertical; min-height: 80px; }
label { display: block; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
label input, label select, label textarea { margin-top: 5px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.chk input { width: auto; }

/* ---------- prijava ---------- */
.gate {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1000px 600px at 50% -10%, #16283a 0%, var(--bg) 60%);
}
.gate-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 28px;
  box-shadow: var(--shadow);
}
.gate-mark { display: block; border-radius: 13px; }
.side-head .mark { border-radius: 6px; display: block; }
.gate-card h1 { font-size: 21px; margin: 10px 0 2px; letter-spacing: -.2px; }
.gate-card p { margin: 0 0 6px; font-size: 13px; }

/* ---------- ogrodje ---------- */
.shell { display: grid; grid-template-columns: 258px 1fr; height: 100%; }

.side {
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 12px;
  overflow-y: auto;
}
.side-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 14px; }
.side-head .mark { color: var(--accent); }
.side-head strong { letter-spacing: .3px; }
.side-head .icon-btn { margin-left: auto; }

.server-list { display: flex; flex-direction: column; gap: 4px; }
.srv {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: 9px;
  padding: 9px 10px; color: var(--text); font: inherit;
}
.srv:hover { background: var(--surface); }
.srv.active { background: var(--surface-2); border-color: var(--line-2); }
.srv-top { display: flex; align-items: center; gap: 7px; }
.srv-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-meta { font-size: 11.5px; color: var(--muted-2); font-family: var(--mono); margin-top: 3px; }
.srv-badge { font-size: 11px; padding: 1px 6px; border-radius: 20px; background: #3a2416; color: var(--warn); }
.srv-move { margin-left: auto; display: flex; gap: 1px; opacity: 0; transition: opacity .12s; flex: none; }
.srv:hover .srv-move, .srv.active .srv-move { opacity: 1; }
.icon-btn.tiny { font-size: 12px; padding: 1px 4px; }
.srv.dragging { opacity: .45; }
.srv[draggable="true"] { cursor: grab; }
@media (hover: none) { .srv-move { opacity: 1; } }

.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; }
.side-link {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: 13.5px;
  text-align: left; padding: 7px 10px; border-radius: 7px; cursor: pointer;
}
.side-link:hover { background: var(--surface); color: var(--text); }

.main { display: flex; flex-direction: column; min-width: 0; height: 100%; }
.top {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px;
  border-bottom: 1px solid var(--line); background: var(--bg-2);
  position: sticky; top: 0; z-index: 5;
}
.top-title { font-weight: 600; display: flex; align-items: center; gap: 9px; min-width: 0; }
.top-title .sub { color: var(--muted); font-weight: 400; font-size: 13px; font-family: var(--mono); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.search { width: 190px; padding: 6px 10px; font-size: 13.5px; }
.view { padding: 18px; overflow-y: auto; flex: 1; }
.only-mobile { display: none; }

/* ---------- trak z metrikami ---------- */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 13px;
}
.tile-k { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted-2); }
.tile-v { font-family: var(--mono); font-size: 20px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.tile-v small { font-size: 12px; color: var(--muted); }
.bar { height: 3px; background: var(--line); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.bar > i.w { background: var(--warn); }
.bar > i.e { background: var(--err); }

/* ---------- opozorila ---------- */
.warns { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.warn-row {
  display: flex; align-items: center; gap: 9px; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--muted); border-radius: 8px; padding: 8px 12px;
}
.warn-row.error { border-left-color: var(--err); }
.warn-row.warn { border-left-color: var(--warn); }
.warn-row.info { border-left-color: var(--info); }
.warn-row .dismiss { margin-left: auto; }
.warn-row.clickable { cursor: pointer; }
.warn-row.clickable:hover { background: var(--surface-2); border-color: var(--line-2); }
.warn-row .wt { min-width: 0; }
.warn-row .wtools { margin-left: auto; display: flex; gap: 7px; align-items: center; flex: none; }
.warn-row .go { white-space: nowrap; }
.warn-row.clickable:hover .go { color: var(--accent); }

/* ---------- skupine in kartice ---------- */
.group { margin-bottom: 22px; }
.group-h {
  display: flex; align-items: center; gap: 9px; margin: 0 0 10px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted-2);
}
.group-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 11px; }

.card {
  position: relative; cursor: pointer; text-align: left; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px 12px 16px; overflow: hidden;
  transition: border-color .12s, background .12s;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--muted-2);
}
.card.up::before { background: var(--ok); }
.card.down::before { background: var(--err); }
.card.idle::before { background: var(--muted-2); }
.card:hover { border-color: var(--line-2); background: var(--surface-2); }
.card-top { display: flex; align-items: center; gap: 8px; }
.card-name { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; }
.card-dom { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-stats { display: flex; gap: 12px; margin-top: 9px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.card-stats b { color: var(--text); font-weight: 500; }
.pill { font-size: 10.5px; padding: 1px 6px; border-radius: 20px; }
.pill.warn { background: #3a2a10; color: var(--warn); }
.pill.err { background: #3a1616; color: var(--err); }
.pill.ok { background: #10301f; color: var(--ok); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); flex: none; }
.dot.up { background: var(--ok); box-shadow: 0 0 0 3px rgba(74, 222, 128, .13); }
.dot.down { background: var(--err); box-shadow: 0 0 0 3px rgba(248, 113, 113, .13); }

.empty { color: var(--muted); text-align: center; padding: 50px 20px; }

/* ---------- tabela ---------- */
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted-2); font-weight: 500; padding: 7px 10px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg);
}
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:hover td { background: var(--surface); }
table.t td.mono, table.t td .mono { font-family: var(--mono); font-size: 12.5px; }
.scroll-x { overflow-x: auto; }

/* ---------- predal ---------- */
.panel { position: fixed; inset: 0; z-index: 40; display: flex; justify-content: flex-end; }
.panel-back { position: absolute; inset: 0; background: rgba(4, 6, 10, .6); backdrop-filter: blur(2px); }
.panel-body {
  position: relative; width: min(760px, 100%); background: var(--bg-2);
  border-left: 1px solid var(--line); display: flex; flex-direction: column;
  box-shadow: var(--shadow); animation: slide .16s ease-out;
}
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.panel-head { display: flex; align-items: flex-start; gap: 12px; padding: 15px 18px 12px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head .icon-btn { margin-left: auto; }
.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted);
  font: inherit; font-size: 13.5px; padding: 10px 13px; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; min-height: 0; }

.kv { display: grid; grid-template-columns: 138px 1fr; gap: 7px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.sec-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted-2); margin: 20px 0 9px; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- logi ---------- */
.log-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.log-out {
  flex: 1; min-height: 240px; overflow: auto; background: #080b11;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.log-out .l-err { color: #ff9d9d; }
.log-out .l-warn { color: #ffd08a; }
.log-out .l-ok { color: #93e6b0; }
.log-out mark { background: #4a3c12; color: #ffe9a8; }

/* ---------- terminal ---------- */
.term-wrap { flex: 1; min-height: 300px; background: #080b11; border: 1px solid var(--line); border-radius: 8px; padding: 8px; overflow: hidden; }
.term-wrap .xterm { height: 100%; }

/* ---------- AI chat ---------- */
.chat { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 11px; padding-bottom: 8px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 11px; font-size: 14px; }
.msg.user { align-self: flex-end; background: var(--accent-dim); border: 1px solid #1c6b63; }
.msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.msg.tool { align-self: flex-start; background: transparent; border: 1px dashed var(--line-2); color: var(--muted); font-family: var(--mono); font-size: 11.5px; padding: 5px 9px; }
.msg pre { background: #080b11; border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; overflow-x: auto; font-family: var(--mono); font-size: 12px; margin: 8px 0; }
.msg code { font-family: var(--mono); font-size: 12.5px; background: #0c1017; padding: 1px 4px; border-radius: 4px; }
.msg pre code { background: none; padding: 0; }
.msg p { margin: 6px 0; }
.msg p:first-child { margin-top: 0; }
.msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 6px 0; padding-left: 20px; }
.chat-in { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--line); }
.chat-in textarea { min-height: 42px; max-height: 180px; font-family: var(--sans); font-size: 14px; }
.chat-note { font-size: 11.5px; color: var(--muted-2); margin-top: 7px; }
.typing::after { content: "▋"; animation: blink 1s steps(2) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- modalno ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; }
.modal-back { position: absolute; inset: 0; background: rgba(4, 6, 10, .65); }
.modal-card {
  position: relative; width: min(560px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 13px;
  padding: 0 20px 20px; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; position: sticky; top: 0; background: var(--surface); padding: 16px 0 12px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .icon-btn { margin-left: auto; }

/* ---------- obvestila ---------- */
.toasts { position: fixed; bottom: 16px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 10px 14px; font-size: 13.5px; max-width: 380px;
  box-shadow: var(--shadow); animation: rise .15s ease-out;
}
.toast.err { border-left-color: var(--err); }
.toast.ok { border-left-color: var(--ok); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------- mobilno ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 30;
    transform: translateX(-100%); transition: transform .18s ease-out;
  }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .only-mobile { display: inline-block; }
  .search { width: 120px; }
  .view { padding: 14px; }
  .cards { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
  .panel-body { width: 100%; border-left: 0; }
}

/* ---------- modul INFO (public/info.js) ---------- */
.info-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.info-search { flex: 1 1 240px; min-width: 150px; padding: 7px 11px; font-size: 14px; }
.info-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

/* dejstva na kartici zapisa: kopirljiva polja, povezave, gesla */
.info-facts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.info-facts .pill {
  font: inherit; font-family: var(--mono); font-size: 11px; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 20px;
  padding: 2px 8px; cursor: pointer; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.info-facts .pill:hover { color: var(--text); border-color: var(--accent); }
.info-facts .pill.link { color: var(--accent); }
.info-facts .pill.secret { letter-spacing: 2px; }

/* vrstica z vrednostjo (geslo, URL) + gumbi */
.info-sec { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.info-sec code {
  font-family: var(--mono); font-size: 12.5px; background: #080b11;
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; word-break: break-all;
}
.info-note {
  white-space: pre-wrap; font-size: 13.5px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
}

/* seznami v modalnih oknih (dogajanje, zgodovina, projekti, kategorije) */
.info-log { display: flex; flex-direction: column; gap: 6px; }
.info-hist { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; }
.info-hist .row > .btn { flex: 0 0 auto; }
.info-hist .row > span:first-child { flex: 1 1 120px; font-weight: 600; font-size: 14px; }
