:root {
    --bg: #f7f4ef;
    --surface: #ffffff;
    --surface-soft: #fbfaf7;
    --text: #243026;
    --muted: #737b70;
    --brand: #3f7352;
    --brand-dark: #234631;
    --brand-soft: #e7f1e9;
    --accent: #c79b5b;
    --border: #e4ded3;
    --danger: #b64040;
    --success: #2f7a46;
    --shadow: 0 18px 45px rgba(31, 46, 36, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(199,155,91,.14), transparent 34%),
        linear-gradient(180deg, #fbf8f2 0%, var(--bg) 100%);
    color: var(--text);
}

a {
    color: var(--brand);
    text-decoration: none;
    font-weight: 700;
}

a:hover {
    color: var(--brand-dark);
}

.topbar {
    position: fixed;
    top: 0;
    left: 250px;
    right: 0;
    height: 72px;
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 10;
}

.topbar strong {
    font-size: 18px;
}

.topbar span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.topbar a {
    background: var(--brand-soft);
    color: var(--brand-dark);
    padding: 9px 14px;
    border-radius: 999px;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    bottom: 0;
    background:
        linear-gradient(180deg, #234631 0%, #162d20 100%);
    padding: 24px 16px;
    overflow-y: auto;
    box-shadow: 12px 0 35px rgba(22,45,32,.18);
}

.sidebar::before {
    content: "AlpacaCloud";
    display: block;
    color: #fff;
    font-size: 21px;
    font-weight: 900;
    letter-spacing: -.03em;
    padding: 8px 12px 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.sidebar a {
    display: flex;
    align-items: center;
    color: rgba(255,255,255,.88);
    padding: 12px 14px;
    border-radius: 15px;
    margin-bottom: 5px;
    font-weight: 750;
}

.sidebar a:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.main {
    margin-left: 250px;
    padding: 104px 30px 48px;
    max-width: 1500px;
}

h1 {
    margin: 0 0 22px;
    font-size: clamp(28px, 3vw, 42px);
    letter-spacing: -.045em;
}

h2 {
    margin: 0 0 18px;
    font-size: 20px;
    letter-spacing: -.025em;
}

p {
    line-height: 1.65;
}

.card,
.stat-card {
    background: rgba(255,255,255,.92);
    border: 1px solid var(--border);
    border-radius: 26px;
    padding: 24px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}

.stats-grid,
.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

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

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -34px;
    top: -34px;
    width: 110px;
    height: 110px;
    border-radius: 999px;
    background: var(--brand-soft);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-weight: 750;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.stat-card strong {
    position: relative;
    z-index: 1;
    display: block;
    font-size: 38px;
    margin-top: 10px;
    letter-spacing: -.05em;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    border: 0;
    border-radius: 15px;
    padding: 11px 17px;
    font-weight: 850;
    cursor: pointer;
    min-height: 42px;
    box-shadow: 0 10px 20px rgba(35,70,49,.16);
}

.button:hover,
button:hover {
    color: #fff;
    transform: translateY(-1px);
}

.button.ghost {
    background: #fff;
    color: var(--brand-dark);
    border: 1px solid var(--border);
    box-shadow: none;
}

.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.quick-actions .button {
    border-radius: 999px;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .07em;
    background: var(--surface-soft);
}

tr:hover td {
    background: #fcfbf8;
}

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

.form-grid .full {
    grid-column: 1 / -1;
}

label {
    display: block;
    font-weight: 800;
    font-size: 14px;
    color: var(--text);
}

input,
select,
textarea {
    width: 100%;
    margin-top: 8px;
    padding: 13px 14px;
    border-radius: 15px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font: inherit;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(63,115,82,.12);
}

input[readonly] {
    background: #f3f1ec;
    color: var(--muted);
}

textarea {
    min-height: 120px;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.alert {
    padding: 13px 15px;
    border-radius: 16px;
    margin-bottom: 18px;
    font-weight: 750;
}

.alert.success {
    background: #eef9f0;
    color: var(--success);
}

.alert.error {
    background: #fff2f2;
    color: var(--danger);
}

.badge {
    display: inline-block;
    margin: 2px 4px 2px 0;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 800;
}

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

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

.link-danger {
    color: var(--danger);
    font-weight: 800;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    box-shadow: none;
    min-height: auto;
}

.inline-form {
    display: inline;
}

/* Login */
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 20% 15%, rgba(199,155,91,.28), transparent 28%),
        linear-gradient(135deg, #203d2c, #4f7f5c);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255,255,255,.95);
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 32px;
    padding: 36px;
    box-shadow: 0 30px 80px rgba(0,0,0,.22);
}

.brand-mark {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 950;
    font-size: 21px;
    margin-bottom: 18px;
}

.login-card h1 {
    margin-bottom: 8px;
}

.login-card p {
    color: var(--muted);
    margin-bottom: 24px;
}

.login-card button {
    width: 100%;
    margin-top: 10px;
}

/* Mobile */
.mobile-nav {
    display: none;
}

@media (max-width: 920px) {
    .sidebar {
        display: none;
    }

    .topbar {
        left: 0;
        height: 64px;
        padding: 0 16px;
    }

    .main {
        margin-left: 0;
        padding: 88px 14px 94px;
    }

    .stats-grid,
    .profile-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

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

    .page-head .quick-actions {
        width: 100%;
    }

    .page-head .quick-actions .button {
        flex: 1 1 auto;
        text-align: center;
    }

    .card,
    .stat-card {
        border-radius: 22px;
        padding: 18px;
    }

    th,
    td {
        padding: 12px;
    }

    .mobile-nav {
        position: fixed;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255,255,255,.96);
        backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        z-index: 20;
    }

    .mobile-nav a {
        text-align: center;
        padding: 13px 6px;
        font-size: 13px;
        color: var(--brand-dark);
        font-weight: 850;
    }
}