/* Mahdar — component stylesheet.
   Loaded after tokens.css, so every value below comes from a token.
   Everything is written with logical properties: the same rules serve
   RTL (the default) and the LTR English build with no overrides. */

/* ---------------------------------------------------------------- motion */
:root {
  --mh-ease-ink: cubic-bezier(0.2, 0.8, 0.2, 1);
  --mh-ease-settle: cubic-bezier(0.16, 1, 0.3, 1);
  --mh-ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --mh-dur-fast: 120ms;
  --mh-dur: 220ms;
  --mh-dur-slow: 420ms;
  --mh-dur-settle: 560ms;
  --mh-stagger: 90ms;
}

*, *::before, *::after { box-sizing: border-box; }

.mh, .mh-root {
  font-family: var(--font-arabic);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.mh-ltr { font-family: var(--font-latin); }

/* ------------------------------------------------------- the ink motif */
/* Ruled paper. One hairline every 32px, starting below the first line.
   Use on the minutes sheet and the live transcript only. */
.mh-ruled {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 31px,
    var(--rule) 31px,
    var(--rule) 32px
  );
  background-position: 0 6px;
}
.mh-ruled--wide {
  background-image: repeating-linear-gradient(
    to bottom, transparent 0, transparent 47px, var(--rule) 47px, var(--rule) 48px);
}
/* The margin rule of a notebook: a single clay line down the leading edge. */
.mh-margin-rule { border-inline-start: var(--border-hair) solid var(--clay-line); }

/* The live ink cursor: a nib-shaped bar that blinks while text is arriving. */
.mh-cursor {
  display: inline-block;
  inline-size: 3px;
  block-size: 1.05em;
  vertical-align: -0.16em;
  margin-inline-start: 2px;
  background: var(--clay);
  border-radius: 1px;
  transform: skewX(-12deg);
  animation: mh-blink 1.05s steps(2, start) infinite;
}
.mh-cursor--still { animation: none; }
@keyframes mh-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.15; } }

/* A meta list: items separated by a drawn hairline, never by a middle dot.
   In Arabic-Indic numerals U+0660 ZERO is itself a dot, so "٤٢ · ٦" reads as
   "٤٢٠ ٦". Each item is also its own bidi isolate. */
.mh-meta { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.mh-meta > span, .mh-row__meta > span, .mh-item__meta > span, .mh-notif__head > span { unicode-bidi: isolate; }
.mh-meta > span + span::before,
.mh-row__meta > span + span::before,
.mh-notif__head > span + span::before {
  content: "";
  display: inline-block;
  inline-size: var(--border-hair);
  block-size: 10px;
  vertical-align: -1px;
  background: var(--rule-strong);
  margin-inline-end: var(--space-2);
}

/* ------------------------------------------------------------- buttons */
.mh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-block-size: 48px;
  padding-inline: var(--space-5);
  border: var(--border-line) solid transparent;
  border-radius: var(--radius-lg);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  /* Labels are one to three words by rule; they never wrap and never truncate. */
  white-space: nowrap;
  transition: background var(--mh-dur-fast) var(--mh-ease-ink),
              box-shadow var(--mh-dur-fast) var(--mh-ease-ink),
              transform var(--mh-dur-fast) var(--mh-ease-ink),
              border-color var(--mh-dur-fast) var(--mh-ease-ink);
}
.mh-btn:focus-visible, .mh-btn.is-focus {
  outline: var(--border-thick) solid var(--focus);
  outline-offset: 2px;
}
.mh-btn--lg { min-block-size: 56px; font-size: 17px; padding-inline: var(--space-6); border-radius: var(--radius-xl); }
.mh-btn--sm { min-block-size: 36px; font-size: 13px; padding-inline: var(--space-4); border-radius: var(--radius-md); }
.mh-btn--block { inline-size: 100%; }

.mh-btn--primary { background: var(--clay); color: var(--on-clay); box-shadow: var(--shadow-sheet); }
.mh-btn--primary:hover, .mh-btn--primary.is-hover { background: var(--clay-strong); box-shadow: var(--shadow-raised); }
.mh-btn--primary:active, .mh-btn--primary.is-pressed { background: var(--clay-strong); box-shadow: var(--shadow-press); transform: translateY(1px); }

.mh-btn--secondary { background: transparent; color: var(--clay); border-color: var(--clay); }
.mh-btn--secondary:hover, .mh-btn--secondary.is-hover { background: var(--clay-soft); }
.mh-btn--secondary:active, .mh-btn--secondary.is-pressed { background: var(--clay-soft); border-color: var(--clay-strong); color: var(--clay-strong); transform: translateY(1px); }

.mh-btn--danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.mh-btn--danger:hover, .mh-btn--danger.is-hover { background: var(--danger-soft); }
.mh-btn--danger:active, .mh-btn--danger.is-pressed { background: var(--danger-soft); transform: translateY(1px); }
.mh-btn--danger-solid { background: var(--danger); color: var(--on-danger); border-color: var(--danger); }

