/* ============================================================
   BASTION CONSOLE â€” Swiss Minimal Dark
   Ultra-clean editorial system. Near-black canvas, one accent,
   hairline separators, tiny radii, no glow. Linear / Vercel feel.
   ============================================================ */

:root {
    /* --- Canvas & surfaces (near-black, layered by lightness) --- */
    --bg:        #0a0a0b;   /* page canvas */
    --surface:   #111113;   /* card body */
    --surface-2: #161618;   /* card head / inset rows */
    --surface-3: #1c1c1f;   /* hover wells */

    /* --- Hairlines --- */
    --line:        #232327;
    --line-strong: #2e2e33;

    /* --- Type --- */
    --text:   #ededef;   /* primary */
    --text-2: #a1a1aa;   /* secondary / muted */
    --text-3: #6e6e78;   /* tertiary / labels */

    /* --- The ONE accent --- */
    --accent:      #6e7bff;   /* confident indigo */
    --accent-weak: #3a3f6b;
    --accent-ink:  #0a0a0b;   /* text on accent fill */
    --accent-tint: rgba(110,123,255,0.12);

    /* --- State semantics (kept legacy var names for inline styles) --- */
    --green:  #34d399;   /* ON / healthy */
    --danger: #f96a6a;   /* OFF / danger */
    --amber:  #e6b450;   /* transitional / warning */

    --green-tint:  rgba(52,211,153,0.12);
    --danger-tint: rgba(249,106,106,0.12);
    --amber-tint:  rgba(230,180,80,0.12);

    /* --- Geometry --- */
    --r:    6px;    /* default radius */
    --r-sm: 4px;
    --r-pill: 999px;

    /* --- Spacing scale (4-based) --- */
    --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
    --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px;

    /* --- Shadow (soft, never glowy) --- */
    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px -12px rgba(0,0,0,0.6);

    --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --grot:  'Space Grotesk', var(--sans);
    --mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.55;
    font-feature-settings: "cv05" 1, "ss01" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* faint top vignette â€” adds depth without color */
    background-image:
        radial-gradient(120% 80% at 50% -10%, rgba(110,123,255,0.06), transparent 60%);
    background-repeat: no-repeat;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color .15s ease;
}
a:hover { color: var(--text); }

::selection { background: var(--accent-tint); color: var(--text); }

/* ------------------------------------------------------------
   Layout
   ------------------------------------------------------------ */
.wrap {
    max-width: 920px;
    margin: 0 auto;
    padding: var(--s7) var(--s5) var(--s8);
}

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */
header.bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--s4);
    flex-wrap: wrap;
    margin-bottom: var(--s7);
    padding-bottom: var(--s5);
    border-bottom: 1px solid var(--line);
}
header.bar > div { display: flex; flex-direction: column; gap: 6px; }
header.bar > div:last-child {
    flex-direction: row;
    align-items: center;
    gap: var(--s3);
    flex-wrap: wrap;
}

/* ------------------------------------------------------------
   Typography
   ------------------------------------------------------------ */
h1, .title {
    font-family: var(--grot);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0;
}
h1 {
    font-size: 1.5rem;
    color: var(--text);
}
.title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-3);
}
.accent {
    color: var(--text-2);
    font-weight: 400;
}
.muted {
    color: var(--text-2);
    font-size: 0.85rem;
    line-height: 1.5;
}
header.bar .muted { font-family: var(--mono); font-size: 0.78rem; color: var(--text-3); }

/* page footer note */
.wrap > .muted:last-child {
    margin-top: var(--s6);
    text-align: center;
    color: var(--text-3);
    font-size: 0.78rem;
}

/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: var(--s5);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card > .head {
    padding: var(--s3) var(--s5);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    font-family: var(--grot);
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s3);
}
.card > .body { padding: var(--s5); }

/* danger-flagged cards: a single hairline accent on the left */
#dangerCard, .card[style*="--danger"] {
    border-color: var(--line) !important;
}
#dangerCard { box-shadow: var(--shadow); }

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
label {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    margin: var(--s4) 0 var(--s2);
    font-weight: 500;
}
form > label:first-child,
.body > label:first-child { margin-top: 0; }

input, select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    font-family: var(--sans);
    font-size: 0.92rem;
    line-height: 1.4;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
    -webkit-appearance: none;
    appearance: none;
}
input::placeholder { color: var(--text-3); }
input:hover, select:hover { border-color: #3a3a40; }
input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-tint);
    background: var(--surface);
}
input:disabled, select:disabled { opacity: 0.5; cursor: not-allowed; }

/* datetime-local: tame the native dark indicator */
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    opacity: 0.6;
    cursor: pointer;
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* ------------------------------------------------------------
   Grid
   ------------------------------------------------------------ */
.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s4);
}
/* when .grid2 holds full-width buttons, let them sit flush */
.body.grid2 > .btn { margin-top: 0; }
@media (max-width: 560px) {
    .grid2 { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    margin-top: var(--s3);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--sans);
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.2;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--surface-3); border-color: #3a3a40; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-tint);
    border-color: var(--accent);
}
.btn:disabled,
.btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}
.btn-primary:hover {
    background: #828dff;
    border-color: #828dff;
    color: var(--accent-ink);
}

