/* MitaBase Pro — a product of ETMITA · https://etmita.com
   Copyright © ETMITA. All rights reserved. */
/*
 * public/ui-kit.css — the looks of MT.ui (src/shared/ui-kit.ts): the KPI
 * tile and the live dot, drawn the same way on every page (2026-10-28).
 * Tokens only (public/overview-tokens.css, `.mt-scope`), light and dark
 * from the same rules; logical properties only, so RTL needs nothing.
 */

/* ── the KPI tile ─────────────────────────────────────────────────── */
/* icon · title · the number with its "/ total" — no subtitle line. */
.mt-kpi {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 4px;
  align-items: center;
  text-align: start;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-body);
  font: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, transform .15s var(--mt-ease-out, cubic-bezier(.16, 1, .3, 1)), background .15s;
}
.mt-kpi.hidden { display: none !important; }
button.mt-kpi { cursor: pointer; }
button.mt-kpi:hover { transform: translateY(-1px); border-color: var(--border-strong); }
button.mt-kpi:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: 2px; }
.mt-kpi.is-on { border-color: var(--accent-fill-solid); background: var(--accent-soft); }
.mt-kpi-ic {
  grid-row: 1 / span 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--surface-inset); color: var(--accent);
}
.mt-kpi-l {
  grid-column: 2; grid-row: 1;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .78rem; font-weight: 700; line-height: 1.2; color: var(--text-secondary);
}
.mt-kpi-v {
  grid-column: 2; grid-row: 2;
  display: inline-flex; align-items: baseline; gap: 5px;
  justify-self: start; unicode-bidi: isolate;
}
.mt-kpi-n { font-size: 1.7rem; font-weight: 600; line-height: 1; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.mt-kpi-of { font-size: .9rem; font-weight: 600; line-height: 1; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.mt-kpi.is-alert .mt-kpi-n, .mt-kpi.is-alert .mt-kpi-ic { color: var(--status-expired-text); }
.mt-kpi-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── the live dot ─────────────────────────────────────────────────── */
/* The pulse is the dot's own ::after over the same box (inset 0, the same
   radius), so it grows from the dot's centre — the old ring was a sibling
   in a flex box and drifted off it. Only transform and opacity move. */
.mt-live-dot {
  --mt-live-size: 10px;
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--mt-live-size);
  height: var(--mt-live-size);
  border-radius: 50%;
  background: var(--accent-fill-solid);
  vertical-align: middle;
}
.mt-live-dot.hidden { display: none !important; }
.mt-live-dot.is-sm { --mt-live-size: 6px; }
.mt-live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  transform-origin: center;
  animation: mtLivePulse 1.8s cubic-bezier(0, 0, .2, 1) infinite;
  pointer-events: none;
}
@keyframes mtLivePulse {
  0% { transform: scale(1); opacity: .55; }
  80%, 100% { transform: scale(2.6); opacity: 0; }
}

/* ── the page head: MT.ui.pageHead (2026-10-28) ──────────────────────
   One card, the same surface, edge, radius and inline padding as the
   sections under it; title + subtitle at the start, one group at the end:
   the tabs directly before the buttons, all at one control height. */
.mt-phead {
  --mt-ctl-h: 36px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-block: 12px; padding-inline: 12px;
  border-radius: 14px; border: 1px solid var(--border-subtle);
  background: var(--surface-card); box-shadow: var(--shadow-sm);
}
.mt-phead.hidden { display: none !important; }
.mt-phead-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mt-phead-title {
  display: inline-flex; align-items: center; gap: 10px; margin: 0;
  font-family: var(--font-display), sans-serif; font-size: 1.2rem; font-weight: 600; letter-spacing: -.01em; color: var(--text-primary);
}
.mt-phead-sub { margin: 0; font-size: .74rem; color: var(--text-muted); }
.mt-phead-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-inline-start: auto; }
.mt-phead .mt-phead-r .dsp3-act { --act-h: var(--mt-ctl-h); height: var(--mt-ctl-h); min-height: var(--mt-ctl-h); }
.mt-phead .mt-phead-r [role="tablist"] { height: var(--mt-ctl-h); box-sizing: border-box; padding: 2px; }
.mt-phead .mt-phead-r [role="tablist"] > [role="tab"] { height: 100%; min-height: 0; }
@media (pointer: coarse) { .mt-phead { --mt-ctl-h: 44px; } }

