/* dashboard page «اللوحة» (#/dash/<place>): owned by the "dashboard" page builder (docs/UI_V4.md).
   The design "V4 Desktop" dashboard (main column flex 2.2 + sticky insight column max 480) and "V4 iPhone".
   Everything comes from tokens.css; sizes set by JS go through custom properties (--span, --k, --p, --c, --dash-top). */

/* ---------- Layout ---------- */
.dash-view { display: flex; flex-direction: column; gap: var(--gap-section); min-width: 0; transition: opacity 200ms var(--ease); }
.dash-view.dash-busy { opacity: .55; }
.dash { display: flex; gap: 20px; align-items: flex-start; min-width: 0; }
.dash-main { flex: 2.2 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.dash-narrow { flex: none; width: 100%; }
.dash-aside {
  align-self: flex-start; position: sticky; top: var(--dash-top, 20px); flex: 1 1 340px; min-width: 0; max-width: 480px;
  background: var(--card); border-radius: var(--r-shell); padding: 24px; display: flex; flex-direction: column; gap: 18px;
}
/* Narrow desktop / tablet: the insight column as a wide card (two columns inside) */
.dash-insight {
  position: static; max-width: none; flex: none; width: 100%;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px 28px;
}
.dash-insight-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dash-needcard { gap: 12px; }

/* ---------- Top: place + the page's controls (first row), strip of the last periods + Google link ---------- */
.dash-top { display: flex; flex-direction: column; gap: 8px; }
.dash-top-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
/* First row: the place picker, then «آخر تحديث قبل …», 🔄 «تحديث» and the period pill at the other end (js controls) */
.dash-bar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; min-width: 0; }
.dash-ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-inline-start: auto; min-width: 0; }
.dash-ctl .dash-upbtn, .dash-ctl .period-btn { height: var(--hit); padding: 0 18px; gap: 8px; font-size: var(--fs-ui); }
.dash-ctl .period-btn { background: var(--white); color: var(--ink); font-weight: 500; }
.dash-ctl .period-btn:hover { background: var(--ac); color: var(--ink); }
.dash-ctl .period-btn .ph { font-size: 16px; color: var(--ink); }
.dash-ctl .period-btn .ph:last-child { font-size: 13px; }
.dash-place {
  display: flex; align-items: center; gap: 6px; color: var(--text); font-size: var(--fs-ui); text-decoration: none;
  max-width: 220px; min-height: var(--hit); min-width: 0;
}
.dash-place:hover { color: var(--ac); }
.dash-place .ph { font-size: 14px; flex: none; }
.dash-strip { flex: 1; min-width: 260px; display: flex; align-items: center; }
.dash-step { flex: 1; display: flex; align-items: center; }
.dash-step-line { flex: 1; height: 1.5px; background: var(--raised); }
.dash-step-line.first { background: transparent; }
.dash-step-dot {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; background: #000;
  border: 1.5px solid var(--dot-off); color: var(--ink); text-decoration: none; transition: transform var(--t-fast) var(--ease);
}
.dash-step-dot:hover { transform: scale(1.12); color: var(--ink); }
.dash-step-dot.ok { background: var(--ac); border: none; }
.dash-step-dot.none { border-style: dashed; border-color: var(--raised); }
.dash-step-dot.few { opacity: .6; }
.dash-step-dot .ph { font-size: 13px; }
.dash-glink { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-ui); white-space: nowrap; min-height: var(--hit); }
.dash-glink .ph { font-size: 14px; }
.dash-strip-hint { font-size: var(--fs-meta); color: var(--muted-2); }

/* ---------- KPI row (desktop rings are all the accent, like the design) ---------- */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.dash-kpis .ring-fill.bad { stroke: var(--ac); }
.dash-kpis .kpi-label { white-space: nowrap; }
/* English: "Based on 32 reviews with text" breaks into two even lines, never one lone word on the second line */
:root[dir="ltr"] .dash-kpis .kpi-sub > span:first-child { text-wrap: balance; }
.dash-kpi-google:hover { color: var(--text); }

