/* =========================================================
   SignReach — Booking Portal styles
   Design language inherited from v4 budget planner.
   ========================================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
}

/* ---- CSS custom properties (light mode) ---- */
:root {
    --ink: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --card: #ffffff;
    --brand: #4f46e5;
    --brand-2: #4338ca;
    --good: #166534;
    --bad: #dc2626;
    --warn: #b45309;
    --bg: #f5f7fb;
    --bg-2: #f8fafc;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);

    --status-pending: #b45309;
    --status-confirmed: #166534;
    --status-completed: #475569;
    --status-cancelled: #dc2626;
}

body[data-theme="dark"] {
    --ink: #e2e8f0;
    --muted: #94a3b8;
    --border: #46526a;
    --card: #37404f;
    --bg: #2b3345;
    --bg-2: #323c4f;
    --shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

/* ---- SignaVision signature theme ---- */
body[data-theme="signa"] {
    /* App variable mapping */
    --ink: #eeeef8;
    --muted: #b8b8d8;
    --border: #464664;
    --card: #393953;
    --brand: #7c5cff;
    --brand-2: #6340e0;
    --good: #3ddc97;
    --bad: #ff5c7a;
    --warn: #ffb020;
    --bg: #313144;
    --bg-2: #404060;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.30);
    --status-pending: #ffb020;
    --status-confirmed: #3ddc97;
    --status-completed: #b8b8d8;
    --status-cancelled: #ff5c7a;
    /* Native signature vars */
    --bg-main: #313144;
    --bg-panel: #393953;
    --bg-elevated: #404060;
    --bg-hover: #49496c;
    --text-primary: #eeeef8;
    --text-secondary: #b8b8d8;
    --text-muted: #8888b8;
    --accent-primary: #7c5cff;
    --accent-secondary: #00d4ff;
    --accent-success: #3ddc97;
    --accent-warning: #ffb020;
    --accent-danger: #ff5c7a;
    --border-subtle: #464664;
    --border-strong: #54547c;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.22);
    --shadow-glow: 0 0 10px rgba(124, 92, 255, 0.4);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

body[data-theme="signa"] .appbar {
    background: rgba(49, 49, 68, 0.92);
}

body[data-theme="signa"] .field-input:focus {
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.28);
}

body[data-theme="signa"] .status-pill.pending {
    background: rgba(255, 176, 32, 0.18);
}

body[data-theme="signa"] .status-pill.confirmed {
    background: rgba(61, 220, 151, 0.15);
}

body[data-theme="signa"] .status-pill.completed {
    background: rgba(166, 166, 197, 0.15);
}

body[data-theme="signa"] .status-pill.cancelled {
    background: rgba(255, 92, 122, 0.15);
}

body[data-theme="signa"] .lang-chip {
    background: rgba(124, 92, 255, 0.15);
    border-color: rgba(124, 92, 255, 0.35);
}

body[data-theme="signa"] .cert-chip {
    background: rgba(61, 220, 151, 0.15);
    color: #3ddc97;
    border-color: rgba(61, 220, 151, 0.30);
}

body[data-theme="signa"] .group-chip {
    background: rgba(61, 220, 151, 0.12);
    color: #3ddc97;
    border-color: rgba(61, 220, 151, 0.28);
}

body[data-theme="signa"] .btn-danger {
    background: rgba(255, 92, 122, 0.14);
    border-color: rgba(255, 92, 122, 0.35);
    color: #ff5c7a;
}

body[data-theme="signa"] .btn-ghost.active {
    background: rgba(124, 92, 255, 0.14);
    border-color: rgba(124, 92, 255, 0.55);
}

/* Scrollbar */
body[data-theme="signa"] ::-webkit-scrollbar-track {
    background: #1e1e2f;
}

body[data-theme="signa"] ::-webkit-scrollbar-thumb {
    background: #3c3c5a;
}

body[data-theme="signa"] ::-webkit-scrollbar-thumb:hover {
    background: #7c5cff;
}

/* Glow utility */
body[data-theme="signa"] .glow {
    box-shadow: 0 0 10px rgba(124, 92, 255, 0.4);
}

/* ---- Hover states — all interactive surfaces get purple tint ---- */

/* Buttons */
body[data-theme="signa"] .btn:hover,
body[data-theme="signa"] .btn-ghost:hover {
    background: rgba(124, 92, 255, 0.18);
    border-color: rgba(124, 92, 255, 0.5);
    box-shadow: 0 0 10px rgba(124, 92, 255, 0.35);
}

/* KPI cards */
body[data-theme="signa"] .kpi-card:hover {
    background: rgba(124, 92, 255, 0.1);
    border-color: rgba(124, 92, 255, 0.35);
    box-shadow: 0 0 14px rgba(124, 92, 255, 0.25);
}

/* Booking table rows */
body[data-theme="signa"] table.booking-table tbody tr:hover td,
body[data-theme="signa"] table.booking-table tbody tr.row-assigned:hover td,
body[data-theme="signa"] table.booking-table tbody tr.row-unassigned:hover td {
    background: rgba(124, 92, 255, 0.1);
}

/* Field inputs */
body[data-theme="signa"] .field-input:hover {
    border-color: rgba(124, 92, 255, 0.5);
}

/* Role / group filter pills */
body[data-theme="signa"] .role-pill:hover {
    background: rgba(124, 92, 255, 0.15);
    border-color: rgba(124, 92, 255, 0.45);
    color: #c4b0ff;
}

/* Profile tabs */
body[data-theme="signa"] .profile-tab-btn:hover {
    background: rgba(124, 92, 255, 0.15);
    color: #c4b0ff;
}

/* Identity chip / logout */
body[data-theme="signa"] .appbar-identity:hover,
body[data-theme="signa"] .identity-logout:hover {
    background: rgba(124, 92, 255, 0.15);
}

/* Row action buttons (delete group, etc.) */
body[data-theme="signa"] .row-action-btn:hover {
    background: rgba(255, 92, 122, 0.18);
    color: #ff5c7a;
}

/* Select / dropdown highlight — override browser blue */
body[data-theme="signa"] select.field-input {
    accent-color: #7c5cff;
    color-scheme: dark;
}

body[data-theme="signa"] select.field-input option {
    background: #2d2d44;
    color: #e6e6f0;
}

body[data-theme="signa"] select.field-input option:checked,
body[data-theme="signa"] select.field-input option:hover {
    background: #7c5cff;
    color: #ffffff;
}

/* ---- Time range slider (booking form) ---- */
.time-widget-wrap {
    padding: 0.25rem 0;
}

.bk-time-slider {
    margin: 0.75rem 0.5rem 0.25rem;
    height: 10px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    box-shadow: none;
}

.bk-time-slider .noUi-connect {
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.bk-time-slider .noUi-handle {
    height: 20px;
    width: 20px;
    border-radius: 999px;
    background: #fff;
    border: 2px solid var(--brand);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
    cursor: grab;
    right: -10px;
    top: -6px;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.bk-time-slider .noUi-handle:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.30);
}

.bk-time-slider .noUi-handle.noUi-active {
    cursor: grabbing;
    transform: scale(1.12);
    box-shadow: 0 0 0 6px rgba(79, 70, 229, 0.18), 0 4px 12px rgba(79, 70, 229, 0.30);
}

.bk-time-slider .noUi-handle:before,
.bk-time-slider .noUi-handle:after {
    display: none;
}

body[data-theme="dark"] .bk-time-slider .noUi-handle {
    background: var(--card);
    border-color: #818cf8;
}

.time-display {
    margin-top: 0.35rem;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
}

/* ---- Time-range loupe (water-drop magnifier on hover/scroll) ---- */
.time-loupe {
    position: absolute;
    bottom: 100%;
    left: 50%;
    width: 64px;
    height: 80px;
    transform: translate(-50%, 4px) scale(0.55);
    transform-origin: 50% 100%;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 200ms ease,
        transform 320ms cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 5;
}

.bk-time-slider:hover .time-loupe,
.bk-time-slider.noui-dragging .time-loupe,
.bk-time-slider .noUi-handle.noUi-active .time-loupe,
.time-loupe.flashing {
    opacity: 1;
    transform: translate(-50%, -10px) scale(1);
}

.time-loupe-shape {
    position: absolute;
    inset: 0;
    filter: url(#time-range-goo);
}

.time-loupe-shape::before {
    /* the bubble / lens */
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 56px;
    height: 56px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%,
            rgba(255, 255, 255, 0.96) 0%,
            rgba(228, 229, 255, 0.78) 38%,
            rgba(99, 90, 234, 0.55) 100%);
    box-shadow:
        inset 0 4px 9px rgba(255, 255, 255, 0.85),
        inset 0 -5px 11px rgba(67, 56, 202, 0.32),
        inset 0 0 0 1px rgba(99, 90, 234, 0.18);
    transition: transform 220ms cubic-bezier(0.32, 0.72, 0, 1);
}

.time-loupe-shape::after {
    /* the tail droplet — close enough to the bubble that the goo filter fuses them */
    content: "";
    position: absolute;
    bottom: 6px;
    left: 50%;
    width: 14px;
    height: 14px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: rgba(160, 150, 250, 0.92);
    box-shadow:
        inset 0 -2px 4px rgba(67, 56, 202, 0.32),
        inset 0 2px 3px rgba(255, 255, 255, 0.55);
}

.time-loupe-readout {
    position: absolute;
    top: 0;
    left: 50%;
    width: 56px;
    height: 56px;
    transform: translateX(-50%);
    display: grid;
    place-items: center;
    color: var(--brand-2);
    font-weight: 800;
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
    pointer-events: none;
}

/* Pulse the bubble on each scroll-tick */
.time-loupe.flashing .time-loupe-shape::before {
    animation: loupe-pulse 320ms cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes loupe-pulse {
    0% {
        transform: translateX(-50%) scale(1);
    }

    35% {
        transform: translateX(-50%) scale(1.10);
    }

    100% {
        transform: translateX(-50%) scale(1);
    }
}

body[data-theme="dark"] .time-loupe-shape::before {
    background: radial-gradient(circle at 32% 28%,
            rgba(232, 232, 255, 0.94) 0%,
            rgba(167, 165, 236, 0.70) 42%,
            rgba(99, 90, 234, 0.65) 100%);
    box-shadow:
        inset 0 4px 9px rgba(232, 232, 255, 0.55),
        inset 0 -5px 11px rgba(45, 35, 140, 0.55),
        inset 0 0 0 1px rgba(167, 165, 236, 0.30);
}

body[data-theme="dark"] .time-loupe-readout {
    color: #1e1b4b;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* ---- Appbar ---- */
.appbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

body[data-theme="dark"] .appbar {
    background: rgba(43, 51, 69, 0.90);
}

.appbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1.25rem;
}

/* ---- Interpreter bookings bar (row 2) ---- */
.appbar-interp-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.35rem 1.25rem 0.45rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.02);
}

