/* AL2bolig Afdelingsportalen — mobile first. Palette: AL2 farvepalette (primær/sekundær/tertiær). */
:root {
  /* Primære */
  --sand: #D1CDC4;
  --taupe: #928574;
  --ink: #444039;
  --paper: #F0EFEC;
  /* Sekundære */
  --green: #1B7650;
  --sage: #8CA693;
  --rust: #C14C16;
  --mist: #E4E7E8;
  /* Tertiære */
  --moss: #617D67;
  --stone: #B6A999;
  --clay: #B56F52;
  --rose: #C78172;

  --text: #2f2c27;
  --muted: #6f6556;
  --line: #e2ded6;
  --card: #ffffff;
  --accent: var(--green);
  --accent-soft: #e6f0ea;
  --highlight-soft: #f7e7df;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(68, 64, 57, .06), 0 4px 14px rgba(68, 64, 57, .05);
  --tabbar-h: 64px;
  --font: Aptos, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--paper); font-size: 16px; line-height: 1.45; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }
:focus-visible { outline: 3px solid var(--sage); outline-offset: 2px; border-radius: 6px; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell: phone ---------- */
.shell { min-height: 100dvh; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--ink); color: #fff;
}
.topbar-logo { height: 20px; width: auto; }
.topbar-title { font-weight: 700; font-size: 15px; letter-spacing: .2px; opacity: .92; }
.avatar-btn {
  margin-left: auto; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--taupe); color: #fff; font-weight: 700; font-size: 14px;
}
.main { padding: 14px 14px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px); outline: none; max-width: 1240px; margin: 0 auto; }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(68, 64, 57, .06);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--muted); font-size: 11.5px; font-weight: 600; position: relative;
  min-height: 48px;
}
.tab[aria-current="page"] { color: var(--green); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--green); }
.tab .badge { position: absolute; top: 7px; left: calc(50% + 6px); }

/* ---------- Cards & common ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--green); margin: 0 0 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; color: var(--ink); }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.link-btn { border: 0; background: none; color: var(--green); font-weight: 700; font-size: 14px; padding: 8px 0; }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--rust); color: #fff; font-size: 11.5px; font-weight: 800; font-style: normal; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.godkendt { background: var(--accent-soft); color: var(--green); }
.status.kommentering { background: var(--highlight-soft); color: var(--rust); }

.board-mark { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .5px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; color: var(--ink); min-height: 40px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Hero */
.hero { position: relative; overflow: hidden; padding: 18px 16px; background: linear-gradient(135deg, #fff 0%, #fff 55%, var(--paper) 100%); }
.hero h1 { font-size: 23px; max-width: 70%; }
.hero p { margin: 6px 0 12px; color: var(--muted); max-width: 64%; font-size: 14.5px; }
.hero-art { position: absolute; right: -40px; bottom: -36px; width: 190px; opacity: .9; pointer-events: none; }
.hero .chips { position: relative; max-width: 100%; }
.hero .chip { background: var(--paper); }

/* Lists of documents */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px 16px; border: 0; border-top: 1px solid var(--line); background: #fff; min-height: 64px;
}
.rows > li:first-child .row { border-top: 0; }
.row:active { background: var(--paper); }
.row-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--green); flex: none; }
.row-icon.warm { background: var(--highlight-soft); color: var(--rust); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 700; color: var(--ink); display: block; }
.row-sub { font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 2px; }
.row-end { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.count { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.count svg.i { width: 16px; height: 16px; }

.group-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: linear-gradient(90deg, var(--paper), #fff); border-top: 1px solid var(--line); }
.card.flush > .group-head:first-child { border-top: 0; }
.group-head strong { display: block; color: var(--ink); }

/* Meetings */
.meeting { display: flex; gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.rows > li:first-child .meeting { border-top: 0; }
.date-tile { width: 52px; flex: none; text-align: center; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); padding: 6px 0 5px; }
.date-tile b { display: block; font-size: 20px; line-height: 1; color: var(--ink); }
.date-tile span { font-size: 11.5px; font-weight: 800; text-transform: uppercase; color: var(--clay); letter-spacing: .05em; }

.empty { padding: 26px 16px; text-align: center; color: var(--muted); }

/* ---------- Reader ---------- */
.reader-head { display: flex; align-items: flex-start; gap: 10px; }
.back { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--ink); }
.reader-title { flex: 1; min-width: 0; }
.reader-title h1 { font-size: 21px; }
.reader-title .row-sub { margin-top: 6px; }
.internal-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--mist); color: var(--ink); font-size: 13.5px; margin: 12px 0 0; }
.internal-note svg.i { color: var(--moss); margin-top: 1px; }
.meta { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 0; }
.meta div { display: grid; grid-template-columns: 96px 1fr; gap: 8px; font-size: 14px; }
.meta dt { color: var(--muted); font-weight: 600; }
.meta dd { margin: 0; color: var(--ink); }

