/* Native feel: type, colour, materials and motion tuned to match macOS/iOS. Loaded last; changes no layout.
   1 Type     the device's own UI font (SF Pro on Apple, Segoe UI Variable on Windows), optical sizing, Apple-style tracking, aligned numbers
   2 Colour   brand teal and blue in Display P3 where the screen can show it (sRGB elsewhere); crisper text contrast
   3 Icons    thinner, even strokes drawn at geometric precision
   4 Material frosted top bar (blur + saturation) over the turquoise canvas
   5 Motion   one spring curve; interactions in 140-260 ms, never longer; press feedback; quicker page arrival; reduced motion respected */

/* ── 1 Type ───────────────────────────────────────────────────────────────────────────────────────────────────────────────── */
:root {
  --ui-font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", "Figtree", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ui-font-display: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", "Figtree", Roboto, sans-serif;
}
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-kerning: normal;
  font-optical-sizing: auto; font-synthesis-weight: none; -webkit-text-size-adjust: 100%; }
.ui-body, .ui-body button, .ui-body input, .ui-body select, .ui-body textarea { font-family: var(--ui-font); }
/* body text: no tracking override, so Safari applies SF Pro's own optical tracking as macOS does */
.ui-body :is(h1, .ui-page-title, .ui-page-header h1) { font-family: var(--ui-font-display); letter-spacing: -0.022em; font-weight: 700; }
.ui-body h2 { font-family: var(--ui-font-display); letter-spacing: -0.016em; font-weight: 590; }
.ui-body :is(h3, h4, .ui-card__title) { letter-spacing: -0.01em; font-weight: 590; }
.ui-body :is(.ui-table, table, .ui-stat, .ui-badge, .pp-stat, time, code) { font-variant-numeric: tabular-nums; }
.ui-body ::selection { background: rgba(20, 198, 194, 0.28); }

/* ── 2 Colour (wide gamut) ────────────────────────────────────────────────────────────────────────────────────────────────── */
:root:not([data-theme="dark"]) { --ui-text: #0B1424; --ui-text-2: #2E3B4E; }
@supports (color: color(display-p3 1 1 1)) {
  :root {
    --ui-accent: color(display-p3 0.02 0.76 0.74);
    --th-primary: linear-gradient(120deg, color(display-p3 0.0 0.58 0.56) 0%, color(display-p3 0.02 0.49 0.6) 50%, color(display-p3 0.15 0.36 0.78) 100%);
    --th-primary-hover: linear-gradient(120deg, color(display-p3 0.0 0.52 0.5) 0%, color(display-p3 0.02 0.44 0.55) 50%, color(display-p3 0.13 0.31 0.7) 100%);
  }
  :root:not([data-theme="dark"]) {
    --th-canvas: radial-gradient(1200px 620px at 0% 0%, color(display-p3 0.1 0.82 0.8 / 0.14), transparent 62%),
                 radial-gradient(1100px 600px at 100% 0%, color(display-p3 0.25 0.65 0.96 / 0.09), transparent 62%),
                 linear-gradient(180deg, color(display-p3 0.92 0.98 0.97) 0%, color(display-p3 0.95 0.985 0.985) 45%, color(display-p3 0.975 0.993 0.993) 100%);
  }
}

/* ── 3 Icons ──────────────────────────────────────────────────────────────────────────────────────────────────────────────── */
.ui-body .icon { shape-rendering: geometricPrecision; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── 4 Material ───────────────────────────────────────────────────────────────────────────────────────────────────────────── */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root:not([data-theme="dark"]) .ui-top { background: rgba(255, 255, 255, 0.74) !important; backdrop-filter: saturate(180%) blur(20px) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px) !important; border-bottom-color: rgba(10, 60, 80, 0.10) !important; }
  :root[data-theme="dark"] .ui-top { background: rgba(13, 21, 32, 0.72) !important; backdrop-filter: saturate(160%) blur(20px) !important;
    -webkit-backdrop-filter: saturate(160%) blur(20px) !important; }
}

