/* =========================================================================
   PayProof Experience Layer — live, focused, operational
   ========================================================================= */

:root {
    --brand-400: #6480f4;
    --brand-500: #3659e3;
    --brand-600: #2947c8;
    --brand-700: #2039a8;
    --brand-accent: #20b8a6;
    --brand-gradient: linear-gradient(135deg, #496cf0 0%, #3659e3 58%, #20a9a0 100%);

    --bg: #f4f7fb;
    --bg-subtle: #f8faff;
    --surface: #ffffff;
    --surface-2: #f6f8fc;
    --surface-raised: #ffffff;
    --text: #111827;
    --text-secondary: #465269;
    --text-muted: #77839a;
    --border: #e3e8f1;
    --border-strong: #d1d9e6;
    --ring: rgba(54, 89, 227, 0.19);

    --sidebar-bg: linear-gradient(180deg, #101c32 0%, #0a1324 52%, #08101e 100%);
    --sidebar-text: #a9b6ca;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.065);
    --sidebar-active: linear-gradient(135deg, rgba(69, 107, 237, 0.32), rgba(39, 184, 166, 0.13));
    --sidebar-border: rgba(255, 255, 255, 0.075);

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.035);
    --shadow-sm: 0 5px 16px rgba(27, 42, 77, 0.055);
    --shadow-md: 0 12px 32px rgba(27, 42, 77, 0.075);
    --shadow-lg: 0 24px 64px rgba(15, 23, 42, 0.16);
    --shadow-brand: 0 8px 20px rgba(54, 89, 227, 0.22);

    --radius-xs: 7px;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --sidebar-width: 286px;
    --sidebar-collapsed-width: 82px;
    --topbar-height: 76px;
}

[data-theme="dark"] {
    --bg: #080e19;
    --bg-subtle: #0b1220;
    --surface: #101a2a;
    --surface-2: #152136;
    --surface-raised: #172338;
    --text: #edf2fb;
    --text-secondary: #b9c5d8;
    --text-muted: #8797b1;
    --border: #22314a;
    --border-strong: #32435f;
    --ring: rgba(100, 128, 244, 0.28);
    --sidebar-bg: linear-gradient(180deg, #0b1425 0%, #070d18 100%);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 8px 22px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 16px 36px rgba(0, 0, 0, 0.34);
    --shadow-lg: 0 28px 72px rgba(0, 0, 0, 0.52);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6,
.brand-name,
.topbar-context strong,
.stat-card .display-6,
.verification-metric-value,
.archive-summary-card strong {
    font-family: 'Manrope', 'Inter', sans-serif;
}

.app-body {
    background:
        radial-gradient(circle at 82% -10%, rgba(86, 116, 237, 0.075), transparent 28rem),
        var(--bg);
}

.theme-transitioning,
.theme-transitioning * {
    transition: background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease !important;
}

/* ============================ Application shell ============================ */

#wrapper { min-height: 100dvh; }

#sidebar-wrapper {
    overflow: visible;
    box-shadow: 12px 0 34px rgba(4, 11, 24, 0.12);
}

.sidebar-heading {
    min-height: var(--topbar-height);
    padding: 0.95rem 3.25rem 0.95rem 1.05rem;
    background: rgba(255, 255, 255, 0.018);
}

.sidebar-heading .brand-lockup { min-width: 0; }
.sidebar-heading .brand-mark {
    filter: drop-shadow(0 8px 18px rgba(67, 92, 222, 0.32));
}
.sidebar-heading .brand-name { font-size: 1.08rem; letter-spacing: -0.035em; }
.sidebar-heading .brand-tagline {
    color: rgba(213, 222, 238, 0.48);
    font-size: 0.61rem;
    letter-spacing: 0.095em;
}

.sidebar-collapse-btn {
    right: -14px;
    width: 28px;
    height: 28px;
    background: #ffffff;
    color: #526079;
    border: 1px solid #dfe5ef;
    box-shadow: 0 5px 14px rgba(8, 16, 30, 0.18);
    z-index: 4;
}
.sidebar-collapse-btn:hover {
    background: #f7f9fc;
    color: var(--brand-500);
    transform: translateY(-50%) scale(1.04);
}
[data-theme="dark"] .sidebar-collapse-btn {
    background: #172338;
    border-color: #2d3b54;
    color: #c8d2e2;
}

.sidebar-workspace-card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0.85rem 0.8rem 0.55rem;
    padding: 0.72rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.038);
    color: #fff;
}
.sidebar-workspace-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #b9c8ff;
    background: linear-gradient(145deg, rgba(95, 125, 242, 0.22), rgba(32, 184, 166, 0.13));
    border: 1px solid rgba(143, 164, 244, 0.16);
}
.sidebar-workspace-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.sidebar-workspace-copy small {
    color: rgba(200, 211, 228, 0.52);
    font-size: 0.61rem;
    font-weight: 650;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}
.sidebar-workspace-copy strong {
    overflow: hidden;
    color: #eff4ff;
    font-size: 0.79rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-workspace-state {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #31d5a4;
    box-shadow: 0 0 0 4px rgba(49, 213, 164, 0.1);
}

.sidebar-search-wrap {
    position: relative;
    margin: 0.35rem 0.8rem 0.6rem;
}
.sidebar-search-wrap > i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #7f90ab;
    font-size: 0.84rem;
    pointer-events: none;
}
.sidebar-search-wrap input {
    width: 100%;
    height: 38px;
    padding: 0 2.65rem 0 2.1rem;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 10px;
    outline: 0;
    background: rgba(0, 0, 0, 0.15);
    color: #eaf0fa;
    font-size: 0.78rem;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.sidebar-search-wrap input::placeholder { color: #73849f; }
.sidebar-search-wrap input:focus {
    border-color: rgba(101, 128, 241, 0.48);
    background: rgba(0, 0, 0, 0.24);
    box-shadow: 0 0 0 3px rgba(81, 109, 228, 0.12);
}
.sidebar-search-wrap kbd {
    position: absolute;
    right: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.16rem 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.055);
    color: #7889a5;
    font-family: inherit;
    font-size: 0.57rem;
    font-weight: 600;
    box-shadow: none;
}

.sidebar-nav-scroll {
    min-height: 0;
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}
.sidebar-nav-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-nav-scroll::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(255, 255, 255, 0.1); }

