:root {
    --bg: #f5f3ef;
    --bg-accent: #ece7df;
    --surface: #ffffff;
    --ink: #1f1a16;
    --muted: #6b6158;
    --line: #ddd4c8;
    --teal: #0f5f5b;
    --teal-dark: #0a4542;
    --teal-soft: #d7f3f0;
    --amber: #b45309;
    --amber-soft: #fef3c7;
    --red: #b42318;
    --red-soft: #fee4e2;
    --green: #15803d;
    --green-soft: #dcfce7;
    --shadow: 0 12px 32px rgba(31, 26, 22, 0.08);
    --radius: 14px;
    --font: "Source Sans 3", "Segoe UI", sans-serif;
    --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(ellipse 80% 50% at 8% -10%, rgba(15, 95, 91, 0.14), transparent 50%),
        radial-gradient(ellipse 55% 40% at 100% 0%, rgba(180, 35, 24, 0.08), transparent 45%),
        linear-gradient(180deg, var(--bg-accent), var(--bg));
}

.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 36px 20px 72px;
}

.brand { margin-bottom: 24px; }

.brand-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.brand-mark {
    display: inline-block;
    font-family: var(--display);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 8px;
}

.brand h1,
.login-card h1 {
    margin: 0 0 8px;
    font-family: var(--display);
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 650;
    letter-spacing: -0.02em;
}

.brand p,
.lede {
    margin: 0;
    max-width: 760px;
    color: var(--muted);
    line-height: 1.55;
}

.steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.step-pill {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.55);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.step-pill.active {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}

.step-pill.done {
    background: var(--teal-soft);
    border-color: #9ee4de;
    color: var(--teal-dark);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}

.panel h2 {
    margin: 0 0 6px;
    font-family: var(--display);
    font-size: 1.45rem;
}

.panel .lede { margin: 0 0 22px; }

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 18px;
    border: 1px solid;
    font-size: 0.95rem;
}

.alert-error { background: var(--red-soft); border-color: #fecaca; color: var(--red); }
.alert-info { background: var(--teal-soft); border-color: #99e6df; color: var(--teal-dark); }
.alert-success { background: var(--green-soft); border-color: #86efac; color: var(--green); }

.list-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.mini-field span {
    display: block;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--muted);
    margin-bottom: 4px;
}

.selection-meta {
    margin: 10px 0 12px;
    color: var(--muted);
    font-size: 0.92rem;
}

.list-picker {
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfaf7;
}

.list-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
}

.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #fff; }
.list-row:has(input:checked) { background: var(--teal-soft); }
.list-row.hidden { display: none; }
.list-row input { margin-top: 4px; }

.list-main { min-width: 0; }
.list-title { display: block; }
.list-title strong { margin-right: 8px; }
.list-desc {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.4;
    word-break: break-word;
}

.inactive {
    font-style: normal;
    margin-left: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--amber);
}

.section-title {
    margin: 28px 0 12px;
    font-family: var(--display);
    font-size: 1.15rem;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.option-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    background: #fff;
    cursor: pointer;
}

.option-card.selected,
.option-card:has(input:checked) {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(15, 95, 91, 0.12);
}

.option-card strong { display: block; margin-bottom: 4px; }
.option-card p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.option-card input { margin-top: 3px; }

.filter-fields { margin-top: 18px; }
.hidden { display: none !important; }

label.field-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 650;
    color: var(--muted);
    margin-bottom: 6px;
}

select,
input[type="text"],
input[type="search"],
input[type="password"],
textarea {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font: inherit;
}

select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(15, 95, 91, 0.15);
}

.hint { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; }
.empty { padding: 24px; color: var(--muted); text-align: center; }

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.btn {
    appearance: none;
    border: none;
    border-radius: 10px;
    padding: 11px 18px;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #8f1b13; }
.btn-danger:disabled,
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.text-link {
    color: var(--teal);
    font-weight: 650;
    text-decoration: none;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

.stat {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    background: #fbfaf7;
}

.stat span { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 650; }
.stat strong { display: block; margin-top: 4px; font-size: 1.35rem; }
.stat em { display: block; margin-top: 4px; font-style: normal; color: var(--ink); font-size: 0.92rem; word-break: break-word; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th,
.data-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
.data-table th {
    background: #f8f4ee;
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.data-table.compact td { font-size: 0.9rem; white-space: nowrap; }
.desc-cell { font-size: 0.9rem; line-height: 1.4; min-width: 220px; }
.new-desc { color: var(--teal-dark); }
.muted { color: var(--muted); font-size: 0.88rem; }

.delete-panel {
    margin-top: 28px;
    padding: 18px;
    border-radius: 12px;
    background: var(--red-soft);
    border: 1px solid #fecaca;
}

.delete-panel h3 { margin: 0 0 8px; font-family: var(--display); }
.delete-panel p { margin: 0 0 16px; color: #7a1d16; }

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card { max-width: 420px; width: 100%; }
.login-form { margin-top: 18px; }

@media (max-width: 700px) {
    .page { padding: 22px 14px 48px; }
    .panel { padding: 20px 16px; }
    .list-toolbar { display: block; }
    .toolbar-actions { margin-top: 12px; }
}
