/* ---------------------------------------------------------------------------
   F. BINSABBAR - My Desk (staff self-service). LAYOUT ONLY.

   Everything visual - colours, buttons, the back button, the footer, cards,
   pills, tags, inputs, the modal, the busy scrim, the toast - comes from
   /guidelines/fb-ui.css. There are no parallel design tokens in this file and
   no raw hex or rgba literal for anything the kit tokens already express.

   Four house laws this file must not break:

     1. USE THE KIT'S COMPONENT CLASSES. Buttons are .btn / .btn.outline /
        button.secondary.danger. Tags are .tag. Inputs are .text-input and
        .fb-select. Cards are .card. There is deliberately NO .md-btn in this
        file: a hand-rolled retype of the kit's button is exactly what got a
        previous console rejected.
     2. Danger buttons are red fill with Premium Yellow text. We never restate
        that; button.secondary.danger already reads --accent / --on-danger.
     3. Uniform 44px control height -> var(--s-9). Never a hardcoded px height
        on a button, select or input. No 38px, no 40px.
     4. Bespoke inputs relight red, because fb-ui.css sets an accent border with
        !important on every hovered/focused text-shaped input. This file
        therefore ships NO bespoke input: every field in the tool carries the
        kit's .text-input or .fb-select and inherits the house behaviour.

   Written logical-property-first (margin-inline / padding-inline / inset-inline
   / border-inline) because My Desk is bilingual from day one. Arabic is a `dir`
   attribute on <html>, never a stylesheet fork. The kit's [dir="rtl"] block
   handles the select chevron, the drawer side and the footer alignment; this
   file adds nothing physical for it to have to undo.
--------------------------------------------------------------------------- */

/* ============== PENDING KIT PROMOTION ==============
   These six type roles, the measure cap and the 44px tab floor BELONG in
   fb-ui.css :root, consumed identically by My Desk, the HR Portal and the
   sample console. They are declared here, scoped to this tool, for one reason
   only: fb-ui.css is the whole house's sheet - store, POS, stockroom and both
   HR surfaces - and three HR surfaces are being worked concurrently. A blind
   concurrent edit to the shared sheet is how a token gets half-written.

   PROMOTION IS A PURE DELETION. Move this block to fb-ui.css :root verbatim,
   delete it here, and every var() below keeps resolving with no other change.
   Nothing in this tool reads a literal that these tokens express.

   The tracking ladder is keyed to SIZE, not to taste, and applies only to
   uppercase positions: 9-10px -> 0.12em, 11px -> 0.10em, 12-13px -> 0.04em,
   15px and above -> 0. Lowercase and proper nouns carry none. */
.page, .md-view, .md-sample-banner, .modal, .md-toast-host {
  --ty-micro: 11px;   /* uppercase label tier */
  --ty-meta:  12px;
  --ty-body:  13px;
  --ty-name:  15px;
  --ty-sub:   20px;
  --ty-num:   23px;
  --measure:  66ch;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--s-4) max(var(--s-6), env(safe-area-inset-right)) 140px max(var(--s-6), env(safe-area-inset-left));
}

/* The `hidden` attribute MUST win over the class display rules below. A class
   selector (.md-view{display:block}) outranks the UA [hidden]{display:none},
   which would otherwise leave every screen visible at once. */
#md-chrome[hidden], .md-view[hidden], .md-sample-banner[hidden],
.md-empty[hidden], #md-tab-approvals[hidden] { display: none !important; }

.md-view { display: block; }

/* S3 - THE HOUSE CAPS AT WEIGHT 500. Futura Demi is where a geometric sans
   starts to look cheap, and the browser default for b/strong is 700. If a
   thing needs presence, it gets space above it, never weight. */
b, strong { font-weight: 500; }

/* The language switch sits at the far end of the nav row, opposite the back
   pill. Height comes from .btn (var(--s-9)); this rule is placement only. */
.md-lang { margin-inline-start: auto; flex: 0 0 auto; }
.page-nav-inner { display: flex; align-items: center; gap: var(--s-3); }

/* Arabic sets Tajawal ahead of Futura for the whole document. The kit already
   lists Tajawal in every font stack as the Arabic fallback; this only reorders
   it so Arabic-first pages do not render Latin numerals in a Latin face. */
html[dir="rtl"] body,
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3,
html[dir="rtl"] .btn, html[dir="rtl"] button,
html[dir="rtl"] .text-input, html[dir="rtl"] .fb-select {
  font-family: "Tajawal", futura-pt, "Futura PT", sans-serif;
}
/* The language button always shows the OTHER language, so it stays in its own
   script regardless of the page direction. */