#sidebar-wrapper .list-group {
    padding: 0 0.68rem 0.75rem;
    gap: 0.17rem;
}
#sidebar-wrapper .sidebar-section-label {
    padding: 0.78rem 1.02rem 0.32rem;
    color: rgba(199, 211, 228, 0.36);
    font-size: 0.59rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

#sidebar-wrapper .list-group-item,
.nav-group-toggle {
    min-height: 44px;
    gap: 0.7rem;
    padding: 0.42rem 0.55rem;
    border-radius: 11px;
    font-size: 0.825rem;
    font-weight: 550;
}

.nav-main-icon,
.nav-group-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #9bacbf;
    background: transparent;
    transition: all 0.18s ease;
}
.nav-main-icon i,
.nav-group-icon i { width: auto !important; font-size: 0.95rem !important; }

#sidebar-wrapper .list-group-item:hover .nav-main-icon,
.nav-group-toggle:hover .nav-group-icon {
    color: #dfe8f7;
    background: rgba(255, 255, 255, 0.06);
}
#sidebar-wrapper .list-group-item.active,
.nav-group.is-active > .nav-group-toggle {
    background: var(--sidebar-active);
    box-shadow: inset 0 0 0 1px rgba(112, 139, 241, 0.11);
}
#sidebar-wrapper .list-group-item.active { box-shadow: inset 3px 0 0 #5c7bf0, inset 0 0 0 1px rgba(112, 139, 241, 0.11); }
#sidebar-wrapper .list-group-item.active .nav-main-icon,
.nav-group.is-active > .nav-group-toggle .nav-group-icon {
    color: #ffffff;
    background: linear-gradient(145deg, rgba(93, 124, 240, 0.42), rgba(60, 93, 218, 0.24));
    border-color: rgba(151, 170, 244, 0.16);
}

.nav-main-arrow,
.nav-sub-arrow {
    margin-left: auto;
    color: rgba(191, 204, 222, 0.28);
    font-size: 0.66rem !important;
    transition: transform 0.18s ease, color 0.18s ease;
}
#sidebar-wrapper .list-group-item:hover .nav-main-arrow,
.nav-sub-item:hover .nav-sub-arrow { color: rgba(255, 255, 255, 0.64); transform: translateX(2px); }
.nav-main-current,
.nav-group-current {
    width: 6px;
    height: 6px;
    margin-left: auto;
    border-radius: 50%;
    background: #60e4ce;
    box-shadow: 0 0 0 4px rgba(96, 228, 206, 0.09);
}
#sidebar-wrapper .list-group-item:not(.active) .nav-main-current { display: none; }
#sidebar-wrapper .list-group-item.active .nav-main-arrow,
.nav-group.is-active .nav-group-chevron { display: none; }

.nav-group-chevron {
    margin-left: auto;
    font-size: 0.64rem;
    color: rgba(194, 205, 222, 0.42);
}

