:root {
    --primary: #B8E6C1;
    --primary-light: #E8F8EB;
    --primary-dark: #79B989;
    --blue: #CDE5FF;
    --yellow: #FFE7A8;
    --red: #FFBABA;
    --purple: #DDD1FF;
    --bg: #F7FBF8;
    --text: #18231B;
    --border: #18231B;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --shadow-card: 5px 5px 0 var(--border);
    --shadow-btn: 4px 4px 0 var(--border);
    --shadow-btn-sm: 3px 3px 0 var(--border);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0 0 4px; font-weight: 800; letter-spacing: -0.01em; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 264px;
    background: #fff;
    border-right: 3px solid var(--border);
    padding: 20px 16px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 20px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}

.sidebar-brand .logo-box {
    width: 40px; height: 40px;
    background: var(--primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
}

.sidebar-brand .name { font-weight: 800; font-size: 14px; line-height: 1.2; }
.sidebar-brand .sub { font-size: 11px; opacity: 0.65; }

.nav-section { margin-bottom: 18px; }
.nav-section-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    font-weight: 700; opacity: .55; padding: 0 10px; margin-bottom: 6px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 14px; color: var(--text);
    border: 2px solid transparent;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--primary-light); }
.nav-item.active { background: var(--primary); border-color: var(--border); box-shadow: 3px 3px 0 var(--border); }
.nav-item i, .nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.main-content { flex: 1; min-width: 0; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 28px; background: #fff; border-bottom: 3px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}

.topbar .user-chip {
    display: flex; align-items: center; gap: 10px;
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    padding: 6px 12px; font-weight: 700; font-size: 13px; background: var(--primary-light);
}

.page-body { padding: 28px; width: 100%; max-width: 1900px; }

/* ---------- Card ---------- */
.card {
    background: #fff;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 22px;
    margin-bottom: 22px;
}

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}

.stat-card {
    background: #fff; border: 2px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card); padding: 18px 20px;
}
.stat-card .label { font-size: 12px; font-weight: 700; text-transform: uppercase; opacity: .6; letter-spacing: .05em; }
.stat-card .value { font-size: 32px; font-weight: 800; margin-top: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-btn-sm);
    padding: 9px 18px; font-weight: 700; font-size: 14px; cursor: pointer;
    background: #fff; color: var(--text); transition: transform .06s ease;
}
.btn:hover { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--border); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--border); }
.btn-primary { background: var(--primary); }
.btn-blue { background: var(--blue); }
.btn-yellow { background: var(--yellow); }
.btn-red { background: var(--red); }
.btn-purple { background: var(--purple); }
.btn-outline { background: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 10px; box-shadow: 2px 2px 0 var(--border); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.form-control, select.form-control, textarea.form-control {
    width: 100%; border: 2px solid var(--border); border-radius: var(--radius-sm);
    padding: 10px 14px; font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
.form-control:focus { outline: 3px solid var(--primary); outline-offset: 0; }
.form-hint { font-size: 12px; opacity: .6; margin-top: 4px; }
.form-error { font-size: 12px; color: #B23B3B; margin-top: 4px; font-weight: 600; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 2px solid var(--border); border-radius: var(--radius-md); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th {
    text-align: left; background: var(--primary-light); padding: 12px 14px;
    font-weight: 800; border-bottom: 2px solid var(--border); white-space: nowrap;
}
table.data-table td { padding: 10px 14px; border-bottom: 1px solid #E3E9E4; vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #FAFDFB; }

/* ---------- Badge ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    border: 2px solid var(--border); border-radius: 999px;
    padding: 3px 12px; font-size: 12px; font-weight: 700;
}
.badge-green { background: var(--primary); }
.badge-blue { background: var(--blue); }
.badge-yellow { background: var(--yellow); }
.badge-red { background: var(--red); }
.badge-purple { background: var(--purple); }
.badge-gray { background: #EDEDED; }

/* ---------- Alert ---------- */
.alert {
    border: 2px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-btn-sm); padding: 12px 16px; margin-bottom: 18px;
    font-weight: 600; font-size: 14px;
}
.alert-success { background: var(--primary-light); }
.alert-error { background: var(--red); }
.alert-warning { background: var(--yellow); }
.alert-info { background: var(--blue); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
    border: 2px solid var(--border); border-radius: 10px; padding: 6px 12px;
    font-weight: 700; font-size: 13px; background: #fff;
}
.pagination .active { background: var(--primary); }

/* ---------- Photo ---------- */
.avatar { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--border); object-fit: cover; background: #eee; }
.avatar-lg { width: 96px; height: 96px; border-radius: var(--radius-md); border: 3px solid var(--border); object-fit: cover; background: #eee; }

/* ---------- Utilities ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-sm { font-size: 13px; }
.text-muted { opacity: .6; }
.mb-0 { margin-bottom: 0; }
.w-full { width: 100%; }

/* ---------- Auth page ---------- */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg); padding: 20px;
}
.auth-card {
    width: 100%; max-width: 400px; background: #fff;
    border: 3px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: 7px 7px 0 var(--border); padding: 36px 32px;
}
.auth-logo { width: 56px; height: 56px; background: var(--primary); border: 2px solid var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; font-weight: 800; font-size: 22px; }

@media (max-width: 900px) {
    .sidebar { position: fixed; left: -280px; z-index: 40; transition: left .2s ease; box-shadow: 8px 0 0 rgba(0,0,0,.05); }
    .sidebar.open { left: 0; }
    .form-row { grid-template-columns: 1fr; }
    .page-body { padding: 16px; }
    .topbar { padding: 12px 16px; }
}
