/* Menusday Leads — design system.
   Follows menusday.com: white surfaces, amber only as accent (primary action, active state),
   small radii, hairline borders, almost no shadow, top navigation, centered content. */
@import url("/static/fonts/tajawal.css");

:root {
  color-scheme: light;
  --amber: #FFBD2F; --amber-hover: #F5AD12; --amber-ink: #2A1A00; --amber-soft: #FFF6E0;
  --amber-line: #FBE3A6; --amber-deep: #B45309;
  --ink: #101828; --ink-2: #344054; --ink-3: #667085; --ink-4: #98A2B3;
  --line: #EAECF0; --line-2: #D0D5DD;
  --bg: #F9FAFB; --surface: #FFFFFF; --soft: #F2F4F7;
  --green: #067647; --green-bg: #ECFDF3; --red: #B42318; --red-bg: #FEF3F2;
  --blue: #175CD3; --blue-bg: #EFF8FF; --orange: #B54708; --orange-bg: #FFFAEB;
  --gray: #475467; --gray-bg: #F2F4F7;
  /* legacy names used by page styles */
  --brand-primary: var(--amber); --brand-primary-contrast: var(--amber-ink);
  --dark: var(--ink); --border: var(--line); --text: var(--ink); --text-muted: var(--ink-3);
  --r: 8px; --r-lg: 10px; --r-xl: 14px; --pill: 999px;
  --shadow: 0 1px 2px rgba(16,24,40,.05);
  --shadow-pop: 0 12px 32px -8px rgba(16,24,40,.18), 0 4px 8px -4px rgba(16,24,40,.06);
  --ring: 0 0 0 4px rgba(255,189,47,.30);
  --ease: cubic-bezier(.2,.8,.2,1);
  --font: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --container: 1200px; --header: 60px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 14.5px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
a { color: var(--amber-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 700; line-height: 1.35; }
h2 { font-size: 16px; font-weight: 700; line-height: 1.4; }
h3 { font-size: 15px; font-weight: 700; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--amber-deep); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--amber-line); }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row:empty { display: none; }
.between { justify-content: space-between; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Header: brand · centered pill navigation · user pill ---------- */
.header { position: sticky; top: 0; z-index: 1500; padding: 12px 0; background: rgba(249,250,251,.88); backdrop-filter: blur(10px); }
.header-inner { max-width: var(--container); margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; justify-self: start; color: var(--ink); text-decoration: none !important; }
.brand-mark { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.brand-mark img { width: 64px; height: auto; max-width: none; object-fit: contain; object-position: right center; transform: translateX(-9px); }
.brand-dot { position: absolute; bottom: 1px; inset-inline-end: 1px; width: 11px; height: 11px; border-radius: 50%; background: #22C55E; border: 2px solid var(--surface); }
.brand strong { display: block; font-size: 15.5px; line-height: 1.2; }
.brand small { display: block; color: var(--ink-3); font-size: 12px; }
.nav { display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: var(--pill); background: rgba(255,240,199,.55); border: 1px solid rgba(251,227,166,.9); backdrop-filter: blur(12px) saturate(1.4); box-shadow: 0 6px 24px -12px rgba(180,83,9,.25); }
.nav a { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: var(--pill); color: var(--ink-2); font-weight: 600; text-decoration: none !important; transition: background .15s, color .15s; }
.nav a:hover { color: var(--ink); background: rgba(255,255,255,.55); }
.nav a[aria-current="page"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(180,83,9,.15); }
.nav a[aria-current="page"] .icon { color: var(--amber-deep); }
.nav .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--pill); background: var(--amber); color: var(--amber-ink); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.user { justify-self: end; display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: var(--pill); background: rgba(255,240,199,.55); border: 1px solid rgba(251,227,166,.9); backdrop-filter: blur(12px) saturate(1.4); box-shadow: 0 6px 24px -12px rgba(180,83,9,.25); }
.user .live { width: 9px; height: 9px; margin: 0 8px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
.user .who { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--pill); background: #fff; color: var(--ink); font-size: 13px; font-weight: 700; }
.user .who .icon { color: var(--amber-deep); }
.user .out { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--ink-2); }
.user .out:hover { background: rgba(255,255,255,.6); color: var(--red); }
.tabbar { display: none; }

/* ---------- Page ---------- */
.page { max-width: var(--container); margin: 0 auto; padding: 28px 24px 64px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.page-head p { margin-top: 4px; color: var(--ink-3); max-width: 720px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink-2); font-weight: 700; font-size: 14px; white-space: nowrap; cursor: pointer; text-decoration: none !important; box-shadow: var(--shadow); transition: background .15s, border-color .15s, color .15s, transform .1s; }
.btn:hover:not(:disabled) { background: var(--soft); color: var(--ink); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.btn-primary:hover:not(:disabled) { background: var(--amber-hover); border-color: var(--amber-hover); color: var(--amber-ink); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover:not(:disabled) { background: var(--ink-2); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-3); }
.btn-ghost:hover:not(:disabled) { background: var(--soft); }
.btn-danger { color: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red-bg); color: var(--red); }
.btn-wa { color: var(--green); }
.btn-wa:hover:not(:disabled) { background: var(--green-bg); color: var(--green); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-3); border-top-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Inputs ---------- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .select { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: var(--ink-4); }
.input:focus, .select:focus { outline: none; border-color: var(--amber); box-shadow: var(--ring); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; inset-inline-start: 12px; color: var(--ink-4); pointer-events: none; }
.input-wrap > .input { padding-inline-start: 38px; }
.select { appearance: none; padding-inline-end: 34px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat left 10px center / 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--amber-deep); }

/* ---------- Combobox ---------- */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 45; top: calc(100% + 4px); inset-inline: 0; max-height: 320px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); }
.combo-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.combo-list li[aria-selected="true"], .combo-list li:hover { background: var(--amber-soft); }
.combo-kind { flex: none; min-width: 42px; padding: 1px 6px; border-radius: 4px; background: var(--soft); color: var(--ink-3); font-size: 11.5px; font-weight: 700; text-align: center; }
.combo-main { font-weight: 600; color: var(--ink); }
.combo-sub { color: var(--ink-3); font-size: 12.5px; }
.combo-empty { color: var(--ink-3); cursor: default !important; background: none !important; }
.combo-list mark { background: none; color: var(--amber-deep); font-weight: 700; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head p { font-size: 13px; color: var(--ink-3); }
.divider { height: 1px; background: var(--line); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--pill); background: var(--gray-bg); color: var(--gray); font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ready, .badge-hot { background: var(--red-bg); color: var(--red); }
.badge-high { background: var(--orange-bg); color: var(--orange); }
.badge-warm { background: var(--blue-bg); color: var(--blue); }
.badge-review { background: var(--orange-bg); color: var(--orange); }
.badge-excluded, .badge-ignore { background: var(--gray-bg); color: var(--gray); }
.badge-pending { background: var(--blue-bg); color: var(--blue); }
.badge-success { background: var(--green-bg); color: var(--green); }
.badge-danger { background: var(--red-bg); color: var(--red); }
.badge-warning { background: var(--orange-bg); color: var(--orange); }
.badge-info { background: var(--blue-bg); color: var(--blue); }
.badge-live .dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.chip { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--pill); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s; }
.chip:hover { border-color: var(--amber); background: var(--amber-soft); }