.nav-group-items {
    gap: 0.08rem;
    margin: 0.18rem 0 0.42rem;
    padding-left: 0.62rem;
}
.nav-group-items::before {
    left: 1.6rem;
    top: 0.25rem;
    bottom: 0.25rem;
    background: rgba(255, 255, 255, 0.065);
}
.nav-sub-item {
    min-height: 37px;
    margin-left: 0.48rem;
    padding: 0.31rem 0.5rem 0.31rem 0.58rem;
    border-radius: 9px;
    color: #91a2ba;
    font-size: 0.78rem;
}
.nav-sub-icon {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: #788da9;
}
.nav-sub-icon i { font-size: 0.79rem; }
.nav-sub-item:hover .nav-sub-icon { color: #cbd7e9; background: rgba(255, 255, 255, 0.045); }
.nav-sub-item.active {
    background: rgba(75, 106, 222, 0.18);
    color: #ffffff;
    font-weight: 600;
}
.nav-sub-item.active .nav-sub-icon { color: #83e3d4; }
.nav-sub-item.active .nav-sub-arrow { color: #65caba; }
.nav-sub-badge { margin-left: auto; }

.nav-filter-hidden { display: none !important; }
.sidebar-nav-empty {
    margin: 1rem;
    padding: 1rem;
    border: 1px dashed rgba(255, 255, 255, 0.11);
    border-radius: 11px;
    color: #71819a;
    text-align: center;
    font-size: 0.76rem;
}
.sidebar-nav-empty i { display: block; margin-bottom: 0.35rem; font-size: 1rem; }

.sidebar-footer {
    flex: 0 0 auto;
    padding: 0.7rem 0.72rem 0.78rem;
    border-top: 1px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.075);
}
.sidebar-live-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.68rem;
    padding: 0.65rem 0.68rem;
    border: 1px solid rgba(66, 213, 172, 0.12);
    border-radius: 11px;
    background: rgba(34, 197, 139, 0.055);
    color: #dce7f5;
    text-align: left;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.sidebar-live-card:hover {
    background: rgba(34, 197, 139, 0.09);
    border-color: rgba(66, 213, 172, 0.2);
    transform: translateY(-1px);
}
.live-status-orbit {
    position: relative;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(43, 211, 162, 0.08);
}
.live-status-dot,
.live-mini-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1);
}
.live-status-orbit::after {
    content: '';
    position: absolute;
    width: 13px;
    height: 13px;
    border: 1px solid rgba(52, 211, 153, 0.45);
    border-radius: 50%;
    animation: liveOrbit 1.8s ease-out infinite;
}
@keyframes liveOrbit {
    0% { transform: scale(0.5); opacity: 0.9; }
    100% { transform: scale(1.7); opacity: 0; }
}
.sidebar-live-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.sidebar-live-copy strong { color: #e7f7f3; font-size: 0.73rem; font-weight: 650; }
.sidebar-live-copy small {
    overflow: hidden;
    color: #739489;
    font-size: 0.61rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-live-action { color: #6f8b83; font-size: 0.72rem; }
.sidebar-live-card[data-live-state="syncing"] .live-status-dot,
.live-refresh-button[data-live-state="syncing"] .live-mini-dot { background: #60a5fa; box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.1); }
.sidebar-live-card[data-live-state="offline"] .live-status-dot,
.sidebar-live-card[data-live-state="error"] .live-status-dot,
.live-refresh-button[data-live-state="offline"] .live-mini-dot,
.live-refresh-button[data-live-state="error"] .live-mini-dot { background: #f87171; box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.1); }
.sidebar-live-card[data-live-state="paused"] .live-status-dot,
.live-refresh-button[data-live-state="paused"] .live-mini-dot { background: #94a3b8; box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.1); }
.sidebar-live-card[data-live-state="paused"] .live-status-orbit::after,
.sidebar-live-card[data-live-state="offline"] .live-status-orbit::after,
.sidebar-live-card[data-live-state="error"] .live-status-orbit::after { display: none; }

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0.66rem;
    margin-top: 0.55rem;
    padding: 0.48rem 0.46rem;
    border-radius: 11px;
}
.sidebar-user-card .avatar-circle {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    font-size: 0.75rem;
}
.sidebar-user-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.sidebar-user-copy strong {
    overflow: hidden;
    color: #edf2fa;
    font-size: 0.75rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-user-copy small { color: #72839d; font-size: 0.63rem; }
.sidebar-user-action {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #7f90a9;
}
.sidebar-user-action:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }

/* Compact rail still remains useful instead of becoming a stack of mystery text. */
#wrapper.sidebar-collapsed .sidebar-heading { padding-inline: 0.7rem; }
#wrapper.sidebar-collapsed .sidebar-heading .brand-lockup { justify-content: center; width: 100%; }
#wrapper.sidebar-collapsed .sidebar-collapse-btn {
    display: inline-flex !important;
    position: absolute;
    right: -14px;
    transform: translateY(-50%);
}
#wrapper.sidebar-collapsed .sidebar-workspace-card,
#wrapper.sidebar-collapsed .sidebar-search-wrap,
#wrapper.sidebar-collapsed .sidebar-section-label,
#wrapper.sidebar-collapsed .sidebar-user-copy,
#wrapper.sidebar-collapsed .sidebar-user-action,
#wrapper.sidebar-collapsed .sidebar-live-copy,
#wrapper.sidebar-collapsed .sidebar-live-action,
#wrapper.sidebar-collapsed .nav-main-arrow,
#wrapper.sidebar-collapsed .nav-main-current,
#wrapper.sidebar-collapsed .nav-group-current { display: none !important; }
#wrapper.sidebar-collapsed #sidebar-wrapper .list-group { padding-inline: 0.62rem; }
#wrapper.sidebar-collapsed #sidebar-wrapper .list-group-item,
#wrapper.sidebar-collapsed .nav-group-toggle { justify-content: center; padding: 0.42rem; }
#wrapper.sidebar-collapsed .nav-main-icon,
#wrapper.sidebar-collapsed .nav-group-icon { margin: 0; }
#wrapper.sidebar-collapsed .sidebar-footer { padding-inline: 0.72rem; }
#wrapper.sidebar-collapsed .sidebar-live-card,
#wrapper.sidebar-collapsed .sidebar-user-card { justify-content: center; padding-inline: 0.35rem; }

.sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 1035;
    display: none;
    border: 0;
    background: rgba(5, 10, 20, 0.52);
    backdrop-filter: blur(2px);
}

/* ================================ Top bar ================================= */

.topbar {
    min-height: var(--topbar-height);
    padding: 0.65rem 1.7rem;
    gap: 1rem;
    background: color-mix(in srgb, var(--surface) 91%, transparent);
    box-shadow: 0 1px 0 var(--border), 0 7px 22px rgba(31, 46, 77, 0.025);
}

.topbar-context {
    min-width: 140px;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.topbar-kicker {
    color: var(--text-muted);
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.085em;
    text-transform: uppercase;
}
.topbar-context strong { color: var(--text); font-size: 0.9rem; font-weight: 750; }

.topbar-search-trigger {
    width: min(360px, 32vw);
    height: 42px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-left: clamp(0rem, 2vw, 2.2rem);
    padding: 0 0.75rem;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: left;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.topbar-search-trigger:hover {
    border-color: var(--border-strong);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}
.topbar-search-trigger span { flex: 1; }
.topbar-search-trigger kbd {
    padding: 0.18rem 0.42rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.61rem;
    font-weight: 650;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
}

.topbar-actions { display: flex; align-items: center; gap: 0.55rem; }
.topbar-date {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding-right: 0.8rem;
    margin-right: 0.15rem;
    border-right: 1px solid var(--border);
}
.topbar-date-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--brand-500);
    background: rgba(54, 89, 227, 0.09);
}
.topbar-date > span:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-date small { color: var(--text-muted); font-size: 0.57rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.07em; }
.topbar-date strong { color: var(--text-secondary); font-size: 0.69rem; font-weight: 650; font-variant-numeric: tabular-nums; }

.live-refresh-button {
    height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 0.65rem;
    border: 1px solid rgba(32, 184, 166, 0.18);
    border-radius: 10px;
    background: rgba(32, 184, 166, 0.075);
    color: #078a7d;
    font-size: 0.69rem;
    font-weight: 700;
}
[data-theme="dark"] .live-refresh-button { color: #6ee7d7; }
.live-refresh-button:hover { background: rgba(32, 184, 166, 0.12); }
.live-refresh-button > i { font-size: 0.78rem; }
.live-refresh-button.is-syncing > i { animation: rotateLive 0.85s linear infinite; }
@keyframes rotateLive { to { transform: rotate(360deg); } }
.live-mini-dot { width: 6px; height: 6px; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1); }

.icon-btn { width: 38px; height: 38px; border-radius: 10px; }
.user-dropdown .dropdown-toggle { padding: 0.25rem 0.45rem 0.25rem 0.28rem; border-radius: 11px; }
.user-dropdown-copy { min-width: 0; flex-direction: column; line-height: 1.18; text-align: left; }
.user-dropdown-copy strong { max-width: 120px; overflow: hidden; color: var(--text); font-size: 0.72rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown-copy small { color: var(--text-muted); font-size: 0.59rem; }
.dropdown-account-summary { display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.65rem; }
.dropdown-account-summary > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.dropdown-account-summary strong { font-size: 0.8rem; }
.dropdown-account-summary small { max-width: 210px; overflow: hidden; color: var(--text-muted); font-size: 0.68rem; text-overflow: ellipsis; }

main {
    width: 100%;
    padding: 1.85rem 1.8rem 3.5rem;
    animation: pageReveal 0.3s ease both;
}
@keyframes pageReveal {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    position: relative;
    margin-bottom: 1.55rem;
    padding-left: 0.9rem;
}
.page-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.22rem;
    width: 4px;
    height: calc(100% - 0.44rem);
    min-height: 37px;
    border-radius: 999px;
    background: var(--brand-gradient);
}
.page-header h1 { margin-bottom: 0.22rem; font-size: clamp(1.45rem, 2.1vw, 1.78rem); letter-spacing: -0.035em; }
.page-header p { font-size: 0.87rem; }

/* ========================== Core surface refinement ======================== */

.card,
.stat-card,
.verification-metric,
.archive-summary-card,
.archive-callout {
    border-radius: var(--radius);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}
.card { overflow: clip; }
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
    min-height: 52px;
    padding: 0.88rem 1.12rem;
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 98%, transparent), color-mix(in srgb, var(--surface-2) 42%, var(--surface)));
    font-size: 0.86rem;
}
.card-header i { color: var(--brand-500); }
.card-body { padding: 1.18rem; }

.stat-card {
    min-height: 132px;
    padding: 1.1rem 1.15rem 1.05rem 1.3rem;
    overflow: hidden;
}
.stat-card::before { width: 4px; }
.stat-card::after {
    content: '';
    position: absolute;
    right: -34px;
    bottom: -42px;
    width: 105px;
    height: 105px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--stat-accent, var(--brand-500)) 6%, transparent);
    pointer-events: none;
}
.stat-card .stat-icon { width: 36px; height: 36px; right: 15px; top: 15px; border-radius: 10px; }
.stat-card h5 { max-width: calc(100% - 50px); font-size: 0.72rem; letter-spacing: 0.045em; }
.stat-card .display-6 { margin-top: 0.34rem; font-size: clamp(1.55rem, 2.3vw, 2rem); letter-spacing: -0.04em; }
.stat-card small { font-size: 0.7rem; }