/* ── 5 Motion ─────────────────────────────────────────────────────────────────────────────────────────────────────────────── */
:root {
  --ui-spring: cubic-bezier(0.32, 0.72, 0, 1);  /* the curve Apple uses for sheets and panels */
  --mo-ease: var(--ui-spring); --mo-soft: cubic-bezier(0.25, 0.1, 0.25, 1);
  --mo-fast: 140ms; --mo-base: 220ms; --mo-slow: 260ms;   /* was 220 / 420 / 640 ms: everything answers at once */
  --ease: var(--ui-spring); --dur: 160ms;
}
@media (prefers-reduced-motion: no-preference) {
  .ui-main > * { animation-duration: 260ms !important; }
  :is(.ui-btn, .btn, .ui-chip, .ui-tab, button.mitra__chip) { transition-timing-function: var(--ui-spring) !important; }
  :is(.ui-btn, .btn):active:not([aria-disabled="true"]):not(:disabled) { transform: scale(0.97); transition-duration: 80ms !important; }
  :is(.ui-card, .ui-app, .ui-panelcard, a.ui-stat, .ui-launch__tile) { transition: transform 240ms var(--ui-spring), box-shadow 240ms var(--ui-spring),
    border-color 160ms var(--mo-soft), background-color 160ms var(--mo-soft); }
  :is(.ui-app, .ui-panelcard, a.ui-stat, .ui-launch__tile, a.ui-link-card):hover { transform: translateY(-2px); }
  .ui-nav__item { transition-duration: 140ms !important; transition-timing-function: var(--ui-spring) !important; }
  ::view-transition-old(main) { animation-duration: 120ms !important; }
  ::view-transition-new(main) { animation-duration: 220ms !important; animation-timing-function: var(--ui-spring) !important; }
}

/* Focus like macOS: a soft accent halo, only for keyboard users */
.ui-body :is(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid rgba(20, 198, 194, 0.55); outline-offset: 2px; border-radius: 8px; }

/* Thin scrollbars that keep out of the way */
.ui-body { scrollbar-width: thin; scrollbar-color: rgba(10, 60, 80, 0.28) transparent; }

/* Dock-style magnification on the employee launchpad (ui.js sets --mag per tile) */
.ui-launch__tile, .ui-apps .ui-app { --mag: 1; }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .am-dock .ui-launch__tile, .am-dock .ui-app { transform: scale(var(--mag)) !important; transition: transform 160ms var(--ui-spring) !important; z-index: calc(var(--mag) * 10); }
}

/* ── Smooth scrolling (high refresh rate screens) ───────────────────────────────────────────────────────────────────────────── */
/* The turquoise canvas was a three-layer gradient with background-attachment: fixed, which makes the browser repaint the whole visible page
   on every scroll frame (Safari especially). It now sits on its own fixed layer, painted once; scrolling only moves the content over it. */
:root:not([data-theme="dark"]) .ui-body { background: var(--ui-bg) !important; background-attachment: scroll !important; }
:root:not([data-theme="dark"]) .ui-body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--th-canvas); transform: translateZ(0); }
body { background-attachment: scroll !important; }
/* A lighter frosted bar: a smaller blur is re-sampled more cheaply each frame as content passes under it */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root:not([data-theme="dark"]) .ui-top { backdrop-filter: saturate(150%) blur(12px) !important; -webkit-backdrop-filter: saturate(150%) blur(12px) !important; }
  :root[data-theme="dark"] .ui-top { backdrop-filter: saturate(140%) blur(12px) !important; -webkit-backdrop-filter: saturate(140%) blur(12px) !important; }
}