.mh-btn--ghost { background: transparent; color: var(--ink-muted); }
.mh-btn--ghost:hover, .mh-btn--ghost.is-hover { background: var(--paper-sunken); color: var(--ink); }
.mh-btn--ghost:active, .mh-btn--ghost.is-pressed { background: var(--paper-sunken); transform: translateY(1px); }

.mh-btn[disabled], .mh-btn.is-disabled {
  background: var(--paper-sunken);
  color: var(--ink-ghost);
  border-color: transparent;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}
.mh-btn.is-loading { color: transparent; position: relative; pointer-events: none; }
.mh-btn.is-loading::after {
  content: "";
  position: absolute;
  inline-size: 18px; block-size: 18px;
  border: 2px solid currentColor;
  border-block-start-color: transparent;
  border-radius: 999px;
  color: var(--on-clay);
  animation: mh-spin 720ms linear infinite;
}
.mh-btn--secondary.is-loading::after, .mh-btn--ghost.is-loading::after, .mh-btn--danger.is-loading::after { color: var(--clay); }
@keyframes mh-spin { to { transform: rotate(360deg); } }

.mh-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  inline-size: 44px; block-size: 44px;
  border: none; border-radius: var(--radius-md);
  background: transparent; color: var(--ink-muted); cursor: pointer;
  transition: background var(--mh-dur-fast) var(--mh-ease-ink), color var(--mh-dur-fast) var(--mh-ease-ink);
}
.mh-iconbtn:hover, .mh-iconbtn.is-hover { background: var(--paper-sunken); color: var(--ink); }
.mh-iconbtn:active, .mh-iconbtn.is-pressed { background: var(--paper-sunken); transform: translateY(1px); }
.mh-iconbtn.is-disabled { color: var(--ink-ghost); pointer-events: none; }
.mh-iconbtn--filled { background: var(--paper-raised); box-shadow: var(--shadow-sheet); }
.mh-iconbtn:focus-visible, .mh-iconbtn.is-focus { outline: var(--border-thick) solid var(--focus); outline-offset: 2px; }

/* The one big action. Dominates the home screen. */
.mh-record {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-2);
  inline-size: 100%;
  min-block-size: 200px;
  padding: var(--space-6);
  border: none;
  border-radius: var(--radius-2xl);
  background: var(--clay);
  color: var(--on-clay);
  box-shadow: var(--shadow-raised);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--mh-dur) var(--mh-ease-ink), box-shadow var(--mh-dur) var(--mh-ease-ink);
}
.mh-record::after {
  /* a faint page-corner fold, the paper motif */
  content: "";
  position: absolute; inset-block-start: 0; inset-inline-end: 0;
  inline-size: 64px; block-size: 64px;
  background: linear-gradient(to bottom left, rgba(255, 255, 255, 0.16) 50%, transparent 50%);
}
.mh-record:hover, .mh-record.is-hover { transform: translateY(-2px); box-shadow: var(--shadow-raised); }
.mh-record:active, .mh-record.is-pressed { transform: translateY(1px) scale(0.995); box-shadow: var(--shadow-press); }
.mh-record:focus-visible { outline: var(--border-thick) solid var(--focus); outline-offset: 3px; }
.mh-record__label { font-size: 28px; font-weight: 700; }
.mh-record__hint { font-size: 13px; opacity: 0.86; }
.mh-record__mic { inline-size: 56px; block-size: 56px; margin-block-end: var(--space-1); }

/* --------------------------------------------------------------- chips */
.mh-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-block-size: 34px;
  padding-inline: var(--space-3);
  border: var(--border-hair) solid var(--rule-strong);
  border-radius: var(--radius-pill);
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 13px; font-weight: 600; line-height: 1;
  cursor: pointer; white-space: nowrap;
  transition: background var(--mh-dur-fast) var(--mh-ease-ink), border-color var(--mh-dur-fast) var(--mh-ease-ink);
}
.mh-chip:hover, .mh-chip.is-hover { background: var(--paper-sunken); }
.mh-chip.is-selected { background: var(--clay-soft); border-color: var(--clay); color: var(--clay-strong); }
.mh-chip.is-disabled { color: var(--ink-ghost); border-color: var(--rule); pointer-events: none; }
.mh-chip:focus-visible, .mh-chip.is-focus { outline: var(--border-thick) solid var(--focus); outline-offset: 2px; }
.mh-chip--add { border-style: dashed; color: var(--clay); background: transparent; }
.mh-chip--tag { border-radius: var(--radius-xs); background: var(--paper-sunken); border-color: transparent; font-weight: 500; }
.mh-chip__x { color: var(--ink-faint); font-size: 15px; line-height: 1; }