body[data-theme="dark"] .appbar-interp-row {
    background: rgba(255, 255, 255, 0.03);
}

/* Pill action buttons in the interpreter header bar */
.interp-bar-pill {
    padding: 0.18rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.interp-bar-pill:hover {
    background: var(--bg-2);
    border-color: rgba(79, 70, 229, 0.4);
}

.interp-bar-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-right: 0.25rem;
}

.interp-tab-group {
    display: flex;
    gap: 0.25rem;
}

.interp-tab {
    padding: 0.18rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.interp-tab:hover {
    background: var(--bg-2);
    border-color: rgba(79, 70, 229, 0.4);
}

.interp-tab.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.appbrand-title {
    font-weight: 900;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.appbrand-sub {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.05rem;
}

.appbar-right {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

/* Identity chip in appbar */
.appbar-identity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.45rem 0.2rem 0.25rem;
    margin-left: 0.35rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.appbar-identity:hover {
    border-color: rgba(79, 70, 229, 0.45);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

.identity-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.identity-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    min-width: 0;
    max-width: 140px;
}

.identity-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.identity-role {
    font-size: 0.66rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.identity-logout {
    flex-shrink: 0;
    padding: 0.2rem 0.45rem;
    font-size: 0.95rem;
    line-height: 1;
    color: var(--muted);
    border: none;
    background: transparent;
}

.identity-logout:hover {
    color: var(--bad);
    background: rgba(220, 38, 38, 0.08);
    transform: none;
    box-shadow: none;
}

@media (max-width: 720px) {
    .identity-meta {
        display: none;
    }
}

/* ---- Buttons ---- */
.btn {
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    border: none;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition:
        background 140ms ease,
        transform 140ms ease,
        box-shadow 140ms ease;
}

.btn:hover {
    background: var(--brand-2);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.35);
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
}

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--bg-2);
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

.btn-ghost:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-ghost:focus-visible {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

.btn-ghost.active {
    background: rgba(79, 70, 229, 0.10);
    border-color: rgba(79, 70, 229, 0.55);
}

body[data-theme="dark"] .btn-ghost.active {
    background: rgba(129, 140, 248, 0.12);
    border-color: rgba(129, 140, 248, 0.6);
}

.btn-danger {
    background: #fef2f2;
    color: var(--bad);
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
}

/* ---- Drawer overlay ---- */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(2px);
    z-index: 70;
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms ease;
}

body.drawer-open .drawer-overlay {
    opacity: 1;
    pointer-events: auto;
}

body.drawer-open {
    overflow: hidden;
}

/* ---- Drawer ---- */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(480px, calc(100vw - 2rem));
    background: var(--card);
    color: var(--ink);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: 75;
    transform: translateX(108%);
    transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.drawer.drawer-left {
    left: 0;
    right: auto;
    border-left: none;
    border-right: 1px solid var(--border);
    transform: translateX(-108%);
}

.drawer.open {
    transform: translateX(0);
}

.drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.drawer-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.015em;
}

.drawer-sub {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1.25rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.drawer-section {
    margin-bottom: 1.1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.drawer-section:last-child {
    border-bottom: none;
}

/* ---- Form fields ---- */
.panel-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.65rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    margin-bottom: 0.75rem;
}

.field-label {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--ink);
}

.field-input {
    width: 100%;
    padding: 0.42rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
    background: var(--bg-2);
    color: var(--ink);
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field-input:hover {
    border-color: #cbd5e1;
}

.field-input:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--card);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

body[data-theme="dark"] .field-input:focus {
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25);
}

