:root{
  --sidebar-width: 280px;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --ink: #0f172a;
  --muted: #475569;
  --border: #e5e7eb;
  --primary: #1d4ed8;
  --primary-2: #0b3aa6;
  --success: #15803d;
  --danger: #b91c1c;
  --shadow: 0 10px 25px rgba(2,6,23,0.08);
  --shadow-sm: 0 6px 16px rgba(2,6,23,0.08);
  --radius: 14px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 800px at 20% -10%, rgba(29,78,216,.10), transparent 55%),
              radial-gradient(900px 650px at 80% 0%, rgba(29,78,216,.08), transparent 50%),
              var(--bg);
}

/* Sidebar */
.sidebar{
  position:fixed; inset:0 auto 0 0;
  width:var(--sidebar-width);
  background: linear-gradient(180deg, #0b1f4d 0%, #0a1633 100%);
  color:#e6edf7;
  border-right: 1px solid rgba(255,255,255,.08);
  z-index: 30;
}
.sidebar-header{
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand{
  display:block;
  text-decoration:none;
  color:#fff;
  font-weight: 850;
  letter-spacing: .3px;
  font-size: 18px;
}
.brand-accent{ color: #93c5fd; }
.sidebar-subtitle{
  margin-top: 6px;
  color: rgba(230,237,247,.75);
  font-size: 12px;
}
.nav{ padding: 14px 10px; display:flex; flex-direction:column; gap:6px;}
.nav-link{
  display:flex; align-items:center; gap:10px;
  padding: 12px 12px;
  border-radius: 12px;
  color: rgba(230,237,247,.82);
  text-decoration:none;
  border: 1px solid transparent;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.nav-link:hover{
  background: rgba(147,197,253,.12);
  border-color: rgba(147,197,253,.25);
  transform: translateX(2px);
}
.nav-link.active{
  background: rgba(147,197,253,.18);
  border-color: rgba(147,197,253,.35);
  color:#fff;
}
.nav-link .icon{ width:22px; display:inline-flex; justify-content:center; }

.sidebar-footer{
  position:absolute; left:0; right:0; bottom:0;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.pill{
  display:inline-flex;
  align-items:center;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 12px;
  color: rgba(230,237,247,.9);
}

/* Layout */
.main{
  margin-left: var(--sidebar-width);
  padding: 26px 26px 90px;
  min-height: 100vh;
}
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap: 18px;
  margin-bottom: 18px;
}
.page-title{ margin:0; font-size: 22px; letter-spacing:-.2px; }
.page-subtitle{ margin-top: 6px; color: var(--muted); font-size: 13px; }
.topbar-actions{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }

.footer{
  position:fixed;
  left: var(--sidebar-width);
  right:0;
  bottom:0;
  padding: 12px 18px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  display:flex;
  justify-content:space-between;
  color: var(--muted);
  font-size: 12px;
}

/* Cards */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card.pad{ padding: 18px; }
.grid{
  display:grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 18px;
}
@media (max-width: 1100px){
  .grid{ grid-template-columns:1fr; }
  .footer{ left:0; }
  .main{ margin-left:0; padding: 18px 14px 90px; }
  .sidebar{ position:static; width:auto; height:auto; }
}

/* Form */
.form-row{
  display:grid;
  grid-template-columns: 1.2fr .9fr .7fr .8fr;
  gap: 12px;
  align-items:end;
}
@media (max-width: 1100px){
  .form-row{ grid-template-columns: 1fr; }
}
.label{ font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom:6px; display:block; }
.input, .select{
  width:100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  outline:none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus{
  border-color: rgba(29,78,216,.45);
  box-shadow: 0 0 0 4px rgba(29,78,216,.12);
}
.switch{
  display:flex; align-items:center; gap:10px; margin-top: 12px;
  color: var(--muted); font-size: 13px;
}
.switch input{ width: 42px; height: 22px; }

.btn{
  border: 1px solid transparent;
  background: var(--primary);
  color:#fff;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 800;
  cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  display:inline-flex; align-items:center; gap:10px;
  box-shadow: 0 10px 18px rgba(29,78,216,.18);
}
.btn:hover{ background: var(--primary-2); transform: translateY(-1px); }
.btn:disabled{ opacity:.65; cursor:not-allowed; transform:none; }
.btn.ghost{
  background: #fff;
  color: var(--ink);
  border-color: var(--border);
  box-shadow: none;
}
.btn.ghost:hover{ border-color: rgba(29,78,216,.35); box-shadow: 0 10px 18px rgba(2,6,23,.08); }
.btn.danger{
  background: var(--danger);
  box-shadow: 0 10px 18px rgba(185,28,28,.16);
}
.btn.small{ padding: 9px 10px; border-radius: 10px; font-weight: 800; }

/* Table */
.table-wrap{ overflow:auto; border-radius: var(--radius); border: 1px solid var(--border); }
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 900px;
  background:#fff;
}
.table thead th{
  background: #0f2147;
  color:#eaf2ff;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .06em;
  padding: 14px 14px;
  position: sticky; top:0;
}
.table td{
  padding: 14px 14px;
  border-bottom: 1px solid #eef2f7;
  font-size: 13px;
  color: #0f172a;
}
.table tbody tr:nth-child(even){ background: #f8fafc; }
.table tbody tr:hover{ background: rgba(29,78,216,.06); }
.badge{
  display:inline-flex; align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-weight: 800;
  color: #0f172a;
  font-size: 12px;
}
.muted{ color: var(--muted); }
.right{ text-align:right; }
.center{ text-align:center; }

.total{
  display:flex; justify-content:space-between; align-items:center; gap:14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(29,78,216,.10), rgba(29,78,216,.04));
  border: 1px solid rgba(29,78,216,.18);
}
.total .big{
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -.3px;
}
.kpi{
  display:flex; flex-direction:column; gap:2px;
}
.kpi .cap{ font-size: 11px; text-transform:uppercase; letter-spacing:.08em; color: var(--muted); font-weight: 800;}
.kpi .val{ font-size: 14px; font-weight: 900; color: var(--primary); }

/* Toast */
.toast{
  position:fixed;
  right: 18px;
  bottom: 70px;
  background: #0f172a;
  color:#fff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  z-index: 80;
  max-width: 360px;
}
.toast.show{ opacity:1; transform: translateY(0); }
