/* ============================================================
   Cronpilot -- design tokens + base styles
   Ported from docs/mockup/styles.css; accent is fixed to amber.
   Theme is toggled via data-theme="light|dark" on <html>.
   ============================================================ */

:root {
    --accent: oklch(0.72 0.16 55);
    --accent-hover: oklch(0.67 0.17 55);
    --accent-ink: oklch(0.28 0.08 55);
    --accent-soft: oklch(0.96 0.04 70);

    --ok: oklch(0.68 0.14 150);
    --ok-bg: oklch(0.96 0.04 150);
    --warn: oklch(0.78 0.14 85);
    --warn-bg: oklch(0.96 0.05 85);
    --err: oklch(0.62 0.19 25);
    --err-bg: oklch(0.96 0.04 25);
    --info: oklch(0.62 0.13 250);

    --bg: oklch(0.985 0.004 250);
    --bg-elev: oklch(1 0 0);
    --bg-sunk: oklch(0.968 0.006 250);
    --bg-hover: oklch(0.955 0.008 250);
    --line: oklch(0.905 0.008 250);
    --line-soft: oklch(0.945 0.006 250);
    --ink: oklch(0.20 0.015 250);
    --ink-2: oklch(0.40 0.015 250);
    --ink-3: oklch(0.58 0.013 250);
    --ink-4: oklch(0.72 0.010 250);

    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --r-1: 4px;
    --r-2: 6px;
    --r-3: 8px;
    --r-4: 12px;
    --r-5: 16px;

    --shadow-1: 0 1px 2px oklch(0.2 0.01 70 / 0.04);
    --shadow-2: 0 4px 14px oklch(0.2 0.01 70 / 0.06), 0 1px 2px oklch(0.2 0.01 70 / 0.04);
    --shadow-3: 0 12px 32px oklch(0.2 0.01 70 / 0.10), 0 2px 6px oklch(0.2 0.01 70 / 0.06);
}

[data-theme="dark"] {
    --bg: oklch(0.215 0.012 255);
    --bg-elev: oklch(0.265 0.014 255);
    --bg-sunk: oklch(0.188 0.011 255);
    --bg-hover: oklch(0.295 0.015 255);
    --line: oklch(0.34 0.014 255);
    --line-soft: oklch(0.285 0.013 255);
    --ink: oklch(0.975 0.006 250);
    --ink-2: oklch(0.84 0.010 250);
    --ink-3: oklch(0.68 0.013 250);
    --ink-4: oklch(0.52 0.012 250);

    --accent: oklch(0.78 0.15 60);
    --accent-hover: oklch(0.82 0.16 60);
    --accent-ink: oklch(0.18 0.02 70);
    --accent-soft: oklch(0.55 0.008 250);

    --ok: oklch(0.78 0.15 150);
    --ok-bg: oklch(0.24 0.05 150);
    --warn: oklch(0.82 0.15 85);
    --warn-bg: oklch(0.26 0.05 85);
    --err: oklch(0.72 0.17 25);
    --err-bg: oklch(0.26 0.06 25);
    --info: oklch(0.72 0.13 250);

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 4px 14px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-3: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ---- reset-ish ---- */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

/* Alpine: hide [x-cloak] until Alpine has booted so conditionally
   rendered tabs / menus don't flash before the JS initialises. */
[x-cloak] {
    display: none !important;
}

/* Events page: single-column when no detail aside is visible, two
   columns (feed + 360px aside) when one is. We use :has() rather than
   a server-rendered conditional because HTMX swaps the aside in/out
   without reloading the grid parent -- a just-swapped aside would
   otherwise land as a second row. Falls back cleanly to single-column
   in browsers without :has() support (2022+ in all major engines). */
.events-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.events-layout:has(> aside#events-detail.card) {
    grid-template-columns: minmax(0, 1fr) 360px;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-feature-settings: "cv11", "ss01";
}

button {
    font-family: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0;
}

input,
textarea,
select {
    font-family: inherit;
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Public page body links (main / content). Footers stay muted. */
.public-surface main a:not(.btn):not(.logo),
.public-surface .public-content a:not(.btn):not(.logo) {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.public-surface main a:not(.btn):not(.logo):hover,
.public-surface .public-content a:not(.btn):not(.logo):hover {
    color: var(--accent-hover);
}

code,
pre,
.mono {
    font-family: var(--font-mono);
}

/* ---- typography scale ---- */
.t-display {
    font-size: 56px;
    line-height: 1.04;
    letter-spacing: -0.03em;
    font-weight: 600;
}

.t-h1 {
    font-size: 36px;
    line-height: 1.12;
    letter-spacing: -0.02em;
    font-weight: 600;
}

.t-h2 {
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: -0.015em;
    font-weight: 600;
}

.t-h3 {
    font-size: 18px;
    line-height: 1.3;
    letter-spacing: -0.01em;
    font-weight: 600;
}

.t-lead {
    font-size: 18px;
    line-height: 1.55;
    color: var(--ink-2);
}

.t-body {
    font-size: 14px;
    line-height: 1.55;
}

.t-small {
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink-2);
}

.t-meta {
    font-size: 12px;
    line-height: 1.4;
    color: var(--ink-3);
    letter-spacing: 0.01em;
}

.t-kicker {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    font-weight: 500;
}

/* ---- buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--r-2);
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 60ms ease;
    white-space: nowrap;
}

.btn:active {
    transform: translateY(0.5px);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.btn-primary {
    background: var(--ink);
    color: var(--bg);
}

.btn-primary:hover {
    background: oklch(from var(--ink) calc(l + 0.1) c h);
}

[data-theme="dark"] .btn-primary:hover {
    background: oklch(from var(--ink) calc(l - 0.08) c h);
}

.btn-accent {
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}

.btn-accent:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--ink-2);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--ink);
}

.btn-secondary {
    background: var(--bg-elev);
    border-color: var(--line);
    color: var(--ink);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--ink-4);
}

.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 12.5px;
    border-radius: var(--r-2);
}

.btn-lg {
    height: 44px;
    padding: 0 20px;
    font-size: 15px;
    border-radius: var(--r-3);
}

/* ---- inputs ---- */
.input,
.textarea,
.select {
    width: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--r-2);
    padding: 9px 11px;
    font-size: 13.5px;
    color: var(--ink);
    transition: border-color 120ms, box-shadow 120ms, background 120ms;
}

.input:focus,
.textarea:focus,
.select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent);
}

