/* #/monthly/<place> «التقرير الشهري» and the report view that share.html uses too (js/pages/monthly.js).
   Built from the design's own pieces: the dashboard's main column + analysis column, KPI tiles, the topics page's
   best / worst cards, the «الأكثر حباً» item cards, review cards. Tokens only (css/tokens.css). */

/* ---------- Head: month switch + share ---------- */
.mo-head-end { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mo-picker { display: flex; align-items: center; gap: 8px; }
.mo-picker .btn-raised { background: var(--raised); color: var(--text); }
.mo-picker .btn-icon:disabled { opacity: .35; }
.mo-pick { gap: 8px; }
.mo-pick > .ph-calendar-blank { font-size: 16px; color: var(--ac); }
.mo-pick-n { font-family: var(--font-num); color: var(--muted-2); }
.mo-menu { inset-inline-start: 0; inset-inline-end: auto; min-width: 250px; max-height: min(420px, 60vh); overflow-y: auto; overscroll-behavior: contain; }
.mo-menu button { min-height: 44px; height: auto; padding: 8px 14px; }
.mo-mi-l { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
:root[dir="ltr"] .mo-mi-l { white-space: nowrap; } /* "October 2026" stays on one line (English only: Arabic as before) */
.mo-mi-sub { font-size: var(--fs-small); color: var(--muted-2); }
.mo-mi-r { display: flex; align-items: center; gap: 10px; }
.mo-mi-n { font-size: var(--fs-small); color: var(--muted); white-space: nowrap; }
.mo-mi-n.zero { color: var(--muted-2); }

.mo-tip { align-items: flex-start; }
.mo-tip-text { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }

/* ---------- Layout: main column + the analysis column (design: flex 2.2 / max 480) ---------- */
.mo-body { display: flex; flex-direction: column; gap: var(--gap-section); }
.mo-layout { display: flex; gap: 20px; align-items: flex-start; }
.mo-main { flex: 2.2 1 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.mo-aside { flex: 1 1 340px; min-width: 0; max-width: 480px; display: flex; flex-direction: column; gap: 14px; }
/* The analysis column stays in view while the long main column scrolls, like the dashboard and home side columns
   (js/pages/monthly.js sets --mo-top so a column taller than the window sticks by its bottom instead) */
@media (min-width: 1100px) {
  .mo-layout:not(.sh-layout) > .mo-aside { position: sticky; top: var(--mo-top, 20px); align-self: flex-start; }
}
@media (max-width: 1099px) {
  .mo-layout { flex-direction: column; align-items: stretch; }
  .mo-aside { order: -1; max-width: none; }
}
@media (max-width: 700px) {
  .mo-main, .mo-aside { gap: var(--gap-section); }
}

/* ---------- Summary (the dashboard's analysis column) and honesty notes ---------- */
.mo-summary { gap: 14px; }
.mo-eyebrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-meta); color: var(--ac); }
.mo-eyebrow > .ph-fill, .mo-eyebrow > .ph { font-size: 15px; }
.mo-eyebrow .badge { color: var(--muted); }
.mo-verdict { font-size: 22px; line-height: 1.55; text-wrap: pretty; }
.mo-lines { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.mo-lines li { position: relative; padding-inline-start: 18px; font-size: var(--fs-body); line-height: 1.7; color: var(--soft); }
.mo-lines li::before {
  content: ''; position: absolute; inset-inline-start: 2px; top: .72em; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ac);
}
.mo-notes { display: flex; flex-direction: column; gap: 8px; }
.mo-note {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-inner);
  background: var(--card); color: var(--soft-2); font-size: var(--fs-ui); line-height: 1.6;
}
.mo-note > .ph { font-size: 18px; color: var(--alert-amber); flex: none; margin-top: 2px; }

/* ---------- KPI tiles: 2 x 2 (phone: the design's two tiles per row) ---------- */
.mo-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* ---------- Better / worse (the topics page's «أفضل» accent card and «أسوأ» white card) ---------- */
.mo-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
@media (max-width: 700px) { .mo-two { grid-template-columns: 1fr; } }
.mo-move { border-radius: var(--r-tile); padding: 16px 18px; gap: 10px; }
.mo-move-h { display: flex; align-items: center; gap: 8px; font-size: var(--fs-body); font-weight: 500; }
.mo-move-h .ph { font-size: 18px; }
.mo-move.is-worse .mo-move-h .ph { color: var(--bad-warn); }
.mo-move-rows { display: flex; flex-direction: column; gap: 8px; }
.mo-move-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-chip);
  text-decoration: none; color: inherit; min-height: 44px; transition: background var(--t-fast);
}
.is-better .mo-move-row { background: rgba(0, 0, 0, .08); }
.is-better a.mo-move-row:hover { background: rgba(0, 0, 0, .16); color: inherit; }
.is-worse .mo-move-row { background: var(--light-row); }
.is-worse a.mo-move-row:hover { background: var(--light-row-hover); color: inherit; }
.mo-rank {
  font-family: var(--font-num); font-size: 13px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; flex: none; background: #000; color: var(--text);
}
.is-worse .mo-rank { background: var(--bad); color: var(--ink); }
.mo-move-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-ui); }
.mo-move-meta { font-size: var(--fs-small); opacity: .7; }
.mo-move-nums { display: flex; align-items: center; gap: 6px; flex: none; }
.mo-move-nums .ph { font-size: 13px; opacity: .55; }
.mo-before { opacity: .55; }
.mo-move-empty { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-ui); line-height: 1.6; }
.mo-move-rule { font-size: var(--fs-small); opacity: .65; }