/* ---------- Score chart ---------- */
.dash-chart { padding: 20px 22px 16px; }
.dash-chart-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.dash-chart-title { display: flex; flex-direction: column; gap: 4px; }
.dash-chart-t { font-size: var(--fs-section); }
.dash-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.dash-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dash-stat .num { font-size: var(--fs-stat); }
.dash-stat .num .unit { font-size: 15px; }
.dash-stat-ac { color: var(--ac); }
.dash-stat-ac .unit { font-size: 14px; }
.dash-stat-l { font-size: var(--fs-small); color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dash-stat-link { color: var(--text); text-decoration: none; }
.dash-stat-link:hover { color: var(--ac); }
.dash-chart .legend { border-top: 1px solid var(--divider); padding-top: 12px; }
/* Time labels: every k-th one (js thinLabels), the selected one always; the end labels stay inside the card */
.dash-chart .lc-labels span.alt { color: var(--muted-2); }
.dash-chart .lc-labels span.dash-lh:not(.on) { color: transparent; }
.dash-chart .lc-labels span.on { color: var(--text); }
.dash-chart .lc-labels span:first-child, .dash-sb-axis span:first-child { text-align: start; }
.dash-chart .lc-labels span:last-child, .dash-sb-axis span:last-child { text-align: end; }
.dash-sb-axis span:first-child, .dash-sb-axis span:last-child { display: flex; } /* a long end label grows inwards */
.dash-sb-axis span:first-child { justify-content: flex-start; }
.dash-sb-axis span:last-child { justify-content: flex-end; }

/* ---------- «تحليل المراجعات» heading; last update + the 🔄 «تحديث» pill (top row, phone update row) ---------- */
.dash-h1row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 4px; flex-wrap: wrap; position: relative; }
.dash-h1 { margin: 0; font-size: 28px; font-weight: 400; letter-spacing: -.01em; line-height: 1.3; }
.dash-updated { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-small); color: var(--muted); white-space: nowrap; }
.dash-updated .ph { font-size: 14px; }
.dash-upbtn { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--raised); }
.dash-upbtn:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--ac); }
.dash-upbtn .ph { font-size: 17px; color: var(--ac); }

/* ---------- Bento (12 columns, design) ---------- */
.dash-bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; }
.dash-bento > * { grid-column: span var(--span, 3); }