/* Status chip: colour AND a glyph AND a word — never colour alone. */
.mh-status {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 3px var(--space-2);
  border-radius: var(--radius-xs);
  font-size: 12px; font-weight: 600; line-height: 1.5;
  border: var(--border-hair) solid transparent;
  white-space: nowrap;
}
.mh-status--ready { background: var(--teal-soft); color: var(--teal); border-color: var(--teal-line); }
.mh-status--writing { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.mh-status--none { background: var(--paper-sunken); color: var(--ink-faint); border-color: var(--rule-strong); }
.mh-status--queued { background: var(--paper-sunken); color: var(--ink-muted); border-color: var(--rule-strong); }
.mh-status--live { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }

/* ------------------------------------------------------------ avatars */
.mh-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  inline-size: 32px; block-size: 32px;
  border-radius: 999px;
  background: var(--paper-sunken);
  color: var(--ink-muted);
  font-size: 12px; font-weight: 700;
  border: var(--border-line) solid var(--paper-raised);
  flex: none;
}
.mh-avatar--sm { inline-size: 24px; block-size: 24px; font-size: 10px; }
.mh-avatar--lg { inline-size: 44px; block-size: 44px; font-size: 15px; }
.mh-avatar--clay { background: var(--clay-soft); color: var(--clay-strong); }
.mh-avatar--teal { background: var(--teal-soft); color: var(--teal); }
.mh-avatar--amber { background: var(--amber-soft); color: var(--amber); }
.mh-avatar--ink { background: var(--paper-inverse); color: var(--ink-inverse); }
.mh-avatars { display: inline-flex; }
.mh-avatars > .mh-avatar + .mh-avatar { margin-inline-start: -8px; }