.table-responsive { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.table-responsive::-webkit-scrollbar { height: 8px; width: 8px; }
.table-responsive::-webkit-scrollbar-thumb { border-radius: 999px; background: var(--border-strong); border: 2px solid transparent; background-clip: padding-box; }
.table thead th { padding: 0.78rem 1rem; background: var(--surface-2); font-size: 0.665rem; letter-spacing: 0.07em; }
.table tbody td { padding: 0.82rem 1rem; font-size: 0.835rem; }
.table tbody tr:hover > td { background: color-mix(in srgb, var(--brand-400) 5%, transparent); }
.table code { color: var(--text-secondary); }

.btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    border-radius: 10px;
    padding: 0.48rem 0.95rem;
    font-size: 0.81rem;
    box-shadow: none;
}
.btn-sm { min-height: 32px; padding: 0.3rem 0.62rem; border-radius: 8px; font-size: 0.74rem; }
.btn-lg { min-height: 48px; }
.btn-primary { box-shadow: 0 7px 16px rgba(54, 89, 227, 0.17); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(54, 89, 227, 0.24); }
.btn-warning { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; border-color: #d97706; color: #fff; }
.btn.is-loading { pointer-events: none; opacity: 0.78; }
.btn.is-loading::after {
    content: '';
    width: 13px;
    height: 13px;
    margin-left: 0.35rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: rotateLive 0.65s linear infinite;
}

.form-control,
.form-select {
    min-height: 42px;
    border-radius: 10px;
    /* The right padding must clear the chevron drawn as a background image
       (custom.css positions it at right 0.8rem). The shorthand used here
       previously reset padding-right to 0.78rem, so the arrow sat on top of
       the selected text in every dropdown in the app. */
    padding: 0.55rem 2.3rem 0.55rem 0.78rem;
    font-size: 0.84rem;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.018);
}
.form-control-sm,
.form-select-sm { min-height: 34px; padding-top: 0.34rem; padding-bottom: 0.34rem; font-size: 0.76rem; }
.form-label { color: var(--text-secondary); font-size: 0.75rem; letter-spacing: 0.005em; }
.form-text { line-height: 1.5; }

.badge,
.badge-soft,
.status-chip { border-radius: 999px; }