textarea.field-input {
    resize: vertical;
}

.field-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.field-badge {
    display: inline-block;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--brand);
    min-width: 3rem;
    text-align: center;
}

.muted-text {
    color: var(--muted);
    font-weight: 400;
}

.req {
    color: var(--bad);
}

/* Availability preview inside form */
.avail-preview {
    margin-top: 0.6rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.avail-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px dashed var(--border);
}

.avail-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.avail-dot.free {
    background: #22c55e;
}

.avail-dot.busy {
    background: var(--bad);
}

.form-error {
    background: #fef2f2;
    color: var(--bad);
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

/* ---- Toast ---- */
.toast-root {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    min-width: 260px;
    max-width: 380px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 0.7rem 0.9rem;
    animation: toast-in 200ms ease;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast-title {
    font-weight: 700;
    font-size: 0.88rem;
}

.toast-msg {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

/* ---- KPI bar ---- */
.kpi-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.kpi-card {
    flex: 1 1 130px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.10);
    border-color: #cbd5e1;
}

body[data-theme="dark"] .kpi-card:hover {
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
    border-color: #5a6680;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.kpi-warn {
    color: var(--warn);
}

.kpi-good {
    color: var(--good);
}

.kpi-muted {
    color: var(--muted);
}

.kpi-brand {
    color: var(--brand);
}

/* ---- Week schedule strip ---- */
.week-strip {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    padding: 0.55rem 0.75rem 0.75rem;
    margin-bottom: 1.5rem;
}

.week-strip-nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

.week-strip-range {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink);
    flex: 1;
    text-align: center;
}

.week-nav-btn {
    padding: 0.1rem 0.55rem;
    font-size: 1rem;
    line-height: 1;
}

.week-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.4rem;
}

