:root {
    --brand: #176b5b;
    --brand-dark: #0f4f43;
    --brand-soft: #eaf5f2;
    --ink: #172321;
    --muted: #66736f;
    --line: #dfe7e4;
    --surface: #ffffff;
    --canvas: #f5f7f6;
    --danger: #b42318;
    --warning: #b54708;
    --success: #067647;
    --shadow: 0 12px 38px rgba(25, 52, 46, .08);
}

* { box-sizing: border-box; }
html { font-family: Tahoma, Arial, sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-brand { position: relative; overflow: hidden; padding: 64px; display: flex; flex-direction: column; justify-content: space-between; color: white; background: linear-gradient(145deg, #0b3d35, #176b5b 58%, #2d8f7c); }
.auth-brand::after { content: ""; position: absolute; width: 520px; height: 520px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; left: -190px; bottom: -250px; box-shadow: 0 0 0 70px rgba(255,255,255,.04), 0 0 0 140px rgba(255,255,255,.03); }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); font-size: 25px; font-weight: 700; }
.auth-brand h1 { font-size: clamp(36px, 5vw, 68px); line-height: 1.15; margin: 24px 0 16px; max-width: 680px; }
.auth-brand p { color: rgba(255,255,255,.76); line-height: 1.9; max-width: 620px; font-size: 17px; }
.auth-panel { display: grid; place-items: center; padding: 40px; background: #fbfcfc; }
.auth-card { width: min(440px, 100%); }
.auth-card h2 { font-size: 30px; margin: 0 0 10px; }
.auth-card > p { color: var(--muted); margin: 0 0 30px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line); background: white; border-radius: 12px; padding: 12px 14px; outline: none; transition: .18s; color: var(--ink); }
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(23,107,91,.1); }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 6px; }

.btn { border: 0; border-radius: 11px; padding: 11px 17px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; transition: .18s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: white; background: var(--brand); box-shadow: 0 7px 18px rgba(23,107,91,.18); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { color: var(--ink); background: #eef2f1; }
.btn-danger { color: white; background: var(--danger); }
.btn-outline { border: 1px solid var(--line); background: white; color: var(--ink); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 10px; font-size: 13px; border-radius: 8px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: #103f37; color: white; padding: 22px 16px; overflow-y: auto; z-index: 20; }
.sidebar-head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-logo { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.12); font-size: 20px; font-weight: 800; }
.sidebar-head strong { display: block; font-size: 15px; }
.sidebar-head span { display: block; color: rgba(255,255,255,.55); font-size: 11px; margin-top: 4px; }
.nav-section { margin-top: 22px; }
.nav-label { color: rgba(255,255,255,.43); font-size: 11px; padding: 0 11px 8px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 11px 12px; margin: 3px 0; border-radius: 10px; color: rgba(255,255,255,.73); font-size: 14px; }
.nav-link:hover, .nav-link.active { color: white; background: rgba(255,255,255,.1); }
.nav-icon { width: 24px; text-align: center; opacity: .8; }

.main { min-width: 0; }
.topbar { height: 72px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 10; }
.topbar-title { display: flex; align-items: center; gap: 12px; }
.menu-toggle { display: none; border: 0; background: transparent; font-size: 23px; cursor: pointer; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; }
.user-chip strong { font-size: 13px; display: block; }
.user-chip span { color: var(--muted); font-size: 11px; display: block; margin-top: 3px; }
.content { padding: 30px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 27px; }
.page-head p { color: var(--muted); margin: 7px 0 0; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: 0 5px 20px rgba(25,52,46,.03); }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.stat-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.stat-value { font-size: 30px; font-weight: 800; margin: 14px 0 4px; }
.stat-note { color: var(--muted); font-size: 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 5px 20px rgba(25,52,46,.03); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 17px; }
.card-body { padding: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.section-gap { margin-top: 20px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th, .table td { text-align: right; padding: 13px 15px; border-bottom: 1px solid #edf1f0; font-size: 13px; vertical-align: middle; }
.table th { color: var(--muted); font-size: 12px; background: #fafbfb; }
.table tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; align-items: center; gap: 7px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-success { background: #ecfdf3; color: var(--success); }
.badge-warning { background: #fff7ed; color: var(--warning); }
.badge-danger { background: #fef3f2; color: var(--danger); }
.badge-neutral { background: #f0f2f2; color: #4d5b57; }

.alert { padding: 13px 15px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; font-size: 14px; }
.alert-success { color: var(--success); background: #ecfdf3; border-color: #abefc6; }
.alert-error { color: var(--danger); background: #fef3f2; border-color: #fecdca; }
.alert-warning { color: var(--warning); background: #fff7ed; border-color: #fedf89; }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 24px; }
.checkbox-list { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.checkbox-item { display: flex; gap: 9px; align-items: flex-start; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfc; }
.checkbox-item input { margin-top: 3px; accent-color: var(--brand); }
.filter-grid { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(150px, .8fr)) auto; gap: 12px; align-items: end; }
.filter-grid .field { margin-bottom: 0; }
.filter-actions, .status-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.detail-list > div { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.detail-list span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.detail-list strong { font-size: 14px; }
.detail-list .detail-wide { grid-column: 1 / -1; }
.detail-list p { margin: 0; line-height: 1.9; white-space: normal; }

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .checkbox-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .filter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .app-shell { display: block; }
    .sidebar { position: fixed; right: -290px; width: 270px; transition: .22s; }
    body.sidebar-open .sidebar { right: 0; box-shadow: var(--shadow); }
    .menu-toggle { display: block; }
    .content { padding: 20px; }
    .topbar { padding: 0 18px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .filter-grid { grid-template-columns: 1fr; }
    .detail-list { grid-template-columns: 1fr; }
    .detail-list .detail-wide { grid-column: auto; }
}
@media (max-width: 560px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .checkbox-list { grid-template-columns: 1fr; }
    .auth-panel { padding: 24px; }
}
