:root {
    --bg: #f4f5ef;
    --bg-accent: linear-gradient(135deg, #e9efe1 0%, #f9f6ef 55%, #eef2f7 100%);
    --panel: rgba(255, 255, 255, 0.88);
    --panel-strong: #ffffff;
    --text: #172026;
    --muted: #5e6a74;
    --line: rgba(23, 32, 38, 0.1);
    --primary: #0f766e;
    --primary-dark: #0a4d49;
    --danger: #b42318;
    --warning: #b54708;
    --success: #157f3d;
    --shadow: 0 24px 80px rgba(23, 32, 38, 0.08);
    --radius: 24px;
    --radius-small: 14px;
    --font: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-accent);
}

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

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

.guest-body,
.install-body,
.error-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.guest-shell,
.install-shell,
.error-shell {
    width: min(100%, 1080px);
}

.auth-card,
.install-card,
.error-card {
    background: var(--panel);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 32px;
    box-shadow: var(--shadow);
    padding: 32px;
}

.auth-card {
    max-width: 560px;
    margin: 0 auto;
}

.auth-intro,
.install-header {
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.stack {
    display: grid;
    gap: 18px;
}

.grid {
    display: grid;
    gap: 16px;
}

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

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

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

.form-group {
    display: grid;
    gap: 8px;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(15, 118, 110, 0.18);
    border-color: rgba(15, 118, 110, 0.55);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 11px 18px;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

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

.button.primary {
    background: var(--primary);
    color: #fff;
}

.button.subtle {
    background: rgba(15, 118, 110, 0.09);
    color: var(--primary-dark);
}

.button.danger {
    background: rgba(180, 35, 24, 0.1);
    color: var(--danger);
}

.button.wide {
    width: 100%;
}

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

.alert-success {
    background: rgba(21, 127, 61, 0.09);
    border-color: rgba(21, 127, 61, 0.2);
    color: var(--success);
}

.alert-danger {
    background: rgba(180, 35, 24, 0.09);
    border-color: rgba(180, 35, 24, 0.18);
    color: var(--danger);
}

.alert-info,
.alert-warning {
    background: rgba(181, 71, 8, 0.08);
    border-color: rgba(181, 71, 8, 0.18);
    color: var(--warning);
}

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

.sidebar {
    padding: 28px 22px;
    background: rgba(23, 32, 38, 0.96);
    color: #f4f5ef;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: relative;
}

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

.sidebar-nav a {
    padding: 12px 14px;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.82);
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    background: rgba(233, 239, 225, 0.12);
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 14px;
}

.profile-card {
    display: grid;
    gap: 4px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
}

.main-panel {
    padding: 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

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

.nav-toggle {
    display: none;
    border: 0;
    background: rgba(15, 118, 110, 0.12);
    color: var(--primary-dark);
    border-radius: 999px;
    padding: 10px 16px;
}

.content-area {
    display: grid;
    gap: 20px;
}

.panel-card {
    background: var(--panel);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

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

.stat-card {
    background: var(--panel-strong);
    border-radius: 22px;
    padding: 22px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 2rem;
}

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

.section-head,
.inline-actions,
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.inline-actions {
    flex-wrap: wrap;
}

.toolbar {
    margin: 14px 0 0;
}

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

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

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

.data-table th {
    color: var(--muted);
    font-size: 0.88rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.list-table {
    display: grid;
}

.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child {
    border-bottom: 0;
}

.muted {
    color: var(--muted);
}

.center {
    text-align: center;
}

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

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

.detail-card {
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 18px;
    padding: 18px;
}

.detail-card.full {
    margin-top: 16px;
}

.helper-text,
.error-text {
    font-size: 0.85rem;
}

.helper-text {
    color: var(--muted);
}

.error-text {
    color: var(--danger);
}

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

.checkbox-line input {
    width: auto;
}

.separator {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 10px 0;
}

@media (max-width: 1100px) {
    .grid.four,
    .grid.three,
    .dashboard-grid,
    .detail-grid.triple {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

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

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

    .main-panel {
        padding: 18px;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .stats-grid,
    .grid.two,
    .grid.three,
    .grid.four,
    .dashboard-grid,
    .detail-grid,
    .detail-grid.triple {
        grid-template-columns: 1fr;
    }

    .topbar,
    .section-head,
    .toolbar,
    .inline-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
