:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --canvas: #eaf0f6;
  --card: #ffffff;
  --green: #047857;
  --green-bg: #ecfdf5;
  --rose: #be123c;
  --rose-bg: #fff1f2;
  --amber: #92400e;
  --amber-bg: #fffbeb;
  --slate-bg: #f1f5f9;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Segoe UI", sans-serif;
  font-size: 14px;
}
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: #0f172a;
  color: #e2e8f0;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.brand { margin-bottom: 22px; }
.brand-name { min-width: 0; }
.brand-name strong { display: block; font-size: 15px; line-height: 1.15; color: #fff; font-weight: 800; }
.brand-name span { display: block; margin-top: 2px; font-size: 10px; line-height: 1.3; color: #94a3b8; font-weight: 600; }
.nav a {
  display: block; color: #cbd5e1; padding: 9px 12px; border-radius: 10px; margin-bottom: 2px; font-weight: 600; font-size: 13px;
}
.nav a.active, .nav a:hover { background: rgba(255,255,255,.08); color: white; }
.nav .group { margin: 16px 12px 6px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #64748b; }
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 28px; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 18px; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.content { padding: 24px 28px 40px; }
.who { font-size: 12px; color: var(--muted); text-align: right; }
.who strong { color: var(--ink); display: block; }

.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.card {
  background: var(--card); border: 1px solid #eef2f7; border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}
.stat { padding: 16px 18px; }
.stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat strong { display: block; margin-top: 6px; font-size: 28px; letter-spacing: -.03em; }
.panel { padding: 18px; }
.panel h2 { margin: 0 0 12px; font-size: 15px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.field.grow { flex: 1; }
.field label { font-size: 11px; font-weight: 700; color: #475569; letter-spacing: .03em; text-transform: uppercase; }
.field input, .field select, .field textarea {
  height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: white; color: var(--ink);
}
.field textarea { height: 80px; padding: 10px 12px; resize: vertical; }
.btn {
  height: 40px; border: 0; border-radius: 10px; padding: 0 14px; background: var(--blue); color: white;
  font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { background: var(--blue-dark); }
.btn.ghost { background: white; color: #334155; border: 1px solid var(--line); }
.btn.danger { background: var(--rose); }
.btn.small { height: 32px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
th { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
tr:hover td { background: #f8fafc; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: var(--slate-bg); color: #475569; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.rose { background: var(--rose-bg); color: var(--rose); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.blue { background: #eff6ff; color: var(--blue-dark); }
.person { display: flex; gap: 10px; align-items: center; }
.avatar, .photo {
  width: 36px; height: 36px; border-radius: 10px; background: #eff6ff; color: var(--blue);
  display: grid; place-items: center; font-weight: 800; font-size: 12px; object-fit: cover;
}
.sub { color: var(--muted); font-size: 12px; }
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 600; }
.flash.ok { background: var(--green-bg); color: var(--green); }
.flash.bad { background: var(--rose-bg); color: var(--rose); }
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.pager a, .pager span { padding: 6px 10px; border-radius: 8px; background: white; border: 1px solid var(--line); color: var(--ink); font-size: 12px; }
.two { display: grid; grid-template-columns: 1.4fr .8fr; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.split { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login {
  width: min(420px, 100%); background: white; border-radius: 20px; padding: 28px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .08);
}
.login .brand-name strong { color: #0f172a; font-size: 18px; }
.login .brand-name span { color: #64748b; font-size: 11px; }
.login h1 { margin: 12px 0 4px; font-size: 16px; }
.login .lead { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; align-items: center; }

@media (max-width: 980px) {
  .shell { display: block; }
  .sidebar { width: auto; height: auto; position: relative; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav .group { width: 100%; }
  .stats, .two, .form-grid { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}
