/* Task Manager – fælles stil. Ingen eksterne skrifttyper eller scripts, så CSP kan være 'self'. */
:root {
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #EBEFF4;
  --fg: #17202B;
  --muted: #566173;
  --line: #D5DBE3;
  --line-strong: #A9B4C3;
  --accent: #946010;
  --accent-line: #B57D1E;
  --accent-soft: #F6E6C4;
  --on-accent: #FFFFFF;
  --hk: #1E5DA6; --hk-bg: #E1ECFA;
  --mt: #AE411A; --mt-bg: #FBE4DA;
  --rs: #2B7340; --rs-bg: #DFF0E3;
  --rc: #6843A3; --rc-bg: #ECE4F8;
  --good: #2B7340; --good-bg: #DFF0E3;
  --bad: #AE2F1A; --bad-bg: #FBE2DC;
  --warn: #8A5A00; --warn-bg: #FBEFD5;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E131A; --surface: #151C26; --surface-2: #1C2531; --fg: #E5EAF0; --muted: #98A4B5;
    --line: #2A3544; --line-strong: #46536A; --accent: #E3AE57; --accent-line: #D49B3F; --accent-soft: #382A12;
    --on-accent: #1A1305;
    --hk: #8DBCF3; --hk-bg: #172840; --mt: #F2A07F; --mt-bg: #3A1F16; --rs: #8ED29E; --rs-bg: #16301E;
    --rc: #C4A9EF; --rc-bg: #2A2140; --good: #8ED29E; --good-bg: #16301E; --bad: #F4A08C; --bad-bg: #3B1C16;
    --warn: #F0C46B; --warn-bg: #3A2C10;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, blockquote { margin: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.muted { color: var(--muted); font-size: .9rem; }

/* Topbar */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px max(16px, env(safe-area-inset-left)); background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: -.01em; }
.brand span { font-weight: 400; color: var(--muted); margin-left: 8px; }
.topbar nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: .95rem; }

.container { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; display: flex; flex-direction: column; gap: 28px; }
.toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.toolbar h1 { font-size: 1.6rem; letter-spacing: -.01em; margin-right: auto; }
section > h2 { font-size: 1.05rem; margin-bottom: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* Knapper */
.btn {
  font: 600 .92rem var(--font); padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg);
}
.btn:hover { border-color: var(--accent-line); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-line); }
.btn-danger { color: var(--bad); }
.btn-ghost { background: transparent; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.segmented button { font: 500 .9rem var(--font); padding: 6px 14px; border: 0; background: var(--surface); color: var(--fg); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* Kort */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.card.is-overdue { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.card[data-status="done"], .card[data-status="cancelled"] { opacity: .75; }
.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.room { font: 600 .9rem var(--mono); }
.card h3 { font-size: 1.1rem; line-height: 1.3; }
.guest {
  font-size: .95rem; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 8px 10px;
  overflow-wrap: anywhere; white-space: pre-wrap;
}
.card-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .9rem; }
.due { color: var(--muted); font-variant-numeric: tabular-nums; }
.due.overdue { color: var(--bad); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.chip { font: 600 .78rem/1.3 var(--font); padding: 3px 8px; border-radius: 4px; }
.dept-housekeeping { background: var(--hk-bg); color: var(--hk); }
.dept-maintenance { background: var(--mt-bg); color: var(--mt); }
.dept-roomservice { background: var(--rs-bg); color: var(--rs); }
.dept-reception { background: var(--rc-bg); color: var(--rc); }
.prio-high { background: var(--warn-bg); color: var(--warn); }
.prio-urgent { background: var(--bad-bg); color: var(--bad); }

.status { font-weight: 600; }
.s-pending_approval { color: var(--warn); }
.s-received, .s-in_progress { color: var(--accent); }
.s-needs_help { color: var(--bad); }
.s-done { color: var(--good); }
.s-cancelled { color: var(--muted); text-decoration: line-through; }

.reply summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .92rem; }
.reply form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

textarea, input[type="text"], input[type="password"] {
  font: 1rem var(--font); color: var(--fg); background: var(--surface); width: 100%;
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px;
}
textarea { resize: vertical; min-height: 70px; }

.notices { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 12px 16px; }
.notices ul { margin: 6px 0 0; padding-left: 1.1em; }
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 12px; }

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 500; max-width: 90vw;
}
.toast.error { background: var(--bad); color: #fff; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login {
  width: min(100%, 380px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px; display: flex; flex-direction: column; gap: 14px;
}
.login h1 { font-size: 1.5rem; }
.login label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; }
.error { color: var(--bad); background: var(--bad-bg); padding: 8px 12px; border-radius: 8px; font-size: .92rem; }

/* Gæstechat */
.chat { max-width: 640px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--surface); }
.chat header { padding: 16px; border-bottom: 1px solid var(--line); }
.chat header h1 { font-size: 1.2rem; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 82%; padding: 9px 12px; border-radius: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble time { display: block; font-size: .75rem; color: var(--muted); margin-top: 3px; }
.from-guest { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.from-hotel { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.bubble.sending { opacity: .6; }
.composer { display: flex; gap: 8px; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.composer textarea { min-height: 46px; }

/* Statistik */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
