:root {
    color-scheme: light;
    --bg: #f3f0e8;
    --paper: #fffcf7;
    --ink: #1d2430;
    --muted: #5e6872;
    --line: #e3dcd0;
    --accent: #0e5c4a;
    --accent-dark: #0b4a3b;
    --danger: #8d2e2e;
    --shadow: 0 1px 2px rgba(29, 36, 48, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
}

a { color: var(--accent); }

button, input, select, textarea { font: inherit; color: inherit; }

.skip {
    position: absolute;
    left: -999px;
    top: 8px;
    background: white;
    padding: 8px 12px;
    z-index: 2;
}

.skip:focus { left: 8px; }

.wrap {
    width: min(1040px, calc(100% - 32px));
    margin: 0 auto;
}

.wrap-bare {
    max-width: 440px;
    padding-top: 12vh;
}

.site {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 0 16px;
}

.brand {
    color: var(--ink);
    font-weight: 650;
    letter-spacing: -0.02em;
    text-decoration: none;
}

nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

nav a {
    color: var(--muted);
    text-decoration: none;
}

nav a[aria-current="page"] {
    color: var(--ink);
    font-weight: 650;
}

.who { color: var(--muted); font-size: 0.92rem; }

main { padding: 8px 0 64px; }

h1 {
    margin: 0;
    font-size: 1.8rem;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

h2 {
    margin: 0 0 12px;
    font-size: 1.05rem;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.card + .card,
.card + .table-wrap,
.table-wrap + .card { margin-top: 16px; }

.narrow { max-width: 560px; }

.empty p:first-child { margin-top: 0; }

.lede, .hint, .muted, .eyebrow { color: var(--muted); }

.eyebrow {
    margin: 0 0 8px;
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lede { margin-top: 0; }

.banner {
    padding: 12px 14px;
    border-radius: 8px;
    margin: 8px 0 16px;
}

.banner p { margin: 0; }

.banner p + p { margin-top: 4px; }

.banner.success { background: #e5f4ef; color: var(--accent-dark); }

.banner.error { background: #fdecec; color: var(--danger); }

.banner.notice { background: #fff6e8; color: #6d4a10; }

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

label.field > span,
.field > label span,
.field > span:not(.hint) {
    font-weight: 650;
}

.hint { font-size: 0.82rem; font-weight: 400; }

input, select, textarea {
    width: 100%;
    background: white;
    border: 1px solid #d5cec2;
    border-radius: 8px;
    padding: 10px 12px;
}

textarea { min-height: 180px; resize: vertical; }

textarea[hidden] { display: none !important; }

.editor {
    border: 1px solid #d5cec2;
    border-radius: 8px;
    background: white;
    overflow: hidden;
}

.editor-tools {
    display: flex;
    gap: 4px;
    padding: 6px;
    border-bottom: 1px solid var(--line);
    background: #faf7f2;
}

.editor-tools button {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}

.editor-tools button[aria-pressed="true"] {
    background: #e7efe9;
    color: var(--accent-dark);
}

.editor-u { text-decoration: underline; }

.editor-body {
    min-height: 180px;
    max-height: 420px;
    overflow: auto;
    padding: 10px 12px;
}

.editor-body:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.editor-body p { margin: 0 0 0.75em; }

.editor-body p:last-child { margin-bottom: 0; }

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
}

.check input { width: auto; }

.color-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-row input[type="color"] {
    width: 48px;
    height: 42px;
    padding: 4px;
    flex: none;
}

.color-row input[type="text"] { flex: 1; }

.thumb {
    display: block;
    align-self: flex-start;
    max-width: min(420px, 100%);
    max-height: 96px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    background: white;
}

.button {
    appearance: none;
    border: 0;
    background: var(--accent);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

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

.button.secondary {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}

.button.secondary:hover { background: #f6f1e7; }

.button.danger {
    background: transparent;
    color: var(--danger);
    padding-left: 0;
    padding-right: 0;
}

.button.danger:hover { background: transparent; text-decoration: underline; }

button:disabled { opacity: 0.6; cursor: wait; }

.text-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 0;
    cursor: pointer;
}

.text-button:hover { color: var(--ink); }

.stack { display: flex; gap: 8px; align-items: center; }

.stack.vertical { flex-direction: column; align-items: stretch; }

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 20px;
    align-items: start;
}

.side { position: sticky; top: 16px; }

.order { margin: 0 0 16px; padding-left: 1.2rem; color: var(--muted); }

.error-text {
    color: var(--danger);
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.danger-form { margin-top: 8px; }

.table-wrap { overflow-x: auto; padding: 8px 12px; }

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

td, th {
    padding: 12px 8px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.78rem;
    font-weight: 650;
    background: #ece7dc;
    color: var(--ink);
}

.badge.live { background: #e5f4ef; color: var(--accent-dark); }

.badge.stale { background: #fff6e8; color: #6d4a10; }

.badge.failed { background: #fdecec; color: var(--danger); }

.add-grid {
    display: grid;
    grid-template-columns: minmax(140px, 0.8fr) minmax(220px, 1.4fr) 180px auto;
    gap: 12px;
    align-items: end;
}

.add-grid .field { margin-bottom: 0; }

.card form + form { margin-top: 16px; }

@media (max-width: 800px) {
    .site, .page-head { align-items: flex-start; flex-direction: column; }
    .form-grid, .add-grid { grid-template-columns: 1fr; }
    .side { position: static; }
}
