/* =============================================
   AltSleep — Dashboard Styles
   Extends the base dark theme
   ============================================= */

/* =============================================
   Login Gate
   ============================================= */

.login-gate {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 30%, rgba(124,140,248,0.06) 0%, var(--bg) 70%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 48px 40px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header svg { margin-bottom: 20px; }
.login-header h2 { margin-bottom: 8px; font-size: 1.6rem; }
.login-header p { color: var(--text-muted); font-size: 0.95rem; }

/* =============================================
   User Greeting
   ============================================= */

.user-greeting {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

/* =============================================
   Onboarding Wizard
   ============================================= */

.onboard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 48px;
    padding: 0 20px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.35;
    transition: opacity 0.4s;
}

.progress-step.active { opacity: 1; }
.progress-step.done { opacity: 0.7; }

.step-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.progress-step.active .step-dot {
    background: var(--gradient-primary);
    border-color: transparent;
    box-shadow: 0 0 20px rgba(124,140,248,0.3);
}

.progress-step.done .step-dot {
    background: var(--accent-green);
    border-color: transparent;
}

.progress-step span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.progress-line {
    flex: 1;
    height: 2px;
    background: rgba(255,255,255,0.08);
    margin: 0 8px;
    margin-bottom: 28px;
}

.step-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: fadeInUp 0.4s ease-out;
}

.step-icon { font-size: 3rem; margin-bottom: 16px; }

.step-card h2 { margin-bottom: 12px; font-size: 1.5rem; }
.step-card > p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.7; }

.code-input {
    text-align: center;
    font-size: 1.3rem !important;
    letter-spacing: 0.15em;
    font-weight: 600;
    text-transform: uppercase;
}

/* Device discovery cards */
.device-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    text-align: left;
}

.discovered-device {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    border: 2px solid rgba(255,255,255,0.06);
    cursor: pointer;
    transition: all 0.3s;
}

.discovered-device:hover {
    border-color: rgba(124,140,248,0.3);
}

.discovered-device.claimed {
    border-color: var(--accent-green);
    background: rgba(52,211,153,0.06);
}

.discovered-device .dev-icon { font-size: 1.5rem; }
.discovered-device .dev-info { flex: 1; }
.discovered-device .dev-info strong { display: block; font-size: 0.95rem; }
.discovered-device .dev-info span { font-size: 0.82rem; color: var(--text-muted); }

.discovered-device .dev-check {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.3s;
}

.discovered-device.claimed .dev-check {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #fff;
}

.device-shimmer {
    height: 64px;
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--bg-elevated) 25%, rgba(255,255,255,0.04) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Plan cards */
.plan-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.plan-card {
    padding: 24px 20px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    border: 2px solid rgba(255,255,255,0.08);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.plan-card:hover { border-color: rgba(124,140,248,0.3); }

.plan-card.selected {
    border-color: var(--accent-blue);
    background: rgba(124,140,248,0.06);
}

.plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 12px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--gradient-primary);
    color: #fff;
}

.plan-badge.save { background: var(--gradient-warm); }

.plan-price {
    font-size: 2rem;
    font-weight: 800;
    margin: 8px 0 4px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.plan-price span {
    font-size: 0.9rem;
    font-weight: 500;
    -webkit-text-fill-color: var(--text-muted);
}

.plan-name { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* Select elem */
.form-select {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1.5px solid rgba(255,255,255,0.1);
    background: var(--bg-elevated);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    appearance: none;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(124,140,248,0.1);
}

/* =============================================
   Dashboard Stats Row
   ============================================= */

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(124,140,248,0.15);
}

.stat-icon { font-size: 1.8rem; }

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.stat-trend {
    margin-left: auto;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.stat-trend.up {
    background: rgba(244,114,182,0.1);
    color: var(--accent-coral);
}

.stat-trend.down {
    background: rgba(52,211,153,0.1);
    color: var(--accent-green);
}

.stat-trend.stable {
    background: rgba(124,140,248,0.1);
    color: var(--accent-blue);
}

/* =============================================
   Illness Banner
   ============================================= */

.illness-banner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 28px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(244,114,182,0.08) 0%, rgba(251,191,36,0.06) 100%);
    border: 1px solid rgba(244,114,182,0.2);
    margin-bottom: 24px;
    animation: fadeInUp 0.5s ease-out;
}

.illness-icon { font-size: 2.5rem; }

.illness-info { flex: 1; }
.illness-info strong { display: block; font-size: 1rem; margin-bottom: 4px; }
.illness-info p { color: var(--text-muted); font-size: 0.9rem; }

.illness-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* =============================================
   Tab System
   ============================================= */

