/* Wanbase - Full-Width Modern SaaS Design System */
:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Light Mode */
    --bg-body: #f8fafc;
    --bg-header: rgba(255, 255, 255, 0.9);
    --bg-surface: #ffffff;
    --bg-inset: #f1f5f9;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    
    --btn-primary-bg: #0f172a;
    --btn-primary-text: #ffffff;
    --btn-primary-hover: #1e293b;
    
    --badge-active-bg: rgba(22, 163, 74, 0.1);
    --badge-active-text: #15803d;
    --badge-active-border: rgba(22, 163, 74, 0.25);
    
    --badge-suspended-bg: rgba(220, 38, 38, 0.1);
    --badge-suspended-text: #b91c1c;
    --badge-suspended-border: rgba(220, 38, 38, 0.25);
    
    --radius-card: 2px;
    --radius-btn: 2px;
    --radius-input: 2px;
    --radius-modal: 2px;
    --radius: 2px;

    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* Dark Mode */
html.dark {
    --bg-body: #09090b;
    --bg-header: rgba(14, 14, 18, 0.9);
    --bg-surface: #121216;
    --bg-inset: #18181b;
    --border-color: #27272a;
    --border-hover: #3f3f46;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-faint: #64748b;
    
    --btn-primary-bg: #fafafa;
    --btn-primary-text: #09090b;
    --btn-primary-hover: #f1f5f9;
    
    --badge-active-bg: rgba(34, 197, 94, 0.12);
    --badge-active-text: #4ade80;
    --badge-active-border: rgba(34, 197, 94, 0.3);
    
    --badge-suspended-bg: rgba(239, 68, 68, 0.12);
    --badge-suspended-text: #f87171;
    --badge-suspended-border: rgba(239, 68, 68, 0.3);
    
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    min-height: 100vh;
    background-color: var(--bg-body);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* ==========================================================================
   INTERSERVER-STYLE APPLICATION SHELL & PERSISTENT DARK SIDEBAR
   ========================================================================== */

.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
    background-color: var(--bg-body);
}

/* 1. Black & White Sidebar */
.app-sidebar {
    width: 250px;
    min-width: 250px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    background-color: #121214;
    border-right: 1px solid #27272a;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Subtle scrollbar for sidebar */
.app-sidebar::-webkit-scrollbar {
    width: 5px;
}
.app-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.app-sidebar::-webkit-scrollbar-thumb {
    background: #27272a;
    border-radius: 4px;
}

/* Sidebar Brand Header */
.app-sidebar-header {
    height: 60px;
    min-height: 60px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #27272a;
}

.brand-logo-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
}

.brand-logo-icon {
    width: 32px;
    height: 32px;
    background: #ffffff;
    color: #000000;
    font-weight: 800;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    box-shadow: none;
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

/* 2. User Profile Card in Sidebar */
.sidebar-user-card {
    margin: 14px 14px 10px 14px;
    padding: 12px 14px;
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #27272a;
    border: 1px solid #3f3f46;
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-info-box {
    min-width: 0;
    flex: 1;
}

.user-name-text {
    font-size: 13.5px;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.user-email-text {
    font-size: 11.5px;
    color: #71717a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
    line-height: 1.2;
}

/* 3. Navigation Links in Sidebar */
.app-sidebar-nav {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar-nav-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #71717a;
    padding: 10px 12px 6px 12px;
}

.app-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 4px;
    color: #a1a1aa;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.app-sidebar .nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #71717a;
    transition: color 0.15s ease;
}

.app-sidebar .nav-item:hover {
    background: #1f1f23;
    color: #f8fafc;
}

.app-sidebar .nav-item:hover svg {
    color: #ffffff;
}

.app-sidebar .nav-item.active {
    background: #27272a;
    color: #ffffff;
    font-weight: 600;
    border-left: 3px solid #ffffff;
    padding-left: 11px;
}

.app-sidebar .nav-item.active svg {
    color: #ffffff;
}

.app-sidebar .nav-item.signout:hover {
    background: #27272a;
    color: #ffffff;
}

.app-sidebar .nav-item.signout:hover svg {
    color: #ffffff;
}

/* 4. Sidebar Footer (Settings & Sign Out) */
.app-sidebar-footer {
    padding: 12px;
    border-top: 1px solid #27272a;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: auto;
}

/* Mobile Close Button inside sidebar */
.mobile-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: #a1a1aa;
    padding: 6px;
    cursor: pointer;
    border-radius: 4px;
}
.mobile-close-btn:hover {
    color: #ffffff;
    background: #27272a;
}

/* ==========================================================================
   APP WRAPPER & TOPBAR (STRICT BLACK & WHITE MONOCHROME)
   ========================================================================== */

.app-wrapper {
    margin-left: 250px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg-body);
}

