:root {
    --ink: #1c1915;
    --muted: #6d655c;
    --paper: #f3efe7;
    --card: #fffdf9;
    --line: #e4dcd0;
    --teal: #1f6f68;
    --teal-deep: #154e49;
    --copper: #c4622d;
    --warn: #8a5a12;
    --warn-bg: #f8efd8;
    --bad: #8d2f2f;
    --bad-bg: #f8e6e2;
    --good-bg: #e5f3f1;
    --sidebar: #171512;
    --sidebar-text: #f6f1e8;
    --shadow: 0 18px 40px rgba(48, 36, 22, 0.06);
    --sans: "Segoe UI", Candara, "Helvetica Neue", sans-serif;
    --serif: Georgia, "Iowan Old Style", Palatino, serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
}

body { min-height: 100vh; }

a { color: inherit; }

button, input, select { font: inherit; }

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

.skip:focus { top: 12px; }

.shell {
    display: grid;
    grid-template-columns: 252px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
}

.brand strong { display: block; font-family: var(--serif); font-size: 22px; font-weight: 500; }

.brand small { color: #c9bfb2; letter-spacing: 0.02em; }

.mark { position: relative; width: 38px; height: 38px; flex: none; }

.mark i {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 8px;
    display: block;
}

.mark i:first-child { background: var(--copper); left: 0; top: 0; }

.mark i:last-child { background: #2a9d8f; right: 0; bottom: 0; }

.nav { display: flex; flex-direction: column; gap: 6px; }

.nav a {
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 12px;
    color: #ebe4d8;
}

.nav a:hover, .nav a.active { background: rgba(255, 255, 255, 0.08); color: white; }

.aside-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }

.aside-note { margin: 0; color: #b7ad9f; font-size: 13px; line-height: 1.45; }

.main { padding: 36px 40px 56px; max-width: 1080px; }

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

.eyebrow {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 12px;
    color: var(--copper);
}

h1 {
    margin: 0;
    font-family: var(--serif);
    font-size: 44px;
    font-weight: 500;
    letter-spacing: -0.03em;
}

.lede { margin: 10px 0 0; max-width: 62ch; color: var(--muted); line-height: 1.5; }

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}

.card, .panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.card { padding: 18px 18px 16px; }

.card span { display: block; color: var(--muted); font-size: 13px; }

.card strong {
    display: block;
    margin-top: 8px;
    font-family: var(--serif);
    font-size: 36px;
    font-weight: 500;
}

.panel { padding: 8px 8px 12px; margin-bottom: 18px; }

.panel-head, .table-wrap { padding: 0 12px; }

.panel h2 { margin: 14px 12px 8px; font-size: 18px; font-family: var(--serif); font-weight: 500; }

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

th, td { text-align: left; padding: 12px; border-top: 1px solid var(--line); vertical-align: top; }

th { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

code { font-family: Consolas, "Courier New", monospace; font-size: 0.92em; }

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 13px;
    background: var(--warn-bg);
    color: var(--warn);
}

.pill.active, .pill.acked { background: var(--good-bg); color: var(--teal-deep); }

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

.button, .ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
}

.button { background: var(--teal); color: white; }

.button:hover { background: var(--teal-deep); }

.button-full { width: 100%; }

.ghost { background: transparent; border-color: #8d857a; color: var(--sidebar-text); }

.ghost.dark { border-color: var(--line); color: var(--ink); background: white; }

.form-grid, .stack { display: grid; gap: 16px; }

.form-grid { grid-template-columns: 1fr 1fr; }

.span-2 { grid-column: span 2; }

fieldset {
    border: 1px solid var(--line);
    border-radius: 18px;
    margin: 0 0 16px;
    padding: 18px;
    background: var(--card);
}

legend { padding: 0 8px; font-family: var(--serif); font-size: 20px; }

label { display: block; font-size: 14px; margin-bottom: 6px; }

input, select {
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid #d9d0c4;
    background: white;
    padding: 0 12px;
    color: var(--ink);
}

textarea { width: 100%; }

.field-error, .alert { color: var(--bad); font-size: 14px; margin: 6px 0 0; }

.validation-summary-valid { display: none; }

.alert, .toast, .note {
    border-radius: 14px;
    padding: 12px 14px;
    margin: 0 0 16px;
    line-height: 1.45;
}

.alert { background: var(--bad-bg); }

.toast { background: var(--good-bg); color: var(--teal-deep); }

.note { background: white; border: 1px solid var(--line); color: var(--muted); }

.note.warn { background: var(--warn-bg); color: var(--warn); }
.secret-row { display: flex; gap: 10px; align-items: center; }

.secret-row .secret {
    flex: 1;
    font-family: ui-monospace, Consolas, monospace;
    background: var(--sidebar);
    color: var(--sidebar-text);
    border-color: transparent;
}

.secret-row .ghost { flex: none; white-space: nowrap; }

.check { display: flex; gap: 10px; align-items: center; }

.check input { width: auto; min-height: 0; }

.actions { display: flex; gap: 10px; align-items: center; }

.history { list-style: none; padding: 0 12px 8px; margin: 0; }

.history li { padding: 10px 0; border-top: 1px solid var(--line); }

.history time { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }

.search { display: flex; gap: 10px; align-items: end; margin-bottom: 16px; }

.search .field { flex: 1; }

.filters {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr 0.9fr auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 16px;
}

.sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.pager {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 4px 12px 8px;
}

.login-body {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    background:
        radial-gradient(circle at 12% 18%, rgba(196, 98, 45, 0.18), transparent 28%),
        radial-gradient(circle at 70% 80%, rgba(31, 111, 104, 0.16), transparent 26%),
        var(--paper);
}

.login-copy { padding: 64px; display: flex; flex-direction: column; justify-content: flex-end; }

.login-copy h1 { font-size: 68px; max-width: 8ch; }

.login-card h1 { font-size: 40px; }

.login-card {
    margin: auto;
    width: min(440px, calc(100% - 48px));
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 28px;
    box-shadow: var(--shadow);
}

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

@media (max-width: 980px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: sticky; top: 0; z-index: 2; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .aside-foot { margin-top: 0; }
    .cards, .form-grid, .login-body, .filters { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .main { padding: 24px 16px 40px; }
    h1, .login-copy h1 { font-size: 36px; }
    .login-copy { padding: 32px 20px 0; }
}
