:root {
    --ink: #221e19;
    --muted: #6e675e;
    --line: #e3d9cc;
    --accent: #1e4f4a;
    --brass: #8d6434;
    --paper: #f7f4ef;
    --card: #fffcf8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font: 16px/1.5 "Segoe UI", Candara, sans-serif;
}

a { color: var(--accent); }

.bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(247, 244, 239, 0.94);
}

.brand {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
    font-family: Georgia, "Palatino Linotype", serif;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.pearl {
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border: 2px solid var(--brass);
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 5px var(--brass);
}

.nav {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}

.nav a {
    color: inherit;
    text-decoration: none;
}

.nav a[aria-current="page"] {
    color: var(--accent);
    box-shadow: inset 0 -2px 0 var(--brass);
}

button.link {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.wrap {
    max-width: 1040px;
    margin: 0 auto;
    padding: 28px 20px 72px;
}

.narrow { max-width: 32rem; }

h1, h2, h3 {
    font-family: Georgia, "Palatino Linotype", serif;
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2.1rem; margin: 0 0 8px; }
h2 { font-size: 1.35rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }

.lead { max-width: 40rem; font-size: 1.05rem; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat strong {
    display: block;
    font-family: Georgia, "Palatino Linotype", serif;
    font-size: 1.8rem;
    font-weight: 600;
}

.fields { display: grid; gap: 14px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

label { display: block; margin-bottom: 6px; font-size: 0.92rem; }
label span { color: var(--muted); }

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: white;
    color: inherit;
    font: inherit;
}

textarea { min-height: 6rem; resize: vertical; }

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(30, 79, 74, 0.25);
    border-color: var(--accent);
}

.btn {
    appearance: none;
    border: 0;
    background: var(--accent);
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn.secondary {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn.danger {
    background: transparent;
    color: #8d2f24;
    border: 1px solid #e4c7c1;
}

.btn.small { padding: 6px 10px; font-size: 0.92rem; }

.flash { padding: 10px 12px; border-radius: 6px; margin-bottom: 16px; }
.flash.ok { background: #e5f2ea; }
.flash.error { background: #f8e8e4; }

.callout {
    border: 1px solid var(--line);
    border-left: 4px solid var(--brass);
    background: var(--card);
    border-radius: 0 8px 8px 0;
    padding: 12px 14px;
}

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.pill.active { background: #e5f2ea; color: #14613a; }
.pill.closed { background: #f8e8e4; color: #8d2f24; }

.mono, code, pre, textarea.mono {
    font-family: Consolas, "Courier New", monospace;
}

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
th {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters label { min-width: 11rem; flex: 1; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { width: 12rem; }

.defs { display: grid; grid-template-columns: 11rem 1fr; gap: 8px 16px; margin: 0; }
.defs dt { font-family: Consolas, "Courier New", monospace; }

pre, .codebox {
    background: #1c1915;
    color: #f6f3ee;
    padding: 14px;
    border-radius: 8px;
    overflow: auto;
    font-size: 0.9rem;
}

details { margin: 10px 0 16px; }
summary { cursor: pointer; font-weight: 600; }

.product + .product { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

.site-footer {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 20px 28px;
    color: var(--muted);
    font-size: 0.88rem;
}

@media (max-width: 800px) {
    .stats, .row-2, .defs { grid-template-columns: 1fr; }
    h1 { font-size: 1.7rem; }
}
