:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #6b7280;
    --primary: #0f766e;
    --primary-dark: #134e4a;
    --accent: #f59e0b;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #ca8a04;
    --border: #e5e7eb;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    --radius: 18px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0f172a 0%, #0f766e 100%);
    color: #fff;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 10px 8px 24px; }
.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,0.14);
    font-size: 27px;
}
.brand span { display: block; color: rgba(255,255,255,.72); font-size: 13px; margin-top: 4px; }
.side-nav { display: grid; gap: 8px; }
.side-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 14px;
    border-radius: 14px;
    color: rgba(255,255,255,.88);
    transition: .2s ease;
    font-weight: 600;
}
.side-nav a:hover, .side-nav a.active { background: rgba(255,255,255,.15); color: #fff; }
.side-footer { margin-top: auto; padding: 16px; background: rgba(255,255,255,.12); border-radius: 18px; }
.side-footer small { display: block; color: rgba(255,255,255,.7); }
.side-footer strong { display: block; margin: 5px 0 10px; }
.side-footer a { color: #fff; font-weight: 700; }
.main-content { margin-left: 280px; width: calc(100% - 280px); padding: 24px; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.topbar h1 { margin: 0; font-size: 28px; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.menu-toggle {
    display: none;
    border: none;
    background: var(--surface);
    box-shadow: var(--shadow);
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 20px;
}
.role-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    right: -25px;
    top: -25px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(15, 118, 110, .11);
}
.stat-label { color: var(--muted); font-size: 14px; font-weight: 700; }
.stat-value { font-size: 28px; font-weight: 800; margin-top: 8px; }
.stat-note { color: var(--muted); margin-top: 5px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 7px; font-size: 14px; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 12px;
    background: #fff;
    font-size: 14px;
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
textarea { min-height: 90px; resize: vertical; }
.btn {
    border: none;
    border-radius: 12px;
    padding: 11px 15px;
    cursor: pointer;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    justify-content: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #e2e8f0; color: #0f172a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--accent); color: #111827; }
.btn-small { padding: 7px 10px; font-size: 12px; border-radius: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-top: 12px; }
.table-wrap { width: 100%; overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; min-width: 760px; background: #fff; }
th, td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
th { background: var(--surface-soft); color: #334155; font-size: 13px; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }
.badge { padding: 6px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; display: inline-block; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.alert { padding: 13px 15px; border-radius: 14px; margin-bottom: 18px; font-weight: 700; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }
.page-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.filter-form .form-group { min-width: 170px; }
.total-box {
    background: var(--surface-soft);
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: 12px;
    color: var(--muted);
    font-weight: 700;
}
.print-only { display: none; }
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at top left, rgba(245,158,11,.2), transparent 30%), linear-gradient(135deg, #0f172a, #0f766e);
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0,0,0,.25);
    padding: 28px;
}
.login-logo { font-size: 52px; text-align: center; }
.login-card h1 { text-align: center; margin-bottom: 5px; }
.login-card p { text-align: center; color: var(--muted); margin-top: 0; }
.sidebar-backdrop { display: none; }
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
    .sidebar { transform: translateX(-105%); transition: .25s ease; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 20; }
    .main-content { margin-left: 0; width: 100%; padding: 16px; }
    .menu-toggle { display: inline-grid; place-items: center; }
    .topbar { justify-content: flex-start; }
    .top-actions { margin-left: auto; }
    .grid-4, .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 24px; }
    table { min-width: 680px; }
}
@media print {
    .sidebar, .topbar, .actions, .filter-form, .btn, .sidebar-backdrop { display: none !important; }
    .main-content { margin: 0; width: 100%; padding: 0; }
    .card, .stat-card { box-shadow: none; border: 1px solid #ddd; }
    body { background: #fff; }
    .print-only { display: block; }
}
