/* ================================================================
   DCT CLIENT PORTAL — portal.css
   Mobile-first redesign with CIC-pattern bottom nav
   ================================================================ */

:root {
    --navy: #2E3D50;
    --blue: #4177B9;
    --blue-hover: #3668a8;
    --gold: #F0BC1B;
    --gold-light: #f5d060;
    --bg: #f9f9f9;
    --bg-card: #ffffff;
    --text: #2E3D50;
    --text-light: #6b7a8d;
    --text-muted: #9aa5b1;
    --border: #e2e6ec;
    --border-light: #edf0f4;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
    --sidebar-width: 260px;
    --header-height: 56px;
    --bottom-nav-h: 64px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --transition: 0.2s ease;
    /* Sidebar tokens */
    --sb-bg: #e2e6ec;
    --sb-text: #2E3D50;
    --sb-accent: #47A9DE;
    --sb-text-dim: #8896A6;
    --sb-hover: rgba(71,169,222,0.08);
    --sb-active-bg: rgba(71,169,222,0.12);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a {
    color: var(--blue);
    text-decoration: none;
}

/* ================================================================
   LOGIN
   ================================================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 1rem;
}
.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem;
}
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text);
    background: #f8f9fb;
    transition: border-color var(--transition);
    min-height: 44px;
}
.form-input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(65,119,185,0.15);
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    min-height: 44px;
}
.btn-primary {
    background: var(--blue);
    color: #fff;
    width: 100%;
}
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    min-height: 36px;
}
.btn-gold { background: var(--gold); color: #fff; font-weight: 700; }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.form-link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--blue);
    cursor: pointer;
}

/* ================================================================
   ALERTS
   ================================================================ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}
.alert-error { background: #fde8e8; color: var(--danger); border: 1px solid #f9c4c4; }
.alert-success { background: #e8f8ef; color: var(--success); border: 1px solid #a3e0bf; }
.alert-info { background: #e8f0fc; color: var(--info); border: 1px solid #a3c4e8; }
.mfa-code-input {
    letter-spacing: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: var(--navy);
}

/* ================================================================
   APP SHELL — Mobile-First Layout
   ================================================================ */
.app-shell { display: none; min-height: 100vh; flex-direction: column; }
.app-shell.active { display: flex; }

/* Mobile header — visible on mobile only */
.mobile-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    gap: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.mobile-header .page-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--navy);
    flex: 1;
}
.mobile-header .page-subtitle {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 400;
}

/* Scrollable content area */
.app-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-top: var(--header-height);
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-b));
}

/* Desktop sidebar — hidden on mobile */
.sidebar {
    display: none;
}
.sidebar-overlay { display: none; }

/* Main content wrapper */
.main-body {
    padding: 1rem;
}

/* ================================================================
   BOTTOM NAVIGATION — Mobile (CIC pattern)
   ================================================================ */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: calc(var(--bottom-nav-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}
.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 64px;
    min-height: 48px;
    padding: 6px 0;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    transition: color 0.15s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.nav-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    transition: stroke-width 0.15s;
}
.nav-btn.active {
    color: var(--blue);
}
.nav-btn.active svg {
    stroke-width: 2.25;
}
.nav-btn:active {
    color: var(--blue);
}

/* ================================================================
   BOTTOM SHEET — More Menu + General Sheets (CIC pattern)
   ================================================================ */
.sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 500;
    opacity: 0;
    transition: opacity 0.2s;
}
.sheet-overlay.active { display: block; opacity: 1; }
.sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 501;
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    pointer-events: none;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: var(--safe-b);
}
.sheet.active { transform: translateY(0); pointer-events: auto; }
.sheet-handle {
    width: 36px; height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin: 10px auto 0;
}
.sheet-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px 10px;
    flex-shrink: 0;
}
.sheet-head h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--navy);
}
.sheet-close {
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    border-radius: var(--radius);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.25rem;
}
.sheet-close:active { background: rgba(0,0,0,0.04); }
.sheet-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 20px 20px;
}

/* More-sheet list items */
.more-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border-light);
    min-height: 56px;
    cursor: pointer;
    transition: background 0.1s;
    -webkit-user-select: none;
    user-select: none;
}
.more-list-item:active { background: rgba(0,0,0,0.03); }
.more-list-item:last-child { border-bottom: none; }
.more-list-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.more-list-icon svg {
    width: 20px; height: 20px;
    stroke-width: 1.75;
    fill: none;
}
.more-list-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    flex: 1;
}

/* ================================================================
   VIEWS
   ================================================================ */
