:root {
    --bg: #f4efe7;
    --bg-strong: #efe4d2;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #fffdf9;
    --surface-dark: #132620;
    --text: #1b251f;
    --text-muted: #5d6b62;
    --line: rgba(19, 38, 32, 0.12);
    --primary: #0f766e;
    --primary-strong: #115e59;
    --danger: #b91c1c;
    --success: #166534;
    --shadow: 0 24px 60px rgba(24, 37, 31, 0.12);
    --radius-lg: 28px;
    --radius-md: 20px;
    --radius-sm: 14px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Manrope', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.18), transparent 32%),
        radial-gradient(circle at right bottom, rgba(180, 83, 9, 0.14), transparent 28%),
        linear-gradient(135deg, #f7f0e8 0%, #f4efe7 48%, #ede6db 100%);
}

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

button,
input,
select,
table {
    font: inherit;
}

.auth-shell,
.admin-shell {
    min-height: 100vh;
}

.auth-page {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 460px);
    min-height: 100vh;
}

.auth-brand-panel,
.auth-card-panel,
.sidebar,
.content-area {
    padding: 32px;
}

.auth-brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
}

.auth-brand-panel h1,
.topbar h1,
.hero-card h2,
.section-heading h2,
.auth-card h2 {
    margin: 10px 0 0;
    line-height: 1.05;
}

.auth-brand-panel h1 {
    font-size: clamp(2.6rem, 5vw, 5.4rem);
    max-width: 11ch;
}

.auth-brand-panel p,
.hero-card p,
.section-heading p,
.panel-card p,
.auth-card p,
.stat-card p,
.credentials-note {
    color: var(--text-muted);
    line-height: 1.7;
}

.auth-points,
.stats-grid,
.panel-grid {
    display: grid;
    gap: 18px;
}