/* -------------------------------------------------- the live text block */
.mh-live {
  position: relative;
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  background: var(--paper-sunken);
  color: var(--ink);
  font-size: 26px; line-height: 48px; font-weight: 500;
  overflow: hidden;
}
.mh-live--onpaper { background: transparent; padding-inline: 0; }
.mh-live--lg { font-size: 22px; line-height: 40px; }
.mh-live__flow > span { animation: mh-phrase-in var(--mh-dur-slow) var(--mh-ease-ink) both; }
.mh-live__tail { color: var(--ink-faint); font-weight: 400; }
.mh-live__speaker {
  display: inline-block;
  color: var(--clay-strong);
  font-size: 15px; font-weight: 700;
  padding: 1px var(--space-2);
  margin-inline-end: var(--space-2);
  background: var(--clay-soft);
  border-radius: var(--radius-xs);
  vertical-align: 0.22em;
}
.mh-live__mark { background: var(--mark); border-radius: 3px; padding: 0 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.mh-live__fade {
  position: absolute; inset-inline: 0; inset-block-start: 0; block-size: 56px;
  background: linear-gradient(to bottom, var(--paper-sunken), transparent);
  pointer-events: none;
}
@keyframes mh-phrase-in {
  from { opacity: 0; transform: translateY(6px); filter: blur(2px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* ------------------------------------------------------ timer, waveform */
.mh-timer {
  unicode-bidi: isolate;
  font-family: var(--font-latin);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: 0.01em;
  font-size: 52px; line-height: 56px; font-weight: 600;
  color: var(--ink);
}
.mh-timer--md { font-size: 28px; line-height: 32px; }
.mh-timer--sm { font-size: 15px; line-height: 20px; font-weight: 500; color: var(--ink-faint); }

.mh-rec-dot {
  display: inline-block; inline-size: 12px; block-size: 12px;
  border-radius: 999px; background: var(--danger); flex: none;
  position: relative;
}
.mh-rec-dot::after {
  content: ""; position: absolute; inset: -4px;
  border-radius: 999px; border: 2px solid var(--danger);
  animation: mh-pulse 1.8s var(--mh-ease-settle) infinite;
}
.mh-rec-dot--paused { background: var(--ink-faint); }
.mh-rec-dot--paused::after { display: none; }
@keyframes mh-pulse {
  0% { transform: scale(0.7); opacity: 0.9; }
  70% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

.mh-wave { display: flex; align-items: center; gap: 3px; block-size: 44px; }
.mh-wave__bar {
  inline-size: 3px; border-radius: 2px;
  background: var(--clay);
  block-size: 30%;
  transform-origin: center;
}
.mh-wave--quiet .mh-wave__bar { background: var(--rule-strong); }
.mh-wave--live .mh-wave__bar { animation: mh-wave 900ms var(--mh-ease-settle) infinite alternate; }
@keyframes mh-wave { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }
.mh-wave--player { block-size: 56px; gap: 2px; }
.mh-wave--player .mh-wave__bar { inline-size: 2px; background: var(--rule-strong); }
.mh-wave--player .mh-wave__bar.is-played { background: var(--clay); }
.mh-wave--player .mh-wave__bar.is-mark { background: var(--mark-line); }

/* -------------------------------------------------------- section marks */
.mh-marker {
  display: inline-flex; align-items: center; justify-content: center;
  inline-size: 22px; block-size: 22px; flex: none;
  margin-inline-end: var(--space-3);
  font-size: 13px; font-weight: 700; line-height: 1;
  border-radius: 999px;
  margin-block-start: 4px;
}
.mh-marker--point { color: var(--ink-muted); }
.mh-marker--decision { background: var(--teal-soft); color: var(--teal); }
.mh-marker--task { border: var(--border-line) solid var(--rule-strong); color: transparent; }
.mh-marker--task.is-done { border-color: var(--teal); background: var(--teal); color: var(--on-teal); }
.mh-marker--risk { background: var(--amber-soft); color: var(--amber); }
.mh-marker--follow { background: var(--paper-sunken); color: var(--ink-muted); }

.mh-mline { display: flex; align-items: flex-start; padding-block: var(--space-2); }
.mh-mline__text { font-size: 15px; line-height: 26px; }

/* ---------------------------------------------------------- paper sheet */
.mh-sheet {
  background-color: var(--paper-raised);
  border: var(--border-hair) solid var(--rule);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sheet);
}
.mh-sheet--flat { box-shadow: var(--shadow-none); }
.mh-card { background-color: var(--paper-raised); border: var(--border-hair) solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-sheet); }

/* ------------------------------------------------------ action item card */
.mh-item {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--paper-raised);
  border: var(--border-hair) solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sheet);
}
.mh-item.is-done { background: var(--paper); box-shadow: var(--shadow-none); }
.mh-item.is-done .mh-item__title { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: var(--teal); }
.mh-item.is-overdue { border-color: var(--amber-line); }
.mh-item__body { flex: 1 1 auto; min-inline-size: 0; }
.mh-item__title { font-size: 17px; font-weight: 600; line-height: 26px; }
.mh-item__meta { display: flex; align-items: center; gap: var(--space-3); margin-block-start: var(--space-2); flex-wrap: wrap; }
.mh-item__owner { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.mh-item__due { unicode-bidi: isolate; display: inline-flex; align-items: center; gap: var(--space-1); font-size: 12px; font-weight: 600; color: var(--ink-faint); }
.mh-item__due.is-soon { color: var(--amber); }
.mh-item__check {
  inline-size: 24px; block-size: 24px; flex: none; margin-block-start: 2px;
  border: var(--border-line) solid var(--rule-strong);
  border-radius: 999px; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent;
}
.mh-item__check.is-done { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }

/* -------------------------------------------------------------- callout */
.mh-callout {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border-inline-start: var(--border-heavy) solid var(--amber);
  background: var(--amber-soft);
  color: var(--ink);
  display: flex; gap: var(--space-3); align-items: flex-start;
}
.mh-callout__icon { color: var(--amber); flex: none; margin-block-start: 2px; }
.mh-callout__title { font-size: 15px; font-weight: 700; }
.mh-callout__body { font-size: 14px; line-height: 24px; color: var(--ink); }
.mh-callout--error { border-inline-start-color: var(--danger); background: var(--danger-soft); }
.mh-callout--error .mh-callout__icon { color: var(--danger); }
.mh-callout--done { border-inline-start-color: var(--teal); background: var(--teal-soft); }
.mh-callout--done .mh-callout__icon { color: var(--teal); }
.mh-callout--quiet { border-inline-start-color: var(--rule-strong); background: var(--paper-sunken); }
.mh-callout--quiet .mh-callout__icon { color: var(--ink-faint); }

/* ----------------------------------------------------------------- tabs */
.mh-tabs { display: flex; gap: var(--space-5); border-block-end: var(--border-hair) solid var(--rule); }
.mh-tab {
  padding-block: var(--space-3);
  border: none; background: none; cursor: pointer;
  font: inherit; font-size: 15px; font-weight: 600;
  color: var(--ink-faint);
  position: relative;
}
.mh-tab.is-active { color: var(--ink); }
.mh-tab.is-active::after {
  content: ""; position: absolute; inset-inline: 0; inset-block-end: -1px;
  block-size: var(--border-thick); background: var(--clay); border-radius: 2px;
}
.mh-tab:hover { color: var(--ink); }
.mh-tab:focus-visible { outline: var(--border-thick) solid var(--focus); outline-offset: 2px; border-radius: var(--radius-xs); }
.mh-tab .mh-tab__count { font-size: 12px; color: var(--ink-faint); margin-inline-start: var(--space-1); font-variant-numeric: tabular-nums; }

.mh-seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--paper-sunken); border-radius: var(--radius-pill);
}
.mh-seg__btn {
  border: none; background: transparent; cursor: pointer; font: inherit;
  font-size: 13px; font-weight: 600; color: var(--ink-faint);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill);
}
.mh-seg__btn.is-active { background: var(--paper-raised); color: var(--ink); box-shadow: var(--shadow-sheet); }