.view { display: none; }
.view.active { display: block; }

/* ================================================================
   SHARED COMPONENTS
   ================================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--navy);
}
.card-body { padding: 1.25rem; }
.card-body.no-pad { padding: 0; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: #e8f8ef; color: var(--success); }
.badge-warning { background: #fef5e7; color: var(--warning); }
.badge-danger { background: #fde8e8; color: var(--danger); }
.badge-info { background: #e8f0fc; color: var(--info); }
.badge-neutral { background: var(--bg); color: var(--text-light); }

/* Tables */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.8125rem;
}
tr:hover td { background: var(--bg); }

/* Empty/Loading states */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state h4 {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   DASHBOARD STAT CARDS
   ================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    transition: box-shadow var(--transition), transform var(--transition);
    cursor: pointer;
    min-height: 44px;
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.stat-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
}
.stat-icon.blue { background: rgba(65,119,185,0.1); }
.stat-icon.green { background: rgba(39,174,96,0.1); }
.stat-icon.gold { background: rgba(240,188,27,0.12); }
.stat-icon.red { background: rgba(231,76,60,0.1); }
.stat-icon.navy { background: rgba(46,61,80,0.08); }
.stat-info { flex: 1; }
.stat-value {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.2;
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}
.stat-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ================================================================
   CIC-STYLE STATUS BARS
   ================================================================ */