.nav-tab {
    position: relative;
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0; right: 0;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.tab-panel { animation: fadeInUp 0.3s ease-out; }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.panel-header h2 { font-size: 1.4rem; }

.period-switcher {
    display: flex;
    gap: 4px;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    padding: 4px;
}

.period-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.period-btn.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.period-btn:hover:not(.active) { color: var(--text); }

/* =============================================
   Charts
   ============================================= */

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 16px;
}

.chart-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 0.95rem;
}

.chart-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.chart-area {
    height: 200px;
    position: relative;
}

.chart-area canvas {
    width: 100%;
    height: 100%;
}

/* =============================================
   Baseline Card
   ============================================= */

.baseline-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid rgba(255,255,255,0.06);
    margin-top: 16px;
}

.baseline-card h3 { margin-bottom: 20px; font-size: 1.05rem; }

.baseline-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.baseline-item { text-align: center; }

.baseline-val {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.baseline-lbl {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* =============================================
   Device Grid
   ============================================= */

.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.device-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.3s;
}

.device-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.device-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.device-header .dev-icon { font-size: 2rem; }
.device-header .dev-name { font-weight: 700; font-size: 1.05rem; }
.device-header .dev-type { font-size: 0.8rem; color: var(--text-muted); }

.device-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.device-status.online {
    background: rgba(52,211,153,0.1);
    color: var(--accent-green);
}

.device-status.offline {
    background: rgba(244,114,182,0.1);
    color: var(--accent-coral);
}

.device-status .status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.device-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.dev-stat {
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-elevated);
}

.dev-stat-val {
    font-size: 1.2rem;
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
}

.dev-stat-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* =============================================
   Order Timeline
   ============================================= */

.order-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.order-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 16px;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.order-id { font-weight: 700; font-size: 0.9rem; }

.order-status-badge {
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-ordered { background: rgba(124,140,248,0.1); color: var(--accent-blue); }
.badge-provisioning { background: rgba(167,139,250,0.1); color: var(--accent-purple); }
.badge-provisioned { background: rgba(167,139,250,0.15); color: var(--accent-purple); }
.badge-testing { background: rgba(251,191,36,0.1); color: var(--accent-gold); }
.badge-packaging { background: rgba(232,168,124,0.1); color: var(--accent-peach); }
.badge-shipped { background: rgba(110,220,217,0.1); color: var(--accent-cyan); }
.badge-delivered { background: rgba(52,211,153,0.1); color: var(--accent-green); }

.timeline-steps {
    display: flex;
    gap: 0;
    position: relative;
}

.timeline-step {
    flex: 1;
    text-align: center;
    position: relative;
    padding-top: 32px;
}

.timeline-step::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 0; right: 0;
    height: 3px;
    background: rgba(255,255,255,0.06);
}

.timeline-step:first-child::before { left: 50%; }
.timeline-step:last-child::before { right: 50%; }

.timeline-step.complete::before {
    background: var(--accent-green);
}

.timeline-step.current::before {
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
}

.timeline-dot {
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 3px solid rgba(255,255,255,0.1);
    z-index: 1;
}

.timeline-step.complete .timeline-dot {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.timeline-step.current .timeline-dot {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(124,140,248,0.4);
    animation: pulse-dot 2s infinite;
}

.timeline-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.timeline-step.complete .timeline-label {
    color: var(--accent-green);
}

.timeline-step.current .timeline-label {
    color: var(--accent-blue);
}

.timeline-date {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 4px;
}

.order-tracking {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    gap: 12px;
}

.order-tracking .tracking-label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.order-tracking .tracking-number {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--accent-cyan);
    text-decoration: none;
}

/* =============================================
   Alerts List
   ============================================= */

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.3s;
}

.alert-item:hover { border-color: rgba(124,140,248,0.15); }

.alert-item.unread {
    border-left: 3px solid var(--accent-blue);
}

.alert-item .alert-icon { font-size: 1.5rem; flex-shrink: 0; }

.alert-item .alert-content { flex: 1; }
.alert-item .alert-content strong { display: block; margin-bottom: 4px; font-size: 0.95rem; }
.alert-item .alert-content p { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; }
.alert-item .alert-time { font-size: 0.78rem; color: var(--text-light); white-space: nowrap; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 0.9rem; }

/* =============================================
   Symptom Modal
   ============================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
    width: 90%;
    max-width: 480px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.3s ease-out;
}

.modal-card h3 { margin-bottom: 8px; font-size: 1.3rem; }
.modal-card > p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 24px; }

.feeling-scale {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.feeling-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 2px solid rgba(255,255,255,0.08);
    background: var(--bg-elevated);
    cursor: pointer;
    font-family: var(--font);
    font-size: 1.5rem;
    transition: all 0.2s;
    color: var(--text);
}

.feeling-btn span { font-size: 0.65rem; font-weight: 600; color: var(--text-muted); }

.feeling-btn:hover { border-color: rgba(124,140,248,0.3); }

.feeling-btn.selected {
    border-color: var(--accent-blue);
    background: rgba(124,140,248,0.1);
    box-shadow: 0 0 12px rgba(124,140,248,0.2);
}

.symptom-checklist {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.symptom-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg-elevated);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.symptom-check:hover { background: rgba(255,255,255,0.05); }

.symptom-check input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent-blue);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions .btn { flex: 1; justify-content: center; }

/* =============================================
   Bed Control Tab
   ============================================= */