.btn-danger {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger-tint);
    border-color: var(--danger);
    color: #ff8b8b;
}

.btn-ghost {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--text-2);
}
.btn-ghost:hover {
    background: var(--surface-2);
    border-color: #3a3a40;
    color: var(--text);
}

.btn-sm {
    width: auto;
    padding: 6px 12px;
    margin-top: 0;
    font-size: 0.78rem;
    border-radius: var(--r-sm);
}

/* ------------------------------------------------------------
   Status badge
   ------------------------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 12px;
    border-radius: var(--r-pill);
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    font-family: var(--mono);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--text);
    white-space: nowrap;
}
/* the living dot */
.badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
    animation: dot-pulse 2.4s ease-in-out infinite;
}
@keyframes dot-pulse {
    0%, 100% { opacity: 1;   box-shadow: 0 0 0 0 currentColor; }
    50%      { opacity: 0.45; box-shadow: 0 0 0 4px transparent; }
}

.s-ON {
    color: var(--green);
    border-color: rgba(52,211,153,0.4);
    background: var(--green-tint);
}
.s-OFF {
    color: var(--danger);
    border-color: rgba(249,106,106,0.4);
    background: var(--danger-tint);
}
.s-BOOTING_UP,
.s-SHUTTING_DOWN {
    color: var(--amber);
    border-color: rgba(230,180,80,0.4);
    background: var(--amber-tint);
}
/* transitional states pulse a touch faster to read as "in motion" */
.s-BOOTING_UP::before,
.s-SHUTTING_DOWN::before { animation-duration: 1s; }

/* ------------------------------------------------------------
   Tabs
   ------------------------------------------------------------ */
.tabs {
    display: flex;
    gap: var(--s1);
    padding: var(--s4) var(--s5) 0;
    border-bottom: 1px solid var(--line);
}
.tab {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    cursor: pointer;
    font-family: var(--grot);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-3);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--text-2); }
.tab.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* ------------------------------------------------------------
   Task rows
   ------------------------------------------------------------ */
.task {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s4);
    padding: var(--s3) var(--s4);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    transition: border-color .15s ease, background .15s ease;
}
.task + .task { margin-top: var(--s2); }
.task:hover { border-color: var(--line-strong); background: var(--surface-3); }
.task .desc {
    font-weight: 600;
    color: var(--text);
    font-size: 0.92rem;
    margin-bottom: 2px;
}
.task .muted { font-family: var(--mono); font-size: 0.74rem; }

/* ------------------------------------------------------------
   Notes
   ------------------------------------------------------------ */
.note {
    font-size: 0.82rem;
    line-height: 1.45;
    padding: 10px 14px;
    margin-top: var(--s3);
    border: 1px solid var(--line-strong);
    border-left-width: 3px;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text-2);
}
.note + .note { margin-top: var(--s2); }
.note.err {
    border-color: var(--line-strong);
    border-left-color: var(--danger);
    background: var(--danger-tint);
    color: #f6b4b4;
}
.note.ok {
    border-color: var(--line-strong);
    border-left-color: var(--green);
    background: var(--green-tint);
    color: #9ee9cb;
}

.hide { display: none !important; }

/* ------------------------------------------------------------
   Tables (Security)
   ------------------------------------------------------------ */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-2);
    color: var(--text-3);
    font-family: var(--grot);
    font-weight: 500;
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line-strong);
}
td {
    color: var(--text-2);
    font-family: var(--mono);
    font-size: 0.78rem;
}
tbody tr { transition: background .12s ease; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

/* ------------------------------------------------------------
   Stat tiles (Security overview)
   ------------------------------------------------------------ */
.stat {
    font-family: var(--grot);
    font-size: 1.9rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--text);
    margin-top: 2px;
}
/* each tile gets breathing room inside the grid */
.body.grid2 > div { min-width: 0; }
.body.grid2 > div > .muted {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
}

/* ------------------------------------------------------------
   Custom scrollbar
   ------------------------------------------------------------ */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: var(--r-pill);
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #3a3a42; }

/* ------------------------------------------------------------
   Motion / accessibility
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* ------------------------------------------------------------
   Small screens
   ------------------------------------------------------------ */
@media (max-width: 560px) {
    .wrap { padding: var(--s5) var(--s4) var(--s7); }
    h1 { font-size: 1.3rem; }
    header.bar { gap: var(--s3); }
    header.bar > div:last-child { width: 100%; }
    .stat { font-size: 1.6rem; }
    .card > .body { padding: var(--s4); }
    .btn-sm { flex: 1; }
}


/* ============================================================
   Grafts — art-director picks from the runner-up directions
   ============================================================ */
/* Confident accented brand wordmark (was muted grey) */
.accent { color: var(--accent); font-weight: 500; }

/* Hairline top sheen on cards: subtle depth, no glow */
.card { position: relative; }
.card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    pointer-events: none;
}