/* My day page tabs (Sami 2026-11-09, js/pages/myday.js + js/myDayOffers.js, prototype docs/prototypes/myday-offers/b2.html).
   Underline look (Sami 2026-11-16, DECISIONS #305, #306, look 1 of docs/prototypes/inner-tabs/; tried on My day first, before the shared .tabs):
   no grey tray, the picked tab = blue words + a 3px blue line under it, the others grey and a grey ground on hover. Follow-ups is always there; a "stuck" tab (Cancelled offers, Payment due, Approval delayed)
   only exists while something is stuck, with a red count. Built for the sales team's tablets: one row of tabs at 768px and up (never scroll,
   never hide an alarm tab). */
.md-tabs { position: relative; z-index: 1; display: flex; gap: 4px; margin: 0 0 var(--sp-3); padding: 0; background: none; border: 0; border-bottom: 1px solid var(--c-line); border-radius: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.md-tab { flex: 0 1 auto; min-width: 0; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; background: none; font: inherit; font-size: var(--fs-table); font-weight: var(--fw-medium); color: var(--c-muted); white-space: nowrap; cursor: pointer; transition: background .12s, color .12s; }
.md-tab:not(.on):hover { background: var(--c-select); color: var(--c-ink); }
.md-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.md-tab.on { background: none; color: var(--c-accent-text); box-shadow: inset 0 -3px 0 var(--c-accent); font-weight: var(--fw-semibold); }
.md-tab.on:focus-visible { box-shadow: inset 0 -3px 0 var(--c-accent), var(--focus-ring); }
.md-tab b { min-width: 0; overflow: hidden; text-overflow: ellipsis; font: inherit; }
.md-tab em { flex: none; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: var(--r-pill); background: var(--c-select-line); font-style: normal; font-size: var(--fs-hint); font-weight: var(--fw-semibold); color: var(--c-ink); }
.md-tab-ic { flex: none; display: grid; place-items: center; width: 16px; height: 16px; }
.md-tab-ic .ico, .md-tab-ic svg { width: 16px; height: 16px; }
.md-tab.on:not(.stuck) em { background: var(--c-accent-soft); color: var(--c-accent-text); }
.md-tab.stuck em { background: var(--c-danger); color: var(--c-card); }
.md-tab.stuck { animation: md-tab-in .45s ease-out both; }
@keyframes md-tab-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* the page below the tabs: everything of the open tab, no box of its own (the cards, the toolbar and the list are the boxes) */
.md-stuck { padding-top: 4px; }
.mo-pane .md-lst { border-radius: var(--r-lg); }
.mo-why { margin: 0 0 12px; padding: 12px 16px; border-radius: var(--r-lg); background: var(--c-tile); font-size: var(--fs-table); color: var(--c-text); }
.mo-ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--c-danger-soft); color: var(--c-danger); }
.mo-ic.a { background: var(--c-warning-soft); color: var(--c-warning); }
/* an Arabic client name starts on the same side as the English ones */
.mo-pane .mo-main b, .mo-pane .mo-q-main b, .mo-pane .mo-name { text-align: left; }
.mo-late { font-size: var(--fs-hint); font-weight: var(--fw-semibold); color: var(--c-danger); white-space: nowrap; }
/* Waiting your approval (#470): the wait before the limit, quiet; the salesperson name in the sub line */
.mo-wait { font-size: var(--fs-hint); color: var(--c-text); white-space: nowrap; }
.mo-who { color: var(--c-text); font-weight: var(--fw-medium); }
/* the two answers sit under the text (side by side they squeezed the client's name on a tablet) */
.mo-pane .mo-q { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
.mo-pane .mo-q-acts { grid-column: 2; justify-content: flex-start; }
.mo-link { grid-template-columns: auto minmax(0, 1fr) auto auto; }
/* A row with its own button (Unit is back, Refresh tomorrow): icon, words, button on one line like an offer row */
.mo-act { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; }

/* Sizes follow the PAGE width, not the screen: a landscape tablet with the side menu open leaves ~740px, like a portrait one. */
.md-page { container: mdpage / inline-size; }
/* When the row is tight (many alarm tabs on a tablet), fitTabs() in myday.js adds .tight: a closed alarm tab keeps only its icon + red
   count (its name on hover); the open tab and Follow-ups keep their names (Sami 2026-11-10). */
.md-tabs.measure .md-tab { flex: none; }
.md-tabs.tight .md-tab.stuck:not(.on) { padding: 8px 8px; }
.md-tabs.tight .md-tab.stuck:not(.on) b { display: none; }
/* phone: the tabs wrap on more than one line instead of scrolling */
@container mdpage (max-width: 560px) {
  .md-tabs { flex-wrap: wrap; overflow: visible; }
  .mo-link { grid-template-columns: auto minmax(0, 1fr); }
  .mo-link > .mo-late, .mo-link > .mo-wait, .mo-link > .mo-go { grid-column: 2; }
  .mo-act { grid-template-columns: auto minmax(0, 1fr); }
  .mo-act > .btn { grid-column: 2; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { .md-tab.stuck { animation: none; } }
/* the two answers after a cancellation: thumbs up (hope) / thumbs down in red (no hope), Sami 2026-11-09 */
.mo-ans-ic { display: inline-flex; margin-inline-start: -2px; }
.mo-ans-ic.no { color: var(--c-danger); }
/* the client name and the offer number open the lead / the offer (Sami 2026-11-09: what you see, you can open) */
.mo-name { font-weight: var(--fw-semibold, 600); color: var(--c-ink); text-decoration: none; justify-self: start; }
.mo-num { color: var(--c-accent-text); text-decoration: none; font-weight: var(--fw-medium, 500); }
.mo-name:hover, .mo-num:hover { text-decoration: underline; }
.mo-name:hover { color: var(--c-accent-text); }

/* The cards button (placed by statsFold.js) and its divider only make sense on the Follow-up tab: the cards sit inside it */
.md-page:has(.md-fu[hidden]) .topbar-actions :is(.sum-tg, .tb-sep) { display: none; }

/* The tabs sit as one compact group, like the shared tabs; with no alarm tab, a lone "Follow-up" tab says nothing, so the row hides
   (one thing on its own is not a choice, like a single card; Sami 2026-11-16). */
.md-tabs { display: inline-flex; max-width: 100%; }
.md-tabs:not(:has(.md-tab.stuck)) { display: none; }
/* The cards (Sami 2026-11-16, DECISIONS #303; today 7: All, New, Priority overdue, Overdue, Today, Coming up, No follow-up).
   My day's page is ~1,040px wide at most, so 8 cards are ~120px each: the circle and the count share the first line, the name sits under
   them over the full card, so a 4-digit count and the longest name (Priority overdue, Tomorrow, Upcoming) always stay inside.
   One row of 8 when the tray is 900px or wider (by the tray's own width, so the side menu counts), else 2 rows of 4. */
#mdStats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); }
#mdStats .stat { min-width: 0; padding: 10px; column-gap: 8px; row-gap: 4px; align-content: start; }
#mdStats .stat > .stat-ico { grid-row: 1; width: 30px; height: 30px; }
#mdStats .stat > .stat-ico .ico { width: 16px; height: 16px; }
#mdStats .stat .value { grid-row: 1; grid-column: 2; font-size: var(--fs-title); line-height: 1.15; }
#mdStats .stat .label { grid-row: 2; grid-column: 1 / -1; line-height: 1.25; }
.cards-tray:has(> #mdStats) { container-type: inline-size; }
/* No empty slot, whatever the number of cards (Sami 2026-11-17: 7 cards in 8 columns left a hole after No follow-up on the tablet):
   one row = as many columns as cards; 2 rows of 4 with an odd count = the last card takes the free slot too. */
#mdStats > .stat:last-child:nth-child(4n+3) { grid-column: span 2; }
@container (min-width: 900px) {
  #mdStats { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  #mdStats > .stat:last-child:nth-child(4n+3) { grid-column: auto; }
}
