/* EMS polish - round 3 (Tyler 11-05). Rules: DESIGN.md.

   "This is not polished. This is still that shitty design." The bar is MPMA
   Pathways. Round 3 measured every screen against it (scratchpad
   design/r3-audit/AUDIT.md) and this sheet fixes what hit the most screens:

     1. The intro card on every tool page (UI.intro) was a white box of bullets
        with the same weight as the form under it. Pathways draws the same
        sentence as the page's lede on the canvas (phase3.css .card.intro).
     2. Native checkboxes, radios, file pickers, date fields and sliders looked
        like a browser default inside a designed page.
     3. Type: secondary copy sat at 13-13.5px Lato, which reads thin and grey
        next to Pathways' 14.5-15px; page titles were a notch too heavy.
     4. Rows and empty slots carried no identity: no icon plate, no hover, no
        press. Empty slots had no plate either.
     5. Small tool buttons (Upload / Dictate) were 12px boxes.

   VISUAL ONLY: every word, control, order and behaviour stays. Dashboards
   (My Plan, My Dashboard, Family Home, mentor and admin dashboards) get the
   same type/controls polish but no layout change. Loaded LAST, after the
   per-area sheets, so these rules win at equal specificity. */

/* ── 1. Type rhythm ─────────────────────────────────────────────────────── */
/* Page header: Pathways weight (700, not 800), a calmer lede under it. */
.topbar h1, .content > .topbar h1 { font-weight: 700; letter-spacing: -.02em; }
.tagline { font-size: 15.5px; color: var(--ems-mute); }
/* Headings top out at 700 (numbers keep 800: a figure may be loud). */
#view .ems-m-next-t { font-weight: 700; letter-spacing: -.015em; }
/* Secondary copy reads at 14.5px, not 13: Lato is thin at small sizes. */
#view .muted { line-height: 1.5; }
#view p.muted, #view div.muted, #view .card > .muted { font-size: 14.5px; }
#view .res-item-desc, #view .plan-step .muted, #view .list-note .muted { font-size: 14px; line-height: 1.5; }
#view .res-item-title { font-size: 15px; }
#view .card p { line-height: 1.6; }
#view .card h2 { font-weight: 700; letter-spacing: -.012em; }
/* The type floor, measured (r3-audit small.cjs): reading copy that sat at
   12.5-13.5px across 30+ screens. Ledes read at 15, row descriptions at 14,
   meta lines at 13.5. Kickers, chips and badges keep their small caps size. */
#view .ems-m-lede, #view .card > p.muted:not(.small) { font-size: 15px; line-height: 1.6; color: var(--ems-mute); }
#view :is(.mentor-mile-d, .res-item-desc, .ems-s-quote, .plan-step .muted) { font-size: 14px; line-height: 1.5; }
#view :is(.ems-m-note, .ems-m-item-m, .ems-s-cell-m, .ems-s-row-meta, .ems-m-mentor-e, .ems-s-meta, .ems-s-h-sub) { font-size: 13.5px; line-height: 1.5; }
#view span.muted.small, #view p.muted.small, #view div.muted.small { font-size: 14px; }
#view .adm-funnel-l { font-size: 14px; }
#view label.small.muted, #view .ems-ac-meta { font-size: 13.5px; }
#view .ems-s-url, #view .ems-s-code-url { font-size: 12.5px; }
#view .crisis-footer { font-size: 13.5px; }
/* Labels above fields: one size everywhere (Pathways: 14px/600, ink). */
#view label.field > span:first-child, .modal label.field > span:first-child { font-size: 13.5px; font-weight: 600; color: var(--ems-ink-2); letter-spacing: 0; }

/* ── 2. The intro on every tool page (UI.intro) ─────────────────────────── */
/* Pathways phase3.css: not a box, the page's lede. A sentence at reading size,
   then the tips as quiet dotted lines. */
