/* Management app (Manager dashboard). Tokens from admin.css only (--panel, --line, --ink, --muted, --brand, --accent, --ok, --warn, --danger, --info + -soft/-ink, --c1..c8);
   logical properties for RTL; every grid collapses to one column on a phone. */
.mg-page { --mg: #0d5f59; display: grid; gap: 18px; align-content: start; }
.mg-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }
.mg-body > * { min-width: 0; }
.mg-h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; margin: 0 0 10px; color: var(--ink); }
.mg-h2 .ico { color: var(--brand); }
.mg-card .card-head { flex-wrap: wrap; gap: 4px 12px; }
.mg-empty { padding: 8px 2px; }

/* ------------------------------------------------------------ toolbar */
.mg-bar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.mg-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 12px; background: var(--panel-3); max-width: 100%; }
.mg-seg-btn { min-height: 36px; padding: 0 13px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-weight: 650; white-space: nowrap; }
.mg-seg-btn:hover { color: var(--ink); }
.mg-seg-btn.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(60, 40, 25, .15); }
:root[data-theme="dark"] .mg-seg-btn.on { background: var(--panel-2); }
.mg-dates { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mg-dates .input { min-height: 36px; width: auto; }

.mg-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mg-notes li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: 10px; background: var(--info-soft); color: var(--info-ink); font-size: 13px; }
.mg-notes .ico { margin-top: 2px; }
.mg-note-box { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--panel-3); color: var(--muted); font-size: 13px; margin: 0; }

.mg-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mg-sum { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); border-inline-start: 4px solid var(--q, var(--line)); }
.mg-sum b { font-size: 22px; font-variant-numeric: tabular-nums; }
.mg-sum span { color: var(--muted); font-weight: 650; font-size: 13px; }
.mg-sum:hover { background: var(--panel-2); }
.q-s { --q: var(--ok); } .q-w { --q: var(--danger); } .q-o { --q: var(--info); } .q-t { --q: var(--warn); }

