/* ============ Uptime CRM – design system ============
   Ét sted at rette farver: alle sider bruger disse tokens.        */
:root {
    /* Uptime-rød er den primære farve */
    --red: #da001b;
    --red-hover: #b80017;
    --red-soft: #fdeaec;

    /* Tekst i tre trin */
    --ink: #1a1d21;
    --ink-2: #5a6270;
    --ink-3: #98a0ad;

    --bg: #f5f6f8;
    --card: #ffffff;
    --line: #e7e9ee;

    --green: #0e8345;  --green-soft: #e7f5ec;
    --amber: #b25e00;  --amber-soft: #fdf3e2;
    --blue:  #1b5fae;  --blue-soft:  #e9f1fb;
    --purple: #6d28d9; --purple-soft: #f5f3ff;

    /* Menuen er lys som resten af fladen — den sorte bjælke skar siden i to,
       og de lilla gradienter hørte ikke til i et rødt design. Accenten er
       Uptime-rød, brugt sparsomt: aktivt punkt, logo og fremhævninger. */
    --sidebar-bg: #ffffff;
    --sidebar-fg: #5a6270;
    --sidebar-fg-strong: #1a1d21;
    --sidebar-hover: #f2f3f6;
    --sidebar-line: #e7e9ee;
    /* Gammelt navn, peger nu på hover-fladen */
    --sidebar-active: var(--sidebar-hover);

    --radius: 12px;
    --shadow: 0 1px 3px rgba(20, 22, 26, .06), 0 1px 2px rgba(20, 22, 26, .04);

    /* Gamle navne peger på de nye, så intet skal rettes to steder */
    --accent: var(--red);
    --accent-hover: var(--red-hover);
    --accent-soft: var(--red-soft);
    --border: var(--line);
    --text: var(--ink);
    --text-muted: var(--ink-2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* hidden-attributten skal altid vinde — også over display: flex m.m. */
[hidden] { display: none !important; }

html { font-size: 16px; }

body {
    font-family: 'Segoe UI Variable', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ App-layout ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-line);
    color: var(--sidebar-fg);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--sidebar-line);
    color: var(--sidebar-fg-strong);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

/* Logoet er det ene sted, den røde må fylde */
.sidebar-brand .logo {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: var(--red);
    display: grid; place-items: center;
    font-size: .9rem; font-weight: 800; color: #fff;
}

.sidebar-nav { flex: 1; padding: 8px 12px; }

.sidebar-nav .nav-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--ink-3);
    padding: 10px 10px 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--sidebar-fg);
    font-size: .92rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}

.sidebar-nav a:hover { background: var(--sidebar-hover); color: var(--sidebar-fg-strong); text-decoration: none; }
/* Aktivt punkt: rød på rødt-lyst frem for en fuldtonet klat */
.sidebar-nav a.active { background: var(--red-soft); color: var(--red); font-weight: 600; }
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Administrator-gruppen: fold ud/ind, samme udseende som menupunkterne */
.nav-group-toggle {
    display: flex; align-items: center; gap: 11px; width: 100%;
    padding: 10px 12px; border: 0; border-radius: 9px; cursor: pointer;
    background: none; color: var(--sidebar-fg);
    font: inherit; font-size: .92rem; font-weight: 500; margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-group-toggle:hover { background: var(--sidebar-hover); color: var(--sidebar-fg-strong); }
.nav-group-toggle svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-group-toggle .caret { width: 14px; height: 14px; margin-left: auto; transition: transform .15s; }
.nav-group-toggle.open .caret { transform: rotate(180deg); }
.nav-group a { padding-left: 41px; font-size: .88rem; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px 16px;
    border-top: 1px solid var(--sidebar-line);
}

/* Samme avatar som i listerne — rød på lys rød, ikke en lilla gradient */
.sidebar-user .avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--red-soft);
    color: var(--red);
    display: grid; place-items: center;
    font-size: .8rem; font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { color: var(--sidebar-fg-strong); font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.sidebar-user .user-role { color: var(--ink-3); font-size: .75rem; }

.sidebar-user .logout {
    color: var(--ink-3);
    padding: 6px;
    border-radius: 7px;
    display: grid; place-items: center;
}
.sidebar-user .logout:hover { color: var(--red); background: var(--red-soft); text-decoration: none; }
.sidebar-user .logout svg { width: 17px; height: 17px; }

/* ============ Hovedindhold ============ */
.main { flex: 1; min-width: 0; padding: 32px 40px 60px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.page-header .subtitle { color: var(--text-muted); font-size: .9rem; margin-top: 3px; }

.breadcrumb { font-size: .82rem; color: var(--text-muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

/* ============ Kort ============ */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card + .card { margin-top: 24px; }

.card-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-header h2 { font-size: 1rem; font-weight: 600; }
.count-pill {
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 99px;
}

.card-body { padding: 22px; }

/* ============ Tabeller ============ */
.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: .89rem; }

table.data th {
    text-align: left;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data th a.th-sort {
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
table.data th a.th-sort:hover { color: var(--accent); text-decoration: none; }
table.data th a.th-sort.active { color: var(--accent); }
.sort-arrow { font-size: .6rem; }

table.data td {
    padding: 13px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: #f8faff; }
table.data tbody tr:last-child td { border-bottom: none; }

.row-link { color: var(--text); font-weight: 600; }
.row-link:hover { color: var(--accent); text-decoration: none; }

.cell-muted { color: var(--text-muted); }
.cell-nowrap { white-space: nowrap; }

.entity {
    display: flex; align-items: center; gap: 12px;
}
/* Initialerne i listerne er pynt, ikke signal — derfor neutrale. Så betyder
   den røde noget, dér hvor den bruges (handlinger, aktivt menupunkt, status). */
.entity .avatar {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: #eef0f4;
    color: var(--ink-2);
    display: grid; place-items: center;
    font-size: .75rem; font-weight: 700;
    flex-shrink: 0;
}
.entity .avatar.round { border-radius: 50%; }
.entity .entity-sub { font-size: .78rem; color: var(--text-muted); }

/* ============ Badges ============ */
.badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
    white-space: nowrap;
}
.badge-green  { background: var(--green-soft);  color: var(--green); }
.badge-blue   { background: var(--blue-soft);   color: var(--blue); }
.badge-amber  { background: var(--amber-soft);  color: var(--amber); }
.badge-red    { background: var(--red-soft);    color: var(--red); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-muted  { background: var(--bg);          color: var(--ink-2); border: 1px solid var(--line); }

/* Status-badges følger pipelinen: suspect → prospect → confirmed → client → dropped */
.badge-status-ny        { background: var(--blue-soft);   color: var(--blue); }
.badge-status-varm      { background: var(--amber-soft);  color: var(--amber); }
.badge-status-confirmed  { background: var(--purple-soft); color: var(--purple); }
.badge-status-kunde     { background: var(--green-soft);  color: var(--green); }
.badge-status-droppet   { background: var(--red-soft);    color: var(--red); }
.badge-status-senere,
.badge-status-tom     { background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }

/* ============ Søgning & værktøjslinje ============ */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }

.search-box { position: relative; flex: 1; max-width: 380px; }
.search-box svg {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; color: var(--text-muted);
    pointer-events: none;
}
.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: .9rem;
    font-family: inherit;
    background: var(--card);
    color: var(--text);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(218, 0, 27, .12); }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: .9rem; font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    transition: background .15s;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-danger { background: transparent; color: #b91c1c; border: 1px solid #fecaca; }
.btn-danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger svg { width: 15px; height: 15px; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; color: var(--text-muted); }

/* ============ Filterdropdowns ============ */
.filter-form { align-items: stretch; }

.dropdown { position: relative; }
.dropdown summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    font-size: .88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    user-select: none;
    white-space: nowrap;
}
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown summary::after { content: '▾'; font-size: .7rem; color: var(--text-muted); }
.dropdown[open] summary { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(218, 0, 27, .12); }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
    padding: 8px;
    min-width: 240px;
    /* så høj som skærmen tillader, så man slipper for at scrolle i listen */
    max-height: calc(100vh - 240px);
    overflow-y: auto;
    z-index: 50;
}

@media (max-width: 760px) {
    .dropdown-menu { max-height: 45vh; }
}
.dropdown-menu label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: .87rem;
    cursor: pointer;
    white-space: nowrap;
}
.dropdown-menu label:hover { background: #f1f5f9; }
.dropdown-menu input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }

/* Søgefelt i lange filterlister (fx virksomheder) — bliver klæbende i toppen */
.dropdown-search {
    position: sticky;
    top: -8px;
    z-index: 1;
    width: 100%;
    margin-bottom: 6px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: .85rem;
    background: var(--card);
}
.dropdown-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(218, 0, 27, .12); }
.dropdown-menu label[hidden] { display: none; }

.filter-count {
    background: var(--accent);
    color: #fff;
    border-radius: 99px;
    font-size: .7rem;
    padding: 1px 8px;
    font-weight: 700;
}

/* ============ Massehandlinger ============ */
.bulk-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    flex-wrap: wrap;
}
.bulk-count { font-size: .85rem; color: var(--text-muted); font-weight: 600; min-width: 60px; }
.bulk-bar .input { padding: 8px 12px; }
.bulk-bar .btn:disabled { opacity: .45; cursor: not-allowed; }