.select option {
    background: var(--bg-elev);
    color: var(--ink);
}

.select option:disabled,
.select option.select__option-muted {
    color: var(--ink-2);
    opacity: 1;
}

.select option:checked {
    background: var(--bg-hover);
    color: var(--ink);
}

.input-mono {
    font-family: var(--font-mono);
    font-size: 13px;
}

.label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-2);
    margin-bottom: 6px;
}

.help {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 6px;
}

/* ---- chips ---- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--bg-sunk);
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink-2);
    cursor: pointer;
    transition: all 120ms;
}

.chip:hover {
    background: var(--bg-hover);
    color: var(--ink);
    border-color: var(--ink-4);
}

.chip-active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-ink);
}

[data-theme="dark"] .chip-active {
    color: var(--ink);
}

/* ---- status pills ---- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.pill-ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.pill-warn {
    background: var(--warn-bg);
    color: oklch(from var(--warn) calc(l - 0.15) c h);
}

.pill-err {
    background: var(--err-bg);
    color: var(--err);
}

.pill-neutral {
    background: var(--bg-sunk);
    color: var(--ink-3);
    border: 1px solid var(--line);
}

[data-theme="dark"] .pill-warn {
    color: var(--warn);
}

/* ---- status dots ---- */
.dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
    flex-shrink: 0;
}

.dot-ok {
    background: var(--ok);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ok) 18%, transparent);
}

.dot-warn {
    background: var(--warn);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--warn) 22%, transparent);
}

.dot-err {
    background: var(--err);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--err) 20%, transparent);
}

.dot-muted {
    background: var(--ink-4);
}

/* live pulse */
.pulse {
    position: relative;
}

.pulse::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 999px;
    border: 1.5px solid var(--ok);
    opacity: 0;
    animation: pulse 2.2s ease-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.9;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* ---- card ---- */
.card {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--r-4);
}

.card-flat {
    background: var(--bg-sunk);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-3);
}

/* ---- re-run toast (Events detail pane) ----
   Deliberately Alpine-free: the pane is swapped wholesale on every
   Re-run / row-click / close, so the toast doesn't need enter/leave
   transitions or external state. See partials/_events_detail.html. */
