@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Tokyo Night inspired — soft blue accent on deep navy */
    --green:          #7aa2f7;   /* accent: soft periwinkle blue */
    --green-dim:      #b4cafe;   /* accent light: for text on dark */
    --green-bg:       #1a1f3a;   /* accent bg: dark navy tint */
    --green-border:   #2d3c6e;   /* accent border: medium navy */
    --text-primary:   #c0caf5;   /* slightly blue-tinted white */
    --text-secondary: #9aa5ce;   /* muted blue-gray */
    --text-muted:     #565f89;   /* dim blue-gray */
    --text-faint:     #3b4261;   /* very faint */
    --bg-page:        #0f1117;   /* deep dark navy */
    --bg-surface:     #16161e;   /* surface layer */
    --bg-elevated:    #1c1d2e;   /* elevated panels */
    --bg-nav:         #13131c;   /* nav bar */
    --border:         #292e42;   /* subtle navy border */
    --border-focus:   #3d5098;   /* focused: brighter blue */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
}

/* ── Nav ─────────────────────────────────────────────────────────────────── */
nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
}
nav .brand {
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
    color: var(--text-primary);
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.nav-links { display: flex; gap: 1rem; }
.nav-links a { color: var(--text-secondary); text-decoration: none; font-size: 0.95rem; }
.nav-links a:hover { color: var(--text-primary); }

/* ── Brand name spans ────────────────────────────────────────────────────── */
.brand-robo { color: var(--text-secondary); }
.brand-gate { color: var(--green); }
.brand-icon { width: 22px; height: 22px; vertical-align: middle; flex-shrink: 0; }

/* ── Main ────────────────────────────────────────────────────────────────── */
main {
    padding: 2rem 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

h1 { font-size: 1.6rem; margin-bottom: 1.5rem; font-weight: 600; }

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
}
.stat-card h2 { font-size: 2.4rem; font-weight: 700; color: var(--green); }
.stat-card p  { color: var(--text-muted); margin-top: 0.3rem; font-size: 0.9rem; }

/* ── Table ───────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.7rem 1rem; text-align: left; border-bottom: 1px solid var(--bg-elevated); }
th { background: var(--bg-nav); font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover td { background: var(--bg-elevated); }
code { font-family: monospace; font-size: 0.88rem; color: #a78bfa; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge-green  { background: var(--green-bg); color: var(--green); }
.badge-red    { background: #450a0a; color: #f87171; }
.badge-blue   { background: #1e3a5f; color: #60a5fa; }
.badge-yellow { background: #2a2112; color: #fbbf24; }
.badge-gray   { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin-bottom: 0.25rem; }
.page-subtitle { color: var(--text-muted); font-size: 0.88rem; }

/* ── Form card ───────────────────────────────────────────────────────────── */
.form-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
}
.form-title { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 1rem; }
.form-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; min-width: 160px; }
.form-group label { font-size: 0.8rem; color: var(--text-secondary); }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.45rem 0.7rem;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus { border-color: var(--border-focus); }
.form-group select option { background: var(--bg-surface); }
.form-group-check { justify-content: flex-end; padding-bottom: 0.2rem; }
.form-group-check label { display: flex; align-items: center; gap: 0.4rem; color: var(--text-secondary); font-size: 0.88rem; cursor: pointer; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary  { background: var(--green); color: #060c22; }
.btn-danger   { background: #7f1d1d; color: #fca5a5; }
.btn-sm       { padding: 0.25rem 0.65rem; font-size: 0.78rem; }

/* ── Alert ───────────────────────────────────────────────────────────────── */
.alert {
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
}
.alert-key {
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    color: var(--green-dim);
}
.alert-key code { font-family: monospace; }
.key-value {
    display: block;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-page);
    border: 1px solid var(--green-border);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--green);
    word-break: break-all;
}

/* ── Nav extras ─────────────────────────────────────────────────────────── */
.nav-user { color: var(--text-faint); font-size: 0.85rem; }
.nav-sep  { color: var(--border); }
.nav-active { color: var(--text-primary) !important; }
.nav-portal { color: var(--text-secondary) !important; }
.nav-admin  { color: var(--green) !important; }
/* ── User pill (nav top-right) ───────────────────────────────────── */
.nav-user-pill {
    margin-left: auto;
    position: relative;
    list-style: none;
}
.nav-user-pill > summary {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    transition: border-color 0.15s, color 0.15s;
    list-style: none;
}
.nav-user-pill > summary::-webkit-details-marker { display: none; }
.nav-user-pill > summary::marker { display: none; }
.nav-user-pill > summary:hover { border-color: var(--border-focus); color: var(--text-primary); }
.pill-email { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-chevron {
    width: 14px; height: 14px; flex-shrink: 0;
    transition: transform 0.15s;
}
.nav-user-pill[open] .pill-chevron { transform: rotate(180deg); }
.pill-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    min-width: 170px;
    background: var(--bg-nav);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.35rem;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.pill-item {
    display: block;
    padding: 0.5rem 0.85rem;
    border-radius: 7px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
}
.pill-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.pill-item-admin { color: var(--green); }
.pill-item-admin:hover { color: var(--green); }
.pill-item-danger { color: #f87171; }
.pill-item-danger:hover { background: #2f1212; color: #fca5a5; }
/* ── Home / landing ───────────────────────────────────────────────────────── */
.home-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-page);
    padding: 4rem 1.5rem 3rem;
}
.home-hero {
    text-align: center;
    max-width: 580px;
    margin-bottom: 4rem;
}
.home-brand { margin-bottom: 1rem; line-height: 1; }
.home-brand-icon { width: 72px; height: 72px; }
.home-title { font-size: 2.2rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.75rem; }
.home-sub   { color: var(--text-muted); font-size: 1rem; margin-bottom: 2rem; line-height: 1.6; }
.home-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.home-signed-in { margin-top: 1.25rem; font-size: 0.88rem; color: var(--text-faint); }
.home-signed-in a { color: #60a5fa; text-decoration: none; }
.home-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    max-width: 760px;
    width: 100%;
}
.home-feature {
    background: var(--bg-nav);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}
.home-feature h3   { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.home-feature p    { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; }

/* ── Button variants ──────────────────────────────────────────────────────── */
.btn-lg      { padding: 0.65rem 1.5rem; font-size: 1rem; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--border-focus); color: var(--text-primary); opacity: 1; }

/* ── Auth pages ────────────────────────────────────────────────────────── */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-page);
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-nav);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2.5rem 2rem;
    margin: 1rem;
}
.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
    text-decoration: none;
}
.auth-brand-icon { width: 28px; height: 28px; flex-shrink: 0; }
.auth-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    text-align: center;
    color: var(--text-primary);
}
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-form .form-group { min-width: unset; }
.btn-full { width: 100%; margin-top: 0.5rem; padding: 0.6rem 1rem; font-size: 0.95rem; }
.auth-error {
    background: #3b0a0a;
    border: 1px solid #7f1d1d;
    color: #fca5a5;
    border-radius: 7px;
    padding: 0.65rem 0.9rem;
    font-size: 0.88rem;
    margin-bottom: 1rem;
}
.auth-errors {
    background: #3b0a0a;
    border: 1px solid #7f1d1d;
    color: #fca5a5;
    border-radius: 7px;
    padding: 0.65rem 0.9rem 0.65rem 1.5rem;
    font-size: 0.88rem;
    margin-bottom: 1rem;
}
.auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.auth-switch a { color: #60a5fa; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.hint { font-size: 0.75rem; color: var(--text-faint); font-weight: 400; }

/* ── Flash banners ────────────────────────────────────────────────────────── */
.flash {
    border-radius: 8px;
    padding: 0.85rem 1.2rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.flash-success { background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green-dim); }
.flash-error   { background: #2f1c1c; border: 1px solid #7f1d1d; color: #fca5a5; }
.flash-info    { background: #1c2340; border: 1px solid #2d4a8a; color: #93c5fd; }

/* ── Loading overlay ──────────────────────────────────────────────────────── */
#loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
}
#loading-overlay.active { display: flex; }
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ── Section card ─────────────────────────────────────────────────────────── */
.section-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 2rem;
    overflow: hidden;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}
.section-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}
.section-body { padding: 1.5rem; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-faint);
}
.empty-state p { font-size: 0.9rem; color: var(--text-faint); margin-bottom: 1.25rem; }