.md-lang[lang="ar"] { font-family: "Tajawal", sans-serif; }
.md-lang[lang="en"] { font-family: futura-pt, "Futura PT", sans-serif; }

/* ============== SAMPLE-DATA BANNER ==============
   Deliberately loud and deliberately persistent. It is one of four independent
   signals that a row is not a real record (the others: the per-row Sample chip,
   the SAMPLE-nn identifiers, and the per-card notice). */
.md-sample-banner {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  margin: var(--s-6) 0 0;
  border-radius: var(--radius-card);
  background: var(--warning-soft);
  box-shadow: inset 0 0 0 1px var(--warning-soft);
  color: var(--text);
  font-size: var(--ty-body); line-height: 1.4;
  max-width: var(--measure);
}
.md-sample-banner > .icon { --icon-size: 18px; margin-top: 1px; color: var(--warning-text); }
.md-sample-banner .tag { vertical-align: middle; }

/* Offline reuses the sample banner's shape - same weight of interruption, and
   the two can legitimately be on screen together - but carries the error tint
   and the error glyph, because one is "this is not your record" and the other
   is "this cannot be saved". */
.md-offline-banner { background: var(--error-soft); margin-top: var(--s-3); }
.md-offline-banner > .icon { color: var(--error); }
.md-offline-banner[hidden] { display: none !important; }

/* The DELEGATION BANNER (study 12.9 item 2) used to be styled here. It is
   retired: borrowed authority is now a Cover-tab count badge and the first
   row under "Needs your attention", so it is content rather than a paragraph
   of chrome above every screen. Both carry existing styles - .md-tab-count
   and .md-row - so nothing replaced it. */

/* ============== SHARED SCREEN FURNITURE ============== */

.md-view > .card { margin-bottom: var(--s-4); }

/* Screen intro: one title + one sentence, above the content of each screen. */
.md-head { margin: var(--s-6) 0 var(--s-4); }
.md-head h2 {
  margin: 0 0 var(--s-2);
  font-size: var(--ty-sub); font-weight: 400; letter-spacing: 0; color: var(--text);
}
.md-head p { margin: 0; font-size: var(--ty-body); line-height: 1.4; color: var(--text-muted); max-width: var(--measure); }

/* Category pages group related workflows without creating more top-level
   navigation. The label and rule make each domain visible while scrolling. */
.md-category-section { min-width: 0; }
.md-category-section + .md-category-section { margin-top: var(--s-9); }
.md-category-label {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: var(--s-6) 0 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
}
.md-category-label::after {
  content: '';
  flex: 1 1 auto;
  block-size: 1px;
  background: var(--control-border);
}
.md-category-label span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding-inline: var(--s-3);
  border-radius: var(--radius-pill);
  background: var(--premium-yellow);
  color: var(--text);
  font-size: var(--param-title-fs);
  font-weight: var(--param-title-weight);
  letter-spacing: var(--param-title-ls);
  text-transform: var(--param-title-tt);
}
.md-category-section .md-head { margin-top: var(--s-3); }

.md-section-title {
  display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap;
  margin: var(--s-6) 0 var(--s-3);
}
/* S2 - ONE uppercase label rule, reading the kit's own quartet. No local
   font-weight: Futura Medium uppercase at this size reads as system chrome. */
.md-section-title h3 {
  margin: 0;
  font-size: var(--param-title-fs);
  letter-spacing: var(--param-title-ls);
  text-transform: var(--param-title-tt);
  color: var(--param-title-color);
  font-weight: var(--param-title-weight);
  line-height: 1.25;
}
.md-section-title .sub { font-size: var(--ty-micro); line-height: 1.25; color: var(--text-faint); }

.md-empty {
  padding: var(--s-7) var(--s-5);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--ty-body);
}
.md-empty p { max-width: var(--measure); margin-inline: auto; }

/* Action row inside a card. Kit .btn-row already handles wrap + gap; this only
   pushes it clear of the text above it. */
.md-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin-top: var(--s-4); }

/* ============== THE HEADLINE (Desk landing) ============== */
.md-hello {
  padding: var(--s-5) var(--s-6);
  margin: var(--s-6) 0 var(--s-4);
  border-radius: var(--radius-glass);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}