#view .card.intro {
  background: none; box-shadow: none; border: 0; border-radius: 0;
  padding: 0; margin: -4px 0 24px;
}
#view .card.intro > p {
  margin: 0 0 10px !important; max-width: 74ch;
  font: 400 17px/1.55 var(--ems-font-body); color: var(--ems-ink-2);
}
#view .card.intro > p b, #view .card.intro > p strong { color: var(--ems-navy-800); }
#view .card.intro ul.clean { list-style: none; margin: 0 !important; padding: 0; display: grid; gap: 5px; max-width: 82ch; }
#view .card.intro ul.clean:empty { display: none; }
#view .card.intro ul.clean li {
  position: relative; margin: 0; padding-left: 18px;
  font-size: 14.5px; line-height: 1.5; color: var(--ems-mute);
}
#view .card.intro ul.clean li::before {
  content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ems-navy-400); opacity: .55;
}
#view .card.intro ul.clean li b, #view .card.intro ul.clean li strong { color: var(--ems-ink-2); }
#view .card.intro:empty { display: none; }
/* Inside a pop-up or a card it stays a soft note, never a box in a box. */
:is(.modal, #view .card) .card.intro { background: var(--ems-soft); border-radius: var(--ems-r-md); padding: 12px 14px; margin: 0 0 14px; }

/* ── 3. Checkboxes and radios: drawn, not the browser's ───────────────────
   No `display` is set here on purpose: screens hide some inputs inside choice
   cards with their own rules, and this must never un-hide one. */
input[type=checkbox], input[type=radio] {
  -webkit-appearance: none; appearance: none;
  box-sizing: border-box; width: 20px; height: 20px; min-width: 20px; min-height: 0; flex: none;
  margin: 0; padding: 0; vertical-align: -4px; cursor: pointer;
  border: 1.5px solid var(--ems-line-2); border-radius: 6px; background-color: #fff;
  background-repeat: no-repeat; background-position: center; background-size: 0 0;
  box-shadow: 0 1px 2px rgba(22, 32, 99, .06);
  transition: background-color var(--ems-dur-fast) var(--ems-ease), border-color var(--ems-dur-fast) var(--ems-ease), box-shadow var(--ems-dur) var(--ems-ease), background-size 180ms var(--ems-spring);
}
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--ems-navy-400); }
input[type=checkbox]:checked {
  border-color: var(--ems-navy-500); background-color: var(--ems-navy-500); background-size: 12px 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.4 6.3l2.4 2.4 4.8-5.2' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
input[type=checkbox]:indeterminate {
  border-color: var(--ems-navy-500); background-color: var(--ems-navy-500); background-size: 10px 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5h6' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
input[type=radio]:checked {
  border-color: var(--ems-navy-500); background-color: var(--ems-navy-500); background-size: 8px 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Ccircle cx='4' cy='4' r='4' fill='%23fff'/%3E%3C/svg%3E");
}
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: none; box-shadow: var(--ems-focus); }
input[type=checkbox]:active, input[type=radio]:active { transform: scale(.92); }
input[type=checkbox]:disabled, input[type=radio]:disabled { background-color: var(--ems-soft); border-color: var(--ems-line); cursor: not-allowed; }
input[type=checkbox]:checked:disabled, input[type=radio]:checked:disabled { background-color: var(--ems-navy-200); border-color: var(--ems-navy-200); }
/* A label that holds a checkbox lines it up with its words. */
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { cursor: pointer; }
/* A done item (a checked to-do) reads as done. */
.checkrow:has(> input[type=checkbox]:checked) > span, .mentor-mile-chk:has(input:checked) + * { color: var(--ems-mute); }

/* ── 4. File pickers, date fields, sliders ──────────────────────────────── */
/* A visible file input: a dashed drop slot with a real button in it. */
input[type=file] {
  width: 100%; max-width: 100%; box-sizing: border-box; min-height: 52px; padding: 8px; cursor: pointer;
  border: 1.5px dashed var(--ems-line-2); border-radius: var(--ems-r-md); background: var(--ems-soft);
  font: 400 14px/1.4 var(--ems-font-body); color: var(--ems-mute);
  transition: border-color var(--ems-dur) var(--ems-ease), background-color var(--ems-dur) var(--ems-ease);
}
input[type=file]:hover { border-color: var(--ems-navy-300); background: var(--ems-navy-50); }
input[type=file]:focus-visible { outline: none; border-color: var(--ems-navy-500); box-shadow: var(--ems-focus); }
input[type=file]::file-selector-button {
  margin-right: 12px; min-height: 34px; padding: 6px 14px; cursor: pointer;
  border: 1px solid var(--ems-line-2); border-radius: 10px; background: #fff; color: var(--ems-navy-600);
  font: 600 13.5px/1.2 var(--ems-font-ui); box-shadow: 0 1px 2px rgba(22, 32, 99, .06);
  transition: background-color var(--ems-dur) var(--ems-ease), border-color var(--ems-dur) var(--ems-ease);
}
input[type=file]:hover::file-selector-button { background: #fff; border-color: var(--ems-navy-300); }
/* Date and time fields: the field's own type, a navy calendar glyph. */
input[type=date], input[type=month], input[type=time], input[type=datetime-local], input[type=week] {
  font-family: var(--ems-font-body); color: var(--ems-ink); font-variant-numeric: tabular-nums;
}
input[type=date]::-webkit-calendar-picker-indicator, input[type=month]::-webkit-calendar-picker-indicator,
input[type=datetime-local]::-webkit-calendar-picker-indicator, input[type=week]::-webkit-calendar-picker-indicator {
  width: 18px; height: 18px; padding: 4px; margin-right: -4px; border-radius: 8px; cursor: pointer; opacity: 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A3890' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 10h18'/%3E%3C/svg%3E") center / 18px no-repeat;
  transition: background-color var(--ems-dur) var(--ems-ease);
}
input[type=time]::-webkit-calendar-picker-indicator {
  width: 18px; height: 18px; padding: 4px; margin-right: -4px; border-radius: 8px; cursor: pointer; opacity: 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A3890' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") center / 18px no-repeat;
}
input::-webkit-calendar-picker-indicator:hover { background-color: var(--ems-navy-50); }
input[type=date]::-webkit-datetime-edit-fields-wrapper { padding: 0; }
/* Number fields: no browser spinner arrows crowding the value. */
input[type=number] { -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* Sliders: a navy track and a white thumb with a navy ring. */
input[type=range] {
  -webkit-appearance: none; appearance: none; height: 24px; min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--ems-navy-100); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--ems-navy-100); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--ems-navy-500); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%;
  background: #fff; border: 2px solid var(--ems-navy-500); box-shadow: 0 2px 6px rgba(22, 32, 99, .25);
  transition: transform var(--ems-dur) var(--ems-spring);
}
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--ems-navy-500); box-shadow: 0 2px 6px rgba(22, 32, 99, .25); }
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.12); }
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: var(--ems-focus); }
/* Selects that sit in a line of text (a filter, a sort) keep the chevron
   but get the same hover/focus as every field. */