/* ── Provider / Integration cards ────────────────────────────────────────── */
.provider-list { display: flex; flex-direction: column; gap: 1rem; }
.provider-card {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.provider-card .provider-icon {
    font-size: 1.8rem;
    line-height: 1;
    flex-shrink: 0;
}
.provider-card .provider-info { flex: 1; min-width: 140px; }
.provider-card .provider-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}
.provider-card .provider-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}
.provider-card .provider-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ── Wizard ───────────────────────────────────────────────────────────────── */
.wizard-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 2rem;
}
.wizard-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--text-faint);
}
.wizard-step.active { color: var(--text-primary); }
.wizard-step.done   { color: var(--green); }
.wizard-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}
.wizard-step.active .wizard-step-num { background: var(--green); color: #060c22; }
.wizard-step.done   .wizard-step-num { background: var(--green-bg); color: var(--green); }
.wizard-sep {
    flex: 1;
    height: 1px;
    background: var(--border);
    margin: 0 0.75rem;
    max-width: 80px;
}

/* ── ESP device table extras ─────────────────────────────────────────────── */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
}
.dot-online  { background: var(--green); box-shadow: 0 0 6px rgba(122, 162, 247, 0.5); }
.dot-offline { background: var(--text-faint); }

/* ── Vacuum cards ────────────────────────────────────────────────────────── */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}
.vacuum-card {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: border-color 0.15s;
}
.vacuum-card:hover { border-color: var(--border-focus); }
.vacuum-card .vc-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.vacuum-card .vc-gate-state { font-size: 0.78rem; color: var(--text-secondary); display: flex; align-items: center; gap: 0.35rem; }
.gate-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.gate-dot-closed { background: #22c55e; }
.gate-dot-open   { background: #f87171; }
.gate-dot-unassigned { background: #888; }
.vacuum-card .vc-meta  { font-size: 0.82rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 0.25rem; }
.vacuum-card .vc-footer {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--bg-elevated);
    font-size: 0.8rem;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.vacuum-card .vc-esp-controls {
    padding-top: 0.6rem;
    border-top: 1px solid var(--bg-elevated);
}
.vacuum-card .vc-select {
    flex: 1;
    min-width: 0;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.3rem 0.55rem;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.15s;
}
.vacuum-card .vc-select:focus { border-color: var(--border-focus); }
.vacuum-card .vc-select option { background: var(--bg-surface); }

/* ── Vacuum status badges ─────────────────────────────────────────────────── */
.badge-idle     { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-cleaning { background: var(--green-bg); color: var(--green); }
.badge-charging { background: #1e3a5f; color: #60a5fa; }
.badge-returning{ background: #2a1f12; color: #fb923c; }
.badge-docking  { background: #2a1f12; color: #fb923c; }
.badge-paused   { background: #2a2112; color: #fbbf24; }
.badge-error    { background: #450a0a; color: #f87171; }
.badge-unknown  { background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Claim form ──────────────────────────────────────────────────────────── */
.claim-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}
.claim-form .form-group { flex: 1; min-width: 200px; }

/* ── Unpaired ESP warning dot ───────────────────────────────────────────── */
.esp-warn-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f87171;
    box-shadow: 0 0 0 0 rgba(248,113,113,0.5);
    animation: warn-pulse 2s infinite;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 0.4rem;
    flex-shrink: 0;
    position: relative;
    border: none;
    padding: 0;
    outline: none;
}
@keyframes warn-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(248,113,113,0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(248,113,113,0);    }
    100% { box-shadow: 0 0 0 0   rgba(248,113,113,0);    }
}
.esp-warn-dot::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #2f1212;
    border: 1px solid #7f1d1d;
    color: #fca5a5;
    font-size: 0.75rem;
    white-space: nowrap;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 50;
}
.esp-warn-dot:hover::after,
.esp-warn-dot:focus::after,
.esp-warn-dot.tip-visible::after { opacity: 1; }

/* ── Setup-ESP modal (native <dialog>) ────────────────────────────────────── */
.esp-modal {
    background: var(--bg-nav);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0;
    min-width: 340px;
    max-width: 480px;
    width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    color: var(--text-primary);
}
.esp-modal::backdrop {
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
}
.esp-modal-inner { padding: 1.5rem; }
.esp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.esp-modal-header h3 { font-size: 1rem; font-weight: 600; }
.esp-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.2rem;
    transition: color 0.15s;
}
.esp-modal-close:hover { color: var(--text-primary); }

/* ── Responsive tweaks ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    main { padding: 1rem 0.75rem; }
    .provider-card { flex-direction: column; align-items: flex-start; }
    .section-header { flex-wrap: wrap; gap: 0.6rem; }
    .section-header > div:last-child { width: 100%; }
    .section-header > div:last-child form,
    .section-header > div:last-child button { flex: 1; }
    .page-header { flex-direction: column; align-items: flex-start !important; gap: 0.75rem; }
    .page-header .btn { width: 100%; justify-content: center; }
    .pill-email { max-width: 140px; }
    /* Modal edge-to-edge on small screens */
    .esp-modal { width: 95vw; min-width: unset; }
    /* Warning dot tooltip: open downward on mobile to avoid going off-screen */
    .esp-warn-dot::after {
        bottom: auto;
        top: calc(100% + 8px);
    }
    /* Comfortable tap targets */
    .btn { min-height: 40px; }
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"],
    .form-group select,
    .vc-select {
        min-height: 40px;
    }
}

/* ── Vacuum table → card stack on mobile ──────────────────────────────── */
@media (max-width: 768px) {
    .vac-table-wrap { overflow-x: visible !important; }
    .vac-table { display: block; width: 100%; }
    .vac-table thead { display: none; }
    .vac-table tbody { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.75rem; }
    .vac-table tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--bg-elevated);
        overflow: hidden;
    }
    .vac-table td {
        display: block;
        padding: 0.55rem 0.85rem;
        border-bottom: 1px solid var(--border);
        font-size: 0.875rem;
        word-break: break-word;
    }
    .vac-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.2rem;
    }
    /* ESP and Action cells span full width */
    .vac-td-esp, .vac-td-action { grid-column: 1 / -1; }
    .vac-td-action {
        border-bottom: none;
        padding-top: 0.4rem;
        padding-bottom: 0.65rem;
    }
    .vac-td-action button,
    .vac-td-action .btn { width: 100%; justify-content: center; }
    /* Remove border from last data cells */
    .vac-td-esp { border-bottom: 1px solid var(--border); }
    .vac-table .btn, .vac-table .vc-select { min-height: 40px; }
}

/* ── Mobile nav (hamburger) ───────────────────────────────────────────────
   Checkbox-driven disclosure — same no-JS philosophy as .nav-user-pill
   (which uses <details>); a checkbox is used here instead because the
   toggle needs to control a later sibling, not its own nested content. */
.nav-toggle-checkbox {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    flex-shrink: 0;
}
.nav-hamburger span {
    display: block;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
}
.nav-toggle-checkbox:focus-visible ~ .nav-hamburger {
    outline: 2px solid var(--border-focus);
    outline-offset: 3px;
}

@media (max-width: 768px) {
    .portal-nav { flex-wrap: wrap; gap: 0.75rem; }
    .portal-nav .nav-hamburger { display: flex; }
    .portal-nav .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        flex-basis: 100%;
        gap: 0;
        margin-top: 0.75rem;
        order: 5;
    }
    .portal-nav .nav-toggle-checkbox:checked ~ .nav-links { display: flex; }
    .portal-nav .nav-links a {
        padding: 0.85rem 0.5rem;
        border-top: 1px solid var(--border);
        font-size: 1rem;
    }
}