.app-topbar {
    height: 60px;
    min-height: 60px;
    background-color: #121214;
    border-bottom: 1px solid #27272a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.app-topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    max-width: 600px;
}

.app-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Topbar Hamburger Toggle */
.mobile-hamburger {
    display: none;
    background: transparent;
    border: none;
    color: #a1a1aa;
    padding: 6px;
    cursor: pointer;
    border-radius: 4px;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}
.mobile-hamburger:hover {
    color: #ffffff;
    background: #27272a;
}

/* Topbar Search Box (Black & White, zero blue) */
.topbar-search-box {
    display: flex;
    align-items: center;
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 4px;
    padding: 0 12px;
    height: 36px;
    width: 100%;
    max-width: 360px;
    color: #ffffff;
    transition: border-color 0.15s ease;
}

.topbar-search-box:focus-within {
    border-color: #ffffff;
    box-shadow: none;
}

.topbar-search-box svg {
    color: #71717a;
    flex-shrink: 0;
    margin-right: 8px;
}

.topbar-search-input {
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-size: 13px;
    width: 100%;
}

.topbar-search-input::placeholder {
    color: #52525b;
}

.topbar-search-shortcut {
    background: #27272a;
    color: #a1a1aa;
    padding: 2px 6px;
    font-size: 11px;
    font-family: monospace;
    border-radius: 3px;
    border: 1px solid #3f3f46;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}
.topbar-search-shortcut:hover {
    background: #3f3f46;
    color: #ffffff;
    border-color: #71717a;
}

/* Topbar Action Buttons */
.topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: #18181b;
    border: 1px solid #27272a;
    color: #a1a1aa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    position: relative;
}

.topbar-btn:hover {
    background: #27272a;
    color: #ffffff;
    border-color: #3f3f46;
}

.topbar-btn.power-btn:hover {
    background: #27272a;
    color: #ffffff;
    border-color: #3f3f46;
}

.topbar-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #121214;
}

/* Topbar User Pill Override */
.app-topbar .user-pill {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.app-topbar .user-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
}

/* ==========================================================================
   PAGE BREADCRUMBS & INNER HEADERS
   ========================================================================== */

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.page-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.page-breadcrumb a:hover {
    color: var(--text-primary);
}

.breadcrumb-sep {
    color: var(--text-faint);
    font-size: 11px;
}

.page-breadcrumb .current {
    color: var(--text-primary);
    font-weight: 500;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (Desktop vs Mobile)
   ========================================================================== */

@media (max-width: 900px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    }

    .app-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .mobile-hamburger {
        display: flex !important;
    }

    .mobile-close-btn {
        display: flex !important;
    }

    .sidebar-backdrop.open,
    .sidebar-backdrop.active {
        display: block !important;
    }

    .topbar-search-box {
        max-width: 220px;
    }
    .topbar-search-shortcut {
        display: none;
    }

    .main-container {
        padding: 20px 16px;
        max-width: 100% !important;
        box-sizing: border-box;
    }
}

@media (max-width: 600px) {
    .topbar-search-box {
        display: none;
    }
    .app-topbar {
        padding: 0 14px;
    }

    .user-pill-text {
        display: none !important;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header .btn {
        width: 100%;
        justify-content: center;
    }
}

/* User Account Pill */
.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 2px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    max-width: 190px;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
}

.user-pill svg {
    flex-shrink: 0;
}

.user-pill-text {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
    flex: 1;
    min-width: 0;
}

.role-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 2px;
    background: var(--bg-inset);
    color: var(--text-muted);
    flex-shrink: 0;
    letter-spacing: 0.04em;
}

.admin-badge,
.role-badge.admin {
    background: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #000000 !important;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    display: inline-block;
}

