:root {
    --bg: #14202c;
    --surface: #1f2f3f;
    --line: #3a4f63;
    --text: #f1f4f7;
    --muted: #b6c3cf;
    --accent: #e0a94f;
    --accent-text: #14202c;
    --ok: #8fd6a6;
    --error: #ffb4a8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 18px/1.6 Verdana, Tahoma, "Segoe UI", system-ui, sans-serif;
}

a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 .5rem; }
p { margin: .5rem 0; }

.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1.5rem;
    padding: .75rem 16px;
    border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); font-weight: 700; font-size: 1.2rem; text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.top-actions { display: flex; align-items: center; gap: 1.25rem; margin-left: auto; }

.test-banner {
    margin: 0;
    padding: .4rem 16px;
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 700;
    text-align: center;
}

.page { width: 100%; max-width: 960px; margin: 0 auto; padding: 1.5rem 16px 3rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tile { display: block; color: var(--text); text-decoration: none; margin: 0; }
.tile:hover, .tile:focus-visible { border-color: var(--accent); }
.count { color: var(--accent); font-weight: 700; }
.muted { color: var(--muted); }

label { display: block; margin-top: 1rem; font-weight: 700; }
input, textarea {
    width: 100%;
    min-height: 48px;
    margin-top: .25rem;
    padding: .6rem .75rem;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

button, .button {
    display: inline-block;
    min-height: 48px;
    padding: .6rem 1.1rem;
    border-radius: 6px;
    border: 1px solid var(--accent);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
button.primary, .button { background: var(--accent); color: var(--accent-text); }
button.primary { width: 100%; margin-top: 1.25rem; }
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.link {
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font-weight: 400;
    text-decoration: underline;
}

.notice { color: var(--ok); font-weight: 700; }
.error { color: var(--error); font-weight: 700; }

.heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.heading h1 { margin: 0; }
.search { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: end; margin-bottom: 1rem; }
.search label { grid-column: 1 / -1; margin: 0; }
.search input { margin: 0; }

.list, .activity, .codes { list-style: none; margin: 0; padding: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.row p { margin: 0; overflow-wrap: anywhere; }
.activity li { display: grid; grid-template-columns: 11rem 1fr auto; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.activity li:last-child { border-bottom: 0; }

.qr { width: 220px; margin: 1rem auto; padding: 10px; background: #fff; border-radius: 6px; }
.qr svg { display: block; width: 100%; height: auto; }
.codes li { padding: .25rem 0; font-family: Consolas, monospace; overflow-wrap: anywhere; }

details { margin-top: 1.5rem; }
.danger-zone { margin-top: 1.5rem; }

@media (max-width: 600px) {
    .top-actions { margin-left: 0; }
    .row { align-items: flex-start; flex-direction: column; }
    .activity li { grid-template-columns: 1fr; gap: 0; }
}

.pagination { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; }

select {
    width: 100%;
    min-height: 48px;
    margin-top: .25rem;
    padding: .6rem .75rem;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}
select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
fieldset { margin: 1.25rem 0 0; padding: 0 1rem 1rem; border: 1px solid var(--line); border-radius: 6px; }
legend { padding: 0 .5rem; font-weight: 700; }
.badge { display: inline-block; margin-right: .5rem; padding: 0 .5rem; border-radius: 4px; background: #9ec5ec; color: var(--accent-text); font-size: .85rem; font-weight: 700; }
.badge-sell { background: var(--accent); }
.due { color: var(--error); font-weight: 700; }
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: 1rem; }
.filters a { padding: .25rem .6rem; border-radius: 6px; }
.filters a.active { background: var(--accent); color: var(--accent-text); font-weight: 700; text-decoration: none; }
.facts { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: .25rem 1rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.match { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.match:last-child { border-bottom: 0; }
.match p { margin: .15rem 0 0; }

.due-chip { display: inline-block; padding: 0 .5rem; border-radius: 4px; border: 1px solid var(--line); color: var(--text); font-weight: 700; }
.due-green { background: #1f6b41; border-color: #1f6b41; color: #fff; }
.due-orange { background: #b86a10; border-color: #b86a10; color: #fff; }
.due-red { background: #b3261e; border-color: #b3261e; color: #fff; }
.level-green { border-left: 6px solid #2f9e5f; }
.level-orange { border-left: 6px solid #e58a1f; }
.level-red { border-left: 6px solid #e5483f; }
.legend { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .85rem; }
.checklist { list-style: none; margin: 0 0 1rem; padding: 0; }
.checklist li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .25rem 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist li > form:first-child { flex: 1; min-width: 0; }
.check {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: .5rem 0;
    border: 0;
    background: none;
    color: var(--text);
    font-weight: 400;
    text-align: left;
}
.box {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 2px solid var(--accent);
    border-radius: 6px;
    color: var(--accent);
    font-weight: 700;
}
.done .check, li.done > span:last-child { color: var(--muted); text-decoration: line-through; }
.small { font-size: .85rem; }
.spaced { margin-top: .75rem; }
.choice { display: flex; align-items: flex-start; gap: .75rem; margin-top: .75rem; font-weight: 400; }
.choice input { flex: none; width: 24px; min-height: 24px; height: 24px; margin: .2rem 0 0; }