/* Reviews card (accent): growth number + real bars, stacked by stars */
.dash-rev {
  --span: 7; background: var(--ac); color: var(--ink); border-radius: var(--r-card); padding: 20px 22px;
  display: flex; flex-direction: column; gap: 10px; min-height: 250px; min-width: 0;
}
.dash-rev-head, .dash-reply-head { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 8px; }
.dash-rev-t, .dash-reply-t { font-size: var(--fs-body); font-weight: 500; }
.dash-rev-n { display: flex; align-items: center; gap: 8px; }
.dash-rev-count { font-size: 30px; }
.dash-chip { font-size: var(--fs-small); padding: 3px 10px; border-radius: var(--r-pill); background: rgba(0, 0, 0, .14); white-space: nowrap; }
.dash-chip.light { background: var(--light-track); }
.dash-rev-big { font-size: var(--fs-hero); width: 100%; }
.dash-rev-sub {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-ui); color: var(--ink); text-decoration: none;
  align-self: flex-start; min-height: 32px;
}
.dash-rev-sub:hover { color: var(--ink); text-decoration: underline; }
.dash-rev-sub .ph { font-size: 16px; flex: none; }
.dash-sb-box { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding-top: 6px; min-width: 0; }
.dash-sb { display: flex; align-items: stretch; gap: 8px; height: 128px; }
.dash-sb-col {
  flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px;
  color: var(--ink); text-decoration: none; border-radius: 14px;
}
.dash-sb-col:hover { color: var(--ink); }
.dash-sb-col:hover .dash-sb-bar { box-shadow: 0 0 0 2px #000; }
.dash-sb-n { font-family: var(--font-num); font-size: var(--fs-small); line-height: 1; text-align: center; white-space: nowrap; }
.dash-sb-bar {
  flex: none; height: calc((100% - 15px) * var(--k, 0)); min-height: 8px; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column-reverse; background: rgba(0, 0, 0, .14); transition: height var(--m-dur, var(--t-bar)) var(--ease);
}
.dash-sb-bar.zero { min-height: 4px; }
.dash-sb-n.zero { opacity: .45; }
.dash-sb-part { flex: none; height: var(--p, 0%); background: var(--c, #000); }
.dash-sb-axis { display: flex; gap: 8px; }
.dash-sb-axis span { flex: 1; min-width: 0; text-align: center; font-size: var(--fs-tiny); white-space: nowrap; color: var(--ink-2); }
.dash-rev .legend { color: var(--ink-2); gap: 6px 12px; font-size: var(--fs-tiny); }
.dash-rev .legend .swatch { width: 9px; height: 9px; border-radius: 50%; }
.dash-sb-unit { color: var(--ink-2); }

/* Replies card (white) */
.dash-reply {
  --span: 5; text-align: start; border: none; background: var(--white); color: var(--ink); border-radius: var(--r-card);
  padding: 20px 22px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; min-width: 0;
  font: inherit; transition: transform var(--t-fast) var(--ease);
}
button.dash-reply:hover { transform: translateY(-2px); }
.dash-reply-count { font-size: 26px; }
.dash-reply-rows { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.dash-reply-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--fs-meta); color: var(--ink-3); }
.dash-reply-row.gap { padding-top: 6px; }
.dash-reply-row .strong { color: var(--ink); font-weight: 600; }
.dash-reply .hbar { flex: none; width: 100%; height: 8px; }
.dash-reply-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; width: 100%; }
.dash-reply-big { font-size: 54px; }
.dash-reply-of { font-size: var(--fs-meta); color: var(--ink-3); padding-bottom: 6px; }
.dash-reply-note { font-size: var(--fs-small); color: var(--ink-3); line-height: 1.6; }

/* Topic tiles (the colour rule) and the weak-topics stack */
.dash-tile { min-height: 160px; }
.dash-tile-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; width: 100%; }
.dash-tile-name { font-size: var(--fs-ui); font-weight: 500; line-height: 1.5; min-width: 0; }
.dash-tile-tags { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
/* English topic names are longer ("Service and orders"): the mentions pill moves under a name that has no room */
:root[dir="ltr"] .dash-tile-top { flex-wrap: wrap; }
.dash-pill { font-size: var(--fs-small); padding: 3px 10px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .55); white-space: nowrap; }
.tone-raised .dash-pill, .tone-inner .dash-pill { background: rgba(255, 255, 255, .12); }
.dash-tile-bottom { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.dash-tile-split { font-size: var(--fs-meta); color: var(--ink-2); }
.tone-raised .dash-tile-split { color: var(--muted); }
.dash-tile-num { font-size: var(--fs-tile); }
.dash-tile-num .unit { font-size: 16px; }
.dash-weak { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dash-weak-tile { flex: 1; border-radius: var(--r-tile-sm); padding: 14px 16px; gap: 8px; }
.dash-weak-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; width: 100%; font-size: var(--fs-ui); }
/* English: a long topic name ("Policies and other things") gets the full width, its complaints count goes under it */
:root[dir="ltr"] .dash-weak-top { flex-wrap: wrap; align-items: flex-start; }
.dash-weak-c { font-size: var(--fs-small); color: var(--bad); white-space: nowrap; }
.dash-weak-bottom { display: flex; justify-content: space-between; align-items: baseline; width: 100%; }
.dash-weak-num { font-size: 28px; }
.dash-weak-num .unit { font-size: 13px; color: #9A9A9A; }
.dash-weak-bottom .ph { font-size: 16px; color: var(--bad); }
.dash-topics-foot { display: flex; justify-content: flex-end; margin-top: -10px; }
.dash-link { display: inline-flex; align-items: center; gap: 4px; min-height: var(--hit); font-size: var(--fs-ui); color: var(--text); white-space: nowrap; }

/* ---------- Employees (small) + «الناس منقسمون» ---------- */
.dash-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.dash-pair .card-head { align-items: center; }
.dash-pair .dash-link { min-height: 32px; font-size: var(--fs-meta); }
.dash-people { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.dash-person {
  border-radius: var(--r-tile-sm); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  text-decoration: none; transition: transform var(--t-fast) var(--ease);
}
.dash-person:hover { transform: translateY(-2px); }
.dash-person.best, .dash-person.best:hover { background: var(--ac); color: var(--ink); }
.dash-person.low, .dash-person.low:hover { background: var(--raised); color: var(--text); }
.dash-person-l { font-size: var(--fs-small); opacity: .7; }
.dash-person-name { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: start; }
.dash-person-c { font-size: var(--fs-meta); }
.dash-person-c .bad { color: var(--bad-text); }
.dash-person-q { font-size: var(--fs-meta); line-height: 1.6; opacity: .85; text-align: start; }
/* English: an Arabic name keeps its own direction (bdi) but starts on the page's side, under «Most praised» */
:root[dir="ltr"] .dash-person-name { text-align: left; }
/* the yellow «تقييمات متشابهة» notes: one compact card, the newest 2 inside, the rest open in place */
.dash-notes-list, .dash-notes-rest { display: flex; flex-direction: column; }
.dash-notes-rest[hidden] { display: none; }
.dash-note-item { display: flex; flex-direction: column; gap: 8px; padding-block: 10px; border-top: 1px solid color-mix(in srgb, currentColor 16%, transparent); }
.dash-note-item:first-child { border-top: none; padding-top: 0; }
.dash-note-line { line-height: 1.7; }
.dash-notes-toggle { align-self: flex-start; padding: 0 12px; gap: 6px; }
.dash-staff-count { font-size: var(--fs-meta); color: var(--muted); line-height: 1.7; }
.dash-split-row { display: flex; flex-direction: column; gap: 8px; }
.dash-split-head { display: flex; align-items: center; gap: 8px; }
.dash-split-name { flex: 1; min-width: 0; font-size: var(--fs-body); text-decoration: none; }
.dash-split-counts { display: flex; flex-wrap: wrap; gap: 6px; font-size: var(--fs-small); color: var(--muted-2); }
.dash-split-counts a { text-decoration: none; }
.dash-split-counts .bad { color: var(--bad-text); }
.dash-split-counts .good { color: var(--good-text); }
.dash-split-counts .mixed { color: var(--soft); }
.dash-parts { display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.dash-part { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 10px; font-size: var(--fs-small); color: var(--muted); }

/* ---------- «الأكثر حباً» / «الأكثر شكوى» (items) ---------- */
.dash-items-honest { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: -6px; }
.dash-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.dash-item {
  border-radius: var(--r-tile-sm); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
  background: var(--card-2); color: var(--text); min-width: 0;
}
.dash-item.top { background: var(--ac); color: var(--ink); }
.dash-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dash-item-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-body); }
.dash-rank {
  font-family: var(--font-num); font-size: var(--fs-meta); width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--white); color: var(--ink);
}
.dash-item.top .dash-rank { background: #000; color: var(--text); }
.dash-item.bad .dash-rank { background: var(--bad); color: var(--ink); }
.dash-item-ic { font-size: 18px; flex: none; opacity: .7; }
.dash-item-nums { display: flex; align-items: baseline; gap: 6px; }
.dash-item-big { font-size: 34px; }
.dash-item.bad .dash-item-big { color: var(--bad-text); }
.dash-item-w { font-size: var(--fs-small); opacity: .7; }
.dash-item-other { font-size: var(--fs-small); margin-inline-start: auto; color: var(--muted); white-space: nowrap; }
.dash-item-other.warn { color: var(--bad-text); }
.dash-item.top .dash-item-other { color: var(--ink); }
/* the design's item bar: praise first (right), complaints after it, on a track */
.dash-item .split { flex-direction: row-reverse; background: var(--raised); }
.dash-item.top .split { background: rgba(0, 0, 0, .12); }
.dash-item-q { font-size: var(--fs-meta); line-height: 1.6; opacity: .85; text-align: start; color: inherit; text-decoration: none; }
.dash-item-q:hover { color: inherit; text-decoration: underline; }
.dash-items-sub { display: flex; align-items: center; gap: 8px; font-size: 18px; padding-top: 6px; }
.dash-items-sub .ph { color: var(--bad); font-size: 18px; }

/* ---------- «معلومات أخرى» ---------- */
.dash-extras { gap: 0; }
.dash-extras > summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer;
  min-height: var(--hit);
}
.dash-extras > summary::-webkit-details-marker { display: none; }
.dash-caret { font-size: 18px; color: var(--muted); transition: transform var(--t-fast) var(--ease); }
.dash-extras[open] .dash-caret { transform: rotate(180deg); }
.dash-extras-body { display: flex; flex-direction: column; gap: 4px; padding-top: 10px; }
.dash-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: var(--fs-ui);
  padding: 10px 0; border-bottom: 1px solid var(--divider);
}
.dash-row > span:first-child { color: var(--muted); }
.dash-row-v { text-align: end; }
.dash-extras-h { font-size: var(--fs-body); padding-top: 12px; }
.dash-nc-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; padding-top: 6px; }
.dash-nc {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: var(--r-inner);
  background: var(--card-2); color: var(--text); text-decoration: none; min-width: 0;
}
.dash-nc:hover { color: var(--text); background: var(--raised); }
.dash-nc-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dash-nc-head .hint { white-space: nowrap; }
.dash-nc-text { font-size: var(--fs-meta); line-height: 1.6; text-align: start; }
.dash-nc-st { font-size: var(--fs-small); padding: 1px 9px; border-radius: var(--r-pill); margin-inline-start: auto; }
:root[dir="ltr"] .dash-nc-st { white-space: nowrap; } /* "No reply" stays one pill */
.dash-nc-st.ok { background: var(--tag-good); color: var(--good-text); }
.dash-nc-st.no { background: var(--tag-bad); color: var(--bad-text); }
.dash-monthly { align-self: flex-start; margin-top: 12px; }

