:root {
  --bg: #f5f7fb; --card: #fff; --text: #1d2433; --muted: #6b7486; --line: #e3e7ef;
  --primary: #2f6fed; --primary-d: #2459c4; --danger: #d64545; --ok: #1f9d55; --warn: #d08a00;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: #0f1d3a; color: #fff; position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.topbar .brand { color: #fff; font-weight: 700; font-size: 17px; }
.topbar nav { display: flex; gap: 16px; align-items: center; }
.topbar nav a { color: #cfd8ee; }
.topbar nav a.btn { color: #fff; }
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 16px; }
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; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .g3, .g4, .split { grid-template-columns: 1fr 1fr; } .split { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .topbar { padding: 10px 16px; } }
.stat { text-align: left; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c9d8ff; border-color: var(--primary); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 600; }
.btn:hover { background: #f0f3f9; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-danger { color: var(--danger); border-color: #f0c9c9; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f7f9fd; }
.table-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2fa; color: #3b4a66; white-space: nowrap; }
.s-appointment-booked { background: #e6efff; color: #2459c4; }
.s-appointment-done { background: #e8f6ff; color: #0b6fa4; }
.s-no-show { background: #fdeaea; color: #b23434; }
.s-rescheduled { background: #fff4e0; color: #9a6400; }
.s-follow-up { background: #f3ebff; color: #6b3fc7; }
.s-proposal-sent { background: #e9f8f1; color: #16794a; }
.s-negotiation { background: #fff0e6; color: #b2560b; }
.s-won { background: #d9f5e5; color: #0e7a3e; }
.s-lost { background: #eceef2; color: #555e70; }
.pipeline { display: flex; gap: 4px; flex-wrap: wrap; }
.pipeline .step { flex: 1; min-width: 90px; text-align: center; padding: 6px 4px; font-size: 11px; font-weight: 600; border-radius: 6px; background: #eef1f6; color: var(--muted); cursor: pointer; border: 1px solid transparent; }
.pipeline .step.done { background: #dbe7ff; color: #2459c4; }
.pipeline .step.current { background: var(--primary); color: #fff; }
.pipeline .step:hover { border-color: var(--primary); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { background: none; border: none; padding: 8px 14px; cursor: pointer; font: inherit; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.rec { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.rec audio, .rec video { width: 100%; margin-top: 8px; }
.rec video { max-height: 260px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--primary); }
.timeline li.k-status::before { background: var(--primary); }
.timeline li.k-recording::before { border-color: var(--ok); }
.timeline li.k-followup::before { border-color: var(--warn); }
.timeline .when { font-size: 12px; color: var(--muted); }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--primary); background: #f0f5ff; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #1d2433; color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.appt { font-weight: 600; }
.progress { height: 6px; background: #eef1f6; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--primary); }
.auth-box { max-width: 380px; margin: 60px auto; }
.auth-box form > div { margin-bottom: 12px; }
.auth-box .btn { width: 100%; justify-content: center; }
.err-msg { color: var(--danger); min-height: 20px; font-size: 13px; }
.userchip { color: #cfd8ee; font-size: 13px; }
.userchip b { color: #fff; }
.role { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.role-admin { background: #ffe9d6; color: #a14b00; }
.role-manager { background: #e6efff; color: #2459c4; }
.role-opener { background: #e2f6ec; color: #16794a; }
.pipeline.readonly .step { cursor: default; }
.pipeline.readonly .step:hover { border-color: transparent; }
tr.inactive td { opacity: .5; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