.md-hello h2 { margin: 0 0 var(--s-1); font-size: var(--ty-sub); font-weight: 400; color: var(--text); }
.md-hello .md-hello-sub {
  margin: 0; font-size: var(--ty-body); color: var(--text-muted);
  /* The sample pill sits inline on this line instead of owning a strip of its
     own. inline-flex keeps the 11px pill optically centred on 13px text. */
  display: inline-flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
}
.md-hello .md-hello-tags { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }

/* ============== EMPLOYEE DESK ==============
   The membership card is temporary badge artwork. The image is deliberately
   monochrome so the employee data remains the identity, not the card tier. */
.md-desk-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.1fr);
  gap: var(--s-4);
  align-items: stretch;
  margin-top: var(--s-5);
}
.md-employee-badge {
  position: relative;
  min-height: 292px;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius-glass);
  background: var(--text);
  color: #fff;
  box-shadow: var(--glass-shadow);
}
.md-employee-badge__art {
  position: absolute;
  inset: 0;
  z-index: -2;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  object-position: center;
  filter: grayscale(1) contrast(1.08) brightness(0.78);
  transform: scale(1.01);
}
.md-employee-badge::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(14, 14, 14, 0.12), rgba(14, 14, 14, 0.02) 38%),
    linear-gradient(to top, rgba(14, 14, 14, 0.88), rgba(14, 14, 14, 0.04) 62%);
}
.md-employee-badge__content {
  min-height: inherit;
  block-size: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--s-5);
}
.md-employee-badge__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.md-employee-badge__eyebrow,
.md-employee-badge__identity > p {
  margin: 0;
  font-size: var(--ty-micro);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.md-employee-badge__eyebrow { color: rgba(255, 255, 255, 0.78); }
.md-employee-badge__identity > p { color: rgba(255, 255, 255, 0.62); }
.md-employee-badge__identity h2 {
  margin: var(--s-2) 0 var(--s-1);
  color: #fff;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0;
}
.md-employee-badge__identity > span {
  display: block;
  color: rgba(255, 255, 255, 0.78);
  font-size: var(--ty-body);
  line-height: 1.3;
}
.md-general-card,
.md-desk-leave { margin: 0; }
.md-general-card h3,
.md-desk-leave h3 {
  margin: 0;
  font-size: var(--ty-name);
  font-weight: 400;
  color: var(--text);
}
.md-general-card .md-facts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
}
.md-general-card .md-fact:last-child { grid-column: 1 / -1; }
.md-general-card .md-fact dd {
  overflow-wrap: anywhere;
  font-size: var(--ty-body);
}
.md-desk-leave { margin-top: var(--s-4); }
.md-desk-leave h3 {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.md-desk-leave .md-facts { margin-top: var(--s-4); }

/* Fact grid: label over value. Used on the Desk headline, the profile card and
   the leave summary. Tabular numerals so dates and day counts line up. */
.md-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-4) var(--s-5);
  margin-top: var(--s-5);
}
.md-fact dt {
  margin: 0 0 var(--s-1);
  font-size: var(--param-title-fs);
  letter-spacing: var(--param-title-ls);
  text-transform: var(--param-title-tt);
  color: var(--param-title-color);
  font-weight: var(--param-title-weight);
}
.md-fact dt { line-height: 1.25; }
.md-fact dd {
  margin: 0;
  font-size: var(--ty-name); color: var(--text);
  font-variant-numeric: tabular-nums;
}
.md-fact dd.md-muted { color: var(--text-faint); font-size: var(--ty-body); }

/* The stat treatment stockroom already established and the house already
   accepted: one number, given room, tabular so a column of them lines up.
   Reserved for the leave figures, which are the only true statistics here. */
.md-fact dd.md-num {
  font-size: var(--ty-num); font-weight: 500; letter-spacing: 0;
  line-height: 1.2;
}
.md-fact dd.md-num .md-num-unit {
  font-size: var(--ty-body); font-weight: 400; color: var(--text-muted);
  margin-inline-start: var(--s-1);
}

/* ============== ROW LIST ==============
   One list shape reused by documents, leave history and the approvals queue.
   A row is a card-weight surface, not a table, because the tool is read on a
   phone by staff standing in the boutique. */
.md-rows { display: flex; flex-direction: column; gap: var(--s-3); }

.md-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--radius-card);
  background: var(--glass-bg-strong);
  box-shadow: var(--glass-shadow);
}
.md-row > .icon { --icon-size: 20px; color: var(--text-faint); flex: 0 0 auto; }
/* On a row carrying a consequence line the block is three deep, and a centred
   glyph floats against the middle sentence instead of marking the row. It
   rises to sit with the title. Rows without one stay centred. */