/* --------------------------------------------------------- bottom sheet */
.mh-scrim { position: absolute; inset: 0; background: var(--overlay); }
.mh-bottomsheet {
  background: var(--paper-raised);
  border-start-start-radius: var(--radius-2xl);
  border-start-end-radius: var(--radius-2xl);
  box-shadow: var(--shadow-overlay);
  padding: var(--space-3) var(--space-5) var(--space-6);
  animation: mh-sheet-up var(--mh-dur-slow) var(--mh-ease-settle) both;
}
.mh-bottomsheet__handle {
  inline-size: 44px; block-size: 4px; border-radius: 999px;
  background: var(--rule-strong); margin: 0 auto var(--space-4);
}
.mh-bottomsheet__title { font-size: 19px; font-weight: 600; margin-block-end: var(--space-1); }
.mh-bottomsheet__sub { font-size: 13px; color: var(--ink-faint); }
@keyframes mh-sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------------------------------------------------------- menus */
.mh-menu { background: var(--paper-raised); border-radius: var(--radius-xl); box-shadow: var(--shadow-overlay); padding: var(--space-2); }
.mh-menu__item {
  display: flex; align-items: center; gap: var(--space-3);
  inline-size: 100%; padding: var(--space-3) var(--space-3);
  border: none; background: transparent; cursor: pointer; font: inherit;
  font-size: 15px; font-weight: 500; color: var(--ink);
  border-radius: var(--radius-md); text-align: start;
}
.mh-menu__item:hover, .mh-menu__item.is-hover { background: var(--paper-sunken); }
.mh-menu__item.is-danger { color: var(--danger); }
.mh-menu__item.is-disabled { color: var(--ink-ghost); pointer-events: none; }
.mh-menu__icon { color: var(--ink-muted); flex: none; display: inline-flex; }
.mh-menu__item.is-danger .mh-menu__icon { color: var(--danger); }
.mh-menu__item.is-disabled .mh-menu__icon { color: var(--ink-ghost); }
.mh-menu__hint { margin-inline-start: auto; font-size: 12px; color: var(--ink-faint); unicode-bidi: isolate; }
.mh-menu__sep { block-size: 1px; background: var(--rule); margin: var(--space-2) var(--space-3); }

/* --------------------------------------------------------------- toasts */
.mh-toast {
  display: inline-flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--paper-inverse); color: var(--ink-inverse);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-raised);
  font-size: 14px; font-weight: 600;
  animation: mh-toast-in var(--mh-dur) var(--mh-ease-settle) both;
}
.mh-toast__icon { flex: none; display: inline-flex; }
.mh-toast--saved .mh-toast__icon { color: var(--teal); }
.mh-toast--error .mh-toast__icon { color: var(--danger); }
.mh-toast__action { margin-inline-start: var(--space-3); color: var(--clay); font-weight: 700; cursor: pointer; background: none; border: none; font: inherit; }
@keyframes mh-toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------------------------------------------------- empty state */
.mh-empty { text-align: center; padding: var(--space-8) var(--space-5); }
.mh-empty__art { margin: 0 auto var(--space-5); color: var(--clay-line); display: flex; justify-content: center; }
.mh-empty__title { font-size: 19px; font-weight: 600; margin-block-end: var(--space-2); }
.mh-empty__body { font-size: 14px; line-height: 24px; color: var(--ink-faint); max-inline-size: 30ch; margin: 0 auto var(--space-5); }

/* ------------------------------------------------------------- skeleton */
.mh-skel { background: var(--skeleton); border-radius: var(--radius-xs); position: relative; overflow: hidden; }
.mh-skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to left, transparent, var(--paper-raised), transparent);
  opacity: 0.55;
  animation: mh-shimmer 1.35s var(--mh-ease-settle) infinite;
}
.mh-skel--line { block-size: 12px; }
.mh-skel--title { block-size: 20px; border-radius: var(--radius-xs); }
.mh-skel--circle { border-radius: 999px; }
@keyframes mh-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------------------------------------------------------------- forms */
.mh-field { display: block; }
.mh-field__label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-muted); margin-block-end: var(--space-2); }
.mh-input {
  inline-size: 100%; min-block-size: 48px;
  padding: var(--space-3) var(--space-4);
  background: var(--paper-sunken);
  border: var(--border-line) solid var(--rule-strong);
  border-radius: var(--radius-md);
  font: inherit; font-size: 15px; color: var(--ink);
}
.mh-input::placeholder { color: var(--ink-faint); }
.mh-input:hover { border-color: var(--ink-faint); }
.mh-input:focus, .mh-input.is-focus { outline: var(--border-thick) solid var(--focus); outline-offset: 2px; border-color: var(--clay); background: var(--paper-raised); }
.mh-input.is-error { border-color: var(--danger); background: var(--danger-soft); }
.mh-input.is-disabled, .mh-input[disabled] { color: var(--ink-ghost); border-color: var(--rule); background: var(--paper); }
.mh-field__hint { display: block; font-size: 12px; line-height: 18px; color: var(--ink-faint); margin-block-start: var(--space-2); }
.mh-field__error { font-size: 12px; font-weight: 600; color: var(--danger); margin-block-start: var(--space-2); display: flex; gap: var(--space-1); align-items: center; }
.mh-input--key { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.02em; direction: ltr; text-align: start; }

