:root {
    --canvas: #f6f2e8;
    --paper: #fffdf8;
    --paper-strong: #ffffff;
    --ink: #18222a;
    --muted: #66727c;
    --line: rgba(24, 34, 42, 0.12);
    --forest: #173f35;
    --forest-soft: #24584b;
    --mint: #b7f0d5;
    --mint-strong: #54d6a2;
    --sand: #eadbb7;
    --danger: #b54034;
    --success: #1e7d58;
    --shadow: 0 18px 40px rgba(24, 34, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(183, 240, 213, 0.45), transparent 28%),
        linear-gradient(180deg, #faf7ef 0%, var(--canvas) 55%, #efe7da 100%);
    color: var(--ink);
}

a {
    color: inherit;
}

code {
    background: rgba(23, 63, 53, 0.08);
    padding: 2px 6px;
    border-radius: 7px;
}

.shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(10, 27, 22, 0.96), rgba(23, 63, 53, 0.96)),
        linear-gradient(180deg, #122620, #1f2937);
    color: #f8fafc;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.sidebar-title {
    margin: 0;
    font-size: 31px;
    line-height: 1.08;
    font-weight: 700;
}

.sidebar-copy,
.sidebar-user-email {
    color: rgba(248, 250, 252, 0.75);
    line-height: 1.5;
}

.sidebar-user {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-user-name {
    font-weight: 700;
}

.nav-links,
.sidebar-actions {
    display: grid;
    gap: 10px;
}

.nav-link,
.primary-link,
.secondary-link,
.primary-button,
.ghost-button {
    text-decoration: none;
    border: none;
    border-radius: 16px;
    padding: 13px 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.nav-link {
    color: rgba(248, 250, 252, 0.92);
    background: rgba(255, 255, 255, 0.07);
}

.nav-link.active,
.primary-link,
.primary-button {
    background: linear-gradient(135deg, var(--mint), var(--mint-strong));
    color: #08372a;
}

.secondary-link {
    background: rgba(23, 63, 53, 0.08);
    color: var(--forest);
}

.primary-link:hover,
.secondary-link:hover,
.primary-button:hover,
.ghost-button:hover,
.nav-link:hover {
    transform: translateY(-1px);
}

.full {
    width: 100%;
}

.ghost-button {
    background: rgba(23, 63, 53, 0.08);
    color: var(--forest);
}

.logout {
    width: 100%;
    border: none;
    border-radius: 16px;
    padding: 13px 16px;
    font-weight: 700;
    cursor: pointer;
    background: var(--sand);
    color: #473917;
}

.admin-link {
    margin-top: auto;
    color: rgba(248, 250, 252, 0.7);
}

.content {
    padding: 32px;
}

.hero-card,
.card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    border-radius: 26px;
    padding: 28px;
    margin-bottom: 24px;
}

.hero-card h1,
.card h1,
.card h2,
.card h3 {
    margin: 0 0 10px;
}

.hero-card.compact {
    max-width: 620px;
}

.hero-text,
.card p,
.story-card p {
    color: var(--muted);
    line-height: 1.6;
}

.hero-actions,
.download-footer,
.download-meta,
.section-heading {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.eyebrow {
    color: var(--forest-soft);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
}

.eyebrow.light {
    color: rgba(248, 250, 252, 0.72);
}

.steps-grid,
.metrics-grid,
.download-grid,
.story-grid,
.admin-grid {
    display: grid;
    gap: 18px;
}

.steps-grid,
.metrics-grid,
.story-grid,
.admin-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.download-grid {
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}

.step-card,
.story-card,
.nested-card {
    margin-bottom: 0;
}

.story-card {
    background: rgba(23, 63, 53, 0.04);
    border: 1px solid rgba(23, 63, 53, 0.08);
    border-radius: 20px;
    padding: 18px;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--forest);
    color: white;
    font-weight: 800;
    margin-bottom: 12px;
}

.metric-card {
    margin-bottom: 0;
}

.metric-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.metric-value {
    margin: 8px 0;
    font-size: 42px;
    font-weight: 800;
    line-height: 1;
}

.metric-note,
.muted,
.download-hint {
    color: var(--muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(84, 214, 162, 0.17);
    color: var(--forest);
    font-size: 13px;
    font-weight: 700;
}

.status-pill-muted {
    background: rgba(24, 34, 42, 0.08);
    color: var(--muted);
}

.public-shell {
    min-height: calc(100vh - 64px);
    display: grid;
    align-items: center;
}

.single-card {
    justify-items: start;
}

.stack-form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.stack-form label,
.stack-form .check-row {
    display: grid;
    gap: 8px;
    color: var(--ink);
    font-weight: 600;
}

.field-input,
select.field-input,
input[type="file"].field-input {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--paper-strong);
    padding: 13px 14px;
    font-size: 15px;
    color: var(--ink);
}

.alert {
    border-radius: 18px;
    padding: 14px 16px;
    margin-bottom: 20px;
    font-weight: 600;
}

.alert.success {
    background: rgba(30, 125, 88, 0.12);
    color: var(--success);
}

.alert.danger {
    background: rgba(181, 64, 52, 0.12);
    color: var(--danger);
}

.clean-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
}

.portal-body {
    background:
        radial-gradient(circle at top left, rgba(84, 214, 162, 0.28), transparent 24%),
        linear-gradient(180deg, #f7f3ea 0%, #efe8da 100%);
}

.admin-shell {
    max-width: 1320px;
    margin: 0 auto;
    padding: 32px;
}

.admin-metrics {
    margin-bottom: 24px;
}

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

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

.inline-upload {
    display: flex;
    gap: 10px;
    align-items: center;
}

.inline-upload .field-input {
    min-width: 220px;
}

@media (max-width: 960px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .content,
    .admin-shell {
        padding: 20px;
    }

    .hero-actions,
    .section-heading,
    .download-footer,
    .download-meta,
    .inline-upload {
        flex-direction: column;
        align-items: flex-start;
    }
}
