/* PestDial UI preview — design tokens and layout.
   Palette: field green (brand), amber (needs attention), cool neutrals.
   Type: the device's own UI font, so every script (Latin, Telugu, Devanagari,
   Arabic …) renders with a native face and no web-font download. */
:root {
  --bg: #F2F5F4;
  --surface: #FFFFFF;
  --ink: #15241F;
  --muted: #51605A;
  --line: #DCE4E1;
  --line-strong: #BFCCC6;
  --brand: #17614F;
  --brand-hover: #0F4E3F;
  --brand-soft: #E3F0EB;
  --attn-bg: #FFF4E3;
  --attn-line: #E4A145;
  --attn-ink: #6F3A00;
  --danger: #A12A2A;
  --danger-bg: #FCF1F1;
  --focus: #1A56DB;
  --radius: 12px;
  --radius-sm: 8px;
  --topbar: 60px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Telugu", "Nirmala UI", "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--bg); }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); text-decoration: none; }
.skip-link:focus { top: 12px; }

.icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- preview toolbar (not part of the product) ---------- */
.preview-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 6px 16px; background: #25324A; color: #EEF2F8; font-size: 13px; }
.preview-bar .pv-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.preview-bar select { font-size: 13px; padding: 3px 6px; border-radius: 6px; border: 1px solid #5A6A86; background: #334262; color: #fff; min-height: 30px; }
.preview-bar label { color: #C8D2E3; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: var(--topbar) 1fr; grid-template-areas: "top top" "side content"; min-height: 100vh; }
.topbar { grid-area: top; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
/* Official logo: height-driven, width auto => original 922:297 aspect ratio; no crop, no filter, no recolour. */
.brand-logo { display: block; height: 44px; width: auto; max-width: none; }
.company { color: var(--muted); font-weight: 600; padding-left: 16px; border-left: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.user-menu { margin-left: auto; position: relative; }
.user-menu summary { list-style: none; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 10px 4px 4px; border-radius: 999px; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--bg); }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 14px; }
.user-name { font-weight: 600; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(21, 36, 31, .12); padding: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 44px; border-radius: var(--radius-sm); text-decoration: none; }
.menu-item:hover { background: var(--bg); }

.sidebar { grid-area: side; padding: 20px 12px; border-right: 1px solid var(--line); background: var(--surface); }
.sidebar ul { display: grid; gap: 4px; position: sticky; top: calc(var(--topbar) + 20px); }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; position: relative; }
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.badge { margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--attn-line); color: #2B1700; font-size: 13px; font-weight: 700; display: inline-grid; place-items: center; }
.content { grid-area: content; min-width: 0; }
.main { padding: 26px 40px 56px; outline: none; }
.page { max-width: 1080px; margin: 0 auto; }
.bottom-nav { display: none; }

/* ---------- typography blocks ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.page-title { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; display: flex; align-items: center; gap: 10px; outline: none; }
.page-title .icon { width: 26px; height: 26px; color: var(--attn-ink); }
.page-sub { color: var(--muted); margin-top: 4px; }
.section-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-title.big { font-size: 22px; margin-bottom: 16px; outline: none; }
.sub-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; outline: none; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; margin-top: 6px; }
.text-link { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-weight: 600; text-decoration: none; min-height: 44px; }
.text-link:hover span { text-decoration: underline; }
.text-link .icon { width: 18px; height: 18px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-bottom: 8px; color: var(--muted); font-weight: 600; text-decoration: none; }
.back-link:hover { color: var(--ink); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #F0F4F2; border-color: #A9B8B1; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--brand); }
.btn-quiet:hover { background: var(--brand-soft); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: #E3B9B9; }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }

/* ---------- search ---------- */
.search { position: relative; margin-bottom: 20px; }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 22px; height: 22px; pointer-events: none; }
.search-input { width: 100%; height: 54px; padding: 0 16px 0 50px; font-size: 17px; border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.search-input::placeholder { color: #75837D; }
.search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23, 97, 79, .18); }
.home-search { margin-bottom: 8px; }
.home-search .search { margin-bottom: 6px; }
.search-results { margin-bottom: 10px; }
.result-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.result { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; padding: 12px 16px; text-decoration: none; border-top: 1px solid var(--line); }
.result-list li:first-child .result { border-top: 0; }
.result:hover { background: var(--bg); }
.r-name { font-weight: 600; }
.r-meta { color: var(--muted); font-size: 14px; }
.result-empty { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* ---------- home ---------- */
.home-head { margin-bottom: 14px; }
.attention { background: var(--attn-bg); border: 1px solid #F0D3A6; border-left: 5px solid var(--attn-line); border-radius: var(--radius); padding: 14px 22px; margin-bottom: 16px; }
.attention > .section-title { color: var(--attn-ink); margin-bottom: 4px; }
.attention.is-clear { background: var(--brand-soft); border-color: #C4DED4; border-left-color: var(--brand); }
.attention.is-clear > .section-title { color: var(--brand); }
.attn-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 8px 0; }
.attn-row + .attn-row { border-top: 1px solid #F0D3A6; }
.attn-line { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 650; }
.attn-help { color: #5E4A2E; margin-top: 2px; padding-left: 30px; font-size: 15px; }
.attn-link { text-decoration: none; flex-wrap: nowrap; }
.attn-link .text-link { flex-shrink: 0; }
.attn-link:hover .attn-line span { text-decoration: underline; }
.attn-link .attn-line { font-size: 16px; font-weight: 600; }
.kpis { margin-bottom: 16px; }
.kpi-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi-row li + li { border-left: 1px solid var(--line); }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 22px; text-decoration: none; border-radius: var(--radius); height: 100%; }
.kpi:hover { background: #F7FAF9; }
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 15px; }
.kpi-num { font-size: 34px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.mini-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 3px 0; border-top: 1px solid var(--line); }
.mini-list li:first-child { border-top: 0; }
.mini-who { display: flex; align-items: center; gap: 8px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-who.is-unknown { color: var(--attn-ink); }
.mini-when { color: var(--muted); font-size: 15px; white-space: nowrap; }
.mini-row .btn { min-width: 92px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin; }
.tab { display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); }
.tab .icon { width: 18px; height: 18px; }
.tab-short { display: none; }
.tab-count { background: var(--attn-bg); color: var(--attn-ink); border: 1px solid #F0D3A6; border-radius: 999px; font-size: 13px; padding: 0 8px; }
.caught-up { display: inline-flex; align-items: center; gap: 8px; color: var(--brand); font-weight: 600; min-height: 44px; }

/* ---------- call list ---------- */
.split.has-detail { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.call-list, .cust-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.call-row { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1.3fr) minmax(0, 1fr) 150px; align-items: center; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line); }
.cr-badge { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; }
.cr-badge .icon { width: 18px; height: 18px; stroke-width: 2; }
.cr-badge.is-in { background: var(--brand-soft); color: var(--brand); }
.cr-badge.is-out { background: #EAEFF5; color: #3C5270; }
.cr-facts { display: flex; flex-direction: column; min-width: 0; }
.cr-type { font-weight: 650; color: var(--ink); }
.call-list li:first-child { border-top: 0; border-radius: var(--radius) var(--radius) 0 0; }
.call-row:hover { background: #F7FAF9; }
.call-row.is-selected { background: var(--brand-soft); }
.call-row.is-unknown .row-link { color: var(--attn-ink); }
.dir { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 600; }
.dir .icon { width: 18px; height: 18px; }
.cr-who { display: flex; flex-direction: column; min-width: 0; }
.row-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-link::after { content: ""; position: absolute; inset: 0; }
.row-link:hover span, .row-link:hover { text-decoration: underline; }
.row-link:focus-visible { outline: none; }
.row-link:focus-visible::after { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: 6px; }
.cr-phone { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.cr-when { color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-dur { color: var(--muted); font-size: 14px; white-space: nowrap; }
.cr-status { display: flex; justify-content: flex-end; }
.cr-status .btn { position: relative; z-index: 1; }
.has-detail .call-row { grid-template-columns: 36px minmax(0, 1fr) auto; row-gap: 2px; }
.has-detail .cr-badge { grid-row: 1 / span 2; width: 32px; height: 32px; }
.has-detail .cr-dur { display: none; }
.has-detail .cr-facts { grid-column: 2; grid-row: 2; }
.has-detail .cr-when { font-size: 14px; }
.has-detail .cr-status { grid-column: 3; grid-row: 1 / span 2; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 650; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.chip .icon { width: 15px; height: 15px; stroke-width: 2.2; }
.chip-ok { background: var(--brand-soft); color: var(--brand); }
.chip-attn { background: var(--attn-bg); color: var(--attn-ink); }
.chip-muted { background: #EDF1EF; color: var(--muted); }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.pager-range { color: var(--muted); }
.pager-btns { display: flex; gap: 8px; }

/* ---------- detail ---------- */
.detail-panel { position: sticky; top: calc(var(--topbar) + 16px); max-height: calc(100vh - var(--topbar) - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.detail-title { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 8px; outline: none; }
.detail-page .detail-title { font-size: 26px; }
.detail-title .icon { color: var(--attn-ink); width: 24px; height: 24px; }
.detail-phone { font-size: 17px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.detail-meta { color: var(--muted); margin-top: 2px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 4px; }
.detail-section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; }
.facts { display: grid; gap: 8px; margin: 0; }
.fact { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; align-items: center; }
.fact dt { color: var(--muted); font-size: 15px; }
.fact dd { margin: 0; overflow-wrap: anywhere; }
.fact .text-link { min-height: 0; }
.note { padding: 10px 0; border-top: 1px solid var(--line); }
.notes .note:first-child { border-top: 0; padding-top: 0; }
.note-meta { color: var(--muted); font-size: 14px; }
.note-text { margin-top: 2px; overflow-wrap: anywhere; }
.note .btn-quiet { min-height: 36px; padding: 0 8px; margin-top: 4px; margin-left: -8px; }
.note-form { margin-top: 12px; }
.textarea, .input { width: 100%; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--surface); padding: 10px 12px; font-size: 16px; }
.input { min-height: 48px; }
.textarea:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23, 97, 79, .18); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.more { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 8px; }
.more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); font-weight: 600; }
.more-body { padding-top: 4px; }
.inline-confirm { background: #F7FAF9; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-top: 10px; }

/* ---------- review flow ---------- */
.page.page-review { max-width: 600px; }
.review-card { max-width: 600px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px 28px; }
.review-progress { color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.review-phone { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 6px; letter-spacing: -0.01em; }
.review-step { margin-top: 22px; }
.choice-stack { display: grid; gap: 12px; }
.choice-stack .btn { min-height: 52px; font-size: 16px; justify-content: flex-start; padding: 0 18px; }
.step-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; margin-left: -10px; }
.step-head .sub-title { margin: 0; font-size: 18px; }
.review-note { margin-top: 14px; }
.review-done { text-align: center; padding: 40px 28px; display: grid; justify-items: center; gap: 10px; }
.done-icon { width: 48px; height: 48px; color: var(--brand); stroke-width: 2; }
.form { display: grid; gap: 16px; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: 6px; }
.opt { color: var(--muted); font-weight: 400; }
.field-error { color: var(--danger); font-weight: 600; font-size: 15px; margin-top: 6px; }
.static-value { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.static-value .icon { color: var(--brand); }
.options { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.option { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 10px; align-items: center; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.option:hover { border-color: var(--line-strong); }
.option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.option input { width: 18px; height: 18px; accent-color: var(--brand); grid-row: 1 / span 2; }
.opt-name { font-weight: 600; }
.opt-meta { color: var(--muted); font-size: 14px; grid-column: 2; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.page-review .field-error + .btn, .page-review .options + .btn { margin-top: 8px; }

/* ---------- customers ---------- */
.cust-row { position: relative; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.1fr) minmax(0, 1fr) 110px; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.cust-list li:first-child { border-top: 0; }
.cust-row:hover { background: #F7FAF9; }
.cu-phone { font-variant-numeric: tabular-nums; }
.more-count, .cu-addr { color: var(--muted); font-size: 15px; }
.cu-addr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-page { max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.form-actions { margin-top: 4px; }
.cust-phone-big { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 6px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 20px; align-items: start; }
.phone-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.phone-list li:first-child { border-top: 0; }
.panel > .section-title { margin-bottom: 6px; }
.timeline { background: var(--surface); }
.tab-panel > .timeline, .tab-panel > .state { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 20px; }
.tl-item { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: baseline; }
.timeline li:first-child { border-top: 0; }
.tl-when { color: var(--muted); font-size: 15px; }
.tl-what { display: inline-flex; align-items: flex-start; gap: 8px; text-decoration: none; overflow-wrap: anywhere; }
.tl-what:hover span { text-decoration: underline; }
.tl-what .icon { margin-top: 2px; color: var(--muted); }

/* ---------- services / settings / more ---------- */
.preview-note { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; }
.preview-note .icon { color: var(--muted); margin-top: 2px; }
.settings-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav ul { display: grid; gap: 4px; }
.settings-link { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 10px; text-decoration: none; font-weight: 600; color: var(--muted); }
.settings-link:hover { background: var(--surface); color: var(--ink); }
.settings-link[aria-current="page"] { background: var(--surface); color: var(--brand); box-shadow: inset 0 0 0 1px var(--line); }
.settings-link .only-mobile { display: none; }
.settings-content { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; min-width: 0; }
.settings-group + .settings-group { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 20px; }
.settings-content select.input { max-width: 420px; }
.settings-content .facts { margin-bottom: 20px; }
.settings-footer { margin-top: 20px; }
.calling-group { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 8px 24px; align-items: start; }
.settings-group.calling-group { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }
.settings-content > h2 + div > .calling-group:first-child, .settings-content > h1 + div > .calling-group:first-child { border-top: 0; margin-top: 0; padding-top: 4px; }
.cg-head { display: flex; align-items: center; gap: 10px; }
.cg-head .sub-title { margin: 0; }
.cg-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.cg-icon .icon { width: 18px; height: 18px; }
.cg-body > p { max-width: 60ch; }
.cg-body .text-link { margin-top: 2px; }
.cg-body > p + p { margin-top: 6px; }
.cg-rule { color: var(--muted); }
.cg-head .sub-title label { cursor: pointer; }
.calling-group .field select.input { margin-top: 0; }
.more-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.more-list li + li { border-top: 1px solid var(--line); }
.more-list .settings-link { color: var(--ink); min-height: 56px; }
.more-list .settings-link .icon:last-child { margin-left: auto; color: var(--muted); }
.page-signed-out { max-width: 520px; padding-top: 48px; display: grid; gap: 14px; justify-items: start; }

/* ---------- states ---------- */
.state { padding: 28px 20px; text-align: center; display: grid; justify-items: center; gap: 8px; }
.state-empty { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.state-title { font-weight: 650; font-size: 17px; }
.state-help { color: var(--muted); }
.state-error { background: var(--danger-bg); border: 1px solid #EBC7C7; border-left: 5px solid var(--danger); border-radius: var(--radius); text-align: left; justify-items: start; }
.state-error .state-title { color: #6B1717; }
.skeleton-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 18px; }
.skeleton-list.sk-attn { background: transparent; border: 0; padding: 0; }
.skeleton-row { display: flex; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.skeleton-row:first-child { border-top: 0; }
.sk { display: inline-block; height: 14px; border-radius: 6px; background: #E4EBE8; animation: pulse 1.4s ease-in-out infinite; }
.sk-a { width: 38%; } .sk-b { width: 22%; margin-left: auto; }
.sk-num { width: 72px; height: 34px; }
.slow-note { color: var(--muted); font-size: 14px; padding: 8px 0; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ---------- toast ---------- */
.toast-region { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 16px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(21, 36, 31, .25); }
.toast-action { background: transparent; border: 0; color: #9EE0C8; font-weight: 700; cursor: pointer; min-height: 36px; padding: 0 6px; }

/* sign-out end state: product chrome hidden */
body.bare .sidebar, body.bare .bottom-nav, body.bare .user-menu { display: none; }
body.bare .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "content"; }

/* ---------- tablet (collapsed sidebar with labels) ---------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 92px minmax(0, 1fr); }
  .sidebar { padding: 16px 8px; }
  .nav-item { flex-direction: column; justify-content: center; gap: 4px; min-height: 64px; padding: 6px 4px; font-size: 12.5px; text-align: center; }
  .nav-item[aria-current="page"]::before { left: -8px; }
  .nav-item .badge { position: absolute; top: 4px; right: 10px; margin: 0; min-width: 20px; height: 20px; font-size: 12px; }
  .main { padding: 28px 28px 56px; }
  .call-row { grid-template-columns: 36px minmax(0, 1.2fr) minmax(0, 1fr) 140px; padding: 12px 14px; }
  .split.has-detail { grid-template-columns: minmax(0, 1fr) 360px; }
  .tl-item { grid-template-columns: 160px minmax(0, 1fr); }
}

/* ---------- mobile ---------- */
@media (max-width: 767px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "content"; }
  .sidebar { display: none; }
  .topbar { padding: 0 12px; gap: 10px; }
  .brand-logo { height: 36px; }
  .company { padding-left: 10px; font-size: 15px; }
  .user-name { display: none; }
  .user-menu summary { padding: 4px; }
  .main { padding: 18px 16px 104px; }
  .page-title { font-size: 24px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0); }
  .bnav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 62px; text-decoration: none; color: var(--muted); font-size: 12.5px; font-weight: 650; }
  .bnav-item[aria-current="page"] { color: var(--brand); }
  .bnav-item[aria-current="page"] .bnav-icon::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 18px; height: 3px; margin-left: -9px; border-radius: 2px; background: var(--brand); }
  .bnav-icon { position: relative; display: inline-grid; }
  .bnav-icon .icon { width: 24px; height: 24px; }
  .badge-dot { position: absolute; top: -2px; right: -4px; min-width: 10px; width: 10px; height: 10px; padding: 0; border: 2px solid var(--surface); }
  .toast-region { bottom: 84px; }

  .search-input { height: 52px; font-size: 16px; }
  .attention { padding: 16px; }
  .attn-row .btn { width: 100%; }
  .attn-help { padding-left: 0; }
  .attn-line { font-size: 17px; }
  .kpi { padding: 14px 12px; gap: 4px; }
  .kpi-label { font-size: 13px; align-items: flex-start; flex-direction: column; gap: 4px; }
  .kpi-num { font-size: 26px; }
  .mini-row { grid-template-columns: minmax(0, 1fr) auto; }
  .mini-when { grid-column: 1; grid-row: 2; font-size: 14px; margin-top: -4px; }
  .mini-row .btn { grid-column: 2; grid-row: 1 / span 2; }

  .page-head { align-items: stretch; }
  .page-action, .page-action .btn { width: 100%; }
  .tabs { gap: 0; }
  .tab { padding: 0 9px; font-size: 15px; }
  .tab .icon { display: none; }
  .tab-long { display: none; }
  .tab-short { display: inline; }
  .call-row .chip-ok, .cust-row .chip-ok { display: none; }
  .call-row:not(.is-unknown) .cr-status { grid-column: 3; grid-row: 2; margin-top: 0; justify-content: flex-end; }
  .settings-content > .page-title { margin-bottom: 14px; }
  .call-row, .has-detail .call-row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 2px 12px; padding: 14px 16px; align-items: start; }
  .cr-badge, .has-detail .cr-badge { grid-row: 1 / span 2; width: 34px; height: 34px; }
  .cr-who { grid-column: 2 / span 2; }
  .cr-facts, .has-detail .cr-facts { grid-column: 2; grid-row: 2; flex-direction: row; flex-wrap: wrap; gap: 0 10px; }
  .cr-dur, .has-detail .cr-dur { display: inline; }
  .cr-when { font-size: 14px; }
  .cr-status, .has-detail .cr-status { grid-column: 2 / span 2; grid-row: 3; justify-content: flex-start; margin-top: 8px; }
  .call-row.is-unknown .cr-status .btn { width: 100%; }
  .row-link { font-size: 17px; }
  .cr-phone { font-size: 15px; }
  .fact { grid-template-columns: 110px minmax(0, 1fr); }
  .sticky-actions { position: sticky; bottom: 72px; z-index: 5; background: var(--bg); padding: 10px 0; margin: 12px 0 0; }
  .sticky-actions .btn { flex: 1 1 0; }
  .detail-page .detail-actions { flex-direction: row-reverse; }
  .review-card { padding: 20px 18px; }
  .review-phone { font-size: 23px; }

  .page-customers .page-action { position: fixed; left: 16px; right: 16px; bottom: 74px; z-index: 20; width: auto; }
  .page-customers .page-action .btn { box-shadow: 0 6px 18px rgba(21, 36, 31, .22); }
  .page-customers .page-head { margin-bottom: 14px; }
  .cust-row { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 14px 16px; }
  .cu-name { flex: 1 1 100%; order: 1; font-size: 17px; }
  .cu-phone { flex: 1 1 100%; order: 3; }
  .cu-addr { order: 4; }
  .cu-status { order: 5; }
  .page-customers .pager { margin-bottom: 64px; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .tl-item { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .calling-group { grid-template-columns: minmax(0, 1fr); }
  .settings-nav ul { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); gap: 0; }
  .settings-nav li + li { border-top: 1px solid var(--line); }
  .settings-link { color: var(--ink); min-height: 56px; }
  .settings-link .only-mobile { display: block; margin-left: auto; color: var(--muted); }
  .settings-content { padding: 18px 16px; }
  .form-page { padding: 18px 16px; }
  .preview-bar { padding: 6px 12px; }
  .preview-bar .pv-controls label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .preview-bar .pv-controls { flex-wrap: nowrap; }
  .preview-bar select { max-width: 150px; }
}

/* ---------- right-to-left languages (R2.3) ----------
   Grid/flex layouts mirror automatically from dir="rtl"; these rules mirror the
   remaining side-specific details. Left-to-right rendering is unchanged. */
[dir="rtl"] .icon-dir { transform: scaleX(-1); }
[dir="rtl"] [dir="ltr"] { text-align: right; }
[dir="rtl"] .company { padding-left: 0; border-left: 0; padding-right: 16px; border-right: 1px solid var(--line); }
[dir="rtl"] .user-menu { margin-left: 0; margin-right: auto; }
[dir="rtl"] .user-menu summary { padding: 4px 4px 4px 10px; }
[dir="rtl"] .menu { right: auto; left: 0; }
[dir="rtl"] .sidebar { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .nav-item[aria-current="page"]::before { left: auto; right: -12px; border-radius: 4px 0 0 4px; }
[dir="rtl"] .badge { margin-left: 0; margin-right: auto; }
[dir="rtl"] .search-icon { left: auto; right: 16px; }
[dir="rtl"] .search-input { padding: 0 50px 0 16px; }
[dir="rtl"] .attention { border-left: 1px solid #F0D3A6; border-right: 5px solid var(--attn-line); }
[dir="rtl"] .attention.is-clear { border-left-color: #C4DED4; border-right-color: var(--brand); }
[dir="rtl"] .attn-help { padding-left: 0; padding-right: 30px; }
[dir="rtl"] .kpi-row li + li { border-left: 0; border-right: 1px solid var(--line); }
[dir="rtl"] .state-error { border-left: 1px solid #EBC7C7; border-right: 5px solid var(--danger); text-align: right; }
[dir="rtl"] .step-head { margin-left: 0; margin-right: -10px; }
[dir="rtl"] .note .btn-quiet { margin-left: 0; margin-right: -8px; }
[dir="rtl"] .more-list .settings-link .icon:last-child { margin-left: 0; margin-right: auto; }
[dir="rtl"] .skip-link { left: auto; right: 12px; }
[dir="rtl"] .choice-stack .btn { justify-content: flex-start; }
@media (max-width: 1180px) {
  [dir="rtl"] .nav-item[aria-current="page"]::before { right: -8px; }
  [dir="rtl"] .nav-item .badge { right: auto; left: 10px; margin: 0; }
}
@media (max-width: 767px) {
  [dir="rtl"] .company { padding-left: 0; padding-right: 10px; }
  [dir="rtl"] .badge-dot { right: auto; left: -4px; }
  [dir="rtl"] .attn-help { padding-right: 0; }
  [dir="rtl"] .settings-link .only-mobile { margin-left: 0; margin-right: auto; }
}