.md-row:has(.md-row-why) > .icon { align-self: flex-start; margin-top: 2px; }
.md-row-main { flex: 1 1 220px; min-width: 0; }
.md-row-title {
  margin: 0 0 var(--s-1);
  font-size: var(--ty-name); color: var(--text);
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.md-row-sub {
  margin: 0;
  font-size: var(--ty-meta); line-height: 1.4; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
/* M3 - THE CONSEQUENCE LINE. A date is a fact; what lapsing costs you is the
   reason to act on it. Sits at body size directly under the title, at full
   text colour, because it outranks the date it follows. Rendered only while
   the document is inside its alert window - never as permanent decoration. */
.md-row-why {
  margin: var(--s-1) 0 0;
  font-size: var(--ty-body); line-height: 1.4; color: var(--text);
  max-width: var(--measure);
}
.md-row-end { display: flex; align-items: center; gap: var(--s-2); flex: 0 0 auto; flex-wrap: wrap; }

/* Severity rail on a document row. Colour is the kit's semantic FILL token,
   used here as a 3px surface and never as text. */
.md-row.is-overdue { border-inline-start: 3px solid var(--error); }
.md-row.is-soon    { border-inline-start: 3px solid var(--warning); }
.md-row.is-clear   { border-inline-start: 3px solid var(--success); }

/* ============== FORM BLOCKS ==============
   Labels only. Every control below a label is a kit .text-input / .fb-select,
   so there is no bespoke field for the kit's !important focus ring to fight. */
.md-field { margin-bottom: var(--s-4); }
.md-field > label {
  display: block; margin-bottom: var(--s-2);
  font-size: var(--param-title-fs);
  letter-spacing: var(--param-title-ls);
  text-transform: var(--param-title-tt);
  color: var(--param-title-color);
  font-weight: var(--param-title-weight);
}
.md-field-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-4);
}

/* ============== PHASE 2 / BLOCKED NOTICE ==============
   Where an action is not wired, the control stays visible and visibly
   disabled with a tooltip saying why. This is the copy that sits beside it. */
.md-notice {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--radius-card);
  background: var(--hover);
  color: var(--text-muted);
  font-size: var(--ty-body); line-height: 1.4;
}
.md-notice > div { max-width: var(--measure); }
.md-notice > .icon { --icon-size: 18px; margin-top: 1px; flex: 0 0 auto; }
.md-notice strong { color: var(--text); font-weight: 500; }
.md-notice code {
  font-size: var(--ty-meta);
  padding: 1px var(--s-1);
  border-radius: var(--radius-sm);
  background: var(--hover);
}

/* ============== NOT-YET-WIRED CONTROLS ==============
   A control whose action is not wired stays visible and visibly disabled, with
   a tooltip naming the blocker. The TITLE lives on this wrapper because a
   disabled <button> dispatches no mouse events and .btn.disabled additionally
   sets pointer-events:none, so a title on the control itself never renders.
   The wrapper is a positioning shell and carries no button styling of its own -
   the control inside is the kit's .btn or the kit's button.secondary.danger. */
.md-dead { display: inline-flex; cursor: not-allowed; }
.md-dead > .btn, .md-dead > button { pointer-events: none; }

/* button.primary / button.secondary are declared width:100% by the kit, which
   is right for a stacked form and wrong inside a horizontal action row. This
   returns them to intrinsic width in the two row contexts this tool uses, and
   changes nothing else about them. Height stays var(--s-9) from the kit. */
.md-row-end button.primary, .md-row-end button.secondary,
.md-actions button.primary, .md-actions button.secondary,
.md-dead button.primary, .md-dead button.secondary {
  width: auto;
  padding-inline: var(--s-5);
}

/* The kit dims a disabled button.primary but has no disabled treatment for
   button.secondary. Matched to the 0.45 opacity + not-allowed cursor the kit
   already uses for disabled checkboxes, radios and switches, so a disabled
   danger button reads as disabled without losing its red/yellow identity. */
button.secondary:disabled { opacity: 0.45; cursor: not-allowed; }
button.secondary.danger:disabled:hover { filter: none; }