.rerun-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--line-soft);
    border-radius: var(--r-3);
    user-select: none;
}

.rerun-toast--ok {
    background: var(--ok-bg);
    border-color: color-mix(in oklch, var(--ok) 30%, var(--line));
}

.rerun-toast--err {
    background: var(--err-bg);
    border-color: color-mix(in oklch, var(--err) 30%, var(--line));
}

.rerun-toast__message {
    flex: 1 1 auto;
    font-size: 12.5px;
    line-height: 1.2;
}

.rerun-toast--ok .rerun-toast__message {
    color: var(--ok);
}

.rerun-toast--err .rerun-toast__message {
    color: var(--err);
}

.rerun-toast__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    opacity: 0.7;
    border-radius: 4px;
    outline: none;
}

.rerun-toast__close:hover {
    opacity: 1;
}

.rerun-toast--ok .rerun-toast__close {
    color: var(--ok);
}

.rerun-toast--err .rerun-toast__close {
    color: var(--err);
}

.code-block {
    background: var(--bg-sunk);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-3);
    color: var(--ink-2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    line-height: 1.55;
    white-space: pre;
}

/* ---- tables ---- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.table th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13.5px;
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: 0;
}

.table tbody tr {
    transition: background 80ms;
    cursor: pointer;
}

.table tbody tr:hover {
    background: var(--bg-sunk);
}

.table tbody tr.is-kb-focused {
    background: color-mix(in oklch, var(--accent) 12%, var(--bg-sunk));
    outline: 1px solid color-mix(in oklch, var(--accent) 40%, transparent);
    outline-offset: -1px;
}

/* Monitors list: per-cell anchors so middle-click / open-in-new-tab work. */
.table a.table-row-link {
    display: block;
    color: inherit;
    text-decoration: none;
    margin: -12px;
    padding: 12px;
}

.table td:first-child a.table-row-link {
    margin-left: -18px;
    padding-left: 18px;
}

.table td:last-child a.table-row-link {
    margin-right: -18px;
    padding-right: 18px;
}

/* ---- uptime bar (N segments for status viz) ---- */
.uptime {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}

.uptime span {
    display: inline-block;
    width: 3px;
    height: 14px;
    border-radius: 1.5px;
    background: var(--ink-4);
    opacity: 0.4;
}

.uptime span.u-ok {
    background: var(--ok);
    opacity: 0.9;
}

.uptime span.u-warn {
    background: var(--warn);
    opacity: 0.95;
}

.uptime span.u-err {
    background: var(--err);
    opacity: 0.95;
}

.uptime span.u-none {
    background: var(--ink-4);
    opacity: 0.18;
}

/* sparkline bars */
.spark {
    display: inline-flex;
    gap: 1.5px;
    align-items: flex-end;
    height: 24px;
}

.spark span {
    width: 3px;
    background: var(--ink-4);
    border-radius: 1px;
    opacity: 0.55;
}

.spark span.s-ok {
    background: var(--ok);
}

.spark span.s-err {
    background: var(--err);
}

/* ---- kbd ---- */
kbd {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--bg-sunk);
    border: 1px solid var(--line);
    color: var(--ink-2);
    box-shadow: 0 1px 0 var(--line);
}

/* ---- logo mark ---- */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 600;
    letter-spacing: -0.01em;
    font-size: 15px;
    color: var(--ink);
}

.logo-mark {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--ink);
    color: var(--bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.logo-mark::before {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    border: 1.5px solid var(--bg);
}

.logo-mark::after {
    content: "";
    position: absolute;
    width: 1.5px;
    height: 5px;
    background: var(--accent);
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 1px;
}

/* ---- feature-card icon tile ---- */
.feature-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--r-2);
    background: var(--accent-soft);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
}

[data-theme="dark"] .feature-icon {
    background: color-mix(in oklch, var(--accent) 16%, var(--bg-elev));
    color: var(--accent);
    border-color: color-mix(in oklch, var(--accent) 40%, transparent);
}

/* ---- misc ---- */
::selection {
    background: color-mix(in oklch, var(--accent) 30%, transparent);
    color: var(--ink);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 999px;
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ink-4);
}

