/* Tahavolyar design system: navy and white. Status colors are functional only. */
/* Licensed fonts are loaded by app.js after sign-in. */

:root {
  --bg: #f3f5fb; --card: #fff; --field: #f5f7fc; --tint: #e8edf9; --subtle: #eaeefa;
  --heading: #0f1f4d; --text: #1a1818; --secondary: #3c4766; --muted: #556080;
  --line: #dde3f1; --line-strong: #7c86a3; --track: #dfe5f5;
  --primary: #20409a; --primary-hover: #1a3378; --on-primary: #fff;
  --accent: #a9bdf5; --accent-strong: #5b7be0; --on-accent: #0f1f4d;
  --side: #20409a; --on-side: #fff;
  --ok: #1d6b3f; --ok-bg: #e2f4ec; --warn: #8a5300; --warn-bg: #fbf0da; --danger: #b3261e; --danger-bg: #fbe9e7;
  --shadow: 0 1px 2px rgba(15,31,77,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1330; --card: #16224a; --field: #101a3b; --tint: #1a2752; --subtle: #1c2a5c;
    --heading: #eef2ff; --text: #e6e9f5; --secondary: #c3cbe4; --muted: #9aa6c9;
    --line: #2a3868; --line-strong: #6f7db0; --track: #2a3868;
    --primary: #8ea6ee; --primary-hover: #a9bdf5; --on-primary: #0b1330; --side: #101a3b;
    --ok: #6fd39a; --ok-bg: #12352a; --warn: #f2c063; --warn-bg: #3a2c0e; --danger: #ff9a92; --danger-bg: #3d1a1d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1330; --card: #16224a; --field: #101a3b; --tint: #1a2752; --subtle: #1c2a5c;
  --heading: #eef2ff; --text: #e6e9f5; --secondary: #c3cbe4; --muted: #9aa6c9;
  --line: #2a3868; --line-strong: #6f7db0; --track: #2a3868;
  --primary: #8ea6ee; --primary-hover: #a9bdf5; --on-primary: #0b1330; --side: #101a3b;
  --ok: #6fd39a; --ok-bg: #12352a; --warn: #f2c063; --warn-bg: #3a2c0e; --danger: #ff9a92; --danger-bg: #3d1a1d;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* layout classes must not reveal hidden parts */
body { margin: 0; display: flex; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 15px/26px IRANSansX, Tahoma, sans-serif; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { color: var(--heading); font-family: Dana, IRANSansX, Tahoma, sans-serif; margin: 0; }
h1 { font-size: 28px; line-height: 42px; font-weight: 700; }
h2 { font-size: 20px; line-height: 32px; font-weight: 600; margin: 28px 0 10px; }
h3 { font-size: 17px; line-height: 28px; font-weight: 600; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- navigation ---------- */
nav { width: 230px; flex: none; background: var(--side); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 4px 8px 20px; }
.brand img { display: block; width: 100%; max-width: 170px; height: auto; }
nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border-radius: 10px; color: var(--on-side); font-weight: 500; font-size: 14px; }
nav a:hover { background: rgba(255,255,255,.1); }
nav a[aria-current] { background: var(--accent); color: var(--on-accent); }
.spacer { flex: 1; }
#shell { flex: 1; min-width: 0; }
header { display: flex; gap: 12px; padding: 12px 32px; border-bottom: 1px solid var(--line); background: var(--card); }
#search { flex: 1; max-width: 560px; }
header #quick { margin-inline-start: auto; }
main { padding: 24px 32px 64px; max-width: 1240px; }

/* ---------- controls ---------- */
input, select, textarea, button, .button { font: 500 14px/22px IRANSansX, Tahoma, sans-serif; color: var(--text); }
input, select, textarea { width: 100%; background: var(--field); border: 1px solid var(--line-strong); border-radius: 6px; padding: 9px 12px; min-height: 42px; font-weight: 400; }
textarea { min-height: 44px; resize: vertical; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 14px;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; white-space: nowrap; }
button:hover, .button:hover { background: var(--subtle); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
button.primary:hover { background: var(--primary-hover); }
button.danger { color: var(--danger); }
.button.small { min-height: 34px; padding: 4px 10px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.bar, .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bar { margin-bottom: 16px; }
.bar h1 { flex: 1; }
.bar input, .bar select { width: auto; min-width: 180px; }
.between { justify-content: space-between; }
.tabs-switch { display: inline-flex; gap: 4px; background: var(--tint); padding: 4px; border-radius: 10px; }
.tab { display: inline-flex; align-items: center; min-height: 34px; padding: 4px 14px; border: 0; border-radius: 8px; background: none; color: var(--secondary); }
.tab.active { background: var(--primary); color: var(--on-primary); }

/* ---------- surfaces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; box-shadow: var(--shadow); }
div.card + div.card { margin-top: 16px; }
.muted { color: var(--muted); }
.table { overflow-x: auto; padding: 4px 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--subtle); }
th { color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
ul.plain { list-style: none; margin: 0; }
ul.plain li { padding: 10px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }
.badge { display: inline-block; border-radius: 999px; padding: 0 10px; font-size: 12px; line-height: 22px; font-weight: 500; background: var(--tint); color: var(--secondary); white-space: nowrap; }
.badge.warn, .s2 { background: var(--warn-bg); color: var(--warn); }
.badge.danger, .s3 { background: var(--danger-bg); color: var(--danger); }
.s1 { background: var(--tint); color: var(--secondary); }
.stage-won { background: var(--ok-bg); color: var(--ok); }
.stage-lost { background: var(--danger-bg); color: var(--danger); }
.stage-paused { background: var(--warn-bg); color: var(--warn); }

/* ---------- call queue ---------- */
.call { margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.call p { margin: 0; }
.call.done { background: var(--field); }
.call.saving { opacity: .6; pointer-events: none; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.next { color: var(--heading); font-weight: 500; }
.phones { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
@media (min-width: 761px) {
  /* In the table the messengers are icons; their names stay for screen readers. */
  .caselist .phones { flex-wrap: nowrap; }
  .caselist .phones .whatsapp span, .caselist .phones .telegram span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .caselist .phones .whatsapp, .caselist .phones .telegram { position: relative; min-width: 34px; justify-content: center; }
}
@media (max-width: 760px) {
  /* The name of a case is as easy to touch as a button. */
  .call h3 a, .caselist td:first-child a, .table td:first-child > a { display: inline-flex; align-items: center; min-height: 44px; }
}
details.callgroup > article, details.callgroup > button { margin-top: 6px; }
.results button { min-height: 44px; }
.panel { display: flex; flex-direction: column; gap: 10px; background: var(--tint); border-radius: 10px; padding: 12px 16px; }
.inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.progress-card { display: flex; flex-direction: column; gap: 8px; }
.progress, .track { height: 10px; background: var(--track); border-radius: 999px; overflow: hidden; }
.progress span, .track i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }
.quicklog { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
div.stats .card + .card { margin-top: 0; }
.kpi { display: flex; flex-direction: column; }
.kpi strong { font: 700 36px/48px "Yekan Bakh FaNum", IRANSansX, sans-serif; color: var(--heading); }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.warn { background: var(--warn-bg); border-color: var(--warn); }
.kpi.warn * { color: var(--warn); }
.funnel { display: grid; grid-template-columns: 110px 1fr 110px; gap: 12px; align-items: center; padding: 6px 0; }
.num { font-variant-numeric: tabular-nums; color: var(--secondary); }
.alerts li::marker { content: none; }
.owner { display: grid; grid-template-columns: 90px 1fr; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.owner > span { grid-column: 2; font-size: 13px; }
.stack { display: flex; gap: 2px; height: 16px; border-radius: 6px; overflow: hidden; }
.seg-following { background: var(--primary); } .seg-waiting { background: #3a58b4; }
.seg-paused { background: var(--accent); } .seg-closed { background: var(--line-strong); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; }
.late { color: var(--danger); }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: 240px; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.column { background: var(--tint); border-radius: 16px; padding: 12px; }
.column h2 { font-size: 14px; line-height: 24px; margin: 0 0 8px; }
.deal { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; }
.deal select { margin-top: 8px; font-size: 12px; min-height: 34px; padding: 4px 8px; }
.column.over { outline: 2px dashed var(--primary); }
.deal.dragging { opacity: .45; }
.deal.fixed { cursor: default; }
.badge.referred { background: var(--primary); color: var(--on-primary); }
/* actions: one list for every kind */
.actionlist .action { display: flex; align-items: flex-start; gap: 12px; }
.actionlist .badge { flex: none; min-width: 74px; text-align: center; }
.actionlist .what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.actionlist .what small { display: block; }
.actionlist .late small { color: var(--danger); }
.actionlist .action { flex-wrap: wrap; }
.actionlist .what { flex-basis: 200px; }
.actionlist .tools { display: flex; flex-wrap: wrap; gap: 8px; margin-inline-start: auto; }
.actionlist .pick { display: grid; place-items: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.actionlist .pick input { width: 20px; height: 20px; min-height: 0; margin: 0; }
.selectbar { position: sticky; top: 0; z-index: 2; margin-bottom: 8px; }
.selectbar[hidden] { display: none; }
.actionlist .done { flex: none; min-height: 34px; padding: 4px 12px; font-size: 13px; }
.ev-note { background: var(--subtle); color: var(--text); }
.choice.kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice.kinds button { flex-direction: column; white-space: normal; min-height: 60px; }
.deal.saving { opacity: .6; cursor: progress; }
.deal .advance { display: block; width: 100%; margin-top: 8px; font-size: 12px; min-height: 30px; padding: 2px 10px; }
/* With a mouse the button shows on the card in use; on touch screens always. */
@media (hover: hover) {
  .deal .advance { opacity: 0; height: 0; min-height: 0; margin: 0; padding-block: 0; border: 0; overflow: hidden; }
  .deal:hover .advance, .deal:focus-within .advance { opacity: 1; height: auto; min-height: 30px; margin-top: 8px; padding-block: 2px; border: 1px solid var(--line-strong); }
}

/* ---------- records, forms, dialogs ---------- */
dl { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 8px 20px; margin: 0; }
dt { color: var(--muted); } dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
dialog { width: min(640px, 94vw); max-height: 90vh; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text); padding: 24px; box-shadow: 0 12px 32px rgba(15,31,77,.16); }
dialog::backdrop { background: rgba(15,31,77,.5); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 16px 0; }
.form label { display: block; }
.form .wide { grid-column: 1 / -1; }
.form input[type=checkbox], .checks input { width: auto; min-height: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.actions { margin-top: 14px; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.choices button { flex-direction: column; min-height: 88px; white-space: normal; }
.choices strong { font-size: 16px; } .choices small { color: var(--muted); font-weight: 400; }
summary { cursor: pointer; color: var(--primary); min-height: 32px; }
.answer { white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant { margin-top: 16px; }
.assistant .bar { margin: 0; }
.datebox { display: flex; flex-wrap: wrap; gap: 6px; }
.datebox select { flex: 1; width: auto; min-width: 72px; max-width: 180px; padding-inline: 8px; }
.datebox input { width: auto; }
.shortcuts { margin-top: 6px; }
.shortcuts button { font-size: 12px; min-height: 32px; padding: 2px 10px; }
.error { color: var(--danger); }
#toast { position: fixed; inset-inline-start: 20px; bottom: 20px; display: none; gap: 12px; align-items: center; background: #0f1f4d; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 5; box-shadow: 0 12px 32px rgba(15,31,77,.16); }
#toast.show { display: flex; }
nav a.phone-only { display: none; }
#toast button { min-height: 34px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
#tabs { display: none; }

/* ---------- assistant conversation ---------- */
.thread { display: flex; flex-direction: column; gap: 12px; max-height: 55vh; overflow-y: auto; }
.thread p { margin: 4px 0; }
.msg { border-radius: 14px; padding: 10px 14px; max-width: min(85%, 720px); }
.msg.me { align-self: flex-start; background: var(--tint); }
.msg.bot { background: var(--field); border: 1px solid var(--line); }
.thread > .msg.bot, .thread > div:not(.msg) { align-self: flex-end; }
.thread > div:not(.msg) > .msg { max-width: 720px; }
.askform { margin-top: 16px; }

/* ---------- calendar ---------- */
.calhead { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.calhead select { width: auto; flex: 1; max-width: 150px; }
.calhead button { min-width: 42px; }
.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekday { text-align: center; color: var(--muted); font-size: 12px; }
.weekday.off, .day.off b { color: var(--danger); }
.day { flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 2px; min-width: 0; min-height: 84px; padding: 4px; border-color: var(--line); background: var(--card); overflow: hidden; }
.day b { font-weight: 600; text-align: start; }
.day.past { background: var(--field); }
.day.today { border: 2px solid var(--primary); }
.day.today b { align-self: flex-start; background: var(--primary); color: var(--on-primary); border-radius: 999px; min-width: 26px; text-align: center; }
.day[aria-pressed="true"] { background: var(--tint); box-shadow: inset 0 0 0 2px var(--accent-strong); }
.marks { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.marks i { font-style: normal; font-size: 12px; line-height: 17px; border-radius: 4px; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; text-align: start; }
.marks em { font-style: normal; font-size: 12px; color: var(--muted); }
.ev-case { background: var(--tint); color: var(--secondary); }
.ev-task { background: var(--ok-bg); color: var(--ok); }
.ev-follow { background: var(--warn-bg); color: var(--warn); }
.ev-meeting { background: var(--primary); color: var(--on-primary); }
.calcard .legend i { width: 14px; }
.agenda { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.calcard + div, .lateBox + .calcard, .calcard ~ div .card { margin-top: 16px; }
.lateBox { margin-bottom: 16px; }
.google { margin-top: 16px; }
.google ol { margin: 12px 0 0; padding-inline-start: 20px; }
.datepick { display: flex; flex-direction: column; gap: 4px; }
.datevalue { flex: 1; justify-content: flex-start; }
.cal.compact { max-width: 340px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-top: 4px; }
.cal.compact .day { min-height: 36px; padding: 0; align-items: center; justify-content: center; }
.cal.compact .day b { text-align: center; }
.cal.compact .calhead button { min-height: 34px; padding: 2px 8px; }
.cal.compact .calhead select { min-height: 34px; padding: 2px 6px; }

/* ---------- linked choices ---------- */
.picker { display: flex; flex-direction: column; gap: 6px; }
.picker button.small { align-self: flex-start; min-height: 32px; padding: 2px 10px; font-size: 12px; }
.volume { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.exact { display: flex; gap: 6px; }
.exact input { width: 130px; min-height: 36px; padding-block: 4px; }
.exact button { min-height: 36px; padding-block: 4px; }

/* ---------- accounts ---------- */
#who { margin-inline-start: auto; }
#who + #theme + #quick { margin-inline-start: 0; }
#theme { flex: none; width: 42px; padding: 0; }
.stackform { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.stackform .bar { margin: 0; }
label.field { display: flex; flex-direction: column; gap: 4px; }
.toggle { display: flex; align-items: center; gap: 8px; }
.toggle input { width: 18px; height: 18px; min-height: 0; }
.login { max-width: 420px; margin: 8vh auto 0; }
body.signed-out nav, body.signed-out header, body.signed-out #tabs { display: none; }
body.signed-out main { margin-inline: auto; width: 100%; }
.user { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
div.card.user + div.card { margin-top: 16px; }
.user p { margin: 0; }
.linkbox { overflow-wrap: anywhere; background: var(--field); border-radius: 8px; padding: 10px 12px; }
.tabs-switch button.tab { min-height: 34px; }
.tabs-switch button.tab.active:hover { background: var(--primary-hover); }

@media (max-width: 760px) {
  body { flex-direction: column; }
  nav { display: none; }
  nav.open { display: flex; position: fixed; inset: 0 0 64px 0; width: auto; height: auto; z-index: 3; }
  nav a.phone-only { display: flex; }
  header, main { padding-inline: 16px; }
  header #quick { display: none; }
  #who span { display: none; }
  #who { width: 42px; padding: 0; }
  h1 { font-size: 22px; line-height: 34px; }
  main { padding-bottom: 110px; }
  #tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; position: fixed; inset: auto 0 0 0;
    height: calc(64px + env(safe-area-inset-bottom)); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--card); border-top: 1px solid var(--line); z-index: 4; }
  #tabs a, #tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; border: 0; border-radius: 10px; padding: 0; background: none; color: var(--secondary); font-size: 12px; line-height: 16px; }
  #tabs a[aria-current] { background: var(--subtle); color: var(--primary); }
  #tabs button.primary { background: var(--primary); color: var(--on-primary); }
  #toast { bottom: 80px; }
  .card { padding: 16px; }
  .form { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }
  .bar input, .bar select { flex: 1; min-width: 140px; }
  .results button { flex: 1 1 44%; }
  .choices { grid-template-columns: 1fr; }
  .funnel { grid-template-columns: 90px 1fr 84px; gap: 8px; font-size: 13px; }
  .owner { grid-template-columns: 1fr; } .owner > span { grid-column: 1; }
  /* On a phone the calendar shows a count instead of titles. */
  .day { min-height: 48px; align-items: center; }
  .day b { text-align: center; }
  .marks i { display: none; }
  .marks em { background: var(--primary); color: var(--on-primary); border-radius: 999px; min-width: 18px; text-align: center; line-height: 18px; }
  .calcard { padding: 10px; }
  .calhead { flex-wrap: wrap; }
  /* Tables become cards. */
  .table { background: none; border: 0; padding: 0; box-shadow: none; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px 14px; margin-bottom: 8px; }
  td { border: 0; padding: 3px 0; }
  td[data-label]:not([data-label=""])::before { content: attr(data-label) ": "; color: var(--muted); }
}

/* ---------- supplied design: menu ---------- */
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.brand span { padding: 2px 10px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 700 12px/20px IRANSansX, Tahoma, sans-serif; }
nav a b { margin-inline-start: auto; min-width: 24px; padding: 0 7px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 12px; line-height: 20px; text-align: center; }
nav a:last-child { border-top: 1px solid rgba(255,255,255,.18); border-radius: 0 0 10px 10px; }
main { max-width: 1360px; }

/* ---------- supplied design: today ---------- */
.eyebrow { color: var(--primary); font: 700 12px/18px IRANSansX, Tahoma, sans-serif; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.pagehead p { margin: 0; color: var(--secondary); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills button { border-radius: 999px; min-height: 40px; padding: 0 16px; }
.pills button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.progress-card { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px; padding-block: 16px; margin-bottom: 24px; }
.progress-card strong { color: var(--heading); font-weight: 600; }
.progress-card .progress { flex: 1 1 240px; height: 8px; }
.progress-card .progress span { background: var(--ok); }
.columns { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.columns > .main { flex: 3 1 520px; min-width: 0; }
.columns > aside { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
div.columns .card + .card { margin-top: 0; }
article.call { margin-bottom: 12px; gap: 12px; }
.call h3 a { color: var(--heading); }
.call .who { color: var(--secondary); font-size: 14px; }
.callbtn { min-height: 44px; padding: 0 20px; background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.button.callbtn:hover { background: var(--primary-hover); }
.lastnote { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--bg); color: var(--secondary); font-size: 14px; line-height: 22px; }
.lastnote .icon { width: 16px; height: 16px; margin-top: 3px; color: var(--muted); }
.results button small { color: var(--muted); font-size: 12px; font-weight: 400; }
aside .voice { background: var(--side); border-color: var(--side); color: #fff; display: flex; flex-direction: column; gap: 12px; }
aside .voice h3 { color: #fff; }
aside .voice p { margin: 0; color: #d9e1f8; font-size: 14px; line-height: 24px; }
.voice > span { align-self: flex-start; padding: 2px 12px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 12px; }
aside .help p { margin: 0 0 6px; color: var(--secondary); font-size: 14px; line-height: 24px; }

/* ---------- supplied design: dashboard ---------- */
.products { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.products button { border: 2px solid transparent; background: #fff; color: #20409a; min-height: 40px; }
.products button[aria-pressed="true"] { border-color: #20409a; background: #eaeefa; }
.products img { display: block; height: 24px; width: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
div.kpis .card + .card { margin-top: 0; }
.kpi { gap: 4px; padding: 20px; }
.kpi > span { color: var(--muted); font-size: 12px; }
.kpi .progress { height: 6px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; margin-bottom: 24px; }
div.grid2 > .card + .card { margin-top: 0; }
.card > header, .cardhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; padding: 0; border: 0; background: none; }
.card h2 { margin: 0 0 12px; }
.cardhead h2 { margin: 0; }
.funnel { grid-template-columns: 130px 1fr 110px; }
.funnel .track { height: 28px; border-radius: 8px; background: var(--bg); }
.funnel .track i { border-radius: 8px; }
.funnel:nth-of-type(n+4) .track i { background: var(--accent-strong); }
.bottleneck { margin: 16px 0 0; padding: 12px 16px; border-radius: 10px; background: var(--subtle); font-size: 14px; }
.decisions { display: flex; flex-direction: column; gap: 12px; }
/* every number opens the cases behind it */
button.drill { font: inherit; color: inherit; text-align: start; white-space: normal; cursor: pointer; }
button.kpi.drill { align-items: stretch; justify-content: flex-start; }
button.funnel.drill, button.source.drill, button.owner.drill { width: 100%; border: 0; background: transparent; border-radius: 10px; }
button.source.drill { display: block; padding: 0; }
button.decision.drill { display: block; border: 0; width: 100%; }
button.decision.drill:not(.warn) { background: var(--bg); }
.drill:hover { outline: 2px solid var(--accent-strong); outline-offset: -2px; }
.drilllist li { display: flex; justify-content: space-between; gap: 12px; }
/* my performance */
.viewer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; border-style: dashed; background: var(--tint); }
.goal { margin-bottom: 14px; }
.goal .progress { height: 8px; margin-top: 4px; }
.up { color: var(--ok); } .down { color: var(--danger); }
.grid2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid2.even { grid-template-columns: 1fr; } }
.hotlist li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.decision { padding: 12px 16px; border-radius: 10px; background: var(--bg); }
.decision.warn { background: var(--warn-bg); color: var(--warn); }
.decision strong { display: block; font-size: 14px; }
.decision small { font-size: 12px; opacity: .85; }
.owner { grid-template-columns: 110px 1fr 70px; border: 0; }
.owner > span { grid-column: auto; text-align: center; font-size: 12px; }
.owner > span b { display: block; font: 700 18px/26px "Yekan Bakh FaNum", IRANSansX, sans-serif; color: var(--heading); }
.owner div small { display: block; color: var(--muted); font-size: 12px; }
.stack { height: 28px; }
.stack i { display: flex; align-items: center; justify-content: center; min-width: 6px; color: #fff; font: 700 12px/1 IRANSansX, sans-serif; font-style: normal; }
.seg-following { background: #20409a; } .seg-waiting { background: #3a58b4; } .seg-referral { background: #a9bdf5; }
.seg-nophone { background: #e8c98a; } .seg-closed { background: #dfe5f5; }
.stack .seg-referral, .stack .seg-nophone, .stack .seg-closed { color: #0f1f4d; }
.source { margin-bottom: 14px; }
.source > div:first-child { display: flex; justify-content: space-between; font-size: 14px; }
.source .progress { height: 8px; }
.hot .table { box-shadow: none; border: 0; padding: 0; }
@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .funnel { grid-template-columns: 96px 1fr 92px; }
  .owner { grid-template-columns: 1fr; }
  .progress-card .progress { flex-basis: 100%; }
}

/* ---------- short forms and case page ---------- */
dialog h2 { margin: 0; }
.composer { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.composer.compact { margin-top: 0; }
.composer.compact > :not(.results) { display: none; }
.composer.saving { opacity: .6; pointer-events: none; }
.composer [hidden] { display: none; }
.field { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice button { min-height: 44px; }
.choice button small { color: var(--muted); font-size: 12px; font-weight: 400; }
.choice button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.choice button[aria-pressed="true"] small { color: var(--on-primary); }
.casehead { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.casehead .who { color: var(--secondary); }
.casehead details > .eval { margin-top: 14px; }
.stagebar { display: flex; flex-wrap: wrap; gap: 4px; }
.stagebar button { flex: 1 1 90px; border-radius: 6px; background: var(--field); border-color: var(--line); }
.stagebar button.passed { background: var(--tint); color: var(--primary); }
.stagebar button.side { flex: 0 0 auto; background: none; border-style: dashed; }
.stagebar button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.eval { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; }
.eval > span { color: var(--muted); font-size: 14px; }
.eval .choice button { min-height: 36px; padding: 4px 12px; }
details.card, details.more { margin-top: 16px; }
details.more > .row, details.more > .card { margin-top: 12px; }
@media (max-width: 760px) { .eval { grid-template-columns: 1fr; gap: 4px; } .choice.results button { flex: 1 1 44%; } }

/* ---------- today's actions ---------- */
details.works { margin-bottom: 12px; }
details.works > summary { color: var(--heading); font: 600 17px/28px Dana, IRANSansX, Tahoma, sans-serif; padding-block: 6px; }
details.works > ul { margin-top: 6px; }

/* ---------- phone: the first call in sight, and nothing too small to tap ---------- */
@media (max-width: 760px) {
  .today .pagehead p { display: none; }
  .today .pagehead { margin-bottom: 8px; gap: 8px; }
  .today .progress-card { padding-block: 10px; margin-bottom: 8px; }
  button, .button, .button.small, .tab, select, textarea, input:not([type="checkbox"]):not([type="radio"]),
  .actionlist .done, .shortcuts button, .eval .choice button, .deal select, .deal .advance, #toast button,
  .cal.compact .day, .cal.compact .calhead button, .cal.compact .calhead select,
  .tabs-switch button.tab, .pills button, .products button { min-height: 44px; }
  summary { min-height: 44px; line-height: 32px; padding-block: 6px; }
}
@media (max-width: 760px) and (hover: hover) {
  .deal:not(:hover):not(:focus-within) .advance { min-height: 0; }
}

/* ---------- funnel conversion ---------- */
.funnel .num small { display: block; font-size: 12px; line-height: 18px; color: var(--muted); }
.funnel.worst .num small { color: var(--warn); font-weight: 700; }

/* ---------- table of cases ---------- */
th button.sort { min-height: 34px; padding: 2px 6px; border: 0; background: none; color: inherit; font: inherit; }
th[aria-sort] button.sort { color: var(--heading); font-weight: 700; }
.sortselect { display: block; }
@media (max-width: 760px) {
  .bar select.sortselect { display: block; }
  .caselist tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center;
    grid-template-areas: "title stage" "person owner" "next next" "phone phone" "last last"; }
  .caselist td { padding-block: 1px; }
  .caselist td:nth-child(1) { grid-area: title; font-weight: 700; }
  .caselist td:nth-child(2) { grid-area: person; color: var(--secondary); }
  .caselist td:nth-child(3) { grid-area: phone; }
  .caselist td:nth-child(4) { grid-area: owner; color: var(--muted); }
  .caselist td:nth-child(5) { grid-area: stage; justify-self: end; }
  .caselist td:nth-child(6) { grid-area: last; display: none; font-size: 12px; color: var(--muted); }
  .caselist.by-last td:nth-child(6):not(.blank) { display: block; }
  .caselist td:nth-child(7) { grid-area: next; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .caselist td:nth-child(-n+5)::before { content: none !important; }
  /* Empty values take no room on a phone. */
  .caselist td.blank:nth-child(n), td.blank { display: none; }
}

/* ---------- accessibility ---------- */
#skip { position: fixed; inset-inline-start: 8px; top: -80px; z-index: 10; padding: 10px 16px; border-radius: 10px; background: var(--card); border: 2px solid var(--primary); }
#skip:focus { top: 8px; }
#view:focus { outline: none; }
body.signed-out #skip { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- team conversation on a case ---------- */
.teamtalk { margin-top: 16px; }
.teamtalk h2 { margin-top: 0; }
.comment { display: flex; gap: 10px; margin-bottom: 10px; }
.comment .avatar { flex: none; width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 13px; }
.comment .bubble { flex: 1; min-width: 0; background: var(--tint); border-radius: 4px 14px 14px; padding: 8px 14px; }
.comment .bubble p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment.gone { padding-inline-start: 46px; font-size: 13px; }
.mention { color: var(--primary); font-weight: 700; }
.replies { margin-inline-start: 46px; }
.commentactions button { min-height: 34px; padding: 2px 10px; border: 0; background: none; color: var(--primary); font-size: 13px; }
.commentform { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.mentionoffers:empty { display: none; }
@media (max-width: 760px) {
  .replies { margin-inline-start: 18px; }
  .commentactions button { min-height: 44px; }
}

/* ---------- notifications ---------- */
#bell { position: relative; width: 42px; padding: 0; flex: none; }
#bell b { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 20px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: var(--card); font-size: 12px; line-height: 20px; }
button.notice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; border: 0; border-radius: 10px; white-space: normal; text-align: start; padding: 10px 12px; }
button.notice.unread { background: var(--tint); }
button.notice strong { font-weight: 500; }
button.notice.unread strong { font-weight: 700; color: var(--heading); }
.comment.wanted .bubble { outline: 2px solid var(--primary); }
@media (max-width: 760px) { #bell { width: 44px; } header { gap: 8px; } }

.checkline { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.checkline input { width: 20px; height: 20px; min-height: 0; flex: none; }

.viewer .overview { border-radius: 999px; border-color: var(--primary); color: var(--primary); }

/* ---------- today: the filters take one row each ---------- */
.pills.urgency { margin-bottom: 12px; }
@media (max-width: 760px) {
  .today .pills { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
  .today .pills button { flex: none; }
  .today .pagehead > * { min-width: 0; max-width: 100%; }
  .pills.urgency { margin-bottom: 8px; }
}

/* ---------- call, WhatsApp and Telegram ---------- */
.callactions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.callactions .button { min-height: 44px; }

.badge.event { background: var(--accent); color: var(--on-accent); margin-inline-start: 4px; white-space: normal; }
@media (max-width: 760px) { .today .pills.urgency button { padding-inline: 10px; font-size: 13px; } }

/* ---------- every number of a case ---------- */
ul.numbers li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; }
ul.numbers .button { min-height: 44px; }
ul.numbers .muted { flex-basis: 100%; font-size: 13px; overflow-wrap: anywhere; }
ul.numbers { padding: 0; }
@media (max-width: 760px) { ul.numbers .button { padding-inline: 10px; font-size: 13px; gap: 4px; } }

/* ---------- manager or salesperson ---------- */
#mode { margin: 0 0 0 0; margin-inline-start: auto; flex: none; flex-wrap: nowrap; }
#mode + #who { margin-inline-start: 0; }
#mode button { white-space: nowrap; }
@media (min-width: 761px) {
  header:has(#mode) { flex-wrap: wrap; }
  header:has(#mode) #search { flex: 1 1 220px; }
}
@media (max-width: 760px) {
  header:has(#mode) { flex-wrap: wrap; height: auto; }
  #mode { order: 9; flex-basis: 100%; margin: 0; }
  #mode button { flex: 1; min-height: 44px; }
}