.bed-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.bed-side-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.3s;
}

.bed-side-card:hover {
    border-color: rgba(124,140,248,0.15);
    box-shadow: var(--shadow-glow);
}

.bed-side-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.bed-side-icon { font-size: 1.8rem; }
.bed-side-header h3 { margin: 0; font-size: 1.1rem; }

.pressure-display {
    text-align: center;
    margin-bottom: 16px;
}

.pressure-value-input {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: transparent;
    color: var(--text);
    border: none;
    outline: none;
    text-align: center;
    width: 90px;
    padding: 0;
    font-family: inherit;
    -moz-appearance: textfield;
    border-bottom: 2px dashed rgba(255,255,255,0.2);
    transition: all 0.2s;
}

.pressure-value-input:focus {
    border-bottom: 2px solid var(--accent-blue);
    color: var(--accent-blue);
}

.pressure-value-input::-webkit-outer-spin-button,
.pressure-value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pressure-unit {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Custom range slider */
.pressure-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(110,220,217,0.3), rgba(124,140,248,0.5), rgba(244,114,182,0.3));
    outline: none;
    margin-bottom: 20px;
}

.pressure-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    border: 3px solid var(--bg-card);
    box-shadow: 0 0 12px rgba(124,140,248,0.4);
    transition: transform 0.2s;
}

.pressure-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.pressure-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    border: 3px solid var(--bg-card);
    box-shadow: 0 0 12px rgba(124,140,248,0.4);
}

.bed-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bed-actions .btn { flex: 1; justify-content: center; min-width: 80px; }

/* Smart Inflation Card */
.smart-inflate-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    border: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 16px;
}

.smart-inflate-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.smart-inflate-header h3 { margin: 0 0 4px; font-size: 1.05rem; }
.smart-inflate-desc { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

.smart-inflate-config {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255,255,255,0.08);
    border-radius: 28px;
    transition: all 0.3s ease;
}

.toggle-track::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-track {
    background: var(--gradient-primary);
}

.toggle-switch input:checked + .toggle-track::before {
    transform: translateX(24px);
    background: #fff;
    box-shadow: 0 0 8px rgba(124,140,248,0.3);
}

/* Queue Badge */
.bed-queue-badge {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(251,191,36,0.15);
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Schedules Card */
.bed-schedules-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    border: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 16px;
}

.bed-schedules-card h3 { margin: 0; font-size: 1.05rem; }

.schedule-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.9rem;
}

.schedule-item:last-child { border-bottom: none; }
.schedule-item.disabled { opacity: 0.45; }

.sched-time {
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent-blue);
    min-width: 50px;
}

.sched-side {
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(124,140,248,0.1);
    color: var(--accent-blue);
}

.sched-pressure {
    font-weight: 700;
    min-width: 30px;
}

.sched-days {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.sched-label {
    color: var(--text-light);
    font-size: 0.82rem;
    margin-left: auto;
}

/* Bed History Card */
.bed-history-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    border: 1px solid rgba(255,255,255,0.06);
}

.bed-history-card h3 { margin: 0 0 16px; font-size: 1.05rem; }

.bed-cmd-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.85rem;
}

.bed-cmd-item:last-child { border-bottom: none; }

.cmd-type {
    font-weight: 600;
    color: var(--accent-cyan);
    text-transform: capitalize;
}

.cmd-side {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
}

.cmd-pressure { font-weight: 700; }
.cmd-time { margin-left: auto; font-size: 0.78rem; color: var(--text-light); }

.empty-hint {
    color: var(--text-light);
    font-size: 0.88rem;
    text-align: center;
    padding: 20px 0;
}

/* =============================================
   AI Report Card
   ============================================= */

.ai-report-card { border-color: rgba(168,85,247,0.15); }

.ai-credit-badge {
    font-size: 0.72rem; font-weight: 700; padding: 3px 8px;
    border-radius: 6px; background: rgba(168,85,247,0.12); color: #A855F7;
}
.ai-credit-badge.badge-green { background: rgba(34,197,94,0.12); color: #22C55E; }

.ai-questions-hint {
    padding: 10px 14px; border-radius: 8px; font-size: 0.82rem; font-weight: 600;
    background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.25);
    color: #8B5CF6; cursor: pointer; margin-bottom: 12px; transition: background 0.2s;
}
.ai-questions-hint:hover { background: rgba(139,92,246,0.18); }