.week-day-col {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.week-day-head {
    text-align: center;
    padding: 0.2rem 0.25rem;
    border-radius: var(--radius);
    background: var(--bg-2);
}

.week-day-head.is-today {
    background: var(--brand);
    color: #fff;
}

.week-day-name {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.75;
}

.week-day-num {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.1;
}

.week-day-head.is-today .week-day-name,
.week-day-head.is-today .week-day-num {
    opacity: 1;
    color: #fff;
}

.week-bk-chip {
    display: flex;
    align-items: center;
    font-size: 0.68rem;
    line-height: 1.25;
    padding: 0.18rem 0.35rem;
    border-radius: 4px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--brand);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(79, 70, 229, 0.2);
    transition: background 120ms;
}

.week-chip-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.week-chip-icon {
    flex-shrink: 0;
    margin-left: 0.2rem;
    line-height: 1;
}

.week-bk-chip:hover {
    background: rgba(79, 70, 229, 0.2);
}

.week-bk-chip.status-confirmed {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.25);
}

.week-bk-chip.status-confirmed:hover {
    background: rgba(16, 185, 129, 0.2);
}

.week-bk-chip.status-completed {
    background: var(--bg-2);
    color: var(--muted);
    border-color: var(--border);
}

.week-bk-chip.status-cancelled {
    background: rgba(239, 68, 68, 0.07);
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.2);
    text-decoration: line-through;
    opacity: 0.6;
}

.week-bk-chip.status-pending,
.week-bk-chip.status-pending_assignment {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.25);
}

.week-bk-chip.status-pending:hover,
.week-bk-chip.status-pending_assignment:hover {
    background: rgba(245, 158, 11, 0.2);
}

/* Earning pills in interpreter Rate Service tab */
.earning-pill {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    padding: 0.3rem 0.55rem;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #065f46;
    font-size: 0.75rem;
    line-height: 1.3;
}

.earning-pill .ep-amount {
    font-weight: 700;
    font-size: 0.85rem;
}

.earning-pill .ep-label {
    color: #059669;
    font-size: 0.7rem;
}

.week-day-empty {
    font-size: 0.68rem;
    color: var(--muted);
    text-align: center;
    padding: 0.3rem 0;
    opacity: 0.5;
}

/* ---- Virtual meeting (booking form + detail) ---- */
.virtual-toggle-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    cursor: pointer;
}

.virtual-platform-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.platform-btn {
    padding: 0.2rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-2);
    color: var(--ink);
    cursor: pointer;
    transition: background 120ms, border-color 120ms;
}

.platform-btn:hover,
.platform-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.virtual-badge {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
}