/* ── Gate device table → card stack on mobile ─────────────────────────── */
@media (max-width: 768px) {
    .esp-table-wrap { overflow-x: visible !important; }
    .esp-table { display: block; width: 100%; }
    .esp-table thead { display: none; }
    .esp-table tbody { display: flex; flex-direction: column; gap: 0.75rem; }
    .esp-table tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--bg-elevated);
        overflow: hidden;
    }
    .esp-table td {
        display: block;
        padding: 0.55rem 0.85rem;
        border-bottom: 1px solid var(--border);
        font-size: 0.875rem;
        word-break: break-word;
    }
    .esp-table tr td:last-child { border-bottom: none; }
    .esp-table td[data-label=""]::before { content: none; }
    .esp-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.25rem;
    }
    .esp-table .esp-td-mode form { width: 100%; }
    .esp-table .esp-td-mode select { flex: 1; min-width: 0; }
    .esp-table .esp-td-action button { width: 100%; justify-content: center; }
    .esp-table .btn, .esp-table .vc-select { min-height: 40px; }
}

/* ── Claim form → full-width fields on phones ─────────────────────────── */
@media (max-width: 480px) {
    .claim-form .form-group { flex: 1 1 100%; min-width: 0; }
    .claim-form button[type="submit"] { width: 100%; justify-content: center; }
}

/* ── Info rows (profile page) ─────────────────────────────────────────── */
.info-rows { display: flex; flex-direction: column; gap: 0.85rem; }
.info-row { display: flex; flex-direction: column; gap: 0.2rem; }
.info-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.info-value { color: var(--text-primary); font-size: 0.92rem; word-break: break-word; }

/* ── Integration provider actions → stacked on phones ─────────────────────── */
@media (max-width: 480px) {
    .provider-card .provider-actions { flex-direction: column; align-items: stretch; width: 100%; }
    .provider-card .provider-actions > form { width: 100%; }
    .provider-card .provider-actions .btn { width: 100%; justify-content: center; }
}