.dash-foot { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-meta); color: var(--muted-2); line-height: 1.7; }

/* ---------- Insight column ---------- */
.dash-eyebrow { display: flex; align-items: center; gap: 8px; font-size: var(--fs-meta); color: var(--ac); }
.dash-eyebrow .ph-fill { font-size: 15px; }
.dash-verdict { display: flex; flex-direction: column; gap: 6px; }
.dash-verdict-t { font-size: var(--fs-h2); line-height: 1.55; text-wrap: pretty; }
.dash-health { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--divider); }
.dash-health-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dash-health-t { font-size: var(--fs-body); }
.dash-status { font-size: var(--fs-meta); padding: 3px 12px; border-radius: var(--r-pill); white-space: nowrap; background: var(--white); color: var(--ink); }
.dash-status.good { background: var(--ac); }
.dash-status.bad { background: var(--bad); }
.dash-status.warn { background: var(--alert-amber); }
.dash-status.few { background: transparent; border: 1px solid var(--raised); color: var(--muted); }
.dash-reasons { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.dash-reasons li { position: relative; padding-inline-start: 16px; font-size: var(--fs-ui); line-height: 1.65; color: var(--soft); }
.dash-reasons li::before {
  content: ''; position: absolute; inset-inline-start: 0; top: .72em; width: 6px; height: 6px; border-radius: 50%; background: var(--ac);
}
.dash-health-note { font-size: var(--fs-small); color: var(--muted-2); line-height: 1.6; }
.dash-cgbox { display: flex; flex-direction: column; gap: 14px; }
.dash-cg { display: flex; gap: 14px; align-items: stretch; }
.dash-cg-num { display: flex; flex-direction: column; justify-content: center; gap: 4px; flex: none; color: var(--text); text-decoration: none; }
.dash-cg-num:hover { color: var(--text); }
.dash-cg-num:hover .dash-cg-t { color: var(--text); }
.dash-cg-big { font-size: 50px; }
.dash-cg-t { font-size: var(--fs-meta); color: var(--muted); max-width: 130px; line-height: 1.5; }
.dash-area { flex: 1; position: relative; height: 190px; min-width: 0; margin-inline-end: 16px; }
.dash-area svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.dash-area-y {
  /* dir-ok: the axis is dir="ltr" (its digits), so a logical side would point at its own LTR end; the page's end side
     is the left in Arabic, the right in English (the rule below) */
  position: absolute; top: 0; bottom: 0; left: -6px; transform: translateX(-100%); display: flex; flex-direction: column;
  justify-content: space-between; font-family: var(--font-num); font-size: var(--fs-small); color: var(--muted); line-height: 1;
}
:root[dir="ltr"] .dash-area-y { left: auto; right: -6px; transform: translateX(100%); }
.dash-cg-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: var(--fs-meta); color: var(--soft); }
.dash-calm { display: flex; align-items: center; gap: 8px; font-size: var(--fs-ui); color: var(--muted); line-height: 1.6; }
.dash-calm .ph { font-size: 18px; color: var(--ac); flex: none; }
.dash-tip-link {
  display: inline; border: none; background: none; padding: 0; font: inherit; color: var(--ac); text-decoration: underline;
  text-underline-offset: 4px; cursor: pointer;
}
.dash-tip-link:hover { color: var(--ac); }

