:root {
    --bg: #f3efe7;
    --surface: rgba(255, 255, 255, 0.86);
    --ink: #182126;
    --muted: #66737d;
    --brand: #102a43;
    --border: rgba(16, 42, 67, 0.08);
    --topbar-start: #0f172a;
    --topbar-end: #102a43;
    --sidebar-bg: rgba(255, 255, 255, 0.45);
    --sidebar-active: #102a43;
    --sidebar-active-text: #ffffff;
    --body-bg:
        radial-gradient(circle at top left, rgba(217, 119, 6, 0.18), transparent 22%),
        radial-gradient(circle at bottom right, rgba(16, 42, 67, 0.14), transparent 26%),
        linear-gradient(180deg, #f8f4ee 0%, #eef2f4 100%);
}

body.theme-dark {
    --bg: #08111b;
    --surface: rgba(12, 23, 36, 0.92);
    --ink: #edf2f7;
    --muted: #a8b3bd;
    --brand: #0b2540;
    --border: rgba(148, 163, 184, 0.16);
    --topbar-start: #020617;
    --topbar-end: #0b2540;
    --sidebar-bg: rgba(7, 18, 31, 0.9);
    --sidebar-active: #d97706;
    --sidebar-active-text: #08111b;
    --body-bg:
        radial-gradient(circle at top left, rgba(217, 119, 6, 0.15), transparent 20%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.12), transparent 22%),
        linear-gradient(180deg, #06101a 0%, #0a1622 100%);
}

body {
    font-family: "Outfit", sans-serif;
    color: var(--ink);
    background: var(--body-bg);
}

.auth-wrapper,
.app-shell {
    min-height: 100vh;
}

.topbar {
    background: linear-gradient(135deg, var(--topbar-start), var(--topbar-end));
}

.brand-title {
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sidebar {
    background: var(--sidebar-bg);
    backdrop-filter: blur(18px);
    border-right: 1px solid var(--border);
}

.sidebar-link {
    display: block;
    color: var(--ink);
    text-decoration: none;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
}

.glass-card,
.panel-card,
.metric-card,
.call-modal {
    background: var(--surface);
    backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 18px 60px rgba(15, 23, 42, 0.08);
}

.panel-card,
.metric-card {
    padding: 1.5rem;
}

.metric-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.metric-card strong {
    font-size: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.list-entry {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(16, 42, 67, 0.08);
}

.list-entry:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.call-timer {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.modal-footer {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.table > :not(caption) > * > * {
    background: transparent;
}

body.theme-dark .table {
    --bs-table-color: var(--ink);
    --bs-table-border-color: rgba(148, 163, 184, 0.14);
}

body.theme-dark .form-control,
body.theme-dark .form-select,
body.theme-dark textarea {
    background: rgba(15, 23, 42, 0.82);
    color: var(--ink);
    border-color: rgba(148, 163, 184, 0.18);
}

body.theme-dark .form-control::placeholder,
body.theme-dark textarea::placeholder {
    color: #8ca0b3;
}

body.theme-dark .text-muted,
body.theme-dark .form-text {
    color: var(--muted) !important;
}

body.theme-dark .btn-outline-dark {
    color: #e5edf5;
    border-color: rgba(229, 237, 245, 0.35);
}

body.theme-dark .btn-outline-dark:hover {
    background: #e5edf5;
    color: #0b1320;
}

body.theme-dark .badge.text-bg-light {
    background-color: #243447 !important;
    color: #f8fafc !important;
}

@media (max-width: 991.98px) {
    .topbar .container-fluid {
        align-items: flex-start;
        gap: 0.75rem;
    }

    .brand-title {
        max-width: 100%;
        white-space: normal;
        line-height: 1.2;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .sidebar {
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        display: flex;
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding: 0.85rem 1rem !important;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        scrollbar-width: thin;
    }

    .sidebar-link {
        margin-bottom: 0;
        flex: 0 0 auto;
        text-align: center;
        padding: 0.7rem 1rem;
        border: 1px solid rgba(16, 42, 67, 0.08);
        background: rgba(255, 255, 255, 0.65);
    }

    .sidebar-link::after {
        content: ">";
        margin-left: 0.75rem;
        opacity: 0.45;
    }

    .sidebar-link:last-child::after {
        content: "";
        margin-left: 0;
    }

    .sidebar-link.active::after,
    .sidebar-link:hover::after {
        opacity: 0.7;
    }

    main.col-lg-10 {
        padding: 1.25rem !important;
    }

    .page-title {
        font-size: 1.7rem;
    }

    .panel-card,
    .metric-card,
    .glass-card {
        border-radius: 20px;
        padding: 1.2rem;
    }

    .list-entry {
        flex-direction: column;
        align-items: flex-start;
    }

    .call-modal {
        margin: 1rem;
    }
}

@media (max-width: 575.98px) {
    .topbar {
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }

    .topbar-actions {
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    .topbar-actions form,
    .topbar-actions .badge {
        width: 100%;
    }

    .topbar-actions .btn {
        width: 100%;
    }

    .sidebar-link {
        width: auto;
    }

    .metric-card strong {
        font-size: 1.6rem;
    }

    .call-timer {
        font-size: 1.7rem;
    }

    .modal-footer .btn {
        flex: 1 1 calc(50% - 0.5rem);
    }

    .table-responsive {
        font-size: 0.92rem;
    }
}