.hstack {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.muted {
    color: var(--ink-3);
}

.mono {
    font-family: var(--font-mono);
}

.divider {
    height: 1px;
    background: var(--line);
}

.scroll-y {
    overflow-y: auto;
}

.screen {
    animation: fadeIn 220ms ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--r-1);
}

/* ============================================================
   Cronpilot-specific: layout primitives that the mockup used
   inline styles for. Keeping these as real CSS classes makes
   the Jinja templates dramatically easier to read.
   ============================================================ */

/* Two-column app shell: sidebar + main.

   Browsers do transition ``grid-template-columns`` when the values are
   explicit lengths (not custom properties via ``var()``), so we declare
   the two states inline here. */
.app {
    display: grid;
    grid-template-columns: 232px 1fr;
    min-height: 100vh;
    background: var(--bg);
    transition: grid-template-columns 220ms ease;
}

.app[data-collapsed="true"] {
    grid-template-columns: 60px 1fr;
}

.sidebar {
    border-right: 1px solid var(--line);
    background: var(--bg-sunk);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 20;
    overflow: hidden;
    transition: padding 220ms ease, gap 220ms ease;
}

.app[data-collapsed="true"] .sidebar {
    padding: 14px 10px;
    gap: 14px;
}

.app[data-collapsed="true"] .sidebar-item {
    justify-content: center;
    padding: 10px;
}

.app[data-collapsed="true"] .sidebar-item>span:not(:first-child) {
    display: none;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-2);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-2);
    background: transparent;
    border: 1px solid transparent;
    text-align: left;
    width: 100%;
}

.sidebar-item:hover {
    background: var(--bg-hover);
    color: var(--ink);
}

.sidebar-item:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.sidebar-item:disabled:hover {
    background: transparent;
    color: var(--ink-2);
}

.sidebar-item.active {
    color: var(--ink);
    background: var(--bg-elev);
    border-color: var(--line);
}

.sidebar-item .count {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-3);
}

.sidebar-spacer {
    flex: 1;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    border-bottom: 1px solid var(--line);
    background: color-mix(in oklch, var(--bg) 90%, transparent);
    backdrop-filter: blur(8px);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink-3);
    font-size: 13;
}

.breadcrumb .sep {
    stroke: var(--ink-4);
}

.breadcrumb .current {
    color: var(--ink);
}

.page {
    padding: 28px 28px 80px;
    max-width: 1440px;
    margin: 0 auto;
}

/* Stats cards used on the dashboard */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 18px;
}

.stat-card .stat-label {
    margin-bottom: 6px;
}

.stat-card .value {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.stat-card .value.err {
    color: var(--err);
}

.stat-card .sub {
    font-size: 12px;
    color: var(--ink-3);
}

.stat-card .sub.ok {
    color: var(--ok);
}

.stat-card .sub.err {
    color: var(--err);
}

/* Tenant / project switcher at the top of the sidebar */
.tenant-switcher {
    display: grid;
    grid-template-columns: 28px 1fr 14px;
    align-items: center;
    column-gap: 10px;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--r-3);
}

.tenant-switcher__avatar {
    grid-column: 1;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--accent);
    color: var(--accent-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.tenant-switcher__info {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    min-width: 0;
    row-gap: 2px;
}

.tenant-switcher__name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tenant-switcher__chev {
    grid-column: 3;
    color: var(--ink-3);
    display: inline-flex;
    align-items: center;
}

/* Theme toggle buttons in the sidebar */
.theme-toggle {
    display: inline-flex;
    gap: 4px;
}

.theme-toggle button {
    width: 28px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle button[aria-pressed="true"] {
    background: var(--bg-elev);
    color: var(--ink);
}

/* Keyboard-shortcut hints (page content — not the topbar) */
.kbd-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    color: var(--ink-3);
    font-size: 12px;
}

.kbd-hints kbd {
    margin-right: 2px;
}

/* Section used on the new-monitor form */
.step {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 14px;
    align-items: start;
    margin-bottom: 18px;
}

.step-num {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-sunk);
    border: 1px solid var(--line);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    letter-spacing: 0.02em;
}

/* Project picker: explicit existing-project menu plus free-form input. */
.project-picker {
    position: relative;
}

.project-picker__control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
}