/* ============== 44px CONTROL FLOOR ON THE KIT'S OWN TABS ==============
   PENDING KIT PROMOTION (S8). fb-ui.css sizes .tabs button at 40px laptop /
   39px phone, which makes the kit's tabs the shortest control in a house whose
   law is a uniform 44px. Corrected here for this tool; belongs in the kit
   alongside every other control height, at which point this block is deleted. */
.tabs a, .tabs button { min-height: var(--s-9); align-items: center; }

/* ============== PANEL FOCUS ==============
   Changing tab moves focus to the revealed panel rather than announcing it
   through a live region, so the ring must exist but must not read as a text
   selection on a whole screen. */
.md-view:focus { outline: none; }
.md-view:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius-card); }

/* ============== LOADING PLACEHOLDERS ==============
   Used only where the layout would otherwise jump: My leave paints its heading
   before the fetch resolves. A placeholder is a SHAPE, never a fake number. */
.md-skel {
  border-radius: var(--radius-card);
  background: var(--hover);
  position: relative; overflow: hidden;
}
.md-skel-row { height: 76px; }
.md-skel-stat { height: 92px; }
.md-skel::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--control-bg), transparent);
  transform: translateX(-100%);
  animation: md-shimmer 1.4s infinite;
}
[dir="rtl"] .md-skel::after { animation-name: md-shimmer-rtl; }
@keyframes md-shimmer { to { transform: translateX(100%); } }
@keyframes md-shimmer-rtl { to { transform: translateX(-200%); } }
@media (prefers-reduced-motion: reduce) {
  .md-skel::after { animation: none; }
}

/* ============== TOAST HOST ============== */
.md-toast-host {
  position: fixed; inset-inline-start: 50%; bottom: 28px;
  transform: translateX(-50%);
  z-index: 9800;
  display: flex; flex-direction: column; gap: var(--s-2); align-items: center;
  pointer-events: none;
}

/* ============== NARROW ==============
   The whole tool is one column below 720px. Tabs already scroll horizontally
   inside .tabs, which is kit behaviour. */
@media (max-width: 720px) {
  .md-hello { padding: var(--s-4) var(--s-5); border-radius: var(--radius-card); }
  .md-hello h2 { font-size: 20px; }
  .md-desk-grid { grid-template-columns: 1fr; }
  .md-employee-badge { min-height: 0; aspect-ratio: 1600 / 1009; }
  .md-facts { grid-template-columns: 1fr 1fr; gap: var(--s-4); }
  .md-row { padding: var(--s-4); }
  .md-actions .btn { flex: 1 1 100%; }
}
@media (max-width: 420px) {
  .tabs button { padding-inline: 13px; }
}

/* ============== LEAVE: THE ASSESSMENT ==============
   Layout only. Every colour, radius and control style below resolves to a kit
   token or a kit component class; there is no bespoke button, input, tab or
   pill anywhere in this block.

   The pay ladder is the piece worth reading. It is a description list in
   spirit - a quantity of days and the rate they are paid at - and it is set as
   a two-column row so the day counts align down the left and the percentages
   down the right. A sick leave that crosses a tier boundary is the case this
   exists for, and the split has to be readable at a glance on a phone. */
.md-asof {
  margin-inline-start: auto;
  font-size: var(--ty-micro); letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--text-faint);
}
.md-subhead {
  margin-top: var(--s-4); margin-bottom: var(--s-2);
  font-size: var(--ty-micro); letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--text-faint);
}
.md-tiers { list-style: none; margin: 0 0 var(--s-3); padding: 0; }
.md-tiers li {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-4);
  padding-block: var(--s-2);
  border-block-end: 1px solid var(--control-border);
}
.md-tiers li:last-child { border-block-end: 0; }
.md-tier-days { font-size: var(--ty-name); color: var(--text); }
.md-tier-pct { font-size: var(--ty-body); color: var(--text-muted); }

/* Two tiles side by side: the balance now and the balance after. They are a
   before/after pair and are always read together, so they never wrap apart. */
.md-facts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* The panel before the server has answered. A SHAPE and a sentence, never a
   number: a zero here would be read as a statement about somebody's balance. */
.md-assess-wait {
  padding: var(--s-5);
  border-radius: var(--radius-card);
  background: var(--hover);
  color: var(--text-muted);
  font-size: var(--ty-body); line-height: 1.4;
  max-width: var(--measure);
}

/* A consequence the person must not miss - days beyond the paid ladder, an
   absence long enough to suspend service. Colour alone never carries it: each
   one is a full sentence, so it survives being read in monochrome or aloud. */
