/* Matchwright app stylesheet (v2). See docs/frontend-v2.md for the classes and the page skeleton. */

/* ---------- fonts (self-hosted, SIL OFL) ---------- */
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Matchwright app stylesheet (v2). Ported from the design boards: product tokens for Paper (light) and
   Carbon (dark), components as on the boards, the app shell. Square everywhere, hairlines for structure,
   shadows only on menus and dialogs in Paper. The theme class (t-paper or t-carbon) sits on <html>;
   app.js sets it. Without the class, the system preference decides. Keep the two token blocks identical. */

/* ---------- tokens ---------- */
:root {
  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --d-fast: 150ms;
  --d-mid: 240ms;
  --d-slow: 400ms;
}
.t-paper, :root:not(.t-carbon) {
  color-scheme: light;
  --paper: #eef3f7; --sheet: #ffffff; --ink: #1c3d6e; --ink-deep: #14305a; --ink-tint: #dce5ef;
  --night: #10213d; --marker: #f2c230; --marker-hover: #ffd24a; --marker-wash: #fbe7a6;
  --correction: #b8392a; --correction-ink: #962c20; --correction-wash: #f8e3df; --on-correction: #ffffff;
  --graphite: #4a5d75; --dim: #596b83; --rule: #c5d2de; --rule-soft: #d8e1ea; --field-border: #6e819a;
  --text: #13284a; --on-ink: #ffffff; --on-night: #ffffff; --on-night-2: #b9c8da; --night-rule: rgba(185, 200, 218, 0.22);
  --row: #f5f8fb; --track: #eef2f7; --deduct: #58708f; --pending: #716857; --focus: #2e6bc6;
  --scrim: rgba(16, 33, 61, 0.36); --sheen: rgba(255, 255, 255, 0.75);
}
.t-carbon {
  color-scheme: dark;
  --paper: #191c20; --sheet: #23252a; --ink: #b8d0f2; --ink-deep: #d2e3fb; --ink-tint: #313844;
  --night: #0e1114; --marker: #e8bf42; --marker-hover: #f0cc5c; --marker-wash: #4b3e1b;
  --correction: #ee7b6a; --correction-ink: #f5a799; --correction-wash: #4e2a24; --on-correction: #0e1114;
  --graphite: #acb1b9; --dim: #92979f; --rule: #3e4146; --rule-soft: #303337; --field-border: #808790;
  --text: #dde0e4; --on-ink: #191c20; --on-night: #dde0e4; --on-night-2: #acb1b9; --night-rule: rgba(172, 177, 185, 0.18);
  --row: #282c30; --track: #2e3237; --deduct: #93a6c1; --pending: #9499a0; --focus: #83b3fa;
  --scrim: rgba(0, 0, 0, 0.6); --sheen: rgba(255, 255, 255, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root:not(.t-paper) {
    color-scheme: dark;
    --paper: #191c20; --sheet: #23252a; --ink: #b8d0f2; --ink-deep: #d2e3fb; --ink-tint: #313844;
    --night: #0e1114; --marker: #e8bf42; --marker-hover: #f0cc5c; --marker-wash: #4b3e1b;
    --correction: #ee7b6a; --correction-ink: #f5a799; --correction-wash: #4e2a24; --on-correction: #0e1114;
    --graphite: #acb1b9; --dim: #92979f; --rule: #3e4146; --rule-soft: #303337; --field-border: #808790;
    --text: #dde0e4; --on-ink: #191c20; --on-night: #dde0e4; --on-night-2: #acb1b9; --night-rule: rgba(172, 177, 185, 0.18);
    --row: #282c30; --track: #2e3237; --deduct: #93a6c1; --pending: #9499a0; --focus: #83b3fa;
    --scrim: rgba(0, 0, 0, 0.6); --sheen: rgba(255, 255, 255, 0.06);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--paper); color: var(--text);
  font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-wrap: anywhere;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: var(--ink); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--ink-deep); }
