/* ═══════════════════════════════════════════════════════════════════
   ANDROMEDA MISSION CONTROL — Design System
   Dark theme: #0a0a0a bg · #141414 cards · #262626 borders
   Font: Inter (Google Fonts)
═══════════════════════════════════════════════════════════════════ */

/* ─── Google Fonts ─────────────────────────────────────────────── */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

/* ─── Design Tokens ─────────────────────────────────────────────── */
:root {
    /* Backgrounds */
    --bg-base:        #0a0a0a;
    --bg-card:        #141414;
    --bg-card-hover:  #1a1a1a;
    --bg-header:      rgba(10, 10, 10, 0.85);
    --bg-input:       #0f0f0f;
    --bg-skeleton:    #1c1c1c;

    /* Borders */
    --border-subtle:  #262626;
    --border-default: #333333;
    --border-focus:   #555555;

    /* Text */
    --text-primary:   #e8e8e8;
    --text-secondary: #888888;
    --text-muted:     #555555;
    --text-inverse:   #0a0a0a;

    /* Accent Colors */
    --accent-cyan:    #00d4ff;
    --accent-amber:   #f59e0b;
    --accent-green:   #22c55e;
    --accent-red:     #ef4444;
    --accent-yellow:  #eab308;

    /* Status Colors */
    --status-online:  #22c55e;
    --status-standby: #f59e0b;
    --status-offline: #555555;

    /* Glow Effects */
    --glow-cyan:   0 0 12px rgba(0, 212, 255, 0.25);
    --glow-amber:  0 0 12px rgba(245, 158, 11, 0.25);
    --glow-green:  0 0 8px  rgba(34, 197, 94, 0.4);
    --glow-red:    0 0 8px  rgba(239, 68, 68, 0.4);

    /* Spacing */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  16px;
    --space-lg:  24px;
    --space-xl:  32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Layout */
    --header-height: 60px;
    --max-width:     1280px;
    --radius-sm:     4px;
    --radius-md:     6px;
    --radius-lg:     8px;

    /* Transitions */
    --transition-fast:   150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow:   400ms ease;
}

/* ─── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-base);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

button {
    font-family: inherit;
    cursor: pointer;
}

/* ─── Utility ───────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ─── Starfield Background ──────────────────────────────────────── */
.starfield-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    background-color: #ffffff;
    border-radius: 50%;
}

/* ═══════════════════════════════════════════════════════════════════
   HEADER / NAVIGATION
═══════════════════════════════════════════════════════════════════ */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-xl);
    height: var(--header-height);
    gap: var(--space-xl);
}

/* Brand Logo */
.brand-logo {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.brand-logo:hover {
    color: var(--accent-cyan);
}

/* Desktop Nav Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex: 1;
    justify-content: center;
}

.nav-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    border-bottom: 2px solid transparent;
    transition: color var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.04);
}

/* Active nav link — set by router.js */
.nav-link.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}

/* Header Right: user greeting + hamburger */
.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
}

.user-greeting {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Logout Button — sits between user greeting and hamburger */
.btn-logout {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 5px 10px;
    white-space: nowrap;
}

/* Hamburger Button (mobile only) */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0;
    transition: border-color var(--transition-fast);
}

.hamburger:hover {
    border-color: var(--border-default);
}

.hamburger span {
    display: block;
    width: 16px;
    height: 1.5px;
    background-color: var(--text-secondary);
    border-radius: 1px;
    transition: background-color var(--transition-fast);
}

.hamburger:hover span {
    background-color: var(--text-primary);
}

/* Mobile Nav Drawer */
.mobile-nav {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-sm) 0;
}

.mobile-nav-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: var(--space-md) var(--space-xl);
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.mobile-nav-link:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.04);
}

.mobile-nav-link.active {
    color: var(--accent-cyan);
}

/* ═══════════════════════════════════════════════════════════════════
   MAIN CONTENT AREA
═══════════════════════════════════════════════════════════════════ */
.app-main {
    position: relative;
    z-index: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-xl);
    min-height: calc(100vh - var(--header-height));
}

/* Page sections — toggled by router.js */
.page {
    animation: page-fade-in 200ms ease;
}

@keyframes page-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Page Header ───────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
    flex-wrap: wrap;
}

.page-header-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.last-updated {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: 13px;
    font-weight: 500;
    padding: 9px var(--space-md);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
    white-space: nowrap;
    line-height: 1;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
    background-color: var(--accent-cyan);
    color: var(--text-inverse);
    border-color: var(--accent-cyan);
    width: 100%;
    padding: 11px var(--space-md);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.btn-primary:hover:not(:disabled) {
    background-color: #00b8d9;
    border-color: #00b8d9;
    box-shadow: var(--glow-cyan);
}

/* Ghost Button */
.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

.btn-ghost:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: var(--border-default);
    color: var(--text-primary);
}