/* ---------- Loves / complaints: the design's «الأكثر حباً» item cards ---------- */
.mo-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.mo-item {
  border-radius: var(--r-tile-sm); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
  min-width: 0; text-decoration: none; transition: transform var(--t-fast) var(--ease);
}
a.mo-item:hover { transform: translateY(-2px); color: inherit; }
a.mo-item.on-light:hover { color: var(--ink); }
.mo-item-h { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mo-item-name { flex: 1; min-width: 0; font-size: var(--fs-body); line-height: 1.4; }
.mo-item .mo-rank { background: var(--white); color: var(--ink); }
.mo-item.top .mo-rank { background: #000; color: var(--text); }
.mo-item.tone-raised .mo-rank { background: var(--bad); color: var(--ink); }
.mo-item-nums { display: flex; align-items: baseline; gap: 6px; }
:root[dir="ltr"] .mo-item-nums { flex-wrap: wrap; gap: 0 6px; } /* wraps when the words are long (English only) */
.mo-item-big { font-size: 34px; }
.mo-item.tone-raised .mo-item-big { color: var(--bad); }
.mo-item-unit { font-size: var(--fs-small); opacity: .7; }
.mo-item-other { font-size: var(--fs-small); margin-inline-start: auto; color: var(--muted); white-space: nowrap; }
.mo-item-other.warn { color: var(--bad-text); }
.mo-item.on-light .mo-item-other { color: var(--ink); }
.mo-ibar { display: flex; height: 6px; border-radius: var(--r-pill); overflow: hidden; gap: 2px; background: var(--raised); }
.mo-ibar > span { width: var(--w, 0%); border-radius: var(--r-pill); transition: width var(--m-dur, var(--t-bar)) var(--ease); }
.mo-ibar > .p { background: var(--ac); }
.mo-ibar > .c { background: var(--bad); }
.mo-item.on-light .mo-ibar { background: rgba(0, 0, 0, .12); }
.mo-item.on-light .mo-ibar > .p { background: #000; }
.mo-item.tone-raised .mo-ibar { background: rgba(255, 255, 255, .12); }
.mo-item-q { font-size: var(--fs-meta); line-height: 1.6; opacity: .85; text-align: start; }

/* ---------- All topics: name · split · score (tile colour rule) · last month ---------- */
.mo-tlist { display: flex; flex-direction: column; }
.mo-trow {
  display: grid; grid-template-columns: minmax(130px, 1.1fr) minmax(0, 1.6fr) 72px 60px; gap: 14px;
  align-items: center; padding: 10px 8px; border-top: 1px solid var(--divider); text-decoration: none; color: inherit;
  border-radius: 12px; transition: background var(--t-fast);
}
.mo-trow.no-prev { grid-template-columns: minmax(130px, 1.1fr) minmax(0, 1.6fr) 72px; }
.mo-thead { border-top: none; padding-top: 0; font-size: var(--fs-small); color: var(--muted-2); }
a.mo-trow:hover { background: rgba(255, 255, 255, .04); color: inherit; }
.mo-t-name { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-ui); min-width: 0; }
.mo-t-meta { font-size: var(--fs-small); color: var(--muted-2); }
.mo-t-title { gap: 6px; }
.mo-t-score, .mo-t-prev { justify-self: center; text-align: center; }
.mo-t-prev { font-family: var(--font-num); font-size: 15px; color: var(--muted-2); }
.mo-thead .mo-t-prev { font-family: var(--font-ui); font-size: var(--fs-small); }
.mo-t-none { display: block; height: 6px; border-radius: var(--r-pill); background: var(--track); }
.mo-t-dash { color: var(--muted-2); font-family: var(--font-num); }
.mo-pill {
  display: inline-block; min-width: 50px; padding: 4px 10px; border-radius: var(--r-pill); text-align: center;
  font-family: var(--font-num); font-size: 15px; font-weight: 500; line-height: 1.3;
}
.mo-pill.tone-inner { background: var(--card-2); }
@media (max-width: 700px) {
  .mo-trow, .mo-trow.no-prev {
    grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name score prev" "bar bar bar";
    gap: 8px 12px; padding: 12px 4px;
  }
  .mo-trow.no-prev { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name score" "bar bar"; }
  .mo-t-name { grid-area: name; }
  .mo-t-bar { grid-area: bar; }
  .mo-t-score { grid-area: score; }
  .mo-t-prev { grid-area: prev; min-width: 36px; }
  .mo-thead .mo-t-bar { display: none; }
}

/* ---------- Side cards: new complaints, problems that grew ---------- */
.mo-side-rows { display: flex; flex-direction: column; gap: 6px; }
.mo-side-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 48px; border-radius: var(--r-chip);
  background: var(--card-2); text-decoration: none; color: inherit; transition: background var(--t-fast);
}
a.mo-side-row:hover { background: var(--raised); color: inherit; }
.mo-side-name { font-size: var(--fs-ui); }
.mo-side-n { font-size: var(--fs-meta); color: var(--muted); margin-inline-start: auto; text-align: end; }
.mo-side-n.bad-text { color: var(--bad-text); }
.mo-go { font-size: 14px; color: var(--muted-2); flex: none; }

/* ---------- Employees (the staff page's card, smaller) ---------- */
.mo-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.mo-person {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "av name" "nums nums"; gap: 12px;
  padding: 14px 16px; border-radius: var(--r-tile-sm); background: var(--card-2); text-decoration: none; color: inherit;
  transition: background var(--t-fast);
}
a.mo-person:hover { background: var(--raised); color: inherit; }
.mo-av { grid-area: av; width: 44px; height: 44px; border-radius: 50%; padding: 3px; background: var(--ac); flex: none; }
.mo-av > span {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; background: var(--card-2);
  color: var(--text); font-size: 16px;
}
.mo-person.warn .mo-av { background: var(--bad); }
.mo-person-name { grid-area: name; align-self: center; font-size: var(--fs-body); }
.mo-person-nums { grid-area: nums; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mo-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.mo-stat-l { font-size: var(--fs-small); color: var(--muted-2); }

/* ---------- Examples (shared review cards, each with why it was picked) ---------- */
.mo-examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; align-items: start; }
.mo-example { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mo-why { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-small); color: var(--muted); }
.mo-why .ph { font-size: 14px; }
.mo-why.good .ph { color: var(--good-text); }
.mo-why.bad .ph { color: var(--bad-text); }

.mo-foot { padding: 2px 4px 0; line-height: 1.7; }

/* ---------- Share drawer ---------- */
.mo-link { height: 52px; padding: 0 18px; }
.mo-link > .ph { color: var(--muted-2); font-size: 18px; }
.mo-link-input { font-family: var(--font-num); font-size: var(--fs-meta); text-align: start; } /* the input is dir=ltr: start = left */
.mo-open-share { align-self: flex-start; padding: 0 4px; }
.mo-share-sheet .sheet-foot { flex-wrap: wrap; }
.mo-share-sheet .sheet-foot .btn { flex: 1 1 140px; }

@media (max-width: 700px) {
  .mo-verdict { font-size: 18px; }
  .mo-item-big { font-size: 30px; }
  .mo-items { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .mo-picker { flex: 1; }
  .mo-period { flex: 1; min-width: 0; }
  .mo-pick { width: 100%; justify-content: space-between; }
  .mo-head-end { width: 100%; }
  /* "September 2026" is longer than «سبتمبر 2026»: on a narrow phone the month gives way («…») instead of pushing
     the next-month arrow off the screen (English only: Arabic as before) */
  :root[dir="ltr"] .mo-controls { min-width: 0; }
  :root[dir="ltr"] .mo-pick-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  /* «شكاوى جديدة»: a long English topic ("− Policies and other things") keeps its tag whole: its count drops to a
     second line and the arrow stays at the row's end (a row that fits looks as before) */
  :root[dir="ltr"] .mo-side-row:has(> .tag) { flex-wrap: wrap; row-gap: 4px; }
  :root[dir="ltr"] .mo-side-row .tag { max-width: 100%; white-space: normal; }
  :root[dir="ltr"] a.mo-side-row:has(> .tag) { position: relative; padding-inline-end: 36px; } /* 12 + the arrow + 10 */
  :root[dir="ltr"] a.mo-side-row:has(> .tag) .mo-go {
    position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%) scaleX(-1); /* + base.css mirror */
  }
}
@media (max-width: 389px) {
  :root[dir="ltr"] .mo-pick { padding: 0 12px; }
}
@media (max-width: 359px) {
  :root[dir="ltr"] .mo-picker, :root[dir="ltr"] .mo-pick { gap: 4px; }
  :root[dir="ltr"] .mo-pick > .ph-calendar-blank { display: none; } /* the month's whole name rather than the icon */
}

/* A problem-only topic (core/problem.js, styles in topics.css): the level instead of a score */
.mo-item-prob { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.mo-item-pline { font-size: var(--fs-small); line-height: 1.6; opacity: .85; }
.mo-t-level { font-size: var(--fs-small); padding: 3px 10px; gap: 6px; }
.mo-t-level .prob-dot { width: 8px; height: 8px; }
