:root {
    --bg: #f4f7f1;
    --surface: #ffffff;
    --sidebar: #173225;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #dbe4d7;
    --primary: #2f855a;
    --primary-dark: #236746;
    --danger: #c53030;
    --warning: #d69e2e;
    --shadow: 0 18px 45px rgba(23, 50, 37, 0.12);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(47, 133, 90, 0.12), transparent 28%),
        linear-gradient(180deg, #eef5ea 0%, var(--bg) 100%);
}

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

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

.sidebar {
    background: linear-gradient(180deg, var(--sidebar) 0%, #10241a 100%);
    color: #f5fbf5;
    padding: 28px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #68d391, #2f855a);
    color: #12301f;
    font-weight: 700;
}

.brand small,
.topbar p,
.card-subtitle,
.table-muted {
    color: var(--muted);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav a {
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(245, 251, 245, 0.92);
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.08);
}

.content {
    padding: 26px;
}

.topbar,
.card-header,
.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.topbar {
    align-items: flex-start;
    margin-bottom: 20px;
}

.topbar h1 {
    margin: 0 0 6px;
}

.quick-badge,
.badge {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 14px;
}

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

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

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

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

.grid-2,
.form-grid,
.stack {
    display: grid;
    gap: 18px;
}

.card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(219, 228, 215, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

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

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -18px -18px auto;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: rgba(47, 133, 90, 0.08);
}

.stat-value {
    font-size: 30px;
    font-weight: 700;
    margin: 8px 0;
}

.card-header {
    align-items: center;
    margin-bottom: 16px;
}

.card h2,
.card h3 {
    margin-top: 0;
}

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

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 14px;
}

th {
    color: var(--muted);
    font-weight: 600;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}

input,
select,
textarea,
button {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 12px 14px;
    font: inherit;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

button {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    cursor: pointer;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-actions form {
    margin: 0;
}

.button-link {
    background: transparent;
    color: var(--primary-dark);
    padding: 0;
    width: auto;
}

.button-link-danger {
    color: var(--danger);
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
}

.alert-success {
    background: #def7e8;
    color: #22543d;
}

.alert-error {
    background: #fed7d7;
    color: #822727;
}

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

.login-card {
    width: min(100%, 430px);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 30px;
}

.empty {
    padding: 28px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 16px;
}

.text-warning {
    color: var(--warning);
}

@media (max-width: 1100px) {
    .grid-4,
    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    .sidebar {
        position: static;
        height: auto;
    }

    .grid-4,
    .grid-3,
    .grid-2,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .card-header,
    .topbar {
        flex-direction: column;
        align-items: stretch;
    }
}
