﻿@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #f3f8ef;
    --card: #ffffff;
    --ink: #19372d;
    --muted: #6b7280;
    --line: #dbe4d5;
    --accent: #1d2e28;
    --accent-soft: #eaf3e4;
}

body {
    font-family: 'Cairo', sans-serif;
    background:
        radial-gradient(circle at top right, rgba(149, 213, 178, 0.16), transparent 26%),
        linear-gradient(180deg, #f8fcf4 0%, var(--bg) 100%);
    color: var(--ink);
}

.glass-shell {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.admin-card {
    background: var(--card);
    border: 1px solid rgba(29, 46, 40, 0.08);
    border-radius: 1.5rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.admin-kpi,
.security-status-card {
    background: linear-gradient(180deg, #ffffff 0%, #f9fcf7 100%);
    border: 1px solid rgba(29, 46, 40, 0.08);
    border-radius: 1.5rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
    padding: 1.5rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.form-input {
    width: 100%;
    border-radius: 1rem;
    border: 1px solid #d1d5db;
    background: #fbfcfa;
    padding: 0.8rem 1rem;
    outline: none;
    transition: all 0.18s ease;
}

.form-input:focus {
    border-color: #1d2e28;
    box-shadow: 0 0 0 4px rgba(29, 46, 40, 0.08);
    background: white;
}

.btn-primary {
    background: var(--accent);
    color: white;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.8rem 1.3rem;
    transition: all 0.18s ease;
}

.btn-primary:hover {
    background: #2f493f;
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--accent);
    font-weight: 700;
    border: 1px solid rgba(29, 46, 40, 0.12);
    border-radius: 999px;
    padding: 0.8rem 1.2rem;
    transition: all 0.18s ease;
}

.btn-secondary:hover {
    background: #f8fbf6;
    border-color: rgba(29, 46, 40, 0.22);
}

.message-box {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 1rem 1.2rem;
    border-radius: 1rem;
    font-weight: 700;
    text-align: center;
    display: none;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.message-box.error { background-color: #fee2e2; color: #991b1b; }
.message-box.success { background-color: #dcfce7; color: #166534; }

.modal { display: none; }
.modal.flex { display: flex; }

.account-item {
    border: 1px solid rgba(29, 46, 40, 0.08);
    border-radius: 1.5rem;
    overflow: hidden;
    background: white;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.account-item:hover {
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}

.account-item.expanded {
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}

.account-header {
    cursor: pointer;
}

.account-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.account-item.expanded .chevron-icon {
    transform: rotate(180deg);
}

.chevron-icon {
    transition: transform 0.2s ease;
}

.chart-shell {
    position: relative;
    height: 260px;
}

.admin-console-tabs {
    position: sticky;
    top: 96px;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    border: 1px solid rgba(29, 46, 40, 0.08);
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    padding: 0.75rem;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(14px);
}

.admin-console-tab {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0 1rem;
    color: #475569;
    font-weight: 800;
    background: transparent;
    transition: all 0.18s ease;
}

.admin-console-tab:hover,
.admin-console-tab.is-active {
    border-color: rgba(29, 46, 40, 0.12);
    background: #1d2e28;
    color: #ffffff;
}

.admin-tab-panel {
    display: none;
}

.admin-tab-panel.is-active {
    display: block;
}

.admin-tab-panel.is-active > * + * {
    margin-top: 2rem;
}

.admin-command-console {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: stretch;
}

.admin-command-rail {
    padding: 1rem 0.85rem;
    border-radius: 1.75rem;
    background:
        radial-gradient(circle at top, rgba(149, 213, 178, 0.24), transparent 34%),
        linear-gradient(180deg, #102d22 0%, #173c2c 100%);
    box-shadow: 0 22px 45px rgba(15, 35, 26, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
}

.admin-command-rail__item {
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 1.05rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.62);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font-size: 1.35rem;
    transition: all 0.18s ease;
}

.admin-command-rail__item.is-active,
.admin-command-rail__item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.18);
}

.admin-command-main {
    border: 1px solid rgba(29, 46, 40, 0.08);
    border-radius: 2rem;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.07);
    padding: 1.6rem;
}

.admin-command-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.admin-command-head h2 {
    margin: 0.25rem 0 0;
    color: #19372d;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.08;
    font-weight: 900;
}

.admin-command-head p:last-child {
    max-width: 52rem;
    margin-top: 0.75rem;
    color: #64748b;
    line-height: 1.7;
}

.admin-command-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.4rem;
}

.admin-command-cards article {
    min-height: 9rem;
    border-radius: 1.35rem;
    border: 1px solid #e5e7eb;
    background: #fbfdf9;
    padding: 1.2rem;
}

.admin-command-cards i {
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: #1d2e28;
    font-size: 1.25rem;
}

.admin-command-cards b,
.admin-command-cards span {
    display: block;
}

.admin-command-cards b {
    margin-top: 0.9rem;
    color: #19372d;
    font-size: 2rem;
    line-height: 1;
    font-weight: 900;
}

.admin-command-cards span {
    margin-top: 0.45rem;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 800;
}

.admin-content-control {
    border: 1px solid rgba(29, 46, 40, 0.08);
    border-radius: 2rem;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbf3 100%);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.07);
    padding: 1.6rem;
}

.admin-content-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.4rem;
    border-radius: 1.5rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

.admin-content-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.admin-content-card {
    min-height: 210px;
    border: 1px solid #e5e7eb;
    border-radius: 1.35rem;
    background: #fbfdf9;
    padding: 1.25rem;
}

.admin-content-card i {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: #1d2e28;
    color: #ffffff;
    font-size: 1.55rem;
}

.admin-content-card h4 {
    margin: 1rem 0 0;
    color: #19372d;
    font-size: 1.2rem;
    font-weight: 800;
}

.admin-content-card p {
    margin: 0.65rem 0 0;
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.75;
}

.security-event-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.security-event-row {
    border: 1px solid #e5e7eb;
    border-radius: 1.15rem;
    background: #ffffff;
    padding: 1rem 1.1rem;
}

.security-event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
    margin-bottom: 0.55rem;
}

.security-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.22rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
}

.security-badge.low {
    background: #eef5e9;
    color: #1d2e28;
}

.security-badge.medium {
    background: #fef3c7;
    color: #92400e;
}

.security-badge.high,
.security-badge.critical {
    background: #fee2e2;
    color: #991b1b;
}

.security-empty {
    border: 1px dashed #dbe4d5;
    border-radius: 1rem;
    background: #ffffff;
    color: #6b7280;
    padding: 1rem;
    text-align: center;
}

.security-top-type {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 1rem;
    padding: 0.85rem 1rem;
}

.admin-ops-center {
    border: 1px solid rgba(29, 46, 40, 0.08);
    border-radius: 2rem;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbf3 100%);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.07);
    padding: 1.6rem;
}

