/*
 * Design etter Unifon UI-kit (@phonectas/unifon-ui-kit, src/theme/theme.ts): marineblå #001B74, Fellix,
 * radius 4px, felt med lys grå bakgrunn uten kant. Mørk modus er avledet; kitet har ingen.
 */
@font-face { font-family: "Fellix"; font-weight: 100 599; font-display: swap; src: url("/static/fellix-medium.woff2") format("woff2"); }
@font-face { font-family: "Fellix"; font-weight: 600 900; font-display: swap; src: url("/static/fellix-bold.woff2") format("woff2"); }

:root {
  --accent: #001b74; --accent-soft: #e6e8f3; --topbar: #001b74; --topbar-fg: #fff;
  --bg: #f0f0f4; --surface: #fff; --border: #d6d7e1; --separator: #eaeaef; --fill: #ededf0;
  --text: #001b74; --text-secondary: #656580;
  --ok-fg: #1d864c; --ok-dot: #27ad61; --ok-bg: #e7f5ec;
  --warn-fg: #9a470d; --warn-dot: #ff8946; --warn-bg: #fff0e6;
  --ready-fg: #001b74; --ready-dot: #6b76b8; --ready-bg: #e6e8f3;
  --neutral-dot: #b6b7cc; --danger: #e32b2b; --danger-bg: #fdecec;
  --input-bg: #ededf0; --input-bg-hover: #e3e3e8; --input-focus: #9ca0ce; --hover: #e6e8f3;
  --shadow: 0 6px 10px rgba(38, 38, 74, .2); --inner-shadow: inset 0 1px 2px rgba(128, 131, 160, .2);
  --radius: 4px;
  --font: "Fellix", "Segoe UI Variable", "Helvetica Neue", -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #9daeff; --accent-soft: #1f2a55; --topbar: #000e3f;
    --bg: #12131d; --surface: #1d1f2c; --border: #343750; --separator: #2a2c3d; --fill: #262838;
    --text: #e8e9f5; --text-secondary: #a9aac2;
    --ok-fg: #7fdba6; --ok-bg: #143323; --warn-fg: #ffb98a; --warn-bg: #3a2210; --ready-fg: #bcc7ff; --ready-bg: #1f2a55;
    --danger: #ff7d7d; --danger-bg: #3b1214;
    --input-bg: #262838; --input-bg-hover: #2e3043; --input-focus: #6b76b8; --hover: #262f55;
  }
  .btn-primary, .sidenav a[aria-current="page"] { color: #12131d !important; }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
.secondary { color: var(--text-secondary); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }

/* Ramme */
.topbar { position: sticky; top: 0; z-index: 20; height: 52px; background: var(--topbar); color: var(--topbar-fg); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px; }
.topbar a, .topbar a:hover { color: var(--topbar-fg); text-decoration: none; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; }
.brand svg { flex: none; }
.brand-sep { width: 1px; height: 20px; background: rgba(255,255,255,.35); }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.topbar-right form { margin: 0; }
.topbar-btn { background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: var(--radius); min-height: 32px; padding: 0 12px; cursor: pointer; font-size: 13px; }
.topbar-btn:hover { background: rgba(255,255,255,.12); }

.shell { display: flex; min-height: calc(100vh - 52px); }
.sidenav { flex: none; width: 230px; background: var(--surface); padding: 12px 0 24px; display: flex; flex-direction: column; position: sticky; top: 52px; height: calc(100vh - 52px); overflow-y: auto; }
.sidenav a { display: flex; align-items: center; gap: 12px; padding: 11px 20px; min-height: 44px; color: var(--text); font-size: 14px; font-weight: 500; }
.sidenav a:hover { background: var(--hover); text-decoration: none; }
.sidenav a[aria-current="page"] { background: var(--accent); color: #fff; font-weight: 600; }
.sidenav a svg { flex: none; }
.sidenav-label { padding: 18px 20px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); }
.main { flex: 1 1 auto; min-width: 0; padding: 24px 28px 64px; display: flex; flex-direction: column; gap: 20px; }
.main > * { max-width: 1100px; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidenav { position: sticky; top: 52px; z-index: 10; width: auto; height: auto; flex-direction: row; overflow-x: auto; padding: 0; box-shadow: 0 1px 0 var(--separator); }
  .sidenav a { white-space: nowrap; padding: 10px 14px; }
  .sidenav-label, .brand-sep, .brand-sub, .topbar-user { display: none; }
  .main { padding: 18px 16px 48px; }
}

/* Sidetopp */
.page-head h1 { font-size: 26px; font-weight: 700; }
.page-head p { margin-top: 4px; color: var(--text-secondary); font-size: 14px; max-width: 760px; }

/* Kort */
.card { background: var(--surface); border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.card h2 { font-size: 17px; font-weight: 700; }
.card h3 { font-size: 14.5px; font-weight: 700; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.card-head p { margin-top: 4px; font-size: 13px; color: var(--text-secondary); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.section-label { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); }

/* Steg (Oppsett) */
.step { background: var(--surface); border-radius: var(--radius); padding: 20px 22px; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 4px 14px; }
.step-no { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.step-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.step-body h2 { font-size: 17px; font-weight: 700; line-height: 30px; }
.step-body > p { color: var(--text-secondary); font-size: 13.5px; margin-top: -8px; }
.step.disabled .step-no { background: var(--neutral-dot); }

/* Nøkkelverdier */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 13.5px; }
.kv + .kv { border-top: 1px solid var(--separator); }
.kv > :first-child { color: var(--text-secondary); flex: none; }
.kv > :last-child { font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* Status: prikk og tekst */
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--neutral-dot); }
.status-ok { color: var(--ok-fg); } .status-ok .dot { background: var(--ok-dot); }
.status-warn { color: var(--warn-fg); } .status-warn .dot { background: var(--warn-dot); }
.status-ready { color: var(--ready-fg); } .status-ready .dot { background: var(--ready-dot); }
.status-danger { color: var(--danger); } .status-danger .dot { background: var(--danger); }
.status-neutral { color: var(--text-secondary); }
.status-big { font-size: 20px; } .status-big .dot { width: 12px; height: 12px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--radius); font-size: 12px; font-weight: 600; background: var(--fill); color: var(--text-secondary); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-ready { background: var(--ready-bg); color: var(--ready-fg); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* Meldinger */
.alert { padding: 11px 14px; border-radius: var(--radius); font-size: 13.5px; line-height: 1.5; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-ok { background: var(--ok-bg); color: var(--ok-fg); }
.alert-info { background: var(--accent-soft); color: var(--text); }
.alert-warn { background: var(--warn-bg); color: var(--warn-fg); }
.alert a { color: inherit; text-decoration: underline; font-weight: 600; }
.empty { padding: 24px 16px; text-align: center; color: var(--text-secondary); font-size: 13.5px; }
.todo { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.todo li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.todo .mark { flex: none; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--neutral-dot); margin-top: 1px; }
.todo .done .mark { background: var(--ok-dot); }
.todo .done span:last-child { color: var(--text-secondary); }

/* Skjema */
form { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.hint { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }
.input, .select, .textarea { min-height: 40px; border-radius: var(--radius); border: 0; background: var(--input-bg); box-shadow: var(--inner-shadow); padding: 0 10px; font-size: 15px; width: 100%; min-width: 0; transition: background-color 250ms; }
.textarea { padding: 8px 10px; font-family: var(--mono); font-size: 12.5px; resize: vertical; }
.input:hover:not(:disabled), .select:hover:not(:disabled) { background: var(--input-bg-hover); box-shadow: none; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--input-focus); outline-offset: -2px; }
.input::placeholder { color: var(--text-secondary); }
.input-short { max-width: 140px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.fields .wide { grid-column: 1 / -1; }
@media (max-width: 860px) { .fields { grid-template-columns: minmax(0, 1fr); } }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check strong { display: block; font-weight: 600; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.choice:hover { background: var(--hover); }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input { margin: 3px 0 0; accent-color: var(--accent); }
.choice strong { display: block; font-size: 14px; }
.choice span { font-size: 12.5px; color: var(--text-secondary); }
.choice code { font-size: 12px; }
.copy { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 4px 4px 12px; border-radius: var(--radius); background: var(--fill); }
.copy code { flex: 1 1 auto; overflow-wrap: anywhere; font-size: 13.5px; color: var(--text); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
details.more > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--accent); list-style: none; padding: 4px 0; }
details.more > summary::before { content: "▸ "; }
details.more[open] > summary::before { content: "▾ "; }
details.more > div { margin-top: 12px; display: flex; flex-direction: column; gap: 14px; }

/* Knapper */
.btn { white-space: nowrap; min-height: 39px; border-radius: var(--radius); border: 1px solid transparent; padding: 0 22px; font-size: 14.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: opacity 300ms, background-color 300ms; text-decoration: none !important; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: .9; color: #fff; }
.btn-soft { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-soft:hover:not(:disabled) { background: var(--hover); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-plain { background: none; color: var(--accent); padding: 0 6px; }
.btn-small { min-height: 30px; font-size: 13px; padding: 0 12px; }
.btn-big { min-height: 48px; font-size: 15.5px; padding: 0 28px; }

/* Faner */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 10px 16px; font-weight: 600; font-size: 14px; color: var(--text-secondary); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* Tabeller */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--text-secondary); padding: 10px 12px; border-bottom: 1px solid var(--separator); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--separator); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.hl td { background: var(--warn-bg); }
.table td.raw { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; max-width: 560px; color: var(--text-secondary); }
.fixed { color: var(--warn-fg); }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
@media (max-width: 860px) { .filters { grid-template-columns: 1fr 1fr; } }
pre { margin: 0; padding: 12px; border-radius: var(--radius); background: var(--fill); font-family: var(--mono); font-size: 12.5px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
pre.diff { max-height: 40rem; overflow: auto; white-space: pre; }

/* Innlogging */
.login { min-height: 100vh; background: var(--topbar); display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--radius); padding: 36px 32px 30px; display: flex; flex-direction: column; gap: 20px; }
.login-brand { display: flex; align-items: center; gap: 12px; color: var(--accent); }
.login-brand strong { font-size: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.footer { color: var(--text-secondary); font-size: 12px; }