/* Persistent context is a calm panel, not an interruptive alert. */
.notice-panel {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.88rem 1rem;
    margin-bottom: 1.1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-secondary);
    box-shadow: var(--shadow-xs);
    font-size: 0.82rem;
}
.notice-panel-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-muted);
}
.notice-panel-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.48; }
.notice-panel-copy > strong,
.notice-panel > .fw-semibold { color: var(--text); font-size: 0.84rem; }
.notice-panel p:last-child,
.notice-panel ul:last-child { margin-bottom: 0; }
.notice-panel-success { border-color: color-mix(in srgb, var(--success) 24%, var(--border)); background: color-mix(in srgb, var(--success-soft) 45%, var(--surface)); }
.notice-panel-success .notice-panel-icon,
.notice-panel-success > i { color: var(--success); background: var(--success-soft); }
.notice-panel-danger { border-color: color-mix(in srgb, var(--danger) 24%, var(--border)); background: color-mix(in srgb, var(--danger-soft) 40%, var(--surface)); }
.notice-panel-danger .notice-panel-icon,
.notice-panel-danger > i { color: var(--danger); background: var(--danger-soft); }
.notice-panel-warning { border-color: color-mix(in srgb, var(--warning) 25%, var(--border)); background: color-mix(in srgb, var(--warning-soft) 40%, var(--surface)); }
.notice-panel-warning .notice-panel-icon,
.notice-panel-warning > i { color: var(--warning); background: var(--warning-soft); }
.notice-panel-info { border-color: color-mix(in srgb, var(--info) 22%, var(--border)); background: color-mix(in srgb, var(--info-soft) 38%, var(--surface)); }
.notice-panel-info .notice-panel-icon,
.notice-panel-info > i { color: var(--info); background: var(--info-soft); }
.notice-panel-neutral { background: var(--surface-2); }
.notice-panel-link { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.directive-panel { align-items: flex-start; }

/* ============================ Calendar controls ============================ */

.app-date-control {
    position: relative;
    width: 100%;
    min-width: 150px;
    min-height: 42px;
    border-radius: 10px;
}
.app-date-control > input[type="date"],
.app-date-control > input[type="datetime-local"] {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.app-date-control > input:disabled,
.app-date-control > input[readonly] { cursor: not-allowed; pointer-events: none; }
.app-date-visual {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.52rem 2.1rem 0.52rem 0.72rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.018);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.app-date-control:hover .app-date-visual { border-color: var(--border-strong); }
.app-date-control.is-focused .app-date-visual {
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3.5px var(--ring);
}
.app-date-control.is-disabled .app-date-visual { background: var(--surface-2); color: var(--text-muted); }
.app-date-icon {
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(54, 89, 227, 0.085);
    color: var(--brand-500);
    font-size: 0.78rem;
}
.app-date-value {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    font-size: 0.79rem;
    font-weight: 550;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-date-value.is-placeholder { color: var(--text-muted); font-weight: 450; }
.app-date-chevron {
    position: absolute;
    right: 0.72rem;
    color: var(--text-muted);
    font-size: 0.66rem;
}
.app-date-clear {
    position: absolute;
    right: 1.75rem;
    top: 50%;
    z-index: 3;
    width: 24px;
    height: 24px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--text-muted);
}
.app-date-clear:hover { color: var(--danger); background: var(--danger-soft); }
.app-date-control-sm,
.app-date-control-sm .app-date-visual { min-height: 34px; }
.app-date-control-sm .app-date-visual { padding-top: 0.31rem; padding-bottom: 0.31rem; }
.app-date-control-sm .app-date-icon { width: 23px; height: 23px; flex-basis: 23px; }
.app-date-control:has(input.is-invalid) .app-date-visual { border-color: var(--danger); }

.date-range-shortcuts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.38rem;
    margin-bottom: -0.15rem;
}
.date-range-shortcuts > span {
    margin-right: 0.1rem;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}
.date-range-shortcuts button {
    min-height: 27px;
    padding: 0.22rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.67rem;
    font-weight: 600;
}
.date-range-shortcuts button:hover,
.date-range-shortcuts button.active {
    border-color: color-mix(in srgb, var(--brand-500) 42%, var(--border));
    background: rgba(54, 89, 227, 0.075);
    color: var(--brand-500);
}

/* ========================= Modular application dialog ====================== */

body.dialog-open { overflow: hidden; }
.app-dialog,
.app-command-dialog {
    width: min(calc(100vw - 2rem), 470px);
    max-width: none;
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 20px;
    outline: 0;
    background: transparent;
    color: var(--text);
    box-shadow: var(--shadow-lg);
    overflow: visible;
}
.app-dialog::backdrop,
.app-command-dialog::backdrop {
    background: rgba(5, 11, 24, 0.58);
    backdrop-filter: blur(5px);
    animation: backdropIn 0.18s ease both;
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

.app-dialog-shell {
    position: relative;
    overflow: hidden;
    padding: 1.45rem;
    border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
    border-radius: 20px;
    background: var(--surface-raised);
    animation: dialogIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes dialogIn {
    from { opacity: 0; transform: translateY(12px) scale(0.975); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.app-dialog-accent {
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--brand-gradient);
}
.app-dialog-danger .app-dialog-accent { background: var(--danger); }
.app-dialog-warning .app-dialog-accent { background: var(--warning); }
.app-dialog-success .app-dialog-accent { background: var(--success); }
.app-dialog-close {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
}
.app-dialog-close:hover { background: var(--surface-2); color: var(--text); }
.app-dialog-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border-radius: 14px;
    background: rgba(54, 89, 227, 0.1);
    color: var(--brand-500);
    font-size: 1.15rem;
}
.app-dialog-danger .app-dialog-icon { background: var(--danger-soft); color: var(--danger); }
.app-dialog-warning .app-dialog-icon { background: var(--warning-soft); color: var(--warning); }
.app-dialog-success .app-dialog-icon { background: var(--success-soft); color: var(--success); }
.app-dialog-copy h2 { margin: 0 2rem 0.42rem 0; font-size: 1.05rem; letter-spacing: -0.025em; }
.app-dialog-copy p { margin: 0; color: var(--text-secondary); font-size: 0.83rem; line-height: 1.62; white-space: pre-line; }
.app-dialog-details { margin-top: 0.85rem; padding: 0.75rem 0.85rem; border-radius: 10px; background: var(--surface-2); color: var(--text-secondary); font-size: 0.76rem; }
.app-dialog-details ul { margin: 0; padding-left: 1.1rem; }
.app-dialog-actions { display: flex; justify-content: flex-end; gap: 0.55rem; margin-top: 1.35rem; }

/* Command palette */
.app-command-dialog { width: min(calc(100vw - 2rem), 610px); border-radius: 18px; }
.app-command-shell {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-raised);
    animation: dialogIn 0.2s ease both;
}
.app-command-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}
.app-command-header > i { color: var(--brand-500); }
.app-command-header input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.94rem;
}
.app-command-header input::placeholder { color: var(--text-muted); }
.app-command-header kbd {
    padding: 0.18rem 0.42rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.63rem;
    box-shadow: none;
}
.app-command-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 1rem 0.42rem;
}
.app-command-meta h2 { margin: 0; color: var(--text-muted); font-family: 'Inter', sans-serif; font-size: 0.64rem; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; }
.app-command-meta span { color: var(--text-muted); font-size: 0.62rem; }
.app-command-results { max-height: min(55vh, 420px); overflow-y: auto; padding: 0.35rem 0.55rem 0.6rem; }
.app-command-item {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    padding: 0.62rem 0.7rem;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
}
.app-command-item:hover,
.app-command-item.active { background: var(--surface-2); color: var(--text); text-decoration: none; }
.app-command-item.active { box-shadow: inset 0 0 0 1px var(--border); }
.app-command-item-icon { width: 34px; height: 34px; flex: 0 0 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; background: rgba(54, 89, 227, 0.08); color: var(--brand-500); }
.app-command-item-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.app-command-item-copy strong { font-size: 0.79rem; }
.app-command-item-copy small { color: var(--text-muted); font-size: 0.64rem; }
.app-command-item-arrow { color: var(--text-muted); font-size: 0.72rem; }
.app-command-empty { padding: 2.2rem 1rem; color: var(--text-muted); text-align: center; }
.app-command-empty i { display: block; margin-bottom: 0.55rem; font-size: 1.4rem; opacity: 0.5; }
.app-command-empty strong { display: block; color: var(--text-secondary); font-size: 0.82rem; }
.app-command-empty span { font-size: 0.7rem; }