:root.dark .admin-badge,
:root.dark .role-badge.admin,
.dark .admin-badge,
.dark .role-badge.admin {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #ffffff !important;
}

/* Client Portal Minimalist Alert Indicator (Dot + Count) */
.portal-alert-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}
.portal-alert-indicator .alert-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.portal-alert-indicator.alert {
    color: #f87171;
}
.portal-alert-indicator.alert .alert-dot {
    background: #f87171;
}
.portal-alert-indicator.healthy {
    color: #16a34a;
}
.portal-alert-indicator.healthy .alert-dot {
    background: #16a34a;
}

.health-issue-bubble {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 700;
}
.health-issue-bubble.healthy {
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
    border: 1px solid rgba(22, 163, 74, 0.25);
}
.health-issue-bubble.has-issue {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.bubble-count-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}
.bubble-count-circle.alert {
    background: #ef4444;
    color: #ffffff;
}
.bubble-count-circle.zero {
    background: #16a34a;
    color: #ffffff;
}

/* Main Container (Normal Website View) */
.main-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 36px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Page Title & Actions */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title-group h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-title-group p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 2px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
    user-select: none;
}

.btn svg {
    width: 15px;
    height: 15px;
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}
.btn-primary:hover {
    background: var(--btn-primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: var(--bg-inset);
    border-color: var(--border-hover);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
    border-color: rgba(34, 197, 94, 0.3);
}
html.dark .btn-success {
    color: #4ade80;
}
.btn-success:hover {
    background: rgba(34, 197, 94, 0.22);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 2px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}
.icon-btn:hover {
    background: var(--bg-inset);
    border-color: var(--border-hover);
}
.icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* Cards & Containers */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

/* Table Style */
.wanbase-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.wanbase-table th {
    padding: 14px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-inset);
}

.wanbase-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.col-actions {
    text-align: right;
    white-space: nowrap;
}

.cell-actions-row {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
    vertical-align: middle;
}

.btn-wrap-main {
    display: inline-flex;
    align-items: center;
}

.btn-edit:hover {
    background: var(--bg-inset);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* Domain Cell */
.domain-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.domain-title:hover {
    text-decoration: underline;
}
.client-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Status Badges - Clean Dot + Text (No Background Pill) */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 0 !important;
}

.status-active,
.status-badge.active,
.status-badge.status-active,
.badge-active {
    background: transparent !important;
    color: #16a34a !important;
    border: none !important;
}
:root.dark .status-active,
:root.dark .status-badge.active,
:root.dark .status-badge.status-active {
    color: #4ade80 !important;
}

.status-suspended,
.status-badge.suspended,
.status-badge.status-suspended,
.badge-suspended {
    background: transparent !important;
    color: #ef4444 !important;
    border: none !important;
}
:root.dark .status-suspended,
:root.dark .status-badge.suspended,
:root.dark .status-badge.status-suspended {
    color: #f87171 !important;
}

.status-warning,
.status-badge.warning,
.status-badge.status-warning,
.badge-warning,
.badge-grace {
    background: transparent !important;
    color: #d97706 !important;
    border: none !important;
}
:root.dark .status-warning,
:root.dark .status-badge.warning,
:root.dark .status-badge.status-warning {
    color: #fbbf24 !important;
}

.status-info,
.status-badge.info,
.status-badge.status-info {
    background: transparent !important;
    color: #2563eb !important;
    border: none !important;
}
:root.dark .status-info,
:root.dark .status-badge.info,
:root.dark .status-badge.status-info {
    color: #60a5fa !important;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    flex-shrink: 0;
}

.status-pill-health {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 12px;
    font-weight: 600;
}
.status-pill-health::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}
.status-pill-health.healthy {
    color: #16a34a !important;
}
:root.dark .status-pill-health.healthy {
    color: #4ade80 !important;
}
.status-pill-health.warning {
    color: #d97706 !important;
}
:root.dark .status-pill-health.warning {
    color: #fbbf24 !important;
}
.status-pill-health.critical {
    color: #ef4444 !important;
}
:root.dark .status-pill-health.critical {
    color: #f87171 !important;
}