b, strong { font-weight: 600; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::placeholder { color: var(--graphite); opacity: 1; }
.vis { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- type (product styles, weights 400 / 500 / 600) ---------- */
.title { font-size: 28px; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; }
.head { font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
.label, .flabel { font-size: 13px; line-height: 1.4; font-weight: 500; color: var(--graphite); }
.sec { color: var(--graphite); }
.small { font-size: 13px; line-height: 1.4; }
.mono { font-family: var(--mono); font-size: 0.93em; font-weight: 400; letter-spacing: 0; }
.mono.b { font-weight: 500; }
.mono.keep { white-space: nowrap; }
.cap { font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--graphite); }

/* ---------- layout helpers ---------- */
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sp { flex: 1; }
.num { text-align: right; white-space: nowrap; }
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.appear { animation: mw-in var(--d-slow) var(--ease) both; }

/* ---------- shell: header, left nav, drawer ---------- */
.bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; min-height: 60px; padding: 8px 24px;
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.wm { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 18px; letter-spacing: -0.025em; }
.brand-logo { display: block; width: 180px; height: 28px; overflow: visible; }
.org-wrap { position: relative; display: inline-flex; min-width: 0; }
.org {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: 100%; padding: 0 12px;
  border: 0; background: transparent; color: var(--text); font: 500 15px var(--sans); cursor: pointer;
}
.org:hover, .org[aria-expanded="true"] { background: var(--ink-tint); }
.org-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.org svg, .burger svg { flex: none; }
.who { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; color: var(--text); text-decoration: none; }
.av {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: none;
  background: var(--ink-tint); color: var(--ink); font: 500 12px var(--mono);
}
.burger {
  display: none; align-items: center; justify-content: center; order: -1; width: 44px; height: 44px; padding: 0;
  border: 0; background: transparent; color: var(--text); cursor: pointer;
}
.shell { display: flex; align-items: stretch; min-height: calc(100vh - 60px); }
.nav {
  flex: 0 0 232px; display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 32px;
  border-right: 1px solid var(--rule);
}
.nav .grp { font-size: 13px; font-weight: 500; color: var(--graphite); padding: 16px 12px 8px; margin-top: 12px; border-top: 1px solid var(--rule); }
.nav .grp:first-child { padding-top: 12px; margin-top: 0; border-top: 0; }
.nav a, .nav-drawer .pane a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 12px;
  color: var(--text); text-decoration: none; font-weight: 500;
  transition: background-color var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}
.nav a:hover, .nav-drawer .pane a:hover { background: var(--ink-tint); color: var(--text); }
.nav a[aria-current="page"], .nav-drawer .pane a[aria-current="page"] { background: var(--ink); color: var(--on-ink); }
.t-carbon .nav a[aria-current="page"], .t-carbon .nav-drawer .pane a[aria-current="page"] {
  background: var(--ink-tint); color: var(--text); border-left: 2px solid var(--ink);
}
.main {
  flex: 1 1 auto; min-width: 0; max-width: 1120px; padding: 32px 40px 64px;
  display: flex; flex-direction: column; gap: 32px;
}
/* Before app.js: js/shell-boot.js draws the header and nav from the last visit (class mw-boot on <html>), while the
   page's <main> is still a sibling of the shell, not inside it. This grid puts them where the live shell will, so
   nothing moves when app.js swaps in the live copy (review 18.11: the page jumped 232 px right and 60 px down). */
.mw-boot body { display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: auto 1fr; align-items: start; }
.mw-boot #mw-shell, .mw-boot #mw-shell > .shell { display: contents; }
.mw-boot #mw-shell .bar { grid-column: 1 / -1; grid-row: 1; }
.mw-boot #mw-shell .nav { grid-column: 1; grid-row: 2; align-self: stretch; }
.mw-boot #mw-shell ~ :is(main.main, [data-shell-content]) { grid-column: 2; grid-row: 2; }
/* A non-English interface: the page's own text waits for the translation (at most 1.5 s, see shell-boot.js) instead
   of showing English first. The shell is not hidden: its copy is already in the chosen language. */
.mw-i18n main, .mw-i18n [data-shell-content] { visibility: hidden; }
/* Page to page: the browser cross-fades the content and keeps the header and nav in place (cross-document view
   transitions; browsers without them just navigate). The old entrance animation of every block replayed on each
   page and made the whole page look rebuilt. */
@view-transition { navigation: auto; }
.bar { view-transition-name: mw-bar; }
.nav { view-transition-name: mw-nav; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 120ms; }
.nav-drawer { position: fixed; inset: 0; z-index: 30; display: flex; }
.nav-drawer .pane {
  display: flex; flex-direction: column; gap: 2px; width: 280px; max-width: 86vw; height: 100%; overflow-y: auto;
  padding: 8px 8px 24px; background: var(--sheet); border-right: 1px solid var(--rule);
  animation: mw-slide var(--d-mid) var(--ease) both;
}
.nav-drawer .pane-head { display: flex; align-items: center; gap: 8px; padding: 0 4px 8px; }
.nav-drawer .burger { display: inline-flex; }
.nav-drawer .grp { font-size: 13px; font-weight: 500; color: var(--graphite); padding: 16px 12px 4px; }
.nav-drawer .bg { flex: 1; border: 0; background: var(--scrim); cursor: pointer; animation: mw-fadein var(--d-mid) var(--ease) both; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border: 1.5px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink);
  font: 600 15px/1.2 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color var(--d-fast) var(--ease), color var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease), opacity var(--d-fast) var(--ease), transform var(--d-fast) var(--ease);
}
.btn:hover { background: var(--ink-tint); color: var(--ink); }
.btn:active { transform: scale(0.98); }
.btn.pri { background: var(--ink); color: var(--on-ink); }
.btn.pri:hover { background: var(--ink-deep); border-color: var(--ink-deep); color: var(--on-ink); }
.btn.quiet { border-color: transparent; }
.btn.quiet:hover { background: var(--ink-tint); }
.btn.marker { background: var(--marker); border-color: var(--marker); color: var(--night); }
.btn.marker:hover { background: var(--marker-hover); border-color: var(--marker-hover); color: var(--night); }
.btn.danger { border-color: var(--correction); color: var(--correction); }
.btn.danger:hover { background: var(--correction-wash); color: var(--correction-ink); }
.btn.sel { border-color: var(--ink); background: var(--ink-tint); }
.btn.wide { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: transparent; }
.btn.pri:disabled:hover { background: var(--ink); border-color: var(--ink); }
.btn[aria-busy="true"] { cursor: progress; }
.btn-group { display: inline-flex; }
.btn-group .btn + .btn { margin-left: -1.5px; }
.lnk {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none;
  color: var(--ink); font: 600 15px var(--sans); text-decoration: underline; text-decoration-thickness: 1.5px;
  text-underline-offset: 3px; cursor: pointer;
}
.lnk:hover { color: var(--ink-deep); }
/* Busy: the mark drawn on a loop inside the button (SVG markup from the Logo card). */
.mw-loader { display: none; flex: none; width: 31px; height: 22px; overflow: visible; }
.mw-loader .mw-line { fill: none; stroke: currentColor; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.mw-loader .mw-out { stroke: var(--marker); stroke-width: 13; }
[aria-busy="true"] > .mw-loader { display: block; }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 13px; font-weight: 500; color: var(--graphite); }
.in {
  display: block; width: 100%; min-height: 44px; padding: 8px 0; border: 0; border-bottom: 1.5px solid var(--field-border);
  border-radius: 0; background: transparent; color: var(--text); font: 400 16px/1.4 var(--sans);
  transition: border-color var(--d-fast) var(--ease);
}
.in:hover { border-bottom-color: var(--text); }
.in:focus { border-bottom-color: var(--ink); }
.in:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.in.bad, .in[aria-invalid="true"] { border-bottom-color: var(--correction); }
.in.mono { font-family: var(--mono); font-size: 15px; }
select.in {
  appearance: none; padding-right: 24px;
  background-image: linear-gradient(45deg, transparent 41%, var(--text) 41%, var(--text) 59%, transparent 59%), linear-gradient(135deg, transparent 41%, var(--text) 41%, var(--text) 59%, transparent 59%);
  background-position: calc(100% - 8px) 50%, calc(100% - 2px) 50%; background-size: 6px 6px; background-repeat: no-repeat;
}
textarea.in { min-height: 72px; resize: vertical; }
.in:disabled { opacity: 0.55; cursor: not-allowed; }
.ferr { font-size: 13px; color: var(--correction-ink); }
.fok { font-size: 13px; color: var(--graphite); }
.cb { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -12px 0; cursor: pointer; }
.cb input { appearance: none; width: 20px; height: 20px; margin: 0; border: 1.5px solid var(--field-border); border-radius: 0; background: transparent; display: grid; place-content: center; cursor: pointer; }
.cb input:checked { background: var(--ink-tint); border-color: var(--ink); }
.cb input:checked::after { content: ""; width: 10px; height: 6px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-1px) rotate(-45deg); }
.cb input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.opt { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 12px 0; cursor: pointer; }
.opt + .opt { border-top: 1px solid var(--rule-soft); }
input[type="radio"] { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); flex: none; }
.drop { border: 1.5px dashed var(--field-border); padding: 16px; text-align: center; cursor: pointer; transition: background-color var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease); }
.drop:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.drop.over { background: var(--ink-tint); border-color: var(--ink); }