.project-picker__control .input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.project-picker__button {
    width: 36px;
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 var(--r-2) var(--r-2) 0;
    background: var(--bg-elev);
    color: var(--ink-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 120ms, box-shadow 120ms, background 120ms, color 120ms;
}

.project-picker__button:hover {
    background: var(--bg-hover);
    color: var(--ink);
}

.project-picker__control:focus-within .input {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent);
}

.project-picker__control:focus-within .project-picker__button {
    border-color: var(--accent);
}

.project-picker__menu {
    position: absolute;
    z-index: 60;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    padding: 4px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.project-picker__option {
    width: 100%;
    min-height: 34px;
    padding: 7px 9px;
    border: 0;
    border-radius: var(--r-2);
    background: transparent;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 13px;
    text-align: left;
}

.project-picker__option:hover,
.project-picker__option:focus {
    outline: none;
    background: var(--bg-hover);
    color: var(--ink);
}

.project-picker__option--active {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.project-picker__check {
    flex: 0 0 auto;
    color: var(--accent);
    display: inline-flex;
}

/* ---- new-monitor layout ---- */

/* Two-column page with a sticky preview on the right. The main column has
   its own flex layout so the action-bar sticks to the bottom of the viewport
   regardless of scroll position. */
.new-monitor {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    min-height: calc(100vh - 57px);
}

.new-monitor__main {
    padding: 24px 28px 120px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 57px);
    background: var(--bg-sunk);
    position: relative;
}

.new-monitor__preview {
    background: var(--bg);
    padding: 24px 28px 80px;
    position: sticky;
    top: 57px;
    align-self: flex-start;
    height: calc(100vh - 57px);
    overflow-y: auto;
    border-left: 1px solid var(--line);
}

/* Webhook / uptime-check radio "card" */
.type-card {
    position: relative;
    flex: 1;
    padding: 10px 12px;
    cursor: pointer;
    background: var(--bg-sunk);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-3);
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.type-card:hover {
    border-color: var(--ink-4);
}

.type-card--active {
    border-color: var(--accent);
    background: color-mix(in oklch, var(--accent) 8%, var(--bg-elev));
    box-shadow: 0 0 0 1px var(--accent);
}

/* Header Name/Value rows */
.header-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr 36px;
    gap: 6px;
    margin-bottom: 6px;
    align-items: center;
}

.header-row:last-of-type {
    margin-bottom: 0;
}

.header-row__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-2);
    background: transparent;
    color: var(--ink-3);
    border: 1px solid transparent;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.header-row__remove:hover {
    background: color-mix(in oklch, var(--err) 10%, var(--bg-elev));
    border-color: color-mix(in oklch, var(--err) 35%, transparent);
    color: var(--err);
}

/* Switcher-looking row used for capture-response + alert channels */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    background: var(--bg-sunk);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-3);
    cursor: pointer;
}

.toggle-row>input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

.toggle-row--disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* iOS-style toggle switch: a ``<label>`` wraps a native ``<input
   type="checkbox">`` which we visually hide. The ``.toggle-switch__track``
   and knob animate via ``:checked`` state. */
.toggle-switch {
    --toggle-w: 34px;
    --toggle-h: 20px;
    --toggle-pad: 2px;
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: var(--toggle-w);
    height: var(--toggle-h);
    cursor: pointer;
}

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

.toggle-switch__track {
    position: absolute;
    inset: 0;
    background: var(--ink-4);
    border-radius: 999px;
    transition: background 160ms ease;
}

.toggle-switch__track::after {
    content: "";
    position: absolute;
    top: var(--toggle-pad);
    left: var(--toggle-pad);
    width: calc(var(--toggle-h) - var(--toggle-pad) * 2);
    height: calc(var(--toggle-h) - var(--toggle-pad) * 2);
    background: #fff;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: left 160ms ease;
}

.toggle-switch input:checked+.toggle-switch__track {
    background: var(--accent);
}

.toggle-switch input:checked+.toggle-switch__track::after {
    left: calc(var(--toggle-w) - var(--toggle-h) + var(--toggle-pad));
}

.toggle-switch input:disabled+.toggle-switch__track {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Sticky action bar that spans the full width of the main column */
.action-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px -28px -120px;
    padding: 14px 28px;
    background: color-mix(in oklch, var(--bg-sunk) 94%, transparent);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    z-index: 4;
}