/* Small Button */
.btn-sm {
    font-size: 12px;
    padding: 6px 10px;
}

/* ═══════════════════════════════════════════════════════════════════
   BANNERS (error, info)
═══════════════════════════════════════════════════════════════════ */
.error-banner,
.info-banner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: var(--space-xl);
    line-height: 1.5;
}

.error-banner {
    background-color: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.error-banner svg {
    flex-shrink: 0;
    color: var(--accent-red);
}

.info-banner {
    background-color: rgba(0, 212, 255, 0.06);
    border: 1px solid rgba(0, 212, 255, 0.2);
    color: var(--text-secondary);
}

.info-banner svg {
    flex-shrink: 0;
    color: var(--accent-cyan);
}

/* ═══════════════════════════════════════════════════════════════════
   AUTH PAGE
═══════════════════════════════════════════════════════════════════ */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - var(--header-height) - var(--space-3xl) * 2);
    padding-top: var(--space-3xl);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
}

.auth-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: var(--space-xs);
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.form-group label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.form-group input {
    background-color: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    padding: 9px var(--space-md);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    width: 100%;
}

.form-group input::placeholder {
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.04em;
}

.form-group input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.form-error {
    font-size: 12px;
    color: #fca5a5;
    background-color: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
}

.auth-switch {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin-top: var(--space-lg);
}

.auth-switch a {
    color: var(--text-secondary);
    font-weight: 500;
}

.auth-switch a:hover {
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════
   DASHBOARD — SERVICE HEALTH GRID
═══════════════════════════════════════════════════════════════════ */
.service-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

/* Service Card */
.service-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    transition: border-color var(--transition-normal), background-color var(--transition-normal), transform var(--transition-normal), box-shadow var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.service-card:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-default);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Status-specific card border accents */
.service-card.status-online:hover {
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.08);
}

.service-card.status-standby:hover {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.08);
}

/* Card Header Row */
.service-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.service-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.status-badge.online {
    background-color: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-badge.standby {
    background-color: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.offline {
    background-color: rgba(85, 85, 85, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(85, 85, 85, 0.2);
}

/* Status Dot (inside badge) */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online {
    background-color: var(--status-online);
    box-shadow: var(--glow-green);
    animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.standby {
    background-color: var(--status-standby);
    box-shadow: var(--glow-amber);
}

.status-dot.offline {
    background-color: var(--status-offline);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* Card Meta Info */
.service-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.service-meta-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.service-meta-label {
    color: var(--text-muted);
    min-width: 36px;
}

.service-meta-value {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Skeleton Loading Cards */
.service-card.skeleton {
    pointer-events: none;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.service-card.skeleton::before {
    content: "";
    display: block;
    height: 14px;
    width: 60%;
    background-color: var(--bg-skeleton);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
}

.service-card.skeleton::after {
    content: "";
    display: block;
    height: 10px;
    width: 40%;
    background-color: var(--bg-skeleton);
    border-radius: var(--radius-sm);
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ═══════════════════════════════════════════════════════════════════
   QUICK LINKS PAGE
═══════════════════════════════════════════════════════════════════ */
.links-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}

/* Link Tile */
.link-tile {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    text-decoration: none;
    color: inherit;
    transition: border-color var(--transition-normal), background-color var(--transition-normal), transform var(--transition-normal), box-shadow var(--transition-normal);
    position: relative;
    overflow: hidden;
    /* Keyboard focus ring — visible for keyboard nav, hidden for mouse */
    outline: none;
}

/* Visible focus ring for keyboard navigation */
.link-tile:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.15);
}

.link-tile:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-default);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    color: inherit;
}

/* Online tile gets a subtle cyan accent on hover */
.link-tile.status-online:hover {
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.06);
}

/* Offline tile is visually dimmed */
.link-tile.status-offline {
    opacity: 0.6;
}

.link-tile.status-offline:hover {
    opacity: 0.8;
}

/* Tile Icon */
.link-tile-icon {
    font-size: 24px;
    line-height: 1;
    margin-bottom: var(--space-xs);
}

/* Tile Header Row */
.link-tile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.link-tile-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Tile Status Dot (small, top-right) */
.link-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.link-status-dot.online {
    background-color: var(--status-online);
    box-shadow: var(--glow-green);
}

.link-status-dot.standby {
    background-color: var(--status-standby);
}

.link-status-dot.offline {
    background-color: var(--status-offline);
}

/* Tile Description */
.link-tile-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* External link arrow indicator */
.link-tile-arrow {
    margin-top: auto;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color var(--transition-fast);
}

.link-tile:hover .link-tile-arrow {
    color: var(--accent-cyan);
}

/* ═══════════════════════════════════════════════════════════════════
   SYSTEM OVERVIEW PAGE
═══════════════════════════════════════════════════════════════════ */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

/* Chart Card */
.chart-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    transition: border-color var(--transition-normal);
}

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

.chart-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.chart-icon {
    font-size: 16px;
    line-height: 1;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.chart-badge {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 20px;
}

.chart-badge.pending {
    background-color: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Chart Placeholder Container
 * ─────────────────────────────────────────────────────────────────
 * DROP-IN READY: to replace with a real chart, remove the inner
 * .chart-hint-bars and .chart-placeholder-label, then insert a
 * <canvas> or chart library element. The container's fixed height,
 * flex centering, and overflow:hidden will contain it automatically.
 * ─────────────────────────────────────────────────────────────────
 */
.chart-placeholder {
    height: 160px;
    background-color: var(--bg-base);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    position: relative;
    overflow: hidden;
}

/* When a real chart canvas is the only child, remove the flex gap */
.chart-placeholder > canvas:only-child {
    width: 100%;
    height: 100%;
}

/* Subtle animated scan line for visual interest */
.chart-placeholder::after {
    content: "";
    position: absolute;
    inset: 0;
    left: -60%;
    width: 60%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.025), transparent);
    animation: chart-scan 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes chart-scan {
    0%   { left: -60%; }
    100% { left: 160%; }
}

/* Decorative hint bars — removed when a real chart is dropped in */
.chart-hint-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 60px;
    z-index: 1;
    opacity: 0.18;
}

.chart-hint-bars span {
    display: block;
    width: 8px;
    background-color: var(--accent-cyan);
    border-radius: 2px 2px 0 0;
    flex-shrink: 0;
}

/* Donut variant — wider bars for storage-style hint */
.chart-hint-bars--donut span {
    width: 18px;
    border-radius: var(--radius-sm);
}

.chart-placeholder-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    z-index: 1;
    text-align: center;
}

