:root {
    --bg: #f5f1e8;
    --panel: rgba(255, 251, 244, 0.92);
    --panel-strong: #1f3a37;
    --ink: #1e2321;
    --muted: #5f6a67;
    --line: rgba(31, 58, 55, 0.14);
    --accent: #a04d2a;
    --accent-soft: #e8b79d;
    --success: #2b6b54;
    --warning: #9f5b22;
    --danger: #9a3431;
}

body[data-theme="dark"] {
    --bg: #111210;
    --panel: rgba(28, 27, 25, 0.94);
    --panel-strong: #4f98a3;
    --ink: #d8d4cf;
    --muted: #8f8c88;
    --line: rgba(255, 255, 255, 0.08);
    --accent: #e0914a;
    --accent-soft: rgba(224, 145, 74, 0.18);
    --success: #6daa45;
    --warning: #e0914a;
    --danger: #e05c5c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "IBM Plex Sans", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(160, 77, 42, 0.14), transparent 30%),
        radial-gradient(circle at right, rgba(31, 58, 55, 0.12), transparent 24%),
        linear-gradient(180deg, #fbf8f1 0%, var(--bg) 100%);
}

body[data-theme="dark"] {
    background:
        radial-gradient(circle at top left, rgba(79, 152, 163, 0.1), transparent 34%),
        radial-gradient(circle at right, rgba(224, 145, 74, 0.08), transparent 28%),
        linear-gradient(180deg, #111210 0%, #151613 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

.hero-shell,
.simple-shell,
.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0 72px;
}

.hero-panel,
.simple-panel,
.action-card,
.metric-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 16px 48px rgba(31, 58, 55, 0.08);
}

.hero-panel,
.simple-panel {
    padding: 40px;
}

.login-panel {
    width: min(480px, 100%);
    margin: 6vh auto 0;
    display: grid;
    gap: 24px;
    justify-items: center;
    text-align: center;
    padding: 48px 40px 40px;
}

.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.login-sidebar-logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.login-sidebar-logo-glyph {
    width: 55px;
    height: 62px;
}

.login-brand-wordmark {
    font-family: "Fraunces", serif;
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.login-context-note {
    margin: 0;
    max-width: 34ch;
}

.login-context-note-hidden {
    display: none;
}

.login-cta-button {
    min-width: min(320px, 100%);
    gap: 12px;
    padding: 14px 22px;
    font-size: 1rem;
    box-shadow: 0 12px 28px rgba(31, 58, 55, 0.16);
}

.login-cta-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.login-cta-icon svg {
    width: 20px;
    height: 20px;
}

.hero-panel h1,
.simple-panel h1,
.page-header h1,
.action-card h2 {
    margin: 0;
    font-family: "Fraunces", serif;
    font-weight: 700;
    line-height: 1.04;
}

.hero-panel h1,
.page-header h1 {
    font-size: clamp(2.2rem, 5vw, 4.4rem);
    max-width: 11ch;
}

.simple-panel h1 {
    font-size: clamp(1.8rem, 4vw, 3rem);
}

.hero-copy,
.page-header p,
.simple-panel p,
.action-card p,
.page-note,
.checklist-detail {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

.hero-actions,
.state-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.button,
.subtle-link,
.state-pill,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 999px;
    font-weight: 600;
}

.button,
button.button {
    border: 0;
    background: var(--panel-strong);
    color: #fff9f1;
    cursor: pointer;
}

.button.button-disabled {
    background: rgba(68, 52, 44, 0.48);
    color: rgba(255, 249, 241, 0.72);
    cursor: not-allowed;
    pointer-events: none;
}

.subtle-link,
.state-pill {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.66);
}

.state-pill-active {
    background: var(--accent-soft);
    border-color: rgba(160, 77, 42, 0.35);
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.75rem;
    font-weight: 600;
}

.page-header {
    margin-bottom: 28px;
}

.card-grid,
.state-band {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.action-card,
.metric-card {
    padding: 24px;
}

.action-card-strong {
    background: linear-gradient(180deg, rgba(31, 58, 55, 0.95), rgba(48, 90, 85, 0.92));
    color: #fff9f1;
}

.action-card-strong p,
.action-card-strong .eyebrow {
    color: rgba(255, 249, 241, 0.82);
}

.metric-card span {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.86rem;
}

.metric-card strong {
    font-size: 1.1rem;
}

.checklist {
    display: grid;
    gap: 14px;
    padding: 0;
    margin: 24px 0 0;
    list-style: none;
}

.checklist-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.6);
}

.checklist-item-complete {
    border-color: rgba(43, 107, 84, 0.25);
}

.checklist-item-current {
    border-color: rgba(159, 91, 34, 0.25);
}

