:root {
    --bg: #f4f1ea;
    --bg-accent: #e7efe9;
    --surface: #ffffff;
    --ink: #1c1915;
    --muted: #5f675f;
    --line: #d9e0d8;
    --teal: #1f6b4a;
    --teal-dark: #154d35;
    --teal-soft: #e5f4ec;
    --amber: #9a6700;
    --red: #9f2d2d;
    --red-soft: #fde8e8;
    --green: #157a3a;
    --green-soft: #e5f6ea;
    --shadow: 0 16px 40px rgba(28, 25, 21, 0.06);
    --radius: 16px;
    --font: "Source Sans 3", "Segoe UI", sans-serif;
    --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: var(--font);
    background:
        radial-gradient(900px 420px at -10% -10%, rgba(31, 107, 74, 0.16), transparent 55%),
        radial-gradient(700px 380px at 110% 0%, rgba(154, 103, 0, 0.1), transparent 50%),
        var(--bg);
}

a { color: var(--teal-dark); }

.page {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 64px;
}

.brand-mark {
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--teal);
    font-weight: 700;
}

h1, h2, h3 { font-family: var(--display); font-weight: 550; }

h1 { font-size: 2.4rem; line-height: 1.1; margin: 4px 0 8px; }

.brand-row, .btn-row, .toolbar-actions, .list-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.brand p, .lede, .hint, .db-line, .selection-meta, .note-list, .list-desc {
    color: var(--muted);
    line-height: 1.5;
}

.db-line { margin-top: 8px; font-size: 0.92rem; }

.steps, .tool-grid, .mode-grid, .stat-grid, .form-grid {
    display: grid;
    gap: 12px;
}

.steps {
    grid-template-columns: repeat(auto-fit, minmax(140px, max-content));
    margin: 18px 0;
}

.step-pill, .tool-card, .option-card, .panel, .stat, .list-picker, .table-wrap, .zip-cloud, .confirm-panel, .delete-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.step-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
}

.step-pill.active { background: var(--teal); color: white; border-color: var(--teal); }
.step-pill.done { background: var(--teal-soft); color: var(--teal-dark); }

.panel { padding: 22px; box-shadow: var(--shadow); }
.panel h2 { margin-top: 0; }

.tool-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.tool-card {
    display: block;
    padding: 16px;
    text-decoration: none;
    color: inherit;
}
.tool-card:hover { border-color: var(--teal); }
.tool-card p { margin-bottom: 0; }

.mode-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 12px 0; }
.option-card { display: flex; gap: 10px; padding: 14px; cursor: pointer; }
.option-card.selected { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.option-card p { margin: 4px 0 0; }

.alert { padding: 12px 14px; border-radius: 12px; margin: 12px 0; }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-success { background: var(--green-soft); color: var(--green); }

.field-label, .mini-field span {
    display: block;
    font-weight: 700;
    margin: 14px 0 6px;
}

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

textarea { resize: vertical; }

.check-line {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 12px;
}
.check-line input { margin-top: 4px; }

.list-toolbar { align-items: end; margin-top: 8px; }
.list-toolbar > div:first-child { flex: 1; }
.toolbar-actions { align-items: end; }
.mini-field { min-width: 140px; }
.mini-field span { margin-top: 0; }

.list-picker { max-height: 360px; overflow: auto; margin-top: 8px; }
.list-row {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
}
.list-row:last-child { border-bottom: 0; }
.list-row.hidden { display: none; }
.list-title { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.list-desc { display: block; font-size: 0.92rem; }
.inactive, .campaign {
    font-style: normal;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.inactive { color: var(--amber); }
.campaign { color: var(--teal); }
.picker-off { opacity: 0.45; }

.form-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 8px 0 16px; }
.stat { padding: 14px; }
.stat span { color: var(--muted); font-size: 0.86rem; }
.stat strong { display: block; font-size: 1.4rem; margin-top: 4px; }

.note-list { padding-left: 18px; }
.section-title { margin: 22px 0 8px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

.zip-cloud {
    max-height: 240px;
    overflow: auto;
    padding: 12px 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.btn {
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.btn-primary { background: var(--teal); color: white; }
.btn-secondary { background: white; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: var(--red); color: white; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-row { justify-content: flex-start; margin-top: 18px; flex-wrap: wrap; }

.confirm-panel, .delete-panel { margin-top: 22px; padding: 16px; }
.delete-panel { background: var(--red-soft); border-color: #f3c0c0; }
.confirm-panel { background: var(--teal-soft); }

.hidden { display: none; }
.text-link { font-weight: 700; text-decoration: none; }
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-card { width: min(440px, 100%); }

@media (max-width: 720px) {
    h1 { font-size: 2rem; }
    .list-toolbar, .brand-row { display: block; }
    .toolbar-actions { margin-top: 8px; }
}