/* «تحتاج رد»: the shared review card arranged like the design's carousel card (stars + badge, text,
   author · date, one black button «افتح في قوقل») */
.dash-need { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dash-need-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 6px; }
.dash-need-t { font-size: 18px; white-space: nowrap; }
.dash-need-n { color: var(--muted-2); }
.dash-need-nav { display: flex; gap: 8px; }
.dash-nav-btn { width: var(--hit); height: var(--hit); border-radius: 50%; border: none; display: grid; place-items: center; transition: opacity var(--t-fast); }
.dash-nav-btn .ph { font-size: 18px; }
.dash-nav-btn.prev { background: var(--raised); color: var(--text); }
.dash-nav-btn.next { background: var(--white); color: var(--ink); }
.dash-nav-btn:disabled { opacity: .4; }
/* Two cards a page, side by side while each gets 200px or more; in the narrow insight column (an iPad in landscape,
   about 300px) they stack, one under the other, instead of two thin cards that break the text into short lines */
.dash-need-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; align-items: start; }
.dash-need .hint { min-width: 0; overflow-wrap: anywhere; }
.dash-dots { align-self: center; display: flex; gap: 6px; padding: 6px 10px; border-radius: var(--r-pill); background: #000; }
.dash-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--dot-off); }
.dash-dots span.on { background: var(--white); }
.dash-need .rcard { border-radius: var(--r-tile); padding: 16px; gap: 10px; min-width: 0; }
.dash-need .rcard-head { display: contents; }
.dash-need .rcard-av, .dash-need .tags { display: none; }
.dash-need .rcard.dash-need-sk { display: block; background: var(--card-2); min-height: 150px; }
.dash-need .rcard-side { order: -1; flex-direction: row; align-items: center; justify-content: space-between; gap: 6px; width: 100%; }
.dash-need .rcard-text { flex: 1; font-size: var(--fs-ui); line-height: 1.65; }
.dash-need .rcard-who { order: 2; flex: none; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: var(--fs-small); color: var(--ink-2); }
.dash-need .rcard-author { font-size: var(--fs-small); max-width: 100%; }
.dash-need .rcard-meta { opacity: 1; }
.dash-need .rcard-meta::before { content: '·'; }
.dash-need .rcard-actions { order: 3; padding-top: 0; }
.dash-need .rcard-actions .btn { flex: 1; height: 40px; background: #000; color: var(--text); font-weight: 500; }
.dash-need .rcard-actions .btn:hover { color: var(--text); text-decoration: none; }
.dash-need .old-line { margin-top: 2px; }
/* A narrow card (English, or an iPad): "Reply soon" drops under the stars and "Open in Google" goes to two lines
   instead of sticking out of the card (one line, as before, when it fits) */
.dash-need .rcard-side { flex-wrap: wrap; }
@media (min-width: 701px) {
  .dash-need .rcard-actions .btn {
    min-width: 0; height: auto; min-height: 40px; padding-block: 8px; white-space: normal; line-height: 1.3; text-align: center;
  }
}

/* ---------- Tablet: a little tighter ---------- */
@media (max-width: 1099px) {
  .dash-bento { gap: 10px; }
  .dash-tile { padding: 16px; }
  .dash-tile-num { font-size: 34px; }
  /* the KPIs stay in one row (no lone third tile under the other two); a long label wraps inside its tile */
  .dash-kpis { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .dash-kpis .kpi-label { white-space: normal; }
}
/* Four topic cells (the bento's 6 children: 3 tiles + the weak stack, or 4 tiles) are too narrow in one row under
   960 px (the weak stack ran out of the page at 768 px): two rows of two */
@media (max-width: 959px) {
  .dash-bento:has(> :nth-child(6)) > .dash-tile, .dash-bento:has(> :nth-child(6)) > .dash-weak { grid-column: span 6; }
}

/* ---------- Phone (design "V4 iPhone") ---------- */
.dash-phone { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dash-uprow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dash-phone .dash-upbtn { height: var(--hit); }
/* The period chips at the top: all four in view (they wrap on a very narrow screen), never a side-scrolling row */
.dash-phone .period-chips.hscroll { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; gap: 6px; }
.dash-phone .period-chips .fchip { flex: 1 1 auto; justify-content: center; padding: 0 12px; }
/* English names are longer ("Last 3 months"): the four do not fit one row, so two even rows of two, not 3 + 1 */
:root[dir="ltr"] .dash-phone .period-chips .fchip { flex-basis: calc(50% - 3px); }
/* Arabic too on a very narrow phone (320 px): the four do not fit one row, so two rows of two, not 3 + a lone one */
@media (max-width: 359px) { .dash-phone .period-chips .fchip { flex-basis: calc(50% - 3px); } }
.dash-pverdict { padding: 16px 18px; gap: 8px; }
.dash-phone .dash-verdict-t { font-size: 18px; line-height: 1.6; }
.dash-phone .dash-health { padding-top: 12px; }
.dash-phone .dash-rev { border-radius: 26px; padding: 16px 18px; gap: 6px; min-height: 0; }
.dash-phone .dash-rev-count { font-size: 24px; }
.dash-phone .dash-chip { font-size: var(--fs-tiny); padding: 2px 8px; }
.dash-phone .dash-rev-sub { font-size: var(--fs-meta); min-height: var(--hit); }
.dash-phone .dash-sb { height: 112px; gap: 6px; }
.dash-phone .dash-sb-axis { gap: 6px; }
.dash-phone .dash-sb-bar { border-radius: 12px; }
.dash-phone .dash-sb-n { font-size: var(--fs-tiny); }
.dash-phone .dash-chart { border-radius: 26px; padding: 16px 16px 12px; gap: 12px; }
.dash-phone .dash-chart-head { align-items: stretch; flex-direction: column; gap: 12px; }
.dash-phone .dash-chart-title { flex-direction: row; justify-content: space-between; align-items: center; gap: 8px; }
.dash-phone .dash-chart-t { font-size: 18px; }
.dash-phone .dash-chart .hint-row { font-size: var(--fs-tiny); }
.dash-phone .dash-stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 6px; }
.dash-phone .dash-stat { gap: 2px; }
.dash-phone .dash-stat .num { font-size: 24px; }
.dash-phone .dash-stat .num .unit { font-size: 13px; }
.dash-phone .dash-stat-ac .unit { font-size: 12px; }
.dash-phone .dash-stat-l { font-size: var(--fs-tiny); }
.dash-phone .dash-stat-l .badge { display: none; }
.dash-phone .dash-chart .legend { font-size: var(--fs-tiny); gap: 16px; padding-top: 10px; }
.dash-pkpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dash-pkpis > .dash-kpi-google { grid-column: 1 / -1; min-height: 0; }
.dash-pkpis .kpi-sub > span:first-child { white-space: normal; }
.dash-phone .dash-reply { border-radius: var(--r-card); padding: 16px 18px; }
.dash-phone .dash-reply-big { font-size: 44px; }
.dash-psec { display: flex; flex-direction: column; gap: 10px; }
.dash-phead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 6px; }
.dash-phead-t { font-size: 18px; }
.dash-all {
  display: inline-flex; align-items: center; min-height: var(--hit); padding: 0 4px; border: none; background: transparent;
  color: var(--muted); font-size: var(--fs-meta); text-decoration: none;
}
.dash-ptiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dash-ptile { border-radius: var(--r-tile); padding: 14px; min-height: 112px; gap: 8px; }
.dash-ptile-top { display: flex; justify-content: space-between; gap: 6px; width: 100%; }
.dash-ptile-name { font-size: var(--fs-meta); line-height: 1.5; min-width: 0; }
.dash-ptile-note { font-size: var(--fs-tiny); white-space: nowrap; color: var(--bad); }
.dash-ptile-note.plain { color: inherit; opacity: .6; }
.dash-ptile-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; width: 100%; }
.dash-ptile-num { font-size: 30px; }
.dash-ptile-num .unit { font-size: 13px; opacity: .55; }
.dash-need-row { gap: 10px; scroll-snap-type: x mandatory; padding-bottom: 4px; align-items: stretch; }
.dash-need-row .rcard { flex: none; width: 280px; scroll-snap-align: start; }
.dash-pcomp { gap: 14px; }
.dash-pgoogle { align-self: stretch; }

