:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1a2233;
  --muted: #6b7688;
  --line: #e2e7ee;
  --brand: #16324f;
  --brand-2: #1e6091;
  --accent: #1e6091;
  --danger: #c53030;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--brand); color: #fff; padding: 0 22px; height: 58px;
  position: sticky; top: 0; z-index: 10;
}
.brand { color: #fff; font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.brand span { font-weight: 400; opacity: .7; margin-left: 6px; font-size: 14px; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: #cdd8e3; padding: 8px 12px; border-radius: 8px; font-size: 14px; display: inline-flex; align-items: center; gap: 7px; }
.nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255,255,255,.16); color: #fff; }
.user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #cdd8e3; }

.container { max-width: 1000px; margin: 0 auto; padding: 28px 20px 80px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 8px; }
h1 { font-size: 24px; margin: 6px 0; }
h2 { font-size: 17px; margin: 22px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.btn, button {
  background: var(--accent); color: #fff; border: 0; padding: 9px 16px;
  border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn:hover, button:hover { filter: brightness(1.08); text-decoration: none; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); padding: 8px 14px; border-radius: 9px; }
.btn-ghost:hover { background: #fff; text-decoration: none; }
.btn-danger { background: var(--danger); }
.btn-danger-sm { background: transparent; color: var(--danger); padding: 2px 6px; font-size: 12px; font-weight: 600; }
.btn-danger-sm:hover { background: #fde8e8; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 16px 0; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); color: var(--ink); display: block;
}
.stat:hover { text-decoration: none; border-color: var(--brand-2); }
.stat-icon .icon { width: 26px; height: 26px; color: var(--brand-2); }
.stat-count { font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { margin-top: 6px; font-weight: 700; color: var(--brand); }

.summary { margin: 8px 0 4px; }
.summary-total { background: var(--brand); color: #fff; border-radius: var(--radius); padding: 20px 24px; display: flex; flex-direction: column; gap: 2px; }
.summary-total strong { font-size: 30px; }
.summary-total .muted { color: #b7c5d4; }

.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.table tbody tr:last-child td, .table tr:last-child td { border-bottom: 0; }
.num { text-align: right; white-space: nowrap; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; background: var(--c, #718096); }

.icon { width: 18px; height: 18px; vertical-align: -4px; flex-shrink: 0; }
.icon-nav { width: 16px; height: 16px; vertical-align: -3px; }
.icon-inline { width: 14px; height: 14px; vertical-align: -2px; color: var(--muted); }
h1 .icon { width: 22px; height: 22px; vertical-align: -4px; color: var(--brand); margin-right: 2px; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } }
.cols .full-width { grid-column: 1 / -1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }

.chip { display: inline-block; background: #eef2f7; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 600; margin: 0 4px 4px 0; }
.checkbox-group { display: grid; gap: 8px; }
.checkbox { flex-direction: row !important; align-items: center; font-weight: 400 !important; gap: 8px !important; }
.checkbox input { width: auto; }
.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 12px 6px 0; width: 42%; vertical-align: top; }
.kv td { padding: 6px 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: #40495a; }
input, select, textarea {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: -1px; border-color: var(--brand-2); }
textarea { resize: vertical; }
.actions { display: flex; gap: 10px; align-items: center; }

.upload { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); display: grid; gap: 10px; }

.auth-card { max-width: 380px; margin: 8vh auto 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.auth-card h1 { margin-top: 0; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }

.flash { background: #e6f4ea; border: 1px solid #a6d9b8; color: #1e5631; padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; }
.error { background: #fdecea; border: 1px solid #f5b5ae; color: #a12820; padding: 11px 14px; border-radius: 9px; margin-bottom: 4px; }