.virtual-badge.virtual {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.virtual-badge.in-person {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

/* ---- Filter bar ---- */
.filter-bar {
    display: flex;
    gap: 0.65rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 110px;
}

.filter-label {
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
}

/* ---- Booking table ---- */
.table-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

table.booking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

table.booking-table thead th {
    padding: 0.55rem 0.75rem;
    text-align: left;
    background: var(--bg-2);
    font-size: 0.73rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

table.booking-table tbody td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    transition: background 140ms ease;
}

table.booking-table tbody tr {
    transition: box-shadow 140ms ease;
}

table.booking-table tbody tr:last-child td {
    border-bottom: none;
}

table.booking-table tbody tr:hover td {
    background: var(--bg-2);
}

table.booking-table tbody tr:hover {
    box-shadow: inset 3px 0 0 var(--brand);
}

/* Row tint: coverage at-a-glance — green = interpreter assigned, orange = unassigned */
table.booking-table tbody tr.row-assigned td {
    background: rgba(34, 197, 94, 0.08);
}

table.booking-table tbody tr.row-unassigned td {
    background: rgba(251, 146, 60, 0.10);
}

table.booking-table tbody tr.row-assigned:hover td {
    background: rgba(34, 197, 94, 0.15);
}

table.booking-table tbody tr.row-unassigned:hover td {
    background: rgba(251, 146, 60, 0.17);
}

table.booking-table tbody tr.row-assigned:hover {
    box-shadow: inset 3px 0 0 #16a34a;
}

table.booking-table tbody tr.row-unassigned:hover {
    box-shadow: inset 3px 0 0 #ea580c;
}

body[data-theme="dark"] table.booking-table tbody tr.row-assigned td {
    background: rgba(34, 197, 94, 0.14);
}

body[data-theme="dark"] table.booking-table tbody tr.row-unassigned td {
    background: rgba(251, 146, 60, 0.18);
}

body[data-theme="dark"] table.booking-table tbody tr.row-assigned:hover td {
    background: rgba(34, 197, 94, 0.22);
}

body[data-theme="dark"] table.booking-table tbody tr.row-unassigned:hover td {
    background: rgba(251, 146, 60, 0.26);
}

.empty-row {
    padding: 2rem 1rem !important;
    text-align: center;
    color: var(--muted);
    font-style: italic;
}

/* Status pill */
.status-pill {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.73rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-pill.pending {
    background: #fef3c7;
    color: var(--warn);
}

.status-pill.confirmed {
    background: #d1fae5;
    color: var(--good);
}

.status-pill.completed {
    background: #f1f5f9;
    color: var(--muted);
}

.status-pill.cancelled {
    background: #fef2f2;
    color: var(--bad);
}

.status-pill::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
    background: currentColor;
}

.status-pill.pending::before {
    animation: pulse-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.55;
        transform: scale(0.78);
    }
}

/* Row action buttons */
.row-action-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    color: var(--muted);
    font-weight: 700;
}

.row-action-btn:hover {
    background: var(--bg-2);
    color: var(--ink);
}

.row-accept-btn {
    background: rgba(34, 197, 94, 0.12);
    color: var(--good, #22c55e);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.row-accept-btn:hover {
    background: rgba(34, 197, 94, 0.22);
    color: var(--good, #22c55e);
}

.row-accept-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ---- Availability widget ---- */
/* ---- Inline booking detail panel (slides down below table) ---- */
.bk-detail-panel {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 280ms cubic-bezier(0.4, 0, 0.2, 1),
        opacity 220ms ease;
    margin-bottom: 0.75rem;
}

.bk-detail-panel.bk-detail-open {
    max-height: 480px;
    opacity: 1;
}

.bk-detail-inner {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius, 10px);
    padding: 1rem 1.25rem;
    margin-top: 0.25rem;
}

.bk-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.bk-detail-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ink);
}

.bk-detail-title code {
    font-size: 0.8rem;
    color: var(--brand);
    background: rgba(79, 70, 229, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.bk-detail-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Highlight the selected row */
#booking-tbody tr.bk-row-active td {
    background: rgba(79, 70, 229, 0.08);
}

body[data-theme="signa"] .bk-detail-title code {
    background: rgba(124, 92, 255, 0.15);
    color: #7c5cff;
}

body[data-theme="signa"] #booking-tbody tr.bk-row-active td {
    background: rgba(124, 92, 255, 0.1);
}

.avail-widget {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
}