@media (max-width: 700px) {
  .dash-pair { grid-template-columns: minmax(0, 1fr); }
  .dash-items-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-item { padding: 12px 14px; gap: 8px; }
  .dash-item-big { font-size: 28px; }
  .dash-item-other { white-space: normal; }
  .dash-items .card-head { align-items: flex-start; }
  .dash-items .seg { width: 100%; }
  .dash-items .seg button { flex: 1; height: 44px; }
  .dash-extras-body .dash-row { flex-wrap: wrap; }
  .dash-row-v { text-align: start; }
  .dash-cg-big { font-size: 40px; }
  .dash-area { height: 150px; }
  .dash-verdict-t { font-size: 18px; }
  .dash-split-head { flex-wrap: wrap; }
  .dash-part { grid-template-columns: 60px 1fr auto; }
  /* English item names are longer ("Cheesecake", "London cake"): a smaller name on up to two lines, not cut with «…»;
     the small drink / food picture gives its room to the name (the Drinks / Food tabs say the type) */
  :root[dir="ltr"] .dash-item-name { font-size: var(--fs-ui); }
  :root[dir="ltr"] .dash-item-ic { display: none; }
  :root[dir="ltr"] .dash-item-name .ellipsis {
    white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; line-height: 1.3;
  }
}
@media (max-width: 700px) {
  /* "Monthly report: what changed this month" is longer than its Arabic: it wraps inside the «معلومات أخرى» card
     instead of running past it (English only: Arabic as before) */
  :root[dir="ltr"] .dash-monthly {
    max-width: 100%; white-space: normal; height: auto; min-height: var(--hit); padding-block: 10px; line-height: 1.4;
  }
}
@media (max-width: 380px) {
  .dash-items-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-phone .dash-stat .num { font-size: 20px; }
}
/* Phone tap targets (44 px): small links get a larger invisible tap area, the layout does not move */
@media (max-width: 700px) {
  .dash-sb-col { position: relative; }
  .dash-sb-col::after { content: ''; position: absolute; inset: 0 -4px; } /* the column's whole share of the row */
  .dash-stat-link, .dash-tip-link, .dash-row-v a { position: relative; }
  .dash-stat-link::after { content: ''; position: absolute; inset: -10px -4px; }
  .dash-tip-link::after { content: ''; position: absolute; inset: -11px 0; }
  .dash-row-v a::after { content: ''; position: absolute; inset: -13px -6px; }
  .dash-pair .dash-link { min-height: var(--hit); }
  .dash-all { min-width: var(--hit); justify-content: flex-end; }
  .dash-item-q { position: relative; z-index: 1; padding-block: 12px; margin-block: -12px; }
}
/* A period switch that takes long says so, over the dimmed old numbers (js load(): after 5 s) */
.dash-slow {
  position: fixed; z-index: 30; bottom: 24px; inset-inline: 0; margin-inline: auto; width: max-content;
  max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 8px; padding: 10px 18px;
  border-radius: var(--r-pill); background: var(--card-2); color: var(--text); font-size: var(--fs-meta);
  animation: m-pop 240ms var(--ease);
}
.dash-slow .ph { font-size: 16px; color: var(--ac); flex: none; }
@media (max-width: 700px) { .dash-slow { bottom: calc(96px + env(safe-area-inset-bottom)); } }

/* A problem-only topic (core/problem.js: restaurant food safety): the level and «N شكوى من M مراجعة (x%)» instead of a score */
.dash-tile-prob { gap: 10px; align-items: flex-start; }
.dash-tile-prob .dash-tile-split { line-height: 1.6; }
.dash-weak-line { width: 100%; font-size: var(--fs-small); color: var(--muted); line-height: 1.6; }
.dash-ptile-prob { flex-direction: column; align-items: flex-start; }
.dash-ptile-pline { font-size: var(--fs-tiny); opacity: .75; line-height: 1.5; }

.dash-upinfo { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; min-width: 0; }
