/* © 2026 Vortex Group. Alle rettigheder forbeholdt. */
/* ============================================================
   components.css — Knapper, stats, modaler, chips, inputs
   Genbrugelige UI-elementer på tværs af sider
   ============================================================ */
/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 0.85rem; font-weight: 600;
    text-decoration: none; cursor: pointer;
    transition: all 0.2s ease; border: 1px solid transparent;
    font-family: inherit; text-align: center;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-2) 100%);
    color: #070B14;
    box-shadow: 0 4px 18px rgba(129, 140, 248, 0.28);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(129, 140, 248, 0.4);
    filter: brightness(1.06);
}

.btn-ghost {
    background: var(--color-bg-elevated);
    border-color: var(--color-border-strong);
    color: var(--color-text-primary);
}
.btn-ghost:hover { border-color: var(--color-accent); color: var(--color-white); }

.btn-large { padding: 13px 28px; font-size: 0.95rem; border-radius: 14px; }

/* ── STATS ────────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}
.stat-card {
    position: relative;
    background: linear-gradient(160deg, rgba(19, 27, 42, 0.9), rgba(15, 21, 32, 0.85));
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: transform 0.22s, border-color 0.22s;
}
.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 20%; right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.5), transparent);
    opacity: 0.6;
}
.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--color-border-strong);
}
.stat-card .stat-num {
    display: block;
    font-family: var(--font-display);
    font-size: 1.65rem; font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(120deg, var(--color-accent), var(--color-accent-2));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.stat-card .stat-label {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    margin-top: 3px;
    letter-spacing: 0.02em;
}


/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(4, 6, 10, 0.74);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center; justify-content: center;
    z-index: 300;
    padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 18px;
    width: 100%; max-width: 420px;
    padding: 26px;
    box-shadow: var(--shadow-lift);
    animation: modalIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    max-height: 88vh;
    overflow-y: auto;
}
.modal-lg { max-width: 560px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 20px;
}
.modal-header h3 { font-family: var(--font-display); font-size: 1.05rem; }

.modal-close {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary); font-size: 0.95rem;
    cursor: pointer; padding: 5px 11px;
    border-radius: 10px;
    transition: all 0.2s;
}
.modal-close:hover { color: var(--color-white); border-color: var(--color-text-muted); }

.modal .input { margin-bottom: 12px; }


/* ── KATEGORIER ─────────────────────────────────────────── */
.category-title {
    margin: 22px 0 10px;
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--color-text-primary);
    display: flex; align-items: center; gap: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
}
.category-count {
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
}

/* ── TOPBAR SVG IKONER ─────────────────────────────────── */
.topbar-btn svg {
    width: 24px; height: 24px;
}
.topbar-btn {
    display: inline-flex; align-items: center; justify-content: center;
}

/* ── KATEGORIER ────────────────────────────────────────── */
.category-title {
    margin: 20px 0 10px;
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--color-text-primary);
    display: flex; align-items: center; gap: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
}
.category-count {
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
}