.checklist-item-blocked {
    border-color: rgba(154, 52, 49, 0.2);
}

.checklist-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.checklist-meta {
    display: grid;
    gap: 6px;
    text-align: right;
    color: var(--muted);
    font-size: 0.9rem;
}

.field-label {
    display: block;
    margin: 0 0 8px;
    font-weight: 600;
}

.field-input {
    width: 100%;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    font: inherit;
    background: rgba(255, 255, 255, 0.8);
}

.field-input-area {
    min-height: 110px;
    resize: vertical;
}

.action-form {
    display: block;
}

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

.profile-checklist-shell {
    margin-top: 28px;
}

.profile-checklist-shell h2 {
    margin: 0;
    font-family: "Fraunces", serif;
    font-weight: 700;
}

.admin-shell {
    width: min(1400px, calc(100% - 32px));
}

.admin-section {
    margin-top: 28px;
}

.admin-management-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.admin-toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.admin-tab-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    font-weight: 600;
}

.admin-tab-link-active {
    background: var(--panel-strong);
    color: #fff;
}

.admin-disclosure,
.admin-row-disclosure {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
}

.admin-disclosure {
    min-width: 220px;
    padding: 10px 12px;
}

.admin-row-disclosure {
    padding: 8px 10px;
}

.admin-disclosure summary,
.admin-row-disclosure summary {
    cursor: pointer;
    font-weight: 600;
}

.admin-disclosure[open],
.admin-row-disclosure[open] {
    box-shadow: 0 12px 24px rgba(31, 58, 55, 0.08);
}

.admin-card {
    display: grid;
    gap: 14px;
}

.admin-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.admin-form-grid {
    display: grid;
    gap: 12px;
}

.admin-form-grid .field-input {
    margin-bottom: 0;
}

.admin-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-action-stack {
    display: grid;
    gap: 8px;
    min-width: 220px;
}

.admin-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 0.94rem;
}

.admin-inline-link {
    padding: 6px 10px;
}

.admin-checkbox-row {
    color: var(--muted);
    font-size: 0.94rem;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--line);
}

.admin-badge-active {
    color: var(--success);
    background: rgba(43, 107, 84, 0.12);
}

.admin-badge-inactive {
    color: var(--danger);
    background: rgba(154, 52, 49, 0.1);
}

.admin-badge-setup {
    color: var(--panel-strong);
    background: rgba(31, 58, 55, 0.08);
}

.admin-membership-list {
    display: grid;
    gap: 10px;
}

.admin-membership-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.58);
}

.admin-membership-row span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.9rem;
}

.admin-status-note {
    margin: 0 0 18px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(43, 107, 84, 0.18);
    background: rgba(43, 107, 84, 0.1);
    color: var(--ink);
}

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

.admin-log-search {
    min-width: 220px;
}

.admin-log-summary,
.admin-log-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 12px 0 16px;
    color: var(--muted);
    font-size: 0.94rem;
}

.admin-danger-button {
    background: var(--danger);
}

.data-table td:last-child {
    min-width: 250px;
}

.section-heading {
    margin-bottom: 14px;
}

.section-heading h2 {
    margin: 0;
    font-family: "Fraunces", serif;
    font-size: 1.5rem;
}

.table-shell {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 12px 32px rgba(31, 58, 55, 0.06);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
    font-size: 0.94rem;
}

.data-table th {
    position: sticky;
    top: 0;
    background: rgba(245, 241, 232, 0.96);
    color: var(--panel-strong);
    font-weight: 600;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.empty-state {
    padding: 24px;
    border: 1px dashed var(--line);
    border-radius: 18px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.6);
}

@media (max-width: 720px) {
    .hero-panel,
    .simple-panel,
    .action-card,
    .metric-card,
    .checklist-item {
        padding: 20px;
    }

    .checklist-item {
        flex-direction: column;
    }

    .checklist-meta {
        text-align: left;
    }

    .admin-card-header,
    .admin-membership-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-toolbar {
        flex-direction: column;
    }

    .admin-log-summary,
    .admin-log-pagination {
        flex-direction: column;
        align-items: flex-start;
    }

    .login-panel {
        margin-top: 4vh;
        padding: 32px 24px 24px;
    }

    .login-brand {
        gap: 10px;
    }

    .login-sidebar-logo-mark {
        width: auto;
        height: auto;
    }

    .login-sidebar-logo-glyph {
        width: 44px;
        height: 52px;
    }

    .login-cta-button {
        min-width: 100%;
    }
}

.theme-toggle-shell {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 60;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
    cursor: pointer;
}

.theme-toggle-label {
    font-size: 0.92rem;
    font-weight: 600;
}

.theme-toggle-icon {
    font-size: 0.95rem;
    line-height: 1;
}