select:focus-visible { outline: none; }

/* ── 5. The small tool bar above a text box (Upload / Dictate) ──────────── */
.field-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 8px; }
.field-tools .iconbtn {
  min-height: 34px; padding: 6px 12px; gap: 7px; border: 1px solid var(--ems-line-2); border-radius: 999px; background: #fff;
  font: 600 13px/1.2 var(--ems-font-ui); color: var(--ems-navy-600); box-shadow: 0 1px 2px rgba(22, 32, 99, .05);
  transition: background-color var(--ems-dur) var(--ems-ease), border-color var(--ems-dur) var(--ems-ease), transform var(--ems-dur-fast) var(--ems-ease);
}
.field-tools .iconbtn:hover { background: var(--ems-navy-50); border-color: var(--ems-navy-300); }
.field-tools .iconbtn:active { transform: scale(.97); }
.field-tools .iconbtn .ic, .field-tools .iconbtn svg { width: 15px; height: 15px; color: var(--ems-navy-500); }
.field-tools .iconbtn.rec { background: var(--ems-red-50); border-color: var(--ems-red-200); color: var(--ems-red-700); }
.field-status { font: 500 12.5px/1.4 var(--ems-font-ui); color: var(--ems-mute-2); }
.iconbtn:active { transform: scale(.97); }