/* --error-text, not --error. --error IS --accent, the signature red, which is a
   FILL colour; as text on a light surface it is the wrong contrast and it reads
   as brand rather than as warning. --error-text is the kit's darkened pair for
   exactly this. */
.md-warn { color: var(--error-text); }
.md-notice-error { background: var(--error-soft); }

/* A checkbox and its label on one baseline. The control itself is the browser's
   own; the kit does not ship a checkbox and inventing a lookalike here would be
   exactly the bespoke component the house rule forbids. */
.md-check {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: var(--s-9);
  font-size: var(--ty-body); color: var(--text);
  cursor: pointer;
}
.md-check input { inline-size: 18px; block-size: 18px; margin: 0; accent-color: var(--accent); }

/* A figure at the end of a row - the per-type remaining balance. Tabular so a
   column of them aligns on the decimal. */
.md-num-inline {
  font-size: var(--ty-name); color: var(--text);
  font-variant-numeric: tabular-nums;
}
.md-row-unit { font-size: var(--ty-meta); color: var(--text-faint); }

/* A read-only fact inside a form, where a control would imply a choice. */
.md-field-label {
  display: block; margin-bottom: var(--s-2);
  font-size: var(--param-title-fs);
  letter-spacing: var(--param-title-ls);
  text-transform: var(--param-title-tt);
  color: var(--param-title-color);
  font-weight: var(--param-title-weight);
}
.md-fact-value { margin: 0; font-size: var(--ty-name); color: var(--text); }

/* ============== THE APPROVALS COUNTER ==============
   It rides INSIDE the tab, after the label, so it moves with it and inherits
   the tab's own active and hover states rather than being a second thing
   positioned on top. The number is decoration: the same count is on the tab as
   aria-description in words, because "3" announced alone means nothing. */
.md-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-inline-size: 18px; block-size: 18px;
  margin-inline-start: var(--s-2);
  padding-inline: var(--s-1);
  border-radius: 9px;
  /* RED CARRIES YELLOW. --on-danger IS --premium-yellow and is the same pair
     button.secondary.danger resolves; the pairing is referenced, never restated
     as a literal. */
  background: var(--accent);
  color: var(--on-danger);
  font-size: var(--ty-micro); letter-spacing: 0; font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ============== PRINT (S13) ==============
   A member of staff printing this screen wants the facts on it, not the
   instrument around them. Navigation, tabs, banners and every control come
   off; glass flattens to white so it survives a monochrome office printer.

   This is NOT the printed person record for banks and embassies - that is a
   document with legal weight, needs the crest and an "as of" attestation, and
   is deliberately a separate piece of work. This is only an honest printout of
   whatever screen happens to be open. */
