:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #14213d;
    --muted: #64748b;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --accent: #f59e0b;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #ca8a04;
    --border: #e2e8f0;
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-weight: 500;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 282px;
    background: #0f172a;
    color: #e2e8f0;
    padding: 22px;
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
    z-index: 20;
}
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 8px 22px;
    border-bottom: 1px solid rgba(226,232,240,.14);
    margin-bottom: 18px;
}
.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    box-shadow: 0 12px 28px rgba(20,184,166,.25);
    font-size: 24px;
}
.brand strong { display: block; font-size: 18px; font-weight: 700; }
.brand span { display: block; color: #94a3b8; font-size: 13px; margin-top: 2px; }
.menu { display: grid; gap: 6px; }
.menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 13px;
    color: #cbd5e1;
    font-weight: 650;
}
.menu a:hover, .menu a.active { background: rgba(20,184,166,.15); color: #fff; }

.main { margin-left: 282px; flex: 1; padding: 24px; min-width: 0; }
.topbar {
    min-height: 64px;
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 22px;
    position: sticky;
    top: 14px;
    z-index: 10;
}
.topbar span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.menu-toggle { display: none; border: 0; background: var(--primary); color: #fff; border-radius: 12px; width: 42px; height: 42px; }

.page-title { margin: 0 0 18px; display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.page-title h1 { margin: 0; font-size: clamp(24px, 4vw, 34px); letter-spacing: -0.04em; font-weight: 700; }
.page-title p { margin: 6px 0 0; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.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)); }

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}
.card h2, .card h3 { margin: 0 0 12px; font-weight: 700; letter-spacing: -0.03em; }
.metric { display: flex; flex-direction: column; gap: 6px; }
.metric span { color: var(--muted); font-size: 14px; }
.metric strong { font-size: 28px; font-weight: 700; letter-spacing: -0.04em; }
.metric small { color: var(--muted); }

.form { display: grid; gap: 14px; }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 650; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 11px 12px;
    color: var(--text);
    background: #fff;
    outline: none;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #14b8a6; box-shadow: 0 0 0 4px rgba(20,184,166,.12); }

.btn {
    border: 0;
    border-radius: 13px;
    padding: 11px 14px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 700;
    min-height: 42px;
    background: var(--primary);
    color: #fff;
    transition: transform .2s ease, opacity .2s ease;
}
.btn:hover { transform: translateY(-1px); opacity: .94; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); }
.btn-warning { background: var(--warning); }
.btn-small { padding: 8px 10px; min-height: 34px; border-radius: 10px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; background: #fff; }
th, td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 700; }
.badge.success { background: #dcfce7; color: #166534; }
.badge.warning { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.badge.info { background: #dbeafe; color: #1e40af; }
.badge.muted { background: #e2e8f0; color: #475569; }

.toast { padding: 13px 16px; border-radius: 14px; margin-bottom: 14px; border: 1px solid var(--border); background: #fff; box-shadow: var(--shadow); }
.toast.success { border-color: #86efac; background: #f0fdf4; }
.toast.error { border-color: #fecaca; background: #fef2f2; }
.toast.warning { border-color: #fde68a; background: #fffbeb; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(20,184,166,.28), transparent 34%),
        linear-gradient(135deg, #0f172a, #115e59);
}
.login-card { width: min(100%, 420px); background: #fff; border-radius: 24px; padding: 28px; box-shadow: 0 30px 80px rgba(2,6,23,.28); }
.login-card .brand-mark { margin-bottom: 14px; }
.login-card h1 { margin: 0 0 8px; font-size: 28px; font-weight: 700; letter-spacing: -0.04em; }
.login-card p { color: var(--muted); margin: 0 0 20px; }

.print-header { display: none; }
@media print {
    body { background: #fff; }
    .sidebar, .topbar, .no-print, .btn { display: none !important; }
    .main { margin: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    .print-header { display: block; margin-bottom: 16px; }
}

.landing-body { background: #f8fafc; }
.landing-hero {
    min-height: 92vh;
    display: grid;
    align-items: center;
    padding: 32px 20px;
    background: linear-gradient(135deg, #0f172a, #0f766e);
    color: #fff;
}
.landing-container { width: min(1120px, 100%); margin: 0 auto; }
.landing-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 54px; gap: 20px; flex-wrap: wrap; }
.landing-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 28px; align-items: center; }
.landing-hero h1 { font-size: clamp(36px, 7vw, 66px); line-height: .98; letter-spacing: -0.06em; margin: 0 0 18px; font-weight: 700; }
.landing-hero p { color: #ccfbf1; font-size: 18px; line-height: 1.6; }
.landing-section { padding: 72px 20px; }
.landing-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.lead-card { background: #fff; border-radius: 24px; padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--border); }

@media (max-width: 1050px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .landing-grid, .landing-cards { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
    .sidebar { transform: translateX(-105%); transition: transform .22s ease; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .main { margin-left: 0; padding: 14px; }
    .topbar { top: 8px; border-radius: 16px; }
    .menu-toggle { display: inline-grid; place-items: center; }
    .grid-2, .grid-3, .grid-4, .form-row { grid-template-columns: 1fr; }
    .page-title { align-items: stretch; }
    .page-title .actions, .page-title .btn { width: 100%; }
    .actions .btn { flex: 1 1 140px; }
    .card { padding: 15px; }
    table { min-width: 680px; }
}