.mh-search {
  display: flex; align-items: center; gap: var(--space-3);
  min-block-size: 48px; padding-inline: var(--space-4);
  background: var(--paper-sunken);
  border: var(--border-hair) solid transparent;
  border-radius: var(--radius-pill);
  color: var(--ink-faint);
}
.mh-search.is-focus { border-color: var(--clay); background: var(--paper-raised); outline: var(--border-thick) solid var(--focus); outline-offset: 2px; }
.mh-search.is-disabled { background: var(--paper); border-color: var(--rule); color: var(--ink-ghost); pointer-events: none; }
.mh-search.is-disabled input::placeholder { color: var(--ink-ghost); }
.mh-search input { flex: 1 1 auto; border: none; background: none; font: inherit; font-size: 15px; color: var(--ink); outline: none; min-inline-size: 0; }
.mh-search input::placeholder { color: var(--ink-faint); }

.mh-switch {
  inline-size: 48px; block-size: 28px; border-radius: 999px;
  background: var(--rule-strong); border: none; cursor: pointer;
  position: relative; flex: none; transition: background var(--mh-dur) var(--mh-ease-ink);
}
.mh-switch::after {
  content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px;
  inline-size: 22px; block-size: 22px; border-radius: 999px;
  background: var(--paper-raised); box-shadow: var(--shadow-sheet);
  transition: transform var(--mh-dur) var(--mh-ease-ink);
}
.mh-switch.is-on { background: var(--clay); }
.mh-switch.is-on::after { transform: translateX(-20px); }
[dir="ltr"] .mh-switch.is-on::after { transform: translateX(20px); }
.mh-switch.is-disabled { background: var(--rule); pointer-events: none; }

/* Provider selector: radio cards. */
.mh-provider { display: grid; gap: var(--space-3); }
.mh-provider__opt {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4);
  border: var(--border-line) solid var(--rule-strong);
  border-radius: var(--radius-lg);
  background: var(--paper-raised);
  cursor: pointer;
}
.mh-provider__opt.is-selected { border-color: var(--clay); background: var(--clay-soft); }
.mh-provider__opt.is-disabled { border-color: var(--rule); color: var(--ink-ghost); pointer-events: none; }
.mh-provider__radio {
  inline-size: 20px; block-size: 20px; border-radius: 999px; flex: none; margin-block-start: 2px;
  border: var(--border-thick) solid var(--rule-strong); background: transparent;
}
.mh-provider__opt.is-selected .mh-provider__radio { border-color: var(--clay); box-shadow: inset 0 0 0 4px var(--clay); }
.mh-provider__title { font-size: 15px; font-weight: 600; display: block; }
.mh-provider__desc { font-size: 13px; line-height: 22px; color: var(--ink-faint); margin-block-start: 2px; display: block; }