/* One-time code boxes. States: ok, bad, checking, locked. */
.otp { position: relative; display: flex; align-items: flex-end; gap: 8px; width: max-content; max-width: 100%; }
.otp .cell { position: relative; width: 48px; height: 60px; display: flex; align-items: center; justify-content: center; font: 400 26px/1 var(--mono); color: var(--text); border-bottom: 1.5px solid var(--field-border); overflow: hidden; transition: border-color var(--d-fast) var(--ease), color var(--d-fast) var(--ease), opacity var(--d-fast) var(--ease); }
.otp .cell.on { border-bottom-color: var(--text); }
.otp .sep { width: 16px; height: 1.5px; align-self: center; margin: 0 4px; background: var(--rule); }
.otp .dg { display: inline-block; animation: mw-digit var(--d-mid) var(--ease) both; }
.otp .cur::after { content: ""; position: absolute; left: 50%; top: 50%; width: 1.5px; height: 28px; margin: -14px 0 0 -0.75px; background: var(--ink); animation: mw-caret 1.2s var(--ease) infinite; }
.otp .bar { position: absolute; left: 0; bottom: 0; width: 48px; height: 3px; background: var(--ink); opacity: 0; pointer-events: none; }
.otp:focus-within .bar { opacity: 1; }
.otp.checking .bar { opacity: 1; animation: mw-scan 800ms var(--ease) infinite alternate; }
.otp.checking .cell { color: var(--graphite); }
.otp.ok .cell { border-bottom-color: var(--ink); color: var(--ink); }
.otp.ok .dg { animation: mw-wave var(--d-slow) var(--ease) both; }
.otp.ok .bar, .otp.bad .bar, .otp.locked .bar { opacity: 0; }
.otp.bad .cell { border-bottom-color: var(--correction); color: var(--correction-ink); }
.otp.locked .cell { opacity: 0.4; }
.otp input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; cursor: text; caret-color: transparent; }

