@font-face {
  font-family: Vazirmatn;
  src: url('Vazirmatn-wght.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: Estedad;
  src: url('Estedad-wght.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: light;
  --porcelain: #f2eff6;
  --plum: #302345;
  --coral: #eca088;
  --surface: color-mix(in srgb, var(--porcelain) 26%, #fff);
  --ink: color-mix(in srgb, var(--plum) 78%, #000);
  --muted: color-mix(in srgb, var(--plum) 71%, var(--porcelain));
  --line: color-mix(in srgb, var(--plum) 13%, var(--porcelain));
  --plum-soft: color-mix(in srgb, var(--plum) 8%, var(--porcelain));
  --plum-card: color-mix(in srgb, var(--plum) 90%, var(--porcelain));
  --coral-soft: color-mix(in srgb, var(--coral) 23%, var(--surface));
  --coral-deep: color-mix(in srgb, var(--coral) 43%, var(--ink));
  --shadow: 0 2px 3px rgb(48 35 69 / .025), 0 6px 15px rgb(48 35 69 / .025);
  --radius: 16px;
  --rail: 204px;
  --navbar: 62px;
  font: 400 14px/1.65 Vazirmatn, Tahoma, sans-serif;
  color: var(--ink);
  background: var(--porcelain);
}
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: Estedad, Vazirmatn, sans-serif; line-height: 1.5; }
h2 { font-size: 15px; font-weight: 775; }
h3 { font-size: 14px; font-weight: 725; }
button, select, input, textarea { font: inherit; }
button, a, select { touch-action: manipulation; }
button, select { cursor: pointer; }
a { text-decoration: none; color: inherit; }
:focus-visible { outline: 2px solid var(--plum); outline-offset: 3px; }
.rail :focus-visible, .stat:first-child:focus-visible { outline-color: var(--coral); }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  flex: none;
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.shell { display: grid; grid-template-columns: var(--rail) minmax(0,1fr); min-height: 100dvh; }
.workspace { min-width: 0; }
.wrap { width: min(924px, calc(100% - 64px)); margin-inline: auto; }
.rail {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 18px 13px 15px;
  color: var(--porcelain);
  background: var(--plum);
}
.brand { display: flex; align-items: center; gap: 10px; padding-inline: 5px; font: 760 15px/1.6 Estedad, sans-serif; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid color-mix(in srgb, var(--coral) 74%, var(--plum));
  border-radius: 12px;
  background: color-mix(in srgb, var(--coral) 13%, var(--plum));
  color: var(--coral);
}
.brand-mark .icon { width: 27px; height: 27px; stroke-width: 1.7; }
.brand small, .rail-footer small { color: color-mix(in srgb, var(--porcelain) 70%, var(--plum)); display: block; font: 400 11px/1.5 Vazirmatn, sans-serif; }
.tabs { display: grid; gap: 5px; margin-block: 29px 12px; }
.tabs a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-inline: 11px;
  border-radius: 10px;
  color: color-mix(in srgb, var(--porcelain) 84%, var(--plum));
  font-size: 14px;
  white-space: nowrap;
}
.tabs a[aria-current='page'] { background: color-mix(in srgb, var(--porcelain) 11%, var(--plum)); color: var(--porcelain); }
.tabs a[aria-current='page'] { font-weight: 700; }
.tabs a[aria-current='page']::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  height: 17px;
  width: 2px;
  border-radius: 2px;
  background: var(--coral);
}
.tabs a[aria-current='page'] .icon { color: var(--coral); }
.nav-count {
  display: grid;
  place-items: center;
  margin-inline-start: auto;
  min-width: 19px;
  min-height: 19px;
  padding-inline: 4px;
  border-radius: 100px;
  background: var(--coral);
  color: var(--ink);
  font-size: 11px;
  font-weight: 750;
}
.nav-count:empty { display: none; }
.rail-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px 4px 0;
  border-top: 1px solid color-mix(in srgb, var(--porcelain) 18%, var(--plum));
  font-size: 12px;
  overflow-wrap: anywhere;
}
.rail-footer .avatar { color: var(--porcelain); background: color-mix(in srgb, var(--porcelain) 13%, var(--plum)); }
.top {
  position: sticky;
  top: 0;
  z-index: 3;
  background: color-mix(in srgb,var(--porcelain) 93%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.top-inner, .top-title, .top-actions, .context, .context-date {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.top-inner { justify-content: space-between; min-height: 61px; padding-block: 5px; }
.top-title h1 { font-size: 18px; font-weight: 800; }
.top-title .brand-mark { display: none; }
.top-actions { gap: 7px; }
.context { justify-content: space-between; padding-block: 16px 14px; }
.context-date { color: var(--muted); font-size: 13px; gap: 6px; }
.context-date .icon { width: 17px; height: 17px; }
.operator { position: relative; }
.operator .icon { position: absolute; top: 50%; inset-inline-start: 9px; transform: translateY(-50%); pointer-events: none; width: 17px; height: 17px; color: var(--muted); }
.operator select { width: auto; max-width: 210px; padding-inline-start: 32px; font-size: 12px; font-weight: 650; }
.button, .icon-button, .search-trigger {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  transition: background-color .16s, color .16s, border-color .16s;
}
.button .icon { width: 17px; height: 17px; }
.button.primary { background: var(--plum); border-color: var(--plum); color: var(--porcelain); }
.button.accent { background: var(--coral); border-color: var(--coral); }
.button.compact { padding-inline: 9px; }
.button.subtle { background: var(--plum-soft); border-color: transparent; }
.button.text { flex-direction: row-reverse; border-color: transparent; background: transparent; color: var(--plum); padding-inline: 4px; font-size: 12px; }
.search-trigger, .icon-button { min-width: 44px; padding-inline: 9px; }
.search-trigger kbd { color: var(--muted); font-size: 10px; direction: ltr; border: 1px solid var(--line); border-radius: 4px; padding-inline: 4px; }
.today-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  text-align: start;
  min-width: 0;
  min-height: 110px;
  overflow: hidden;
  isolation: isolate;
  padding: 13px 15px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: border-color .16s, background-color .16s, transform .16s;
}
.stat:first-child { color: var(--porcelain); background: var(--plum-card); border-color: transparent; }
.stat:first-child::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset-inline-end: -36px;
  bottom: -96px;
  width: 219px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 11px, rgb(242 239 246 / .14) 11px 12px, transparent 12px 15px);
  opacity: .68;
  pointer-events: none;
}
.stat-label, .stat-value { display: flex; align-items: center; gap: 7px; }
.stat-label { font-weight: 650; color: var(--muted); }
.stat:first-child .stat-label { color: var(--porcelain); }
.stat-label .icon {
  display: block;
  width: 31px;
  height: 31px;
  padding: 5px;
  border-radius: 9px;
  background: var(--plum-soft);
  color: var(--plum);
}
.stat:first-child .stat-label .icon { color: var(--porcelain); background: rgb(242 239 246 / .14); }
.stat:nth-child(2) .stat-label .icon { color: var(--coral-deep); background: var(--coral-soft); }
.stat-value { justify-content: space-between; }
.stat-value strong { font: 800 29px/1.3 Estedad, sans-serif; }
.stat-value .icon { width: 17px; height: 17px; }
.stat:first-child .stat-value .icon { color: var(--porcelain); }
.section-head, .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.attention { margin-block: 15px 15px; }
.section-head { padding-inline: 2px; min-height: 44px; }
.attention-row {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 71px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.tile-icon, .avatar { display: grid; place-items: center; flex: none; width: 35px; height: 35px; border-radius: 11px; color: var(--plum); background: var(--plum-soft); font-weight: 760; }
.tile-icon { width: 39px; height: 39px; color: var(--coral-deep); background: var(--coral-soft); }
.attention-content .tag { margin-inline-start: 6px; }
.attention-content p { color: var(--muted); font-size: 12px; }
.tag { display: inline-block; vertical-align: middle; padding: 1px 6px; border-radius: 5px; background: var(--coral-soft); color: var(--coral-deep); font-size: 10px; font-weight: 760; }
.today-secondary { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); gap: 12px; align-items: start; }
.panel { overflow: clip; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-head { flex-wrap: wrap; padding: 8px 13px; min-height: 55px; border-bottom: 1px solid var(--line); }
.today-secondary .panel { min-height: 198px; }
.today-secondary .panel-head { flex-wrap: nowrap; padding-block: 4px; }
.agenda-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.agenda-row:last-child { border-bottom: 0; }
.agenda-person { min-width: 0; }
.agenda-person strong, .agenda-person small { display: block; }
.agenda-person small, .agenda-time { color: var(--muted); font-size: 11px; }
.agenda-time { white-space: nowrap; }
.agenda-person small { overflow-wrap: anywhere; }
.activity-total { color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.chart { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 5px; list-style: none; margin: 0; padding: 13px 10px 10px; }
.chart li { display: grid; grid-template-rows: 18px 67px minmax(20px,auto); justify-items: center; align-items: center; gap: 4px; min-width: 0; color: var(--muted); }
.chart li > span { font-size: 11px; font-weight: 720; }
.chart small { text-align: center; font-size: 11px; line-height: 1.3; }
.column-track { display: flex; align-items: end; width: min(26px,88%); height: 100%; background: var(--porcelain); border-radius: 6px; }
.column-track i { display: block; width: 100%; height: max(3px,var(--level)); background: color-mix(in srgb,var(--coral) 62%,var(--porcelain)); border-radius: 6px; }
.chart li:last-child .column-track i { background: var(--plum); }
.chart li:last-child small, .chart li:last-child > span { color: var(--plum); font-weight: 800; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 12px; }
.metric { min-width: 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.metric span, .metric small { display: block; color: var(--muted); }
.metric small { font-size: 11px; }
.metric strong { display: block; margin-block: 3px; font: 775 22px/1.4 Estedad, sans-serif; }
.report-breakdown { padding-inline: 13px; }
.report-row { display: grid; grid-template-columns: minmax(101px,.7fr) minmax(40px,1fr) minmax(107px,.9fr) minmax(92px,.6fr); align-items: center; gap: 10px; padding-block: 12px; border-bottom: 1px solid var(--line); }
.report-row p { font-size: 12px; }
.report-row:last-child { border: 0; }
.bar { background: var(--plum-soft); border-radius: 9px; height: 7px; }
.bar span { display: block; height: 100%; background: var(--plum); border-radius: inherit; }
input, select, textarea { color: var(--ink); background: var(--surface); width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; }
input::placeholder, textarea::placeholder { color: var(--muted); }
.actions, .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.actions select, .filters select { width: auto; font-size: 12px; }
.filters { gap: 8px; }
.queue-panel .filters { width: 100%; }
.filter-search { display: block; position: relative; min-width: 0; flex: 1; }
.filter-search .icon { position: absolute; inset-inline-start: 10px; top: 12px; color: var(--muted); pointer-events: none; }
.filter-search input { padding-inline-start: 35px; background: var(--porcelain); }
.scope-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px 12px; border-bottom: 1px solid var(--line); }
.scope-tab {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 13px;
  white-space: nowrap;
}
.scope-tab[aria-pressed='true'] { background: var(--plum-soft); border-color: var(--line); color: var(--plum); font-weight: 750; }
.row {
  display: grid;
  grid-template-columns: minmax(105px,1fr) minmax(123px,1.23fr) minmax(80px,.65fr) minmax(93px,.85fr) minmax(135px,auto);
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.row:last-child { border-bottom: 0; }
.row.head { background: var(--porcelain); padding-block: 7px; font-weight: 680; color: var(--muted); font-size: 12px; }
.row strong, .row small { display: block; overflow-wrap: anywhere; }
.row small { color: var(--muted); font-size: 11px; }
.row .late { color: var(--coral-deep); font-weight: 700; }
.queue-person, .customer-identity { display: flex; gap: 8px; align-items: center; min-width: 0; }
.queue-person > div { min-width: 0; }
.queue-person .avatar { width: 32px; height: 32px; }
.status { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 6px; font-weight: 650; color: var(--plum); background: var(--plum-soft); }
.status.missed { color: var(--coral-deep); background: var(--coral-soft); }
.status.won { color: var(--porcelain); background: var(--plum); }
.status.lost { color: var(--muted); background: var(--porcelain); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 46px; padding: 5px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
[data-density='compact'] .row:not(.head) { padding-block: 5px; }
[data-density='compact'] .metric { padding-block: 7px; }
.customer-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; padding: 12px; }
.customer-list .empty { grid-column: 1 / -1; }
.card { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--porcelain); overflow-wrap: anywhere; }
.card p { color: var(--muted); font-size: 12px; }
.customer-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 5px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.customer-meta .button { min-height: 42px; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.fields label { display: grid; gap: 4px; align-content: start; font-size: 13px; font-weight: 660; min-width: 0; }
.fields .wide { grid-column: 1 / -1; }
.settings-fields, .settings-feedback { padding-inline: 13px; }
.settings-fields { padding-block: 13px; }
.settings-feedback:has(.form-error:not(:empty)) { padding-bottom: 13px; }
.connections { margin-top: 12px; }
.connection { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 7px; align-items: center; padding: 8px 13px; border-bottom: 1px solid var(--line); }
.connection:last-child { border-bottom: 0; }
.connection p, .quiet { color: var(--muted); font-size: 13px; }
.empty { padding: 17px 13px; color: var(--muted); }
.footnote { margin-block: 13px 22px; color: var(--muted); font-size: 11px; }
dialog {
  width: min(550px,calc(100% - 20px));
  max-height: 88dvh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 20px 70px rgb(48 35 69 / .25);
  overscroll-behavior: contain;
}
dialog[open] { animation: reveal .19s ease-out both; }
dialog::backdrop { background: rgb(48 35 69 / .58); }
body:has(dialog[open]) { overflow: hidden; }
.dialog-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.dialog-head h2 { font-size: 17px; }
.dialog-head h2:focus { outline: none; }
.dialog-main { padding: 12px 14px 16px; }
.dialog-main h3 { margin-block: 12px 5px; }
.dialog-main .actions { margin-top: 10px; }
.dialog-main .quiet + .fields { margin-top: 10px; }
.events { padding-inline-start: 18px; margin-block: 7px 12px; overflow-wrap: anywhere; }
.events li { padding-block: 4px; }
.clues, .search-quick { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.clues span { background: var(--porcelain); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 12px; }
.next-inline { background: var(--coral-soft); border-radius: 8px; padding: 8px; margin-top: 8px; }
.next-inline strong { color: var(--coral-deep); margin-inline-end: 4px; }
.search-results { margin-top: 8px; }
.search-result { display: flex; gap: 8px; align-items: center; width: 100%; min-height: 45px; text-align: start; padding: 6px; border: 0; border-radius: 8px; background: var(--surface); color: var(--ink); overflow-wrap: anywhere; }
.search-result small { display: block; color: var(--muted); font-size: 12px; }
.form-error:not(:empty) { margin-top: 8px; color: var(--coral-deep); font-weight: 700; border-inline-start: 3px solid var(--coral); padding-inline-start: 7px; }
.toast { position: fixed; bottom: 17px; inset-inline-end: 17px; z-index: 6; max-width: min(420px,calc(100vw - 28px)); background: var(--plum); color: var(--porcelain); padding: 8px 12px; border-radius: 9px; }
.toast:empty { display: none; }
@keyframes reveal { from { opacity: 0; transform: translateY(9px); } }
@media (min-width: 900px) and (max-width: 1040px) {
  :root { --rail: 178px; }
  .wrap { width: calc(100% - 40px); }
}
@media (max-width: 899px) {
  .shell { display: block; }
  .wrap { width: min(740px,calc(100% - 36px)); }
  .rail { position: fixed; height: auto; top: auto; bottom: 0; inset-inline: 0; padding: 0 0 env(safe-area-inset-bottom); box-shadow: 0 -4px 18px rgb(48 35 69 / .12); }
  .rail .brand, .rail-footer { display: none; }
  .top-title .brand-mark { display: grid; color: var(--plum); background: var(--plum-soft); border-color: var(--line); }
  .tabs { grid-template-columns: repeat(5,minmax(0,1fr)); width: min(600px,100%); margin: 0 auto; padding: 4px; gap: 2px; }
  .tabs a { flex-direction: column; justify-content: center; gap: 2px; min-height: calc(var(--navbar) - 8px); font-size: 11px; padding-inline: 3px; }
  .tabs a[aria-current='page']::before { inset-inline-start: calc(50% - 12px); top: 0; height: 2px; width: 24px; }
  .nav-count { position: absolute; top: 2px; inset-inline-start: calc(50% + 6px); min-width: 16px; min-height: 16px; font-size: 9px; }
  .workspace { padding-bottom: calc(var(--navbar) + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(var(--navbar) + 10px + env(safe-area-inset-bottom)); }
}
@media (max-width: 680px) {
  .today-secondary { grid-template-columns: 1fr; gap: 12px; }
  .today-secondary .panel { min-height: 0; }
  .customer-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .row.head { display: none; }
  .rows { display: grid; gap: 7px; padding: 8px; background: var(--porcelain); }
  .row:not(.head) {
    grid-template-columns: minmax(0,1fr) auto;
    grid-template-areas: 'person status' 'subject subject' 'due actions';
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
  }
  .queue-person { grid-area: person; }
  .queue-subject { grid-area: subject; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .queue-status { grid-area: status; justify-self: end; }
  .queue-due { grid-area: due; }
  .row .actions { grid-area: actions; justify-content: end; }
}
@media (max-width: 460px) {
  .wrap { width: calc(100% - 24px); }
  .top-inner { min-height: 56px; gap: 6px; }
  .top-title { gap: 6px; }
  .top-title h1 { font-size: 15px; }
  .top-actions { gap: 5px; }
  .top-title .brand-mark { width: 33px; height: 33px; border-radius: 9px; }
  .top-title .brand-mark .icon { width: 24px; height: 24px; }
  .operator .icon, .search-trigger kbd { display: none; }
  .operator select { max-width: 125px; padding-inline-start: 6px; font-size: 11px; }
  .context { padding-block: 11px 10px; gap: 5px; }
  .context-date { font-size: 11px; gap: 4px; }
  .context-date .icon { width: 15px; height: 15px; }
  #new-call { white-space: nowrap; padding-inline: 8px; font-size: 12px; gap: 3px; }
  .today-stats { gap: 7px; }
  .stat { min-height: 99px; padding: 8px; gap: 4px; border-radius: 13px; }
  .stat-label { align-items: start; flex-direction: column; gap: 4px; font-size: 11px; }
  .stat-label .icon { width: 26px; height: 26px; padding: 4px; border-radius: 7px; }
  .stat-value strong { font-size: 23px; }
  .stat-value .icon { width: 14px; height: 14px; }
  .attention { margin-block: 10px 12px; }
  .attention-row { padding-inline: 8px; gap: 7px; }
  .attention-content { font-size: 13px; }
  .attention-content p { font-size: 11px; }
  .attention-subject { display: none; }
  .attention-content .tag { margin-inline-start: 4px; }
  .attention-row .button { padding-inline: 7px; font-size: 11px; white-space: nowrap; }
  .tile-icon { width: 31px; height: 31px; border-radius: 8px; }
  .tile-icon .icon { width: 17px; height: 17px; }
  .agenda-row { grid-template-columns: auto minmax(0,1fr) auto; gap: 3px 7px; }
  .agenda-row .avatar { grid-row: span 2; }
  .agenda-time { grid-column: 2; grid-row: 2; }
  .agenda-row .button { grid-column: 3; grid-row: 1 / 3; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .report-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px; }
  .report-row .bar { grid-column: 2; }
  .queue-panel .filters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .queue-panel .filter-search { grid-column: 1 / -1; }
  .filters select { width: 100%; }
  .scope-tabs { gap: 2px; padding-inline: 5px; }
  .scope-tab { font-size: 11px; padding-inline: 5px; }
  .fields { grid-template-columns: 1fr; }
  .customer-list { grid-template-columns: 1fr; }
  .customer-card { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 5px; }
  .customer-meta { margin: 0; border: 0; }
  .connection { gap: 5px; padding-inline: 8px; }
  .connection p { font-size: 11px; }
  .connection .button { padding-inline: 5px; font-size: 11px; }
}
@media (max-width: 560px) {
  dialog {
    inset: auto 0 0;
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 26px);
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 18px 18px 0 0;
  }
  .dialog-head::before { content: ''; position: absolute; top: 5px; inset-inline: 0; margin-inline: auto; width: 32px; height: 3px; border-radius: 4px; background: var(--line); }
  .dialog-head { padding-top: 12px; }
  input, textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
[hidden] { display: none !important; }
.workspace main { padding-bottom: 20px; }
.auth { width: min(390px,calc(100% - 24px)); margin: min(12svh,85px) auto 24px; }
.auth .panel { padding: 18px; }
.auth .auth-title { display: flex; gap: 9px; align-items: center; margin-bottom: 12px; }
.auth form, .stack { display: grid; gap: 10px; }
.panel-body { padding: 12px 13px; }
.section-stack { display: grid; gap: 12px; }
.notice-error { padding: 10px; border-radius: 8px; background: var(--coral-soft); color: var(--coral-deep); }
.notice-error:empty { display: none; }
.link-button { text-decoration: none; }
.control { display: grid; gap: 5px; font-size: 13px; font-weight: 650; }
.control textarea { min-height: 85px; resize: vertical; }
.module-control { display: flex; align-items: center; gap: 8px; padding: 5px 0; min-height: 44px; }
.module-control input { min-height: 0; width: 18px; height: 18px; accent-color: var(--plum); }
.settings-tabs { padding: 0 0 10px; border: 0; }
.strip { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 8px 13px; }
.strip:last-child { border-bottom: 0; }
.strip-main { min-width: 0; overflow-wrap: anywhere; }
.strip-main strong, .strip-main small { display: block; }
.strip small { font-size: 12px; color: var(--muted); }
.strip strong { font-weight: 710; }
.file-action { display: inline-flex; cursor: pointer; }
.file-action input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.file-action:focus-within { outline: 2px solid var(--plum); outline-offset: 3px; }
.text-button-list { display: grid; gap: 7px; }
.text-button-list button { justify-content: space-between; }
.result-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.divider { border: 0; border-top: 1px solid var(--line); margin-block: 13px; }
.error-spaced { margin-block: 8px; }
.settings-list .strip { padding-block: 8px; }
.audit-code { direction: ltr; display: inline-block; font-size: 12px; }
.settings-backup .strip { flex-wrap: wrap; }
.ai-result { white-space: pre-line; font-size: 13px; padding: 9px; border-radius: 8px; background: var(--plum-soft); overflow-wrap: anywhere; }
.ai-result:empty { display: none; }
.section-empty { padding: 12px; color: var(--muted); }
.button[disabled] { opacity: .6; cursor: wait; }
.positive { font-variant-numeric: tabular-nums; }
@media (max-width: 460px) {
  .strip { align-items: center; padding-inline: 8px; gap: 5px; }
  .strip .button { padding-inline: 7px; font-size: 12px; }
  .context { row-gap: 4px; }
  .context .actions { justify-content: end; }
  .queue-panel .scope-tabs { justify-content: start; }
}
@media (max-width: 899px) {
  .tabs { grid-template-columns: repeat(var(--nav-count,5),minmax(0,1fr)); }
}

.duty-line { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--plum-soft); color: var(--ink); font-size: 14px; }
.duty-line .icon { width: 18px; height: 18px; color: var(--coral-deep); }
.strip-main .late { color: var(--coral-deep); font-weight: 700; display: block; }

/* Hover only where a pointer can hover. On a phone the first tap would leave the style stuck. */
@media (hover: hover) and (pointer: fine) {
  .tabs a:hover { background: color-mix(in srgb, var(--porcelain) 11%, var(--plum)); color: var(--porcelain); }
  .button:hover, .icon-button:hover, .search-trigger:hover { background: var(--plum-soft); border-color: var(--muted); }
  .button.primary:hover { background: var(--ink); }
  .button.accent:hover { background: color-mix(in srgb,var(--coral) 84%,var(--porcelain)); }
  .button.subtle:hover { border-color: var(--line); background: var(--porcelain); }
  .button.text:hover { text-decoration: underline; }
  .stat:hover { border-color: var(--muted); transform: translateY(-2px); }
  .scope-tab:hover { border-color: var(--line); }
  .search-result:hover { background: var(--plum-soft); }
}

/* ===== Polish layer: phone first, calm, quick ===== */

/* Phone baseline: no grey tap flash, no page pull-to-refresh fighting the panel, no text inflation, controls are not selectable text. */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
button, [role='button'], .tabs a, .scope-tab, .file-action { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
summary, label[for], .file-action, [role='button'] { cursor: pointer; }
@media (pointer: coarse) { input, select, textarea { font-size: 16px; } }

/* Press feedback arrives on touch, not on release. */
.button, .icon-button, .search-trigger, .stat, .tabs a, .scope-tab { transition: transform .12s ease-out, background-color .16s, color .16s, border-color .16s; }
.button:active, .icon-button:active, .search-trigger:active, .stat:active, .scope-tab:active { transform: scale(.97); }
.tabs a:active { transform: scale(.94); }
.button[disabled] { transform: none; }

/* Filter chips: one scrolling row, never two rows with an orphan. */
.scope-tabs, .queue-panel .scope-tabs {
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to left, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}
.scope-tabs::-webkit-scrollbar { display: none; }
.scope-tab { flex: none; scroll-snap-align: center; font-size: 13px; padding: 5px 12px; border-radius: 22px; }
.scope-tab[aria-pressed='true'] { background: var(--plum); border-color: var(--plum); color: var(--porcelain); }
.settings-tabs { padding: 0 0 10px; mask-image: none; }
@media (max-width: 460px) { .scope-tabs { gap: 6px; padding-inline: 12px; } .scope-tab { font-size: 13px; padding-inline: 12px; } }

/* Shift line: one calm row, the second line only when it is about you. */
.duty-line { align-items: flex-start; padding: 9px 12px; font-size: 13px; line-height: 1.6; }
.duty-line .icon { margin-top: 3px; flex: none; }
.duty-line span { display: grid; min-width: 0; }
.duty-line small { color: var(--muted); font-size: 12px; }

/* Account button shows who is signed in, not a second "people" icon. */
.icon-button .avatar { width: 30px; height: 30px; border-radius: 50%; font-size: 13px; }

/* Lists on a phone: hairline rows, not boxes inside a box. */
@media (max-width: 680px) {
  .rows { padding: 0; background: var(--surface); gap: 0; }
  .row:not(.head) { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 12px; row-gap: 6px; }
  .row:not(.head):last-child { border-bottom: 0; }
  .queue-subject { padding-bottom: 8px; }
}

/* Loading and error states. */
.skeleton { display: grid; gap: 12px; }
.skeleton i {
  display: block;
  height: 88px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--plum-soft) 30%, color-mix(in srgb, var(--plum-soft) 40%, var(--surface)) 50%, var(--plum-soft) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skeleton i:first-child { height: 52px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.state-error { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Motion: a page rises in once when you switch, rows follow in a short staggered sequence. Reduced-motion users get none. */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
#page.enter > * { animation: rise .24s ease-out both; }
#page.enter > *:nth-child(2) { animation-delay: .04s; }
#page.enter > *:nth-child(3) { animation-delay: .08s; }
#page.enter > *:nth-child(n+4) { animation-delay: .12s; }
#page.enter .row:nth-child(-n+8), #page.enter .strip:nth-child(-n+8), #page.enter .customer-card:nth-child(-n+8) { animation: rise .22s ease-out both; }
#page.enter .row:nth-child(2), #page.enter .strip:nth-child(2), #page.enter .customer-card:nth-child(2) { animation-delay: .03s; }
#page.enter .row:nth-child(3), #page.enter .strip:nth-child(3), #page.enter .customer-card:nth-child(3) { animation-delay: .06s; }
#page.enter .row:nth-child(n+4), #page.enter .strip:nth-child(n+4), #page.enter .customer-card:nth-child(n+4) { animation-delay: .09s; }
.toast { animation: rise .2s ease-out both; }
dialog[open]::backdrop { animation: fade .2s ease-out both; }
@keyframes fade { from { opacity: 0; } }
@media (max-width: 560px) { dialog[open] { animation: sheet .26s cubic-bezier(.2,.8,.2,1) both; } }
@keyframes sheet { from { transform: translateY(40px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton i { animation: none; }
  #page.enter > *, #page.enter .row, #page.enter .strip, #page.enter .customer-card { animation: none !important; }
}

/* ===== Polish 2: nothing scrolls sideways, calm toast, sheets, bell, tighter rhythm ===== */

/* Safety net: if some long unbroken text ever slips through, the page still cannot pan sideways. */
html, body { overflow-x: clip; max-width: 100%; }

/* Filter tabs wrap instead of scrolling. On a phone, groups become even grids. */
.scope-tabs, .queue-panel .scope-tabs {
  flex-wrap: wrap;
  overflow: visible;
  mask-image: none;
  scroll-snap-type: none;
  padding: 8px 12px;
}
.scope-tab { flex: 0 1 auto; }
.settings-tabs { padding: 0 0 8px; }
.only-mobile { display: none; }
@media (max-width: 560px) {
  .only-desktop { display: none !important; }
  .only-mobile { display: grid; }
  .scope-tabs.cols-2, .scope-tabs.cols-3 { display: grid; gap: 6px; padding: 8px 12px; }
  .scope-tabs.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scope-tabs.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .scope-tabs.cols-2 .scope-tab, .scope-tabs.cols-3 .scope-tab { width: 100%; padding-inline: 4px; font-size: 13px; text-align: center; }
  .settings-tabs.cols-3 { padding-inline: 0; }
  .scope-tab { border-color: var(--line); background: var(--surface); }
}

/* Big-row choices, like the Tavafogh panel: one tap picks and closes. */
.sheet-triggers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); }
.sheet-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: start;
}
.sheet-trigger b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; font-size: 13px; }
.sheet-label { flex: none; color: var(--muted); font-size: 11px; }
.sheet-trigger .icon { flex: none; width: 16px; height: 16px; color: var(--muted); transform: rotate(-90deg); }
.sheet-trigger:active { background: var(--plum-soft); }
.sheet-list { display: grid; gap: 2px; margin-inline: -6px; }
.sheet-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 52px; padding: 0 14px; border: 0; border-radius: 12px; background: none; color: inherit; font: inherit; text-align: start; }
.sheet-item:active { background: var(--plum-soft); }
.sheet-item.on { background: var(--plum-soft); font-weight: 750; }
.sheet-item .icon { color: var(--plum); }

/* Toast: one pill at the top with a badge (check, !, i) and a spring-in, plus a spinner while a save is slow. */
.toast {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  bottom: auto;
  inset-inline: 0;
  margin-inline: auto;
  width: max-content;
  max-width: calc(100vw - 24px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 14px;
  border: 1px solid rgb(242 239 246 / .14);
  border-radius: 16px;
  background: rgb(48 35 69 / .97);
  color: var(--porcelain);
  box-shadow: 0 14px 34px rgb(48 35 69 / .3);
  font-weight: 650;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-22px) scale(.96);
  transition: opacity .26s, transform .34s cubic-bezier(.2, 1.2, .4, 1), visibility 0s .34s;
  animation: none;
}
.toast.show { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.toast::before { content: '✓'; display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--coral); color: var(--plum); font-weight: 900; }
.toast[data-tone='bad']::before { content: '!'; }
.toast[data-tone='info']::before { content: 'i'; background: var(--porcelain); }
.toast[data-tone='work']::before { content: ''; background: none; border: 3px solid rgb(242 239 246 / .3); border-top-color: var(--porcelain); box-sizing: border-box; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 899px) { .toast { bottom: auto; } }

/* Bell and notices */
.icon-button { position: relative; }
.bell-dot { position: absolute; top: 9px; inset-inline-end: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 2px var(--porcelain); animation: pop .36s cubic-bezier(.2, 1.4, .4, 1) both; }
.bell-dot[hidden] { display: none; }
@keyframes pop { from { transform: scale(0); } }
.notice-list { display: grid; gap: 8px; }
.notice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 62px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: inherit; font: inherit; text-align: start; }
.notice:active { background: var(--plum-soft); }
.notice.unread { border-color: var(--coral); background: var(--coral-soft); }
.notice-text { flex: 1; min-width: 0; }
.notice-text strong, .notice-text small { display: block; overflow-wrap: anywhere; }
.notice-text small { color: var(--muted); font-size: 12px; }
.notice .icon:last-child { flex: none; width: 16px; height: 16px; color: var(--muted); }
.tile-icon.warn { color: var(--plum); background: var(--plum-soft); }

/* Saving: the button shows a spinner instead of silently waiting. */
.button.loading { position: relative; color: transparent; pointer-events: none; }
.button.loading .icon { opacity: 0; }
.button.loading::after { content: ''; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border: 2.5px solid rgb(242 239 246 / .35); border-top-color: var(--porcelain); border-radius: 50%; animation: spin .7s linear infinite; }
.button:not(.primary).loading::after { border-color: var(--line); border-top-color: var(--plum); }

/* Tighter rhythm: less empty space between things, nothing cramped. */
.context { padding-block: 12px 10px; }
.section-head { min-height: 38px; }
.attention { margin-block: 10px 10px; }
.panel-head { min-height: 50px; padding-block: 6px; }
.empty { padding: 14px 13px; }
.duty-line { margin-bottom: 10px; }
.workspace main { padding-bottom: 14px; }
.stat-value strong { line-height: 1.2; }
@media (max-width: 560px) {
  .context { padding-block: 10px 8px; }
  .today-stats { gap: 8px; }
  .stat { min-height: 88px; padding: 10px; }
  .attention-row { min-height: 60px; padding: 8px 10px; }
  .row:not(.head) { padding: 10px 12px; row-gap: 5px; }
  .queue-subject { padding-bottom: 6px; }
  .strip { padding-block: 9px; }
  .panel-body { padding: 10px 12px; }
  .dialog-main { padding: 10px 14px 14px; }
  .fields { gap: 10px; }
}

/* The toast lives in the top layer so it is never hidden behind a sheet's dimmed backdrop. */
.toast[popover] { margin-block: 0; height: auto; overflow: visible; inset-block-end: auto; }
.toast[popover]:not(:popover-open) { display: none; }

/* Profiles: photo or initial, everywhere a person appears. */
.avatar { overflow: hidden; }
.avatar.has-photo { padding: 0; }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 72px; height: 72px; border-radius: 22px; font-size: 26px; }
.avatar.tiny { display: inline-grid; width: 22px; height: 22px; border-radius: 50%; font-size: 11px; vertical-align: middle; flex: none; }
.icon-button .avatar.has-photo { border-radius: 50%; }
.profile-card { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.profile-card .meta { min-width: 0; }
.profile-card strong { display: block; font-size: 16px; overflow-wrap: anywhere; }
.owner-line { display: flex; align-items: center; gap: 6px; }
.strip .who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.rail-footer #rail-avatar { display: contents; }
.advanced { border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; }
.advanced[open] { padding-bottom: 12px; }
.advanced summary { display: flex; align-items: center; min-height: 44px; color: var(--muted); font-weight: 650; cursor: pointer; }
.duty-line .avatar.tiny { margin-top: 1px; }
