:root {
    --bg: #f4efe4;
    --surface: rgba(255, 252, 246, 0.86);
    --surface-strong: #fffaf1;
    --line: rgba(84, 60, 32, 0.12);
    --text: #1f1c18;
    --muted: #665b4d;
    --brand: #0f766e;
    --brand-2: #b45309;
    --danger: #b42318;
    --ok: #166534;
    --shadow: 0 18px 42px rgba(68, 47, 16, 0.14);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 30%),
        radial-gradient(circle at bottom right, rgba(180, 83, 9, 0.14), transparent 30%),
        linear-gradient(180deg, #f6f1e8 0%, #efe5d3 100%);
    min-height: 100vh;
}

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

button,
input {
    font: inherit;
}

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

.auth-shell {
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.auth-card {
    width: min(100%, 960px);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 32px;
    background: rgba(255, 251, 244, 0.82);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.auth-panel {
    padding: 2.2rem;
}

.auth-hero {
    color: #fff7ef;
    background:
        linear-gradient(145deg, rgba(9, 78, 73, 0.94), rgba(29, 45, 36, 0.92)),
        linear-gradient(45deg, rgba(180, 83, 9, 0.25), transparent);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.5rem;
}

.eyebrow {
    margin: 0 0 0.75rem;
    color: var(--brand-2);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.auth-hero .eyebrow {
    color: #f7c98f;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.05;
}

.auth-title {
    font-size: clamp(2rem, 4vw, 3.6rem);
}

.auth-copy,
.muted {
    color: var(--muted);
}

.auth-hero .auth-copy {
    color: rgba(255, 247, 239, 0.86);
}

.auth-form {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.field {
    display: grid;
    gap: 0.45rem;
}

.field label {
    font-size: 0.92rem;
    font-weight: 700;
}

.field input {
    width: 100%;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(84, 60, 32, 0.14);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
    outline: none;
    border-color: rgba(15, 118, 110, 0.45);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.08);
}

.btn {
    border: 0;
    border-radius: 16px;
    padding: 0.95rem 1.1rem;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: white;
    background: linear-gradient(135deg, var(--brand), #115e59);
}

.notice {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.notice-error {
    color: #7a271a;
    background: rgba(254, 228, 226, 0.9);
    border-color: rgba(180, 35, 24, 0.2);
}

.notice-success {
    color: #14532d;
    background: rgba(220, 252, 231, 0.92);
    border-color: rgba(22, 101, 52, 0.18);
}

.auth-points {
    display: grid;
    gap: 0.8rem;
}

.auth-point {
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.app-shell {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.15rem;
    background: rgba(30, 24, 18, 0.88);
    color: #f8f2e8;
    backdrop-filter: blur(16px);
}

.sidebar-card {
    display: grid;
    gap: 1.1rem;
    height: 100%;
    padding: 1.15rem;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.9), rgba(180, 83, 9, 0.92));
    font-weight: 800;
}

.brand-name {
    font-size: 1.05rem;
    font-weight: 800;
}

.brand-subtitle {
    margin-top: 0.15rem;
    color: rgba(248, 242, 232, 0.68);
    font-size: 0.86rem;
}

.user-card {
    padding: 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-name {
    font-size: 1rem;
    font-weight: 800;
}

.user-meta {
    margin-top: 0.3rem;
    color: rgba(248, 242, 232, 0.72);
    font-size: 0.9rem;
}

.nav {
    display: grid;
    gap: 0.35rem;
    overflow: auto;
}

.nav-group {
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-group-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    color: rgba(248, 242, 232, 0.92);
    cursor: pointer;
    font-weight: 700;
}

.nav-group-summary::-webkit-details-marker {
    display: none;
}

.nav-group[open] .nav-group-summary {
    color: white;
    background: rgba(180, 83, 9, 0.18);
}

.nav-group-items {
    display: grid;
    gap: 0.25rem;
    padding: 0 0.5rem 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    color: rgba(248, 242, 232, 0.9);
}

.nav-link:hover,
.nav-link.active {
    color: white;
    background: rgba(15, 118, 110, 0.22);
}

.nav-link.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.nav-sublink {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: 14px;
    color: rgba(248, 242, 232, 0.84);
    font-size: 0.93rem;
}

.nav-sublink:hover,
.nav-sublink.active {
    color: white;
    background: rgba(15, 118, 110, 0.24);
}

.nav-sublink.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.sidebar-footer {
    margin-top: auto;
}

.btn-side {
    width: 100%;
    color: #251a14;
    background: rgba(255, 250, 243, 0.95);
}

.logout-link {
    display: inline-flex;
    justify-content: center;
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    color: #fff4ef;
    background: rgba(180, 35, 24, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.content {
    padding: 1.2rem;
}

.topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.topbar button {
    width: 46px;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 251, 244, 0.86);
}

.page-card {
    padding: 1.35rem;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--surface);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
    margin-bottom: 1.15rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    color: #0b4b46;
    background: rgba(15, 118, 110, 0.1);
    font-size: 0.82rem;
    font-weight: 700;
}

.status-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.status-item {
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 250, 242, 0.88);
}

.status-item span {
    display: block;
    color: var(--muted);
    font-size: 0.83rem;
}

.status-item strong {
    display: block;
    margin-top: 0.4rem;
    font-size: 1rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat,
.panel,
.module-card {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface-strong);
}

.stat-label {
    color: var(--muted);
    font-size: 0.85rem;
}

.stat-value {
    margin-top: 0.45rem;
    font-size: 1.2rem;
    font-weight: 800;
}

.content-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1rem;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.module-card h3,
.panel h3 {
    margin-bottom: 0.45rem;
    font-size: 1rem;
}

.list {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--muted);
}

.list li + li {
    margin-top: 0.45rem;
}

.hint {
    margin-top: 0.85rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(25, 20, 16, 0.48);
}

@media (max-width: 1100px) {
    .status-strip,
    .stats,
    .content-grid,
    .module-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .auth-card {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        min-height: 280px;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .topbar {
        display: flex;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 30;
        width: min(88vw, 320px);
        transform: translateX(-100%);
        transition: transform 0.28s ease;
    }

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

    .overlay.is-open {
        display: block;
        z-index: 20;
    }
}

@media (max-width: 680px) {
    .auth-panel,
    .content,
    .sidebar {
        padding: 1rem;
    }

    .page-card,
    .sidebar-card {
        border-radius: 24px;
    }

    .status-strip,
    .stats,
    .content-grid,
    .module-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
    }

    .topbar-logout {
        display: none;
    }
}