.driver-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* Empty State Card */
.empty-state {
    padding: 60px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.empty-icon {
    width: 54px;
    height: 54px;
    border-radius: 2px;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.empty-icon svg {
    width: 26px;
    height: 26px;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 440px;
    line-height: 1.5;
}

/* Modal Overlay & Responsive Form - Perfectly Centralized */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-overlay[style*="display: flex"],
.modal-overlay.active {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-modal, 2px);
    width: 100%;
    max-width: 540px;
    padding: 24px;
    box-shadow: var(--shadow-modal);
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto !important;
    position: relative;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h2 {
    font-size: 17px;
    font-weight: 700;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.form-input {
    padding: 10px 14px;
    border-radius: 2px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}
.form-input:focus {
    border-color: var(--text-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.help-guide-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    text-decoration: none;
    margin-bottom: 12px;
}
html.dark .help-guide-toggle {
    color: #60a5fa;
}
.help-guide-toggle:hover {
    text-decoration: underline;
}

.guide-box {
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 14px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 14px;
}
.guide-box strong {
    color: var(--text-primary);
}
.guide-box ol, .guide-box ul {
    margin-left: 18px;
    margin-top: 6px;
    margin-bottom: 6px;
}
.field-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
}
.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-modal);
    border-radius: 2px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Mobile Header Drawer */
.mobile-menu-btn {
    display: none;
}

.mobile-nav-drawer {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-modal);
    padding: 16px 20px;
    z-index: 999;
    flex-direction: column;
    gap: 10px;
}
.mobile-nav-drawer.open {
    display: flex;
}

.mobile-user-info {
    padding: 8px 12px;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    font-size: 12.5px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
}

.mobile-nav-btn {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
}
.mobile-nav-btn:hover {
    background: var(--bg-inset);
}
.mobile-nav-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* Mobile labels hidden on desktop */
.mobile-label {
    display: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .header-inner {
        padding: 0 16px;
    }
    .desktop-nav-items {
        display: none !important;
    }
    .mobile-menu-btn {
        display: inline-flex;
    }
    
    .main-container {
        padding: 20px 14px;
    }

    /* Restructure table into clean, well-spaced stacked cards */
    #websitesContainer {
        background: transparent;
        border: none;
        box-shadow: none;
        overflow: visible;
    }

    .wanbase-table,
    .wanbase-table tbody {
        display: block;
        width: 100%;
    }

    .wanbase-table thead {
        display: none; /* Hide tabular column header row on mobile */
    }

    .wanbase-table tr {
        display: flex;
        flex-direction: column;
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-radius: 2px;
        padding: 18px 16px;
        margin-bottom: 16px;
        box-shadow: var(--shadow-card);
        gap: 12px;
    }

    .wanbase-table td {
        display: block;
        padding: 0;
        border: none;
        width: 100%;
    }

    .hide-on-mobile {
        display: none !important;
    }

    .mobile-label {
        display: block;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        margin-bottom: 4px;
    }

    .cell-top-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 12px;
    }

    .cell-meta-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        background: var(--bg-inset);
        padding: 10px 12px;
        border-radius: 2px;
        border: 1px solid var(--border-color);
        font-size: 12px;
    }

    .cell-actions-row {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-top: 4px;
    }
    .cell-actions-row .btn-wrap-main {
        flex: 1;
    }
    .cell-actions-row .btn-wrap-main .btn {
        width: 100%;
        padding: 10px;
        min-height: 42px;
    }
    .cell-actions-row .btn-edit,
    .cell-actions-row .btn-remove {
        min-height: 42px;
        min-width: 42px;
    }
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }
    .modal-overlay {
        padding: 14px;
        align-items: center !important;
        justify-content: center !important;
    }
    .modal-card {
        padding: 20px 16px;
        border-radius: var(--radius-modal, 2px);
        max-height: calc(100vh - 28px);
        margin: auto !important;
        gap: 14px;
        width: 100%;
    }
    .modal-header h2 {
        font-size: 16px;
    }
    .form-input {
        font-size: 14px;
        padding: 11px 12px;
        min-height: 44px;
        border-radius: 2px;
    }
    .modal-actions {
        flex-direction: column-reverse;
        gap: 8px;
        margin-top: 10px;
    }
    .modal-actions .btn {
        width: 100%;
        padding: 12px;
        min-height: 44px;
        border-radius: 2px;
    }
}



