/* Admin-panel – stil. Tokens øverst er kopi av .claude/skills/web-design/tokens.css (hold dem like). */

@font-face { font-family: "Barlow Condensed"; src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("fonts/barlow-condensed-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  color-scheme: dark;

  /* Grunn: mosegrønn kull (skogen i Rust), skilt med lyshetssteg – ikke med skygger */
  --ground:  #161b17;
  --surface: #1e2420;
  --raised:  #283029;
  --line:    #3d473f;   /* bare dekor/skillelinjer (1.6:1) – aldri eneste kant på et skjemafelt */
  --edge:    #6f7a6c;   /* kant på input, select og knapper uten fyll (≥ 3:1, WCAG 1.4.11) */

  /* Blekk */
  --ink:     #ece6d6;   /* bein-hvit, 14.0 / 12.7 / 10.9 */
  --soft:    #b4b09f;   /* dempet tekst, 8.0 / 7.3 / 6.3 */

  /* Aksent: glo. Under 5 % av skjermen. Som tekst bare på ground/surface (5.3 / 4.8) */
  --accent:    #e8643a;
  --on-accent: #161b17; /* tekst på aksentflate, 5.3 */

  /* Status – alltid sammen med tekst eller form, aldri farge alene */
  --ok:   #9fd36b;      /* 10.0 / 9.0 / 7.8 */
  --warn: #e8b84f;      /* 9.5 / 8.6 / 7.4 */
  --bad:  #f2786a;      /* 6.4 / 5.8 / 5.0 */
  --info: #8cc3e8;      /* 9.2 / 8.4 / 7.2 */
  --danger-fill: #8a2c22; /* fyll på farlige knapper, --ink på toppen 6.8 */

  /* Typografi: to familier. Mono bare for ekte kode/kommandoer */
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif-condensed, sans-serif;
  --font-body: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Størrelser: få og langt fra hverandre (nettside), tettere i verktøy */
  --text-sm: 0.875rem;  /* 14 px – minste tekst, bare i verktøy/tabeller */
  --text-md: 1.0625rem; /* 17 px – brødtekst nettside */
  --text-lg: 1.375rem;  /* 22 px – utsagn/ingress */
  --text-xl: clamp(2rem, 4vw, 3rem);
  --text-display: clamp(3.5rem, 11vw, 9rem);

  /* Avstand: 4/8-skala */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px; --s9: 120px;
  --gutter: clamp(1rem, 2.2vw, 2rem);

  /* Form: rett eller helt rund – ikke «myk 12 px» overalt */
  --radius: 4px;
  --radius-pill: 999px;
  --focus: 0 0 0 3px var(--ground), 0 0 0 5px var(--ink);

  /* Bevegelse */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --t-press: 140ms; --t-hover: 180ms; --t-ui: 240ms; --t-reveal: 700ms;

  /* Lag */
  --z-sticky: 20; --z-toast: 100;
}

/* ---------- Panel-spesifikt ---------- */
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
:root {
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --log-bg: #101411;
  /* Kartmarkører: egne farger, valgt for å skille seg fra hverandre og fra kartet */
  --m-online: var(--ok); --m-sleeping: #d6d2c4; --m-tc: #e8963a; --m-tc-bad: var(--bad); --m-bag: #c19be8;
  --warn-fill: #3a3016; --warn-edge: #6b5a24;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 15px/1.5 var(--font-body); }
a { color: var(--accent); text-underline-offset: .2em; }
:focus-visible { outline: none; box-shadow: var(--focus); }
html { scroll-padding-top: 72px; }
.hidden { display: none !important; }
.muted { color: var(--soft); font-weight: normal; }
.mono { font-family: var(--font-mono); font-size: 13px; }
code { font-family: var(--font-mono); font-size: .9em; background: var(--raised); padding: 0 .3em; border-radius: var(--radius); }
h1, h2 { margin: 0 0 var(--s3); font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; line-height: 1.1; }
h1 { font-size: 34px; font-weight: 800; }
h2 { font-size: 22px; margin-top: var(--s5); }
h2 .muted { font-family: var(--font-body); font-size: 14px; letter-spacing: 0; }

.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--s4); }
.card { background: var(--surface); border-radius: var(--radius); padding: var(--s6); text-align: center; max-width: 360px; width: 100%; }
.card h1 { margin-bottom: var(--s2); }

header { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; justify-content: space-between; padding: var(--s2) var(--s4); background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: var(--z-sticky); }
.brand { font: 800 22px/1 var(--font-display); display: flex; align-items: center; gap: var(--s2); }
nav { display: flex; gap: var(--s1); overflow-x: auto; max-width: 100%; }
nav button { background: none; border: 0; color: var(--soft); min-height: 36px; padding: 0 var(--s3); border-radius: var(--radius); cursor: pointer; font: inherit; white-space: nowrap; }
nav button:hover { color: var(--ink); }
nav button.active { color: var(--ink); background: var(--raised); box-shadow: inset 0 -2px 0 var(--accent); }
.user { display: flex; gap: var(--s2); align-items: center; color: var(--soft); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); display: inline-block; }
.dot.on { background: var(--ok); }

main { padding: var(--s4); max-width: 1200px; margin: 0 auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s2); }
.stat { background: var(--surface); border-radius: var(--radius); padding: var(--s3); }
.stat .label { color: var(--soft); font-size: 13px; }
.stat .value { font: 600 26px/1.15 var(--font-display); margin-top: var(--s1); font-variant-numeric: tabular-nums; }

