/* Solvlab Arkiv. Et internt verktoy - lesbarhet foran uttrykk.
   Det viktigste elementet på hele nettstedet er kostnadstabellen: den skal
   være umulig å klikke seg forbi uten å ha sett den. */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #dce0e6;
  --border-strong: #c3c9d2;
  --text: #1b1f26;
  --text-dim: #5b6472;
  --text-faint: #8b939f;
  --accent: #0b5fa4;
  --accent-hover: #094a80;
  --accent-soft: #e8f1f9;
  --warn: #8a5300;
  --warn-bg: #fdf3e0;
  --warn-border: #e8c98a;
  --danger: #a01c22;
  --danger-bg: #fcecec;
  --danger-border: #e9b4b6;
  --ok: #16653a;
  --ok-bg: #e8f5ec;
  --ok-border: #a8d5b9;
  --radius: 6px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1c2027;
    --surface-2: #24292f;
    --border: #2f353d;
    --border-strong: #414954;
    --text: #e6e9ee;
    --text-dim: #a4adba;
    --text-faint: #77808d;
    --accent: #64b0ea;
    --accent-hover: #8ac5f2;
    --accent-soft: #16293a;
    --warn: #f0c274;
    --warn-bg: #2e2415;
    --warn-border: #574526;
    --danger: #f09a9e;
    --danger-bg: #33191b;
    --danger-border: #5d2f32;
    --ok: #7fd3a0;
    --ok-bg: #16291d;
    --ok-border: #2c4c37;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- ramme -------------------------------------------------------------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 54px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--text-faint); font-weight: 400; }
.topnav { display: flex; gap: 18px; align-items: center; flex: 1; }
.topnav a { color: var(--text-dim); font-size: 14px; }
.topnav a.active { color: var(--text); font-weight: 550; }
.whoami {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}
.role-chip {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.role-chip.admin { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 80px; }

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.015em; font-weight: 620; }
h2 { font-size: 16px; margin: 30px 0 10px; font-weight: 600; }
h2:first-child { margin-top: 0; }
.subtitle { color: var(--text-dim); font-size: 14px; margin: 0 0 22px; }

/* --- kort og bokser ----------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card > h2 { margin-top: 0; }
.card-flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.stat-value { font-size: 21px; font-weight: 600; margin-top: 3px; letter-spacing: -0.02em; }
.stat-note { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* --- meldinger ---------------------------------------------------------- */

.notice { border-radius: var(--radius); padding: 11px 14px; margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.notice-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.notice-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.notice-info { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.notice strong { font-weight: 600; }
.notice code { background: rgba(0,0,0,.08); padding: 1px 5px; border-radius: 3px; font-family: var(--mono); }

/* --- brødsmuler --------------------------------------------------------- */

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; margin-bottom: 14px; }
.crumbs .sep { color: var(--text-faint); }
.crumbs .here { color: var(--text); font-weight: 550; }

/* --- tabeller ----------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 9px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.shrink { width: 1%; white-space: nowrap; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.wrap-any { overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; }

.entry-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.entry-name .ico { flex: none; width: 17px; text-align: center; color: var(--text-faint); }
.entry-name a { overflow-wrap: anywhere; }
.entry-dir a { font-weight: 550; }

/* --- knapper ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-primary:disabled { background: var(--border-strong); border-color: var(--border-strong); cursor: not-allowed; }
.btn-danger { color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; }

/* --- skjema ------------------------------------------------------------- */

label { display: block; font-size: 13px; font-weight: 550; margin-bottom: 5px; }
label .hint { font-weight: 400; color: var(--text-faint); }
input[type=text], input[type=password], input[type=date], input[type=search], select {
  width: 100%;
  padding: 8px 11px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
input:focus, select:focus, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.field { margin-bottom: 14px; }
.field-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; font-weight: 400; }
.check input { margin-top: 3px; flex: none; }

/* --- kostnadstabellen -------------------------------------------------- */

.cost {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.cost table { font-size: 14px; }
.cost tbody td { padding: 11px 16px; }
.cost .cost-label { font-weight: 550; }
.cost .cost-detail { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.cost .cost-amount { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 550; }
.cost tfoot td {
  padding: 13px 16px;
  border-top: 2px solid var(--border-strong);
  background: var(--surface-2);
  font-weight: 650;
  font-size: 15px;
}
.cost tfoot .cost-amount { font-size: 18px; letter-spacing: -0.02em; }
.cost .uncertain .cost-label::after {
  content: "tak";
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 7px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn);
  font-weight: 600;
  vertical-align: 1px;
}

.quote-summary { display: flex; flex-wrap: wrap; gap: 26px; margin-bottom: 18px; }
.quote-summary div { min-width: 110px; }
.quote-summary .stat-value { font-size: 19px; }

/* --- diverse ------------------------------------------------------------ */

.empty { text-align: center; padding: 44px 20px; color: var(--text-dim); }
.empty p { margin: 6px 0; }

.tier-chip {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  white-space: nowrap;
}
.tier-Cold, .tier-Archive { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }

.pill { font-size: 12px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); }
.pill-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.pill-bad { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.pill-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin-bottom: 0; min-width: 145px; }
.filters .field-wide { flex: 1; min-width: 200px; }

.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 18px; font-size: 14px; color: var(--text-dim); }

.prefix-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.prefix-list table { font-size: 13px; }
.prefix-list thead th { position: sticky; top: 0; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-box { width: 100%; max-width: 380px; }
.login-box .card { padding: 26px 26px 22px; }
.login-title { text-align: center; margin-bottom: 22px; }
.login-title h1 { font-size: 20px; }
.login-title p { color: var(--text-dim); font-size: 13px; margin: 4px 0 0; }

.secret {
  font-family: var(--mono);
  font-size: 15px;
  padding: 10px 13px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  user-select: all;
  overflow-wrap: anywhere;
}

footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 40px;
  font-size: 12px;
  color: var(--text-faint);
}
footer a { color: var(--text-faint); text-decoration: underline; }

@media (max-width: 620px) {
  .topnav { order: 3; width: 100%; padding-bottom: 8px; }
  .hide-narrow { display: none; }
  main { padding: 18px 14px 60px; }
}