@media print {
  .page-nav, .tabs-bar, .md-lang,
  .md-offline-banner,
  .md-actions, .md-row-end, .md-dead,
  .fb-busy, .md-toast-host, .popup-backdrop, .modal { display: none !important; }

  /* The SAMPLE DATA banner SURVIVES print. A printout of placeholder rows is the
     one artefact that can be mistaken for a real record long after the screen it
     came from is closed, so print is where the mark matters MOST, not least.
     Same rule as the HR Portal and the sample console. */
  .md-sample-banner {
    position: static;
    box-shadow: none;
    border: 0;
    border-bottom: 1px solid #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  html, body { background: #fff; }
  .page { max-width: none; padding: 0; }

  /* Glass is a screen material. On paper it is a hairline and nothing else. */
  .md-hello, .md-row, .card, .md-notice {
    background: #fff !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid #ddd;
  }
  .md-view[hidden] { display: none !important; }
  .md-row, .card, .md-hello { break-inside: avoid; }
  .md-head h2, .md-section-title { break-after: avoid; }
}

/* ==========================================================================
   EMBEDDED MODE - My Desk as the hub's user-island panel
   ==========================================================================
   Set by the detector in index.html <head>: html.md-embed. This block is the
   WHOLE of the visual difference between the standalone page and the panel.
   There is no second stylesheet and no second markup tree - every screen
   renderer, every card and every dialog below is byte-identical in both, which
   is the only way the tool's security boundary stays reviewable as one bundle.

   What embedded mode removes is PAGE FURNITURE, and each removal has a reason:

     .page-nav   the back pill points at "/", and in the panel you are already
                 standing on "/". A back link to the page you are on is a lie.
                 Its language toggle goes with it: the host's panel header
                 carries one, and it drives this document over the bridge.
     .hero       the panel header already says whose desk this is, in the same
                 pill that was clicked to open it. Saying it twice, 40px apart,
                 is what makes an embed look like a page in a box.
     footer      a trademark number and a registered company name are page
                 furniture. Inside a popup they are noise.

   Nothing here touches the gate, the sample-data banner, the offline banner or
   the delegation banner. Those are STATES OF THE TOOL and they are exactly as
   loud in the panel as they are on the page - a person holding borrowed
   authority must not be able to lose that notice by opening the desk in a
   smaller box. */

html.md-embed .page-nav,
html.md-embed .hero,
html.md-embed .page > footer { display: none !important; }

/* The host owns the material. The panel behind this document is glass, so the
   document paints NOTHING of its own - a canvas fill here would sit on top of
   the host's blur and turn the panel opaque from the inside. Individual cards
   keep their own surfaces; it is only the sheet behind them that goes. */
html.md-embed,
html.md-embed body { background: transparent; }

/* The panel is the viewport. No page gutters, no 1080px measure to centre
   inside, and no 140px of footer runway. The block-end padding is breathing
   room at the bottom of the panel, plus the phone's home indicator. */
html.md-embed .page {
  max-width: none;
  padding: 0 max(var(--s-5), env(safe-area-inset-right))
             calc(var(--s-6) + env(safe-area-inset-bottom))
             max(var(--s-5), env(safe-area-inset-left));
}

/* With the nav gone there is nothing to clear. --page-nav-h would leave the
   tab strip floating a nav-height below the top of the panel. */
html.md-embed .tabs-bar.sticky { top: 0; }
html.md-embed .tabs-bar { margin-top: var(--s-4); }

/* THE PANEL MUST NOT SCROLL THE HUB BEHIND IT. Reaching the end of the desk's
   scroll inside the frame otherwise chains outward and starts moving the hub
   page underneath - the single most common way an embedded panel feels broken. */
html.md-embed body { overscroll-behavior: contain; }

/* The two dialogs are position:fixed, so inside the frame they are already
   confined to the panel box - which is correct, the panel IS the window here.
   What does not survive is the desktop 460px width against a narrow panel, and
   the 100vh cap, which measures the frame and is therefore right but leaves no
   margin. Both are re-expressed against the panel. */
html.md-embed .modal {
  width: min(460px, calc(100% - var(--s-6)));
  max-height: calc(100% - var(--s-6));
}

/* ===========================================================================
   EMBEDDED MODE: THE PANEL IS THE MATERIAL
   ---------------------------------------------------------------------------
   Standalone /my-desk/ is a document on a canvas, so its cards carry their own
   glass. Embedded in the island that reasoning inverts: the host panel is
   already a lens, and every surface repainted here composites ON TOP of it.
   Measured before this block: the desk painted 367,151px2 of translucent fill
   over a 278,320px2 panel - 132% coverage, stacking - which is what turned a
   working 34%-transmittance panel into a solid cream sheet.

   Two separate faults are corrected.

   1. STACKED FILL. Alpha does not average, it accumulates. Panel .62 under
      .md-hello .22 composites to 1-(.38x.78) = .70 effective, and the rows at
      .42 reached .78. Individually each looked like glass; stacked they were
      paint.

   2. NESTED backdrop-filter, the one that actually did the damage. .md-hello
      and nav.tabs each ran their own blur(18px) saturate(1.4) INSIDE the
      panel's blur(22px). The inner filter re-samples the already-blurred
      composite, and two Gaussians in series are a third, much wider Gaussian
      (s = sqrt(18^2+22^2) ~ 28px) applied to content that had already lost its
      high frequencies. The result is flat colour by construction: no amount of
      lowering the host's alpha can recover detail a second blur has removed.
      Nothing here may re-lens. There is exactly one lens and the host owns it.

   Structure survives as hairlines and type hierarchy rather than as fill. This
   block is scoped entirely to html.md-embed; the standalone page is untouched.
   =========================================================================== */

/* No surface inside the frame may run its own backdrop-filter. */
html.md-embed .md-hello,
html.md-embed nav.tabs,
html.md-embed .tabs-bar {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* The greeting block was the single largest repaint (119,018px2, 43% of the
   panel). It carries the most important text on the desk, so it keeps a
   hairline and its type hierarchy and gives up only its fill. */
html.md-embed .md-hello {
  background: transparent;
  border: 1px solid rgba(20, 18, 14, 0.07);
}

html.md-embed .md-general-card,
html.md-embed .md-desk-leave {
  background: rgba(250, 250, 251, 0.16);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* The tab strip reads from weight and the active pill, not from a plate. */
html.md-embed nav.tabs { background: transparent; }

/* Rows are the densest small text in the panel and the only place a local
   scrim is justified. It is NEUTRAL now (250/250/251, achromatic) and a little
   denser, because the host fill it used to lean on has dropped from .26 cream
   to .13 neutral: legibility moved from the whole sheet to the strip directly
   behind the text, which is where it should always have been paid.

   TINT COUNT. Inside the frame this is the ONLY remaining fill. .md-hello is a
   hairline, nav.tabs is transparent, and the two banners that used to lay a
   yellow and a red wash across the top third of the panel - exactly where the
   specular is brightest - are gone with the elements themselves. */
html.md-embed .md-row { background: rgba(250, 250, 251, 0.16); }

/* Honest fallbacks, mirrored from the host. With no backdrop-filter the panel
   goes near-opaque and there is no refraction left to protect, so the desk
   takes its ordinary surfaces back rather than floating hairlines on a plate.
   Same for a reader who has asked for less transparency or more contrast. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html.md-embed .md-hello { background: var(--glass-bg); border: 0; }
  html.md-embed .md-row   { background: var(--glass-bg-strong); }
}
@media (prefers-reduced-transparency: reduce) {
  html.md-embed .md-hello { background: var(--glass-bg); border: 0; }
  html.md-embed .md-row   { background: var(--glass-bg-strong); }
}
@media (prefers-contrast: more) {
  html.md-embed .md-hello { background: var(--glass-bg); border: 1px solid var(--text); }
  html.md-embed .md-row   { background: var(--glass-bg-strong); }
}

/* LOCAL LEGIBILITY HALO, embedded only.

   READ THE LIMIT BEFORE TRUSTING THIS. Measured, not assumed:
     - over the real hub backdrop, greeting local bg rgb(247,235,209) -> 16.3:1
     - over a SYNTHETIC ALL-BLACK backdrop, local bg rgb(96,96,96)    -> 3.07:1
   So the halo softens a dark backdrop, it does NOT rescue one. A 2-6px shadow
   lifts the pixels touching each glyph, which is why type stays crisp, but it
   cannot lift a whole 260px text line off a black field. Do not read this
   block as "the panel is safe over anything". It is not.

   WHAT ACTUALLY CARRIES AA IS THE HOST FILL, AND IT IS CALIBRATED TO THIS PAGE.
   .26 clears AA with margin (worst real text 6.05:1, greeting 14.9:1) because
   the darkest pixel anywhere under the open panel, measured across the full
   scroll of the hub with the fill removed, is rgb(216,209,195). Nothing on the
   hub is a solid dark field - the dark pixels are text strokes and icon glyphs
   at 0.55-1.56% of the footprint, and a 30px Gaussian dissolves them.

   THE INVARIANT: if the hub ever gains a dark hero, a photographic band or a
   dark theme behind this panel, that premise dies and the ratios above must be
   re-measured. The fix then is a denser local scrim on .md-hello and .md-row,
   NOT a higher --desk-fill: raising the fill is what made this panel read as a
   solid cream sheet and got it rejected twice.

   The halo is kept because it costs no transparency anywhere on the panel,
   which a raised card fill would, and it is genuinely invisible over a light
   backdrop since it matches the fill it sits on.
   Radius stays tight so type keeps its edge; this is a halo, never a glow. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html.md-embed .md-hello,
  html.md-embed .md-row,
  html.md-embed .md-section-title {
    text-shadow:
      0 0 2px rgba(250, 250, 251, 0.94),
      0 0 5px rgba(250, 250, 251, 0.72);
  }
  /* The halo is for text sitting DIRECTLY on glass. Anything with its own
     solid plate already has its contrast and would only look smeared. */
  html.md-embed .md-hello .tag,
  html.md-embed .md-row .tag,
  html.md-embed .md-row button,
  html.md-embed .md-row-end .btn { text-shadow: none; }
}
/* No refraction means no varying backdrop, so the halo has nothing to guard. */
@media (prefers-reduced-transparency: reduce) {
  html.md-embed .md-hello, html.md-embed .md-row,
  html.md-embed .md-section-title { text-shadow: none; }
}
@media (prefers-contrast: more) {
  html.md-embed .md-hello, html.md-embed .md-row,
  html.md-embed .md-section-title { text-shadow: none; }
}