/* ---------- Segment tabs: centered pill control ---------- */
.tabs { justify-self: center; display: flex; gap: 2px; max-width: 100%; padding: 5px; border-radius: var(--pill); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border: 0; border-radius: var(--pill); background: none; color: var(--ink-3); font-weight: 700; font-size: 14px; white-space: nowrap; cursor: pointer; transition: background .15s, color .15s; }
.tab:hover { color: var(--ink); background: var(--soft); }
.tab[aria-selected="true"] { background: var(--amber-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--amber-line); }
.tab .count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--pill); background: var(--soft); color: var(--ink-3); font-size: 12px; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] .count { background: var(--amber); color: var(--amber-ink); }
.tabs-indicator { display: none; }

/* ---------- Stats strip ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; }
.stat { padding: 14px 18px; border-inline-start: 1px solid var(--line); }
.stat:first-child { border-inline-start: 0; }
.stat-label { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
.stat-value { margin-top: 2px; font-size: 24px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--ink-4); font-size: 12px; }
.stat.tone-red .stat-value { color: var(--red); }

/* ---------- Progress ---------- */
.progress { height: 6px; border-radius: var(--pill); background: var(--soft); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--ink); transition: width .4s var(--ease); }
.progress.is-live > span { background: var(--amber); }
.skeleton { border-radius: var(--r); background: linear-gradient(90deg, var(--soft) 25%, #F9FAFB 50%, var(--soft) 75%); background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- Alerts / toast / empty ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid; border-radius: var(--r-lg); font-size: 14px; }
.alert .icon { margin-top: 2px; }
.alert-danger { background: var(--red-bg); border-color: #FECDCA; color: var(--red); }
.alert-info { background: var(--blue-bg); border-color: #B2DDFF; color: var(--blue); }
.alert-warning { background: var(--orange-bg); border-color: #FEDF89; color: var(--orange); }
.alert-success { background: var(--green-bg); border-color: #ABEFC6; color: var(--green); }
.toasts { position: fixed; z-index: 3000; bottom: 24px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--r-lg); background: var(--ink); color: #fff; font-weight: 600; box-shadow: var(--shadow-pop); animation: toast .25s var(--ease); }
.toast .icon { color: var(--amber); }
.toast.leaving { opacity: 0; transition: opacity .2s; }
@keyframes toast { from { opacity: 0; transform: translateY(8px); } }
.empty { display: grid; justify-items: center; gap: 8px; padding: 48px 20px; text-align: center; color: var(--ink-3); }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--soft); color: var(--ink-3); }
.empty h3 { color: var(--ink); }

/* ---------- Lead list: table on desktop, cards on mobile ---------- */
.leads { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; }
.leads-head, .lead { display: grid; grid-template-columns: minmax(220px, 2fr) 70px 224px 110px minmax(200px, 1.1fr); align-items: center; gap: 16px; padding: 0 18px; }
.leads-head { height: 40px; background: var(--bg); border-bottom: 1px solid var(--line); color: var(--ink-3); font-size: 12.5px; font-weight: 700; }
.lead { min-height: 72px; padding-block: 12px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.lead:last-child { border-bottom: 0; }
.lead:hover { background: #FCFCFD; }
.lead.is-new { animation: arrive 1.6s var(--ease); }
@keyframes arrive { from { background: var(--amber-soft); } }
.c-name { min-width: 0; }
.lead-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lead-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.lead-meta { margin-top: 2px; color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-note { margin-top: 4px; font-size: 12.5px; color: var(--red); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-note.warn { color: var(--orange); }
.lead-note.info { color: var(--blue); }
.score { display: inline-grid; place-items: center; min-width: 44px; height: 28px; padding: 0 8px; border-radius: 6px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--soft); color: var(--ink-2); }
.score.hot { background: var(--red-bg); color: var(--red); }
.score.high { background: var(--orange-bg); color: var(--orange); }
.score.warm { background: var(--blue-bg); color: var(--blue); }
.score.ignore { background: var(--gray-bg); color: var(--ink-4); }
.score.pending { color: var(--ink-4); }
.dots { display: flex; gap: 4px; }
.dots i { display: grid; place-items: center; width: 34px; height: 22px; border-radius: 5px; background: var(--soft); color: var(--ink-4); font-style: normal; }
.dots i .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.dots i.met { background: var(--green-bg); color: var(--green); }
.dots-head i { height: auto; background: none; color: var(--ink-3); font-size: 10.5px; font-weight: 700; }
.rating { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-2); }
.rating .star { width: 14px; height: 14px; fill: var(--amber); stroke: var(--amber-hover); }
.rating small { color: var(--ink-4); }
.contact { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.phone { direction: ltr; unicode-bidi: isolate; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13.5px; white-space: nowrap; }

/* ---------- Drawer / modal ---------- */
.scrim { position: fixed; inset: 0; z-index: 2000; background: rgba(16,24,40,.32); animation: fade .2s; }
.drawer { position: fixed; z-index: 2001; top: 0; bottom: 0; inset-inline-end: 0; width: min(520px, 100vw); display: flex; flex-direction: column; background: var(--surface); border-inline-start: 1px solid var(--line); box-shadow: var(--shadow-pop); animation: slide .28s var(--ease); }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow: auto; padding: 20px; display: grid; gap: 20px; align-content: start; }
.drawer section > h3 { margin-bottom: 10px; font-size: 13px; color: var(--ink-3); }
.modal { position: fixed; z-index: 2001; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); animation: pop .22s var(--ease); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { overflow: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-body > * { flex-shrink: 0; }
.modal-sm { width: min(440px, calc(100vw - 32px)); }
.modal-lg { width: min(860px, calc(100vw - 32px)); }
.modal-sub { display: grid; justify-items: center; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.modal-sub .field { justify-self: stretch; }
.modal-sub .tabs { padding: 4px; }
.modal-sub .tab { height: 34px; padding: 0 14px; font-size: 13.5px; }
.confirm-text { color: var(--ink-2); line-height: 1.8; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: #912018; color: #fff; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 var(--r-xl) var(--r-xl); }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(-24px); opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%); } }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.crit { display: grid; gap: 6px; }
.crit-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); }
.crit-row.met { background: #FAFEFB; border-color: #D1FADF; }
.crit-row .icon { margin-top: 2px; color: var(--ink-4); }
.crit-row.met .icon { color: var(--green); }
.crit-row b { font-variant-numeric: tabular-nums; }
.crit-row .ev { grid-column: 2 / 4; color: var(--ink-3); font-size: 12.5px; }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.link-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--soft); color: var(--ink-2); font-size: 12px; font-weight: 600; direction: ltr; }
.link-chip:hover { background: var(--amber-soft); text-decoration: none; }
.option { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); cursor: pointer; }
.option:hover { border-color: var(--line-2); }
.option:has(input:checked) { border-color: var(--amber); background: var(--amber-soft); box-shadow: 0 0 0 1px var(--amber); }
.option input { margin-top: 3px; accent-color: var(--amber-deep); }
.option strong { display: block; }
.option span { color: var(--ink-3); font-size: 13px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 10px 16px; background: var(--bg); color: var(--ink-3); font-size: 12.5px; font-weight: 700; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FCFCFD; }
.table-wrap { overflow-x: auto; }
.table-wrap .table td { white-space: nowrap; }

/* ---------- Map ---------- */
.map { position: relative; isolation: isolate; z-index: 0; height: 420px; border-radius: var(--r-lg); overflow: hidden; background: var(--soft); border: 1px solid var(--line); }
.map .leaflet-control-attribution { font: 500 10px/1.4 var(--font); }
.map-legend { position: absolute; z-index: 500; bottom: 10px; inset-inline-start: 10px; display: flex; flex-wrap: wrap; gap: 10px; padding: 6px 10px; border-radius: var(--r); background: rgba(255,255,255,.95); border: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.map-legend i { display: inline-block; width: 11px; height: 11px; margin-inline-end: 5px; border-radius: 3px; vertical-align: -1px; }
.pin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); background: var(--ink-4); }
.pin.ready { background: #D92D20; } .pin.warm { background: #2E90FA; } .pin.review { background: #F79009; } .pin.excluded { background: #98A2B3; } .pin.pending { background: #fff; border-color: var(--ink-3); }
.cell-running { animation: pulse 1.6s ease-in-out infinite; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .leads-head { display: none; }
  .lead { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; padding: 14px 16px; }
  .lead > .c-name { grid-column: 1; grid-row: 1; }
  .lead > .c-score { grid-column: 2; grid-row: 1; justify-self: end; align-self: start; }
  .lead > .c-dots { grid-column: 1 / -1; }
  .lead > .c-rating { grid-column: 1; }
  .lead > .c-contact { grid-column: 2; }
}
@media (max-width: 820px) {
  :root { --header: 56px; }
  .header { padding: 10px 0; }
  .header-inner { padding: 0 16px; grid-template-columns: 1fr auto; }
  .header .nav { display: none; }
  .user .who span { display: none; }
  .tabbar { position: fixed; z-index: 1500; bottom: calc(12px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 5px; border-radius: var(--pill); background: rgba(255,240,199,.8); border: 1px solid var(--amber-line); backdrop-filter: blur(14px) saturate(1.4); box-shadow: 0 10px 30px -12px rgba(180,83,9,.3); }
  .tabbar a { display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border-radius: var(--pill); color: var(--ink-2); font-size: 13px; font-weight: 600; text-decoration: none !important; }
  .tabbar a[aria-current="page"] { background: #fff; color: var(--ink); }
  .tabbar a[aria-current="page"] .icon { color: var(--amber-deep); }
  .tabbar a:not([aria-current="page"]) .label { display: none; }
  .page { padding: 16px 16px 100px; }
  .tabs { justify-self: stretch; }
  h1 { font-size: 20px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-inline-start: 0; border-top: 1px solid var(--line); }
  .stat:nth-child(-n+2) { border-top: 0; }
  .stat:nth-child(even) { border-inline-start: 1px solid var(--line); }
  .map { height: 300px; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Sales workflow ---------- */
.wf { display: flex; justify-content: flex-end; gap: 4px; margin-top: 6px; }
.btn-icon.is-on { background: var(--green-bg); color: var(--green); border-color: #ABEFC6; }
.btn-icon.is-star { background: var(--amber-soft); color: var(--amber-deep); border-color: var(--amber-line); }
.btn-icon.is-star .icon { fill: var(--amber); }
.lead.is-contacted { background: #F6FEF9; box-shadow: inset -3px 0 0 #32D583; }
.lead.is-contacted:hover { background: #EFFDF4; }
.lead.is-starred { box-shadow: inset -3px 0 0 var(--amber); }
.badge-contacted { background: var(--green-bg); color: var(--green); }
.badge-star { background: var(--amber-soft); color: var(--amber-deep); }
.lead-memo { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.is-on { border-color: var(--amber); background: var(--amber-soft); color: var(--amber-ink); }
.popover { position: absolute; z-index: 1400; min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: toast .15s var(--ease); }
.popover-title { padding: 6px 10px; color: var(--ink-3); font-size: 12px; font-weight: 700; }
.popover-item { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; text-align: start; font-weight: 600; cursor: pointer; }
.popover-item:hover { background: var(--amber-soft); }
.popover-item.is-on { background: var(--amber-soft); color: var(--amber-deep); }
.popover-item.danger { color: var(--red); }
.act-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; }
.act-list { display: grid; gap: 6px; }
.act-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 54px 48px 36px; gap: 8px; align-items: center; }
.act-row .input { height: 36px; }
.act-off { padding: 6px 0; color: var(--ink-3); grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 54px 0 auto; }
.act-removed summary { cursor: pointer; margin-top: 8px; font-weight: 700; color: var(--ink-2); }
.act-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.act-chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: var(--pill); background: var(--surface); color: var(--ink-2); font-weight: 700; font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s; }
.act-chip:hover { border-color: var(--amber-line); }
.act-chip b { min-width: 24px; height: 22px; padding: 0 7px; border-radius: var(--pill); background: var(--soft); color: var(--ink-3); font-size: 12px; line-height: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.act-chip[aria-pressed="true"] { border-color: var(--amber); background: var(--amber-soft); color: var(--amber-ink); }
.act-chip[aria-pressed="true"] b { background: var(--amber); color: var(--amber-ink); }
.act-chip.manage { border-style: dashed; padding: 0 12px; color: var(--ink-3); }
@media (max-width: 700px) { .act-add, .act-row { grid-template-columns: minmax(0, 1fr); } .act-row { padding-bottom: 8px; border-bottom: 1px solid var(--line); } }
.combo-manage { display: flex; align-items: center; gap: 8px; color: var(--amber-deep); font-weight: 700; }
.combo-list li:has(.combo-manage) { position: sticky; top: -4px; z-index: 1; margin: -4px -4px 4px; padding: 10px 14px; border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--amber-soft); border-bottom: 1px solid var(--amber-line); }
.combo-list li:has(.combo-manage)[aria-selected="true"], .combo-list li:has(.combo-manage):hover { background: #FFEFC7; }

/* ---------- Export / rules dialogs ---------- */
.exp-section { display: grid; gap: 8px; }
.exp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.exp-card { display: grid; gap: 2px; align-content: start; padding: 14px 16px; text-align: start; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.exp-card:hover:not(:disabled) { border-color: var(--line-2); }
.exp-card[aria-pressed="true"] { border-color: var(--amber); background: var(--amber-soft); box-shadow: 0 0 0 1px var(--amber); }
.exp-card:disabled { opacity: .5; cursor: not-allowed; }
.exp-count { font-size: 22px; font-weight: 700; color: var(--ink); }
.exp-options { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--bg); border: 1px solid var(--line); }
.modal-foot { align-items: center; }
.modal-foot .spacer { flex: 1; }
.modal-tabs { justify-self: center; }
.rule-list { display: grid; gap: 8px; }
.rule-list.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rule-list .span { grid-column: 1 / -1; }
.rule-total { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 4px 0 2px; color: var(--ink-3); }
.rule-total b { font-size: 26px; color: var(--ink); }
.seg-card { display: grid; grid-template-columns: 8px minmax(0, 1fr); align-content: start; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.seg-card strong { font-size: 14px; }
.seg-card i { grid-row: span 2; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; }
.seg-card p { color: var(--ink-3); font-size: 12.5px; line-height: 1.6; }
.hint { color: var(--ink-3); font-size: 12.5px; }
@media (max-width: 700px) { .exp-grid, .rule-list.cols { grid-template-columns: minmax(0, 1fr); } }
.modal:has(.modal-sub .tabs) { height: min(680px, calc(100vh - 48px)); }
.modal:has(.modal-sub .tabs) .modal-body { flex: 1; }
.outcome-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.outcome-grid .chip { justify-content: center; height: 36px; padding: 0 2px; font-size: 12px; white-space: nowrap; }
@media (max-width: 700px) { .outcome-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.badge-outcome-INTERESTED, .badge-outcome-CLOSED_WON { background: var(--green-bg); color: var(--green); }
.badge-outcome-NOT_INTERESTED, .badge-outcome-DO_NOT_CONTACT { background: var(--red-bg); color: var(--red); }
.badge-outcome-NO_ANSWER { background: var(--orange-bg); color: var(--orange); }
.badge-outcome-ALREADY_HAS_SOLUTION { background: var(--blue-bg); color: var(--blue); }
.badge-outcome-WRONG_LEAD, .badge-outcome-CLOSED_LOST { background: var(--gray-bg); color: var(--gray); }
.lead-memo .icon { color: var(--amber-deep); flex: none; }
/* ---------- Lead window ---------- */
.lead-modal { width: min(820px, calc(100vw - 32px)); height: min(720px, calc(100vh - 48px)); }
.lm-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.lm-score { display: grid; place-items: center; align-content: center; width: 64px; height: 64px; border-radius: 16px; background: var(--soft); color: var(--ink-2); }
.lm-score b { font-size: 24px; line-height: 1; }
.lm-score span { font-size: 11px; color: inherit; opacity: .75; }
.lm-score.hot { background: var(--red-bg); color: var(--red); }
.lm-score.high { background: var(--orange-bg); color: var(--orange); }
.lm-score.warm { background: var(--blue-bg); color: var(--blue); }
.lm-score.ignore { background: var(--gray-bg); color: var(--ink-3); }
.lm-title { display: grid; gap: 6px; min-width: 0; }
.lm-title h2 { font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-title .row { gap: 6px; }
.lm-title .badge .icon { width: 12px; height: 12px; }
.lm-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.lm-bar .btn.is-on { background: var(--green-bg); color: var(--green); border-color: #ABEFC6; }
.lm-stage { width: auto; min-width: 170px; }
.lm-tabs { display: grid; justify-items: center; padding: 12px 20px 0; }
.lm-tabs .tabs { padding: 4px; }
.lm-tabs .tab { height: 34px; padding: 0 16px; font-size: 13.5px; }
.lm-body { flex: 1; overflow: auto; padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.lm-body > * { flex-shrink: 0; }
.lm-verdict { display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid; }
.lm-verdict strong { font-size: 15px; }
.lm-verdict p { font-size: 13.5px; line-height: 1.7; }
.lm-verdict.tone-success { background: var(--green-bg); border-color: #ABEFC6; color: var(--green); }
.lm-verdict.tone-success p, .lm-verdict.tone-warning p, .lm-verdict.tone-danger p, .lm-verdict.tone-info p { color: var(--ink-2); }
.lm-verdict.tone-warning { background: var(--orange-bg); border-color: #FEDF89; color: var(--orange); }
.lm-verdict.tone-danger { background: var(--red-bg); border-color: #FECDCA; color: var(--red); }
.lm-verdict.tone-info { background: var(--blue-bg); border-color: #B2DDFF; color: var(--blue); }
.lm-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.lm-fact { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.lm-fact span { color: var(--ink-3); font-size: 12px; }
.lm-fact strong { font-size: 14px; }
.lm-address { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13.5px; }
.lm-address .icon { color: var(--ink-4); flex: none; }
.lm-section { display: grid; gap: 8px; }
.lm-section h3 { font-size: 13px; color: var(--ink-3); }
.lm-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.lm-check { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r); background: var(--soft); color: var(--ink-3); font-size: 13px; }
.lm-check b { margin-inline-start: auto; }
.lm-check.met { background: var(--green-bg); color: var(--green); }
.lm-check.met span { color: var(--ink); }
.lm-reasons { display: grid; gap: 8px; }
.lm-reasons .crit-row { grid-template-columns: 20px minmax(0, 1fr) auto; }
.lm-reasons .crit-row .icon { color: var(--ink-4); }
.lm-reasons .crit-row.met .icon { color: var(--green); }
.timeline { margin: 0; padding: 0 16px 0 0; list-style: none; display: grid; gap: 12px; border-inline-start: 2px solid var(--line); }
.timeline li { position: relative; display: grid; gap: 4px; padding-inline-start: 14px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -7px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--amber); border: 2px solid var(--surface); }
.timeline p { font-size: 14px; color: var(--ink-2); }
@media (max-width: 700px) {
  .lead-modal { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; top: 0; left: 0; transform: none; animation: fade .2s; }
  .lm-head { grid-template-columns: auto minmax(0, 1fr) auto; padding: 14px 16px; }
  .lm-score { width: 52px; height: 52px; }
  .lm-title h2 { white-space: normal; font-size: 17px; }
  .lm-bar { padding: 10px 16px; }
  .lm-bar .row { width: 100%; }
  .lm-bar .row > * { flex: 1; }
  .lm-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lm-checks { grid-template-columns: minmax(0, 1fr); }
  .lm-body { padding: 14px 16px; }
}