/* Toasts replace page-blocking alert banners. */
.app-toast-viewport {
    position: fixed;
    top: calc(var(--topbar-height) + 0.9rem);
    right: 1rem;
    z-index: 2100;
    width: min(390px, calc(100vw - 2rem));
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    pointer-events: none;
}
.guest-body .app-toast-viewport { top: 1rem; }
.app-toast {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.72rem;
    padding: 0.78rem 0.72rem 0.78rem 0.78rem;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: color-mix(in srgb, var(--surface-raised) 95%, transparent);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(18px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.22s ease;
}
.app-toast.is-visible { opacity: 1; transform: translateX(0) scale(1); }
.app-toast.is-leaving { opacity: 0; transform: translateX(14px) scale(0.985); }
.app-toast-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--info-soft);
    color: var(--info);
}
.app-toast-success .app-toast-icon { background: var(--success-soft); color: var(--success); }
.app-toast-danger .app-toast-icon { background: var(--danger-soft); color: var(--danger); }
.app-toast-warning .app-toast-icon { background: var(--warning-soft); color: var(--warning); }
.app-toast-copy { min-width: 0; display: flex; flex-direction: column; padding-top: 0.05rem; }
.app-toast-copy strong { color: var(--text); font-size: 0.76rem; }
.app-toast-copy span { color: var(--text-secondary); font-size: 0.69rem; line-height: 1.48; white-space: pre-line; }
.app-toast-close { width: 27px; height: 27px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); font-size: 0.72rem; }
.app-toast-close:hover { background: var(--surface-2); color: var(--text); }
.app-toast-progress { position: absolute; left: 0; bottom: 0; width: 100%; height: 2px; transform-origin: left; background: var(--info); animation: toastProgress linear forwards; }
.app-toast-success .app-toast-progress { background: var(--success); }
.app-toast-danger .app-toast-progress { background: var(--danger); }
.app-toast-warning .app-toast-progress { background: var(--warning); }
.app-toast-progress.is-paused { animation-play-state: paused; }
@keyframes toastProgress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.live-region-updated { animation: liveRegionPulse 0.75s ease; }
@keyframes liveRegionPulse {
    0% { background-color: rgba(54, 89, 227, 0.1); }
    100% { background-color: transparent; }
}

/* ============================== Activity logs ============================== */

.activity-logs-page .page-header-content { display: flex; align-items: flex-start; gap: 0.8rem; }
.activity-logs-page .page-header-icon { width: 42px; height: 42px; flex: 0 0 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; background: rgba(54, 89, 227, 0.085); color: var(--brand-500); }
.activity-logs-page .page-header::before { display: none; }
.activity-logs-page .page-header { padding-left: 0; }
.logs-actions { display: flex; justify-content: flex-end; }
.logs-card-header { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border); }
.logs-card-title { display: flex; align-items: center; gap: 0.55rem; margin: 0; font-size: 0.88rem; }
.logs-card-title i { color: var(--brand-500); }
.logs-count { display: inline-flex; align-items: center; min-height: 26px; padding: 0.2rem 0.55rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text-muted); font-size: 0.68rem; font-weight: 650; }
.log-date,
.business-name { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text-secondary); white-space: nowrap; }
.log-date i,
.business-name i { color: var(--text-muted); }
.log-user { display: flex; align-items: center; gap: 0.55rem; font-weight: 600; }
.user-avatar { width: 30px; height: 30px; flex: 0 0 30px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--brand-500); font-size: 0.69rem; font-weight: 750; }
.logs-empty-cell { padding: 0 !important; }
.logs-pagination { display: flex; justify-content: flex-end; }