/* ---------- sheets, tables, chips, notices ---------- */
.sheet { background: var(--sheet); border: 1px solid var(--rule-soft); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 13px; font-weight: 500; color: var(--graphite); padding: 12px 20px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl td { padding: 12px 20px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl td a { display: inline-block; padding: 12px 0; margin: -12px 0; }
.tbl tbody tr { transition: background-color var(--d-fast) var(--ease); }
.tbl tbody tr:not(.sel):not(.missrow):hover td { background: var(--row); }
.tbl tr.sel td { background: var(--row); }
.tbl tr.sel td:first-child { border-left: 2px solid var(--ink); }
.tbl tr.missrow td { background: var(--correction-wash); }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 24px; padding: 0 8px; font-size: 13px; font-weight: 500;
  line-height: 1; background: var(--ink-tint); color: var(--text); white-space: nowrap;
}
.chip.open { background: var(--correction-wash); color: var(--correction-ink); }
.chip.ok { background: var(--marker-wash); color: var(--text); }
.chip.act { background: transparent; outline: 1.5px solid var(--field-border); outline-offset: -1.5px; }
.chip.plain { background: transparent; padding: 0; color: var(--graphite); font-weight: 400; }
/* Marker means matched, and only that: the band behind a matched value. */
.matched {
  display: inline-block; padding: 0 4px; line-height: 1.5; white-space: nowrap; color: var(--ink);
  background: linear-gradient(transparent 14%, var(--marker) 14%, var(--marker) 92%, transparent 92%);
}
.num .matched { margin-right: -4px; }
.t-carbon .matched {
  color: var(--text);
  background: linear-gradient(transparent 14%, var(--marker-wash) 14%, var(--marker-wash) 92%, var(--marker) 92%, var(--marker) 100%);
}
.ts { display: inline-block; width: 0.28em; }
.miss { color: var(--correction-ink); }
.notice { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; border: 1.5px solid var(--field-border); background: var(--row); color: var(--text); }
.err { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; background: var(--correction-wash); color: var(--correction-ink); }
.notice b, .err b { font-weight: 600; }
/* The banner of an organization scheduled for deletion (MW.showOrgDeleted), on every page of that organization. */
.notice.org-deleted { border-color: var(--correction); background: var(--correction-wash); }
.notice.org-deleted b { color: var(--correction-ink); }
.meter { position: relative; height: 8px; min-width: 80px; background: var(--track); outline: 1px solid var(--rule); outline-offset: -1px; }
.meter i { display: block; height: 100%; background: var(--ink); transform-origin: 0 50%; animation: mw-grow var(--d-slow) var(--ease) 300ms both; }
.prog { height: 2px; background: var(--track); overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--ink); transform-origin: 0 50%; transition: transform var(--d-mid) var(--ease); }