/* ----------------------------------------------------------------- rows */
.mh-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--paper-raised);
  border: var(--border-hair) solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sheet);
  cursor: pointer;
  transition: box-shadow var(--mh-dur-fast) var(--mh-ease-ink), transform var(--mh-dur-fast) var(--mh-ease-ink);
}
.mh-row:hover, .mh-row.is-hover { box-shadow: var(--shadow-raised); transform: translateY(-1px); }
.mh-row.is-pressed { box-shadow: var(--shadow-press); transform: translateY(1px); }
.mh-row--plain { background: transparent; border: none; box-shadow: none; border-radius: 0; }
.mh-row__body { flex: 1 1 auto; min-inline-size: 0; }
.mh-row__title { font-size: 17px; font-weight: 600; line-height: 26px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-row__meta { font-size: 12px; font-weight: 500; color: var(--ink-faint); margin-block-start: 2px; display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.mh-row__end { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.mh-row__chev { color: var(--ink-ghost); display: inline-flex; }
[dir="ltr"] .mh-row__chev { transform: scaleX(-1); }

.mh-hit { background: var(--mark); color: var(--ink); border-radius: 3px; padding: 0 2px; }
.mh-hit__snip { font-size: 14px; line-height: 24px; color: var(--ink-muted); margin-block-start: var(--space-2); }

/* ----------------------------------------------------------- folder tree */
.mh-tree { font-size: 15px; }
.mh-tree__node {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md); cursor: pointer; color: var(--ink);
  position: relative;
}
.mh-tree__node:hover { background: var(--paper-sunken); }
.mh-tree__node.is-active { background: var(--clay-soft); color: var(--clay-strong); font-weight: 600; }
.mh-tree__node .mh-tree__count { margin-inline-start: auto; font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
.mh-tree__node--nested::before {
  content: ""; position: absolute; inset-block: 3px; inset-inline-start: -10px;
  inline-size: var(--border-hair); background: var(--rule);
}
.mh-tree__icon { color: var(--ink-faint); flex: none; display: inline-flex; }
.mh-tree__node.is-active .mh-tree__icon { color: var(--clay); }

/* ------------------------------------------------------ notification card */
.mh-notif {
  background: var(--paper-raised);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-raised);
  padding: var(--space-4);
  border: var(--border-hair) solid var(--rule);
}
.mh-notif__head { display: flex; align-items: center; gap: var(--space-2); font-size: 12px; font-weight: 600; color: var(--ink-faint); }
.mh-notif__app { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--clay); }
.mh-notif__title { font-size: 15px; font-weight: 700; margin-block-start: var(--space-2); }
.mh-notif__body { font-size: 13px; line-height: 21px; color: var(--ink-muted); margin-block-start: 2px; }
.mh-notif__actions { display: flex; gap: var(--space-2); margin-block-start: var(--space-3); border-block-start: var(--border-hair) solid var(--rule); padding-block-start: var(--space-2); }
.mh-notif__action { border: none; background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--clay); cursor: pointer; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.mh-notif__action:hover { background: var(--clay-soft); }

/* -------------------------------------------------------- upgrade banner */
.mh-banner {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--clay-soft);
  border: var(--border-hair) solid var(--clay-line);
  color: var(--ink);
}
.mh-banner__title { font-size: 15px; font-weight: 700; }
.mh-banner__body { font-size: 13px; line-height: 22px; color: var(--ink-muted); margin-block-start: 2px; }
.mh-banner--quiet { background: var(--paper-sunken); border-color: var(--rule-strong); }
.mh-banner__meter { block-size: 6px; border-radius: 999px; background: var(--paper-raised); overflow: hidden; margin-block-start: var(--space-3); }
.mh-banner__meter > span { display: block; block-size: 100%; background: var(--clay); border-radius: 999px; }
.mh-banner__meter.is-full > span { background: var(--amber); }

/* ------------------------------------------------------------- progress */
.mh-progress { display: grid; gap: var(--space-3); }
.mh-progress__step { display: flex; align-items: center; gap: var(--space-3); font-size: 15px; color: var(--ink-faint); }
.mh-progress__dot {
  inline-size: 22px; block-size: 22px; border-radius: 999px; flex: none;
  border: var(--border-line) solid var(--rule-strong);
  display: inline-flex; align-items: center; justify-content: center; color: transparent;
}
.mh-progress__step.is-done { color: var(--ink); }
.mh-progress__step.is-done .mh-progress__dot { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }
.mh-progress__step.is-active { color: var(--ink); font-weight: 600; }
.mh-progress__step.is-active .mh-progress__dot { border-color: var(--clay); border-block-start-color: transparent; animation: mh-spin 900ms linear infinite; }
.mh-progress__time { margin-inline-start: auto; font-size: 12px; color: var(--ink-faint); unicode-bidi: isolate; }

.mh-queue { display: flex; align-items: center; gap: var(--space-2); }
.mh-queue__pip { inline-size: 10px; block-size: 10px; border-radius: 999px; background: var(--rule-strong); flex: none; }
.mh-queue__pip.is-you { background: var(--clay); box-shadow: 0 0 0 3px var(--clay-soft); }

/* ------------------------------------------------------------- QR block */
.mh-qr {
  display: inline-flex; flex-direction: column; align-items: center; gap: var(--space-3);
  padding: var(--space-5);
  background: var(--paper-raised);
  border: var(--border-hair) solid var(--rule);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sheet);
}
.mh-qr__code { border-radius: var(--radius-md); overflow: hidden; display: block; }
.mh-qr__label { font-size: 13px; font-weight: 600; color: var(--ink-muted); text-align: center; }
.mh-qr__url { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); direction: ltr; }

/* -------------------------------------------------------- audio scrubber */
.mh-scrub { display: grid; gap: var(--space-2); }
.mh-scrub__track { block-size: 4px; border-radius: 999px; background: var(--rule-strong); position: relative; }
.mh-scrub__fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--clay); border-radius: 999px; }
.mh-scrub__knob { position: absolute; inset-block-start: 50%; inline-size: 14px; block-size: 14px; border-radius: 999px; background: var(--clay); transform: translate(50%, -50%); box-shadow: var(--shadow-sheet); }
[dir="ltr"] .mh-scrub__knob { transform: translate(-50%, -50%); }
.mh-scrub__times { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; direction: ltr; }
.mh-scrub__tick { position: absolute; inset-block: -5px; inline-size: 2px; background: var(--mark-line); border-radius: 1px; }

/* ------------------------------------------------------- quoted moment */
.mh-quote {
  border-inline-start: var(--border-heavy) solid var(--mark-line);
  background: var(--paper-sunken);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 15px; line-height: 26px;
}
.mh-quote__time { display: flex; align-items: center; gap: var(--space-1); font-family: var(--font-latin); font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; margin-block-end: var(--space-1); }