.admin-ops-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.4rem;
    border-radius: 1.5rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

.admin-ops-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.admin-ops-tile {
    min-height: 142px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #e5e7eb;
    border-radius: 1.35rem;
    background: #fbfdf9;
    padding: 1.1rem;
}

.admin-ops-tile span,
.admin-ops-tile small {
    color: #6b7280;
    font-weight: 700;
}

.admin-ops-tile span {
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.admin-ops-tile strong {
    color: #19372d;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.admin-ops-tile small {
    font-size: 0.8rem;
    line-height: 1.55;
}

.admin-ops-tile--danger strong {
    color: #991b1b;
}

.admin-ops-tile--warn strong {
    color: #92400e;
}

.admin-ops-grid {
    display: grid;
    grid-template-columns: minmax(360px, 0.85fr) minmax(0, 1.4fr);
    gap: 1rem;
    margin-top: 1rem;
}

.admin-log-panel {
    border: 1px solid #e5e7eb;
    border-radius: 1.5rem;
    background: #ffffff;
    padding: 1.25rem;
}

.admin-log-panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-log-panel__head h4 {
    margin: 0.35rem 0 0;
    color: #19372d;
    font-size: 1.25rem;
    font-weight: 800;
}

.admin-user-log-list {
    display: grid;
    gap: 0.75rem;
}

.admin-user-log-list article {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 0.8rem;
    align-items: center;
    border: 1px solid #e5e7eb;
    border-radius: 1.1rem;
    background: #fbfdf9;
    padding: 0.85rem;
}

.admin-user-log-avatar {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: #eef5e9;
    color: #19372d;
    font-weight: 800;
}

.admin-user-log-list strong,
.admin-user-log-list span,
.admin-user-log-list b,
.admin-user-log-list small {
    display: block;
}

.admin-user-log-list strong,
.admin-user-log-list b {
    color: #19372d;
    font-weight: 800;
}

.admin-user-log-list span,
.admin-user-log-list small {
    color: #6b7280;
    font-size: 0.78rem;
}

.admin-user-log-list article > div:last-child {
    text-align: right;
}

.admin-error-layout {
    display: grid;
    grid-template-columns: minmax(250px, 0.7fr) minmax(0, 1.3fr);
    gap: 1rem;
}

@media (max-width: 1100px) {
    .admin-command-console {
        grid-template-columns: 1fr;
    }

    .admin-command-rail {
        flex-direction: row;
        justify-content: center;
        overflow-x: auto;
    }

    .admin-command-head {
        flex-direction: column;
    }

    .admin-command-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-ops-tabs,
    .admin-ops-grid,
    .admin-error-layout,
    .admin-content-grid {
        grid-template-columns: 1fr;
    }

    .admin-ops-hero,
    .admin-content-hero {
        display: block;
    }

    .admin-ops-hero .btn-secondary,
    .admin-content-hero .btn-primary {
        margin-top: 1rem;
    }

    .admin-console-tabs {
        position: static;
    }
}

@media (max-width: 720px) {
    .admin-command-cards {
        grid-template-columns: 1fr;
    }
}


.chart-shell--wide {
    height: 300px;
}


/* Dark theme: admin cards, tinted chart cards and the brand-green ink. */
html[data-rabuild-color-theme="dark"] .admin-card,
html[data-rabuild-color-theme="dark"] .admin-kpi,
html[data-rabuild-color-theme="dark"] .bg-\[\#FBFDF9\] {
    background: #17241F !important;
    border-color: rgba(217, 230, 211, 0.18) !important;
    color: #F6FBF2 !important;
}

html[data-rabuild-color-theme="dark"] .text-\[\#19372D\],
html[data-rabuild-color-theme="dark"] .text-\[\#1D2E28\] {
    color: #F6FBF2 !important;
}

html[data-rabuild-color-theme="dark"] .text-gray-400 {
    color: #8FB89B !important;
}

html[data-rabuild-color-theme="dark"] .bg-\[\#EEF5E9\] {
    background: #243B32 !important;
    border-color: rgba(217, 230, 211, 0.18) !important;
}

/* Support tab (admin_support_tickets.js). */
.admin-support-badge {
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #DC2626;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.25rem;
    text-align: center;
}
.admin-support-badge[hidden] { display: none; }
.admin-command-rail__item { position: relative; }
.admin-command-rail__item .admin-support-badge { position: absolute; top: 0.2rem; right: 0.2rem; }

.admin-support-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0 1rem;
}
.admin-support-filters button {
    border: 1px solid #DCE5D6;
    border-radius: 999px;
    padding: 0.4rem 0.95rem;
    font-weight: 800;
    font-size: 0.85rem;
    color: #475569;
    background: #ffffff;
    cursor: pointer;
}
.admin-support-filters button.is-active { background: #1D2E28; border-color: #1D2E28; color: #ffffff; }

.admin-support-list { display: flex; flex-direction: column; gap: 1rem; }
.admin-support-ticket {
    border: 1px solid #E5E7EB;
    border-left: 5px solid #94A3B8;
    border-radius: 1.2rem;
    background: #ffffff;
    padding: 1.1rem 1.25rem;
}
.admin-support-ticket--normal { border-left-color: #2F6B4F; }
.admin-support-ticket--high { border-left-color: #F59E0B; }
.admin-support-ticket--urgent { border-left-color: #DC2626; }
.admin-support-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.admin-support-ticket h4 { font-size: 1.1rem; font-weight: 800; color: #19372D; margin-top: 0.15rem; }
.admin-support-ref { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; color: #6B7280; }
.admin-support-from { font-size: 0.85rem; color: #475569; margin-top: 0.25rem; display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.admin-support-from a { color: #2F6B4F; font-weight: 700; text-decoration: underline; }
.admin-support-pills { display: flex; gap: 0.4rem; align-items: flex-start; }
.admin-support-priority, .admin-support-status {
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: capitalize;
}
.admin-support-priority--low { background: #F1F5F9; color: #475569; }
.admin-support-priority--normal { background: #DCFCE7; color: #166534; }
.admin-support-priority--high { background: #FEF3C7; color: #92400E; }
.admin-support-priority--urgent { background: #FEE2E2; color: #991B1B; }
.admin-support-status--new { background: #FEF3C7; color: #92400E; }
.admin-support-status--in_progress { background: #DBEAFE; color: #1E40AF; }
.admin-support-status--resolved { background: #DCFCE7; color: #166534; }
.admin-support-status--closed { background: #E5E7EB; color: #374151; }
.admin-support-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.admin-support-meta span { font-size: 0.75rem; font-weight: 700; color: #475569; background: #F7FAF5; border: 1px solid #E5E7EB; border-radius: 999px; padding: 0.15rem 0.6rem; }
.admin-support-issue {
    margin-top: 0.8rem;
    padding: 0.85rem 1rem;
    border-radius: 0.9rem;
    background: #F7FAF5;
    border: 1px solid #E5E7EB;
    white-space: pre-wrap;
    font-size: 0.92rem;
    line-height: 1.6;
    color: #1F2937;
}
.admin-support-page { font-size: 0.78rem; color: #6B7280; margin-top: 0.5rem; word-break: break-all; }
.admin-support-respond {
    display: grid;
    grid-template-columns: 11rem 1fr auto;
    gap: 0.75rem;
    align-items: start;
    margin-top: 0.9rem;
}
.admin-support-respond label { font-size: 0.75rem; font-weight: 800; color: #475569; display: flex; flex-direction: column; gap: 0.3rem; }
@media (max-width: 720px) {
    .admin-support-respond { grid-template-columns: 1fr; }
}

html[data-rabuild-color-theme="dark"] .admin-support-ticket,
html[data-rabuild-color-theme="dark"] .admin-support-filters button {
    background: #17241F !important;
    border-color: rgba(217, 230, 211, 0.18);
    color: #F6FBF2;
}
html[data-rabuild-color-theme="dark"] .admin-support-ticket--normal { border-left-color: #95D5B2; }
html[data-rabuild-color-theme="dark"] .admin-support-ticket--high { border-left-color: #F59E0B; }
html[data-rabuild-color-theme="dark"] .admin-support-ticket--urgent { border-left-color: #F87171; }
html[data-rabuild-color-theme="dark"] .admin-support-filters button.is-active { background: #95D5B2 !important; color: #101C17; }
html[data-rabuild-color-theme="dark"] .admin-support-issue,
html[data-rabuild-color-theme="dark"] .admin-support-meta span {
    background: #1A2C25;
    border-color: rgba(217, 230, 211, 0.14);
    color: #F6FBF2;
}
html[data-rabuild-color-theme="dark"] .admin-support-from,
html[data-rabuild-color-theme="dark"] .admin-support-respond label,
html[data-rabuild-color-theme="dark"] .admin-support-ref { color: #AFC4B8; }
html[data-rabuild-color-theme="dark"] .admin-support-from a { color: #95D5B2; }

html[data-rabuild-color-theme="dark"] .admin-ops-center,
html[data-rabuild-color-theme="dark"] .admin-ops-hero,
html[data-rabuild-color-theme="dark"] .admin-ops-tile,
html[data-rabuild-color-theme="dark"] .admin-log-panel {
    background: #17241F !important;
    border-color: rgba(217, 230, 211, 0.18) !important;
    color: #F6FBF2;
}
html[data-rabuild-color-theme="dark"] .admin-ops-tile strong { color: #F6FBF2; }
html[data-rabuild-color-theme="dark"] .admin-ops-tile--warn strong { color: #FCD34D; }
html[data-rabuild-color-theme="dark"] .admin-ops-tile--danger strong { color: #FCA5A5; }
html[data-rabuild-color-theme="dark"] .admin-ops-tile span,
html[data-rabuild-color-theme="dark"] .admin-ops-tile small { color: #AFC4B8; }
html[data-rabuild-color-theme="dark"] .admin-support-ticket h4 { color: #F6FBF2; }

/* Support KPIs (admin_support_tickets.js): Users tab "compact", Support tab "full". */
.admin-support-kpis {
    margin-top: 1.5rem;
    border: 1px solid #E5E7EB;
    border-radius: 1.35rem;
    background: #ffffff;
    padding: 1.25rem;
}
.support-kpi-tiles {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
}
.support-kpi-tile {
    border: 1px solid #E5E7EB;
    border-top: 3px solid #CBD5E1;
    border-radius: 1rem;
    background: #FBFDF9;
    padding: 0.8rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.support-kpi-tile span { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #6B7280; }
.support-kpi-tile strong { font-size: 1.6rem; font-weight: 800; line-height: 1.1; color: #19372D; }
.support-kpi-tile small { font-size: 0.75rem; line-height: 1.45; color: #6B7280; font-weight: 600; }
.support-kpi-tile--good { border-top-color: #22A06B; }
.support-kpi-tile--good strong { color: #166534; }
.support-kpi-tile--warn { border-top-color: #F59E0B; }
.support-kpi-tile--warn strong { color: #92400E; }
.support-kpi-tile--bad { border-top-color: #DC2626; }
.support-kpi-tile--bad strong { color: #991B1B; }
.support-kpi-empty { margin-top: 0.85rem; font-size: 0.85rem; color: #6B7280; font-weight: 600; }
.support-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.support-kpi-card {
    border: 1px solid #E5E7EB;
    border-radius: 1.1rem;
    background: #FBFDF9;
    padding: 1rem;
    min-width: 0;
}
.support-kpi-card--wide { grid-column: 1 / -1; }
.support-kpi-eyebrow { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: #6B7280; }
.support-kpi-title { font-size: 1rem; font-weight: 800; color: #19372D; margin-top: 0.15rem; }
.support-kpi-chart { position: relative; height: 240px; margin-top: 0.6rem; }
.support-kpi-table-wrap { overflow-x: auto; margin-top: 0.6rem; }
.support-kpi-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.support-kpi-table th { text-align: left; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: #6B7280; padding: 0.5rem 0.6rem; border-bottom: 1px solid #E5E7EB; }
.support-kpi-table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid #F1F5F9; color: #1F2937; font-weight: 600; }
.support-kpi-table td.is-late { color: #B91C1C; font-weight: 800; }
@media (max-width: 1100px) { .support-kpi-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
    .support-kpi-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .support-kpi-grid { grid-template-columns: 1fr; }
}

.admin-support-note { position: relative; }
.admin-support-ai { display: flex; gap: 0.4rem; justify-content: flex-end; margin-top: 0.35rem; }
.admin-support-ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    border: 1px solid #C9DDB5;
    background: #F2FAE9;
    color: #18392B;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
}
.admin-support-ai-btn:hover, .admin-support-ai-btn:focus-visible { background: #18392B; color: #ffffff; outline: none; }
.admin-support-ai-btn:disabled { opacity: 0.6; cursor: progress; }
.admin-support-ai-btn[hidden] { display: none; }

html[data-rabuild-color-theme="dark"] .admin-support-kpis,
html[data-rabuild-color-theme="dark"] .support-kpi-tile,
html[data-rabuild-color-theme="dark"] .support-kpi-card {
    background: #17241F !important;
    border-color: rgba(217, 230, 211, 0.18);
}
html[data-rabuild-color-theme="dark"] .support-kpi-tile strong,
html[data-rabuild-color-theme="dark"] .support-kpi-title,
html[data-rabuild-color-theme="dark"] .support-kpi-table td { color: #F6FBF2; }
html[data-rabuild-color-theme="dark"] .support-kpi-tile--good strong { color: #86EFAC; }
html[data-rabuild-color-theme="dark"] .support-kpi-tile--warn strong { color: #FCD34D; }
html[data-rabuild-color-theme="dark"] .support-kpi-tile--bad strong { color: #FCA5A5; }
html[data-rabuild-color-theme="dark"] .support-kpi-table td.is-late { color: #FCA5A5; }
html[data-rabuild-color-theme="dark"] .support-kpi-tile span,
html[data-rabuild-color-theme="dark"] .support-kpi-tile small,
html[data-rabuild-color-theme="dark"] .support-kpi-eyebrow,
html[data-rabuild-color-theme="dark"] .support-kpi-empty,
html[data-rabuild-color-theme="dark"] .support-kpi-table th { color: #AFC4B8; }
html[data-rabuild-color-theme="dark"] .support-kpi-table th,
html[data-rabuild-color-theme="dark"] .support-kpi-table td { border-color: rgba(217, 230, 211, 0.12); }
html[data-rabuild-color-theme="dark"] .admin-support-ai-btn { background: #243B32; border-color: rgba(217, 230, 211, 0.18); color: #A7D58A; }
html[data-rabuild-color-theme="dark"] .admin-support-ai-btn:hover { background: #A7D58A; color: #101C17; }

.admin-support-respond > .btn-primary { margin-top: 1.35rem; }

/* Support queue: account, classification, conversation, team, login. */
.admin-support-queue,
.admin-support-agents {
    margin-top: 1.5rem;
    border: 1px solid #E5E7EB;
    border-radius: 1.35rem;
    background: #ffffff;
    padding: 1.25rem;
}
.admin-support-queue-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.admin-support-search { max-width: 22rem; width: 100%; }
.admin-support-queue .admin-support-filters { margin: 1rem 0 0.75rem; }
.admin-support-facets { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.admin-support-facet-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.admin-support-facet-label { min-width: 6rem; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #6B7280; }
.admin-support-chip {
    display: inline-flex; align-items: center; gap: 0.4rem;
    border: 1px solid #E5E7EB; border-radius: 999px; padding: 0.25rem 0.7rem;
    background: #F7FAF5; color: #334155; font-size: 0.78rem; font-weight: 700; cursor: pointer;
}
.admin-support-chip b { font-weight: 800; color: #19372D; }
.admin-support-chip.is-active { background: #2F6B4F; border-color: #2F6B4F; color: #ffffff; }
.admin-support-chip.is-active b { color: #ffffff; }
.admin-support-awaiting { padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.72rem; font-weight: 800; }
.admin-support-awaiting--support { background: #FEE2E2; color: #991B1B; }
.admin-support-awaiting--user { background: #E0F2FE; color: #075985; }
.admin-support-account {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem;
    margin-top: 0.6rem; padding: 0.6rem 0.8rem; border-radius: 0.9rem; background: #F7FAF5; border: 1px solid #E5E7EB;
}
.admin-support-account-who { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; font-size: 0.88rem; color: #19372D; }
.admin-support-account-who a { color: #2F6B4F; font-weight: 700; text-decoration: underline; }
.admin-support-account-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; font-size: 0.78rem; color: #475569; font-weight: 600; }
.admin-support-account-meta span { display: inline-flex; align-items: center; gap: 0.25rem; }
.admin-support-conversation { margin-top: 0.8rem; }
.admin-support-conversation > summary { cursor: pointer; font-size: 0.8rem; font-weight: 800; color: #2F6B4F; }
.support-thread { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.6rem; }
.support-msg { max-width: 85%; padding: 0.6rem 0.85rem; border-radius: 0.9rem; font-size: 0.9rem; line-height: 1.55; }
.support-msg--user { align-self: flex-start; background: #F7FAF5; border: 1px solid #E5E7EB; }
.support-msg--support { align-self: flex-end; background: #EEF5E9; border: 1px solid #C9DDB5; }
.support-msg-meta { font-size: 0.72rem; color: #6B7280; margin-bottom: 0.2rem; }
.support-msg-meta strong { color: #19372D; }
.support-msg-body { white-space: pre-wrap; color: #1F2937; }

.admin-support-agent-form { display: grid; grid-template-columns: 1.2fr 1.2fr 1.2fr auto; gap: 0.75rem; align-items: start; margin-top: 1rem; }
.admin-support-agent-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.75rem; font-weight: 800; color: #475569; }
.admin-support-agent-form > .btn-primary { margin-top: 1.35rem; }
.admin-support-handle-preview { font-size: 0.75rem; font-weight: 700; color: #2F6B4F; }
.admin-support-agent-list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1rem; }
.admin-support-agent {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
    border: 1px solid #E5E7EB; border-radius: 1rem; padding: 0.75rem 1rem; background: #FBFDF9;
}
.admin-support-agent > div:first-child { display: flex; flex-direction: column; gap: 0.1rem; }
.admin-support-agent strong { color: #19372D; font-size: 0.98rem; }
.admin-support-agent span { color: #475569; font-size: 0.85rem; }
.admin-support-agent small { color: #6B7280; font-size: 0.75rem; }
.admin-support-agent.is-disabled { opacity: 0.6; }
.admin-support-agent-actions { display: flex; gap: 0.5rem; }
@media (max-width: 900px) { .admin-support-agent-form { grid-template-columns: 1fr; } }

.support-login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.support-login-card { width: min(28rem, 100%); padding: 2rem; border-radius: 1.5rem; }
.support-login-error {
    margin-top: 1rem; padding: 0.7rem 0.9rem; border-radius: 0.8rem;
    background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; font-size: 0.88rem; font-weight: 700;
}

html[data-rabuild-color-theme="dark"] .admin-support-queue,
html[data-rabuild-color-theme="dark"] .admin-support-agents,
html[data-rabuild-color-theme="dark"] .admin-support-account,
html[data-rabuild-color-theme="dark"] .admin-support-agent,
html[data-rabuild-color-theme="dark"] .support-msg--user {
    background: #17241F !important;
    border-color: rgba(217, 230, 211, 0.18);
}
html[data-rabuild-color-theme="dark"] .support-msg--support { background: #243B32; border-color: rgba(167, 213, 138, 0.35); }
html[data-rabuild-color-theme="dark"] .support-msg-body,
html[data-rabuild-color-theme="dark"] .support-msg-meta strong,
html[data-rabuild-color-theme="dark"] .admin-support-account-who,
html[data-rabuild-color-theme="dark"] .admin-support-agent strong { color: #F6FBF2; }
html[data-rabuild-color-theme="dark"] .support-msg-meta,
html[data-rabuild-color-theme="dark"] .admin-support-account-meta,
html[data-rabuild-color-theme="dark"] .admin-support-agent span,
html[data-rabuild-color-theme="dark"] .admin-support-agent small,
html[data-rabuild-color-theme="dark"] .admin-support-facet-label,
html[data-rabuild-color-theme="dark"] .admin-support-agent-form label { color: #AFC4B8; }
html[data-rabuild-color-theme="dark"] .admin-support-chip { background: #1A2C25; border-color: rgba(217, 230, 211, 0.18); color: #E5EDE8; }
html[data-rabuild-color-theme="dark"] .admin-support-chip b { color: #A7D58A; }
html[data-rabuild-color-theme="dark"] .admin-support-chip.is-active { background: #95D5B2; border-color: #95D5B2; color: #101C17; }
html[data-rabuild-color-theme="dark"] .admin-support-chip.is-active b { color: #101C17; }
html[data-rabuild-color-theme="dark"] .admin-support-conversation > summary,
html[data-rabuild-color-theme="dark"] .admin-support-handle-preview,
html[data-rabuild-color-theme="dark"] .admin-support-account-who a { color: #95D5B2; }
html[data-rabuild-color-theme="dark"] .support-login-error { background: #3B1414; border-color: #7F1D1D; color: #FCA5A5; }
.admin-support-agent-reset { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.admin-support-agent-reset[hidden] { display: none; }
.admin-support-agent-reset .form-input { max-width: 24rem; }

/* Library sizes (P1.6) */
.admin-library-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.admin-library-tile { border: 1px solid #DCE7D4; border-radius: 16px; background: #fff; padding: 14px 16px; }
.admin-library-tile .label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #5A6B62; }
.admin-library-tile .value { font-size: 26px; font-weight: 800; color: #19372D; margin-top: 4px; }
.admin-library-tile .note { font-size: 12px; color: #5A6B62; margin-top: 4px; }
.admin-library-table th { color: #19372D; border-bottom: 1px solid #DCE7D4; }
.admin-library-table td { border-bottom: 1px solid #EEF3EA; color: #2A3B33; }
html[data-rabuild-color-theme="dark"] .admin-library-tile { background: #17231D; border-color: rgba(217, 230, 211, 0.18); }
html[data-rabuild-color-theme="dark"] .admin-library-tile .value, html[data-rabuild-color-theme="dark"] .admin-library-table th { color: #E3EEDD; }
html[data-rabuild-color-theme="dark"] .admin-library-tile .label, html[data-rabuild-color-theme="dark"] .admin-library-tile .note, html[data-rabuild-color-theme="dark"] .admin-library-table td { color: #B9C8B4; }
html[data-rabuild-color-theme="dark"] .admin-library-table td, html[data-rabuild-color-theme="dark"] .admin-library-table th { border-color: rgba(217, 230, 211, 0.14); }

/* Subscriptions tab (2026-10-27). */
.admin-sub-table-wrap { overflow-x: auto; border: 1px solid #E5E7EB; border-radius: 16px; background: #fff; }
.admin-sub-table { width: 100%; min-width: 980px; border-collapse: collapse; font-size: 13px; }
.admin-sub-table th { padding: 12px 14px; text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #6B7280; background: #F9FAFB; border-bottom: 1px solid #E5E7EB; }
.admin-sub-table td { padding: 12px 14px; vertical-align: top; border-bottom: 1px solid #F1F5F9; color: #19372D; }
.admin-sub-table select { min-width: 140px; }
.admin-sub-muted { margin-top: 3px; color: #6B7280; font-size: 12px; line-height: 1.45; }
.admin-sub-muted a { color: inherit; text-decoration: underline; }
.admin-sub-amount { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.admin-sub-notes td { padding-top: 0; color: #4B5563; font-style: italic; }
html[data-rabuild-color-theme="dark"] .admin-sub-table-wrap { background: #0f1a17; border-color: #24342f; }
html[data-rabuild-color-theme="dark"] .admin-sub-table th { background: #13221e; color: #9fb3aa; border-color: #24342f; }
html[data-rabuild-color-theme="dark"] .admin-sub-table td { color: #e6efe9; border-color: #1c2b27; }
html[data-rabuild-color-theme="dark"] .admin-sub-muted, html[data-rabuild-color-theme="dark"] .admin-sub-notes td { color: #9fb3aa; }

/* ---- Console restyle (2026-10-27) ------------------------------------------ */
/* One compact strip replaces the command console hero and the duplicate KPI row. */
.admin-overview-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.admin-overview-strip article { position: relative; display: grid; gap: 2px; padding: 16px 16px 14px; border: 1px solid #E2E8E0; border-radius: 14px; background: #fff; min-width: 0; }
.admin-overview-strip i { position: absolute; top: 14px; right: 14px; font-size: 20px; color: #9DB5A7; }
.admin-overview-strip span { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #64748B; padding-right: 26px; }
.admin-overview-strip b { font-size: 30px; line-height: 1.15; font-weight: 800; color: #19372D; font-variant-numeric: tabular-nums; }
.admin-overview-strip small { font-size: 12.5px; color: #64748B; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-overview-strip article.is-sales { background: #F7FBF5; border-color: #D5E5CE; }
.admin-overview-strip article.is-sales i { color: #2F6B4F; }

/* Tabs: one row, quieter, scrolls sideways on small screens. */
.admin-console-tabs { flex-wrap: nowrap; gap: 4px; padding: 6px; border-radius: 14px; overflow-x: auto; scrollbar-width: thin; }
.admin-console-tab { flex: 0 0 auto; min-height: 42px; padding: 0 14px; font-size: 14.5px; font-weight: 700; white-space: nowrap; }
.admin-console-tab:hover { background: #EEF5E9; color: #19372D; border-color: transparent; }
.admin-console-tab.is-active { background: #1d2e28; color: #fff; }
.admin-console-tab .admin-support-badge { margin-left: 2px; }
.admin-tab-panel.is-active > * + * { margin-top: 1.5rem; }

/* Folded secondary content. */
.admin-fold { border: 1px solid #E2E8E0; border-radius: 14px; background: #fff; padding: 0 18px; }
.admin-fold > summary { display: flex; align-items: center; gap: 8px; min-height: 52px; cursor: pointer; font-weight: 800; color: #19372D; list-style: none; }
.admin-fold > summary::-webkit-details-marker { display: none; }
.admin-fold > summary::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid #64748B; border-bottom: 2px solid #64748B; transform: rotate(45deg); transition: transform .2s; }
.admin-fold[open] > summary::after { transform: rotate(-135deg); }
.admin-fold[open] { padding-bottom: 18px; }
.admin-fold.admin-support-agents { padding: 0 18px; margin-top: 1.5rem; }
.admin-fold.admin-support-agents[open] { padding-bottom: 18px; }
.admin-note-list { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 13.5px; color: #475569; }
.admin-note-list li { display: flex; gap: 8px; align-items: baseline; }
.admin-note-list i { color: #2F6B4F; }

/* Accounts: compact rows instead of tall cards. */
#user-list.space-y-4 > * + * { margin-top: 8px; }
.account-item { border-radius: 12px !important; }
.account-header.user-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px !important; }
.account-header .w-14 { width: 40px; height: 40px; border-radius: 10px; font-size: 16px; }
.account-header .user-name { font-size: 15.5px; }
.account-header .user-email { margin-top: 2px; font-size: 13px; }
.account-header .text-xs.mt-3 { margin-top: 6px; }
.account-header .pill { font-size: 11.5px; padding-top: 2px; padding-bottom: 2px; }

@media (max-width: 1180px) { .admin-overview-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
    .admin-overview-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .admin-overview-strip b { font-size: 24px; }
    .account-header.user-header { flex-wrap: wrap; }
}

html[data-rabuild-color-theme="dark"] .admin-overview-strip article,
html[data-rabuild-color-theme="dark"] .admin-fold { background: #17241F; border-color: #2A3B35; }
html[data-rabuild-color-theme="dark"] .admin-overview-strip article.is-sales { background: #1A2B24; }
html[data-rabuild-color-theme="dark"] .admin-overview-strip b,
html[data-rabuild-color-theme="dark"] .admin-fold > summary { color: #F1F7F3; }
html[data-rabuild-color-theme="dark"] .admin-overview-strip span,
html[data-rabuild-color-theme="dark"] .admin-overview-strip small,
html[data-rabuild-color-theme="dark"] .admin-note-list { color: #9FB3AA; }
html[data-rabuild-color-theme="dark"] .admin-console-tab:hover { background: #1F3A30; color: #F1F7F3; }
