/*
 * Deploy Console — design system v2.
 *
 * Apple-style: system typography (SF Pro / SF Mono where available), a neutral grey scale with
 * ONE accent (blue) for actions and focus, and colour otherwise reserved for status (green /
 * amber / red). Surfaces are layered and slightly translucent, corners are generous, and every
 * state change eases with the same spring curve. Light by default, dark by system preference or
 * explicit choice (data-theme on <html>).
 *
 * Sections: tokens · base · motion · frame · controls · segmented/toggle · panels & tiles ·
 * tables · status · steps · logs · charts · config editor · modal · palette · toast · login ·
 * responsive
 */

/* ================================================================ 1. tokens */
:root {
    color-scheme: light;
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #f7f7f9;
    --surface-3: #ededf0;
    --well: #f2f2f5;
    --chrome: rgba(255, 255, 255, 0.72);
    --hairline: rgba(0, 0, 0, 0.08);
    --border: rgba(0, 0, 0, 0.12);
    --text: #1d1d1f;
    --text-2: #515154;
    --muted: #86868b;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-ink: #ffffff;
    --accent-soft: rgba(0, 113, 227, 0.10);
    --good: #1f9d4e;
    --good-soft: rgba(52, 199, 89, 0.14);
    --warn: #c77800;
    --warn-soft: rgba(255, 159, 10, 0.16);
    --bad: #d70015;
    --bad-soft: rgba(255, 59, 48, 0.12);
    --log-bg: #1c1c1e;
    --log-text: #d7d7dc;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.18), 0 8px 20px rgba(0, 0, 0, 0.08);
    --radius: 14px;
    --radius-sm: 9px;
    --radius-xs: 6px;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --dur: 220ms;
    --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Inter, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, "JetBrains Mono", Consolas, monospace;
    --nav-w: 236px;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f0f11;
    --surface: #1c1c1e;
    --surface-2: #232326;
    --surface-3: #2c2c2e;
    --well: #131315;
    --chrome: rgba(28, 28, 30, 0.72);
    --hairline: rgba(255, 255, 255, 0.09);
    --border: rgba(255, 255, 255, 0.14);
    --text: #f5f5f7;
    --text-2: #c7c7cc;
    --muted: #8e8e93;
    --accent: #0a84ff;
    --accent-hover: #1f8fff;
    --accent-soft: rgba(10, 132, 255, 0.16);
    --good: #30d158;
    --good-soft: rgba(48, 209, 88, 0.16);
    --warn: #ffd60a;
    --warn-soft: rgba(255, 214, 10, 0.14);
    --bad: #ff453a;
    --bad-soft: rgba(255, 69, 58, 0.16);
    --log-bg: #0a0a0b;
    --log-text: #d0d0d5;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0f0f11;
        --surface: #1c1c1e;
        --surface-2: #232326;
        --surface-3: #2c2c2e;
        --well: #131315;
        --chrome: rgba(28, 28, 30, 0.72);
        --hairline: rgba(255, 255, 255, 0.09);
        --border: rgba(255, 255, 255, 0.14);
        --text: #f5f5f7;
        --text-2: #c7c7cc;
        --muted: #8e8e93;
        --accent: #0a84ff;
        --accent-hover: #1f8fff;
        --accent-soft: rgba(10, 132, 255, 0.16);
        --good: #30d158;
        --good-soft: rgba(48, 209, 88, 0.16);
        --warn: #ffd60a;
        --warn-soft: rgba(255, 214, 10, 0.14);
        --bad: #ff453a;
        --bad-soft: rgba(255, 69, 58, 0.16);
        --log-bg: #0a0a0b;
        --log-text: #d0d0d5;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
    }
}

