/* Count-In — "Dine scener" (organisation admin landing page). One stylesheet, light + dark.
   Same tokens and components as support.css; the coming design package merges both into one file.
   Theme: data-theme="light" | "dark" on <html> (or the .page wrapper) from Count-In's existing switch; none → system setting. */

/* ---------- Tokens ---------- */
:root, [data-theme="light"] {
  --bg: #F1F2F5; --panel: #FFFFFF; --row: #F7F8FA; --field: #F1F2F5;
  --line: #E1E3E8; --line2: #ECEEF1;
  --ink: #161A23; --muted: #4B5260;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 6px 20px rgba(16,24,40,.05);
  --primary: #1E2330; --on-primary: #FFFFFF;
  --red: #C81E1E; --red-ink: #B91C1C; --hot-bg: #FEF5F4;
  --orange: #C2410C; --green: #15803D; --blue: #1D4ED8; --slate: #475569;
  --screen: #1E2330; --screen-dead: #0A0C10; --screen-edge: transparent;
  --screen-idle: #D5D9E0; --screen-idle-ink: #2B3140;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0A0C11; --panel: #12151C; --row: #181C25; --field: #0E1117;
  --line: #2A303B; --line2: #1F242D;
  --ink: #F3F4F6; --muted: #A3ABB8; --shadow: none;
  --primary: #2DD4BF; --on-primary: #04201C;
  --red: #F87171; --red-ink: #FCA5A5; --hot-bg: #261314;
  --orange: #FB923C; --green: #4ADE80; --blue: #60A5FA; --slate: #94A3B8;
  --screen: #000; --screen-dead: #000; --screen-edge: #2A303B;
  --screen-idle: #2A303B; --screen-idle-ink: #C9D0DA;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0A0C11; --panel: #12151C; --row: #181C25; --field: #0E1117;
    --line: #2A303B; --line2: #1F242D;
    --ink: #F3F4F6; --muted: #A3ABB8; --shadow: none;
    --primary: #2DD4BF; --on-primary: #04201C;
    --red: #F87171; --red-ink: #FCA5A5; --hot-bg: #261314;
    --orange: #FB923C; --green: #4ADE80; --blue: #60A5FA; --slate: #94A3B8;
    --screen: #000; --screen-dead: #000; --screen-edge: #2A303B;
    --screen-idle: #2A303B; --screen-idle-ink: #C9D0DA;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
.page { background: var(--bg); color: var(--ink); font-family: 'Barlow', system-ui, sans-serif; font-size: 18px; line-height: 1.45; min-height: 100vh; }
.page a { color: var(--ink); }
a { color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
h1, h2, h3 { font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; font-weight: 700; line-height: 1.05; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.wrap { max-width: 1320px; margin: 0 auto; padding: 20px 24px 48px; display: flex; flex-direction: column; gap: 20px; }
.panel { background: var(--panel); border: 1px solid var(--line2); border-radius: 22px; box-shadow: var(--shadow); padding: 20px 24px; }

/* ---------- App bar (existing Count-In header, restyled) ---------- */
.appbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.brand { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 24px; text-decoration: none; margin-right: auto; }
.appbar .btn { min-height: 48px; }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-primary, .page .btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chev { width: 16px; height: 16px; flex: none; }

/* ---------- Page head (app bar + title in one panel) ---------- */
.head { display: flex; flex-direction: column; gap: 14px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.pagehead h1 { font-size: 44px; }
.pagehead .sub { margin-top: 4px; }
.pagehead .titles { margin-right: auto; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Icon tiles ---------- */
.tile { width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.tile-sm { width: 32px; height: 32px; border-radius: 10px; }
.c-red { background: linear-gradient(160deg, #EF4444, #C81E1E); }
.c-orange { background: linear-gradient(160deg, #F28A3A, #C2410C); }
.c-green { background: linear-gradient(160deg, #2FB45A, #15803D); }
.c-blue { background: linear-gradient(160deg, #4B7BEA, #1D4ED8); }
.c-slate { background: linear-gradient(160deg, #748197, #475569); }

/* ---------- Health: all fine (one quiet line) ---------- */
.health-ok { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 20px; }
.health-ok p { font-weight: 600; }
.health-ok .when { margin-left: auto; color: var(--muted); font-size: 16px; }

/* ---------- Health: something needs you ---------- */
.health.is-hot { border: 2px solid var(--red); }
.health-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 12px; }
.health-head h2 { font-size: 32px; }
.health-head .when { margin-left: auto; color: var(--muted); font-size: 16px; }
.issue { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 10px 16px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--row); }
.issue + .issue { margin-top: 8px; }
.issue.is-hot { background: var(--hot-bg); }
.issue .what { font-weight: 700; font-size: 20px; line-height: 1.25; }
.issue.is-hot .what { color: var(--red-ink); }
.issue .where { font-weight: 600; margin-top: 2px; }
.issue .means { margin-top: 2px; }
.issue .means b { font-weight: 700; }
.group { border-top: 1px solid var(--line2); }
.group:first-of-type { border-top: 0; }
.group > summary { list-style: none; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0; cursor: pointer; }
.group > summary::-webkit-details-marker { display: none; }
.group { margin-top: 10px; }
.group > summary .tiles { display: flex; gap: 4px; }
.group > summary .sumtx { font-size: 19px; }
.group > summary .sumtx b { font-family: 'Barlow Condensed', sans-serif; font-size: 24px; }
.items .sub-h { font-size: 22px; margin: 14px 0 8px; }
.group > summary .toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); }
.group > summary .toggle .hide { display: none; }
.group[open] > summary .toggle .show { display: none; }
.group[open] > summary .toggle .hide { display: inline; }
.group[open] > summary .toggle .chev { transform: rotate(180deg); }
.group .items { padding: 0 0 14px; }
.more { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; font-weight: 600; }

/* ---------- Empty: no scenes ---------- */
.empty { display: grid; grid-template-columns: minmax(0, 640px); gap: 14px; padding: 40px 32px; }
.empty h2 { font-size: 40px; }
.empty p { font-size: 20px; }
.empty .btn { justify-self: start; }

/* ---------- Scene cards ---------- */
.section-head { display: flex; align-items: baseline; gap: 12px; margin: 8px 0 -6px; }
.section-head h2 { font-size: 30px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 14px; background: var(--panel); border: 1px solid var(--line2); border-radius: 22px; box-shadow: var(--shadow); padding: 20px; }
.card.is-hot { border: 2px solid var(--red); }
.card h3 { font-size: 30px; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card .day { font-weight: 600; }
.card .foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: auto; }
.card .foot .btn { margin-left: auto; }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.status.is-hot { color: var(--red-ink); }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 14px 4px 5px; border-radius: 999px; background: var(--panel); border: 2px solid currentColor; font-weight: 600; align-self: flex-start; }
.pill .dot { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; font-size: 14px; }
.pill .tx { color: var(--ink); }
.p-red { color: var(--red); } .p-orange { color: var(--orange); } .p-green { color: var(--green); } .p-blue { color: var(--blue); } .p-slate { color: var(--slate); }

/* ---------- Screen miniatures ---------- */
.minis { display: flex; flex-wrap: wrap; gap: 10px; }
.mini-wrap { display: flex; flex-direction: column; gap: 4px; width: 104px; }
.mini-wrap .label { font-size: 16px; line-height: 1.2; overflow-wrap: break-word; hyphens: auto; }
.mini { position: relative; display: block; width: 104px; height: 56px; border-radius: 10px; background: var(--screen); box-shadow: 0 0 0 1px var(--screen-edge); color: #fff; padding: 6px 8px; overflow: hidden; }
.mini .t { display: block; font-size: 11px; line-height: 1.15; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .n { display: block; font-family: 'Barlow Condensed', sans-serif; font-size: 22px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini.is-web { border-top: 6px solid #5B6270; }
.mini.is-dead { background: var(--screen-dead); outline: 3px solid var(--red); outline-offset: 2px; }
.mini.is-idle { background: var(--screen-idle); color: var(--screen-idle-ink); }
.mini .badge { position: absolute; right: 4px; bottom: 4px; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.badge.is-dead { background: #C81E1E; } .badge.is-old { background: #C2410C; } .badge.is-noname { background: #1D4ED8; }

/* ---------- Phone ---------- */
@media (max-width: 820px) {
  .wrap { padding: 12px 12px 24px; gap: 12px; }
  .panel, .card { padding: 16px; border-radius: 20px; }
  .pagehead h1 { font-size: 36px; }
  .admin-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .admin-actions .btn { white-space: normal; text-align: center; padding: 0 12px; }
  .admin-actions .btn-primary { grid-column: 1 / -1; order: -1; }
  .issue { grid-template-columns: minmax(0,1fr); padding: 12px 14px; }
  .issue .tile { display: none; }            /* red text + background + words carry it on phones */
  .appbar { gap: 8px; }
  .appbar .btn { min-height: 44px; padding: 0 12px; font-size: 16px; }
  .brand { width: 100%; }
  .admin-actions .btn { min-height: 48px; font-size: 16px; }
  .issue .btn { grid-column: 1 / -1; }
  .group > summary { flex-wrap: wrap; }
  .group > summary .toggle { margin-left: 0; }
  .health-ok .when, .health-head .when { margin-left: 0; width: 100%; }
  .card .foot .btn { margin-left: 0; width: 100%; }
  .empty { padding: 24px 18px; }
  .empty h2 { font-size: 32px; }
}

/* ======================================================================================
   NOT IN THE PACKAGE — what the page needs that Claude Design did not draw. Same tokens and
   the same components only (the menus are support.css's, copied). Replace when the merged
   design package arrives.
   ====================================================================================== */

/* ---------- Menus in the app bar (support.css .user / .seg) ---------- */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary .chev { transform: rotate(180deg); }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 5; min-width: 260px; display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.menu-panel fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.menu-panel legend { font-weight: 700; padding: 0; margin-bottom: 8px; }
.menu-panel form { display: flex; flex-direction: column; gap: 8px; }
.menu-panel .btn { justify-content: flex-start; }
.menu-panel .btn[disabled] { background: var(--row); cursor: default; }
.menu-email { color: var(--muted); overflow-wrap: anywhere; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.seg label { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 10px; cursor: pointer; font-weight: 600; }
.seg label + label { border-left: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:checked) { background: var(--primary); color: var(--on-primary); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: -3px; }

/* ---------- Notices (a flash after "Opret scene", the platform-admin line) ---------- */
.note { padding: 14px 20px; font-weight: 600; }
.note.is-bad { border: 2px solid var(--red); color: var(--red-ink); }
.note a { font-weight: 700; }

/* ---------- "Vis alle N" (the red rows past the first three) ---------- */
.more-red > summary { list-style: none; cursor: pointer; }
.more-red > summary::-webkit-details-marker { display: none; }
.more-red[open] > summary { display: none; }
.more-red > .issue:first-of-type { margin-top: 8px; }

/* ---------- Dialogs: Eksportér and Tilføj scene ---------- */
dialog.dlg { width: min(640px, calc(100vw - 32px)); max-height: 92vh; overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow); font-family: 'Barlow', system-ui, sans-serif; font-size: 18px; line-height: 1.45; }
dialog.dlg::backdrop { background: rgba(10, 12, 17, .55); }
.dlg form { display: flex; flex-direction: column; gap: 18px; }
.dlg h2 { font-size: 32px; }
.dlg fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.dlg legend, .dlg .lbl { font-weight: 700; padding: 0; margin-bottom: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dlg .seg { flex-wrap: wrap; }
.dlg .seg label { min-width: 200px; padding: 8px 12px; text-align: center; }
.dlg .seg label + label { border-left: 1px solid var(--line); }
.dlg .check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.dlg .check input { width: 22px; height: 22px; flex: none; accent-color: var(--primary); }
.dlg .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.dlg .grid .check { padding: 6px 12px; border: 1px solid var(--line); border-radius: 12px; }
.dlg .grid .check img { height: 22px; max-width: 48px; object-fit: contain; }
.dlg .grid .check span, .dlg .check span { min-width: 0; overflow-wrap: anywhere; }
.dlg .dates { display: flex; flex-wrap: wrap; gap: 12px; }
.dlg .dates label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.dlg .linkbtn { border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 6px; }
.dlg .is-quiet { opacity: .45; }
.dlg .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.field { font: inherit; color: var(--ink); min-height: 52px; padding: 10px 14px; border: 1px solid var(--line); background: var(--field); border-radius: 12px; width: 100%; max-width: 480px; }
@media (max-width: 820px) {
  .menu-panel { right: auto; left: 0; }
  .dlg .seg label { min-width: 0; flex-basis: 100%; }
  .dlg .seg label + label { border-left: 0; border-top: 1px solid var(--line); }
  .dlg .actions .btn { width: 100%; }
}

/* ---------- Long names: a scene or screen name with no spaces wraps instead of widening the page ---------- */
.card, .cards > *, .issue > div { min-width: 0; }
.card h3, .issue .what, .issue .means, .pagehead h1, .pagehead .sub, .empty h2, .note { overflow-wrap: anywhere; }
.issue .btn { white-space: normal; text-align: center; }
