:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --text: #1f2a2e;
  --muted: #66747a;
  --line: #e6e0d6;
  --brand: #1f5f4a;
  --brand-ink: #ffffff;
  --brand-soft: #e7f1ec;
  --accent: #e0a43a;
  --accent-soft: #fbf0dc;
  --danger: #b3392f;
  --danger-soft: #f9e4e1;
  --info-soft: #e6eef7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 42, 46, .05), 0 4px 16px rgba(31, 42, 46, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a1c;
    --surface: #1c2427;
    --surface-2: #222c2f;
    --text: #e8ecec;
    --muted: #97a4a8;
    --line: #2e3a3e;
    --brand: #4fae8c;
    --brand-ink: #0f1a16;
    --brand-soft: #1d3a31;
    --accent: #f0b95a;
    --accent-soft: #3a2f1c;
    --danger: #ef7c70;
    --danger-soft: #3d2320;
    --info-soft: #1f2d3b;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 28px; padding-bottom: 40px; min-height: 70vh; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Haus */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); display: flex; align-items: center; gap: 6px; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.me { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.me-name { color: var(--muted); }
.subnav { background: var(--surface-2); border-bottom: 1px solid var(--line); overflow-x: auto; }
.subnav .wrap { display: flex; gap: 2px; }
.subnav a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-size: .92rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.devbar { background: var(--accent-soft); color: var(--text); text-align: center; font-size: .85rem; padding: 6px 16px; }
.foot { color: var(--muted); font-size: .8rem; padding: 20px 16px 32px; text-align: center; }

/* Spjöld og hnappar */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.narrow { max-width: 520px; margin: 40px auto; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 10px;
  padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn-lg { padding: 13px 22px; font-size: 1.02rem; }
.btn-ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn.danger { color: var(--danger); }
.chip-btn { background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; }
.dev-users { display: flex; flex-wrap: wrap; gap: 8px; }

/* Eyðublöð */
.stack { display: flex; flex-direction: column; gap: 12px; }
label { font-weight: 600; font-size: .92rem; }
.stack label, .settings label { display: flex; flex-direction: column; gap: 6px; }
input[type=text], input[type=email], input[type=number], input:not([type]), select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; line-height: 1.5; }
.counter { text-align: right; font-size: .8rem; margin-top: -6px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.cats { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cats legend { font-weight: 600; font-size: .92rem; margin-bottom: 8px; padding: 0; }
.cat input { position: absolute; opacity: 0; pointer-events: none; }
.cat span { display: inline-block; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); font-weight: 500; cursor: pointer; background: var(--surface); transition: .15s; }
.cat input:checked + span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.cat input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.toggle { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 12px; cursor: pointer; font-weight: 400; background: var(--surface-2); padding: 14px; border-radius: 12px; border: 1px solid var(--line); }
.toggle input { position: absolute; opacity: 0; }
.toggle-ui { flex: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line); position: relative; transition: .2s; margin-top: 2px; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .toggle-ui { background: var(--brand); }
.toggle input:checked + .toggle-ui::after { left: 21px; }
.toggle input:focus-visible + .toggle-ui { outline: 2px solid var(--brand); outline-offset: 2px; }

.preview { font-size: .95rem; padding: 4px 2px; display: flex; gap: 8px; align-items: baseline; }

/* Leitanlegur listi */
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; list-style: none; margin: 0; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 280px; overflow-y: auto; }
.combo-list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; display: flex; flex-direction: column; }
.combo-list li small { color: var(--muted); font-size: .8rem; }
.combo-list li.on, .combo-list li:hover { background: var(--brand-soft); }
.combo-list li.none { color: var(--muted); cursor: default; }
.shake { animation: shake .35s; border-color: var(--danger) !important; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Tilkynningar */
.notice { padding: 12px 16px; border-radius: 10px; margin: 0 0 16px; }
.notice.ok { background: var(--brand-soft); }
.notice.err { background: var(--danger-soft); }
.notice.info { background: var(--info-soft); }
.notice.warn { background: var(--accent-soft); border-left: 4px solid var(--accent); }
.rules { margin: 4px 0 0; text-align: center; }
.report { margin: 0; }
.link-btn.subtle { color: var(--muted); font-size: .8rem; }
.link-btn.subtle:hover { color: var(--danger); }
.st-held { background: var(--accent-soft); color: var(--text); }
.st-rep { background: var(--danger-soft); color: var(--danger); }
.reason { margin-top: 6px; font-size: .82rem; color: var(--muted); font-style: italic; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-danger { background: var(--danger); color: #fff; }
.radio-list { display: flex; flex-direction: column; gap: 8px; }
.settings .radio-opt { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--surface-2); }
.radio-opt input { margin-top: 4px; accent-color: var(--brand); }
.radio-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }

/* Innskráning */
.login-card { max-width: 440px; margin: 8vh auto 0; text-align: center; padding: 40px 32px; }
.login-star { font-size: 3rem; margin-bottom: 8px; }
.login-card p { margin: 8px 0 24px; }

/* Senda */
.send-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 16px; }
.stat-card .big { font-size: 2.6rem; font-weight: 700; color: var(--brand); line-height: 1; }
.stat-card a { display: inline-block; margin-top: 8px; font-weight: 600; }
.tip ul { margin: 0; padding-left: 18px; }
.tip li { margin: 6px 0; font-size: .92rem; }