/* ============================== Auth polish ================================ */

.auth-shell { grid-template-columns: minmax(390px, 0.9fr) minmax(480px, 1.1fr); }
.auth-aside {
    padding: clamp(2rem, 4vw, 3.6rem);
    background:
        radial-gradient(circle at 86% 12%, rgba(98, 128, 244, 0.42), transparent 24rem),
        radial-gradient(circle at 12% 88%, rgba(31, 184, 166, 0.2), transparent 22rem),
        linear-gradient(150deg, #121f39 0%, #0b1730 55%, #081222 100%);
}
.auth-aside::before,
.auth-aside::after { opacity: 0.55; }
.auth-visual-copy { max-width: 580px; }
.auth-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1.1rem;
    color: rgba(220, 233, 249, 0.7);
    font-size: 0.68rem;
    font-weight: 650;
}
.auth-live-pill > span { width: 7px; height: 7px; border-radius: 50%; background: #43d6ac; box-shadow: 0 0 0 4px rgba(67, 214, 172, 0.1); }
.auth-aside-headline { font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.07; letter-spacing: -0.055em; }
.auth-aside-sub { max-width: 54ch; color: rgba(218, 228, 242, 0.68); font-size: 0.92rem; line-height: 1.75; }
.auth-points li { color: rgba(224, 233, 245, 0.78); font-size: 0.82rem; }
.auth-points li i { background: rgba(52, 211, 153, 0.12); color: #71e6c3; }
.auth-aside-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: rgba(195, 207, 225, 0.42); font-size: 0.68rem; }
.auth-secure-note { display: inline-flex; align-items: center; gap: 0.35rem; }
.auth-main { background: var(--bg); }
.auth-card-wrapper { width: min(100%, 460px); }
.auth-card { border-radius: 18px; box-shadow: var(--shadow-sm); }

/* ============================== Responsive ================================= */

@media (max-width: 1199.98px) {
    .topbar-date { display: none; }
    .topbar-search-trigger { width: min(300px, 34vw); margin-left: 0; }
}

@media (max-width: 991.98px) {
    #sidebar-wrapper { overflow: hidden; transform: translateX(-105%); width: min(88vw, var(--sidebar-width)); }
    #sidebar-wrapper.toggled { transform: translateX(0); }
    body.sidebar-mobile-open .sidebar-scrim { display: block; }
    #page-content-wrapper { margin-left: 0 !important; }
    .sidebar-collapse-btn { display: none !important; }
    .topbar { padding: 0.6rem 1rem; }
    .topbar-search-trigger { width: 42px; flex: 0 0 42px; justify-content: center; padding: 0; margin-left: auto; }
    .topbar-search-trigger span,
    .topbar-search-trigger kbd { display: none; }
    .topbar-actions { margin-left: 0 !important; }
    main { padding: 1.35rem 1rem 3rem; }
    .auth-shell { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
    :root { --topbar-height: 66px; }
    .topbar-context { min-width: 0; }
    .topbar-kicker { display: none; }
    .topbar-context strong { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .live-refresh-button { width: 38px; padding: 0; justify-content: center; }
    .live-refresh-button .live-mini-dot { position: absolute; margin: -21px 0 0 24px; }
    .user-dropdown .dropdown-toggle { padding: 0; border: 0; }
    .user-dropdown .dropdown-toggle::after { display: none; }
    .page-header { margin-bottom: 1.15rem; }
    .page-header h1 { font-size: 1.35rem; }
    .card { margin-bottom: 1rem; }
    .card-header { padding-inline: 0.9rem; }
    .card-body { padding: 0.95rem; }
    .app-toast-viewport { top: calc(var(--topbar-height) + 0.65rem); right: 0.65rem; width: calc(100vw - 1.3rem); }
    .app-dialog-shell { padding: 1.2rem; }
    .app-dialog-actions { flex-direction: column-reverse; }
    .app-dialog-actions .btn { width: 100%; }
    .app-command-meta span { display: none; }
    .date-range-shortcuts { gap: 0.3rem; }
    .date-range-shortcuts > span { width: 100%; }
    .logs-actions .btn { width: 100%; }
    .table-responsive-cards tbody tr { margin: 0 0.65rem 0.65rem; border-radius: 12px; box-shadow: var(--shadow-xs); }
    .table-responsive-cards tbody td { padding: 0.62rem 0.8rem; }
    .activity-logs-page .log-user,
    .activity-logs-page .log-date,
    .activity-logs-page .business-name { justify-content: flex-end; }
}

@media (max-width: 480px) {
    .topbar { gap: 0.45rem; padding-inline: 0.7rem; }
    .topbar-context strong { max-width: 29vw; font-size: 0.78rem; }
    .topbar-search-trigger { display: none; }
    .app-command-dialog { width: calc(100vw - 1rem); }
    main { padding-inline: 0.75rem; }
    .page-header { padding-left: 0.75rem; }
    .auth-main { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .live-status-orbit::after,
    .app-toast-progress { animation: none !important; }
}

.topbar-notification-button { position: relative; text-decoration: none; }
.topbar-notification-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 17px;
    height: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--surface);
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 750;
    line-height: 1;
}

.setup-copy-row {
    display: grid;
    grid-template-columns: 94px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.6rem;
    border: 1px solid color-mix(in srgb, var(--warning) 18%, var(--border));
    border-radius: 9px;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
}
.setup-copy-label { color: var(--text-muted); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.045em; }
.setup-copy-row code { min-width: 0; overflow: hidden; color: var(--text); font-size: 0.73rem; text-overflow: ellipsis; white-space: nowrap; }
.copy-complete { border-color: var(--success) !important; color: var(--success) !important; }
@media (max-width: 767.98px) {
    .setup-copy-row { grid-template-columns: 1fr auto; }
    .setup-copy-label { grid-column: 1 / -1; }
}

.password-wrapper { position: relative; }
.password-wrapper .form-control { padding-right: 2.8rem; }
.password-wrapper .password-toggle { z-index: 3; }

.welcome-card { position: relative; overflow: hidden; }
.welcome-icon { width: 50px; height: 50px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 1.15rem; border-radius: 14px; background: rgba(54, 89, 227, 0.1); color: var(--brand-500); font-size: 1.2rem; }
.welcome-capabilities { display: grid; gap: 0.55rem; }
.welcome-capabilities span { display: flex; align-items: center; gap: 0.55rem; color: var(--text-secondary); font-size: 0.78rem; }
.welcome-capabilities i { width: 25px; height: 25px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: var(--surface-2); color: var(--brand-500); }

/* Full human-readable dates stay visible without sacrificing the native picker. */
.app-date-control { min-width: 185px; }
.app-date-control-sm { min-width: 165px; }
.app-date-control:has(input[type="datetime-local"]) { min-width: 245px; }
@media (max-width: 575.98px) {
    .app-date-control,
    .app-date-control-sm,
    .app-date-control:has(input[type="datetime-local"]) { min-width: 0; }
}

/* Compact rail labels must never leak beside their icons. */
#wrapper.sidebar-collapsed #sidebar-wrapper .link-text { display: none !important; }
#wrapper.sidebar-collapsed .nav-group-toggle,
#wrapper.sidebar-collapsed #sidebar-wrapper .list-group-item { font-size: 0; }

/* Reserve enough room for the formatted value, clear control, and picker chevron. */
.app-date-control { min-width: 210px; }
.app-date-control-sm { min-width: 190px; }
.app-date-control:has(input[type="datetime-local"]) { min-width: 280px; }
.app-date-control.has-value .app-date-visual { padding-right: 4.15rem; }
@media (max-width: 575.98px) {
    .app-date-control,
    .app-date-control-sm,
    .app-date-control:has(input[type="datetime-local"]) { min-width: 0; }
}

.app-dialog-field { margin-top: 1rem; }
.app-dialog-field label { display: block; margin-bottom: 0.38rem; color: var(--text-secondary); font-size: 0.72rem; font-weight: 700; }
.app-dialog-field textarea {
    width: 100%;
    min-height: 96px;
    resize: vertical;
    padding: 0.68rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: 0;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.8rem;
    line-height: 1.5;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.app-dialog-field textarea:focus { border-color: var(--brand-400); box-shadow: 0 0 0 3.5px var(--ring); }
.app-dialog-field.is-invalid textarea { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 14%, transparent); }
.app-dialog-field.is-invalid::after { content: 'Please enter a reason before continuing.'; display: block; margin-top: 0.35rem; color: var(--danger); font-size: 0.67rem; }
.app-dialog-field small { display: block; margin-top: 0.35rem; color: var(--text-muted); font-size: 0.66rem; }

/* Notification center */
.notification-feed .list-group-item {
    position: relative;
    padding: 0.95rem 1.05rem;
    border-color: var(--border);
    background: var(--surface);
    transition: background 0.18s ease, transform 0.18s ease;
}
.notification-feed .list-group-item:hover { background: var(--surface-2); }
.notification-feed .list-group-item.bg-light {
    background: color-mix(in srgb, var(--brand-500) 5%, var(--surface)) !important;
}
.notification-feed .list-group-item.bg-light::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.85rem;
    bottom: 0.85rem;
    width: 3px;
    border-radius: 999px;
    background: var(--brand-500);
}
.notification-feed .fw-semibold { color: var(--text); }
.notification-feed .text-muted { color: var(--text-muted) !important; }

/* ================= Navigation activity indicators ================= */

/* A count says how much arrived since you last opened the screen; a dot says
   only that something is there. The dot is drawn as a circle and its bullet
   character is hidden, so the live refresh can still show/hide it by swapping
   text content the way it does for counts. */
.nav-sub-badge,
.nav-group-badge {
    flex-shrink: 0;
    min-width: 18px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.nav-group-badge {
    margin-left: auto;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1;
    padding: 3px 6px;
    border-radius: var(--radius-pill, 999px);
    background: var(--danger);
    color: #fff;
}

.nav-sub-dot,
.nav-group-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin-left: auto;
    border-radius: 50%;
    background: var(--brand-400, #6480f4);
    /* The bullet is only there so the live refresh has text to swap. */
    font-size: 0;
    line-height: 0;
    overflow: hidden;
    color: transparent;
}
.nav-sub-dot { margin-left: auto; }

/* In the icon rail there is no room for a number beside a 32px icon: a "99+"
   pill sat on top of the icon and hid it. The rail therefore shows only a small
   dot in the corner, and the number itself belongs to the expanded sidebar,
   where it has a label to sit against.

   The colour is written out rather than taken from a theme token because the
   sidebar is dark in both themes: a token would turn this white in light mode. */
#wrapper.sidebar-collapsed .nav-group { position: relative; }
#wrapper.sidebar-collapsed .nav-group-badge { display: none !important; }
#wrapper.sidebar-collapsed .nav-group-dot,
#wrapper.sidebar-collapsed .nav-group.has-activity .nav-group-dot {
    position: absolute;
    top: 6px;
    right: 16px;
    width: 9px;
    height: 9px;
    margin: 0;
    z-index: 2;
    background: #f87171;
    box-shadow: 0 0 0 2px #101a2e;
}

/* Expanded sidebar: a number and a dot side by side would say the same thing
   twice, so the dot stands down whenever a number is showing. */
#wrapper:not(.sidebar-collapsed) .nav-group-badge:not(.d-none) + .nav-group-dot { display: none !important; }

/* The vertical guide line under a group's icon was being painted over by the
   hover and active backgrounds of the items beside it. Indenting the items so
   their pill starts clear of the line keeps both readable. */
.nav-group-items { position: relative; }
.nav-sub-item { margin-left: 1.2rem; }
.nav-group-items::before { z-index: 1; }