/* ── macOS weights: Regular 400, Medium 510, Semibold 590, Bold 700 (SF Pro's own named weights) ──────────────────────────────── */
.ui-body :is(b, strong, th, dt, legend, summary) { font-weight: 590; }
.ui-body :is(label, .ui-label, .ui-btn, .btn, .ui-tab, .ui-chip, .ui-nav__item, .ui-badge) { font-synthesis: none; }


/* ── Calm (15 Nov 2026) ────────────────────────────────────────────────────────────────────────────────────────────────────────
   This sheet loads last and used to put a turquoise wash, a gradient accent and 4px colour bars back over the calmer theme. A neutral canvas,
   one muted flat accent, tiles and rows that do not change on hover, and icons that can be seen. */
:root:not([data-theme="dark"]) {
  --th-canvas: #F7F8FA; --ui-bg: #F7F8FA; --th-primary: #21736F; --th-primary-hover: #1B5F5C;
  --ui-accent-soft: #E8F0EF; --ui-accent-ink: #21736F;
}
:root { --th-tint: linear-gradient(transparent, transparent); --th-tint-edge: var(--ui-border-strong); }
:root:not([data-theme="dark"]) .ui-body::before { background: #F7F8FA; }
:root:not([data-theme="dark"]) .ui-side { background: #1C2D34 !important; box-shadow: none !important; }
:root:not([data-theme="dark"]) .ui-panelcard { border-top: 1px solid var(--ui-border) !important; background: #fff !important; }
:root:not([data-theme="dark"]) .ui-panelcard .ui-stat__icon { background: var(--ui-accent-soft) !important; color: var(--th-primary) !important; box-shadow: none !important; }
.ui-body .ui-stat__icon .icon { stroke: currentColor !important; }
.ui-card:has(form)::before { display: none !important; }
.hm-row[data-next-step] { background: transparent !important; }
:root:not([data-theme="dark"]) :is(.ui-tab[aria-current="page"], .ui-chip[aria-pressed="true"]) { box-shadow: none !important; }
:root { --ui-g-brand: #21736F; --ui-g-navy: #1C2D34; --ui-g-navy-soft: #1C2D34; }
.ui-ic { background: color-mix(in srgb, var(--tone-a, #21736F) 76%, #5F6B76) !important; box-shadow: none !important; }
:root[data-theme="dark"] .ui-ic { box-shadow: none !important; }
.ui-stat--brand::before { height: 2px !important; background: var(--ui-border-strong) !important; }

/* ===== Classic polish: one rhythm for forms, buttons, checkboxes and step lists across every classic page ===== */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; min-width: 0; }
.field > span:first-child, .field > label:first-child { font-size: 13px; font-weight: 500; color: #4b5b68; }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), .field select, .field textarea {
  width: 100%; max-width: 460px; min-width: 0; padding: 0 12px; border: 1px solid #cdd7df; border-radius: 8px; background: #fff; font: inherit; color: #16242d; box-shadow: none; }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), .field select { height: 40px; }
.field textarea { padding: 10px 12px; min-height: 88px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #21736F; outline-offset: 1px; border-color: #21736F; }
form:has(> .field):has(> button.ui-btn:last-child) { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
form:has(> .field):has(> button.ui-btn:last-child) > .field { margin-bottom: 0; flex: 1 1 260px; }
.ui-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 8px; line-height: 1.1; box-shadow: none !important; }
.ui-btn--sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: #21736F; }
.aa-person, label:has(> input[type="checkbox"]):not(.field), label:has(> input[type="radio"]):not(.field) { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.apps-steps { gap: 14px; max-width: 78ch; }
.apps-steps li { line-height: 1.6; overflow-wrap: anywhere; }
.apps-steps li > .ui-btn { margin-right: 8px; vertical-align: middle; }
pre, .ui-code { max-width: 100%; overflow-x: auto; }
main h1 + p, .ui-page-desc { margin-top: 6px; margin-bottom: 22px; color: #4b5b68; }
.ui-main > *, .ui-modal__box { animation: none !important; }
[class*="ui-btn"], [class*="ui-btn"]::before, [class*="ui-btn"]::after { box-shadow: none !important; filter: none !important; }

/* ===== Embedded: a classic page shown inside the new interface. No menu, no footer, the new interface's teal canvas behind it. ===== */
html:has(body.is-embedded), body.is-embedded { background: transparent !important; }
.is-embedded .ui-top, .is-embedded .ui-side, .is-embedded .ui-foot, .is-embedded .ui-progressbar, .is-embedded .ui-menu-btn { display: none !important; }
.is-embedded .ui-shell { display: block !important; min-height: 0; background: transparent; }
.is-embedded .ui-main { margin: 0 !important; padding: 0 !important; max-width: none !important; background: transparent; }
.is-embedded .ui-shell, .is-embedded .ui-main, body.is-embedded { padding-top: 0 !important; margin-top: 0 !important; }
.is-embedded .ui-content { max-width: 1320px; margin: 0 auto; padding: 8px 32px 48px; background: transparent; }
.is-embedded .ui-card, .is-embedded .card { background: #fff; border: 1px solid #d2e4e2; box-shadow: 0 1px 2px rgba(11, 95, 99, 0.06), 0 10px 24px -16px rgba(11, 95, 99, 0.22); }
.is-embedded h1, .is-embedded .ui-page-title { display: flex; align-items: center; gap: 10px; font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -0.03em; color: #071e21; }
.is-embedded h1::before, .is-embedded .ui-page-title::before { content: none !important; display: none !important; }
.is-embedded .ui-btn--primary { background-image: linear-gradient(180deg, #14a59d, #0b7f7a); background-color: #0b7f7a; color: #fff; border-color: #0b7f7a; }
@media (max-width: 720px) { .is-embedded .ui-content { padding: 16px 16px 40px; } }
/* the same canvas, type and depth as the new interface's own screens */
html[data-ui] body.ui-body.is-embedded, html body.is-embedded { background: transparent !important; background-color: transparent !important; }
.is-embedded { color: #071e21; }
.is-embedded .ui-page-desc, .is-embedded main h1 + p { font-size: 15px; line-height: 1.6; color: #3a5a5d; max-width: 75ch; }
.is-embedded .ui-breadcrumbs, .is-embedded .ui-crumbs { font-size: 13px; color: #3a5a5d; }
.is-embedded .ui-card, .is-embedded .card, .is-embedded .ui-stat { border-radius: 12px !important; border-color: #c3dad8 !important; box-shadow: 0 1px 2px rgba(11, 95, 99, 0.08), 0 14px 28px -16px rgba(11, 95, 99, 0.32) !important; }
.is-embedded .ui-card__title { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; color: #071e21; }
.is-embedded .ui-card__desc { font-size: 14px; color: #3a5a5d; }
.is-embedded .ui-stat__value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; color: #071e21; }
.is-embedded .ui-stat__label { font-weight: 600; color: #3a5a5d; }
:root body.is-embedded .ui-stat .ui-stat__icon.ui-stat__icon { background: linear-gradient(140deg, #0b7f7a, #0b7f7ac0) !important; color: #fff !important; border-radius: 10px; box-shadow: 0 6px 14px -6px rgba(7, 30, 33, 0.55); }
.is-embedded .ui-table thead tr, .is-embedded table thead tr { background: #e4f1ef; }
.is-embedded .ui-table thead th, .is-embedded table thead th { color: #071e21; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; font-size: 11.5px; }
.is-embedded .ui-table tbody tr:hover { background: #f1f8f7; }
.is-embedded .ui-tabs, .is-embedded .ui-tablist { border-radius: 12px; }
.is-embedded .ui-input, .is-embedded .ui-select, .is-embedded .ui-textarea { border-color: #a9c6c4; border-radius: 8px; }
.is-embedded .ui-btn { border-radius: 8px; }
