:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7385; --line: #e3e6ec;
  --brand: #1f6feb; --brand-soft: #e8f0fe; --hot: #e5484d; --warm: #f5a524; --cold: #3e8ed0;
  --ok: #2f9e44; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.layout { display: flex; min-height: 100vh; }
.side { width: 220px; background: #111827; color: #cbd2e0; padding: 20px 12px; flex-shrink: 0; }
.side .logo { color: #fff; font-weight: 700; font-size: 17px; padding: 0 10px 18px; }
.side a { display: block; color: #cbd2e0; padding: 8px 10px; border-radius: 8px; margin-bottom: 2px; }
.side a:hover, .side a.active { background: #1f2937; color: #fff; text-decoration: none; }
.main { flex: 1; padding: 24px 28px; min-width: 0; }
h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #fafbfc; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: #eef0f4; white-space: nowrap; }
.badge.hot { background: #fde8e8; color: var(--hot); }
.badge.warm { background: #fef3dc; color: #a86b00; }
.badge.cold { background: #e3effa; color: var(--cold); }
.badge.disqualified { background: #eee; color: #777; }
.badge.partial { background: #f1f1f1; color: #888; }
.badge.ok { background: #e3f6e8; color: var(--ok); }
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 7px 14px; border-radius: 8px; cursor: pointer; font: inherit; }
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #1a5fd0; }
.btn.danger { color: var(--hot); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=url], select, textarea {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%;
}
textarea { min-height: 140px; resize: vertical; }
label.f { display: block; font-weight: 600; margin: 12px 0 6px; }
.flash { background: var(--brand-soft); border: 1px solid #c6d8fb; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.filters { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.filters fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 0; max-height: 210px; overflow: auto; }
.filters legend { font-weight: 600; font-size: 12px; padding: 0 4px; color: var(--muted); }
.filters label { display: block; font-size: 13px; cursor: pointer; }
details.filterbox > summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.bars { display: flex; gap: 6px; align-items: flex-end; height: 160px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bars .col { width: 100%; background: var(--brand-soft); border-radius: 4px 4px 0 0; position: relative; }
.bars .col .in { position: absolute; bottom: 0; left: 0; right: 0; background: var(--brand); border-radius: 4px 4px 0 0; }
.bars .col .hot { position: absolute; bottom: 0; left: 30%; right: 30%; background: var(--hot); }
.bars .d { font-size: 11px; color: var(--muted); margin-top: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; font-size: 12px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.progress { height: 8px; background: #eef0f4; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; }
.kv div:nth-child(odd) { color: var(--muted); }
.btnrow { display: grid; grid-template-columns: 170px 1fr 1fr 40px; gap: 8px; margin-bottom: 8px; }
.preview { background: #e6ebee; border-radius: 12px; padding: 14px; }
.preview .msg { background: #fff; border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; max-width: 420px; }
.preview .kb { max-width: 420px; margin-top: 4px; }
.preview .kb div { background: rgba(255,255,255,.7); text-align: center; padding: 7px; border-radius: 8px; margin-top: 4px; font-size: 13px; }
.audience { font-size: 18px; font-weight: 700; }
.login { max-width: 360px; margin: 12vh auto; }
code { background: #f1f3f6; padding: 2px 6px; border-radius: 4px; font-size: 12px; word-break: break-all; }
.ctable { min-width: 680px; }
.ctable input[name=name] { min-width: 150px; }
@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .side { width: auto; display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .side .logo { width: 100%; padding-bottom: 6px; }
  .main { padding: 16px; }
  .kv { grid-template-columns: 1fr; }
  .btnrow { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
}