/* ── 6. Empty slots wear a plate (Pathways empty state) ─────────────────── */
.wt-empty, #view .empty { position: relative; padding-top: 74px; }
.wt-empty::before, #view .empty::before {
  content: ""; position: absolute; top: 22px; left: 50%; width: 40px; height: 40px; margin-left: -20px; border-radius: 12px;
  background: var(--ems-navy-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A3890' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E") center / 20px no-repeat;
}
.card .wt-empty::before, .card .empty::before { background-color: #fff; box-shadow: var(--ems-lift); }
.wt-empty, #view .empty { font-size: 14.5px; color: var(--ems-mute); }
.wt-empty > :is(.btn-row, div:last-child):not(:first-child), .wt-empty > button, .wt-empty > a.primary, .wt-empty > a.ghost { margin-top: 14px; }
/* An empty slot that is only a single short line (a table cell, a chip row) stays a line. */
td .wt-empty, td .empty, .wt-empty.is-line, li.empty, span.empty, #view td.empty, .chip-row .empty { padding: 14px; }
td .wt-empty::before, td .empty::before, li.empty::before, span.empty::before, #view td.empty::before, .chip-row .empty::before { display: none; }

/* ── 7. Rows: hover and press everywhere, soft not boxed ─────────────────── */
.res-item:active, .plan-step:active, .dash-step:active, .tile:active, .journey-card:active, .gate-card:active { transform: scale(.995); }
.res-item-body { color: inherit; text-decoration: none; border-radius: 8px; }
.res-item-body:hover .res-item-title { color: var(--ems-navy-500); }
.plan-step { transition: background-color var(--ems-dur) var(--ems-ease), box-shadow var(--ems-dur) var(--ems-ease); }
.plan-step:not(.current):hover { background: var(--ems-soft-2); }
.list-note, .mentor-mile { transition: background-color var(--ems-dur) var(--ems-ease); }
.mentor-mile:hover { background: var(--ems-soft-2); }
.mentor-mile.is-done:hover { background: var(--ems-good-50); }
.checkrow { transition: background-color var(--ems-dur) var(--ems-ease); border-radius: 10px; }

/* Identity (Pathways: "every card wears the logo/face of what it is about").
   A resource row wears its source's monogram; a tool inside the Hub wears the
   compass; a mentor wears a face (initials; demo paints the photo over). */
.ems-plate.ems-mono {
  width: 40px; height: 40px; border-radius: 11px; background: #fff; color: var(--ems-navy-600);
  font: 700 14px/1 var(--ems-font-display); letter-spacing: .02em;
  box-shadow: 0 0 0 1px var(--ems-line), 0 1px 2px rgba(22, 32, 99, .06);
  transition: background-color var(--ems-dur) var(--ems-ease), color var(--ems-dur) var(--ems-ease), transform 220ms var(--ems-spring);
}
.ems-plate.ems-mono.is-hub { background: var(--ems-navy-500); color: #fff; box-shadow: none; }
.res-item:hover .ems-plate.ems-mono:not(.is-hub) { background: var(--ems-navy-50); box-shadow: none; }
.res-item:hover .ems-plate.ems-mono { transform: scale(1.05); }
/* "Picked for you" rows were white boxes with a 1px outline inside a white
   card (hierarchy rule 1 + 3): soft rows like every other list. */
#view .card.ems-m-picks .res-item { background: var(--ems-soft); box-shadow: none; }
#view .card.ems-m-picks .res-item:hover { background: #fff; box-shadow: var(--ems-lift-hover); }
.ems-m-mentor .ems-s-av.ems-m-mentor-av { width: 56px; height: 56px; font-size: 19px; }
.ems-m-dash-who { display: flex; align-items: center; gap: 10px; }
.ems-m-dash-who .ems-s-av.is-sm { width: 34px; height: 34px; }

/* Career paths: a list of openable cards, Pathways rhythm (12px apart, the
   card lifts on hover, the description reads at body size). */
#view .pw-grid { gap: 12px; }
#view .pw-grid > .card.pw-card { margin-bottom: 0; }
#view .card.pw-card { transition: box-shadow var(--ems-dur) var(--ems-ease), transform var(--ems-dur) var(--ems-ease); }
#view .card.pw-card:not(.is-open):hover { box-shadow: var(--ems-lift-hover); transform: translateY(-1px); }
#view .pw-head { padding: 16px 18px; }
#view .pw-head .ems-m-note { font: 400 14.5px/1.5 var(--ems-font-body); color: var(--ems-mute); margin-top: 2px; }
#view .pw-chev { color: var(--ems-navy-300); transition: transform var(--ems-dur) var(--ems-ease), color var(--ems-dur) var(--ems-ease); }
#view .pw-head:hover .pw-chev { color: var(--ems-navy-500); transform: translateX(2px); }
/* The dashboard's mentor to-do: the hollow square reads as a checkbox. */
.ems-m-dash-todo li { display: flex; align-items: center; gap: 8px; }
.ems-m-dash-todo li .ic-emoji svg { width: 16px; height: 16px; color: var(--ems-navy-300); }

/* ── 8. Tables: a calm, readable list ───────────────────────────────────── */
.wt-table { border-collapse: separate; border-spacing: 0; }
.wt-table thead th { padding-top: 11px; padding-bottom: 11px; }
.wt-table tbody td { padding-top: 13px; padding-bottom: 13px; font-size: 14.5px; vertical-align: middle; }
.wt-table tbody tr:last-child td { border-bottom: 0; }
.wt-table tbody td .muted, .wt-table tbody td small { font-size: 13px; }

/* The toast: two older sheets set left:50% AND right:22px, so it stretched
   into a 700px dark bar. It is a pill that fits its words. */
.toast { right: auto; width: max-content; max-width: min(520px, calc(100vw - 32px)); text-align: center; line-height: 1.4; }

/* ── 9. Loading: a skeleton is a shape, not a word ──────────────────────── */
/* UI.workProgress (every AI tool while it thinks): the bar and its words were
   inline-styled grey. Now a navy bar with a sheen, the stage in UI type, and
   the shape of the answer shimmering under it, so the wait reads as "your
   result is being built here", not a frozen box. */
#view div:has(> [data-bar]) { height: 8px !important; background: var(--ems-navy-100) !important; margin-bottom: 10px !important; }
#view [data-bar] { position: relative; overflow: hidden; border-radius: 999px; background: linear-gradient(90deg, var(--ems-navy-500), var(--ems-navy-400)) !important; }
#view [data-bar]::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent); transform: translateX(-100%); animation: ems-bar-sheen 1.4s ease-in-out infinite; }
@keyframes ems-bar-sheen { to { transform: translateX(100%); } }
#view [data-stage] { font: 600 13.5px/1.4 var(--ems-font-ui); color: var(--ems-navy-700); }
#view [data-clock] { font: 500 12.5px/1.4 var(--ems-font-ui); color: var(--ems-mute-2); font-variant-numeric: tabular-nums; }
#view .card:has([data-bar])::after {
  content: ""; display: block; height: 64px; margin-top: 16px; border-radius: 10px;
  background:
    linear-gradient(90deg, transparent 0, rgba(255, 255, 255, .7) 50%, transparent 100%) 0 0 / 40% 100% no-repeat,
    linear-gradient(var(--ems-soft-2), var(--ems-soft-2)) 0 0 / 72% 12px no-repeat,
    linear-gradient(var(--ems-soft-2), var(--ems-soft-2)) 0 26px / 94% 12px no-repeat,
    linear-gradient(var(--ems-soft-2), var(--ems-soft-2)) 0 52px / 58% 12px no-repeat;
  animation: ems-skel-sheen 1.3s linear infinite;
}
@keyframes ems-skel-sheen { from { background-position: -60% 0, 0 0, 0 26px, 0 52px; } to { background-position: 160% 0, 0 0, 0 26px, 0 52px; } }
@media (prefers-reduced-motion: reduce) { #view [data-bar]::after, #view .card:has([data-bar])::after { animation: none !important; } }
#view .wt-skeleton { min-height: 18px; border-radius: 10px; }
#view .wt-skeleton + .wt-skeleton { margin-top: 10px; }
.spinner { border-color: rgba(42, 56, 144, .2); border-top-color: var(--ems-navy-500); }
:is(button.primary, a.primary, .btn:not(.ghost)) .spinner { border-color: rgba(255, 255, 255, .45); border-top-color: #fff; }

/* ── 10. Phones ─────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  #view .card.intro { margin-bottom: 18px; }
  #view .card.intro > p { font-size: 16px; }
  #view .card.intro ul.clean li { font-size: 14px; }
  .wt-empty, #view .empty { padding-left: 16px; padding-right: 16px; }
  input[type=file] { font-size: 13px; }
  .ems-plate.ems-mono { width: 34px; height: 34px; border-radius: 10px; font-size: 12.5px; }
  .res-item.plan-res { gap: 10px; padding: 12px; }
}
