:root {
    --ink: #1c1916;
    --ink-soft: #5c564e;
    --paper: #f3efe7;
    --paper-2: #fffdf8;
    --line: #e2d9cc;
    --copper: #b5522a;
    --copper-dark: #8c3d1d;
    --pine: #1f6b4a;
    --danger: #9d2c2c;
    --shadow: 0 16px 40px rgba(28, 25, 22, 0.12);
    --radius: 14px;
    --font: "Segoe UI", "Helvetica Neue", sans-serif;
    --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(1200px 400px at 10% -10%, #efe4d4 0%, transparent 60%),
        var(--paper);
    font-family: var(--font);
    line-height: 1.5;
}

a { color: inherit; }

button, input, select { font: inherit; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 20px;
    background: var(--ink);
    color: #f7f1e8;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-decoration: none;
    line-height: 1.1;
}

.brand strong {
    font-family: var(--serif);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.brand span {
    color: #c8b8a4;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.menu-panel {
    max-width: 640px;
    margin-top: 22px;
    padding: 10px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.menu,
.menu .submenu {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu .submenu {
    margin: 2px 0 6px 14px;
    padding-left: 12px;
    border-left: 1px solid var(--line);
}

.menu a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
}

.menu a:hover,
.menu a:focus-visible {
    background: #f3e6da;
    color: var(--copper-dark);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.top-actions a {
    text-decoration: none;
    border-radius: 999px;
    padding: 4px 12px;
    color: #f7f1e8;
    border: 1px solid rgba(247, 241, 232, 0.22);
}

.top-actions a:hover,
.top-actions a[aria-current="page"] {
    background: var(--copper);
    border-color: var(--copper);
}

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0 72px;
}

.hero {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 28px;
    align-items: end;
}

.kicker {
    margin: 0 0 8px;
    color: var(--copper-dark);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1, h2 {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

h1 { font-size: clamp(2.2rem, 5vw, 4rem); margin: 0 0 12px; }
h2 { font-size: 1.6rem; margin: 0; }

.lede {
    max-width: 42rem;
    margin: 0;
    color: var(--ink-soft);
    font-size: 1.08rem;
}

.hero-card {
    background: var(--ink);
    color: #f7f1e8;
    border-radius: var(--radius);
    padding: 22px;
}

.hero-card p { margin: 8px 0 0; color: #d9cbbd; }
.hero-card a { color: #f3c7b4; }

.panel {
    margin-top: 28px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
    padding: 18px 20px 0;
}

.panel-head p { margin: 0; color: var(--ink-soft); }

.notice {
    margin: 18px 0 0;
    padding: 12px 14px;
    border-radius: 10px;
}

.notice.ok { background: #e5f4ec; color: #145336; }
.notice.bad { background: #fde8e4; color: #7c241c; }

.add-form, .editor { padding: 18px 20px 20px; }

.add-form {
    display: grid;
    grid-template-columns: 1.1fr 1.3fr 1.4fr 1fr 90px auto;
    gap: 12px;
    align-items: end;
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--ink-soft);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

input, select {
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #d9d0c4;
    border-radius: 10px;
}

input:focus, select:focus, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--copper);
    outline-offset: 2px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 16px;
    border: 0;
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
}

.btn-primary { background: var(--ink); color: #f7f1e8; }
.btn-primary:hover { background: #000; }
.btn-copper { background: var(--copper); color: #fff; }
.btn-copper:hover { background: var(--copper-dark); }
.btn-quiet {
    background: transparent;
    color: var(--danger);
    border: 1px solid #eccfc8;
    min-height: 36px;
    padding: 6px 12px;
}
.btn-quiet:hover { background: #fde8e4; }
.locked { color: var(--ink-soft); font-size: 0.85rem; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
    padding: 10px 8px;
    text-align: left;
    vertical-align: middle;
    border-top: 1px solid var(--line);
}

th {
    color: var(--ink-soft);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.savebar {
    position: sticky;
    bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px;
    background: rgba(255, 253, 248, 0.94);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow);
}

.savebar p { margin: 0; color: var(--ink-soft); }

.empty {
    margin: 0;
    padding: 8px 4px 18px;
    color: var(--ink-soft);
}

@media (max-width: 980px) {
    .hero, .add-form { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
    .topbar { flex-wrap: wrap; padding: 6px 14px; }
    .page { width: min(1120px, calc(100% - 24px)); }
}

@media (max-width: 720px) {
    .hero, .add-form { grid-template-columns: 1fr; }
    .editor thead { display: none; }
    .editor tr {
        display: block;
        padding: 12px 0;
        border-top: 1px solid var(--line);
    }
    .editor td {
        display: block;
        border: 0;
        padding: 6px 0;
    }
    .editor td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        color: var(--ink-soft);
        font-size: 0.75rem;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }
    .savebar { border-radius: 16px; flex-direction: column; align-items: stretch; }
}