/* Hrósin mín */
.tabs { display: flex; gap: 6px; margin: 16px 0 18px; }
.tab { font: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 7px 16px; cursor: pointer; color: var(--muted); }
.tab.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.praise-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.praise-card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.praise-card.sent { border-top-color: var(--brand); }
.praise-msg { margin: 0; white-space: pre-wrap; font-size: 1.02rem; flex: 1; }
.praise-card footer { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .88rem; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 36px; }
.pill { display: inline-block; align-self: flex-start; background: var(--brand-soft); color: var(--brand); border-radius: 99px; padding: 2px 10px; font-size: .78rem; font-weight: 600; }
.pill-anon { background: var(--accent-soft); color: var(--text); }

/* Stjórnborð */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi-n { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.kpi-l { color: var(--muted); font-size: .85rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.users-top { align-items: start; }
.users-top details summary { cursor: pointer; font-weight: 600; }
.users-top details[open] summary { margin-bottom: 12px; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 16px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; min-width: 0; }
.bar { width: 100%; max-width: 36px; height: var(--h); background: var(--brand); border-radius: 6px 6px 2px 2px; position: relative; overflow: hidden; }
.bar-anon { position: absolute; left: 0; right: 0; bottom: 0; height: var(--a); background: var(--accent); }
.bar-val { font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.bar-lbl { font-size: .72rem; color: var(--muted); margin-top: 6px; white-space: nowrap; }
.legend { display: flex; gap: 8px; align-items: center; font-size: .8rem; color: var(--muted); margin-top: 12px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-named { background: var(--brand); }
.sw-anon { background: var(--accent); margin-left: 8px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: 10px; font-size: .9rem; }
.hbar-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar { background: var(--surface-2); border-radius: 6px; height: 14px; overflow: hidden; }
.hbar span { display: block; height: 100%; width: var(--w); background: var(--brand); border-radius: 6px; }
.hbar-n { text-align: right; font-weight: 600; }
.toplist { margin: 0; padding-left: 22px; }
.toplist li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.toplist li:last-child { border-bottom: 0; }
.toplist li { display: list-item; }
.toplist li b { float: right; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px; margin-bottom: 16px; }
.filters input { flex: 1 1 240px; }
.filters select { flex: 1 1 150px; max-width: 200px; }
.table-wrap { padding: 0; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.is-hidden td { opacity: .55; }
.msg-cell { min-width: 260px; max-width: 460px; }
.msg-text { white-space: pre-wrap; margin-top: 4px; }
.actions { display: flex; flex-direction: column; gap: 6px; white-space: nowrap; }
.actions form, .inline { margin: 0; }
.tbl select { padding: 6px 8px; width: auto; }
.tbl pre { margin: 6px 0 0; font-size: .78rem; white-space: pre-wrap; max-width: 380px; }
.st { font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; display: inline-block; }
.st-ok { background: var(--brand-soft); color: var(--brand); }
.st-q { background: var(--info-soft); }
.st-err { background: var(--danger-soft); color: var(--danger); cursor: help; }
.st-hid { background: var(--surface-2); color: var(--muted); margin-top: 4px; }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; margin: 18px 0; }

.settings { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.settings .btn { align-self: flex-start; }

@media (max-width: 860px) {
  .send-layout, .grid-2 { grid-template-columns: 1fr; }
  .me-name { display: none; }
}
@media (max-width: 560px) {
  .row-2 { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  h1 { font-size: 1.35rem; }
  .topbar-inner { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .me { margin-left: auto; }
}
