:root {
  --bg: #f6f7f9;
  --surface: #fff;
  --surface-2: #f8f9fb;
  --ink: #14213d;
  --muted: #5b6475;
  --line: #e3e6ec;
  --brand: #0b2545;
  --accent: #13a89e;
  --accent-ink: #0d7d75;
  --c-in: #13a89e;
  --c-out: #e07a5f;
  --c-line: #0b2545;
  --c-line2: #f2a541;
  --good: #1b8a5a;
  --ok: #b7791f;
  --bad: #c0392b;
  --accent-hover: #0d7d75;
  --soft: #eef0f4;
  --thead: #f0f2f6;
  --input-bg: #fff;
  --badge-bg: #e6f6f5;
  --zero: #9aa3b2;
  --good-bg: #e8f5ee;
  --good-ink: #14603f;
  --ok-bg: #fdf3e1;
  --ok-ink: #7a5113;
  --bad-bg: #fdecea;
  --bad-ink: #8e2a1f;
  --header-bg: var(--brand);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
  color-scheme: light;
}

/* Dökkt þema. js/theme.js setur data-theme eftir vali notanda eða stillingu stýrikerfis. */
:root[data-theme="dark"] {
  --bg: #0d1420;
  --surface: #151e2c;
  --surface-2: #1a2433;
  --ink: #e6ebf2;
  --muted: #9aa6b8;
  --line: #2a3547;
  --accent-ink: #3cc9bd;
  --accent-hover: #0f8f86;
  --c-line: #8fb3e8;
  --good: #3ccf8e;
  --ok: #e0a84a;
  --bad: #ef6b5b;
  --soft: #222d3d;
  --thead: #1c2636;
  --input-bg: #0f1724;
  --badge-bg: #143834;
  --zero: #5d6a7e;
  --good-bg: #12301f;
  --good-ink: #7fe0ad;
  --ok-bg: #352a12;
  --ok-ink: #f0c47a;
  --bad-bg: #3a1a17;
  --bad-ink: #f6a399;
  --header-bg: #08111f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 12px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
a { color: var(--accent-ink); }
.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Haus og fótur */
header.site { background: var(--header-bg); color: #fff; position: sticky; top: 0; z-index: 10; }
header.site .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.logo { font-weight: 800; font-size: 1.25rem; color: #fff; text-decoration: none; letter-spacing: .02em; white-space: nowrap; }
.logo span { color: var(--accent); }
nav a { color: #c9d4e5; text-decoration: none; margin-left: 20px; font-weight: 500; }
nav a:hover, nav a[aria-current] { color: #fff; }
nav { display: flex; align-items: center; }
.theme-toggle { margin-left: 16px; width: 36px; height: 36px; display: grid; place-items: center; background: none; border: 1px solid rgba(255, 255, 255, .25); border-radius: 8px; color: #c9d4e5; cursor: pointer; }
.theme-toggle:hover { color: #fff; border-color: rgba(255, 255, 255, .5); }
.theme-toggle svg { width: 18px; height: 18px; }
footer.site { background: var(--header-bg); color: #9fb0c8; padding: 32px 0; font-size: .9rem; margin-top: 64px; }
footer.site .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* Forsíða */
.hero { background: linear-gradient(135deg, var(--brand), #13315c 60%, #134e6f); color: #fff; padding: 88px 0 96px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.15; margin: 0 0 16px; max-width: 18ch; }
.hero p { font-size: 1.15rem; color: #d6deeb; max-width: 56ch; margin: 0 0 32px; }
section.block { padding: 72px 0; }
section.block h2 { font-size: 1.9rem; margin: 0 0 8px; }
.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lead { color: var(--muted); margin: 0 0 32px; max-width: 60ch; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h3 { margin: 12px 0 6px; }
.card p { margin: 0; color: var(--muted); }
.icon-badge { width: 44px; height: 44px; border-radius: 10px; background: var(--badge-bg); color: var(--accent-ink); display: grid; place-items: center; font-size: 1.3rem; }
.steps { counter-reset: s; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.step { padding-top: 8px; }
.step::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; margin-bottom: 12px; }
.step h3 { margin: 0 0 4px; }
.step p { margin: 0; color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }

/* Hnappar og form */
.btn { display: inline-block; padding: 11px 18px; border-radius: 10px; font: inherit; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { border-color: rgba(255, 255, 255, .4); color: #fff; margin-left: 8px; }
.btn.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.secondary:hover { background: var(--soft); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn.disabled input { pointer-events: none; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--input-bg); color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
form.contact { display: grid; gap: 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; background: var(--surface); margin: 0; }
legend { font-weight: 700; padding: 0 6px; }

/* Greiningartól */
.page-head { padding: 40px 0 0; }
.page-head h1 { margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); }
.cloud { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; margin-top: 20px; }
.cloud-auth, .cloud-login, .cloud-files { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cloud-login input { width: 240px; }
.cloud-files[hidden] { display: none; }
.cloud-files select { width: auto; min-width: 220px; }
.cloud-msg { width: 100%; font-size: .88rem; }
.cloud-msg:empty { display: none; }
.cloud-msg.good { color: var(--good); }
.cloud-msg.bad { color: var(--bad); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 24px 0; overflow-x: auto; }
.tab { background: none; border: 0; padding: 12px 16px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.panel h2 { margin: 0; }
.panel-head { margin-bottom: 20px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.two-col { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 24px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .k { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi .v { font-size: 1.35rem; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: .85rem; color: var(--muted); }
.kpi.good .v { color: var(--good); }
.kpi.ok .v { color: var(--ok); }
.kpi.bad .v { color: var(--bad); }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.alert.good { background: var(--good-bg); color: var(--good-ink); }
.alert.ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert.bad { background: var(--bad-bg); color: var(--bad-ink); }
.demo-banner { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 20px 0 0; }
.demo-banner .btn { white-space: nowrap; }

.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); }
.chart .zero { stroke: var(--zero); }
.chart .axis { font-size: 11px; fill: var(--muted); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 16px 0; }
table.grid-table { border-collapse: collapse; width: 100%; font-size: .88rem; font-variant-numeric: tabular-nums; }
.grid-table th, .grid-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.grid-table th:first-child, .grid-table td:first-child { text-align: left; }
.grid-table thead th { background: var(--thead); font-weight: 600; }
.grid-table .sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.grid-table thead .sticky { background: var(--thead); }
.grid-table tfoot td, .grid-table tfoot th { background: var(--surface-2); font-weight: 600; }
.grid-table tr.strong td, .grid-table tr.strong th { font-weight: 700; }
.grid-table input, .grid-table select { width: 110px; padding: 4px 6px; text-align: right; border-color: transparent; background: transparent; }
.grid-table input:hover, .grid-table select:hover { border-color: var(--line); }
.grid-table input.name { width: 210px; text-align: left; }
.grid-table select { width: auto; text-align: left; }
.neg { color: var(--bad); }
button.icon { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 4px 6px; border-radius: 6px; font-size: 1rem; }
button.icon:hover { background: var(--soft); color: var(--ink); }

.year-list { display: grid; gap: 8px; }
.year-row { display: grid; grid-template-columns: 48px 1fr auto; gap: 8px; align-items: center; font-size: .9rem; color: var(--muted); }
.ratio-group h3 { margin: 24px 0 12px; font-size: 1.05rem; }
.ratio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.ratio { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.ratio .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }
.ratio .v { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 4px 0; }
.ratio p { margin: 0; font-size: .82rem; color: var(--muted); }
.pill { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.help { margin-top: 16px; color: var(--muted); }
.help summary { cursor: pointer; font-weight: 600; color: var(--ink); }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.note { font-size: .85rem; color: var(--muted); }

@media (max-width: 800px) {
  .two-col, .split { grid-template-columns: 1fr; }
  nav a { margin-left: 12px; }
  nav .hide-sm { display: none; }
  .btn.ghost { margin: 8px 0 0; }
}