/* ── SUB-AGENTER CHIPS ─────────────────────────────────── */
.agent-subs {
    display: flex; flex-wrap: wrap; gap: 4px;
    margin-top: 10px;
}
.sub-chip {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

/* ── TASK DELETE ───────────────────────────────────────── */
.task-card-head {
    display: flex; justify-content: space-between; align-items: flex-start;
}
.task-delete {
    background: none; border: none;
    color: var(--color-text-muted);
    font-size: 0.8rem; cursor: pointer;
    padding: 2px 6px; border-radius: 6px;
    opacity: 0; transition: all 0.2s;
}
.task-card:hover .task-delete { opacity: 1; }
.task-delete:hover { color: #F87171; background: rgba(248,113,113,0.12); }

/* ── KLIKBARE STAT-KASSER ──────────────────────────────── */
.stat-card.clickable {
    cursor: pointer;
    position: relative;
}
.stat-card.clickable:hover {
    transform: translateY(-3px);
    border-color: rgba(129, 140, 248, 0.4);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 1px rgba(129,140,248,0.15);
}
.stat-card.clickable:active { transform: translateY(-1px) scale(0.98); }
.stat-hint {
    display: block;
    font-size: 0.65rem;
    color: var(--color-text-muted);
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}
.stat-card.clickable:hover .stat-hint { opacity: 1; }

/* ── STAT DETAIL LISTE ─────────────────────────────────── */
.stat-detail-body {
    display: flex; flex-direction: column; gap: 6px;
    max-height: 60vh; overflow-y: auto;
    padding: 4px 2px;
}
.stat-item {
    display: flex; align-items: center; gap: 10px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.88rem;
    transition: border-color 0.2s;
}
.stat-item:hover { border-color: rgba(129, 140, 248, 0.3); }
.si-icon { font-size: 1.1rem; }
.si-name { flex: 1; color: var(--color-text-primary); font-weight: 500; min-width: 0; }
.si-meta { color: var(--color-text-secondary); font-size: 0.78rem; white-space: nowrap; }
.si-tag {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.si-tag.status-working { color: #34D399; border-color: rgba(52,211,153,0.3); }
.si-tag.status-idle { color: var(--color-text-secondary); }

/* ── BOSS GODKENDELSE ──────────────────────────────────── */
.boss-badge {
    background: rgba(255, 191, 0, 0.15);
    border: 1px solid rgba(255, 191, 0, 0.35);
    color: #F2C14E;
    font-size: 0.62rem; font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.boss-badge.approved {
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.35);
    color: #34D399;
}
.boss-comment {
    margin-top: 6px;
    font-size: 0.72rem;
    color: #F2C14E;
    background: rgba(255, 191, 0, 0.08);
    border-left: 2px solid rgba(255, 191, 0, 0.4);
    padding: 4px 8px;
    border-radius: 4px;
}

/* ── TASK DETAIL MODAL ─────────────────────────────────── */
.td-block { margin-bottom: 14px; }
.td-title { font-size: 1.05rem; font-weight: 700; font-family: var(--font-display); margin-bottom: 6px; }
.td-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.75rem; color: var(--color-text-secondary); margin-bottom: 8px; }
.td-desc { font-size: 0.85rem; color: var(--color-text-secondary); margin: 8px 0; }
.td-status { font-size: 0.8rem; margin-top: 8px; padding: 4px 0; }
.td-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn-approve {
    background: linear-gradient(135deg, #10B981, #059669);
    border: none; color: #fff;
    padding: 8px 16px; border-radius: 10px;
    font-weight: 600; cursor: pointer;
    transition: transform 0.15s;
}
.btn-approve:hover { transform: translateY(-1px); }
.btn-request {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    padding: 8px 16px; border-radius: 10px;
    font-weight: 600; cursor: pointer;
    transition: transform 0.15s;
}
.btn-request:hover { transform: translateY(-1px); border-color: #F2C14E; color: #F2C14E; }

/* ── LOGIN SCREEN (privat adgang) ───────────────────────── */
.login-screen {
    position: fixed; inset: 0;
    z-index: 999;
    background:
        radial-gradient(800px 500px at 50% -10%, rgba(129, 140, 248, 0.12) 0%, transparent 60%),
        var(--color-bg);
    display: none;
    align-items: center; justify-content: center;
    padding: 20px;
}
.login-box {
    width: 100%; max-width: 360px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 36px 28px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; gap: 12px;
}
.login-logo {
    width: 72px; height: 72px;
    border-radius: 18px;
    margin: 0 auto;
    object-fit: cover;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 0 1px rgba(129,140,248,0.3);
}
.login-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    background: linear-gradient(120deg, #fff 20%, #A5B4FC);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}
.login-sub {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    margin: 0 0 8px;
}
.login-error {
    color: #F87171;
    font-size: 0.8rem;
    margin: 0;
}

/* ── AGENT FORBRUG MODAL ───────────────────────────────── */
.usage-summary { display: flex; gap: 10px; flex-wrap: wrap; }
.usage-total {
    flex: 1; min-width: 90px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}
.usage-total span { display: block; font-size: 0.7rem; color: var(--color-text-secondary); }
.usage-total strong { font-size: 1.15rem; font-family: var(--font-display); }
.usage-agent {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
}
.usage-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.usage-cost { color: var(--color-accent); font-weight: 700; }
.usage-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.usage-bar-label { width: 48px; font-size: 0.7rem; color: var(--color-text-secondary); }
.usage-track { flex: 1; height: 8px; background: var(--color-bg); border-radius: 999px; overflow: hidden; }
.usage-track.cost { background: rgba(255,122,69,0.1); }
.usage-fill { height: 100%; background: linear-gradient(90deg, #818CF8, #38BDF8); border-radius: 999px; transition: width 0.4s; }
.usage-track.cost .usage-fill { background: linear-gradient(90deg, #F2C14E, #FB7185); }
.usage-num { font-size: 0.7rem; color: var(--color-text-secondary); width: 60px; text-align: right; }
.usage-meta { display: flex; gap: 12px; font-size: 0.68rem; color: var(--color-text-muted); margin-top: 6px; }
.spark-chart { display: flex; align-items: flex-end; gap: 3px; height: 50px; padding: 6px 2px; }
.spark-col { flex: 1; display: flex; align-items: flex-end; }
.spark-bar { width: 100%; background: linear-gradient(180deg, #818CF8, #38BDF8); border-radius: 3px 3px 0 0; min-height: 2px; }

/* ── FORBRUG V2 (uddybende grafer) ─────────────────────── */
.spark-chart.tall { height: 90px; }
.spark-label { font-size: 0.55rem; color: var(--color-text-muted); transform: rotate(-45deg); white-space: nowrap; margin-top: 4px; }
.spark-bar.hour { background: linear-gradient(180deg, #F2C14E, #FB7185); }
.usage-agent.clickable { cursor: pointer; transition: border-color 0.2s, transform 0.15s; }
.usage-agent.clickable:hover { border-color: rgba(129,140,248,0.4); transform: translateX(2px); }
.usage-sessions { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.usage-session {
    display: flex; align-items: center; gap: 8px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.72rem;
}
.us-time { color: var(--color-text-secondary); white-space: nowrap; width: 90px; }
.us-key { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-primary); }
.us-tok { color: var(--color-text-secondary); width: 50px; text-align: right; }
.us-cost { color: var(--color-accent); font-weight: 700; width: 60px; text-align: right; }

/* ── AGENT-SWITCHER (skift agent uden at lukke pop-up) ── */
.usage-switch {
    display: flex; gap: 8px; align-items: center;
    margin: 10px 0 14px;
}
.usage-switch .input { flex: 1; }

/* ── TILBAGE-KNAP (modal-header, modsat krydset) ──────── */
.modal-back {
    background: var(--color-bg-elevated);
    border: 1px solid rgba(129, 140, 248, 0.35);
    color: var(--color-accent);
    width: 36px; height: 36px;
    border-radius: 10px;
    font-size: 1.15rem; font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    flex-shrink: 0;
}
.modal-back:hover {
    color: var(--color-white);
    border-color: var(--color-accent);
    background: rgba(129, 140, 248, 0.2);
    transform: translateX(-2px);
}
.modal-header { display: flex; align-items: center; gap: 10px; }
.modal-header h3 { flex: 1; margin: 0; }

/* ── MOBIL (max 640px): modaler fylder skærmen bedre ──── */
@media (max-width: 640px) {
    .modal-overlay { padding: 10px; align-items: flex-end; }
    .modal {
        max-width: 100%;
        padding: 20px 18px;
        max-height: 92vh;
        border-radius: 18px 18px 12px 12px;
    }
    .login-box { padding: 28px 20px; }
}

/* ── 7-DAGES KALENDER (Kommende-boks) ─────────────────── */
.week-view { display: flex; flex-direction: column; gap: 6px; }
.day-block {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 8px 12px;
}
.day-block.today { border-color: rgba(129, 140, 248, 0.4); background: rgba(129, 140, 248, 0.06); }
.day-label {
    font-size: 0.72rem; font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.day-event {
    display: flex; align-items: center; gap: 8px;
    padding: 3px 0;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 6px;
}
.day-event:hover { background: rgba(148, 163, 184, 0.06); }
.day-time { color: var(--color-text-secondary); font-size: 0.72rem; width: 40px; flex-shrink: 0; }
.day-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 👑 AFVENTER DIG (tasks der kræver Boss) ───────────── */
.attention-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.attention-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--ac, #38BDF8);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.attention-card:hover {
    transform: translateX(3px);
    border-color: var(--ac, #38BDF8);
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.att-prio {
    font-size: 0.72rem; font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(56,189,248,0.12);
    color: var(--ac, #38BDF8);
    border: 1px solid rgba(56,189,248,0.25);
    white-space: nowrap;
    flex-shrink: 0;
}
.att-title { flex: 1; font-size: 0.9rem; font-weight: 500; color: var(--color-text-primary); min-width: 0; }
.att-meta { font-size: 0.72rem; color: var(--color-text-secondary); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
.att-go {
    font-size: 0.75rem; font-weight: 700;
    color: var(--ac, #38BDF8);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── TASK VEDHÆFTNING (billede i task-detalje) ────────── */
.td-attachment {
    display: block;
    margin-top: 10px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    background: var(--color-bg-elevated);
    transition: border-color 0.2s;
}
.td-attachment:hover { border-color: rgba(129, 140, 248, 0.4); }
.td-attachment img {
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    background: var(--color-bg);
    display: block;
}
.td-att-hint {
    display: block;
    text-align: center;
    font-size: 0.72rem;
    color: var(--color-accent);
    padding: 6px;
    font-weight: 600;
}

/* ── IMAGE VIEWER (lightbox) ───────────────────────────── */
.img-overlay {
    position: fixed; inset: 0;
    background: rgba(5, 8, 14, 0.92);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
}
.img-overlay.open { opacity: 1; pointer-events: auto; }
.img-full {
    max-width: 92vw; max-height: 88vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    object-fit: contain;
}
.img-close {
    position: absolute; top: 16px; right: 16px;
    width: 42px; height: 42px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    border-radius: 12px;
    font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.img-close:hover { border-color: #F87171; color: #F87171; transform: rotate(90deg); }
.img-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 46px; height: 46px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    border-radius: 50%;
    font-size: 1.6rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    z-index: 2;
}
.img-nav:hover { border-color: var(--color-accent); color: var(--color-accent); }
.img-nav.prev { left: 16px; }
.img-nav.next { right: 16px; }
.img-counter {
    position: absolute; bottom: 20px;
    background: rgba(11, 14, 20, 0.8);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ── BEKRÆFTELSES-MODAL (slet-task) ────────────────────── */
.confirm-body { padding: 4px 2px; }
.confirm-body p { font-size: 0.9rem; color: var(--color-text-primary); margin: 0 0 16px; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn-danger {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    border: none; color: #fff;
    padding: 8px 18px; border-radius: 10px;
    font-weight: 600; cursor: pointer;
    transition: transform 0.15s;
}
.btn-danger:hover { transform: translateY(-1px); }

/* ── OPRETTET AF / ARBEJDER PÅ (task) ─────────────────── */
.task-createdby {
    color: var(--color-text-muted);
    font-size: 0.7rem;
    background: rgba(148, 163, 184, 0.08);
    border-radius: 999px;
    padding: 1px 8px;
}
.task-assignee {
    color: var(--color-text-secondary);
    font-size: 0.7rem;
    background: rgba(129, 140, 248, 0.1);
    border-radius: 999px;
    padding: 1px 8px;
}

/* ════════════════════════════════════════════════════════════
   CHAT MED AGENTER (messenger-bobler nederst til højre)
   ============================================================ */
/* ── Launcher-boble ── */
.chat-launcher {
    position: fixed;
    right: 22px; bottom: 22px;
    width: 60px; height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
    color: #070B14;
    box-shadow: 0 8px 28px rgba(129, 140, 248, 0.45), 0 2px 8px rgba(0,0,0,0.4);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 400;
    transition: transform 0.2s, box-shadow 0.2s;
}
.chat-launcher:hover { transform: scale(1.07); box-shadow: 0 10px 34px rgba(129, 140, 248, 0.55); }
.chat-launcher:active { transform: scale(0.95); }
.chat-launcher svg { width: 26px; height: 26px; }
.chat-launcher .chat-launcher-close { display: none; }
.chat-launcher.active .chat-launcher-icon { display: none; }
.chat-launcher.active .chat-launcher-close { display: block; }

.chat-launcher-badge {
    position: absolute;
    top: -3px; right: -3px;
    min-width: 21px; height: 21px;
    padding: 0 5px;
    background: linear-gradient(135deg, var(--color-danger), #F472B6);
    color: #fff;
    font-size: 0.68rem; font-weight: 800;
    border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 3px var(--color-bg), 0 4px 12px rgba(251, 113, 133, 0.5);
}
/* ── Panel ── */
.chat-panel {
    position: fixed;
    right: 22px; bottom: 92px;
    width: 372px;
    max-width: calc(100vw - 32px);
    height: min(560px, calc(100vh - 140px));
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(129, 140, 248, 0.08);
    display: flex; flex-direction: column;
    overflow: hidden;
    z-index: 410;
    opacity: 0;
    transform: translateY(14px) scale(0.97);
    pointer-events: none;
    transform-origin: bottom right;
    transition: opacity 0.22s ease, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.chat-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chat-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* ── Header ── */
.chat-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    background: rgba(19, 27, 42, 0.6);
    flex-shrink: 0;
}
.chat-title { font-family: var(--font-display); font-size: 0.98rem; font-weight: 700; }
.chat-subtitle { font-size: 0.68rem; color: var(--color-text-muted); }
.chat-close, .chat-back {
    background: none; border: none;
    color: var(--color-text-secondary);
    font-size: 1rem; cursor: pointer;
    padding: 6px 9px; border-radius: 9px;
    transition: all 0.15s;
}
.chat-close { margin-left: auto; }
.chat-close:hover, .chat-back:hover { color: var(--color-white); background: var(--color-bg-elevated); }
.chat-back { font-size: 1.15rem; }

/* ── Agent-liste ── */
.chat-agent-list { flex: 1; overflow-y: auto; padding: 8px; }
.chat-loading { color: var(--color-text-muted); text-align: center; padding: 30px 0; font-size: 0.82rem; }

.chat-agent-item {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    background: none; border: none;
    padding: 12px;
    border-radius: 14px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.chat-agent-item:hover { background: var(--color-bg-elevated); }

.chat-agent-avatar, .chat-thread-avatar {
    width: 44px; height: 44px;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem;
    background: color-mix(in srgb, var(--ac) 15%, var(--color-surface-hover));
    border: 1px solid color-mix(in srgb, var(--ac) 35%, transparent);
    flex-shrink: 0;
}
.chat-thread-avatar { width: 38px; height: 38px; font-size: 1.15rem; }

.chat-agent-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-agent-name { font-weight: 650; font-size: 0.9rem; color: var(--color-text-primary); }
.chat-agent-role { font-size: 0.68rem; color: var(--color-text-muted); }
.chat-agent-last {
    font-size: 0.76rem; color: var(--color-text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-top: 2px;
}

.chat-agent-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.chat-agent-time { font-size: 0.64rem; color: var(--color-text-muted); font-family: var(--font-mono); }
.chat-unread-badge {
    min-width: 19px; height: 19px;
    padding: 0 6px;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
    color: #070B14;
    font-size: 0.66rem; font-weight: 800;
    border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
}

/* ── Tråd: agent-info i header ── */
.chat-thread-agent { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-thread-name { font-weight: 650; font-size: 0.92rem; display: block; }
.chat-thread-role { font-size: 0.66rem; color: var(--color-text-muted); display: block; }

/* ── Beskeder ── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex; flex-direction: column;
    gap: 2px;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: #232C3E; border-radius: 6px; }

.chat-date {
    text-align: center;
    font-size: 0.62rem; font-weight: 700;
    color: var(--color-text-muted);
    margin: 10px 0 6px;
}
.chat-date:first-child { margin-top: 0; }

.chat-msg { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-end; }
.chat-msg.mine { justify-content: flex-end; }
.chat-msg-avatar {
    width: 28px; height: 28px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
    background: color-mix(in srgb, var(--ac) 15%, var(--color-surface-hover));
    border: 1px solid color-mix(in srgb, var(--ac) 35%, transparent);
    flex-shrink: 0;
}

.chat-bubble {
    max-width: 78%;
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.chat-msg.mine .chat-bubble {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
    color: #070B14;
    border-bottom-right-radius: 5px;
    font-weight: 500;
}
.chat-msg.theirs .chat-bubble {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    border-bottom-left-radius: 5px;
}
.chat-bubble-text { white-space: pre-wrap; }
.chat-bubble-time {
    display: block;
    text-align: right;
    font-size: 0.58rem;
    margin-top: 3px;
    opacity: 0.65;
    font-family: var(--font-mono);
}

.chat-empty { text-align: center; padding: 40px 16px; color: var(--color-text-secondary); }
.chat-empty-emoji { font-size: 2.4rem; margin-bottom: 10px; }
.chat-empty p { font-size: 0.88rem; font-weight: 600; }
.chat-empty-sub { font-size: 0.74rem !important; color: var(--color-text-muted); font-weight: 400 !important; margin-top: 4px; }

/* ── Input ── */
.chat-form {
    display: flex; gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--color-border);
    background: rgba(19, 27, 42, 0.5);
    flex-shrink: 0;
}
.chat-input {
    flex: 1;
    background: var(--color-bg);
    border: 1.5px solid var(--color-border-strong);
    border-radius: 999px;
    color: var(--color-white);
    padding: 10px 16px;
    font-family: var(--font-body);
    font-size: 0.86rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input:focus {
    border-color: var(--color-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.16);
}
.chat-input::placeholder { color: var(--color-text-muted); }

.chat-send {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
    color: #070B14;
    font-size: 1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s, filter 0.15s;
    flex-shrink: 0;
}
.chat-send:hover { transform: scale(1.06); filter: brightness(1.08); }
.chat-send:active { transform: scale(0.94); }

/* ── Mobil: chat fylder skærmen ── */
@media (max-width: 480px) {
    .chat-panel {
        right: 8px; bottom: 84px;
        width: calc(100vw - 16px);
        height: calc(100vh - 130px);
    }
    .chat-launcher { right: 16px; bottom: 84px; }
}

/* ════════════════════════════════════════════════════════════
   CHAT-VINDUER (popup pr. agent — flytbare, minimerbare)
   ============================================================ */
.chat-window {
    position: fixed;
    width: 340px;
    height: 460px;
    max-height: calc(100vh - 40px);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(129, 140, 248, 0.08);
    display: flex; flex-direction: column;
    overflow: hidden;
    z-index: 500;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.chat-window.active {
    border-color: color-mix(in srgb, var(--ac) 45%, transparent);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px color-mix(in srgb, var(--ac) 25%, transparent);
}
.chat-window.dragging { user-select: none; cursor: grabbing; }

/* Minimeret: kun header-baren vises */
.chat-window.chat-window-min { height: auto; }
.chat-window.chat-window-min .chat-window-messages,
.chat-window.chat-window-min .chat-window-form { display: none; }

.chat-window-header {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(135deg, color-mix(in srgb, var(--ac) 10%, var(--color-bg-elevated)), var(--color-bg-elevated));
    cursor: grab;
    flex-shrink: 0;
    user-select: none;
}
.chat-window-header:active { cursor: grabbing; }

.chat-window-avatar {
    width: 34px; height: 34px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    background: color-mix(in srgb, var(--ac) 15%, var(--color-surface-hover));
    border: 1px solid color-mix(in srgb, var(--ac) 35%, transparent);
    flex-shrink: 0;
}
.chat-window-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-window-name { font-weight: 700; font-size: 0.9rem; color: var(--color-text-primary); }
.chat-window-role { font-size: 0.64rem; color: var(--color-text-muted); }

.chat-window-actions { display: flex; gap: 2px; flex-shrink: 0; }
.chat-window-btn {
    background: none; border: none;
    color: var(--color-text-secondary);
    width: 28px; height: 28px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.chat-window-btn:hover { color: var(--color-white); background: rgba(148, 163, 184, 0.12); }
.chat-window-btn:last-child:hover { color: var(--color-danger); }

.chat-window-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex; flex-direction: column;
    min-height: 0;
}
.chat-window-messages::-webkit-scrollbar { width: 6px; }
.chat-window-messages::-webkit-scrollbar-thumb { background: #232C3E; border-radius: 6px; }

/* Form i vinduet genbruger .chat-form fra panelet — kun bredde-tilpasning */
.chat-window-form { padding: 10px; }

/* Responsiv: vinduer fylder skærmen på mobil */
@media (max-width: 640px) {
    .chat-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 120px);
        left: 8px !important;
        right: 8px !important;
        top: auto !important;
        bottom: 90px !important;
    }
    .chat-window.chat-window-min { height: auto; }
}

/* ════════════════════════════════════════════════════════════
   AGENT-BOBLER (Facebook-stil: popper op fra hoved-boblen)
   ============================================================ */
.chat-bubbles {
    position: fixed;
    right: 22px; bottom: 96px;
    display: flex;
    flex-direction: column-reverse; /* nyeste/nærmest bunden */
    align-items: center;
    gap: 10px;
    z-index: 450;
    opacity: 0;
    transform: translateY(12px) scale(0.9);
    pointer-events: none;
    transform-origin: bottom right;
    transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.chat-bubbles.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Hver agent: boble med emoji + navn under (så FS/DevOps ikke forveksles) */
.chat-bubble-agent {
    position: relative;
    width: 62px;
    padding: 7px 4px 5px;
    border-radius: 16px;
    border: none;
    background: var(--color-bg-elevated);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 0 0 1px color-mix(in srgb, var(--ac) 30%, transparent);
    cursor: pointer;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    transition: transform 0.18s, box-shadow 0.18s;
    animation: bubblePop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.chat-bubble-agent:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5), 0 0 0 2px color-mix(in srgb, var(--ac) 55%, transparent);
}
.chat-bubble-agent:active { transform: scale(0.94); }
.chat-bubble-agent.open {
    background: linear-gradient(135deg, color-mix(in srgb, var(--ac) 22%, var(--color-bg-elevated)), var(--color-bg-elevated));
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 0 0 2px var(--ac);
}

@keyframes bubblePop {
    from { opacity: 0; transform: scale(0.4) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-bubble-agent-emoji { font-size: 1.35rem; line-height: 1; }

.chat-bubble-agent-name {
    font-size: 0.58rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    max-width: 58px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.chat-bubble-agent.open .chat-bubble-agent-name { color: var(--ac); }

.chat-bubble-agent-badge {
    position: absolute;
    top: -3px; right: -3px;
    min-width: 20px; height: 20px;
    padding: 0 5px;
    background: linear-gradient(135deg, var(--color-danger), #F472B6);
    color: #fff;
    font-size: 0.66rem; font-weight: 800;
    border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2.5px var(--color-bg), 0 4px 10px rgba(251, 113, 133, 0.5);
}

/* ════════════════════════════════════════════════════════════
   CHAT-STATUS (✓/✓✓ set) + "skriver..."-indikator
   ============================================================ */
.chat-bubble-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    margin-top: 3px;
}
.chat-status {
    font-size: 0.62rem;
    font-weight: 700;
    color: rgba(7, 11, 20, 0.55);       /* ✓ sendt (mørk tekst på accent-boble) */
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}
.chat-status.seen {
    color: rgba(7, 11, 20, 0.85);        /* ✓✓ set — tydeligere */
}
.chat-status.replied {
    color: #064e3b;                      /* ✓✓ besvaret — grøn nuance */
}

/* "skriver..."-boble med animerede prikker */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
}
.chat-typing-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--color-text-muted);
    animation: typingBounce 1.2s infinite ease-in-out;
}
.chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}
.chat-typing-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    font-style: italic;
    margin-left: 2px;
}