.auth-points {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auth-points article,
.stat-card,
.panel-card,
.hero-card,
.form-card,
.auth-card,
.credentials-card {
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.auth-points article,
.stat-card,
.panel-card,
.credentials-card {
    padding: 22px;
}

.auth-card-panel {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    padding: 32px;
    display: grid;
    gap: 22px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--primary-strong);
}

.stack-md,
.stack-lg {
    display: grid;
}

.stack-md {
    gap: 16px;
}

.stack-lg {
    gap: 20px;
}

.field {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

.field span,
.checkbox-row span,
.sidebar-footer span,
.stat-card span,
.panel-card span {
    color: var(--text-muted);
}

.field input {
    width: 100%;
    border: 1px solid rgba(19, 38, 32, 0.14);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    padding: 14px 16px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field select,
.toolbar-form input,
.status-select {
    width: 100%;
    border: 1px solid rgba(19, 38, 32, 0.14);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    padding: 14px 16px;
    outline: none;
}

.field input:focus {
    border-color: rgba(15, 118, 110, 0.48);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.checkbox-row,
.action-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.button-primary,
.button-ghost {
    border: 0;
    border-radius: 999px;
    padding: 13px 20px;
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.button-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    color: #f9fffd;
}

.button-ghost {
    background: rgba(255, 255, 255, 0.08);
    color: #f7fbf8;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

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

.credentials-card {
    padding: 20px;
}

.credentials-card p {
    margin: 8px 0;
}

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

.sidebar {
    background: linear-gradient(180deg, #17322a 0%, #10231d 100%);
    color: #f7fbf8;
    display: flex;
    flex-direction: column;
    gap: 26px;
    position: relative;
}

.sidebar-brand,
.sidebar-footer {
    display: grid;
    gap: 6px;
}

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

.nav-item {
    padding: 14px 16px;
    border-radius: 18px;
    color: rgba(247, 251, 248, 0.8);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
}

.nav-item.is-active,
.nav-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.12);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.content-area {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 28px;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar h1 {
    font-size: clamp(2rem, 4vw, 3.5rem);
}

.page-content,
.stats-grid,
.panel-grid {
    gap: 20px;
}

.hero-card,
.form-card {
    padding: 28px;
}

.hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.hero-badge {
    padding: 14px 18px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.12);
    color: var(--primary-strong);
    font-weight: 800;
    white-space: nowrap;
}

.stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card strong {
    display: block;
    font-size: 2.2rem;
    margin: 10px 0;
}

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

.feature-list {
    margin: 16px 0 0;
    padding-left: 18px;
    color: var(--text-muted);
    line-height: 1.8;
}

.alert {
    border-radius: 18px;
    padding: 14px 16px;
    border: 1px solid transparent;
}

.alert-danger {
    color: var(--danger);
    background: rgba(185, 28, 28, 0.08);
    border-color: rgba(185, 28, 28, 0.12);
}

.alert-success {
    color: var(--success);
    background: rgba(22, 101, 52, 0.08);
    border-color: rgba(22, 101, 52, 0.12);
}

.menu-toggle {
    display: none;
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 16px;
    background: rgba(15, 118, 110, 0.12);
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    margin: 4px auto;
    background: var(--primary-strong);
}

.inline-flex {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button-secondary {
    border: 1px solid rgba(19, 38, 32, 0.14);
    border-radius: 999px;
    padding: 13px 20px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.72);
}

.toolbar-card,
.table-card,
.detail-card {
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.toolbar-card,
.table-card {
    padding: 24px;
}

.toolbar-form,
.two-col-grid,
.detail-grid {
    display: grid;
    gap: 16px;
}

.toolbar-form,
.two-col-grid {
    grid-template-columns: minmax(0, 1fr) auto;
}

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

.detail-card {
    padding: 18px;
}

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

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

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

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 16px 12px;
    border-bottom: 1px solid rgba(19, 38, 32, 0.1);
    vertical-align: top;
}

.admin-table th {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.table-meta,
.table-break {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
}

.table-break {
    word-break: break-all;
}

.table-media-cell {
    display: flex;
    align-items: center;
    gap: 14px;
}

.table-icon-preview,
.detail-icon-preview {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid rgba(19, 38, 32, 0.1);
    background: #fff;
    flex: 0 0 auto;
}

.detail-icon-preview {
    width: 84px;
    height: 84px;
    margin-top: 10px;
}

.table-icon-fallback {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: rgba(15, 118, 110, 0.12);
    color: var(--primary-strong);
    font-weight: 800;
    flex: 0 0 auto;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 0.82rem;
    font-weight: 800;
}

.role-admin {
    color: var(--primary-strong);
    background: rgba(15, 118, 110, 0.1);
}

.role-member {
    color: #92400e;
    background: rgba(180, 83, 9, 0.12);
}

.inline-status-form {
    margin: 0;
}

.status-select {
    min-width: 136px;
    padding: 10px 12px;
}

.small-button {
    padding: 10px 14px;
}

.pagination-wrap {
    margin-top: 18px;
}

.pagination-wrap nav {
    display: flex;
    justify-content: flex-end;
}

.pagination-wrap svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 1080px) {
    .auth-page,
    .panel-grid,
    .stats-grid,
    .auth-points,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .hero-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 860px) {
    .app-frame {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(82vw, 300px);
        transform: translateX(-102%);
        transition: transform 0.24s ease;
        z-index: 20;
    }

    .app-frame.is-sidebar-open .sidebar {
        transform: translateX(0);
    }

    .content-area {
        padding-top: 20px;
    }

    .menu-toggle {
        display: inline-block;
    }
}

@media (max-width: 640px) {
    .auth-brand-panel,
    .auth-card-panel,
    .sidebar,
    .content-area {
        padding: 20px;
    }

    .auth-card,
    .hero-card,
    .form-card,
    .panel-card,
    .stat-card {
        border-radius: 22px;
    }

    .topbar h1 {
        font-size: 1.7rem;
    }

    .toolbar-form,
    .two-col-grid,
    .two-col-grid.two-col-even {
        grid-template-columns: 1fr;
    }
}