/* ================================================================ 2. base */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font: 13.5px/1.5 var(--sans);
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 15px; }
h3 { font-size: 13px; color: var(--text-2); font-weight: 600; }
h4 { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.secondary { color: var(--text-2); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.nowrap { flex-wrap: nowrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 8px; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 > *, .grid-3 > *, .stack > * { min-width: 0; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ================================================================ 3. motion */
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes spin { to { transform: rotate(360deg); } }
.view { animation: view-in 320ms var(--ease) both; }
.skeleton {
    border-radius: var(--radius-sm); height: 14px;
    background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 40%, var(--surface-3) 80%);
    background-size: 800px 100%; animation: shimmer 1.4s linear infinite;
}
.spinner { width: 14px; height: 14px; border: 2px solid var(--hairline); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }

/* ================================================================ 4. frame */
.app { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.sidenav {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; gap: 2px; padding: 18px 12px 14px;
    background: var(--chrome); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-right: 1px solid var(--hairline);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 9px; background: var(--text); color: var(--bg);
    display: grid; place-items: center; font-weight: 700; font-size: 14px; letter-spacing: -0.02em;
}
.brand-name { font-weight: 600; font-size: 13.5px; }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav-section { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 14px 10px 4px; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 500; cursor: pointer; text-decoration: none; font-size: 13px;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-ico { width: 18px; height: 18px; display: inline-grid; place-items: center; opacity: 0.85; }
.nav-ico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; padding: 0 7px; min-width: 20px; text-align: center; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.nav-badge.bad { background: var(--bad); color: #fff; }
.nav-badge.info { background: var(--accent); color: #fff; }
.nav-badge.warn { background: var(--warn); color: #1d1d1f; }
.nav-spacer { flex: 1; }
.nav-foot { border-top: 1px solid var(--hairline); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.nav-user { display: flex; align-items: center; gap: 9px; padding: 4px 8px; font-size: 12px; color: var(--muted); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; font-weight: 600; font-size: 11px; text-transform: uppercase; }
.nav-user strong { color: var(--text); font-weight: 600; display: block; line-height: 1.2; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 8;
    display: flex; align-items: center; gap: 12px; padding: 14px 28px;
    background: var(--chrome); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--hairline);
}
.topbar .crumbs { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.content { padding: 24px 28px 72px; max-width: 1440px; width: 100%; }
.menu-btn { display: none; }
.search-btn {
    display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px;
    background: var(--well); border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 6px 10px; min-width: 200px; box-shadow: none;
}
.search-btn:hover { background: var(--surface-3); }
.search-btn kbd { margin-left: auto; font: 11px var(--sans); color: var(--muted); border: 1px solid var(--hairline); border-radius: 5px; padding: 0 5px; background: var(--surface); }

/* ================================================================ 5. controls */
button, .btn {
    font: inherit; font-weight: 500; font-size: 13px; letter-spacing: -0.006em;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    padding: 7px 13px; border-radius: var(--radius-sm); cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; line-height: 1.3;
    box-shadow: var(--shadow-sm);
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform 120ms var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur);
}
button:hover, .btn:hover { background: var(--surface-2); text-decoration: none; }
button:active, .btn:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
button.primary, .btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
button.primary:hover, .btn.primary:hover { background: var(--accent-hover); }
button.danger { color: var(--bad); }
button.danger:hover { background: var(--bad-soft); border-color: transparent; }
button.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
button.ghost:hover { background: var(--surface-3); color: var(--text); }
button.sm, .btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
button.icon { padding: 5px 8px; }
button.link { background: none; border: 0; box-shadow: none; color: var(--accent); padding: 0; font-weight: 500; }
button.link:hover { text-decoration: underline; background: none; }
input, select, textarea {
    font: inherit; font-size: 13px; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; min-width: 0;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: rgba(0, 0, 0, 0.2); }
:root[data-theme="dark"] input:hover, :root[data-theme="dark"] select:hover { border-color: rgba(255, 255, 255, 0.22); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:read-only:not([type=checkbox]) { color: var(--text-2); background: var(--well); }
select { appearance: none; -webkit-appearance: none; padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; }
textarea { font-family: var(--mono); font-size: 12px; resize: vertical; line-height: 1.5; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-2); font-weight: 500; }
label.field .hint { font-weight: 400; color: var(--muted); }
label.check { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
    border-radius: 99px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; user-select: none;
    transition: all var(--dur) var(--ease);
}
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.chip.static { cursor: default; }

/* ================================================================ 6. segmented / toggle */
.seg { display: inline-flex; background: var(--well); border-radius: 9px; padding: 3px; gap: 2px; border: 1px solid var(--hairline); }
.seg > button, .seg > a {
    border: 0; box-shadow: none; background: transparent; color: var(--text-2); padding: 5px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 500;
}
.seg > button:hover, .seg > a:hover { background: transparent; color: var(--text); text-decoration: none; }
.seg > .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg.sm > button, .seg.sm > a { padding: 3px 9px; font-size: 12px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 34px; height: 20px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--hairline); position: relative; transition: background var(--dur) var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform var(--dur) var(--ease); }
.switch input:checked + .track { background: var(--good); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }
.switch.accent input:checked + .track { background: var(--accent); }

/* ================================================================ 7. panels & tiles */
.panel { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.panel-head h2 { flex: 1; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }
.panel-body.tight { padding: 12px 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 15px 18px; box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.tile.clickable { cursor: pointer; }
.tile.clickable:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.tile .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.tile .value { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .value .unit { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 3px; letter-spacing: 0; }
.tile .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.tile.good .value { color: var(--good); }
.tile.bad .value { color: var(--bad); }
.tile.warn .value { color: var(--warn); }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text-2); margin-bottom: 4px; font-weight: 600; }
.empty .ico { font-size: 26px; margin-bottom: 8px; opacity: 0.5; }
.callout { border: 1px solid var(--hairline); background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 13px; font-size: 13px; color: var(--text-2); }
.callout strong { color: var(--text); }
.callout.warn { background: var(--warn-soft); border-color: transparent; }
.callout.bad { background: var(--bad-soft); border-color: transparent; }
.callout.info { background: var(--accent-soft); border-color: transparent; }
.callout.good { background: var(--good-soft); border-color: transparent; }
.divider { height: 1px; background: var(--hairline); margin: 4px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 12.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
details > summary { cursor: pointer; color: var(--text-2); font-size: 12.5px; user-select: none; }

/* ================================================================ 8. tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--surface); position: sticky; top: 0; letter-spacing: 0.01em; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--dur) var(--ease); }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--surface-2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
td.actions button + button, td.actions a + button, td.actions button + a, td.actions a + a { margin-left: 4px; }
.table-compact th, .table-compact td { padding: 7px 12px; }

/* ================================================================ 9. status */
.badge {
    display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
    padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; letter-spacing: 0;
}
.badge.SUCCESS, .badge.UP, .badge.good { background: var(--good-soft); color: var(--good); }
.badge.FAILED, .badge.DOWN, .badge.bad, .badge.REJECTED { background: var(--bad-soft); color: var(--bad); }
.badge.RUNNING, .badge.info { background: var(--accent-soft); color: var(--accent); }
.badge.QUEUED, .badge.CANCELLED, .badge.SKIPPED { background: var(--surface-3); color: var(--text-2); }
.badge.ROLLED_BACK, .badge.warn, .badge.PENDING { background: var(--warn-soft); color: var(--warn); }
.badge.RUNNING::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.2s infinite; }
.badge.PENDING::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot.up { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.dot.down { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.env-tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.env-tag.protected { background: var(--bad-soft); color: var(--bad); }
.env-tag.frozen { background: var(--accent-soft); color: var(--accent); }
.sha { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.release { font-family: var(--mono); font-size: 12px; }
.tests-ok { color: var(--good); font-weight: 600; }
.tests-bad { color: var(--bad); font-weight: 600; }

/* ================================================================ 10. steps (build stages, deploy timeline) */
.steps { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0; }
.step {
    flex: 1; min-width: 150px; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
    border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: var(--surface-2);
    transition: border-color var(--dur) var(--ease);
}
.step.RUNNING { border-color: var(--accent); background: var(--accent-soft); }
.step.FAILED { border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-soft); }
.step-ico { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; font-size: 11px; font-weight: 700; }
.step.SUCCESS .step-ico, .tl-item.SUCCESS .step-ico { background: var(--good); color: #fff; }
.step.FAILED .step-ico, .tl-item.FAILED .step-ico { background: var(--bad); color: #fff; }
.step.SKIPPED .step-ico, .tl-item.SKIPPED .step-ico { background: var(--surface-3); color: var(--muted); }
.step.RUNNING .step-ico, .tl-item.RUNNING .step-ico { border: 2px solid var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.step.PENDING .step-ico, .tl-item.PENDING .step-ico { border: 2px solid var(--hairline); }
.step-name { font-weight: 600; font-size: 12.5px; }
.step-detail { color: var(--muted); font-size: 11.5px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start; padding: 6px 0; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 8px; top: 24px; bottom: -6px; width: 2px; background: var(--hairline); }
.tl-item:last-child::before { display: none; }
.tl-time { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.instance-block { border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); }
.instance-block h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

/* ================================================================ 11. logs */
.log {
    background: var(--log-bg); color: var(--log-text); font: 12px/1.6 var(--mono);
    padding: 12px 14px; border-radius: var(--radius-sm); overflow: auto; white-space: pre-wrap; word-break: break-word;
    max-height: 64vh; min-height: 160px; margin: 0; tab-size: 4;
}
.log.short { max-height: 40vh; min-height: 60px; }
.log .l-err { color: #ff6b6b; }
.log .l-warn { color: #ffd166; }
.log .l-ok { color: #6ee7a0; }
.log .l-cmd { color: #8ab4ff; }
.log .l-step { color: #c9a5ff; font-weight: 600; }
.annotations { display: flex; flex-direction: column; gap: 4px; }
.annotation { font-family: var(--mono); font-size: 12px; padding: 6px 10px; border-radius: 7px; background: var(--bad-soft); color: var(--bad); border-left: 3px solid var(--bad); word-break: break-word; }

/* ================================================================ 12. charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font: 10.5px var(--sans); fill: var(--muted); }
.chart .grid line { stroke: var(--hairline); }
.chart .series { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: 0.12; }
.chart .marker { stroke: var(--accent); stroke-dasharray: 3 3; stroke-width: 1; }
.chart .marker-label { fill: var(--accent); font-weight: 600; }
.chart .down { fill: var(--bad-soft); }
.chart .hover-line { stroke: var(--text-2); stroke-width: 1; opacity: 0; }
.chart .hover-dot { r: 3.5; stroke: var(--surface); stroke-width: 2; opacity: 0; }
.chart-tip {
    position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--hairline); border-radius: 8px;
    box-shadow: var(--shadow); padding: 6px 9px; font-size: 11.5px; white-space: nowrap; opacity: 0; transition: opacity 120ms; z-index: 3;
}
.chart-wrap { position: relative; }
.chart-title { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.chart-title .now { font-weight: 600; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 28px; display: block; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 44px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; min-width: 4px; }
.bars .bar i { display: block; border-radius: 2px; }
.bars .bar .ok { background: var(--good); }
.bars .bar .ko { background: var(--bad); }
.legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* fleet / releases cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.card:hover { box-shadow: var(--shadow); }
.card.down { border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.fleet-group { margin-bottom: 22px; }
.fleet-group > h3 { margin: 0 0 10px; display: flex; gap: 8px; align-items: center; }
.board { display: grid; gap: 10px; }
.board-row { display: grid; grid-template-columns: 170px repeat(var(--envs, 2), 1fr); gap: 10px; align-items: stretch; }
.board-head { color: var(--muted); font-size: 11.5px; font-weight: 600; padding: 0 4px; display: flex; align-items: center; gap: 6px; }
.board-app { display: flex; align-items: center; font-weight: 600; padding: 0 4px; }
.board-cell { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; min-height: 84px; font-size: 12.5px; transition: box-shadow var(--dur) var(--ease); }
.board-cell:hover { box-shadow: var(--shadow); }
.board-cell.empty-cell { background: transparent; border-style: dashed; color: var(--muted); justify-content: center; align-items: center; box-shadow: none; }
.board-cell .build { font-weight: 600; font-size: 13px; }
.behind { color: var(--warn); font-weight: 600; font-size: 11.5px; }
.insync { color: var(--good); font-weight: 600; font-size: 11.5px; }

/* ================================================================ 13. config editor */
.layer-grid td:not(:first-child) { min-width: 120px; }
.layer-cell {
    display: block; width: 100%; text-align: left; font-size: 12px; padding: 7px 9px; border-radius: 8px; box-shadow: none;
    background: var(--well); border: 1px solid var(--hairline); color: var(--muted);
}
.layer-cell.has { color: var(--text); background: var(--surface); }
.layer-cell.sel { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.cfg-table input:not([type=checkbox]) { width: 100%; font-family: var(--mono); font-size: 12px; padding: 5px 8px; }
.cfg-table select { font-size: 12px; padding: 4px 24px 4px 8px; }
.cfg-table td { padding: 5px 8px; }
.cfg-table tr.dirty td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.cfg-table tr.new td:first-child { box-shadow: inset 3px 0 0 var(--good); }
.cfg-table tr.removed td { opacity: 0.4; text-decoration: line-through; }
.diff-add { color: var(--good); }
.diff-del { color: var(--bad); }
.diff-chg { color: var(--warn); }
.cmp-diff td.changed { background: var(--warn-soft); }
.cmp-diff td.missing { background: var(--bad-soft); }

/* ================================================================ 14. modal */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.36); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade-in 180ms var(--ease); }
.modal {
    background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px; box-shadow: var(--shadow-lg);
    width: min(720px, 100%); max-height: 90vh; display: flex; flex-direction: column; animation: pop-in 260ms var(--ease);
}
.modal.wide { width: min(1120px, 100%); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--hairline); display: flex; align-items: center; gap: 10px; }
.modal-head h2 { flex: 1; font-size: 16px; }
.modal-body { padding: 20px; overflow: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--hairline); display: flex; justify-content: flex-end; gap: 8px; }
.modal-back.closing { animation: fade-in 160ms var(--ease) reverse both; }

/* ================================================================ 15. command palette */
.palette-back { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; animation: fade-in 140ms var(--ease); }
.palette { width: min(620px, 92vw); background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop-in 220ms var(--ease); }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0; padding: 14px 18px; font-size: 15px; background: transparent; }
.palette input:focus { box-shadow: none; }
.palette-list { max-height: 50vh; overflow: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 13.5px; }
.palette-item .kind { font-size: 11px; color: var(--muted); min-width: 74px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.palette-item .hint { margin-left: auto; color: var(--muted); font-size: 12px; }
.palette-item.active { background: var(--accent-soft); }
.palette-empty { padding: 20px; text-align: center; color: var(--muted); }

/* ================================================================ 16. toast */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 70; }
.toast {
    background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; box-shadow: var(--shadow-lg);
    padding: 10px 14px; max-width: 420px; font-size: 13px; display: flex; gap: 10px; align-items: center; animation: toast-in 240ms var(--ease);
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.toast.bad::before { background: var(--bad); }
.toast.info::before { background: var(--accent); }
.toast a { font-weight: 600; }

/* ================================================================ 17. login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.login { width: min(380px, 100%); padding: 32px; animation: pop-in 320ms var(--ease); }
.login form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.login .error { color: var(--bad); font-size: 13px; min-height: 18px; }
.login input { padding: 10px 12px; font-size: 14px; }
.login button { padding: 10px; font-size: 14px; border-radius: 10px; }

/* ================================================================ 18. responsive */
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }
    .sidenav { position: fixed; z-index: 40; left: 0; top: 0; width: 250px; transform: translateX(-100%); transition: transform 260ms var(--ease); box-shadow: var(--shadow-lg); }
    .app.nav-open .sidenav { transform: none; }
    .menu-btn { display: inline-flex; }
    .search-btn { min-width: 0; }
    .search-btn span, .search-btn kbd { display: none; }
    .topbar { padding: 12px 16px; }
    .content { padding: 16px 16px 72px; }
    .form-grid .span-2 { grid-column: auto; }
    .cards { grid-template-columns: 1fr; }
    .board-row { grid-template-columns: 1fr; }
}

/* ================================================================ 19. v3: busy, hold-to-confirm, setup, trust */
button.busy, .btn.busy { position: relative; color: transparent !important; pointer-events: none; }
button.busy::after, .btn.busy::after {
    content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
    border: 2px solid currentColor; border-color: var(--muted) var(--muted) var(--muted) transparent; border-radius: 50%; animation: spin 0.7s linear infinite;
}
button.primary.busy::after, button.danger.solid.busy::after { border-color: #fff #fff #fff transparent; }
.hold-row { display: flex; justify-content: center; padding: 6px 0 2px; }
button.hold { position: relative; overflow: hidden; min-width: 260px; justify-content: center; padding: 12px 22px; font-size: 14px; border-radius: 12px; user-select: none; -webkit-user-select: none; touch-action: none; }
button.hold .hold-fill { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.28); transform: scaleX(0); transform-origin: left center; pointer-events: none; }
button.hold .hold-label { position: relative; font-weight: 600; letter-spacing: -0.01em; }
button.hold.holding { transform: scale(0.985); box-shadow: 0 0 0 4px var(--bad-soft); }
button.hold.held { background: var(--good); box-shadow: 0 0 0 4px var(--good-soft); animation: pop-in 260ms var(--ease); }
.shield { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.qr { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: 14px; border: 1px solid var(--hairline); width: 220px; margin: 0 auto; box-shadow: var(--shadow-sm); animation: pop-in 320ms var(--ease); }
.qr svg { width: 190px; height: 190px; display: block; }
.meter { height: 4px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 4px; width: 4%; background: var(--bad); border-radius: 3px; transition: width 260ms var(--ease), background 260ms var(--ease); }
.setup-steps { display: flex; gap: 6px; margin-top: 14px; }
.setup-steps span { flex: 1; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px; border-radius: 8px; background: var(--well); border: 1px solid var(--hairline); transition: all var(--dur) var(--ease); }
.setup-steps span.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.setup-steps span.done { background: var(--good-soft); color: var(--good); border-color: transparent; }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
.login.shake { animation: shake 420ms cubic-bezier(.36, .07, .19, .97) both; }
.fingerprint { font-family: var(--mono); font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--well); border: 1px solid var(--hairline); word-break: break-all; }
.posture { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.posture > div { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--well); border: 1px solid var(--hairline); font-size: 12.5px; }
.posture .ok { color: var(--good); font-weight: 700; }
.posture .no { color: var(--warn); font-weight: 700; }
