:root {
  --bg: #f5f6f8; --panel: #fff; --ink: #1d2433; --muted: #667085; --line: #e3e6eb;
  --accent: #0b5cad; --accent-soft: #e8f1fb; --danger: #b42318; --ok: #2e7d32; --warn: #b54708;
  --radius: 8px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { background: #0f2747; color: #fff; display: flex; align-items: center; gap: 4px; padding: 0 16px; height: 52px; position: sticky; top: 0; z-index: 10; }
header.top .brand { font-weight: 700; margin-right: 18px; color: #fff; font-size: 15px; white-space: nowrap; }
header.top nav { display: flex; gap: 2px; flex-wrap: nowrap; overflow-x: auto; flex: 1; }
header.top nav a { color: #c9d6ea; padding: 8px 10px; border-radius: 6px; white-space: nowrap; }
header.top nav a.on, header.top nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
header.top .me { color: #c9d6ea; white-space: nowrap; display: flex; gap: 10px; }
header.top .me a { color: #c9d6ea; }
main { padding: 20px; max-width: 1400px; margin: 0 auto; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.sub { color: var(--muted); margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 2fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.stat { font-size: 26px; font-weight: 700; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; }
tr:hover td { background: #fafcff; }
.tablewrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #eef1f5; color: #344054; margin: 1px 2px 1px 0; white-space: nowrap; }
.chip.tag { color: #fff; }
.chip.cc { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chip.cc.hq { background: var(--accent); color: #fff; }
.chip.cc.target { background: #fff4e5; color: var(--warn); }
.chip.role { background: #f3e8ff; color: #6a1b9a; }
.chip.st-active { background: #e7f5e9; color: var(--ok); }
.chip.st-prospect { background: #eef4ff; color: var(--accent); }
.chip.st-dormant, .chip.st-closed { background: #f2f4f7; color: var(--muted); }
.chip.s-won { background: #e7f5e9; color: var(--ok); }
.chip.s-lost { background: #fde8e7; color: var(--danger); }
form.inline { display: inline; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 2px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], input[type=url], select, textarea {
  font: inherit; padding: 6px 8px; border: 1px solid #cfd4dc; border-radius: 6px; background: #fff; color: var(--ink); max-width: 100%; }
textarea { width: 100%; min-height: 90px; }
select[multiple] { min-height: 140px; min-width: 220px; }
.btn, button { font: inherit; padding: 6px 12px; border-radius: 6px; border: 1px solid #cfd4dc; background: #fff; color: var(--ink); cursor: pointer; display: inline-block; }
.btn:hover, button:hover { background: #f5f7fa; text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover, button.primary:hover { background: #094c90; }
button.danger, .btn.danger { color: var(--danger); border-color: #f1c0bc; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
.form { display: grid; grid-template-columns: 180px 1fr; gap: 10px 14px; align-items: start; }
.form > label { padding-top: 6px; color: var(--muted); }
.form .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 10px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.flash { background: #e7f5e9; border: 1px solid #b7e1bd; color: var(--ok); padding: 8px 12px; border-radius: 6px; margin-bottom: 14px; }
.error { background: #fde8e7; border: 1px solid #f1c0bc; color: var(--danger); padding: 8px 12px; border-radius: 6px; margin-bottom: 14px; }
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.col { flex: 0 0 260px; background: #eceff3; border-radius: var(--radius); padding: 8px; }
.col h4 { margin: 2px 4px 8px; font-size: 13px; display: flex; justify-content: space-between; }
.oc { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-bottom: 8px; }
.oc .t { font-weight: 600; }
.oc select { font-size: 12px; padding: 2px 4px; margin-top: 6px; width: 100%; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.pre { white-space: pre-wrap; }
.collapse { max-height: 7.5em; overflow: hidden; position: relative; }
.collapse.open { max-height: none; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 6px; background: #fff; border: 1px solid var(--line); }
.tabs a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.matrix { table-layout: fixed; }
.matrix th:first-child { width: 40%; }
.matrix td.n, .matrix th.num { text-align: center; }
.matrix td.n a { display: inline-block; min-width: 24px; }
.bar { height: 8px; background: var(--accent); border-radius: 4px; }
.login { max-width: 380px; margin: 80px auto; }
.done td { color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