.avail-controls {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.avail-controls .field-group {
    min-width: 120px;
    flex: 1 1 120px;
}

.avail-results {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.avail-card {
    flex: 1 1 200px;
    max-width: 280px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.avail-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.avail-card.free {
    border-left: 4px solid #22c55e;
}

.avail-card.busy {
    border-left: 4px solid var(--bad);
    opacity: 0.65;
}

.avail-card-name {
    font-weight: 800;
    font-size: 0.9rem;
}

.avail-card-langs {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.12rem;
}

.avail-card-rate {
    font-size: 0.78rem;
    margin-top: 0.3rem;
    font-weight: 700;
    color: var(--brand);
}

.avail-card-certs {
    font-size: 0.73rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

/* ---- Interpreter cards in drawer ---- */
.interp-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.75rem;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.interp-card:hover {
    transform: translateY(-1px);
    border-color: rgba(79, 70, 229, 0.45);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
}

.interp-card-name {
    font-weight: 800;
    font-size: 0.95rem;
}

.interp-card-bio {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

.interp-card-langs {
    margin-top: 0.4rem;
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.lang-chip {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    background: rgba(79, 70, 229, 0.1);
    color: var(--brand);
    border: 1px solid rgba(79, 70, 229, 0.25);
}

.cert-chip {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: #d1fae5;
    color: #166534;
    border: 1px solid #a7f3d0;
}

.interp-card-avail {
    margin-top: 0.55rem;
    font-size: 0.75rem;
    color: var(--muted);
}

/* ---- Server snapshot panel ---- */
.server-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.3rem;
}

.server-row input {
    flex: 1 1 auto;
}

/* ---- Meta footnote ---- */
.meta-footnote {
    font-size: 0.78rem;
    color: var(--muted);
}

/* ---- Loading ---- */
.loading-pill {
    padding: 1.5rem;
    text-align: center;
    color: var(--muted);
    font-style: italic;
}

/* ---- Main layout ---- */
.main-content {
    max-width: 1360px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

/* ---- Dark mode overrides for status pills ---- */
body[data-theme="dark"] .status-pill.pending {
    background: rgba(180, 83, 9, 0.18);
}

body[data-theme="dark"] .status-pill.confirmed {
    background: rgba(22, 101, 52, 0.18);
}

body[data-theme="dark"] .status-pill.completed {
    background: rgba(71, 85, 105, 0.25);
}

body[data-theme="dark"] .status-pill.cancelled {
    background: rgba(220, 38, 38, 0.18);
}

body[data-theme="dark"] .avail-card.free {
    border-left-color: #16a34a;
}

body[data-theme="dark"] .lang-chip {
    background: rgba(129, 140, 248, 0.12);
    border-color: rgba(129, 140, 248, 0.3);
}

body[data-theme="dark"] .cert-chip {
    background: rgba(22, 101, 52, 0.2);
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.25);
}

body[data-theme="dark"] .btn-danger {
    background: rgba(220, 38, 38, 0.14);
    border-color: rgba(220, 38, 38, 0.35);
}

/* ---- Users & Groups drawer ---- */

.users-filterbar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.role-pills {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Dynamic group filter pills — same look as role pills but tinted */
.group-filter-pills {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    padding-top: 0.15rem;
    border-top: 1px dashed var(--border);
    margin-top: 0.1rem;
}

.group-filter-pill {
    font-size: 0.74rem !important;
    padding: 0.2rem 0.6rem !important;
}

.group-filter-pill .group-pill-count {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    background: rgba(79, 70, 229, 0.12);
    color: var(--brand);
    border-radius: 999px;
    padding: 0 0.35rem;
    margin-left: 0.25rem;
}

.group-filter-pill.active .group-pill-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

body[data-theme="signa"] .group-filter-pill .group-pill-count {
    background: rgba(124, 92, 255, 0.18);
    color: #7c5cff;
}

.role-pill {
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--ink);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.role-pill:hover {
    transform: translateY(-1px);
}

.role-pill.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.users-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

/* New-user / new-group forms */
.users-new-form,
.groups-new-form {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 0.95rem;
    margin-bottom: 0.85rem;
    animation: rise-in 220ms cubic-bezier(0.32, 0.72, 0, 1);
}

.role-toggles {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0.55rem 0 0.65rem;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--ink);
    cursor: pointer;
}

.check-row input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--brand);
}

.nu-interpreter-fields {
    margin-bottom: 0.55rem;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--border);
}

/* Group chip picker (in new-user form) */
.groups-chip-picker {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    padding: 0.35rem 0;
}

.group-pick-chip {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 140ms ease;
}

.group-pick-chip:hover {
    color: var(--ink);
    border-color: #cbd5e1;
}

.group-pick-chip.on {
    background: rgba(79, 70, 229, 0.12);
    color: var(--brand);
    border-color: rgba(79, 70, 229, 0.55);
}

/* User card */
.user-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.6rem;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, opacity 200ms ease;
}

.user-card:hover {
    transform: translateY(-1px);
    border-color: rgba(79, 70, 229, 0.45);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
}

.user-card-inactive {
    opacity: 0.55;
}

.user-card-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.user-avatar {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.user-card-ident {
    flex: 1;
    min-width: 0;
}

.user-card-name {
    font-weight: 800;
    font-size: 0.92rem;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-card-username {
    font-weight: 500;
    color: var(--muted);
    font-size: 0.78rem;
}

.user-card-email {
    font-size: 0.76rem;
    color: var(--muted);
    margin-top: 0.1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-card-tags {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.user-card-meta {
    margin-top: 0.45rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.user-card-meta strong {
    color: var(--brand);
    font-weight: 700;
}

/* Role chips */
.role-chip {
    display: inline-block;
    padding: 0.13rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    border: 1px solid transparent;
}

.role-chip.role-interpreter {
    background: rgba(79, 70, 229, 0.12);
    color: var(--brand);
    border-color: rgba(79, 70, 229, 0.30);
}

.role-chip.role-staff {
    background: rgba(180, 83, 9, 0.13);
    color: var(--warn);
    border-color: rgba(180, 83, 9, 0.32);
}

.role-chip.role-super {
    background: rgba(220, 38, 38, 0.10);
    color: var(--bad);
    border-color: rgba(220, 38, 38, 0.30);
}

.role-chip.role-client {
    background: var(--bg-2);
    color: var(--muted);
    border-color: var(--border);
}

/* Group chips (read-only display in user cards / groups list) */
.group-chip {
    display: inline-block;
    padding: 0.13rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.10);
    color: #166534;
    border: 1px solid rgba(34, 197, 94, 0.30);
}

body[data-theme="dark"] .group-chip {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.35);
}

/* Active toggle switch */
.active-switch {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
}

.active-switch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.active-switch-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    transition: background 180ms ease;
}

.active-switch-slider::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
    transition: transform 180ms cubic-bezier(0.32, 0.72, 0, 1);
}

.active-switch input:checked+.active-switch-slider {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.active-switch input:checked+.active-switch-slider::before {
    transform: translateX(16px);
}

.active-switch input:focus-visible+.active-switch-slider {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.30);
}

/* Badge shown on the current user's own card instead of the toggle */
.active-switch-self {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--brand);
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid rgba(79, 70, 229, 0.25);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    flex-shrink: 0;
    cursor: default;
    user-select: none;
}

body[data-theme="signa"] .active-switch-self {
    color: #7c5cff;
    background: rgba(124, 92, 255, 0.12);
    border-color: rgba(124, 92, 255, 0.3);
}

/* Auth-token UI: form input + Generate button, and the read-only row on user cards */
.pwd-with-gen {
    display: flex;
    gap: 0.4rem;
    align-items: stretch;
}

.pwd-with-gen .field-input {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.78rem;
    letter-spacing: -0.01em;
}

.pwd-with-gen .btn-small {
    flex-shrink: 0;
    white-space: nowrap;
    align-self: stretch;
}

.token-row {
    margin-top: 0.55rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.74rem;
}

.token-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
    font-size: 0.62rem;
    color: var(--muted);
    flex-shrink: 0;
}