/* ---------------------------------------------------------- transcript */
.mh-tx { display: grid; gap: var(--space-5); }
.mh-tx__para { display: grid; grid-template-columns: 56px 1fr; gap: var(--space-3); align-items: start; }
.mh-tx__time { unicode-bidi: isolate; font-family: var(--font-latin); font-size: 13px; font-weight: 500; color: var(--ink-faint); font-variant-numeric: tabular-nums; padding-block-start: 6px; }
.mh-tx__speaker { font-size: 13px; font-weight: 700; color: var(--clay-strong); margin-block-end: 2px; }
.mh-tx__text { font-size: 17px; line-height: 34px; }
.mh-tx__text .is-playing { background: var(--clay-soft); border-radius: 4px; box-shadow: 0 0 0 3px var(--clay-soft); }

/* -------------------------------------------------------------- top bar */
.mh-bar { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); min-block-size: 56px; }
.mh-bar__title { font-size: 17px; font-weight: 600; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-bar--sticky { position: sticky; inset-block-start: 0; background: var(--paper); border-block-end: var(--border-hair) solid var(--rule); z-index: 2; }

/* ------------------------------------------------------- print layout */
.mh-print {
  background: #ffffff; color: #141c26;
  padding: 48px 56px;
  font-family: var(--font-arabic);
  inline-size: 794px;
}
.mh-print h1 { font-size: 26px; margin: 0 0 6px; }
.mh-print__meta { font-size: 12px; color: #5b6875; border-block-end: 1px solid #d5cdbb; padding-block-end: 12px; margin-block-end: 20px; }
.mh-print h2 { font-size: 12px; letter-spacing: 0.08em; color: #5b6875; margin: 24px 0 8px; }
.mh-print table { inline-size: 100%; border-collapse: collapse; font-size: 13px; }
.mh-print th, .mh-print td { border: 1px solid #d5cdbb; padding: 8px 10px; text-align: start; }
.mh-print th { background: #f3ede1; font-weight: 700; }
.mh-print__foot { margin-block-start: 32px; border-block-start: 1px solid #d5cdbb; padding-block-start: 10px; font-size: 11px; color: #5b6875; display: flex; justify-content: space-between; }

/* ============================================================
   Documentation scaffolding — frames and grids used by the
   previews in this system only. Not product classes; do not
   ship them in the app.
   ============================================================ */
.mh-canvas { padding: 24px; background: var(--paper); min-block-size: 100%; }
.mh-stack { display: grid; gap: 16px; align-content: start; }
.mh-stack--sm { gap: 8px; }
.mh-stack--lg { gap: 24px; }
.mh-flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mh-flex--top { align-items: flex-start; }
.mh-flex--nowrap { flex-wrap: nowrap; }
.mh-flex--nowrap > * { min-inline-size: 0; }
.mh-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mh-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mh-spacer { flex: 1 1 auto; }
.mh-lbl { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.mh-note { font-size: 12px; line-height: 20px; color: var(--ink-faint); }
.mh-themebox { background: var(--paper); padding: 18px; border-radius: 22px; }

.mh-phone {
  inline-size: 390px; block-size: 844px; flex: none;
  background: var(--paper);
  border: 10px solid #101418;
  border-radius: 46px;
  box-shadow: var(--shadow-raised);
  overflow: hidden;
  position: relative;
  display: flex; flex-direction: column;
}
.mh-phone__status {
  block-size: 44px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; font-family: var(--font-latin); font-size: 12px; font-weight: 600;
  color: var(--ink); direction: ltr;
}
.mh-phone__screen { flex: 1 1 auto; overflow: hidden; position: relative; display: flex; flex-direction: column; }
.mh-phone__home { block-size: 22px; flex: none; display: flex; align-items: center; justify-content: center; }
.mh-phone__home::after { content: ""; inline-size: 128px; block-size: 5px; border-radius: 999px; background: var(--ink); opacity: 0.35; }

.mh-browser {
  background: var(--paper);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-raised);
  border: var(--border-hair) solid var(--rule);
  display: flex; flex-direction: column;
}
.mh-browser__chrome {
  block-size: 40px; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; background: var(--paper-sunken); border-block-end: var(--border-hair) solid var(--rule);
  direction: ltr; flex: none;
}
.mh-browser__dot { inline-size: 10px; block-size: 10px; border-radius: 999px; background: var(--rule-strong); flex: none; }
.mh-browser__url {
  flex: 1 1 auto; margin-inline-start: 8px; block-size: 24px; border-radius: 999px;
  background: var(--paper); display: flex; align-items: center; padding: 0 12px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint);
}

.mh-swatch { border-radius: var(--radius-md); block-size: 64px; border: var(--border-hair) solid var(--rule); }
.mh-pair { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .mh-cursor { opacity: 1; }
}