.modal-lg { max-width: 720px; }

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.modal-header h3 { margin: 0; }

.ai-report-body {
    max-height: 70vh; overflow-y: auto; font-size: 0.92rem; line-height: 1.7; color: var(--text-muted);
}
.ai-report-body h1,.ai-report-body h2,.ai-report-body h3,.ai-report-body h4 {
    color: var(--text); margin: 18px 0 8px; font-size: 1.05rem;
}
.ai-report-body ul,.ai-report-body ol { padding-left: 20px; margin: 8px 0; }
.ai-report-body li { margin-bottom: 4px; }
.ai-report-body strong { color: var(--text); }
.ai-section { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.ai-section:last-child { border-bottom: none; }
.ai-questions-section { background: rgba(139,92,246,0.05); border-radius: 10px; padding: 16px; border: 1px solid rgba(139,92,246,0.15); }

/* =============================================
   Credits Grid
   ============================================= */

.credits-grid { display: flex; flex-direction: column; gap: 8px; }

.credit-tier-card {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-radius: 12px; cursor: pointer; transition: all 0.2s;
    background: var(--bg-elevated); border: 1px solid rgba(168,85,247,0.15);
}
.credit-tier-card:hover { border-color: rgba(168,85,247,0.4); transform: translateY(-1px); }
.credit-tier-card.tier-gold {
    border-color: rgba(234,179,8,0.35);
    background: linear-gradient(135deg, rgba(234,179,8,0.06), transparent);
}
.credit-tier-card.tier-gold:hover { border-color: rgba(234,179,8,0.6); }

.tier-left { display: flex; align-items: center; gap: 12px; }
.tier-credits { font-size: 1.3rem; font-weight: 800; color: #A855F7; min-width: 36px; }
.tier-credits.gold { color: #EAB308; }
.tier-left strong { font-size: 0.9rem; }
.tier-badge {
    display: inline-block; font-size: 0.65rem; font-weight: 800; padding: 2px 6px;
    border-radius: 4px; margin-left: 6px; background: rgba(34,197,94,0.15); color: #22C55E;
    vertical-align: middle;
}
.tier-badge.gold { background: rgba(234,179,8,0.15); color: #EAB308; }
.tier-per { font-size: 0.78rem; color: var(--text-light); }
.tier-price { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.tier-price.gold { color: #EAB308; }

/* =============================================
   Sleep Sessions List
   ============================================= */

.sessions-list { max-height: 400px; overflow-y: auto; }

.session-row {
    display: flex; align-items: center; gap: 16px; padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 0.85rem;
}
.session-row:last-child { border-bottom: none; }
.session-date { font-weight: 600; color: var(--text); min-width: 56px; }
.session-dur { color: var(--text-muted); min-width: 60px; }
.session-hr { color: #F87171; }
.session-spo2 { color: #34D399; }
.session-score {
    margin-left: auto; font-weight: 700; font-size: 0.82rem; padding: 2px 8px;
    border-radius: 6px; background: rgba(168,85,247,0.1); color: #A855F7;
}

/* =============================================
   Star Rating
   ============================================= */

.star-rating-row { display: flex; gap: 8px; justify-content: center; padding: 8px 0; }
.star-btn {
    font-size: 1.6rem; background: none; border: none; cursor: pointer;
    opacity: 0.4; transition: all 0.2s; padding: 4px;
}
.star-btn:hover { opacity: 1; transform: scale(1.2); }

/* =============================================
   Settings Forms
   ============================================= */

.settings-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-form .form-group { margin-bottom: 12px; }
.settings-form label { display: block; margin-bottom: 4px; font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }
.settings-form input[type="text"],
.settings-form input[type="number"],
.settings-form input[type="date"],
.settings-form select {
    width: 100%; padding: 10px 12px; background: var(--bg-elevated); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text); border-radius: 8px; font-family: var(--font); font-size: 0.9rem;
}
.settings-form input:focus, .settings-form select:focus {
    outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(124,140,248,0.1);
}

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

@media (max-width: 768px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .baseline-grid { grid-template-columns: repeat(2, 1fr); }
    .illness-banner { flex-direction: column; text-align: center; }
    .illness-actions { justify-content: center; }
    .timeline-steps { flex-direction: column; gap: 12px; }
    .timeline-step { padding-top: 0; padding-left: 40px; text-align: left; }
    .timeline-step::before { display: none; }
    .timeline-dot { left: 0; top: 50%; transform: translateY(-50%); }
    .plan-options { grid-template-columns: 1fr; }
    .symptom-checklist { grid-template-columns: 1fr; }
    .login-card { padding: 32px 24px; }
    .bed-grid { grid-template-columns: 1fr; }
    .settings-form .form-row { grid-template-columns: 1fr; }
    .session-row { flex-wrap: wrap; gap: 8px; }
    .modal-lg { max-width: 95%; }
}