/* ------------------------------------------------------------ hero (EBITDA bridge + trend) */
.mg-hero { display: grid; grid-template-columns: minmax(300px, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.mg-hero > * { min-width: 0; }
.mg-bridge-hero { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.mg-bridge-val { font-size: clamp(26px, 5vw, 34px); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mg-bridge-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mg-chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-d); font-weight: 700; font-size: 12.5px; }
.mg-bridge { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mg-bridge-row { display: grid; grid-template-columns: 16px minmax(0, 1.6fr) minmax(40px, 1fr) auto minmax(70px, auto); gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--line-2); }
.mg-bridge-row.total { border-top: 2px solid var(--ink); border-bottom: 0; margin-top: 4px; padding-top: 10px; font-weight: 800; }
.mg-bridge-sign { color: var(--muted); font-weight: 800; text-align: center; }
.mg-bridge-name { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.mg-bridge-bar { display: block; height: 8px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.mg-bridge-bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.mg-bridge-row:first-child .mg-bridge-bar i { background: var(--brand); }
.mg-bridge-row.total .mg-bridge-bar i { background: var(--mg); }
.mg-bridge-row.neg-v .mg-bridge-bar i { background: var(--danger); }
.mg-bridge-amt { font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
.mg-bridge-prev { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mg-formula { margin: 10px 0 0; }
.mg-nodata-box { padding: 6px 0; }

/* ------------------------------------------------------------ KPI cards */
.mg-group { display: grid; gap: 4px; }
.mg-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.mg-kpi { position: relative; display: grid; gap: 4px; align-content: start; min-width: 0; padding: 13px 14px 12px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-inline-start: 4px solid var(--st, var(--line)); container-type: inline-size; }
.mg-kpi.st-ok { --st: var(--ok); } .mg-kpi.st-warn { --st: var(--warn); } .mg-kpi.st-bad { --st: var(--danger); }
.mg-kpi-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 650; font-size: 12.5px; min-width: 0; }
.mg-kpi-ico { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); flex: 0 0 auto; }
.mg-kpi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-info { display: inline-grid; place-items: center; width: 30px; height: 30px; margin: -4px -6px -4px 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); flex: 0 0 auto; }
[dir="rtl"] .mg-info { margin: -4px 0 -4px -6px; }
.mg-info:hover, .mg-info:focus-visible { background: var(--panel-3); color: var(--ink); }
.mg-tip { display: none; position: absolute; z-index: 5; inset-inline: 8px; top: calc(100% - 4px); margin: 0; padding: 9px 11px; border-radius: 10px; background: var(--ink); color: var(--panel); font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow-lg); }
.mg-kpi.is-open .mg-tip { display: block; }
@media (hover: hover) and (pointer: fine) { .mg-info:hover ~ .mg-tip, .mg-kpi-top:hover + .mg-tip { display: block; } }
.mg-info { position: relative; }
.mg-info::after { content: ""; position: absolute; inset: -7px; }   /* 44 px hit area, the drawn button stays 30 px */
.mg-val { display: block; max-width: 100%; text-align: start; padding: 0; border: 0; background: none; color: inherit; font-family: inherit; font-size: clamp(20px, 11cqw, 27px); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.mg-val-long { cursor: pointer; touch-action: manipulation; }
.mg-val-long .mg-v-compact { display: none; }
.mg-val-long.show-full { white-space: normal; overflow-wrap: anywhere; font-size: clamp(16px, 8cqw, 22px); }
@container (max-width: 200px) {   /* narrow card (content width): 1.25M EGP; a tap shows the exact amount */
  .mg-val-long:not(.show-full) .mg-v-full { display: none; }
  .mg-val-long:not(.show-full) .mg-v-compact { display: inline; }
}
.mg-nodata { color: var(--muted); font-size: 18px; font-weight: 700; }
.mg-hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.mg-lock { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 8px 0 4px; }
.mg-kpi.is-locked { background: var(--panel-2); box-shadow: none; }
.mg-kpi-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.mg-target { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--panel-3); color: var(--muted); }
.mg-target.st-ok { background: var(--ok-soft); color: var(--ok-ink); }
.mg-target.st-warn { background: var(--warn-soft); color: var(--warn-ink); }
.mg-target.st-bad { background: var(--danger-soft); color: var(--danger-ink); }
.mg-sub { font-size: 12px; color: var(--muted); }
.mg-spark { height: 34px; margin-top: 2px; direction: ltr; }
.mg-spark .spark { width: 100%; height: 34px; }
.mg-spark.bad .spark .c-line { stroke: var(--danger); } .mg-spark.bad .spark .area { fill: var(--danger); } .mg-spark.bad .spark .c-dot { fill: var(--danger); }
.mg-prev { font-size: 11.5px; color: var(--muted); }

/* ------------------------------------------------------------ charts + tables */
.mg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.mg-chip-btn { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 600; font-size: 12.5px; }
.mg-chip-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-d); }
.mg-chart { min-height: 220px; }
.mg-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.mg-two > * { min-width: 0; }
.mg-table td, .mg-table th { vertical-align: middle; }
.mg-table .link { overflow-wrap: anywhere; }
.mg-me { background: var(--accent-soft); }
.mg-you { margin-inline-start: 8px; }
.mg-rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--panel-3); font-weight: 800; font-size: 13px; }
.mg-rank.first { background: var(--warn-soft); color: var(--warn-ink); }
.mg-donut { justify-content: flex-start; }