.status-bars {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.status-bar {
    border-radius: var(--radius-lg);
    padding: 0.875rem 1rem;
}
.status-bar .bar-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}
.status-bar .bar-label {
    font-size: 0.75rem;
    font-weight: 500;
}
.status-bar.green { background: linear-gradient(135deg, #d4efdf, #a9dfbf); color: #1e8449; }
.status-bar.yellow { background: linear-gradient(135deg, #fef9e7, #f9e79f); color: #b7950b; }
.status-bar.red { background: linear-gradient(135deg, #fadbd8, #f1948a); color: #c0392b; }
.status-bar.gray { background: linear-gradient(135deg, #eaecee, #d5d8dc); color: #616a6b; }

/* ================================================================
   CIC-STYLE HORIZONTAL DEVICE/AGENT CARD GRID
   ================================================================ */
.hcard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.hcard {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1rem 1.125rem;
    cursor: pointer;
    transition: all var(--transition);
}
.hcard:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--blue);
}
.hcard.selected {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(240,188,27,0.3);
}
.hcard-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
.hcard-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.hcard-name .icon { font-size: 1.1rem; }
.hcard-rows {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1rem;
    font-size: 0.75rem;
    color: var(--text-light);
}
.hcard-rows .val {
    color: var(--text);
    font-weight: 500;
}

/* ================================================================
   DEVICE DETAIL PANEL
   ================================================================ */
.detail-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    margin-bottom: 1.5rem;
    overflow: hidden;
    animation: slideDown 0.25s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.detail-panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.detail-panel-header .dp-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.detail-panel-header .dp-left h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
}
.detail-panel-header .dp-left p {
    font-size: 0.8rem;
    color: var(--text-light);
}
.detail-panel-header .dp-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.detail-panel-body {
    padding: 1.25rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
.dp-section h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}
.dp-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.8rem;
}
.dp-row .lbl {
    color: var(--text-light);
    min-width: 110px;
}
.dp-row .val {
    color: var(--text);
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

/* ================================================================
   POSTURE BAR
   ================================================================ */
.posture-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}
.posture-good { background: linear-gradient(135deg, #e8f8ef, #d4efdf); border: 1px solid #a3e0bf; }
.posture-warning { background: linear-gradient(135deg, #fef5e7, #fdebd0); border: 1px solid #f5d89a; }
.posture-critical { background: linear-gradient(135deg, #fde8e8, #fadbd8); border: 1px solid #f1948a; }
.posture-icon { font-size: 2rem; }
.posture-text h3 { font-size: 1rem; font-weight: 700; }
.posture-text p { font-size: 0.8rem; color: var(--text-light); }

/* ================================================================
   MODAL
   ================================================================ */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-backdrop.active { display: flex; }
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
}
.modal h3 {
    font-size: 1.125rem;
    margin-bottom: 1.25rem;
}
.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}
.modal-actions .btn { width: auto; }
textarea.form-input {
    min-height: 100px;
    resize: vertical;
}

/* ================================================================
   ONBOARDING / FIRST-LOGIN
   ================================================================ */
.welcome-banner {
    background: linear-gradient(135deg, var(--navy) 0%, #3d5068 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
}
.welcome-banner-icon { font-size: 2rem; }
.welcome-banner h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.15rem; }
.welcome-banner p { font-size: 0.82rem; opacity: 0.8; margin: 0; }
.onboarding-steps {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.onboarding-step {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.125rem 1.25rem;
    box-shadow: var(--shadow);
}
.onboarding-step-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.onboarding-step-num {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.onboarding-step-icon { font-size: 1.25rem; }
.onboarding-step h4 { font-size: 0.9rem; font-weight: 600; color: var(--navy); }
.onboarding-step p { font-size: 0.82rem; color: var(--text-light); line-height: 1.5; margin-bottom: 0.75rem; }
.onboarding-step-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
}
.onboarding-step .btn {
    margin-top: 0.75rem;
    font-size: 0.78rem;
    padding: 0.45rem 1rem;
}

/* ================================================================
   SERVICE STATUS CARDS
   ================================================================ */
.svc-status-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.svc-status-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.125rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.svc-status-card.enrolled { border-left: 3px solid var(--success); }
.svc-status-card.not-enrolled { border-left: 3px solid var(--border); opacity: 0.85; }
.svc-status-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.svc-status-card-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.badge-enrolled {
    display: inline-block;
    font-size: 0.65rem; font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 99px;
    background: #d4edda; color: #155724;
    white-space: nowrap;
}
.badge-not-enrolled {
    display: inline-block;
    font-size: 0.65rem; font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 99px;
    background: var(--bg); color: var(--text-muted);
    white-space: nowrap;
}
.svc-status-card-desc {
    font-size: 0.77rem;
    color: var(--text-light);
    line-height: 1.4;
    flex: 1;
}
.svc-status-card .btn-buy {
    display: inline-block;
    font-size: 0.72rem; font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    background: var(--gold); color: var(--navy);
    text-decoration: none; border: none; cursor: pointer;
    align-self: flex-start;
    margin-top: 0.25rem;
    transition: background var(--transition);
}
.svc-status-card .btn-buy:hover { background: var(--gold-light); }

/* ================================================================
   TEAM MANAGEMENT
   ================================================================ */
.team-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.team-card {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
    padding: 1rem; display: flex; align-items: center; gap: 12px;
}
.team-card-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: #FAF7F2; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.team-card-info { flex: 1; min-width: 0; }
.team-card-name { font-size: 14px; font-weight: 500; color: #2E3D50; }
.team-card-email { font-size: 12px; color: #5C6A7A; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-card-role { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: #E1F5EE; color: #085041; }
.team-card-role.end-user { background: #f0f0f0; color: #666; }
.device-assign-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.device-assign-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 1rem; }
.device-assign-name { font-size: 14px; font-weight: 500; color: #2E3D50; margin-bottom: 8px; }
.device-assign-select {
    width: 100%; padding: 8px 12px; border: 1px solid #ddd;
    border-radius: 6px; font-size: 13px; background: #fff; min-height: 44px;
}

/* ================================================================
   BACKUP SECTION
   ================================================================ */
.backup-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1.25rem; }
.backup-stat { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 1rem; }
.backup-stat-label { font-size: 12px; color: #5C6A7A; margin-bottom: 4px; }
.backup-stat-value { font-size: 20px; font-weight: 600; color: #2E3D50; }
.backup-stat-sub { font-size: 11px; color: #5C6A7A; margin-top: 2px; }
.backup-cols { display: grid; grid-template-columns: 1fr; gap: 16px; }
.backup-job {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid #f0f0f0;
}
.backup-job-icon {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.backup-job-icon.success { background: #E1F5EE; color: #085041; }
.backup-job-icon.failed { background: #FCEBEB; color: #791F1F; }
.backup-job-icon.running { background: #E8F0FE; color: #1a56db; }
.backup-tree { font-size: 13px; }
.backup-tree-drive { margin-bottom: 8px; }
.backup-tree-folder {
    display: flex; align-items: center; gap: 6px;
    padding: 3px 0; padding-left: 20px; cursor: pointer;
}
.backup-tree-folder:hover { background: #f8f9fa; border-radius: 4px; }
.backup-tree-folder input[type=checkbox] { margin: 0; min-width: 20px; min-height: 20px; }
.backup-tree-folder.locked { opacity: 0.7; cursor: default; }
.backup-tree-folder.locked input { pointer-events: none; }
.backup-quota-bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin: 8px 0; }
.backup-quota-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.backup-upgrade-modal {
    display: none; position: fixed; inset: 0; z-index: 10000;
    background: rgba(46,61,80,0.55);
    align-items: center; justify-content: center; padding: 1rem;
}
.backup-upgrade-modal.active { display: flex; }

/* ================================================================
   RESPONSIVE — TABLET (768px+)
   ================================================================ */
@media (min-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .hcard-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
    .svc-status-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .onboarding-steps { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
    .team-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
    .device-assign-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
    .backup-cols { grid-template-columns: 1fr 1fr; }
    .detail-panel-body { grid-template-columns: 1fr 1fr; gap: 2rem; }
    .welcome-banner {
        flex-direction: row;
        text-align: left;
        padding: 1.75rem 2rem;
        gap: 1.25rem;
    }
}

/* ================================================================
   RESPONSIVE — DESKTOP (1024px+) — Sidebar visible, bottom nav hidden
   ================================================================ */
@media (min-width: 1024px) {
    /* Hide mobile elements */
    .bottom-nav { display: none; }
    .mobile-header { display: none; }

    /* Show sidebar */
    .sidebar {
        display: flex;
        flex-direction: column;
        width: var(--sidebar-width);
        background: var(--sb-bg);
        color: var(--sb-text);
        position: fixed;
        top: 0; left: 0; bottom: 0;
        z-index: 100;
    }

    /* Re-layout app content */
    .app-content {
        padding-top: 0;
        padding-bottom: 0;
        margin-left: var(--sidebar-width);
    }

    /* Desktop header inside main */
    .main-header {
        display: flex;
    }

    /* Larger padding */
    .main-body { padding: 1.5rem; }

    /* Wider stat grid */
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
    .stat-card { padding: 1.25rem; gap: 1rem; }
    .stat-value { font-size: 1.5rem; }
    .stat-icon { width: 48px; height: 48px; }
    .status-bars { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

    /* Bottom sheet becomes centered modal on desktop */
    .sheet {
        left: 50%;
        right: auto;
        bottom: auto;
        top: 50%;
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0;
        border-radius: var(--radius-xl);
        width: 420px;
        max-height: 70vh;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }
    .sheet.active {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    .sheet-handle { display: none; }
}

/* ================================================================
   DESKTOP SIDEBAR STYLES (only rendered at 1024px+)
   ================================================================ */
.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #D1D1D1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-brand img { height: 36px; }
.sidebar-brand span {
    font-size: 0.65rem;
    color: var(--sb-text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}
.nav-section-label {
    padding: 0.75rem 1.5rem 0.35rem;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--sb-text-dim);
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: var(--sb-text);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    opacity: 0.75;
}
.nav-item:hover {
    background: var(--sb-hover);
    opacity: 1;
}
.nav-item.active {
    background: var(--sb-active-bg);
    opacity: 1;
    border-left-color: var(--sb-accent);
    color: var(--sb-accent);
}
.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #D1D1D1;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--sb-accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sb-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 0.65rem;
    color: var(--sb-text-dim);
}
.sidebar-logout {
    cursor: pointer;
    color: var(--sb-text-dim);
    padding: 0.25rem;
    transition: color var(--transition);
    background: none;
    border: none;
}
.sidebar-logout:hover { color: var(--sb-accent); }

/* ================================================================
   DESKTOP MAIN HEADER (sticky, only at 1024px+)
   ================================================================ */
.main-header {
    display: none;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}
.main-header .page-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--navy);
}
.main-header .page-subtitle {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 400;
}

/* ================================================================
   TOAST ANIMATION
   ================================================================ */
@keyframes slideIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}
/* ── Success Checklist widget: score ring + dropdown in the welcome banner ──
   Mobile-first: centered pill under the banner text; >=768px pinned top right. */
.sc-widget { margin: 0 auto; position: relative; display: inline-flex; align-items: center; flex-shrink: 0; }
.sc-toggle { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.3); border-radius: 24px; padding: 4px 12px 4px 4px; cursor: pointer; min-height: 44px; color: #fff; }
.sc-toggle:hover { background: rgba(255,255,255,0.16); }
.sc-panel { display: none; position: absolute; top: calc(100% + 8px); right: 50%; transform: translateX(50%); z-index: 5000; width: 86vw; max-width: 380px; background: #fff; border: 1px solid #e2e6ec; border-radius: 10px; box-shadow: 0 16px 50px rgba(0,0,0,0.18); padding: 14px 16px; text-align: left; }
@media (min-width: 768px) {
    .sc-widget { margin: 0 0 0 auto; }
    .sc-panel { right: 0; transform: none; width: 380px; }
}