/* ── the colour scheme follows the theme (2026-10-28) ────────────────
   The theme is body.dark (app.js). Without this a native calendar popup,
   a select's list and the date icon stayed light on the dark panel.
   Firefox before 121 has no :has — the body rule covers the form controls
   there. */
:root { color-scheme: light; }
:root:has(body.dark) { color-scheme: dark; }
body.dark { color-scheme: dark; }
body:not(.dark) { color-scheme: light; }

/* ── the date field: MT.ui.dateField ─────────────────────────────────
   The text is ours, de-DE in every language (`28.10.2026`); the native
   input lies over it, invisible, and still opens the system calendar.
   One control height (--mt-ctl-h) with the buttons beside it. */
.mt-date {
  --mt-ctl-h: 34px;
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  height: var(--mt-ctl-h); min-width: 0; padding-block: 0; padding-inline: 10px 12px;
  border-radius: 10px; border: 1px solid var(--field-line); background: var(--field-ground); color: var(--text-secondary);
  cursor: pointer; transition: border-color .12s, color .12s;
}
.mt-date.hidden { display: none !important; }
.mt-date:hover, .mt-date:focus-within { border-color: var(--accent-fill-solid); color: var(--text-primary); }
.mt-date:focus-within { box-shadow: 0 0 0 3px var(--accent-soft); }
.mt-date-ic { display: inline-flex; flex-shrink: 0; }
.mt-date-txt { font-family: var(--font-mono); font-size: .78rem; color: var(--text-primary); unicode-bidi: isolate; white-space: nowrap; }
.mt-date.is-empty .mt-date-txt { color: var(--text-muted); }
.mt-date > input.mt-date-in {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0;
  border: 0; background: transparent; opacity: 0; cursor: pointer; outline: none;
}
.mt-date > input.mt-date-in::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
@media (pointer: coarse) { .mt-date { --mt-ctl-h: 44px; } }

@media (prefers-reduced-motion: reduce) {
  .mt-date { transition: none; }
  .mt-kpi { transition: none; }
  .mt-live-dot::after { animation: none; opacity: 0; }
}

/* approve / reject (MT.ui.decide, 2026-10-28): one group, the no before
   the yes, so the yes sits at the inline end on every page */
.mt-decide { display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.mt-decide.hidden { display: none !important; }

/* ── the initials tile (MT.avatar.html({ fallback: "initials" })) ──── */
/* A person without a photo of their own: two letters on a tint of their
   own tone, hashed from the id (2026-10-29). The ground is the tone mixed
   into the card, the letters the primary text — so the contrast is the
   body text's in light and in dark, whatever the tone. */
.mt-av.mt-av--tn {
  background: color-mix(in srgb, var(--av-k, var(--mb-lime-deep)) 26%, var(--surface-card));
  color: var(--text-primary);
  border-color: color-mix(in srgb, var(--av-k, var(--mb-lime-deep)) 40%, transparent);
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1;
}
.mt-av.mt-av--t0 { --av-k: var(--mb-lime-deep); }
.mt-av.mt-av--t1 { --av-k: var(--status-info); }
.mt-av.mt-av--t2 { --av-k: var(--status-valid); }
.mt-av.mt-av--t3 { --av-k: var(--status-expiring); }
.mt-av.mt-av--t4 { --av-k: var(--mb-purple); }
.mt-av.mt-av--t5 { --av-k: var(--status-expired); }