/* Chart badge — "live" variant for when data is connected */
.chart-badge.live {
    background-color: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.chart-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    row-gap: 2px;
}

.chart-meta-item {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 4px;
}

/* Key label inside meta item */
.chart-meta-key {
    color: var(--text-muted);
    font-weight: 500;
}

.chart-meta-key::after {
    content: ":";
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
═══════════════════════════════════════════════════════════════════ */

/* Tablet: ≤ 1024px */
@media (max-width: 1024px) {
    .service-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .links-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .chart-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: ≤ 768px */
@media (max-width: 768px) {
    /* Show hamburger, hide desktop nav */
    .nav-links {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .header-inner {
        padding: 0 var(--space-lg);
    }

    .app-main {
        padding: var(--space-xl) var(--space-lg);
    }

    /* Single column service grid */
    .service-grid {
        grid-template-columns: 1fr;
    }

    /* 2-column links grid */
    .links-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Single column chart grid */
    .chart-grid {
        grid-template-columns: 1fr;
    }

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

    .page-header-right {
        width: 100%;
        justify-content: space-between;
    }
}

/* Small Mobile: ≤ 480px */
@media (max-width: 480px) {
    .links-grid {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: var(--space-xl);
    }

    .brand-logo {
        font-size: 16px;
    }

    /* Prevent page title from overflowing on very small screens */
    .page-title {
        font-size: 18px;
    }

    /* Tighten main padding on very small screens */
    .app-main {
        padding: var(--space-lg) var(--space-md);
    }

    /* Prevent chart placeholder label from wrapping awkwardly */
    .chart-placeholder-label {
        font-size: 9px;
        letter-spacing: 0.06em;
        padding: 0 var(--space-sm);
    }

    /* Ensure info-banner text wraps cleanly */
    .info-banner {
        font-size: 12px;
        padding: var(--space-sm) var(--space-md);
    }

    /* Ensure error-banner text wraps cleanly */
    .error-banner {
        font-size: 12px;
        padding: var(--space-sm) var(--space-md);
    }

    /* Prevent link tile icon from being clipped */
    .link-tile-icon {
        font-size: 20px;
    }

    /* Tighten link tile padding */
    .link-tile {
        padding: var(--space-md);
    }

    /* Tighten chart card padding */
    .chart-card {
        padding: var(--space-md);
    }

    /* Tighten service card padding */
    .service-card {
        padding: var(--space-md);
    }

    /* Prevent header-right from overflowing */
    .header-right {
        gap: var(--space-sm);
    }

    /* Ensure user greeting doesn't push hamburger off screen */
    .user-greeting {
        display: none;
    }
}

/* ─── Global overflow guard ─────────────────────────────────────── */
/* Prevent any element from causing horizontal scroll */
.page,
.service-grid,
.links-grid,
.chart-grid,
.page-header,
.auth-container {
    max-width: 100%;
}

/* Ensure images and media never overflow their containers */
img, svg {
    max-width: 100%;
    height: auto;
}

/* Canvas inside chart-placeholder fills the container exactly */
.chart-placeholder canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: none;
}

/* Non-clickable link tile (e.g. Home Assistant — not configured) */
.link-tile.no-link {
    cursor: default;
    pointer-events: none;
    opacity: 0.5;
}

/* ═══════════════════════════════════════════════════════════════════
   ABOUT PAGE
═══════════════════════════════════════════════════════════════════ */

/* ── Hero ─────────────────────────────────────────────────────── */
.about-hero {
    margin-bottom: var(--space-3xl);
    padding-bottom: var(--space-2xl);
    border-bottom: 1px solid var(--border-subtle);
}

.about-hero-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    line-height: 1.2;
}

.about-hero-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 680px;
}