/* heat map */
.mg-heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.mg-heat { display: grid; gap: 3px; min-width: max(100%, calc(46px + var(--cols) * 24px)); }
.mg-heat-row { display: grid; grid-template-columns: 46px repeat(var(--cols), minmax(18px, 1fr)); gap: 3px; align-items: center; }
.mg-heat-day { font-size: 11.5px; color: var(--muted); font-weight: 650; }
.mg-heat-hr { font-size: 10.5px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.mg-heat-cell { height: 26px; border-radius: 5px; background: var(--panel-3); }
.mg-heat-cell.has { background: color-mix(in srgb, var(--accent) calc(12% + var(--lvl) * .88%), var(--panel-3)); }
.mg-heat-legend { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.mg-heat-scale { display: inline-block; width: 90px; height: 10px; border-radius: 5px; background: linear-gradient(to right, var(--panel-3), var(--accent)); }
[dir="rtl"] .mg-heat-scale { transform: scaleX(-1); }
.mg-heat-max { margin-inline-start: auto; }

/* ------------------------------------------------------------ SWOT */
.mg-swot { display: grid; gap: 10px; }
.mg-swot-head p { margin: -6px 0 0; }
.mg-swot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.mg-quad { display: grid; gap: 10px; align-content: start; padding: 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--q); box-shadow: var(--shadow); min-width: 0; }
.mg-quad-head { display: flex; align-items: center; gap: 10px; }
.mg-quad-head > div { flex: 1; min-width: 0; }
.mg-quad-head h3 { font-size: 15px; }
.mg-quad-ico { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--q); background: color-mix(in srgb, var(--q) 14%, transparent); }
.mg-count { min-width: 28px; text-align: center; padding: 2px 8px; border-radius: 999px; background: var(--panel-3); font-weight: 800; font-variant-numeric: tabular-nums; }
.mg-quad-body { display: grid; gap: 10px; min-width: 0; }
.mg-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mg-item { display: grid; gap: 7px; padding: 11px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); }
.mg-item-head { display: flex; gap: 10px; align-items: flex-start; }
.mg-item-title { line-height: 1.4; overflow-wrap: anywhere; }
.mg-sev { display: inline-flex; gap: 2px; margin-top: 6px; flex: 0 0 auto; }
.mg-sev i { width: 6px; height: 12px; border-radius: 2px; background: var(--line); }
.mg-sev i.on { background: var(--q); }
.mg-evidence { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.mg-evidence li { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 9px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line-2); font-size: 12.5px; max-width: 100%; }
.mg-ev-k { color: var(--muted); }
.mg-evidence b { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mg-action { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 13px; line-height: 1.45; }
.mg-action .ico { color: var(--q); margin-top: 3px; flex: 0 0 auto; }
.mg-sources { margin: 0; }
.mg-more { justify-self: start; }

/* ------------------------------------------------------------ panels */
.mg-panels { display: grid; gap: 14px; }
.mg-panel { padding: 0; }
.mg-panel > summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; cursor: pointer; list-style: none; min-height: 48px; }
.mg-panel > summary::-webkit-details-marker { display: none; }
.mg-panel > summary::after { content: "▾"; margin-inline-start: auto; color: var(--muted); transition: transform .15s; }
.mg-panel[open] > summary::after { transform: rotate(180deg); }
.mg-panel-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 750; font-size: 15px; }
.mg-panel > :not(summary) { margin-inline: 16px; }
.mg-panel > :last-child { margin-bottom: 16px; }
.mg-panel > p { margin-top: 0; margin-bottom: 12px; }
table.data-table.mg-targets > tbody > tr > th[scope="row"] { text-align: start; font-weight: 650; }
.mg-targets .input { width: 92px; min-height: 36px; }
.mg-dir { display: block; font-weight: 400; }
.mg-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 12px; }
.mg-field { display: grid; gap: 4px; align-content: start; min-width: 0; }
.mg-field-l { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.mg-field .input, .mg-field textarea { width: 100%; }
.mg-check { display: flex; align-items: center; gap: 10px; align-self: end; min-height: 40px; }
.mg-foot { text-align: center; margin: 0; }

/* ------------------------------------------------------------ home widgets */
.mg-wi { display: grid; gap: 8px; }
.mg-wi-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mg-wi-big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mg-wi-sw { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mg-wi-sw a { display: grid; justify-items: center; padding: 8px 4px; border-radius: 10px; background: var(--panel-2); border-top: 3px solid var(--q); }
.mg-wi-sw b { font-size: 20px; }
.mg-wi-sw small { color: var(--muted); font-size: 11px; text-align: center; }
.mg-wi-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.mg-wi-list li { display: flex; gap: 8px; align-items: flex-start; }
.mg-wi-list .ico { color: var(--q); margin-top: 2px; }

/* ------------------------------------------------------------ tablet + phone */
.mg-tip-sheet { position: fixed; z-index: 95; inset-inline: 12px; bottom: calc(var(--bn-h, 0px) + 10px); display: grid; gap: 10px; padding: 14px 16px; border-radius: 16px; background: var(--ink); color: var(--panel); box-shadow: var(--shadow-lg); font-size: 14px; line-height: 1.5; }
.mg-tip-sheet .btn { justify-self: end; min-width: 96px; }
.mg-tip-sheet[hidden] { display: none; }
.mg-fold, .mg-quad-chev { display: none; }
.mg-heat-read { margin: 6px 0 0; min-height: 20px; overflow-wrap: anywhere; }
.mg-heat-cell.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
@media (max-width: 1100px) {
  .mg-hero { grid-template-columns: minmax(0, 1fr); }
}
/* tablets: 3 to 4 KPI cards per row, SWOT 2 x 2 */
@media (min-width: 761px) and (max-width: 1100px) {
  .mg-kpis { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .mg-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* the period / compare bar sticks under the top bar on tablets and phones (--stick is the bottom edge of the sticky top bar) */
@media (max-width: 1100px) {
  .mg-bar { position: sticky; top: var(--stick, 62px); z-index: 20; margin-inline: -14px; padding: 8px 14px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-2); flex-wrap: nowrap; align-items: center; }
  .mg-bar:has(.mg-dates) { flex-wrap: wrap; }
  .mg-bar:has(.mg-dates) .mg-dates { order: 3; flex: 1 1 100%; }
  .mg-seg { flex: 1 1 0; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
  .mg-seg::-webkit-scrollbar { display: none; }
  .mg-seg-btn { flex: 0 0 auto; min-height: 40px; scroll-snap-align: center; }
  .mg-bar .chip-select { flex: 0 0 auto; max-width: 150px; min-height: 44px; text-overflow: ellipsis; }
}
@media (max-width: 900px) and (max-height: 520px) { .mg-bar { top: var(--lic-h, 0px); } }
@media (max-width: 760px) {
  .mg-page { gap: 14px; }
  .mg-kpi.is-open .mg-tip { display: none; }   /* phones: the explanation opens as a bottom sheet (kpi-view.js) */
  .mg-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mg-sum { min-height: 48px; }
  .mg-two, .mg-swot-grid { grid-template-columns: minmax(0, 1fr); }
  .mg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mg-kpi { padding: 11px 11px 10px; }
  .mg-kpi-foot { gap: 3px 6px; }
  .mg-dates .input { flex: 1 1 130px; min-height: 44px; font-size: 16px; }
  /* EBITDA bridge: a stacked waterfall - name and bar on the left, amount and previous amount on the right */
  .mg-bridge-row { grid-template-columns: 18px minmax(0, 1fr) auto; grid-template-areas: "sign name amt" "sign bar prev"; gap: 3px 8px; padding: 9px 0; }
  .mg-bridge-sign { grid-area: sign; align-self: start; padding-top: 1px; }
  .mg-bridge-name { grid-area: name; font-size: 13.5px; }
  .mg-bridge-bar { grid-area: bar; display: block; height: 6px; }
  .mg-bridge-amt { grid-area: amt; font-size: 15px; }
  .mg-bridge-prev { grid-area: prev; display: block; font-size: 11.5px; }
  .mg-bridge-prev:empty { display: none; }
  .mg-bridge-row.total { padding-top: 12px; }
  /* heat map: scrolls sideways inside its card only; the weekday column stays */
  .mg-heat-wrap { margin-inline: -4px; padding-inline: 4px; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .mg-heat-row { grid-template-columns: 40px repeat(var(--cols), minmax(26px, 1fr)); }
  .mg-heat { min-width: calc(40px + var(--cols) * 29px); }
  .mg-heat-cell { height: 32px; }
  .mg-heat-day { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--panel); }
  .mg-heat-max { margin-inline-start: 0; flex-basis: 100%; }
  /* products: the lists fold */
  .mg-card.is-collapsed > :not(.card-head) { display: none; }
  .mg-card .card-head { position: relative; padding-inline-end: 48px; }
  .mg-fold { display: inline-grid; place-items: center; position: absolute; inset-inline-end: 0; top: 50%; translate: 0 -50%; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
  .mg-fold svg { transition: transform .18s; }
  .mg-card.is-collapsed .mg-fold svg { transform: rotate(-90deg); }
  [dir="rtl"] .mg-card.is-collapsed .mg-fold svg { transform: rotate(90deg); }
  /* product lists: a small card per product */
  .mg-prods thead { display: none; }
  .mg-prods, .mg-prods tbody { display: block; }
  .mg-prods tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  table.data-table.mg-prods > tbody > tr > td { display: grid; gap: 1px; padding: 0; border: 0; text-align: start; font-variant-numeric: tabular-nums; }
  table.data-table.mg-prods > tbody > tr > td.hide-m { display: grid !important; }
  table.data-table.mg-prods > tbody > tr > td::before { content: attr(data-label); font-size: 11.5px; font-weight: 650; color: var(--muted); }
  table.data-table.mg-prods > tbody > tr > td.mg-p-name { grid-column: 1 / -1; font-weight: 650; overflow-wrap: anywhere; }
  table.data-table.mg-prods > tbody > tr > td.mg-p-name::before { display: none; }
  table.data-table.mg-prods > tbody > tr > td.num { font-weight: 700; }
  /* kiosk table -> cards */
  .mg-kiosks thead { display: none; }
  .mg-kiosks, .mg-kiosks tbody { display: block; }
  .mg-kiosks tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
  .mg-kiosks tr.mg-me { background: var(--accent-soft); border-color: var(--accent); }
  table.data-table.mg-kiosks > tbody > tr > td { display: grid; gap: 1px; padding: 0; border: 0; text-align: start; }
  table.data-table.mg-kiosks > tbody > tr > td.hide-m { display: grid !important; }
  table.data-table.mg-kiosks > tbody > tr > td::before { content: attr(data-label); font-size: 11.5px; font-weight: 650; color: var(--muted); }
  table.data-table.mg-kiosks > tbody > tr > td.mg-k-rank { grid-column: 1; grid-row: 1; width: 32px; }
  table.data-table.mg-kiosks > tbody > tr > td.mg-k-rank::before, table.data-table.mg-kiosks > tbody > tr > td.mg-k-name::before { display: none; }
  table.data-table.mg-kiosks > tbody > tr > td.mg-k-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; grid-column: 1 / -1; grid-row: 1; padding-inline-start: 40px; min-height: 32px; font-size: 15px; }
  table.data-table.mg-kiosks > tbody > tr > td.num { text-align: start; font-weight: 700; font-variant-numeric: tabular-nums; }
  /* SWOT: accordion with the count on every head */
  .mg-quad-head { cursor: pointer; min-height: 44px; -webkit-user-select: none; user-select: none; }
  .mg-quad-head:focus-visible { outline: 2px solid var(--q); outline-offset: 3px; border-radius: 8px; }
  .mg-quad-chev { display: inline-flex; color: var(--muted); transition: transform .18s; }
  .mg-quad.is-collapsed .mg-quad-chev { transform: rotate(-90deg); }
  [dir="rtl"] .mg-quad.is-collapsed .mg-quad-chev { transform: rotate(90deg); }
  .mg-quad.is-collapsed .mg-quad-body { display: none; }
  .mg-quad { padding: 12px; gap: 8px; }
  .mg-item { padding: 10px; }
  .mg-more { min-height: 44px; }
  /* panels: full-width forms */
  .mg-panel > summary { padding: 12px 14px; min-height: 52px; }
  .mg-panel > :not(summary) { margin-inline: 14px; }
  .mg-fields { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .mg-field .input, .mg-field textarea, .mg-field select { min-height: 48px; font-size: 16px; }
  .mg-field textarea { min-height: 88px; }
  .mg-check { min-height: 48px; }
  .mg-check input { width: 22px; height: 22px; }
  .mg-panel .row-gap { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .mg-panel .row-gap .btn { min-height: 48px; width: 100%; justify-content: center; }
  /* targets: one block per measure, Min and Max side by side */
  .mg-targets, .mg-targets tbody { display: block; }
  .mg-targets thead { display: none; }
  .mg-targets tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 4px 10px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
  table.data-table.mg-targets > tbody > tr > th[scope="row"] { grid-column: 1 / -1; padding: 0; border: 0; }
  table.data-table.mg-targets > tbody > tr > td { display: grid; gap: 2px; padding: 0; border: 0; }
  table.data-table.mg-targets > tbody > tr > td::before { content: attr(data-label); font-size: 11.5px; font-weight: 650; color: var(--muted); }
  table.data-table.mg-targets > tbody > tr > td.mg-unit { align-self: end; padding-bottom: 12px; min-width: 24px; }
  table.data-table.mg-targets > tbody > tr > td.mg-unit::before { display: none; }
  .mg-targets .input { width: 100%; min-height: 48px; font-size: 16px; }
  /* home widgets */
  .mg-wi-sw { gap: 6px; }
  .mg-wi-sw a { padding: 8px 2px; }
  .mg-wi-sw small { font-size: 10.5px; overflow-wrap: anywhere; }
}
@media (max-width: 360px) {
  .mg-kpis { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .mg-panel > summary::after, .mg-fold svg, .mg-quad-chev { transition: none; } }
@media print { .mg-bar, .mg-panels, .mg-info, .page-actions { display: none !important; } .mg-tip, .mg-tip-sheet { display: none !important; } }