/* Tabs: a row of 44px tabs on a hairline; the current one has an ink underline. */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--rule); }
.tabs a, .tabs button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; margin-bottom: -1px;
  color: var(--graphite); text-decoration: none; font: 600 15px var(--sans); background: transparent; border: 0;
  border-bottom: 2px solid transparent; cursor: pointer; transition: color var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease);
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a[aria-current="page"], .tabs button.on { color: var(--text); border-bottom-color: var(--ink); }

/* Skip link: the first stop of the keyboard on every page (review 17.11: it was on the sign-in pages only). */
.skip {
  position: absolute; left: 16px; top: -120px; z-index: 60; display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 16px; background: var(--ink); color: var(--on-ink); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 16px; }

/* ---------- menus, popovers, dialogs ---------- */
.menu { display: flex; flex-direction: column; min-width: 300px; padding: 4px 0; background: var(--sheet); border: 1px solid var(--rule); }
.t-paper .menu { box-shadow: 0 8px 24px rgba(16, 33, 61, 0.14); }
.t-carbon .menu { background: var(--row); }
.menu.pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 5; min-width: 320px; max-width: calc(100vw - 32px);
  transform-origin: 0 0; animation: mw-pop var(--d-fast) var(--ease) both;
}
/* As a native popover it sits in the top layer; app.js sets top and left under the button. */
.menu.pop[popover] { position: fixed; inset: auto; margin: 0; padding: 4px 0; color: var(--text); }
.menu.pop[popover]:not(:popover-open) { display: none; }
.mi {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 16px; border: 0;
  background: transparent; color: var(--text); font: 400 15px var(--sans); text-align: left; cursor: pointer;
}
.mi:hover { background: var(--ink-tint); }
.mi:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.mi[aria-current="true"] { background: var(--row); border-left: 2px solid var(--ink); }
.veil { position: fixed; inset: 0; z-index: 4; padding: 0; border: 0; background: transparent; cursor: default; }
/* MW.dialog is a native <dialog> in the top layer (review 17.11): the backdrop is its ::backdrop. */
.dlg {
  flex-direction: column; gap: 16px; width: min(480px, calc(100% - 32px)); max-width: none; max-height: calc(100vh - 32px);
  margin: auto; overflow-y: auto; overscroll-behavior: contain; padding: 24px; color: var(--text);
  background: var(--sheet); border: 1px solid var(--rule);
}
.dlg[open] { display: flex; animation: mw-pop var(--d-slow) var(--ease) 50ms both; }
.dlg::backdrop { background: var(--scrim); overflow: hidden; overscroll-behavior: contain; animation: mw-fadein var(--d-mid) var(--ease) both; }
.t-paper .dlg { box-shadow: 0 8px 24px rgba(16, 33, 61, 0.14); }
.dlg-title { font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.dlg-body { display: flex; flex-direction: column; gap: 12px; }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }

