:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1f2733;
  --muted: #6b7888;
  --line: #e3e8ef;
  --brand: #1f5fd6;
  --brand-d: #1746a0;
  --ok: #1a9c52;
  --warn: #c9881a;
  --bad: #c83a3a;
  --chip: #eef2f8;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: #131b2b; color: #c7d0dd; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  padding: 18px 18px 14px; font-weight: 700; font-size: 16px; color: #fff;
  border-bottom: 1px solid #25304a; line-height: 1.3;
}
.sidebar .brand small { display:block; font-weight:400; color:#7d8aa3; font-size:11px; margin-top:3px;}
.nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.nav .group { color: #5f6c85; font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; padding: 14px 12px 6px; }
.nav a, .nav .disabled {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 8px;
  color: #c7d0dd; margin-bottom: 2px; font-size: 13.5px;
}
.nav a:hover { background: #1d273c; text-decoration: none; color: #fff; }
.nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav .disabled { color:#566179; cursor: default; }
.nav .disabled .soon { margin-left:auto; font-size:10px; background:#26324c; color:#8694b0;
  padding:1px 6px; border-radius:6px; }
.sidebar .foot { padding: 12px 16px; border-top: 1px solid #25304a; font-size: 12px; color:#8694b0;}

.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 14px 26px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar .spacer { flex: 1; }
.content { padding: 24px 26px; max-width: 1180px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border-radius: 8px; border: 1px solid var(--brand); background: var(--brand);
  color: #fff; cursor: pointer; font-size: 13.5px; font-weight: 500;
}
.btn:hover { background: var(--brand-d); text-decoration: none; color:#fff; }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.ghost:hover { background: #f0f5ff; }
.btn.sec { background:#fff; color: var(--ink); border-color: var(--line); }
.btn.sec:hover { background:#f5f7fa; }
.btn.danger { background:#fff; color: var(--bad); border-color: #eccaca; }
.btn.danger:hover { background:#fdf0f0; }
.btn.sm { padding: 5px 9px; font-size: 12.5px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); gap: 14px; margin-bottom: 22px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.card .v { font-size: 26px; font-weight: 700; }
.card .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0; overflow:hidden; }
.panel .ph { padding: 14px 18px; border-bottom: 1px solid var(--line); display:flex; align-items:center; gap:12px; }
.panel .ph h2 { font-size: 15px; margin: 0; }
.panel .pb { padding: 18px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing:.02em; background:#fafbfd; position:sticky; top:0;}
tbody tr:hover { background: #fafbff; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

tr.row-warn { background: #fdf3f3; }
tr.row-warn:hover { background: #fbe9e9; }
td.missing-val { background: #fdeaea; color: #b02a2a; }
.field-missing { color: #b02a2a; }
.field-missing-box { background:#fdeaea; border:1px solid #f0c2c2; border-radius:6px;
  padding:1px 7px; color:#b02a2a; font-size:12px; }

.chip { display:inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; background: var(--chip); color: var(--muted); white-space:nowrap;}
button.chip { border: 0; font-family: inherit; line-height: 1.5; }
.badge-toggle { cursor: pointer; transition: filter .12s, transform .05s; }
.badge-toggle:hover { filter: brightness(0.95); }
.badge-toggle:active { transform: scale(0.96); }
.badge-toggle.busy { opacity: .5; pointer-events: none; }
.chip.ok { background:#e4f6ea; color: var(--ok); }
.chip.warn { background:#fbf0d9; color: var(--warn); }
.chip.bad { background:#fbe3e3; color: var(--bad); }
.chip.draft { background:#eceff4; color:#7a8699; }

.form-row { display:flex; flex-direction:column; gap:5px; margin-bottom:15px; }
.form-row.two { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
label { font-weight: 600; font-size: 13px; }
.form-control, .form-select {
  width: 100%; padding: 9px 11px; border: 1px solid #cfd6e0; border-radius: 8px;
  font-size: 14px; background: #fff; font-family: inherit;
}
.form-control:focus, .form-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px #1f5fd622; }
.help { color: var(--muted); font-size: 12px; }

.messages { margin-bottom: 16px; }
.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; border:1px solid transparent;}
.msg.success { background:#e4f6ea; color:#157a40; border-color:#bfe6cc;}
.msg.warning { background:#fbf0d9; color:#90600f; border-color:#f0dcae;}
.msg.error { background:#fbe3e3; color:#a32626; border-color:#f0c2c2;}
.msg.info { background:#e7f0fb; color:#1746a0; border-color:#c5d8f3;}

.toolbar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:16px; }
.toolbar input[type=text], .toolbar select { padding:8px 10px; border:1px solid #cfd6e0; border-radius:8px; font-size:13.5px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.login-wrap { display:flex; align-items:center; justify-content:center; min-height:100vh; background:#131b2b;}
.login-card { background:#fff; padding:30px; border-radius:14px; width:340px; }
.login-card h1 { margin:0 0 4px; font-size:20px;}
.login-card p.sub { margin:0 0 20px; color:var(--muted); font-size:13px;}
.actions { display:flex; gap:10px; align-items:center; margin-top: 8px;}