.row { display: flex; gap: var(--s2); align-items: center; margin-top: var(--s3); }
.row.between { justify-content: space-between; } .row.between h2 { margin: 0; }
input, select, textarea { background: var(--ground); border: 1px solid var(--edge); color: var(--ink); padding: 0 var(--s3); min-height: 38px; border-radius: var(--radius); font: inherit; }
input { flex: 1; min-width: 0; }
textarea { padding: var(--s2) var(--s3); }
input::placeholder, textarea::placeholder { color: var(--soft); opacity: .8; }
.btn { background: var(--raised); color: var(--ink); border: 1px solid var(--edge); min-height: 38px; padding: 0 var(--s4); border-radius: var(--radius); cursor: pointer; font: 600 15px/1 var(--font-body); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; touch-action: manipulation; }
.btn:hover { background: var(--line); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn.danger { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--ink); }
.btn.small { min-height: 32px; padding: 0 var(--s3); font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.tag { display: inline-block; padding: 1px var(--s2); border-radius: var(--radius); font-size: 13px; font-weight: 600; background: var(--raised); }
.tag.bad { color: var(--bad); } .tag.ok { color: var(--ok); } .tag.warn { color: var(--warn); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th { color: var(--soft); font-weight: 600; font-size: 13px; background: var(--surface); }
td.actions { text-align: right; display: flex; gap: var(--s2); justify-content: flex-end; }

.log { background: var(--log-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3); height: 55vh; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.log .line { padding: 1px 0; }
.log .time { color: var(--soft); margin-right: var(--s2); font-variant-numeric: tabular-nums; }
.log .warn { color: var(--warn); } .log .err { color: var(--bad); }
.log .who { color: var(--info); font-weight: 600; margin-right: 6px; }
.log .team { color: var(--ok); }

.candidates { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s3); }
.cand { background: var(--surface); border: 2px solid transparent; border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.cand.chosen { border-color: var(--ok); }
.cand img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: var(--log-bg); display: block; }
.cand .body { padding: var(--s3); display: flex; flex-direction: column; gap: var(--s1); flex: 1; }
.cand .title { font-weight: 700; }
.cand .votes { font: 600 24px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.cand .small { font-size: 13px; color: var(--soft); }
.warn-box { background: var(--warn-fill); border: 1px solid var(--warn-edge); color: var(--ink); padding: var(--s3); border-radius: var(--radius); margin-top: var(--s3); }
label.check { display: flex; gap: 6px; align-items: center; white-space: nowrap; color: var(--soft); min-height: 32px; cursor: pointer; }
label.check input { flex: none; min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }

.map-layout { display: grid; grid-template-columns: 1fr 280px; gap: var(--s3); margin-top: var(--s3); }
.map-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); height: 72vh; background: #0b1a24; }
.map { position: relative; width: 100%; }
.map img { width: 100%; height: auto; display: block; user-select: none; }
#map-markers { position: absolute; inset: 0; }
.marker { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; cursor: pointer; border: 1px solid rgba(0, 0, 0, .6); }
.marker.online { width: 10px; height: 10px; background: var(--m-online); }
.marker.sleeping { width: 8px; height: 8px; background: var(--m-sleeping); }
.marker.tc { width: 9px; height: 9px; background: var(--m-tc); border-radius: 2px; }
.marker.tc.violation { background: var(--m-tc-bad); width: 12px; height: 12px; box-shadow: 0 0 0 3px rgba(242, 120, 106, .35); }
.marker.bag { width: 6px; height: 6px; background: var(--m-bag); }
.marker:hover { outline: 2px solid var(--ink); z-index: 2; }
.legend { list-style: none; padding: 0; margin: var(--s3) 0 0; display: grid; gap: var(--s2); color: var(--ink); }
.legend li { display: flex; align-items: center; gap: var(--s2); }
.legend .marker { position: static; transform: none; display: inline-block; cursor: default; flex: none; }
.map-info { background: var(--surface); border-radius: var(--radius); padding: var(--s3); max-height: 72vh; overflow-y: auto; }
.map-info h3 { margin: 0 0 var(--s2); font: 600 20px/1.1 var(--font-display); }
.map-info ul { margin: 6px 0; padding-left: 18px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s2); }
.tool { background: var(--surface); border-radius: var(--radius); padding: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.tool .cmd { font-size: 13px; color: var(--soft); overflow-wrap: anywhere; }
#cfg-raw { width: 100%; min-height: 50vh; margin-top: var(--s3); }
.cfg-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: var(--s3) 0; padding: var(--s2) var(--s3); }
.cfg-form legend { color: var(--soft); font-size: 13px; padding: 0 6px; }
.cfg-field { display: grid; grid-template-columns: minmax(180px, 40%) 1fr; gap: var(--s3); align-items: center; padding: var(--s1) 0; }
.cfg-field label { font-size: 14px; }
.cfg-field textarea { min-height: 60px; }
@media (max-width: 800px) { .map-layout { grid-template-columns: 1fr; } .cfg-field { grid-template-columns: 1fr; } }

.toast { position: fixed; bottom: var(--s4); left: 50%; transform: translateX(-50%); background: var(--raised); border: 1px solid var(--edge); padding: var(--s3) var(--s4); border-radius: var(--radius); max-width: calc(100% - 32px); z-index: var(--z-toast); }
.toast.error { border-color: var(--bad); }

@media (max-width: 640px) {
  header { padding: var(--s2) var(--s3); } main { padding: var(--s3); }
  .user #me { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .btn:active { transform: none; }
}