/* ── Section ──────────────────────────────────────────────────── */
.about-section {
    margin-bottom: var(--space-3xl);
}

.about-section-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-cyan);
    margin-bottom: var(--space-xl);
}

.about-body-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 720px;
}

.about-body-text code {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 12px;
    background-color: rgba(0, 212, 255, 0.08);
    color: var(--accent-cyan);
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid rgba(0, 212, 255, 0.15);
}

/* ── Architecture Diagram ─────────────────────────────────────── */
.arch-diagram {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: var(--space-xl);
    padding: var(--space-xl);
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.arch-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background-color: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    min-width: 90px;
    text-align: center;
    flex-shrink: 0;
}

.arch-node-icon {
    font-size: 20px;
    line-height: 1;
}

.arch-node-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    white-space: nowrap;
}

.arch-node-label small {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 1px;
}

.arch-arrow {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: var(--accent-cyan);
}

.arch-arrow-line {
    display: block;
    width: 24px;
    height: 1px;
    background-color: var(--accent-cyan);
    opacity: 0.5;
}

.arch-arrow-head {
    font-size: 10px;
    color: var(--accent-cyan);
    margin-left: -2px;
    opacity: 0.8;
}

/* ── Tech Stack Grid ──────────────────────────────────────────── */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.stack-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-normal);
}

.stack-item:hover {
    border-color: var(--border-default);
}

.stack-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.stack-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.stack-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── Feature Cards ────────────────────────────────────────────── */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.feature-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    transition: border-color var(--transition-normal);
}

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

.feature-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.feature-icon {
    font-size: 18px;
    line-height: 1;
}

.feature-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.feature-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Troubleshooting Details/Summary ─────────────────────────── */
.trouble-details {
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-md);
    margin-top: auto;
}

.trouble-summary {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: color var(--transition-fast);
}

.trouble-summary::-webkit-details-marker {
    display: none;
}

.trouble-summary::before {
    content: "▶";
    font-size: 8px;
    transition: transform var(--transition-fast);
}

details[open] .trouble-summary::before {
    transform: rotate(90deg);
}

.trouble-summary:hover {
    color: var(--text-secondary);
}

.trouble-body {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-top: var(--space-md);
    padding: var(--space-md);
    background-color: rgba(245, 158, 11, 0.04);
    border: 1px solid rgba(245, 158, 11, 0.12);
    border-radius: var(--radius-sm);
}

.trouble-body code {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 11px;
    background-color: rgba(0, 212, 255, 0.08);
    color: var(--accent-cyan);
    padding: 1px 4px;
    border-radius: 3px;
    border: 1px solid rgba(0, 212, 255, 0.15);
}

/* ── About Page Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
    .about-hero-title {
        font-size: 22px;
    }

    .arch-diagram {
        padding: var(--space-md);
    }

    .arch-node {
        min-width: 72px;
        padding: var(--space-sm) var(--space-md);
    }

    .arch-arrow-line {
        width: 12px;
    }

    .stack-grid {
        grid-template-columns: 1fr;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .about-hero-title {
        font-size: 18px;
    }

    .arch-node-label {
        font-size: 9px;
    }

    .arch-node-icon {
        font-size: 16px;
    }
}

/* ─── Focus rings for all interactive elements ──────────────────── */
/* Buttons */
.btn:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

/* Nav links */
.nav-link:focus-visible,
.mobile-nav-link:focus-visible,
.brand-logo:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Form inputs */
.form-group input:focus-visible {
    outline: none; /* handled by border-color + box-shadow on :focus */
}

/* Hamburger */
.hamburger:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}