.col-check { width: 36px; text-align: center; }
.col-check input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
tr.row-selected { background: var(--accent-soft) !important; }

/* ============ Pagination ============ */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    font-size: .85rem;
    color: var(--text-muted);
    flex-wrap: wrap; gap: 10px;
}
.pagination .pages { display: flex; gap: 5px; }
.pagination .pages a, .pagination .pages span {
    min-width: 34px; height: 34px;
    display: grid; place-items: center;
    padding: 0 8px;
    border-radius: 8px;
    font-weight: 500;
    color: var(--text-muted);
}
.pagination .pages a:hover { background: #f1f5f9; text-decoration: none; color: var(--text); }
.pagination .pages .current { background: var(--accent); color: #fff; font-weight: 600; }
.pagination .pages .gap { color: #cbd5e1; }

/* ============ Detaljesider ============ */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.dl { display: grid; grid-template-columns: 160px 1fr; row-gap: 14px; font-size: .9rem; }
/* To felter på samme række, fx postnr. + by */
.dl-pair { display: flex; gap: 8px; }
.dl textarea.edit-input { resize: vertical; min-height: 62px; line-height: 1.5; }
.dl dt { color: var(--text-muted); font-weight: 500; }
.dl dd { font-weight: 500; }

.detail-hero { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
/* Handlinger (fx slet) skubbes til højre i hero-linjen */
.hero-actions { margin-left: auto; }
.hero-actions .btn { display: inline-flex; align-items: center; gap: 7px; }

/* ============ Firmaside: hero, faner, nøgletal, tidslinje ============ */
.hero {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px 0;
    margin-bottom: 16px;
}
.hero-top { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.hero-main { flex: 1; min-width: 220px; }
.hero-main h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.hero-sub { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; font-size: .85rem; color: var(--ink-2); }
.hero-sub a { color: var(--blue); }
.hero-top .hero-actions { margin-left: 0; display: flex; gap: 8px; align-items: flex-start; }

/* Klikbare pills: viser værdien og skifter den uden at forlade siden */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill .mini { width: 18px; height: 18px; border-radius: 50%; background: var(--ink-2); color: #fff; display: grid; place-items: center; font-size: .6rem; font-weight: 700; }
.pill-ny, .pill-inbound { background: var(--blue-soft); color: var(--blue); }
.pill-varm, .pill-lead { background: var(--amber-soft); color: var(--amber); }
.pill-kunde, .pill-customer { background: var(--green-soft); color: var(--green); }
.pill-droppet { background: var(--red-soft); color: var(--red); }
.pill-senere, .pill-tom { background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.pill-opportunity, .pill-confirmed { background: var(--purple-soft); color: var(--purple); }
.pill-owner, .pill-outbound { background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }

.pill-dd { position: relative; display: inline-block; }
.pill-dd > .pill { cursor: pointer; border: 1px solid transparent; }
.pill-dd > .pill.pill-tom, .pill-dd > .pill.pill-owner, .pill-dd > .pill.pill-senere,
.pill-dd > .pill.pill-outbound { border-color: var(--line); }
.pill-dd > .pill::after { content: '▾'; font-size: .65rem; margin-left: 2px; opacity: .7; }
.pill-dd .pill-menu {
    display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 10px 30px rgba(20, 22, 26, .12); min-width: 170px; padding: 5px;
    flex-direction: column; max-height: 320px; overflow-y: auto;
}
.pill-dd.open .pill-menu { display: flex; }
.pill-dd .pill-menu button {
    display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
    padding: 7px 10px; border-radius: 7px; font: inherit; font-size: .83rem; font-weight: 500;
    border: 0; background: transparent; cursor: pointer; color: var(--ink);
}
.pill-dd .pill-menu button:hover { background: var(--bg); }
.pill-dd .pill-menu button.sel { font-weight: 700; }
.pill-dd .pill-menu button.sel::after { content: '✓'; margin-left: auto; color: var(--red); }
.pill-dd .pill-menu .dot { width: 8px; height: 8px; border-radius: 50%; }

/* Statusmenu: status til venstre, lead type (stjerner) til højre i samme række */
.pill-stars { color: var(--amber); letter-spacing: 1px; font-size: .72rem; }
.status-dd .pill-menu { min-width: 250px; padding: 6px; }
.status-head {
    display: flex; justify-content: space-between; gap: 20px;
    padding: 4px 10px 8px; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3);
}
.status-row { display: flex; align-items: center; gap: 6px; border-radius: 7px; }
.status-row:hover { background: var(--bg); }
.status-row > .status-pick { flex: 1; min-width: 0; }
.status-row.sel > .status-pick { font-weight: 700; }
.status-dd .pill-menu .status-row button:hover { background: transparent; }
.status-row-clear { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 4px; }
.status-row-clear:hover { background: none; }
.status-dd .pill-menu .status-pick[disabled] { color: var(--ink-3); cursor: default; }

/* Landekode i telefonnumre — nedtonet, så selve nummeret træder frem */
.phone-cc { color: var(--ink-3); }

/* Spinner til ventetid (AI-kald m.m.) */
.spinner {
    display: inline-block; width: 15px; height: 15px; flex-shrink: 0;
    border: 2px solid var(--line); border-top-color: var(--red);
    border-radius: 50%; vertical-align: -3px; margin-right: 8px;
    animation: spinner-rotate .8s linear infinite;
}
@keyframes spinner-rotate { to { transform: rotate(360deg); } }

/* Statusbokse (bruges af CVR-opslag, listeimport og HubSpot-siden) */
.hs-note { font-size: .85rem; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fafbfc; }
.hs-note.warn { background: var(--amber-soft); border-color: #fcd34d; color: var(--amber); }
.hs-note.ok { background: var(--green-soft); border-color: #bfe6cd; color: var(--green); }
.hs-note.error { background: var(--red-soft); border-color: #f6c6cc; color: var(--red); }

/* Redigerbare overskrifter (firmanavn i hero'en, ringelistens titel m.fl.)
   — ligner en almindelig overskrift indtil hover/fokus */
.hero-main h1 .hero-name,
h2 .hero-name {
    font: inherit; letter-spacing: inherit; color: inherit;
    width: 100%; max-width: 520px; padding: 2px 8px; margin-left: -8px;
    border-color: transparent; background: transparent;
}

/* AI research-feedet på firmasiden */
.ai-block { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ai-block:last-child { border-bottom: 0; }
.ai-block-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ai-block-head strong { font-size: .9rem; }
.ai-meta { color: var(--ink-3); font-size: .75rem; margin-left: auto; white-space: nowrap; }
.ai-del { border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: .85rem; padding: 0 2px; }
.ai-del:hover { color: var(--red); }
.ai-body { margin: 8px 0 0; font-size: .88rem; color: var(--ink-2); line-height: 1.55; max-width: 90ch; }
.ai-source { display: inline-block; margin-top: 6px; font-size: .8rem; font-weight: 600; }
.ai-proposal { background: #fffcf2; border-left: 3px solid var(--amber); }
.ai-actions { margin-top: 10px; }

/* Stjernekolonnen på virksomhedslisten — egen kolonne uden overskrift.
   Klik åbner rækkens statusmenu (rating sættes sammen med status). */
.col-stars, .cell-stars { width: 1%; }
.stars-open {
    border: 0; background: none; cursor: pointer;
    padding: 2px 4px; font-size: .82rem; line-height: 1; letter-spacing: 1px;
}
.stars-open .star-view { color: var(--line); }
.stars-open .star-view.on { color: var(--amber); }
.stars-open:hover .star-view { color: var(--amber); }

.status-row .stars { display: flex; padding-right: 6px; flex-shrink: 0; }
.status-dd .pill-menu .star {
    width: auto; padding: 4px 2px; font-size: .95rem; line-height: 1;
    color: var(--line); background: none;
}
.status-dd .pill-menu .star.on { color: var(--amber); }
/* Hover fylder stjernerne op til den man peger på */
.status-row .stars:hover .star { color: var(--amber); }
.status-row .stars .star:hover ~ .star { color: var(--line); }

.status-note {
    margin-top: 6px; padding: 7px 10px; border-top: 1px solid var(--line);
    font-size: .74rem; color: var(--ink-2); line-height: 1.4;
}

/* Faner */
.tabs { display: flex; gap: 2px; margin-top: 14px; border-top: 1px solid var(--line); overflow-x: auto; }
.tabs button {
    padding: 11px 16px; font: inherit; font-size: .85rem; font-weight: 600; color: var(--ink-3);
    position: relative; white-space: nowrap; border: 0; background: none; cursor: pointer;
}
.tabs button .n { font-size: .7rem; color: var(--ink-3); font-weight: 700; margin-left: 4px; }
.tabs button .n.alert { background: var(--red); color: #fff; border-radius: 99px; padding: 1px 7px; }
.tabs button.on { color: var(--ink); }
.tabs button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; background: var(--red); border-radius: 3px 3px 0 0; }
.tabs button:hover { color: var(--ink); }
.panel { display: none; }
.panel.on { display: block; }

/* Faner der er links (fx Aktive/Deaktiverede/Alle på brugersiden) */
.tab-link {
    padding: 11px 16px; font-size: .85rem; font-weight: 600; color: var(--ink-3);
    position: relative; white-space: nowrap;
}
.tab-link:hover { color: var(--ink); text-decoration: none; }
.tab-link.on { color: var(--ink); }
.tab-link.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; background: var(--red); border-radius: 3px 3px 0 0; }
.tab-link .n { font-size: .7rem; color: var(--ink-3); font-weight: 700; margin-left: 4px; }

/* Nøgletals-strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; display: block; }
.kpi .value { font-size: 1.15rem; font-weight: 700; margin-top: 2px; display: flex; align-items: baseline; gap: 8px; }
.kpi .hint { font-size: .75rem; color: var(--ink-3); margin-top: 2px; display: block; }
.kpi .trend { font-size: .75rem; font-weight: 600; }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }
.kpi svg { margin-top: 4px; display: block; }

/* To-kolonne-layout: tidslinje til venstre, kontekst til højre */
.company-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
@media (max-width: 980px) { .company-grid { grid-template-columns: 1fr; } .company-grid .side { order: -1; } }

.next-action {
    display: flex; gap: 10px; align-items: center; background: var(--red-soft);
    border: 1px solid #f6c6cc; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px;
}
.next-action .na-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--red); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.next-action b { font-size: .88rem; display: block; }
.next-action span { font-size: .78rem; color: var(--ink-2); }

/* Log-knapper over tidslinjen — formularen ligger i en dialog */
.log-bar {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding: 12px 16px; border-bottom: 1px solid var(--line);
    background: #fafbfc; border-radius: var(--radius) var(--radius) 0 0;
}
.log-bar .btn { display: inline-flex; align-items: center; gap: 7px; }

.log-dialog {
    border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px));
    box-shadow: 0 24px 60px rgba(20, 22, 26, .22); color: var(--ink); background: var(--card);
    /* Den globale reset (* { margin: 0 }) fjerner browserens egen centrering
       af <dialog> — uden denne åbner dialogen øverst til venstre */
    margin: auto;
}

/* Opkaldsinfo i log-dialogen: kontaktens nummer + QR-kode til at ringe fra mobilen */
.log-call-info { display: none; align-items: center; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.log-call-info.on { display: flex; }
.log-call-info .nr { font-size: 1.05rem; font-weight: 700; }
.log-call-info img { border-radius: 6px; }
.log-dialog::backdrop { background: rgba(20, 22, 26, .4); }
.log-head { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.log-head h3 { font-size: 1rem; font-weight: 700; flex: 1; }
.log-head .close { border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 1.1rem; width: 30px; height: 30px; border-radius: 8px; }
.log-head .close:hover { background: var(--bg); }
.log-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.log-body textarea { resize: vertical; min-height: 110px; }
.log-types { display: flex; gap: 6px; flex-wrap: wrap; }
.log-type {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
    border: 1px solid var(--line); border-radius: 99px; background: var(--card);
    font: inherit; font-size: .82rem; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.log-type:hover { border-color: var(--red); color: var(--red); }
.log-type.on { background: var(--red); border-color: var(--red); color: #fff; }
.log-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.log-fields select { grid-column: 1 / -1; }
@media (max-width: 560px) { .log-fields { grid-template-columns: 1fr; } }
.log-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); background: #fafbfc; }
.log-body label { display: flex; flex-direction: column; gap: 4px; }

/* Mailforslaget: bredere end log-dialogen, for teksten skal kunne læses */
.mail-dialog { width: min(720px, calc(100vw - 32px)); }
.mail-dialog textarea { min-height: 260px; font-family: inherit; line-height: 1.55; }
#log-mail-help { display: flex; align-items: center; }
#log-mail-help .btn { display: inline-flex; align-items: center; gap: 6px; }

/* Opfølgningsdialogen: de åbne opgaver man kan lukke i samme vending */
.fu-open { display: flex; flex-direction: column; gap: 6px; }
.fu-task {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: .86rem;
}
.fu-task-text { flex: 1; min-width: 0; }
.fu-task.done .fu-task-text { text-decoration: line-through; color: var(--ink-3); }
.fu-task.done { opacity: .6; }
.field-label { font-size: .75rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }

/* Diskret bund på nøgletalskortet */
.fin-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); }
.fin-foot .btn { display: inline-flex; align-items: center; gap: 7px; }
.fin-foot .fin-source { font-size: .78rem; color: var(--ink-3); margin-left: auto; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: .83rem; font-weight: 600; color: var(--blue); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Træf der er filtreret væk — dæmpet, så det ikke forveksles med resultaterne */
.outside-filters { margin-top: 18px; border-style: dashed; background: #fafbfc; }
.outside-filters .card-header h2 { font-size: .9rem; color: var(--ink-2); }
.outside-filters table.data td { padding-top: 9px; padding-bottom: 9px; }

.tl { list-style: none; }
.tl li { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.tl li:last-child { border-bottom: none; }
.tl .ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.tl .ico svg { width: 16px; height: 16px; }
.ico-call, .ico-sms { background: var(--green-soft); color: var(--green); }
.ico-email, .ico-linkedin { background: var(--blue-soft); color: var(--blue); }
.ico-note, .ico-task, .ico-other { background: var(--amber-soft); color: var(--amber); }
.ico-meeting { background: var(--red-soft); color: var(--red); }
.tl .body { flex: 1; min-width: 0; }
.tl .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl .title { font-weight: 600; font-size: .9rem; }
.tl .who { font-size: .78rem; color: var(--ink-3); }
.tl .when { margin-left: auto; font-size: .75rem; color: var(--ink-3); white-space: nowrap; }
.tl .text { font-size: .85rem; color: var(--ink-2); margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tl li.expanded .text { -webkit-line-clamp: unset; }
.tl .more { font-size: .78rem; color: var(--blue); font-weight: 600; margin-top: 2px; border: 0; background: none; cursor: pointer; padding: 0; }
.day-sep { padding: 8px 16px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); background: #fafbfc; }

/* Personer i sidepanelet */
.person { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; cursor: pointer; }
.person:last-of-type { border-bottom: none; }
.person:hover { background: #fafbfc; }
.person .av { width: 34px; height: 34px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 700; font-size: .78rem; flex-shrink: 0; }
.person .nm { font-weight: 600; font-size: .88rem; }
.person .ps { font-size: .76rem; color: var(--ink-3); }
.person .acts { margin-left: auto; display: flex; gap: 6px; }
.person .acts a { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-2); }
.person .acts a:hover { border-color: var(--red); color: var(--red); text-decoration: none; }
.person .acts svg { width: 14px; height: 14px; }

.show-all { display: block; width: 100%; text-align: center; padding: 10px; font: inherit; font-size: .82rem; font-weight: 600; color: var(--blue); border: 0; border-top: 1px solid var(--line); background: none; cursor: pointer; }
.show-all:hover { background: #fafbfc; text-decoration: none; }

/* Foldede felter i detaljekortet */
.full-fields { display: none; }
.card.expanded .full-fields { display: contents; }

/* Detaljekortet ligger i fuld bredde under tidslinjen. Er der plads, sættes
   felterne op i to spalter — ellers ville hvert felt stå alene på en 900 px
   bred linje. full-fields er display: contents, så de folder ind i samme grid. */
@media (min-width: 900px) {
    #details .dl { grid-template-columns: 150px minmax(0, 1fr) 150px minmax(0, 1fr); column-gap: 28px; }
}
.pill.saving { opacity: .55; }

/* Regnskabstal med år som kolonner */
.fin-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.fin-table th { text-align: right; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 8px 14px; border-bottom: 1px solid var(--line); }
.fin-table th:first-child { text-align: left; }
.fin-table td { padding: 9px 14px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.fin-table td:first-child { text-align: left; font-weight: 600; }
.fin-table tr:last-child td { border-bottom: none; }
.fin-table .neg { color: var(--red); }

/* Historik */
.hist { list-style: none; }
.hist li { display: flex; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: .85rem; align-items: baseline; }
.hist li:last-child { border-bottom: none; }
.hist .when { color: var(--ink-3); font-size: .78rem; min-width: 78px; flex-shrink: 0; }

/* Kontakt-drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(20, 22, 26, .35); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--card); box-shadow: -12px 0 40px rgba(20, 22, 26, .12); transform: translateX(105%); transition: transform .25s; z-index: 61; overflow-y: auto; }
body.drawer-open .drawer.on { transform: none; }
body.drawer-open .drawer-bg { opacity: 1; pointer-events: auto; }
.drawer-h { display: flex; gap: 12px; align-items: center; padding: 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.drawer-h .av { width: 44px; height: 44px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.drawer-h h3 { font-size: 1.05rem; }
.drawer-h .ps { font-size: .8rem; color: var(--ink-3); }
.drawer-h .close { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; color: var(--ink-3); font-size: 1.1rem; border: 0; background: none; cursor: pointer; flex-shrink: 0; }
.drawer-h .close:hover { background: var(--bg); }
.drawer-quick { display: flex; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-quick a { flex: 1; text-align: center; padding: 9px; border: 1px solid var(--line); border-radius: 9px; font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.drawer-quick a:hover { border-color: var(--red); color: var(--red); text-decoration: none; }
.drawer .sec { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer .sec h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.drawer .sec h4 .autosave-hint { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Bundlinjen i draweren: HubSpot-link og slet — erstatter den gamle kontaktside */
.drawer-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .85rem; }
.drawer-actions a { font-weight: 600; }
.link-danger { border: 0; background: none; padding: 0; cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--red); }
.link-danger:hover { text-decoration: underline; }

/* Tal i menuen, fx forfaldne opgaver */
.sidebar-nav .nav-badge {
    margin-left: auto; background: var(--red); color: #fff;
    font-size: .68rem; font-weight: 700; border-radius: 99px; padding: 1px 7px;
}

/* ============ Opgavetavle ============ */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; align-items: start; }
@media (max-width: 1300px) { .kanban { grid-template-columns: repeat(3, minmax(200px, 1fr)); } }
@media (max-width: 820px) { .kanban { grid-template-columns: repeat(2, minmax(200px, 1fr)); } }
@media (max-width: 560px) { .kanban { grid-template-columns: 1fr; } }

/* Træk-og-slip */
.kanban-cards { min-height: 60px; }
.task-card[draggable="true"] { cursor: grab; }
.task-card.dragging { opacity: .4; }
.kanban-col.drop-over { border-color: var(--red); box-shadow: 0 0 0 3px rgba(218, 0, 27, .12); }
.kanban-col.drop-over .kanban-cards { background: var(--red-soft); border-radius: 8px; }
.kanban-col.dropping { opacity: .6; }

.kanban-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; }
.kanban-col.overdue { border-color: #f6c6cc; background: #fffafa; }
.kanban-col.done { background: #fafbfc; }
.kanban-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px; }
.kanban-head h2 { font-size: .85rem; font-weight: 700; flex: 1; }
.kanban-col.overdue .kanban-head h2 { color: var(--red); }
.kanban-empty { padding: 14px 10px 18px; font-size: .82rem; color: var(--ink-3); }

.task-card { display: flex; gap: 10px; padding: 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.task-card + .task-card { margin-top: 8px; }
.task-card.is-overdue { border-left: 3px solid var(--red); }
.task-card.is-done { opacity: .65; }
.task-card.is-done .task-title { text-decoration: line-through; }
.task-check button {
    width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink-3);
    background: #fff; cursor: pointer; display: grid; place-items: center;
    font-size: .7rem; color: transparent; padding: 0; flex-shrink: 0;
}
.task-check button:hover { border-color: var(--green); color: var(--green); }
.task-check button.checked { border-color: var(--green); background: var(--green); color: #fff; }
.task-card.is-overdue .task-check button { border-color: var(--red); }
.task-body { min-width: 0; flex: 1; }
.task-title { font-size: .87rem; font-weight: 600; overflow-wrap: anywhere; }
/* Titlen er knappen til at rette opgaven */
button.task-title {
    border: 0; background: none; padding: 0; text-align: left; width: 100%;
    font: inherit; font-size: .87rem; font-weight: 600; color: var(--ink); cursor: pointer;
}
button.task-title:hover { color: var(--red); text-decoration: underline; }
.task-note { font-size: .78rem; color: var(--ink-2); margin-top: 2px; }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: .76rem; color: var(--ink-3); margin-top: 5px; align-items: baseline; }
.task-due { font-weight: 600; }
.task-due.overdue { color: var(--red); }

/* Opgaver i tidslinjen: forfaldne skal ikke kunne overses */
.tl li.task-overdue { background: #fffafa; border-left: 3px solid var(--red); }
.tl li.task-overdue .when { color: var(--red); font-weight: 700; }
.tl li.task-done { opacity: .7; }
.tl li.task-done .title { text-decoration: line-through; }
.tl li.task-done .badge { text-decoration: none; display: inline-block; }

/* ============ Økonomiske nøgletal ============ */
.figure-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; }
.figure-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.figure-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.figure-value.negative { color: #b91c1c; }
.figure-delta { font-size: .8rem; margin-top: 4px; }
.figure-delta.up { color: #15803d; }
.figure-delta.down { color: #b91c1c; }
.cell-right { text-align: right; }
.form-error { background: var(--red-soft); border: 1px solid #f6c6cc; color: var(--red); border-radius: 8px; padding: 10px 12px; font-size: .85rem; }
.flash-ok { background: var(--green-soft); border: 1px solid #bfe6cd; color: var(--green); border-radius: 8px; padding: 10px 12px; font-size: .85rem; font-weight: 600; }

/* ⋯-menu: sjældne og uigenkaldelige handlinger gemmes et klik væk */
.actions-menu { margin-left: auto; }
.actions-menu summary { padding: 9px 11px; }
.actions-menu summary::after { content: none; }
.actions-menu summary svg { width: 18px; height: 18px; display: block; }
.actions-menu .dropdown-menu { left: auto; right: 0; min-width: 200px; max-height: none; padding: 6px; }
.actions-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font: inherit;
    font-size: .87rem;
    text-align: left;
    cursor: pointer;
    color: var(--text);
}
.actions-menu .menu-item:hover { background: #f1f5f9; }
.actions-menu .menu-item svg { width: 15px; height: 15px; flex: none; }
.actions-menu .menu-item.danger { color: #b91c1c; }
.actions-menu .menu-item.danger:hover { background: #fef2f2; }
/* Dæmpet, så den primære knap i samme linje er det stærkeste på siden */
.avatar-lg {
    width: 52px; height: 52px;
    border-radius: 12px;
    background: var(--red-soft);
    color: var(--red);
    display: grid; place-items: center;
    font-size: 1.25rem; font-weight: 700;
    flex-shrink: 0;
}
.avatar-lg.round { border-radius: 50%; }
.detail-hero h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.detail-hero .hero-meta { display: flex; gap: 8px; margin-top: 6px; align-items: center; flex-wrap: wrap; }

/* ============ Inline-redigering (autosave) ============ */
.dl-edit dd { display: flex; align-items: center; gap: 8px; }
.dl-edit .dl-static { display: block; }

.edit-input {
    width: 100%;
    max-width: 280px;
    padding: 6px 10px;
    font-size: .9rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    outline: none;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.edit-input:hover { border-color: var(--border); background: var(--card); }
.edit-input:focus { border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px rgba(218, 0, 27, .12); }
select.edit-input { cursor: pointer; }
.edit-input.saved { border-color: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .15); }
.edit-input.save-error { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }

.edit-with-link a { color: var(--text-muted); font-size: 1rem; text-decoration: none; flex-shrink: 0; }
.edit-with-link a:hover { color: var(--accent); }

.autosave-hint { font-size: .75rem; color: var(--text-muted); transition: color .15s; }
.autosave-hint.saving { color: var(--accent); }
.autosave-hint.saved { color: #059669; font-weight: 600; }
.autosave-hint.save-error { color: #dc2626; font-weight: 600; }

/* ============ Dashboard ============ */
.welcome { margin-bottom: 28px; }
.welcome h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.welcome p { color: var(--text-muted); margin-top: 5px; }

/* Dashboardet må bruge hele bredden — kortene var før klemt ned i 720 px */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }

/* Nederste række: seneste aktiviteter + (for admins) hvem der har lavet mest */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; margin-top: 20px; }
.dash-grid.single { grid-template-columns: 1fr; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

/* Ugetal fra aktivitetsloggen */
.week-tiles {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px; padding: 16px;
}
.week-tile {
    display: block;
    border: 1px solid var(--line); border-radius: 12px;
    padding: 14px 15px;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s, transform .12s;
}
.week-tile:hover {
    text-decoration: none; border-color: var(--red);
    box-shadow: 0 6px 16px rgba(218, 0, 27, .10);
    transform: translateY(-1px);
}
.week-tile .n { display: block; font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.week-tile .lbl { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: .82rem; color: var(--ink-2); }
/* Totalen skiller sig ud — det er den, man aflæser først */
.week-tile.total { background: var(--red-soft); border-color: #f6c6cc; }
.week-tile.total .n { color: var(--red); }
.week-tile.total .lbl { color: var(--red); }

/* Bladring mellem uger — på dashboardet og i aktivitetsloggen */
.week-nav {
    display: inline-flex; align-items: center; gap: 2px;
    border: 1px solid var(--line); border-radius: 99px;
    padding: 2px 4px; background: var(--card);
}
.week-nav .week-now {
    font-size: .8rem; color: var(--ink-2); font-weight: 600;
    padding: 0 8px; white-space: nowrap;
}
.week-nav .week-arrow {
    width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center;
    color: var(--ink-2); font-size: 1.1rem; line-height: 1;
    text-decoration: none;
}
.week-nav a.week-arrow:hover { background: var(--red-soft); color: var(--red); text-decoration: none; }
.week-nav .week-arrow.off { color: #d6d9df; cursor: default; }
/* I loggens fanerække står bladringen til højre for fanerne */
.tabs .week-nav { margin: 6px 6px 6px auto; }

.delta { font-size: .72rem; font-weight: 700; border-radius: 99px; padding: 1px 7px; white-space: nowrap; }
.delta-up   { background: var(--green-soft); color: var(--green); }
.delta-down { background: var(--amber-soft); color: var(--amber); }
.delta-same { background: var(--card); color: var(--ink-3); border: 1px solid var(--line); }

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex; align-items: center; gap: 18px;
    color: var(--text);
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.stat-card:hover {
    text-decoration: none;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(218, 0, 27, .10);
}
.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 13px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid; place-items: center;
    flex-shrink: 0;
}
.stat-card .stat-icon svg { width: 23px; height: 23px; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.stat-card .stat-label { color: var(--text-muted); font-size: .85rem; }

/* ============ Aktiviteter / tidslinje ============ */
.activity-form-wrap { border-bottom: 1px solid var(--border); }

.activity-form { display: flex; flex-direction: column; gap: 12px; }
.activity-form .form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.activity-form .form-row .input { flex: 1; min-width: 150px; }

.input {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: .88rem;
    font-family: inherit;
    background: var(--card);
    color: var(--text);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(218, 0, 27, .12); }
textarea.input { width: 100%; resize: vertical; }

.form-actions { display: flex; justify-content: flex-end; }

.filter-chips {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding: 14px 22px 0;
}
.chip {
    padding: 5px 14px;
    border-radius: 99px;
    border: 1px solid var(--border);
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--card);
    transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.timeline-more {
    padding: 12px 22px 18px;
    font-size: .82rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid #f1f5f9;
}

.timeline { list-style: none; padding: 10px 22px 18px; }

.timeline-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
}
.timeline-item:last-child { border-bottom: none; }

.timeline-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: grid; place-items: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.timeline-icon svg { width: 17px; height: 17px; }
.timeline-icon.type-note    { background: #fffbeb; color: #b45309; }
.timeline-icon.type-call    { background: #ecfdf5; color: #047857; }
.timeline-icon.type-email   { background: #eff6ff; color: #1d4ed8; }
.timeline-icon.type-meeting { background: #f5f3ff; color: #6d28d9; }

.timeline-content { flex: 1; min-width: 0; }
.timeline-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .88rem; }
.timeline-body { font-size: .9rem; margin-top: 5px; overflow-wrap: break-word; }
.timeline-meta { font-size: .78rem; color: var(--text-muted); margin-top: 6px; }

.timeline-delete { margin-left: auto; }
.timeline-delete button {
    background: none; border: none; cursor: pointer;
    color: #cbd5e1; padding: 4px; border-radius: 6px;
    display: grid; place-items: center;
}
.timeline-delete button:hover { color: #dc2626; background: #fef2f2; }
.timeline-delete svg { width: 15px; height: 15px; }

.activity-body-full { font-size: .92rem; line-height: 1.65; overflow-wrap: break-word; }

/* ============ Tom tilstand ============ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state svg { width: 44px; height: 44px; color: #cbd5e1; margin-bottom: 12px; }
.empty-state p { font-size: .95rem; }

/* ============ Login ============ */
.login-page {
    min-height: 100vh;
    display: grid; place-items: center;
    /* Et svagt rødt skær i toppen frem for den mørkeblå nat */
    background: radial-gradient(900px 520px at 70% -15%, var(--red-soft) 0%, #f7f8fa 45%, #eef0f4 100%);
    padding: 24px;
}

.login-card {
    width: 100%; max-width: 420px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(20, 22, 26, .09);
    padding: 40px 36px 34px;
}

.login-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 8px; }
.login-brand .logo {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: var(--red);
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 1.15rem;
    box-shadow: 0 6px 16px rgba(218, 0, 27, .22);
}
.login-brand h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.login-sub { text-align: center; color: var(--text-muted); font-size: .9rem; margin-bottom: 28px; }

.login-note { text-align: center; color: var(--ink-3); font-size: .78rem; margin-top: 24px; }

/* --- Login med adgangskode og engangskode --- */
.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field > span {
    font-size: .75rem; font-weight: 600; color: var(--ink-3);
    text-transform: uppercase; letter-spacing: .04em;
}
.login-field input {
    width: 100%;
    padding: 12px 14px;
    font: inherit; font-size: .95rem;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(218, 0, 27, .12);
}

.code-input { letter-spacing: .5em; font-size: 1.25rem !important; text-align: center; font-variant-numeric: tabular-nums; }

.login-check { display: flex; align-items: center; gap: 9px; font-size: .85rem; color: var(--ink-2); cursor: pointer; }
.login-check input { accent-color: var(--accent); width: 16px; height: 16px; }

.login-hint { font-size: .8rem; color: var(--ink-2); line-height: 1.5; }

.btn-block { width: 100%; justify-content: center; padding: 12px 18px; font-size: .95rem; }

.login-msg {
    border-radius: 10px; padding: 11px 13px;
    font-size: .85rem; line-height: 1.5;
    margin-bottom: 18px;
}
.login-msg.err { background: var(--red-soft); border: 1px solid #f6c6cc; color: var(--red); }
.login-msg.ok  { background: var(--green-soft); border: 1px solid #bfe3cd; color: var(--green); }

.inline-form { display: inline; }
.link-btn {
    background: none; border: 0; padding: 0;
    font: inherit; color: var(--accent); cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* --- Formularer på Min profil --- */
.stack-form { display: flex; flex-direction: column; gap: 14px; max-width: 380px; }
.stack-field { display: flex; flex-direction: column; gap: 5px; }
.stack-field > span { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.stack-field input {
    width: 100%; padding: 9px 12px;
    font: inherit; font-size: .92rem;
    border: 1px solid var(--line); border-radius: 9px; background: var(--card);
}
.stack-field input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(218, 0, 27, .12);
}

.form-ok {
    background: var(--green-soft); border: 1px solid #bfe3cd; color: var(--green);
    border-radius: 8px; padding: 10px 12px; font-size: .85rem;
}

/* ============ Berig virksomheder ============ */
.efilters { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 18px; }
.echip {
    display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid var(--line); border-radius: 999px;
    padding: 6px 13px 6px 11px; font-size: .84rem; cursor: pointer;
    background: var(--card); color: var(--ink-2);
}
.echip input { accent-color: var(--red); width: 15px; height: 15px; }
.echip:has(input:checked) { border-color: var(--red); background: var(--red-soft); color: var(--red); font-weight: 600; }

.erun { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }

.ebar { height: 6px; border-radius: 99px; background: var(--bg); overflow: hidden; margin-top: 16px; }
.ebar span { display: block; height: 100%; background: var(--red); width: 0; transition: width .3s; }

.elog { list-style: none; margin-top: 18px; font-size: .85rem; max-height: 420px; overflow-y: auto; }
.elog li {
    display: flex; align-items: baseline; gap: 10px;
    padding: 7px 2px; border-bottom: 1px solid var(--line);
}
.elog .ename { font-weight: 600; min-width: 210px; }
.elog .ebadge {
    font-size: .72rem; font-weight: 700; border-radius: 99px; padding: 1px 8px;
    background: var(--bg); color: var(--ink-2); white-space: nowrap;
}
.elog .e-done .ebadge, .elog li.e-done .ebadge { background: var(--green-soft); color: var(--green); }
.elog li.e-review .ebadge { background: var(--blue-soft); color: var(--blue); }
.elog li.e-no_accounts .ebadge { background: var(--amber-soft); color: var(--amber); }
.elog li.e-error .ebadge { background: var(--red-soft); color: var(--red); }
.elog .eres { color: var(--ink-2); }

/* Kvittering i hjørnet — fx når en dubletgruppe er lagt sammen */
.toast {
    position: fixed; right: 22px; bottom: 22px; z-index: 200;
    background: var(--ink); color: #fff;
    padding: 11px 16px; border-radius: 10px;
    font-size: .86rem; box-shadow: 0 10px 30px rgba(2, 6, 23, .28);
    opacity: 0; transform: translateY(8px);
    transition: opacity .18s, transform .18s;
    pointer-events: none;
}
.toast.on { opacity: 1; transform: translateY(0); }

/* ============ Mærkater (domæner) ============ */
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; }

.tags .tag {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
    padding: 3px 4px 3px 11px;
    font-size: .84rem; line-height: 1.5;
    max-width: 100%;
}
.tags .tag a { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags .tag a:hover { color: var(--accent); }
/* Det primære domæne er det, der vises og linkes andre steder */
.tags .tag-primary { background: var(--accent-soft); border-color: #f6c6cc; }
.tags .tag-primary a { color: var(--accent); font-weight: 600; }

.tags .tag-x {
    border: 0; background: none; cursor: pointer;
    width: 18px; height: 18px; border-radius: 50%;
    display: grid; place-items: center;
    color: var(--ink-3); font-size: 1rem; line-height: 1;
    flex-shrink: 0;
}
.tags .tag-x:hover { background: var(--red); color: #fff; }

.tags .tag-input {
    flex: 1; min-width: 120px;
    border: 1px dashed var(--line); border-radius: 999px;
    padding: 4px 11px;
    font: inherit; font-size: .84rem;
    background: transparent;
}
.tags .tag-input:focus {
    outline: none; border-style: solid; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(218, 0, 27, .12);
}
.tags .tag-input.save-error { border-style: solid; border-color: var(--red); background: var(--red-soft); }

/* Ekstra domæner i hero'en — nedtonet, så det primære står tydeligst */
.hero-sub .domain-extra { color: var(--ink-2); }
.hero-sub .domain-extra:hover { color: var(--accent); }

.qr-box {
    display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap;
    margin-top: 16px;
}
.qr-box svg {
    border: 1px solid var(--line); border-radius: 10px;
    padding: 6px; background: #fff; flex-shrink: 0;
}
.qr-box .qr-help { flex: 1; min-width: 220px; font-size: .83rem; line-height: 1.6; color: var(--ink-2); }
.qr-box .qr-help p + p { margin-top: 8px; }

.secret-box {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
    padding: 10px 12px; margin-top: 12px;
}
.secret-box .secret-label { font-size: .7rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.secret-box code { font-size: .85rem; word-break: break-all; flex: 1; min-width: 0; }
.secret-box code.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-user .user-name:hover, .sidebar-user .avatar:hover { text-decoration: none; opacity: .85; }

/* ============ Mobil-topbar + slide-in-menu ============ */
.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 90;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-line);
    color: var(--sidebar-fg-strong);
}
.mobile-topbar .logo {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: var(--red);
    color: #fff;
    display: grid; place-items: center;
    font-size: .8rem; font-weight: 800;
}
.mobile-topbar .mobile-title { font-weight: 700; font-size: 1.05rem; }

.menu-toggle {
    background: none;
    border: none;
    color: var(--ink-2);
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    display: grid; place-items: center;
}
.menu-toggle:active { background: var(--sidebar-hover); }
.menu-toggle svg { width: 24px; height: 24px; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, .55);
    z-index: 95;
    opacity: 0;
    transition: opacity .2s;
}
body.menu-open .sidebar-overlay { display: block; opacity: 1; }

/* ============ Responsivt ============ */
@media (max-width: 760px) {
    .mobile-topbar { display: flex; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100dvh;
        width: min(300px, 85vw);
        z-index: 100;
        transform: translateX(-105%);
        transition: transform .22s ease;
        box-shadow: 8px 0 30px rgba(20, 22, 26, .18);
    }
    body.menu-open .sidebar { transform: translateX(0); }
    body.menu-open { overflow: hidden; }

    .sidebar-nav a { padding: 13px 12px; font-size: 1rem; }

    .main { padding: 20px 16px 40px; }
    .page-header h1 { font-size: 1.35rem; }
    .dl { grid-template-columns: 1fr; row-gap: 4px; }
    .dl dt { margin-top: 10px; }
    .dl-edit dd { max-width: 100%; }
    .edit-input { max-width: 100%; }
    .detail-hero .avatar-lg { width: 46px; height: 46px; font-size: 1rem; }
    .filter-form .search-box { max-width: 100%; flex-basis: 100%; }
    .bulk-bar { padding: 10px 14px; }
    .timeline { padding: 10px 14px 16px; }
    .card-body { padding: 16px; }
}

/* Aktivitetsloggen: datoskillere i tabellen */
tr.log-day td {
    background: var(--bg);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ink-3);
    padding: 6px 14px;
}

/* Redigerbare celler i lister: pills skal ikke gøre rækkerne højere */
td.cell-edit { padding-top: 7px; padding-bottom: 7px; }
td.cell-edit .pill { font-size: .74rem; padding: 2px 8px; }
td.cell-edit .pill .mini { width: 16px; height: 16px; font-size: .55rem; }

/* Select-felter i lister: skal se ud som tekst, indtil man rører dem */
select.row-save {
    font: inherit; font-size: .82rem; color: var(--ink-2);
    max-width: 150px; padding: 3px 4px;
    border: 1px solid transparent; border-radius: 7px;
    background: transparent; cursor: pointer;
    text-overflow: ellipsis;
}
select.row-save:hover { border-color: var(--line); background: var(--card); }
select.row-save:focus { outline: 0; border-color: var(--red); background: var(--card); }
select.row-save.saving { opacity: .5; }
select.row-save.saved { border-color: var(--green); color: var(--green); }

/* ============ Kig-tilstand: admin ser CRM'et som en anden bruger ============
   Bjælken ligger fast i bunden — den må ikke kunne rulles væk og glemmes. */
.impersonation-bar {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 120;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: calc(100vw - 24px);
    padding: 10px 12px 10px 16px;
    border-radius: 999px;
    background: var(--amber-soft);
    border: 1px solid var(--amber);
    color: var(--amber);
    font-size: .85rem;
    box-shadow: 0 6px 24px rgba(20, 22, 26, .16);
}
.impersonation-bar svg { width: 18px; height: 18px; flex-shrink: 0; }
.impersonation-bar strong { font-weight: 700; }
.impersonation-bar form { margin: 0; flex-shrink: 0; }
.impersonation-bar .btn { background: var(--amber); border-color: var(--amber); white-space: nowrap; }
.impersonation-bar .btn:hover { background: #8f4b00; }

@media (max-width: 760px) {
    .impersonation-bar {
        left: 8px; right: 8px; bottom: 8px;
        transform: none;
        max-width: none;
        flex-wrap: wrap;
        border-radius: var(--radius);
        font-size: .8rem;
    }
    .impersonation-bar span { flex: 1; min-width: 0; }
}
