:root {
    --bg: #1a1f18;
    --bg-2: #232a20;
    --panel: #2a3226;
    --text: #e6e2d6;
    --muted: #9a9486;
    --line: #3d4636;
    --accent: #6b8f4e;
    --accent-2: #8a6b45;
    --danger: #a84f3f;
    --ok: #4a7a4a;
    --warn: #8a6b45;
    --radius: 4px;
    --font: "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(ellipse at top, #2c3528 0%, transparent 55%),
        linear-gradient(180deg, #1a1f18 0%, #121610 100%);
}

a { color: #b8c9a4; text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
    width: min(960px, calc(100% - 1.5rem));
    margin-inline: auto;
}

.topbar {
    border-bottom: 1px solid var(--line);
    background: rgba(18, 22, 16, 0.85);
    backdrop-filter: blur(6px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 0;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
    font-size: 1.15rem;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: center;
    font-size: 0.95rem;
}

.nav-user {
    color: var(--muted);
    padding-left: 0.5rem;
    border-left: 1px solid var(--line);
}

main.wrap {
    padding: 1.5rem 0 3rem;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.35rem;
    margin-bottom: 1.25rem;
}

.panel.narrow { max-width: 420px; margin-inline: auto; }

h1, h2 {
    margin: 0 0 0.5rem;
    font-weight: 650;
    line-height: 1.25;
}

h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; margin-top: 0.25rem; }

.muted { color: var(--muted); margin: 0.35rem 0 1rem; }

.flash {
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid var(--line);
}

.flash-ok { background: rgba(74, 122, 74, 0.25); border-color: var(--ok); }
.flash-error { background: rgba(168, 79, 63, 0.25); border-color: var(--danger); }

.form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-width: 480px;
}

.form label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.form input,
.form select,
.form textarea {
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.55rem 0.65rem;
}

.form input:focus,
.form select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.btn {
    display: inline-block;
    font: inherit;
    cursor: pointer;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #11150f;
    font-weight: 600;
    padding: 0.55rem 0.95rem;
    border-radius: var(--radius);
    text-decoration: none;
}

.btn:hover { filter: brightness(1.08); text-decoration: none; }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--line);
}

.btn-danger {
    background: transparent;
    border-color: var(--danger);
    color: #e8b4aa;
}

.btn-small {
    padding: 0.3rem 0.55rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

.inline-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    max-width: none;
    margin-top: 0.75rem;
}

.stat-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    display: grid;
    gap: 0.5rem;
}

.stat-list li {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding: 0.45rem 0;
}

.table-wrap { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.table th,
.table td {
    text-align: left;
    padding: 0.55rem 0.45rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.row-due td { color: #e8b4aa; }

.cell-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 10rem;
}

.cell-actions details {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.25rem 0.4rem;
    background: var(--bg-2);
}

.cell-actions summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--muted);
}

.inline-form {
    margin-top: 0.4rem;
    max-width: none;
    gap: 0.4rem;
}

.inline-form label {
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
}

.inline-form input[type="number"] {
    width: 4rem;
    padding: 0.3rem;
}

form.inline { display: inline; }

.steps {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
    color: var(--muted);
}

.steps li { margin-bottom: 0.35rem; }

code {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.88em;
    background: var(--bg);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

.code-lg {
    font-size: 1.15rem;
    letter-spacing: 0.08em;
}

.footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
    padding: 1rem 0 1.5rem;
}

@media (max-width: 640px) {
    .row-3 { grid-template-columns: 1fr; }
    .nav { width: 100%; }
    .nav-user {
        border-left: none;
        padding-left: 0;
        width: 100%;
    }
}
