:root {
    --bg: #f5f0e6;
    --panel: #fffaf3;
    --panel-strong: #f1e4d0;
    --line: #d7c4a8;
    --text: #2b2418;
    --muted: #695d4c;
    --accent: #a8461c;
    --accent-strong: #7f2f11;
    --sidebar: #201a13;
    --sidebar-text: #f4eadf;
    --success-bg: #e7f4e6;
    --success-text: #215729;
    --error-bg: #f8e2df;
    --error-text: #892d21;
    --shadow: 0 18px 48px rgba(64, 42, 11, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(202, 132, 92, 0.2), transparent 28rem),
        linear-gradient(180deg, #f8f2e9 0%, var(--bg) 100%);
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
}

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

img {
    max-width: 100%;
    display: block;
}

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

.sidebar {
    background:
        linear-gradient(180deg, rgba(255, 165, 109, 0.08), transparent 12rem),
        var(--sidebar);
    color: var(--sidebar-text);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.brand-kicker,
.eyebrow,
.user-meta-label,
.meta-kicker {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    color: var(--muted);
}

.sidebar .brand-kicker,
.sidebar .user-meta-label {
    color: rgba(244, 234, 223, 0.68);
}

.brand-link {
    display: block;
    font-family: 'Source Serif 4', serif;
    font-size: 2rem;
    line-height: 1;
    margin: 0.4rem 0 0.75rem;
}

.brand-copy,
.page-copy,
.meta-copy,
.muted {
    color: var(--muted);
    line-height: 1.6;
}

.sidebar .brand-copy,
.sidebar .user-email {
    color: rgba(244, 234, 223, 0.72);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 140ms ease, transform 140ms ease, border-color 140ms ease;
}

.nav-link:hover,
.nav-link.is-active {
    background: rgba(255, 218, 187, 0.12);
    border-color: rgba(255, 218, 187, 0.18);
    transform: translateX(2px);
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-card,
.panel,
.stat-card,
.hero-card,
.list-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 1.4rem;
    box-shadow: var(--shadow);
}

.sidebar .user-card {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

.user-card {
    padding: 1rem;
}

.user-name {
    font-weight: 700;
    margin: 0.3rem 0;
}

.content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.flash {
    padding: 1rem 1.15rem;
    border-radius: 1rem;
    border: 1px solid transparent;
}

.flash-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: #bfd8bb;
}

.flash-error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: #e6b4ac;
}

.hero-card,
.panel,
.list-card,
.stat-card {
    padding: 1.4rem;
}

.page-title {
    font-family: 'Source Serif 4', serif;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.05;
    margin: 0.4rem 0 1rem;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.hero-grid,
.card-grid,
.two-col,
.detail-grid,
.list-grid {
    display: grid;
    gap: 1rem;
}

.hero-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(18rem, 1fr);
}

.card-grid {
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr);
}

.list-grid {
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.stat-card strong {
    display: block;
    font-size: 2rem;
    margin-top: 0.45rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: 999px;
    padding: 0.8rem 1.2rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: inherit;
}

.button-primary {
    background: linear-gradient(135deg, var(--accent), #d56e35);
    color: #fff9f2;
}

.button-primary:hover {
    background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

.button-muted {
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
    border-color: rgba(255, 255, 255, 0.1);
}

.button-secondary {
    background: var(--panel-strong);
    color: var(--text);
    border-color: var(--line);
}

.button-full {
    width: 100%;
}

.stack-form,
.stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.95rem;
}

.field input,
.field select,
.field button,
.field textarea {
    width: 100%;
}

input,
select,
textarea {
    border: 1px solid var(--line);
    border-radius: 0.95rem;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.85rem 1rem;
    font: inherit;
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(168, 70, 28, 0.16);
    border-color: var(--accent);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--muted);
}

.checkbox-row input {
    width: auto;
}

.auth-wrap {
    min-height: calc(100vh - 4rem);
    display: grid;
    place-items: center;
}

.auth-panel {
    max-width: 32rem;
    width: 100%;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.list-card {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.list-card:hover {
    transform: translateY(-2px);
    transition: transform 140ms ease;
}

.list-card-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: var(--panel-strong);
    color: var(--muted);
    font-size: 0.86rem;
}

.import-list,
.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.import-row,
.attachment-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.55);
}

.attachment-row {
    flex-wrap: wrap;
}

.profile-frame {
    aspect-ratio: 1;
    border-radius: 1.5rem;
    overflow: hidden;
    background: linear-gradient(135deg, #f1d1b8, #f7ede1);
    border: 1px solid var(--line);
}

.profile-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.data-grid {
    display: grid;
    gap: 0.8rem;
}

.data-row {
    display: grid;
    grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr);
    gap: 0.9rem;
    align-items: start;
    padding-top: 0.7rem;
    border-top: 1px solid rgba(215, 196, 168, 0.55);
}

.data-row:first-child {
    padding-top: 0;
    border-top: 0;
}

.data-key {
    color: var(--muted);
    font-size: 0.9rem;
}

.data-value {
    line-height: 1.6;
    word-break: break-word;
}

.empty-state {
    padding: 2rem;
    border: 1px dashed var(--line);
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, 0.5);
}

.pagination-wrap nav {
    margin-top: 1rem;
}

@media (max-width: 1100px) {
    .shell,
    .hero-grid,
    .detail-grid,
    .two-col {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 1.25rem;
    }
}

@media (max-width: 800px) {
    .shell {
        display: block;
    }

    .content,
    .sidebar {
        padding: 1.25rem;
    }

    .data-row,
    .section-head,
    .attachment-row,
    .import-row {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: flex-start;
    }
}