.token-mono {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.74rem;
    background: var(--bg-2);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.18rem 0.45rem;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    cursor: text;
    user-select: all;
    transition: background 140ms ease;
}

.token-mono.revealed {
    background: rgba(79, 70, 229, 0.08);
    border-color: rgba(79, 70, 229, 0.30);
    color: var(--brand-2);
}

body[data-theme="dark"] .token-mono.revealed {
    background: rgba(129, 140, 248, 0.14);
    color: #c7d2fe;
    border-color: rgba(129, 140, 248, 0.35);
}

.token-action {
    flex-shrink: 0;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0.18rem 0.4rem;
}

.token-rotate {
    color: var(--warn);
}

.token-rotate:hover {
    background: rgba(180, 83, 9, 0.10);
    color: var(--warn);
}

/* Groups list (in groups section) */
.groups-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.group-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.55rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 150ms, background 150ms;
}

.group-row:hover {
    border-color: var(--brand);
    background: rgba(79, 70, 229, 0.06);
}

.group-row.group-row-active {
    border-color: var(--brand);
    background: rgba(79, 70, 229, 0.12);
}

body[data-theme="signa"] .group-row:hover,
body[data-theme="signa"] .group-row.group-row-active {
    border-color: #7c5cff;
    background: rgba(124, 92, 255, 0.14);
}

.group-row-count {
    flex: 1;
    font-size: 0.76rem;
    color: var(--muted);
}

/* ---- Loading: skeleton shimmer ---- */
.loading-pill {
    position: relative;
    overflow: hidden;
}

.loading-pill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(79, 70, 229, 0.07) 50%,
            transparent 100%);
    transform: translateX(-100%);
    animation: shimmer 1.6s ease-in-out infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* ---- Page entrance: KPI cards stagger in ---- */
.kpi-card {
    animation: rise-in 360ms cubic-bezier(0.32, 0.72, 0, 1) backwards;
}

.kpi-bar .kpi-card:nth-child(1) {
    animation-delay: 0ms;
}

.kpi-bar .kpi-card:nth-child(2) {
    animation-delay: 50ms;
}

.kpi-bar .kpi-card:nth-child(3) {
    animation-delay: 100ms;
}

.kpi-bar .kpi-card:nth-child(4) {
    animation-delay: 150ms;
}

.kpi-bar .kpi-card:nth-child(5) {
    animation-delay: 200ms;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   Login page (/login/)
   ========================================================= */

body.login-page {
    background:
        radial-gradient(circle at 20% 0%, rgba(99, 90, 234, 0.18) 0%, transparent 45%),
        radial-gradient(circle at 80% 100%, rgba(34, 197, 94, 0.12) 0%, transparent 50%),
        var(--bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
}

.login-main {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
}

.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 2rem 1.75rem;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.10);
    animation: rise-in 380ms cubic-bezier(0.32, 0.72, 0, 1);
}

body[data-theme="dark"] .login-card {
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.40);
}

.login-brand {
    text-align: center;
    margin-bottom: 1.6rem;
}

.login-brand-mark {
    font-size: 2.2rem;
    line-height: 1;
    margin-bottom: 0.35rem;
}

