:root {
    color-scheme: light;
    --canvas: #f0f4f2;
    --surface: #fff;
    --ink: #172e29;
    --muted: #51665f;
    --line: #d6e2dc;
    --field: #a4b8af;
    --rail: #122f29;
    --accent: #006c59;
    --accent-hover: #005345;
    --mint: #e2f2e9;
    --danger: #9c302a;
    --focus: #a14e0a;
    font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0 0 12px; }
h1, h2, h3 { line-height: 1.18; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 4.5vw, 3.3rem); letter-spacing: -.055em; font-weight: 760; }
h2 { font-size: 1.36rem; letter-spacing: -.025em; margin-bottom: 16px; }
h3 { font-size: 1.08rem; }
small, .muted, .field-hint { color: var(--muted); }
small, .field-hint { font-size: .86rem; }
.muted { font-size: .94rem; }
h2 small { display: inline-block; margin-left: 6px; font-weight: 550; letter-spacing: 0; }

label { display: block; margin-bottom: 15px; font-weight: 640; font-size: .94rem; }
input, select, textarea, button { font: inherit; }
input:not([type=checkbox], [type=radio]), select, textarea {
    display: block; width: 100%; min-width: 0; color: var(--ink); background: var(--surface); font-weight: 450;
    border: 1px solid var(--field); border-radius: 8px; padding: 10px 12px; min-height: 44px;
}
label > :is(input, select, textarea):not([type=checkbox], [type=radio]) { margin-top: 6px; }
input:is([type=checkbox], [type=radio]) { accent-color: var(--accent); width: 18px; height: 18px; margin: 3px 0 0; flex: none; }
input::placeholder, textarea::placeholder { color: #647970; }
input[aria-invalid=true] { border-color: var(--danger); }
textarea { resize: vertical; }
button, .action-link, .preview-open {
    display: inline-flex; align-items: center; justify-content: center; min-height: 42px;
    padding: 9px 15px; border: 1px solid var(--field); border-radius: 8px; background: var(--surface);
    color: var(--ink); font-weight: 650; cursor: pointer; text-decoration: none;
}
button:not(:disabled):hover, .secondary-link:hover { background: var(--mint); color: var(--ink); }
button:disabled { opacity: .62; cursor: not-allowed; }
.primary, .action-link, .preview-open { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:not(:disabled):hover, .action-link:hover, .preview-open:hover { background: var(--accent-hover); color: #fff; }
.secondary-link { background: var(--mint); border-color: var(--line); color: var(--accent-hover); }

.brand {
    display: inline-flex; align-items: center; gap: 10px; width: fit-content; color: inherit;
    font-size: 1.25rem; font-weight: 750; letter-spacing: -.035em; text-decoration: none;
}
.brand:hover { color: inherit; }
.brand svg { flex: none; color: var(--accent); }
.sidebar .brand svg, .entry-story .brand svg { color: #a6edcd; --brand-cutout: var(--rail); }
.skip-link { position: absolute; z-index: 2; top: 8px; left: 8px; transform: translateY(-150%); padding: 10px; background: white; }
.skip-link:focus { transform: none; }
.workspace { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    align-self: start; position: sticky; top: 0; height: 100vh; height: 100dvh;
    display: flex; flex-direction: column; gap: 24px; overflow-y: auto;
    padding: 28px 16px 18px; background: var(--rail); color: #edf8f1;
}
.sidebar > .brand { margin: 0 8px 10px; }
.sidebar > .muted, .nav-label { margin: 0 8px 8px; color: #bed4cb; font-size: .83rem; }
.sidebar > .muted { margin-bottom: -16px; }
.sidebar nav a {
    display: flex; align-items: center; min-height: 42px; padding: 8px 11px; margin-bottom: 3px;
    color: #e0eee7; text-decoration: none; border-radius: 7px; overflow-wrap: anywhere;
}
.sidebar nav a:hover { background: #204a3e; }
.sidebar nav .active { background: #26574a; color: #f6fff9; box-shadow: inset 3px 0 #91e0b9; font-weight: 680; }
.sidebar-foot { margin-top: auto; border-top: 1px solid #426158; padding: 14px 7px 0; overflow-wrap: anywhere; }
.sidebar-foot p { margin-bottom: 8px; }
.quiet { background: transparent; color: #e0eee7; border-color: #729387; }
.sidebar :focus-visible, .entry-story :focus-visible { outline-color: #a6edcd; }

.main { width: 100%; max-width: 1500px; min-width: 0; padding: 36px clamp(22px, 3.7vw, 58px); margin-inline: auto; }
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
header p:last-child, header h1:last-child { margin-bottom: 0; }
.page-header { align-items: end; }
.page-header .action-link { flex: none; }
.breadcrumb { font-size: .88rem; color: var(--muted); font-weight: 630; overflow-wrap: anywhere; }
.section-nav { display: flex; gap: 4px 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.section-nav a {
    display: inline-flex; align-items: center; min-height: 42px; border-bottom: 2px solid transparent;
    padding: 5px 10px; color: var(--muted); font-weight: 650; text-decoration: none;
}
.section-nav a:is(:hover, :focus-visible) { border-color: var(--accent); color: var(--accent-hover); }
.main [id] { scroll-margin-block: 20px; }
.panel:target { border-color: var(--accent); }
.badge, .status { display: inline-block; padding: 5px 10px; border-radius: 999px; background: #e8efeb; color: #315247; font-size: .83rem; font-weight: 650; }
.badge:hover { color: var(--accent-hover); }
.status { flex: none; max-width: 100%; overflow-wrap: anywhere; }
.status.succeeded { color: #12533a; background: #def1e6; }
.status.running { color: #214b77; background: #e4edf8; }
.status.failed { color: var(--danger); background: #fceae7; }
.status.unknown, .status.cancelling { color: #745018; background: #fff0d3; }
.status.cancelled { color: #4b5552; background: #ecefee; }
.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; align-items: start; }
.workspace-overview, .board-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); align-items: stretch; }
.panel { min-width: 0; padding: clamp(17px, 2.2vw, 27px); border: 1px solid var(--line); border-radius: 13px; background: var(--surface); overflow-wrap: anywhere; }
.main > .panel { margin-bottom: 18px; }
.panel > :last-child { margin-bottom: 0; }
.task-panel { border-top: 4px solid var(--accent); }
.two-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.project-list, .agent-list, .task-list { margin-bottom: 16px; }
.project-row, .agent-row, .event, .provider-list > div, .run, .preview-deployment { border-top: 1px solid var(--line); padding: 12px 0; }
.project-row p, .agent-row p, .run > p, .preview-deployment p { margin: 4px 0; }
.agent-row, .event, .provider-list > div, .run-head, .preview-deployment > div {
    display: flex; justify-content: space-between; gap: 8px 14px; align-items: start; flex-wrap: wrap;
}
.run-head h2 { margin-bottom: 6px; }
.event time { color: var(--muted); white-space: nowrap; font-size: .83rem; }
.provider-list { margin-bottom: 15px; }
.provider-details { flex: 1 1 140px; }
.provider-actions, .task-actions, .preview-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.provider-actions button { font-size: .86rem; }
.run-error { color: var(--danger); }
.empty { color: var(--muted); }
.runs > .empty { padding: 18px; border: 1px dashed var(--field); border-radius: 8px; }
.empty h2, .empty h3 { color: var(--ink); }
.empty p:last-child { margin-bottom: 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 13px; border-radius: 8px; background: var(--canvas); font: inherit; }
summary { cursor: pointer; padding: 10px 0; color: var(--accent); font-weight: 650; }
.notice, .errors { padding: 13px 16px; border-radius: 8px; margin-bottom: 16px; }
.notice { background: var(--mint); color: #14503b; }
.errors { background: #fceae7; color: var(--danger); }
.errors p { margin: 0; }
footer { font-size: .82rem; color: var(--muted); margin-top: 20px; }

.task-list { max-height: 360px; overflow: auto; padding: 4px; margin-inline: -4px; }
.task-choice { display: block; width: 100%; margin-bottom: 7px; text-align: left; font-weight: 550; }
.task-choice span { display: block; margin-top: 3px; font-size: .84rem; color: var(--muted); }
.task-choice.selected { border-color: var(--accent); box-shadow: inset 3px 0 var(--accent); background: var(--mint); }
.task-description { white-space: pre-wrap; }
.task-actions { margin: 14px 0 20px; }
.criterion { display: flex; align-items: start; gap: 9px; font-weight: 500; }
.dependency-form button { margin: 0 8px 8px 0; }
.dependency-form, .security-page form, .main > .panel > form { max-width: 640px; }
.evidence-form, .git-access { padding-top: 12px; }
.inline-action { display: inline-block; margin-block: 10px; font-weight: 650; }
.mobile-task-link { display: none; }
.preview-heading, .preview-settings { display: flex; flex-wrap: wrap; align-items: start; gap: 12px; justify-content: space-between; }
.preview-settings { align-items: end; }
.preview-settings label { flex: 1 1 185px; }
.preview-settings button, .preview-actions { margin-bottom: 15px; }
.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.admin-stats strong { font-size: clamp(1.45rem, 4vw, 2.4rem); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.admin-statuses { display: flex; gap: 10px 22px; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; min-width: 620px; border-collapse: collapse; text-align: left; font-size: .91rem; }
.admin-table th, .admin-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { background: var(--canvas); color: var(--muted); }
.security-page { max-width: 940px; }
.security-page > .brand, .auth-standalone > .brand { margin-bottom: 24px; }

.entry-page, .auth-page { display: grid; place-items: center; min-height: 100vh; padding: clamp(16px, 4vw, 56px); }
.entry-shell, .auth-shell { display: grid; width: min(100%, 1100px); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.entry-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 20px 58px #122f2912; }
.entry-story {
    min-width: 0; color: #f0fff5; padding: clamp(28px, 4.5vw, 58px);
    display: flex; flex-direction: column; justify-content: space-between; gap: 38px;
    background: radial-gradient(ellipse at 92% 9%, #245a47 0%, transparent 62%), var(--rail);
}
.entry-copy h2 { max-width: 12ch; font-size: clamp(2.1rem, 4.6vw, 4rem); letter-spacing: -.065em; line-height: 1.04; }
.entry-copy p { color: #c9e0d5; max-width: 34ch; margin-bottom: 0; }
.entry-flow { list-style: none; margin: 0; padding: 0; }
.entry-flow li { display: flex; align-items: center; gap: 14px; border-top: 1px solid #537369; padding: 10px 0; }
.entry-flow span { color: #a6edcd; font: .84rem ui-monospace, monospace; }
.entry-form { min-width: 0; background: white; padding: clamp(25px, 5vw, 62px); align-content: center; }
.entry-form h1 { font-size: clamp(1.8rem, 3.3vw, 2.8rem); }
.entry-form > .muted { margin-bottom: 22px; }
.entry-mobile-brand { display: none; }
.entry-switch { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--canvas); border-radius: 10px; margin-bottom: 24px; }
.entry-switch a { padding: 8px 13px; color: var(--muted); text-decoration: none; font-weight: 650; border-radius: 7px; }
.entry-switch a[aria-current] { background: white; color: var(--ink); box-shadow: 0 1px 3px #122f2925; }
.password-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 6px; }
.password-heading label { margin: 0; }
.password-heading a { font-size: .88rem; }
.password-field { position: relative; }
.password-field:has(button:not([hidden])) input { padding-right: 88px; }
.password-field button { position: absolute; inset: 4px 4px 4px auto; min-height: 0; padding: 3px 9px; font-size: .84rem; }
.field-hint { margin: 6px 0 14px; }
.remember-choice { display: flex; width: fit-content; align-items: start; gap: 10px; margin: 17px 0; cursor: pointer; }
.remember-choice small { display: block; font-weight: 450; }
.entry-submit, .auth-form .primary { width: 100%; }
.auth-shell { gap: 20px 36px; max-width: 920px; align-items: center; }
.auth-shell > .brand { grid-column: 1 / -1; }
.auth-intro h1 { font-size: clamp(2rem, 5.5vw, 4rem); }
.auth-intro p { color: var(--muted); }
.auth-form { width: 100%; padding: clamp(20px, 3.5vw, 38px); background: white; border: 1px solid var(--line); border-radius: 16px; overflow-wrap: anywhere; }
.auth-form > p:last-child { margin: 16px 0 0; }
.auth-standalone { max-width: 580px; }

@media (max-width: 1020px) {
    .workspace { grid-template-columns: 194px minmax(0, 1fr); }
    .work-grid { grid-template-columns: minmax(0, 1fr); }
    .mobile-task-link { display: inline-block; }
}
@media (max-width: 720px) {
    .workspace { display: block; }
    .sidebar { position: static; height: auto; padding: 15px; gap: 8px; }
    .sidebar > .brand { margin: 0; }
    .sidebar > .muted { display: none; }
    .sidebar nav { display: flex; gap: 2px 5px; flex-wrap: wrap; }
    .sidebar nav a { margin: 0; }
    .nav-label { flex-basis: 100%; margin: 0 0 2px; }
    .sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0 0; }
    .sidebar-foot p { margin: 0; }
    .sidebar .quiet { min-height: 36px; padding-block: 4px; }
    .main { padding: 24px 15px; }
    header { align-items: start; flex-direction: column; gap: 10px; }
    .page-header { align-items: start; }
    .entry-shell, .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .entry-story, .auth-intro { display: none; }
    .entry-mobile-brand { display: block; margin-bottom: 22px; }
    .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    input:not([type=checkbox], [type=radio]), select, textarea { font-size: 16px; }
}
@media (max-width: 450px) {
    .two-cols { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
