/* TimeGuru Backoffice — let, minimalistisk stylesheet uden build-trin. */
:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --border: #ececec;
    --border-strong: #dcdcdc;
    --text: #18181b;
    --muted: #71717a;
    --faint: #a1a1aa;
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #eff4ff;
    --ok: #15803d;
    --ok-bg: #effaf3;
    --warn: #a16207;
    --warn-bg: #fefaec;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --radius: 10px;
    --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14.5px/1.55 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; margin: 0 0 .2rem; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
code, pre { font-family: var(--mono); font-size: .84rem; }
pre { background: #18181b; color: #e4e4e7; padding: 1rem; border-radius: var(--radius); overflow: auto; white-space: pre-wrap; word-break: break-word; }

/* Topbar */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 1.5rem;
    height: 56px; padding: 0 1.5rem;
    background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 600; }
.logo:hover { text-decoration: none; }
.logo-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--text); color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: .02em; }
.logo-text { font-size: .95rem; }
.topnav { display: flex; align-items: center; gap: .25rem; flex: 1; min-width: 0; }
.topnav > a, .menu > summary {
    display: inline-flex; align-items: center; gap: .4rem;
    height: 34px; padding: 0 .7rem; border-radius: 8px;
    color: var(--muted); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.topnav > a:hover, .menu > summary:hover { background: #f4f4f5; color: var(--text); text-decoration: none; }
.topnav > a.active, .menu[data-active] > summary { color: var(--text); background: #f4f4f5; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: .72rem; line-height: 18px; text-align: center; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.topnav .menu > summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .6; }
.menu-panel {
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 200px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,.08); padding: .35rem; display: flex; flex-direction: column;
}
.menu-right { left: auto; right: 0; }
.menu-panel a, .menu-panel button {
    display: block; width: 100%; text-align: left; padding: .5rem .65rem; border-radius: 6px;
    color: var(--text); background: none; border: 0; font: inherit; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: #f4f4f5; text-decoration: none; }
.menu-panel a.active { color: var(--brand); }
.menu-head { padding: .5rem .65rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.menu-head strong { display: block; font-weight: 600; }
.menu-head span { color: var(--muted); font-size: .82rem; }
.health-menu { margin-left: auto; }
.health-menu + .user-menu { margin-left: 0; }
.health-menu > summary.health { position: relative; padding: 0 .55rem; color: var(--muted); }
.health-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #d4d4d8; flex: none; }
summary.health .health-dot { position: absolute; top: 6px; right: 5px; width: 9px; height: 9px; border: 2px solid #fff; box-sizing: content-box; }
.health-ok .health-dot, .health-dot.health-ok { background: #22c55e; }
.health-warn .health-dot, .health-dot.health-warn { background: #eab308; }
.health-fail .health-dot, .health-dot.health-fail { background: #ef4444; }
.health-unknown .health-dot, .health-dot.health-unknown { background: #a1a1aa; }
summary.health-fail { color: var(--danger); }
.health-panel { min-width: 300px; }
.health-row { display: flex; gap: .6rem; align-items: baseline; padding: .45rem .65rem; }
.health-panel > a { border-top: 1px solid var(--border); border-radius: 0 0 6px 6px; margin-top: .3rem; }
.user-menu { margin-left: auto; }
.user-menu > summary { color: var(--text); padding: 0 .4rem 0 .3rem; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: .8rem; }

.main { padding: 1.75rem 2rem 3rem; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
.page-head .sub { color: var(--muted); }

/* Kort og grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1rem; }
.grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-bottom: 1.5rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1.1rem; transition: border-color .15s; }
a.stat:hover { border-color: var(--border-strong); }
.stat .label { color: var(--muted); font-size: .82rem; }
.stat .value { font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; }
.stat.warn .value { color: var(--warn); }
.stat.danger .value { color: var(--danger); }
.module { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 1rem 1.1rem; }
.module h3 { margin: 0 0 .25rem; font-size: .95rem; font-weight: 600; }
.module p { color: var(--muted); font-size: .88rem; margin-bottom: .5rem; }

/* Overblik */
.compact-head { margin-bottom: 1rem; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 500; margin: 0 0 .5rem; }
.grid.compact { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; margin-bottom: 1.25rem; }
.grid.compact .stat { padding: .6rem .85rem; color: inherit; text-decoration: none; }
.grid.compact .stat .label { font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid.compact .stat .value { font-size: 1.15rem; line-height: 1.5; }
.grid.compact .stat .value .badge { font-size: .76rem; vertical-align: middle; }
.grid.compact .module { padding: .65rem .85rem; color: inherit; text-decoration: none; }
.grid.compact .module.live { border-style: solid; }
.grid.compact .module.live:hover { border-color: var(--border-strong); }
.grid.compact .module h3 { font-size: .88rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.grid.compact .module p { font-size: .8rem; margin: 0; }

.chart-card { padding: 1rem 1.25rem .75rem; margin-bottom: 1.25rem; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.chart-head h2 { margin: 0; font-size: .95rem; }
.chart-legend { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: .84rem; }
.chart-legend strong { font-weight: 600; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .4rem; vertical-align: -1px; }
.sw-calls, .bar-calls { background: #2563eb; }
.sw-mails, .bar-mails { background: #93c5fd; }
.chart { display: flex; gap: .5rem; height: 150px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: .7rem; color: var(--faint); text-align: right; min-width: 1.5rem; padding-bottom: 18px; line-height: 0; }
.chart-plot {
    flex: 1; display: flex; gap: 3px; min-width: 0;
    background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px);
    background-size: 100% calc((100% - 18px) / var(--rows));
    background-repeat: repeat-y;
}
.chart-day { flex: 1; display: flex; flex-direction: column; min-width: 0; border-radius: 4px; }
.chart-day:hover { background: rgba(37,99,235,.05); }
.chart-day.weekend .bars { opacity: .45; }
.bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 1px; border-bottom: 1px solid var(--border-strong); }
.bar { width: 42%; max-width: 12px; border-radius: 2px 2px 0 0; min-height: 0; }
.chart-label { height: 18px; font-size: .7rem; color: var(--faint); text-align: center; white-space: nowrap; line-height: 18px; overflow: visible; }
.chart-day.today .chart-label { color: var(--text); font-weight: 600; }

/* Dagens tal */
.grid.compact.today .stat .value { font-size: 1.5rem; }
.today .stat .value .health-dot { width: 12px; height: 12px; vertical-align: 2px; }
.today .stat.health-fail .value { color: var(--danger); }
.today .stat.health-warn .value { color: var(--warn); }

/* TV-visning: ingen menu, store tal, grafen fylder resten af skærmen */
body.tv { background: #fff; }
body.tv .main { padding: 2.5vh 3vw; min-height: 100vh; display: flex; flex-direction: column; }
.tv-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2.5vh; }
.tv-head .logo-text { font-size: 1.4rem; }
.tv-head .logo-mark { width: 40px; height: 40px; font-size: 1rem; border-radius: 10px; }
.tv-clock { font-size: 1.4rem; color: var(--muted); }
.tv-clock strong { color: var(--text); font-weight: 600; }
body.tv .grid.compact.today { grid-template-columns: repeat(4, 1fr); gap: 1.5vw; margin-bottom: 2.5vh; }
body.tv .grid.compact.today .stat { padding: 2vh 1.5vw; }
body.tv .grid.compact.today .stat .label { font-size: 1.2rem; }
body.tv .grid.compact.today .stat .value { font-size: 4rem; line-height: 1.2; }
body.tv .today .stat .value .health-dot { width: 26px; height: 26px; vertical-align: 6px; }
body.tv .chart-card { flex: 1; display: flex; flex-direction: column; margin: 0; padding: 2vh 1.5vw 1.5vh; }
body.tv .chart-head h2 { font-size: 1.3rem; }
body.tv .chart-head .small, body.tv .chart-legend { font-size: 1.1rem; }
body.tv .sw { width: 14px; height: 14px; }
body.tv .chart { flex: 1; height: auto; min-height: 300px; }
body.tv .chart-axis, body.tv .chart-label { font-size: .95rem; }
body.tv .bar { max-width: 22px; }

/* Tabeller */
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 500; background: #fcfcfc; }
tbody tr:hover { background: #fcfcfd; }
tr:last-child td { border-bottom: 0; }
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.25rem; background: var(--surface); }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.nowrap { white-space: nowrap; }
.truncate { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Badges */
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 500; background: #f4f4f5; color: #52525b; border: 1px solid #ececec; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: #d6f0df; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: #f5e6b8; }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: #f8d4d4; }

/* Beskeder */
.alert { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; font-size: .92rem; }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: #d6f0df; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: #f5e6b8; }
.alert.danger { background: var(--danger-bg); color: var(--danger); border-color: #f8d4d4; }
.alert ul { margin: 0; padding-left: 1.1rem; }

/* Formularer */
label { display: block; font-weight: 500; font-size: .88rem; margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
.hint { color: var(--muted); font-size: .8rem; font-weight: 400; }
input[type=text], input[type=email], input[type=password], select, textarea {
    width: 100%; padding: .5rem .7rem; border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; background: #fff; color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
input[type=text], input[type=email], input[type=password], select { max-width: 440px; }
textarea { line-height: 1.6; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.checkbox { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; margin-bottom: .5rem; }
.checkbox input { margin-top: .3rem; }
.checkbox strong { display: block; font-weight: 500; }
.error { color: var(--danger); font-size: .84rem; margin-top: .25rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .48rem .95rem; border-radius: 8px; border: 1px solid var(--text); background: var(--text); color: #fff; font: inherit; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { background: #3f3f46; border-color: #3f3f46; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: #f4f4f5; }
.btn.danger { background: #fff; color: var(--danger); border-color: #f1c4c4; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.small { padding: .3rem .65rem; font-size: .84rem; }
form.inline { display: inline; }
.linklike { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }

/* Login-sider */
.guest { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.guest-box { width: 100%; max-width: 400px; }
.guest-box .brand { display: flex; align-items: center; justify-content: center; gap: .5rem; padding: 0 0 1.25rem; font-weight: 600; font-size: 1.05rem; }
.guest-box .brand::before { content: "TG"; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--text); color: #fff; font-size: .75rem; font-weight: 700; }
.guest-box .brand span { color: var(--muted); font-weight: 400; }
.guest-box .card { padding: 1.75rem; }
.guest-box input { max-width: none; }

/* 2FA */
.qr { background: #fff; display: inline-block; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem 1rem; max-width: 440px; background: #f4f4f5; padding: 1rem; border-radius: var(--radius); font-family: var(--mono); }

/* Paginering */
.pagination { display: flex; gap: .3rem; list-style: none; padding: 0; margin: 0 0 1.25rem; }
.pagination a, .pagination span { display: block; padding: .28rem .65rem; border: 1px solid var(--border); border-radius: 7px; background: #fff; font-size: .84rem; color: var(--text); }
.pagination .current span { background: var(--text); color: #fff; border-color: var(--text); }
.pagination .disabled span { color: var(--faint); }

dl.meta { display: grid; grid-template-columns: 170px 1fr; gap: .45rem 1rem; margin: 0; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; word-break: break-word; }

/* Support */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.thread { display: flex; flex-direction: column; gap: .75rem; }
.msg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1.1rem; }
.msg.outbound { background: #f7f9ff; border-color: #e3e9fb; }
.msg.note { background: #fffcf3; border-color: #f3e8c8; }
.msg.note .msg-head strong::before { content: "Notat · "; color: var(--warn); font-weight: 600; }
.msg-head { display: flex; justify-content: space-between; gap: 1rem; font-size: .84rem; color: var(--muted); margin-bottom: .45rem; }
.msg-head strong { color: var(--text); font-weight: 600; }
.msg-body { white-space: pre-wrap; word-break: break-word; }
.draft-panel { position: sticky; top: 72px; }
.signature { white-space: pre-wrap; color: var(--muted); font-size: .88rem; border-left: 2px solid var(--border-strong); padding-left: .75rem; margin: .6rem 0 1rem; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .75rem; }
.toolbar select { width: auto; }
.sources { font-size: .8rem; color: var(--muted); margin-top: .75rem; }
.sources a { color: var(--muted); text-decoration: underline; }
.tabs { display: inline-flex; gap: .2rem; padding: .2rem; background: #f4f4f5; border-radius: 9px; flex-wrap: wrap; }
.tabs .btn { border: 0; background: transparent; color: var(--muted); }
.tabs .btn:not(.secondary) { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.tabs .btn:hover { background: #fff; color: var(--text); }
details.inline-form summary { cursor: pointer; color: var(--brand); font-size: .9rem; }
.radio-list label { display: flex; gap: .55rem; align-items: center; font-weight: 400; margin-bottom: .4rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1.25rem; }
.form-grid input, .form-grid select { max-width: none; }

/* Driftsstatus */
.timeline { display: flex; gap: 2px; margin: .5rem 0 .25rem; }
.timeline span { flex: 1; height: 20px; border-radius: 3px; background: #eeeeef; }
.timeline .ok { background: #4ade80; }
.timeline .warn { background: #facc15; }
.timeline .fail { background: #f87171; }
.timeline .unknown { background: #d4d4d8; }

@media (max-width: 1000px) {
    .ticket-layout { grid-template-columns: 1fr; }
    .draft-panel { position: static; }
}
@media (max-width: 760px) {
    .topbar { gap: .5rem; padding: 0 .75rem; height: auto; min-height: 56px; flex-wrap: wrap; }
    .logo-text, .user-name { display: none; }
    .topnav { order: 3; flex-basis: 100%; flex-wrap: wrap; padding-bottom: .5rem; }
    .main { padding: 1.25rem 1rem 2rem; }
}