/* ==========================================================================
   PORTAL & DASHBOARD CARD SYSTEM
   ========================================================================== */
.portal-container {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.portal-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.summary-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-card);
    transition: transform 0.15s ease, border-color 0.15s ease;
    min-height: 190px;
}

.summary-card:hover {
    border-color: var(--border-hover);
}

.summary-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.summary-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.summary-card-icon.blue {
    background: var(--bg-inset);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.summary-card-icon.green {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.25);
    color: #16a34a;
}

html.dark .summary-card-icon.green {
    color: #4ade80;
}

.summary-card-icon.red {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

.summary-card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 700;
}

.summary-card-val {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.summary-card-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 6px;
}

.summary-card-footer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   AGENCY BILLING SERVICES CARDS GRID
   ========================================================================== */
.billing-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.billing-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.billing-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}

.billing-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.billing-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    background: var(--bg-inset);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    color: var(--text-muted);
}

.billing-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.billing-card-amount {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.billing-card-amount .curr {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 2px;
}

.billing-card-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
    margin-bottom: 16px;
}

.billing-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

/* Retainer Toggle Slider */
.retainer-slider-active {
    background-color: #16a34a !important;
}
.retainer-slider-dot {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
.retainer-slider-dot-active {
    transform: translateX(20px);
}

/* =========================================================================
   WANBASE UNIVERSAL PRELOADER & SPINNERS
   ========================================================================= */
.wanbase-preloader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 14, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.22s ease-in-out;
    pointer-events: all;
}
.wanbase-preloader-overlay.visible {
    display: flex !important;
    opacity: 1 !important;
}
.wanbase-preloader-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 36px;
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 8px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7);
    text-align: center;
    min-width: 280px;
    max-width: 90vw;
    animation: wanbasePreloaderPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes wanbasePreloaderPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.wanbase-spinner-ring {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}
.wanbase-spinner-ring::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #ffffff;
    animation: wanbaseSpin 0.75s linear infinite;
}
@keyframes wanbaseSpin {
    to { transform: rotate(360deg); }
}
.wanbase-spinner-ring .spinner-core {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: #000000;
    border: 1px solid #3f3f46;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.05em;
    user-select: none;
}
.wanbase-preloader-text {
    font-size: 14px;
    font-weight: 700;
    color: #f4f4f5;
    margin-top: 14px;
    letter-spacing: -0.01em;
}
.wanbase-preloader-sub {
    font-size: 12px;
    color: #a1a1aa;
    margin-top: 4px;
    line-height: 1.4;
}
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: wanbaseSpin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
.btn.btn-loading {
    opacity: 0.82;
    pointer-events: none;
    cursor: wait !important;
}

/* Smart Success Checkmark Ring (Matches preloader ring dimensions) */
.wanbase-success-check-ring {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.15);
    border: 2px solid #22c55e;
    margin-bottom: 6px;
    box-shadow: 0 0 24px rgba(34, 197, 94, 0.28);
    animation: wanbaseSuccessPop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes wanbaseSuccessPop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.12); }
    100% { transform: scale(1); opacity: 1; }
}

/* 4-Step Smart Modals */
.smart-step-progress {
    display: flex;
    gap: 8px;
    width: 100%;
}
.step-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}
.step-progress-bar.active {
    background: var(--primary, #09090b);
}
:root.dark .step-progress-bar.active {
    background: #ffffff;
}
.step-progress-bar.completed {
    background: #22c55e;
}
.smart-modal-step {
    animation: smartStepFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes smartStepFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Universal Table Pagination Styles */
.wanbase-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 12px;
    user-select: none;
}
.wanbase-pagination-info {
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 500;
}
.wanbase-pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.wanbase-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.wanbase-page-btn:hover:not(:disabled) {
    background: var(--bg-inset);
    border-color: var(--border-hover, #d4d4d8);
}
.wanbase-page-btn.active {
    background: var(--text-primary);
    color: var(--bg-surface);
    border-color: var(--text-primary);
}
:root.dark .wanbase-page-btn.active {
    background: #ffffff;
    color: #09090b;
    border-color: #ffffff;
}
.wanbase-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.wanbase-page-toggle-all {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-inset);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.wanbase-page-toggle-all:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
    background: var(--bg-surface);
}