.login-brand-title {
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.login-brand-sub {
    font-size: 0.86rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

/* Screen transitions */
.login-screen {
    animation: rise-in 280ms cubic-bezier(0.32, 0.72, 0, 1);
}

.login-screen-head {
    margin-bottom: 1rem;
}

.login-screen-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.015em;
}

.login-screen-sub {
    font-size: 0.84rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.field-hint {
    font-size: 0.74rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

.field-hint code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    background: var(--bg-2);
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
    font-size: 0.78rem;
}

.login-phone-input {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 1rem;
    letter-spacing: 0.04em;
    padding: 0.6rem 0.75rem;
}

.login-submit-btn {
    width: 100%;
    padding: 0.7rem 1.1rem;
    font-size: 0.95rem;
    margin-top: 0.25rem;
    position: relative;
}

.login-submit-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.login-submit-spinner {
    letter-spacing: 0.4em;
    font-weight: 900;
    animation: dotty 900ms linear infinite;
}

@keyframes dotty {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.login-link {
    border: none;
    background: transparent;
    color: var(--brand);
    font-weight: 700;
    font-size: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.login-link:disabled {
    color: var(--muted);
    cursor: not-allowed;
    text-decoration: none;
}

.login-link:hover:not(:disabled) {
    color: var(--brand-2);
}

/* OTP input row */
.otp-inputs {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.45rem;
    margin: 0.25rem 0 0.5rem;
}

.otp-digit {
    width: 100%;
    aspect-ratio: 1 / 1;
    text-align: center;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--bg-2);
    color: var(--ink);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease, transform 140ms ease;
    caret-color: var(--brand);
}

.otp-digit:focus {
    outline: none;
    background: var(--card);
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.20);
    transform: translateY(-1px);
}

body[data-theme="dark"] .otp-digit:focus {
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.30);
}

/* Filled state — soft brand tint so the user can scan visually */
.otp-digit:not(:placeholder-shown):not(:focus) {
    background: rgba(79, 70, 229, 0.06);
    border-color: rgba(79, 70, 229, 0.45);
}

/* Resend row */
.login-resend {
    margin-top: 0.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.login-resend strong {
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

/* Done screen */
.login-done {
    text-align: center;
    padding: 1.5rem 0 0.5rem;
}

.login-done-mark {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 0 auto 0.75rem;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.7rem;
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(22, 197, 94, 0.30);
    animation: done-pop 380ms cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes done-pop {
    0% {
        opacity: 0;
        transform: scale(0.4);
    }

    60% {
        opacity: 1;
        transform: scale(1.08);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.login-foot {
    text-align: center;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.login-foot-link {
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
}

.login-foot-link:hover {
    text-decoration: underline;
}

/* ---- Reduced motion: respect user preference ---- */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0ms !important;
    }

    .drawer {
        transition: none;
    }

    .drawer-overlay {
        transition: none;
    }

    .status-pill.pending::before {
        animation: none;
    }

    .loading-pill::after {
        animation: none;
        display: none;
    }
}

/* =========================================================
   Profile drawer
   ========================================================= */

/* Identity chip: make it feel interactive */
#profile-drawer-toggle {
    cursor: pointer;
}

#profile-drawer-toggle:focus-visible {
    outline: 2px solid rgba(79, 70, 229, 0.55);
    outline-offset: 2px;
}

/* Large avatar in profile hero */
.profile-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.25rem 0 1rem;
}

.profile-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    font-weight: 900;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.30);
}

.profile-hero-meta {
    min-width: 0;
}

.profile-hero-name {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--ink);
}

.profile-hero-role {
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand);
    margin-top: 0.1rem;
}

.profile-hero-joined {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

/* Tab bar */
.profile-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
}

.profile-tab-btn {
    padding: 0.45rem 0.85rem;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 140ms ease, border-color 140ms ease;
}

.profile-tab-btn:hover {
    color: var(--ink);
}

.profile-tab-btn.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

/* Booking mini-list in profile */
.profile-bk-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-bk-item {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font-size: 0.83rem;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.profile-bk-item:hover {
    border-color: rgba(79, 70, 229, 0.35);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.profile-bk-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.profile-bk-item-name {
    font-weight: 700;
}

.profile-bk-item-meta {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

/* Availability slot list in profile */
.avail-slot-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.avail-slot-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.45rem 0.7rem;
    font-size: 0.82rem;
    transition: border-color 140ms ease;
}

.avail-slot-row:not(.is-booked):hover {
    border-color: rgba(79, 70, 229, 0.35);
}

.avail-slot-row.is-booked {
    opacity: 0.65;
}

.avail-slot-date {
    font-weight: 700;
    flex: 0 0 90px;
    font-variant-numeric: tabular-nums;
}

.avail-slot-time {
    font-variant-numeric: tabular-nums;
    color: var(--brand);
    font-weight: 700;
    flex: 1;
}

.avail-slot-del {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    border-radius: 5px;
    flex-shrink: 0;
    transition: background 140ms ease, color 140ms ease;
}

.avail-slot-del:hover {
    background: #fef2f2;
    color: var(--bad);
}

.avail-slot-del[disabled] {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

body[data-theme="dark"] .avail-slot-del:hover {
    background: rgba(220, 38, 38, 0.15);
}