/* ClientReach dashboard. Builds on site.css tokens and components. */
.app-body { background: var(--bg); }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); gap: 12px; }
.boot img { width: 44px; height: 44px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

/* ------------------------------- shell ------------------------------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 14px; background: #fff; border-right: 1px solid var(--line); }
.side .logo { padding: 4px 8px 18px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--ink-2);
  font-weight: 600; font-size: .94rem; text-decoration: none !important; border: 0; background: none; width: 100%; cursor: pointer; text-align: left; font-family: inherit;
}
.nav-item svg { width: 19px; height: 19px; flex: none; color: var(--faint); }
.nav-item:hover { background: var(--surface-2); }
.nav-item.on { background: var(--brand-soft); color: var(--brand-2); }
.nav-item.on svg { color: var(--brand); }
.nav-item .count { margin-left: auto; background: var(--brand); color: #fff; font-size: .74rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.side-gap { flex: 1; }
.engine-pill { display: flex; align-items: center; gap: 9px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 12px; font-size: .84rem; color: var(--ink-2); text-decoration: none !important; }
.engine-pill:hover { background: var(--surface-2); }
.engine-pill small { display: block; color: var(--muted); font-size: .76rem; }

.main { min-width: 0; padding: 28px 34px 80px; }
.page { max-width: 1060px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 1.7rem; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 30px 0 12px; }
.section-title h2 { font-size: 1.14rem; margin: 0; }
.section-title .muted { font-size: .88rem; }
.section-title .right { margin-left: auto; }
.stack { display: grid; gap: 12px; }
.banners { display: grid; gap: 10px; margin-bottom: 18px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: .82rem; font-weight: 600; }
.stat .value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat .sub { color: var(--muted); font-size: .8rem; }
.meter { height: 6px; background: #edf0f6; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; width: 0; transition: width .4s; }
.meter.green > i { background: #16b67c; }

/* routine */
.routine-card { padding: 18px 20px; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; }
.ring { width: 58px; height: 58px; }
.ring circle { fill: none; stroke-width: 7; }
.ring .bg { stroke: #edf0f6; }
.ring .fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset .5s; transform: rotate(-90deg); transform-origin: 50% 50%; }
.routine-steps { display: flex; gap: 18px; flex-wrap: wrap; }
.r-step { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.r-step .ck { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; font-size: .75rem; color: #fff; flex: none; }
.r-step.done .ck { background: #16b67c; border-color: #16b67c; }
.r-step.done { color: var(--muted); text-decoration: line-through; }
.streak { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-weight: 750; font-size: .9rem; white-space: nowrap; }

/* lead card */
.lead-card { padding: 16px; display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 16px; transition: opacity .25s, transform .25s; }
.lead-card.out { opacity: 0; transform: translateX(24px); }
.thumb { width: 148px; height: 83px; border-radius: 10px; object-fit: cover; background: linear-gradient(135deg, #e8eaf3, #f3f4f9); display: block; }
.lead-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.lead-top h3 { margin: 0; font-size: 1.04rem; }
.lead-top h3 a { color: var(--ink); }
.facts { display: flex; gap: 6px 14px; flex-wrap: wrap; color: var(--muted); font-size: .86rem; margin: 4px 0 6px; }
.facts b { color: var(--ink-2); font-weight: 650; }
.latest { font-size: .88rem; color: var(--ink-2); margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.why { font-size: .84rem; color: var(--muted); margin: 0 0 8px; }
.email-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.email-line .mono { color: var(--ink-2); font-size: .84rem; }
.personal { grid-column: 1 / -1; display: grid; gap: 8px; }
.personal-row { display: flex; gap: 8px; }
.personal-row input { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 4px 11px; font-size: .8rem; color: var(--ink-2); cursor: pointer; font-family: inherit; }
.chip:hover { border-color: var(--brand); color: var(--brand-2); }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-2); }
.card-actions { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-actions .spacer { flex: 1; }
.fit { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--green); }
.fit .bar { width: 46px; height: 5px; background: #e6efe9; border-radius: 99px; overflow: hidden; }
.fit .bar i { display: block; height: 100%; background: #16b67c; }

/* reply card */
.reply-card { padding: 16px 18px; display: grid; gap: 10px; }
.reply-card.interested, .reply-card.question { border-left: 4px solid #16b67c; }
.reply-card.not_now { border-left: 4px solid #e89b18; }
.reply-card.no { border-left: 4px solid var(--line-2); }
.reply-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.reply-head b { font-size: 1rem; }
.quote { margin: 0; padding: 11px 14px; background: var(--surface-2); border-radius: 10px; color: var(--ink-2); white-space: pre-wrap; font-size: .93rem; max-height: 220px; overflow: auto; }
.reply-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.reply-actions select { width: auto; min-height: 32px; padding: 4px 8px; font-size: .84rem; }

/* tabs, table */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; font: 600 .92rem var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--brand-2); border-bottom-color: var(--brand); }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 320px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: .92rem; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #fafbff; }
.table .sub { display: block; color: var(--muted); font-size: .8rem; }
.table-wrap { overflow-x: auto; }

/* kanban */
.board { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #eef0f6; border-radius: 14px; padding: 10px; min-height: 160px; }
.col-head { display: flex; justify-content: space-between; font-weight: 700; font-size: .86rem; padding: 4px 6px 10px; color: var(--ink-2); }
.deal { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow-sm); }
.deal:hover { border-color: #c7cbf3; }
.deal b { display: block; font-size: .92rem; }
.deal small { color: var(--muted); }
.deal select { margin-top: 8px; min-height: 30px; padding: 3px 6px; font-size: .8rem; }

/* funnel */
.funnel { display: grid; gap: 9px; }
.f-row { display: grid; grid-template-columns: 150px 1fr 70px; gap: 12px; align-items: center; font-size: .9rem; }
.f-bar { height: 26px; background: #eef0f6; border-radius: 8px; overflow: hidden; }
.f-bar i { display: block; height: 100%; background: linear-gradient(90deg, #6d67f0, #4c46e6); border-radius: 8px; min-width: 2px; }
.f-row .n { text-align: right; font-weight: 700; }

/* modal / drawer */
.overlay { position: fixed; inset: 0; background: rgba(14, 20, 38, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; animation: rise .18s; }
@keyframes rise { from { transform: translateY(10px); opacity: .6; } }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.email-preview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.email-preview .meta { padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: .86rem; display: grid; gap: 3px; }
.email-preview .meta span { color: var(--muted); display: inline-block; width: 64px; }
.email-preview pre { margin: 0; padding: 14px 16px; white-space: pre-wrap; font: .94rem/1.6 var(--font); color: var(--ink); }
.timeline { display: grid; gap: 10px; }
.t-item { display: grid; grid-template-columns: 22px 1fr; gap: 10px; }
.t-item .t-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; background: var(--brand-soft); color: var(--brand-2); }
.t-item.reply .t-dot { background: var(--green-soft); color: var(--green); }
.t-item .when { color: var(--muted); font-size: .8rem; }

/* toasts */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: min(92vw, 440px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .92rem; display: flex; gap: 10px; align-items: center; animation: rise .2s; }
.toast.err { background: #8f1d1d; }
.toast.ok::before { content: "✓"; color: #6ff0be; font-weight: 800; }

/* auth + wizard */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(160deg, #191563, #4c46e6 62%, #7c3cf0); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .logo { color: #fff; }
.auth-side h2 { color: #fff; font-size: 2rem; max-width: 420px; }
.auth-side ul { padding: 0; list-style: none; display: grid; gap: 12px; color: rgba(255, 255, 255, .9); }
.auth-side li::before { content: "✓  "; color: #8ff3c9; font-weight: 800; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h1 { font-size: 1.7rem; }
.auth-box .btn.block { margin-top: 6px; }

.wizard { max-width: 1060px; margin: 0 auto; padding: 28px 24px 80px; }
.wizard-top { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.stepper { display: flex; gap: 6px; margin-left: auto; }
.stepper i { width: 34px; height: 5px; border-radius: 99px; background: var(--line-2); }
.stepper i.on { background: var(--brand); }
.wizard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.wizard-grid.single { grid-template-columns: minmax(0, 720px); justify-content: center; }
.wizard h1 { font-size: 1.75rem; }
.wizard-foot { display: flex; gap: 10px; margin-top: 22px; }
.wizard-foot .spacer { flex: 1; }
.preview-side { position: sticky; top: 20px; }
.preview-side .email-preview pre { font-size: .86rem; }

.connect-steps { display: grid; gap: 14px; counter-reset: s; }
.c-step { display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 18px; }
.c-step::before { counter-increment: s; content: counter(s); width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; font-weight: 800; }
.c-step h3 { margin: 4px 0 6px; font-size: 1.02rem; }
.c-step p { margin: 0 0 8px; color: var(--ink-2); font-size: .93rem; }
.big-code { display: inline-flex; align-items: center; gap: 12px; font: 800 1.7rem/1 var(--mono); letter-spacing: .12em; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-2); }
.waiting { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); font-weight: 600; }
.spin { width: 16px; height: 16px; border: 2.5px solid #cfd3f7; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.settings-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.sub-nav { display: grid; gap: 2px; position: sticky; top: 20px; }
.form-card { padding: 24px; }
.form-card h2 { font-size: 1.15rem; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.switch:last-child { border-bottom: 0; }
.switch b { display: block; }
.switch small { color: var(--muted); }
.toggle { position: relative; width: 44px; height: 26px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; transition: .2s; cursor: pointer; }
.toggle span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.toggle input:checked + span { background: var(--brand); }
.toggle input:checked + span::after { transform: translateX(18px); }
.toggle input:focus-visible + span { outline: 3px solid rgba(76, 70, 230, .35); outline-offset: 2px; }

.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .em { font-size: 2.2rem; display: block; margin-bottom: 8px; }
.empty b { color: var(--ink); display: block; margin-bottom: 4px; font-size: 1.02rem; }
.empty .cta-row { justify-content: center; margin-bottom: 0; }
.skeleton { height: 120px; border-radius: var(--r-lg); background: linear-gradient(90deg, #eceef5 25%, #f5f6fa 50%, #eceef5 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.menu { position: absolute; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 190px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font: 500 .9rem var(--font); cursor: pointer; color: var(--ink-2); }
.menu button:hover { background: var(--surface-2); }
.rel { position: relative; }

@media (max-width: 1100px) {
  .wizard-grid { grid-template-columns: 1fr; }
  .preview-side { position: static; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 25; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--line); gap: 2px; }
  .side .logo { padding: 0 8px 0 2px; }
  .side .logo span, .side-gap, .engine-pill, .nav-item .label { display: none; }
  .nav-item { width: auto; padding: 9px; }
  .nav-item .count { margin-left: 4px; }
  .main { padding: 20px 16px 70px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .sub-nav { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .sub-nav .nav-item { white-space: nowrap; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 640px) {
  .lead-card { grid-template-columns: 1fr; }
  .thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .routine-card { grid-template-columns: auto 1fr; }
  .routine-card .streak { grid-column: 1 / -1; justify-self: start; }
  .f-row { grid-template-columns: 100px 1fr 50px; }
  .kv { grid-template-columns: 1fr; }
  .page-head .actions { margin-left: 0; }
}
