:root {
  --blue: #1f4fd8; --blue-600: #1a42b8; --blue-50: #eef3ff; --blue-100: #dde7ff;
  --ink: #0f1a33; --ink-2: #44506b; --ink-3: #7a849b; --line: #e3e8f1; --bg: #f5f7fb; --card: #fff;
  --green: #18a058; --green-50: #e8f7ee; --amber: #c27c0e; --amber-50: #fff5e0; --red: #d4363a; --red-50: #fdecec;
  --purple: #6b4fd8; --purple-50: #f1edff;
  --radius: 12px; --shadow: 0 1px 2px rgba(15,26,51,.05), 0 2px 8px rgba(15,26,51,.04);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); font-size: 14px; line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink-3); }
.muted { color: var(--ink-3); } .small { font-size: 12px; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.row { display: flex; gap: 12px; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; } .right { margin-left: auto; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }

/* Shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: #0e1a3a; color: #c9d3ee; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 800; font-size: 19px; font-style: italic; letter-spacing: -.02em; }
.brand img { width: 28px; height: 28px; }
.brand small { display: block; font-style: normal; font-weight: 500; font-size: 11px; color: #8d9bc2; letter-spacing: 0; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #c9d3ee; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav a.active { background: var(--blue); color: #fff; }
.nav .count { margin-left: auto; background: rgba(255,255,255,.14); border-radius: 99px; padding: 0 8px; font-size: 11.5px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6c7aa3; padding: 14px 12px 6px; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.side-foot button { margin-top: 8px; width: 100%; }
.main { padding: 26px 32px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }

.banner { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; }
.banner.warn { background: var(--amber-50); color: #7a4d06; }
.banner.danger { background: var(--red-50); color: #8b1d20; }
.banner.info { background: var(--purple-50); color: #3d2a99; }

/* Cards & stats */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g2 { grid-template-columns: repeat(2, 1fr); }
.g-main { grid-template-columns: 1.6fr 1fr; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g-main, .g3 { grid-template-columns: 1fr; } }
.stat { padding: 16px 18px; }
.stat .label { color: var(--ink-3); font-size: 12.5px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.stat .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 14px 18px; }
.pipeline a { background: var(--bg); border-radius: 10px; padding: 10px 12px; color: var(--ink); }
.pipeline a:hover { background: var(--blue-50); text-decoration: none; }
.pipeline b { display: block; font-size: 20px; }

/* Lists & tables */
.list > * { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: 0; }
.list .empty { color: var(--ink-3); text-align: center; padding: 26px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #f9fbff; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.pill.lead, .pill.new, .pill.requested, .pill.pending, .pill.drafted { background: var(--amber-50); color: var(--amber); }
.pill.quoted, .pill.confirmed, .pill.logged { background: var(--blue-50); color: var(--blue); }
.pill.booked, .pill.purple { background: var(--purple-50); color: var(--purple); }
.pill.customer, .pill.completed, .pill.active, .pill.sent, .pill.posted, .pill.handled, .pill.done { background: var(--green-50); color: var(--green); }
.pill.lost, .pill.canceled, .pill.failed, .pill.suspended { background: var(--red-50); color: var(--red); }
.pill.past_due { background: var(--amber-50); color: var(--amber); }
.pill.skipped, .pill.purged { background: #eef0f4; color: var(--ink-3); }

/* Forms */
button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: #c9d2e3; text-decoration: none; }
button.primary, .btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.primary:hover, .btn.primary:hover { text-decoration: none; background: var(--blue-600); }
button.danger { color: var(--red); } button.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
button.ghost { border-color: transparent; background: transparent; }
button.sm { padding: 5px 10px; font-size: 12.5px; }
button:disabled { opacity: .55; cursor: not-allowed; }
label { display: block; font-weight: 600; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }
input, select, textarea { font: inherit; width: 100%; padding: 8px 11px; border: 1px solid #d4dbe8; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-100); border-color: var(--blue); }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox] { width: auto; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.toggle { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle input { margin-top: 3px; }
.toggle b { display: block; font-size: 13.5px; }
.toggle span { color: var(--ink-3); font-size: 12.5px; }
.toggle.inline-input input[type=number] { width: 70px; display: inline-block; padding: 4px 8px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { color: var(--blue); border-color: var(--blue); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters a { padding: 5px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-weight: 500; font-size: 13px; }
.filters a.active { background: var(--ink); color: #fff; border-color: var(--ink); text-decoration: none; }

/* Timeline */
.timeline { padding: 6px 18px; }
.timeline .ev { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.timeline .ev:last-child { border-bottom: 0; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue-100); border: 2px solid var(--blue); margin-top: 4px; }
.timeline .ev.email_sent .dot, .timeline .ev.sms_sent .dot { border-color: var(--green); background: var(--green-50); }
.timeline .ev.note .dot { border-color: var(--purple); background: var(--purple-50); }

/* Day schedule */
.day { margin-bottom: 18px; }
.day h3 { font-size: 12.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 8px; }
.slot { display: grid; grid-template-columns: 86px 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.slot.completed { border-left-color: var(--green); } .slot.canceled { border-left-color: var(--red); opacity: .6; }
.slot .time { font-weight: 700; }

/* Reviews */
.review { padding: 18px; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: 0; }
.stars { color: #f5a524; letter-spacing: 1px; }
.stars .off { color: #d8dde7; }
.reply-box { margin-top: 12px; background: var(--bg); border-radius: 10px; padding: 12px; }
.reply-box.posted { background: var(--green-50); }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15,26,51,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(760px, 100%); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
#toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 380px; }
.toast.error { background: var(--red); }
.secret { background: var(--bg); border: 1px dashed #c4cde0; border-radius: 8px; padding: 10px 12px; word-break: break-all; }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: linear-gradient(150deg, #0e1a3a, #1f4fd8); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; }
.auth-art h1 { font-size: 34px; font-style: italic; font-weight: 800; }
.auth-art p { color: #c9d6ff; font-size: 16px; max-width: 420px; }
.auth-art ul { list-style: none; padding: 0; margin: 24px 0 0; }
.auth-art li { padding: 6px 0; color: #e3eaff; }
.auth-art li::before { content: "✓"; color: #6ee7a8; font-weight: 800; margin-right: 10px; }
.auth-form { display: grid; place-items: center; padding: 40px; }
.auth-form form { width: min(360px, 100%); }
@media (max-width: 820px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } }
.error-text { color: var(--red); font-size: 13px; margin: 8px 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; word-break: break-word; }