.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; }
.doc-section { padding: 16px; border-top: 1px solid var(--line); scroll-margin-top: 80px; }
.doc-section:first-child { border-top: 0; }
.doc-section.is-focus { background: #fbfaf8; box-shadow: inset 4px 0 0 var(--green); }
.doc-section h3 { display: flex; gap: 10px; align-items: baseline; font-size: 17px; }
.num { color: var(--taupe); font-variant-numeric: tabular-nums; min-width: 1.4em; }
.doc-section p { margin: 8px 0 0; }
.decision { margin-top: 12px; padding: 10px 12px; border-left: 4px solid var(--green); background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 14.5px; }
.decision b { color: var(--green); display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; }
.comment-btn {
  margin-top: 12px; display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 700; color: var(--ink);
}
.comment-btn.has { border-color: #e8c9b9; background: var(--highlight-soft); color: var(--rust); }

/* Comments */
.comments-panel { display: none; }
.comment { padding: 12px 0; border-top: 1px solid var(--line); }
.comment:first-child { border-top: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.comment-head b { color: var(--ink); }
.mini-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--stone); color: #fff; font-size: 11.5px; font-weight: 800; flex: none; }
.comment p { margin: 6px 0 0 36px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment .ref { margin: 4px 0 0 36px; font-size: 12.5px; font-weight: 700; color: var(--moss); border: 0; background: none; padding: 0; text-align: left; }
.comment .del { margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 12.5px; text-decoration: underline; padding: 6px; }
.composer { display: grid; gap: 8px; margin-top: 12px; }
.composer textarea { width: 100%; min-height: 96px; resize: vertical; padding: 12px; border-radius: var(--radius-sm); border: 1px solid #cfc9bf; background: #fff; font-size: 16px; }
.composer textarea:focus { outline: 3px solid rgba(140, 166, 147, .45); border-color: var(--moss); }
.composer-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.target { font-size: 13px; color: var(--muted); }
.btn { border: 0; border-radius: 12px; padding: 11px 18px; min-height: 44px; font-weight: 700; background: var(--green); color: #fff; }
.btn:disabled { opacity: .55; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.fab {
  position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); z-index: 25;
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 13px 18px;
  background: var(--ink); color: #fff; font-weight: 700; box-shadow: 0 8px 22px rgba(68, 64, 57, .3);
}

/* ---------- Sheet (phone dialogs) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(40, 36, 30, .42); z-index: 50; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; max-height: 88dvh; display: flex; flex-direction: column;
  background: #fff; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
  padding-bottom: env(safe-area-inset-bottom); animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--sand); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 8px; }
.sheet-body { overflow: auto; padding: 0 16px 16px; -webkit-overflow-scrolling: touch; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; border-radius: 12px; color: inherit; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; }
.choice[aria-pressed="true"] { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.demo-flag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .08em; padding: 2px 7px; border-radius: 6px; background: var(--rust); color: #fff; vertical-align: middle; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px); transform: translate(-50%, 20px); opacity: 0; transition: .2s; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 70; pointer-events: none; font-weight: 600; font-size: 14px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.view-bar { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; margin-bottom: 12px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; }
.view-bar span { flex: 1; min-width: 0; }
.view-bar button { border: 0; border-radius: 10px; min-height: 36px; padding: 6px 14px; background: rgba(255, 255, 255, .16); color: #fff; font-weight: 700; }

/* Årshjul page embedded in the shell. --chrome = everything outside the frame. */
.arshjul-frame-wrap { --chrome: calc(64px + var(--tabbar-h) + env(safe-area-inset-bottom) + 30px); margin: -14px -14px 0; }
.view-bar + .arshjul-frame-wrap { --chrome: calc(64px + var(--tabbar-h) + env(safe-area-inset-bottom) + 84px); margin-top: 0; }
.arshjul-frame { display: block; width: 100%; height: calc(100dvh - var(--chrome)); min-height: 420px; border: 0; background: var(--paper); }

.grid { display: grid; gap: 14px; }
.grid > .card { margin-bottom: 0; }
.stack { display: grid; gap: 14px; }

/* ---------- Tablet: icon rail ---------- */
@media (min-width: 768px) {
  .topbar, .tabbar, .fab { display: none; }
  .shell { display: grid; grid-template-columns: 76px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh;
    background: #fbfaf8; border-right: 1px solid var(--line);
  }
  .brand { background: var(--ink); color: #fff; padding: 18px 10px; display: grid; place-items: center; min-height: 76px; }
  .brand-logo { width: 54px; height: 24px; object-fit: cover; object-position: left center; }
  .brand-name { display: none; }
  .nav-list { padding: 10px 8px; overflow: auto; flex: 1; }
  .nav-group + .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
  .nav-group-label { display: none; }
  .nav-item {
    position: relative; width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px;
    border: 0; background: none; border-radius: 12px; min-height: 48px; padding: 0 12px; color: var(--ink); font-weight: 600;
  }
  .nav-item span.label { display: none; }
  .nav-item:hover { background: var(--paper); }
  .nav-item[aria-current="page"] { background: #fff; color: var(--green); box-shadow: var(--shadow); }
  .nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -8px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--green); }
  .nav-item .badge { position: absolute; top: 4px; right: 6px; }
  .sidebar-foot { padding: 8px; border-top: 1px solid var(--line); }
  .foot-icons { display: grid; justify-items: center; gap: 2px; color: var(--muted); }
  .who { display: none; }
  .main { padding: 22px 24px 40px; }
  .arshjul-frame-wrap { --chrome: 44px; margin: -22px -24px -40px; }
  .view-bar + .arshjul-frame-wrap { --chrome: 96px; margin: 0 -24px -40px; }
  .arshjul-frame { border-radius: 0; }
  .hero { padding: 26px 28px; }
  .hero h1 { font-size: 28px; }
  .hero-art { width: 250px; right: -20px; bottom: -50px; }
  .grid.two { grid-template-columns: 1fr 1fr; }
  .meta { grid-template-columns: 1fr 1fr; }
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 48px)); border-radius: 18px; animation: none; }
  .sheet-grip { display: none; }
  .toast { bottom: 28px; }
}

/* ---------- Desktop: full sidebar like OB ---------- */
@media (min-width: 1200px) {
  .shell { grid-template-columns: 256px 1fr; }
  .brand { display: block; padding: 18px 20px; text-align: left; }
  .brand-logo { width: 110px; height: auto; object-fit: contain; }
  .brand-name { display: block; font-weight: 700; font-size: 17px; margin-top: 8px; }
  .nav-list { padding: 14px 12px; }
  .nav-group + .nav-group { border-top: 0; margin-top: 14px; padding-top: 0; }
  .nav-group-label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 12px 6px; }
  .nav-item { justify-content: flex-start; min-height: 42px; }
  .nav-item span.label { display: inline; }
  .nav-item .badge { position: static; margin-left: auto; }
  .nav-item[aria-current="page"]::before { left: -12px; }
  .sidebar-foot { padding: 12px; }
  .foot-icons { display: flex; justify-content: space-around; margin-bottom: 10px; }
  .who { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
  .who strong { display: block; color: var(--ink); font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .main { padding: 24px 32px 48px; }
  .arshjul-frame-wrap { margin: -24px -32px -48px; }
  .view-bar + .arshjul-frame-wrap { margin: 0 -32px -48px; }
  .grid.three { grid-template-columns: 2fr 1fr; }

  .reader-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
  .comments-panel { display: block; position: sticky; top: 24px; max-height: calc(100dvh - 48px); overflow: auto; }
}