/* ---------- toasts: one status region from the shell ---------- */
.toasts {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100% - 32px);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 16px; max-width: 100%; padding: 12px 16px; pointer-events: auto;
  background: var(--night); color: var(--on-night); font-size: 15px;
  animation: mw-toast var(--d-mid) var(--ease) both;
}
.t-carbon .toast { background: var(--row); color: var(--text); border: 1px solid var(--rule); }
.toast.bad { background: var(--correction); color: var(--on-correction); }
.toast-text { min-width: 0; overflow-wrap: anywhere; }
.toast-undo {
  flex: none; min-height: 44px; padding: 0 4px; border: 0; background: transparent; color: inherit;
  font: 600 15px var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* ---------- skeletons ---------- */
.skel { display: flex; flex-direction: column; gap: 12px; padding: 12px 20px; }
/* Still blocks, no endless shimmer (review 17.11): they show only after 300 ms, and a quiet sheet fits the system. */
.sk { display: block; flex: none; max-width: 100%; background: var(--rule-soft); }
.t-carbon .sk { background: var(--track); }
.sk-line { width: 100%; height: 12px; }
.sk-block { width: 100%; height: 120px; }
@media (prefers-color-scheme: dark) { :root:not(.t-paper) .sk { background: var(--track); } }

/* Page skeletons (review 18.11). Each data page has its skeleton in its own HTML, in the shape of the loaded page, so
   it is there from the first frame together with the shell. It fades in only after 300 ms (a quick answer never
   shows it, as before), and app.js (MW.withSkeleton) removes it when the data comes; the content then fades in.
   Pieces: .skp (the page skeleton), .skp-head (cap + title), .skp-sheet (a sheet), .skp-bar (sheet head),
   .skp-row (a table row: .skp-c cells with flex 1-4), .skp-field (label + line), and bars .sk with a width class
   (.w-10 to .w-90) and a height class (.h-cap 12, .h-text 14, .h-head 17, .h-title 28, .h-btn 44, .h-av 28). */
.skp { display: flex; flex-direction: column; gap: 32px; animation: mw-fadein var(--d-mid) var(--ease) 300ms both; }
.skp-head { display: flex; align-items: flex-end; gap: 12px; }
.skp-head > .col { gap: 10px; flex: 1 1 auto; }
.skp-sheet { background: var(--sheet); border: 1px solid var(--rule-soft); }
.skp-bar { display: flex; align-items: center; gap: 24px; min-height: 64px; padding: 16px 20px; border-bottom: 1px solid var(--rule-soft); }
.skp-row { display: flex; align-items: center; gap: 24px; min-height: 48px; padding: 12px 20px; border-bottom: 1px solid var(--rule-soft); }
.skp-row:last-child { border-bottom: 0; }
.skp-row.hd { min-height: 44px; border-bottom-color: var(--rule); }
.skp-row.tall { min-height: 70px; }
.skp-c { display: flex; flex-direction: column; gap: 8px; flex: 2; min-width: 0; }
.skp-c.f1 { flex: 1; } .skp-c.f3 { flex: 3; } .skp-c.f4 { flex: 4; } .skp-c.none { flex: none; }
.skp-c.end { align-items: flex-end; }
.skp-body { display: flex; flex-direction: column; gap: 24px; padding: 20px; }
.skp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.skp-field { display: flex; flex-direction: column; gap: 12px; }
.skp-field::after { content: ""; display: block; height: 1px; background: var(--rule); }
.sk.w-10 { width: 10%; } .sk.w-15 { width: 15%; } .sk.w-20 { width: 20%; } .sk.w-25 { width: 25%; } .sk.w-30 { width: 30%; }
.sk.w-40 { width: 40%; } .sk.w-50 { width: 50%; } .sk.w-60 { width: 60%; } .sk.w-70 { width: 70%; } .sk.w-80 { width: 80%; }
.sk.w-90 { width: 90%; }
.sk.h-cap { height: 12px; } .sk.h-text { height: 14px; } .sk.h-head { height: 17px; } .sk.h-title { height: 28px; }
.sk.h-btn { height: 44px; width: 160px; } .sk.h-av { width: 28px; height: 28px; }
.mw-reveal { animation: mw-fadein var(--d-mid) var(--ease) both; }
/* A caption the script fills in later keeps its line while empty, so the title under it does not move. */
.cap-slot:empty::before { content: "\00a0"; }
@media (max-width: 600px) {
  .skp { gap: 24px; }
  .skp-grid { grid-template-columns: minmax(0, 1fr); }
  .skp-row .skp-c.wide-only, .skp-row.hd { display: none; }
}

/* ---------- brand logo ---------- */
.brand-logo .mw-line { fill: none; stroke: var(--ink); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.brand-logo .mw-out { stroke-width: 13; }
.brand-logo .mw-band { fill: var(--marker); }
.brand-logo .mw-text { fill: var(--ink); }
/* Carbon: the night version (lines and name on-night, the shared line marker, no band). */
.t-carbon .brand-logo .mw-line { stroke: var(--on-night); }
.t-carbon .brand-logo .mw-text { fill: var(--on-night); }
.t-carbon .brand-logo .mw-out { stroke: var(--marker); }
.t-carbon .brand-logo .mw-band { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not(.t-paper) .brand-logo .mw-line { stroke: var(--on-night); }
  :root:not(.t-paper) .brand-logo .mw-text { fill: var(--on-night); }
  :root:not(.t-paper) .brand-logo .mw-out { stroke: var(--marker); }
  :root:not(.t-paper) .brand-logo .mw-band { display: none; }
}

/* ---------- motion: one curve, 150 / 240 / 400 ms ---------- */
@keyframes mw-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes mw-toast { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes mw-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes mw-pop { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes mw-slide { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes mw-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes mw-caret { 0%, 70%, 100% { opacity: 1; } 20%, 50% { opacity: 0; } }
@keyframes mw-digit { from { opacity: 0; transform: translateY(60%) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes mw-wave { 0% { transform: none; } 35% { transform: translateY(-7px); } 70% { transform: translateY(1px); } 100% { transform: none; } }
@keyframes mw-scan { from { transform: translateX(0); } to { transform: translateX(304px); } }
@keyframes mw-spin { to { transform: rotate(360deg); } }
@keyframes mw-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.shake { animation: mw-shake var(--d-slow) cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
.spin { display: inline-block; width: 14px; height: 14px; flex: none; border: 1.5px solid currentColor; border-right-color: transparent; animation: mw-spin 0.7s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; scroll-behavior: auto !important;
  }
}

/* ---------- responsive: phone (600 px and below) ---------- */
@media (max-width: 600px) {
  .wm, .who .av-name { display: none; }
  .burger { display: inline-flex; }
  .bar { flex-wrap: nowrap; gap: 8px; padding: 8px 16px; }
  .org-wrap { flex: 1 1 auto; }
  .org { flex: 1 1 auto; justify-content: space-between; }
  .nav { display: none; }
  .shell { display: block; min-height: 0; }
  .mw-boot body { display: block; }
  .main { gap: 24px; padding: 24px 16px 48px; }
  .toasts { bottom: 16px; }
  .menu.pop { min-width: 0; width: calc(100vw - 32px); }
}

/* Organization switcher popover and drawer parts. */
.menu-search { padding: 12px 16px; }
.menu-list { margin: 0; padding: 0 0 4px; list-style: none; }
.menu-none { padding: 12px 16px; }
.menu-foot { padding: 8px 16px 4px; border-top: 1px solid var(--rule-soft); }
.menu-create { padding: 4px 0; border-top: 1px solid var(--rule); }
a.mi { text-decoration: none; }
.mi-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.mi-text .small { overflow-wrap: anywhere; }
.skel-slot { display: flex; flex-direction: column; gap: 12px; }
.skel-slot:empty { display: none; }
.mi[aria-busy="true"] { cursor: progress; }

/* v1 page classes, only those a page or script still uses (review 17.11) */
:root {
  --fg: var(--text); --fg-2: var(--graphite); --fg-3: var(--dim);
  --bad: var(--correction); --bad-ink: var(--correction-ink); --bad-wash: var(--correction-wash); --on-bad: var(--on-correction);
  --ink-hover: var(--ink-deep); --field-line: var(--field-border); --font: var(--sans); --ease-ui: var(--ease);
  --gutter: clamp(16px, 0.5rem + 2.4vw, 40px);
  --r-btn: 0; --r-tag: 0; --r-ctl: 0; --r-sheet: 0;
  --shadow-sm: none; --shadow-md: none; --shadow-lg: none;
}
code {
  font-family: var(--mono);
  font-size: 0.93em;
}
.app-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.app-top:empty {
  display: none;
}
.app-notice {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  background: var(--ink-tint);
  color: var(--fg);
  font-size: 15px;
}
.app-notice p + p {
  margin-top: 6px;
}
.app-notice .app-btn {
  margin-top: 10px;
}
#mw-verify-banner .app-btn {
  margin-top: 0;
}
.app-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 18px;
  border: 1.5px solid transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 200ms var(--ease-ui);
}
.app-btn:active {
  transform: scale(0.98);
  transition-duration: 100ms;
}
.app-btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}
.app-btn-primary {
  background: var(--ink);
  color: var(--on-ink);
}
.app-btn-primary:hover:not(:disabled) {
  background: var(--ink-hover);
}
.app-btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.app-btn-quiet:hover:not(:disabled) {
  background: var(--ink-tint);
  border-color: var(--ink);
}
.app-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.app-link:hover {
  text-decoration-thickness: 2px;
}
.app-mark {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
}
.app-mark svg {
  width: 10px;
  height: 10px;
  display: block;
}
.app-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.app-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.app-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-2);
}
.app-input {
  appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 10px 0;
  font: inherit;
  font-size: 16px;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-bottom: 1.5px solid var(--field-line);
}
.app-input::placeholder {
  color: var(--fg-3);
  opacity: 1;
}
.app-input:hover {
  border-bottom-color: var(--fg-2);
}
.app-input[aria-invalid="true"] {
  border-bottom-color: var(--bad);
}
.app-error {
  font-size: 14px;
  color: var(--bad-ink);
  font-weight: 500;
}
.app-form-msg {
  font-size: 15px;
  color: var(--bad-ink);
  font-weight: 500;
}
.app-form-msg:empty {
  display: none;
}
.app-dialog {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  background: var(--sheet);
  color: var(--fg);
}
.app-dialog::backdrop {
  background: var(--scrim);
}
.app-dialog-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.app-dialog h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.app-dialog p {
  color: var(--fg-2);
  font-size: 15px;
}
.app-dialog .app-error, .app-dialog .app-form-msg {
  color: var(--bad);
}
.app-dialog-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px;
  border-top: 1px solid var(--rule-soft);
}
.app-dialog-foot .app-btn {
  min-width: 0;
}
.app-dialog-form {
  margin: 0;
  display: flex;
  flex-direction: column;
}
.app-dialog-body h2 + p {
  margin-top: -6px;
}
@media (max-width: 760px) {
.app-top {
  position: sticky;
}
}
@media (max-width: 600px) {
.app-dialog-body {
  padding: 24px 20px;
}
.app-dialog-foot {
  padding: 14px 20px;
}
.app-dialog-foot .app-btn {
  flex: 1 1 auto;
}
}
@media print {
.app-top, .app-btn {
  display: none !important;
}
}
.app-notice.app-verify {
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.app-notice.app-verify .app-verify-main {
  margin: 0;
  flex: 1 1 320px;
  min-width: 0;
}
.app-notice.app-verify .app-btn {
  margin-top: 0;
  flex: 0 0 auto;
}
.app-dialog .app-error {
  color: var(--bad);
}
