/* =========================================================================
   Rotation - design system
   Token rules: every gap/margin between elements is --gap (10px). Three fixed radii.
   One border token, --line, everywhere. No mixing widths or colours.
   ========================================================================= */

:root {
  /* spacing: distance between elements is always 10px */
  --gap: 10px;
  --gap-2: 20px;
  --pad: 18px;

  /* radius: architectural, near-square. Circles keep --r-pill on purpose. */
  --r-card: 4px;
  --r-input: 3px;
  --r-chip: 2px;
  --r-pill: 999px;

  /* type */
  --serif: "Playfair Display", "Bodoni 72", Didot, "Bodoni MT", "Times New Roman", serif;
  /* Hangul has no glyphs in Montserrat, so the Korean console falls through to
     whatever the operator machine ships. No extra request. */
  --sans: Montserrat, "Avenir Next", "Helvetica Neue", Arial, Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --track-label: .17em;

  /* colour (paper) */
  --bg: #f3ebdd;
  --bg-deep: #e5d9c4;
  --surface: #fbf6ed;
  --surface-2: #f2e9d8;
  --surface-3: #e9dcc6;
  --ink: #0d2b1d;
  --ink-2: #40594b;
  --ink-3: #7e8f81;
  --line: #ddceb0;
  --line-strong: #c6b18a;

  --accent: #a9782f;
  --accent-press: #8f6421;
  --accent-ink: #fbf6ed;
  --accent-soft: #f5e9d2;
  --accent-line: #dcc08a;
  --gold-grad: linear-gradient(135deg, #8f6421, #c89d51 45%, #9c6d26);
  --gold-hair: linear-gradient(90deg, transparent, #c89d51 18%, #a9782f 50%, #c89d51 82%, transparent);

  --ok: #2f6b4a;
  --ok-soft: #e2eee4;
  --warn: #97711d;
  --warn-soft: #f6ecd3;
  --danger: #8f3626;
  --danger-soft: #f6e4de;
  --info: #2f5a63;
  --info-soft: #e2ecec;

  /* hero panel: paper in light, marble in dark */
  --hero-bg:
    radial-gradient(120% 90% at 78% 0%, rgba(169, 120, 47, .16), transparent 62%),
    linear-gradient(158deg, #fbf6ed 0%, #f3e9d7 55%, #e9dcc6 100%);
  --hero-ink: #0d2b1d;
  --hero-ink-2: #40594b;
  --hero-line: rgba(169, 120, 47, .34);
  --hero-glow: rgba(169, 120, 47, .16);
  --hero-tile: rgba(255, 255, 255, .58);
  --hero-tile-line: rgba(169, 120, 47, .26);

  --shadow-1: 0 1px 1px rgba(13, 43, 29, .04), 0 10px 26px -20px rgba(13, 43, 29, .38);
  --shadow-2: 0 2px 4px rgba(13, 43, 29, .06), 0 24px 50px -26px rgba(13, 43, 29, .46);
  --shadow-up: 0 -2px 18px -12px rgba(13, 43, 29, .4);

  /* motion */
  --dur-1: .16s;
  --dur-2: .22s;
  --dur-3: .34s;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --spring: linear(0, .1 3.3%, .38 7.4%, .78 12.4%, .99 15.7%, 1.08 19.2%, 1.09 22.9%, 1.04 28.3%, .997 35.3%, .99 46.5%, 1);

  --tap: 44px;
  --header-h: 56px;
  --nav-h: 62px;
  color-scheme: light;
}

/* dark = the marble side of the reference: deep green stone, warmer gold */
[data-theme="dark"] {
  --bg: #16231d;
  --bg-deep: #0a120d;
  --surface: #1c2a23;
  --surface-2: #22332a;
  --surface-3: #2b3d33;
  --ink: #f2ead9;
  --ink-2: #b3c3b5;
  --ink-3: #82947f;
  --line: #33463a;
  --line-strong: #4c6353;

  --accent: #c89d51;
  --accent-press: #b1873f;
  --accent-ink: #0d2b1d;
  --accent-soft: #26372c;
  --accent-line: #55492c;
  --gold-grad: linear-gradient(135deg, #a9782f, #e0bd7c 45%, #b1873f);
  --gold-hair: linear-gradient(90deg, transparent, #c89d51 18%, #f7d994 50%, #c89d51 82%, transparent);

  --ok: #79c396;
  --ok-soft: #1b2c22;
  --warn: #dcb265;
  --warn-soft: #2c2618;
  --danger: #dd8672;
  --danger-soft: #2e211c;
  --info: #86b7bd;
  --info-soft: #1a2a2b;

  --hero-bg:
    radial-gradient(120% 90% at 78% 0%, rgba(200, 157, 81, .22), transparent 62%),
    linear-gradient(158deg, #16231d 0%, #0d2b1d 55%, #0a1a12 100%);
  --hero-ink: #f2ead9;
  --hero-ink-2: #cbd8cb;
  --hero-line: rgba(200, 157, 81, .34);
  --hero-glow: rgba(247, 217, 148, .16);
  --hero-tile: rgba(255, 255, 255, .1);
  --hero-tile-line: rgba(247, 217, 148, .28);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 26px -20px rgba(0, 0, 0, .9);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .55), 0 24px 50px -26px rgba(0, 0, 0, .95);
  --shadow-up: 0 -2px 18px -12px rgba(0, 0, 0, .85);
  color-scheme: dark;
}

/* --------------------------------- reset --------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* No document scroll. Only inner containers scroll. */
html { overflow: hidden; }
body {
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* display face: the didone serif carries every headline and number */
.display, .hero .big, .app-header .title, .guide-main h3, .legal-sec h4 { font-family: var(--serif); }
/* micro label: the wide-tracked uppercase sans from the reference */
.label-micro {
  font-family: var(--sans); font-size: 10.5px; font-weight: 600;
  letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-3);
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* --------------------- app shell (mobile first + frame) --------------------- */

#shell {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 12% 0%, color-mix(in oklab, var(--accent) 14%, transparent), transparent 58%),
    radial-gradient(100% 80% at 92% 100%, color-mix(in oklab, var(--ink) 22%, transparent), transparent 55%),
    var(--bg-deep);
}

#app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* paper: an uneven wash rather than a flat fill */
  background:
    radial-gradient(130% 60% at 50% 0%, color-mix(in oklab, var(--surface) 70%, transparent), transparent 70%),
    linear-gradient(155deg, var(--bg) 0%, color-mix(in oklab, var(--surface) 55%, var(--bg)) 52%, var(--bg-deep) 100%);
  isolation: isolate;
}

/* paper grain, exactly the trick the reference poster uses */
#app::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)'/%3E%3C/svg%3E");
}
[data-theme="dark"] #app::after { opacity: .085; }

/* on desktop, wrap the app in a device frame so it reads as a real app */
@media (min-width: 620px) and (min-height: 700px) {
  #app {
    height: min(884px, calc(100dvh - 40px));
    border-radius: 42px;
    border: 1px solid var(--line);
    box-shadow: 0 40px 90px -30px rgba(10, 18, 13, .55), 0 0 0 10px #101a14, 0 0 0 11px rgba(200, 157, 81, .28);
    overflow: hidden;
  }
  #app::before {
    content: "";
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 118px; height: 26px;
    background: #0a120d;
    border-radius: var(--r-pill);
    z-index: 45; /* below modals and popups so the notch never covers content */
    pointer-events: none;
  }
  .app-header { padding-top: 30px !important; height: calc(var(--header-h) + 30px) !important; }
}

/* header */
.app-header {
  flex: 0 0 auto;
  height: var(--header-h);
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: var(--gap);
  padding: 0 var(--gap);
  background: color-mix(in oklab, var(--surface) 90%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}
/* a hairline of gold under the header, the way the poster frames its edges */
.app-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 100%;
  height: 1px;
  background: var(--gold-hair);
  opacity: .75;
  pointer-events: none;
}
.app-header .title {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: .01em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Pinned to the third column on purpose. The title in column 2 is display:none
   on the sign-in screen, and a display:none grid item leaves the grid entirely -
   so without this the right slot auto-placed into column 2 and the language
   switch drifted to the middle-left. */
.app-header .right { grid-column: 3; display: flex; align-items: center; justify-content: flex-end; gap: var(--gap); }

/* ------------------------------ public homepage ---------------------------- */
.site-hero { display: grid; place-items: center; padding: 8px 0 4px; }

/* three menus, centred, on a single hairline rule - eight chips left-aligned in
   two ragged rows was the thing that read as unfinished */
.site-menu {
  display: flex; justify-content: center; gap: 2px; flex-wrap: wrap;
  padding: 4px; border-radius: var(--r-input);
  background: var(--surface-2); border: 1px solid var(--line);
}
.site-menu-item {
  flex: 1 1 0; min-width: 92px; min-height: 38px; padding: 0 14px;
  border-radius: 9px; background: transparent; color: var(--ink-2);
  font-size: 13px; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.site-menu-item:hover { color: var(--ink); }
.site-menu-item:active { transform: scale(.98); }
.site-menu-item[aria-pressed="true"] {
  background: var(--surface); color: var(--accent); box-shadow: var(--shadow-1);
}

/* the line of type under the menu, framed by two gold rules */
.site-lead {
  display: flex; align-items: center; gap: var(--gap);
  font-size: 11px; font-weight: 600; letter-spacing: var(--track-label);
  text-transform: uppercase; color: var(--ink-3); text-align: center;
}
.site-lead-rule { flex: 1 1 auto; height: 1px; background: var(--gold-hair); opacity: .8; }

.site-page-title { font-family: var(--serif); font-size: 19px; font-weight: 500; letter-spacing: .01em; }
.site-p { font-size: 13.5px; line-height: 1.75; color: var(--ink-2); }
.site-p + .site-p { margin-top: 10px; }

/* a closing ornament, the way the printed material ends a page */
.site-orn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 0 2px; }
.site-orn i { width: 5px; height: 5px; background: var(--gold); transform: rotate(45deg); }
.site-orn span { width: 84px; height: 1px; background: var(--gold-hair); }

/* the four admins, as one bar across the top of the console */
.adm-products { display: flex; align-items: center; gap: 4px; justify-self: center; flex-wrap: wrap; }
.adm-product {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
  font-size: 12px; font-weight: 600; white-space: nowrap; text-decoration: none;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease),
              border-color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.adm-product i { font-size: 15px; color: var(--ink-3); transition: color var(--dur-2) var(--ease); }
.adm-product i.ext { font-size: 12px; opacity: .6; }
.adm-product:hover { background: var(--surface-2); color: var(--ink); }
.adm-product:active { transform: translateY(1px); }
.adm-product[aria-current="page"] {
  background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line);
}
.adm-product[aria-current="page"] i { color: var(--accent); }
@media (max-width: 860px) {
  .adm-product span { display: none; }
  .adm-product { padding: 0 10px; }
}

.icon-btn {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-input);
  color: var(--ink-2);
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 21px; height: 21px; }

.help-btn { color: var(--accent); background: transparent; border: 1px solid var(--accent-line); }
.help-btn:hover { background: var(--accent-soft); color: var(--accent-press); }

/* body (route view) */
.app-main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: var(--gap);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
/* table screens: no page scroll, only the table body scrolls */
.view.is-fixed { overflow: hidden; }

.view::-webkit-scrollbar { width: 6px; height: 6px; }
.view::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--r-pill); }

/* bottom tabs */
.app-nav {
  flex: 0 0 auto;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid;
  /* one equal column per tab, however many there are - a fixed count left the
     tabs bunched against the left edge */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  z-index: 40;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-3);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  position: relative;
  transition: color var(--dur-2) var(--ease);
}
.tab > span { padding-left: var(--track-label); }
.tab svg { width: 22px; height: 22px; transition: transform var(--dur-2) var(--spring); }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"] svg { transform: translateY(-2px) scale(1.06); }
/* No badge on the active tab: it landed on top of the icon. Gold colour, the
   filled icon and the lifted glyph already say which tab you are on. */
.tab[aria-current="page"] > span { color: var(--accent); }
.tab:active svg { transform: scale(.88); }
@keyframes dotIn { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* route transition */
.view-enter { animation: viewIn var(--dur-3) var(--ease-out) both; }
@keyframes viewIn { from { opacity: 0; transform: translate3d(0, 10px, 0); } to { opacity: 1; transform: none; } }

/* --------------------------------- cards --------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--pad);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
/* 10px between cards */
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; align-items: center; gap: var(--gap); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.card + .card, .stack > * + * { margin-top: 0; }

/* card titles read as engraved section labels */
.card-title {
  font-size: 10.5px; font-weight: 600; letter-spacing: var(--track-label); text-transform: uppercase;
  color: var(--ink-2); display: flex; align-items: center; gap: 8px;
  padding-bottom: 10px; position: relative;
}
.card-title::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--gold-hair); opacity: .55;
}
.card-title i { color: var(--accent); font-size: 15px; }
.card-sub { font-size: 13px; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--ink-3); }

/* entrance stagger */
.stagger > * { animation: fadeUp var(--dur-3) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }
.stagger > *:nth-child(7) { animation-delay: 240ms; }
.stagger > *:nth-child(8) { animation-delay: 280ms; }
.stagger > *:nth-child(n+9) { animation-delay: 320ms; }
@keyframes fadeUp { from { opacity: 0; transform: translate3d(0, 12px, 0); } to { opacity: 1; transform: none; } }

/* -------------------------------- buttons -------------------------------- */

.btn {
  min-height: var(--tap);
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--r-chip);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  transition: transform var(--dur-1) var(--ease), background var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease), color var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease);
  will-change: transform;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }

.btn-primary { background: var(--gold-grad); color: var(--accent-ink); border-color: transparent; box-shadow: 0 10px 22px -14px rgba(143, 100, 33, .9); }
.btn-primary:hover { background: var(--accent-press); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-soft { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in oklab, var(--danger) 30%, transparent); }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 10px; border-radius: var(--r-chip); }
.btn-lg { min-height: 54px; font-size: 12px; letter-spacing: .16em; }
.btn-icon { padding: 0 9px; }
.btn-icon i { font-size: 15px; }

/* ---------------------------- chips / number badges ---------------------------- */
/* text inside chips and badges is exactly centred: line-height 1 + place-items */

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--r-chip);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .09em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
  /* baseline correction: flex centring + text box trim */
  text-align: center;
  transition: transform var(--dur-1) var(--ease), background var(--dur-2) var(--ease);
}
.chip > * { line-height: 1; display: block; }
.chip-lg { height: 30px; padding: 0 13px; font-size: 10.5px; }
.chip-link { cursor: pointer; text-transform: none; letter-spacing: .02em; }
.chip-link:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.chip-accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.chip-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in oklab, var(--ok) 26%, transparent); }
.chip-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in oklab, var(--warn) 26%, transparent); }
.chip-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in oklab, var(--danger) 26%, transparent); }
.chip-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in oklab, var(--info) 26%, transparent); }
.chip-select { cursor: pointer; }
.chip-select[aria-pressed="true"] { background: var(--gold-grad); color: var(--accent-ink); border-color: transparent; }
.chip-select:active { transform: scale(.94); }

/* a grid on the paper application (현직장/전직장, 부/모, 형제 1~3) is shown as one
   labelled block per row, so nothing has to scroll sideways on a phone */
.grid-row-label {
  margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 10.5px; font-weight: 600; letter-spacing: var(--track-label);
  text-transform: uppercase; color: var(--accent);
}

/* single choice, one row per answer - long sentences do not fit a dropdown */
.radio-list { display: flex; flex-direction: column; gap: var(--gap); }
.rb {
  display: flex; align-items: flex-start; gap: var(--gap); cursor: pointer; user-select: none;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--r-input); background: var(--surface);
  transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.rb:hover { border-color: var(--accent-line); }
.rb:active { transform: translateY(1px); }
.rb input { position: absolute; opacity: 0; width: 0; height: 0; }
.rb .dot {
  flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: var(--surface); display: grid; place-items: center;
  transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.rb .dot::after {
  content: ""; width: 8px; height: 8px; border-radius: var(--r-pill); background: var(--accent-ink);
  opacity: 0; transform: scale(.4);
  transition: opacity var(--dur-1) var(--ease), transform var(--dur-2) var(--spring);
}
.rb input:checked + .dot { background: var(--accent); border-color: var(--accent); }
.rb input:checked + .dot::after { opacity: 1; transform: scale(1); }
.rb input:focus-visible + .dot { box-shadow: 0 0 0 3px var(--accent-soft); }
.rb:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.rb .txt { font-size: 13px; line-height: 1.55; }
.field.invalid .radio-list .rb { border-color: color-mix(in oklab, var(--danger) 45%, transparent); }

/* circled number badge */
.circ {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  vertical-align: middle;
  flex: 0 0 auto;
  /* Optical nudge, measured against the rendered ink box rather than guessed.
     Montserrat 700: digit widths are identical and cap heights match, so the
     only correction left is the sub-pixel rounding of (box - line) / 2.
     22px box / 12px text -> glyph sits 0.2px high.  28px / 13px -> dead centre. */
  --circ-nudge: .2px;
}
.circ > span { display: block; line-height: 1; transform: translateY(var(--circ-nudge)); }
.circ-lg { width: 28px; height: 28px; font-size: 13px; --circ-nudge: 0px; }
.circ-soft { background: var(--accent-soft); color: var(--accent); }
.circ-ghost { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

/* ------------------------------ form controls ------------------------------ */

.field { display: flex; flex-direction: column; gap: var(--gap); }
.field > label { font-size: 13px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.field .req { color: var(--accent); font-size: 12px; line-height: 1; }
.field .err { font-size: 12px; color: var(--danger); display: none; align-items: center; gap: 6px; }
.field.invalid .err { display: flex; animation: shake .3s var(--ease); }
.field.invalid .input, .field.invalid .dd-btn { border-color: var(--danger); }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border-radius: var(--r-input);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.input::placeholder { color: var(--ink-3); }
.input:hover { border-color: var(--line-strong); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.6; }

/* remove number spinners entirely */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }

.input-money { text-align: right; font-variant-numeric: tabular-nums; padding-right: 42px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .suffix {
  position: absolute; right: 14px;
  font-size: 13px; color: var(--ink-3); pointer-events: none; font-weight: 600;
}
.input-wrap .prefix-btn { position: absolute; right: 6px; }

/* custom checkbox */
/* left aligned in forms; inside tables the .cell wrapper does the centring */
.cb { display: inline-flex; align-items: center; justify-content: flex-start; gap: var(--gap); cursor: pointer; user-select: none; }
.cell .cb { justify-content: center; }
.cb input { position: absolute; opacity: 0; width: 0; height: 0; }
.cb .box {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--spring);
}
.cb .box svg { width: 13px; height: 13px; stroke: var(--accent-ink); stroke-width: 3.2; opacity: 0; transform: scale(.5); transition: opacity var(--dur-1) var(--ease), transform var(--dur-2) var(--spring); }
.cb input:checked + .box { background: var(--accent); border-color: var(--accent); }
.cb input:checked + .box svg { opacity: 1; transform: scale(1); }
.cb input:focus-visible + .box { box-shadow: 0 0 0 3px var(--accent-soft); }
.cb:active .box { transform: scale(.9); }
.cb .txt { font-size: 13px; line-height: 1; }

/* segmented control */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-input); }
.seg button {
  min-height: 36px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--ink-2);
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-1); }
.seg button:active { transform: scale(.96); }

/* ---------------------------- dropdown (custom) ---------------------------- */

.dd { position: relative; }
.dd-btn {
  width: 100%;
  min-height: var(--tap);
  padding: 8px 40px 8px 14px;
  border-radius: var(--r-input);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  position: relative;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.dd-btn:hover { border-color: var(--line-strong); }
.dd-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dd-btn .dd-ph { color: var(--ink-3); font-size: 13.5px; }
.dd-btn .caret {
  position: absolute; right: 12px; top: 50%;
  width: 16px; height: 16px; margin-top: -8px;
  color: var(--ink-3);
  transition: transform var(--dur-2) var(--ease);
}
.dd-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.dd-btn .chip { max-width: 150px; overflow: hidden; }
.dd-btn .chip .x { opacity: .6; }

.dd-pop {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform-origin: top center;
  animation: ddIn var(--dur-2) var(--ease-out) both;
}
.dd-pop.up { transform-origin: bottom center; }
@keyframes ddIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.dd-search { padding: var(--gap); border-bottom: 1px solid var(--line); }
.dd-search .input { min-height: 38px; padding: 6px 12px; font-size: 13.5px; }
.dd-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 236px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.dd-search, .dd-foot { flex: 0 0 auto; }
.dd-opt {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: var(--gap);
  font-size: 13.5px;
  text-align: left;
  transition: background var(--dur-1) var(--ease);
}
.dd-opt:hover, .dd-opt.cursor { background: var(--surface-2); }
.dd-opt[aria-selected="true"] { color: var(--accent); font-weight: 700; }
.dd-opt > span { word-break: keep-all; }
.dd-opt .desc { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.dd-empty { padding: 18px 10px; text-align: center; color: var(--ink-3); font-size: 13px; }
.dd-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  padding: var(--gap);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.dd-foot .btn { min-height: 36px; font-size: 12.5px; background: var(--surface); white-space: nowrap; padding: 0 8px; }
@media (max-width: 340px) { .dd-foot { grid-template-columns: 1fr; } }

/* -------------------------------- calendar -------------------------------- */

.cal-field { position: relative; }
.cal-pop {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  width: 100%;
  min-width: 288px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-2);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform-origin: top center;
  animation: ddIn var(--dur-2) var(--ease-out) both;
}
.cal-pop.up { transform-origin: bottom center; }
.cal-head { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: var(--gap); }
.cal-head .yy { display: flex; align-items: center; justify-content: center; gap: 6px; }
.cal-head .yy input {
  width: 62px; text-align: center; font-weight: 800; font-size: 14px;
  border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 4px 2px;
  font-variant-numeric: tabular-nums;
}
.cal-head .yy input:hover { background: var(--surface-2); }
.cal-head .yy input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.cal-head .yy .cal-month { width: 104px; }
.cal-head .yy .cal-month .dd-btn {
  min-height: 30px; padding: 0 6px; border-color: transparent; background: transparent;
  justify-content: center; gap: 4px;
}
.cal-head .yy .cal-month .dd-btn:hover { background: var(--surface-2); }
.cal-head .yy .cal-month .dd-btn > span { font-size: 14px; font-weight: 800; }
.cal-nav { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease); }
.cal-nav:hover { background: var(--surface-2); }
.cal-nav:active { transform: scale(.9); }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow span { text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 2px 0; }
.cal-dow span:first-child { color: var(--danger); }
.cal-dow span:last-child { color: var(--info); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; animation: calSwap var(--dur-2) var(--ease-out) both; }
@keyframes calSwap { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.cal-cell {
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform var(--dur-1) var(--spring);
}
.cal-cell.mute { color: var(--ink-3); opacity: .55; }
.cal-cell:hover:not(:disabled) { background: var(--surface-2); }
.cal-cell:active { transform: scale(.9); }
.cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--accent-line); color: var(--accent); }
.cal-cell.sel { background: var(--accent); color: var(--accent-ink); }
.cal-cell:disabled { opacity: .25; pointer-events: none; }
.cal-foot { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--gap); }
.cal-foot .btn { min-height: 34px; font-size: 12.5px; }

/* --------------------------------- table --------------------------------- */
/* Rules: everything centred / every column named / column rules / opaque sticky
   header / last row keeps its border / header and body share one 1px --line */

.tbl-toolbar { display: flex; flex-direction: column; gap: var(--gap); flex: 0 0 auto; }
.tbl-toolbar .row { flex-wrap: nowrap; }
.tbl-toolbar .cal-field, .tbl-toolbar .dd, .tbl-toolbar .input { flex: 1 1 0; min-width: 0; }
.filter-toggle { position: relative; flex: 0 0 auto; }
.filter-toggle .cnt {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.filter-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-3) var(--ease);
}
.filter-panel > .inner { overflow: hidden; min-height: 0; }
.filter-panel.open { grid-template-rows: 1fr; }
.filter-panel .inner > .stack { padding-top: var(--gap); }

.tbl-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  overflow: hidden;               /* clip to the rounded corner */
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 0 1 auto;                 /* shrink with short content so the bottom border always sits tight */
  box-shadow: var(--shadow-1);
}
.tbl-scroll {
  overflow: auto;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tbl-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.tbl-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--r-pill); border: 2px solid var(--surface); }
.tbl-scroll::-webkit-scrollbar-track { background: transparent; }

table.tbl {
  border-collapse: separate;      /* never collapse: a sticky header loses its borders */
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  margin-bottom: -1px;            /* overlap the wrapper border so it stays exactly 1px */
}

.tbl th, .tbl td {
  /* header and body share the same border */
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: center;             /* every cell centred */
  vertical-align: middle;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.35;
  background: var(--surface);
}
.tbl th:last-child, .tbl td:last-child { border-right: 0; }   /* the wrapper draws the outer border */

.tbl thead th {
  position: sticky;               /* pinned header */
  top: 0;
  z-index: 3;
  background: var(--surface-2);   /* opaque, so scrolled content never shows through */
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -.01em;
}
/* stop a 1px sliver of content showing under the header */
.tbl thead th::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--line);
}
.tbl tbody tr { transition: background var(--dur-1) var(--ease); }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tbody tr.sel td { background: var(--accent-soft); }
.tbl tbody tr:hover td, .tbl tbody tr.sel td { transition: background var(--dur-1) var(--ease); }

.tbl td .cell { display: flex; align-items: center; justify-content: center; gap: var(--gap); }
.tbl td.num, .tbl th.num { font-variant-numeric: tabular-nums; }
.tbl .col-check { width: 62px; }
.tbl .col-no { width: 62px; }
.tbl .col-manage { width: 128px; }
.tbl th .cell { display: flex; align-items: center; justify-content: center; gap: var(--gap); }

.tbl-empty { padding: 40px var(--pad); text-align: center; color: var(--ink-3); font-size: 13.5px; display: flex; flex-direction: column; align-items: center; gap: var(--gap); }

/* table skeleton */
.sk-row td { padding: 11px 12px; }
.sk-bar { height: 12px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sk 1.2s ease-in-out infinite; margin: 0 auto; width: 70%; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* pagination */
.pager { display: flex; align-items: center; justify-content: center; gap: var(--gap); flex-wrap: wrap; }
.pager button {
  min-width: 34px; height: 34px; padding: 0 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px; font-weight: 700; line-height: 1;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.pager button:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.pager button:active { transform: scale(.92); }
.pager button[aria-current="page"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pager button:disabled { opacity: .35; pointer-events: none; }
.pager .dots { color: var(--ink-3); padding: 0 2px; font-weight: 700; }
.pager-meta { text-align: center; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ----------------------------- modal / sheet ----------------------------- */

.scrim {
  position: absolute;
  inset: 0;
  background: color-mix(in oklab, #201009 55%, transparent);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 70;
  display: flex;
  animation: fade var(--dur-2) var(--ease-out) both;
}
.scrim.closing { animation: fadeOut var(--dur-2) var(--ease) both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }

.modal {
  margin: auto;
  width: calc(100% - 2 * var(--gap));
  max-height: calc(100% - 2 * var(--gap));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn var(--dur-3) var(--ease-out) both;
}
.scrim.closing .modal { animation: modalOut var(--dur-2) var(--ease) both; }
@keyframes modalIn { from { opacity: 0; transform: translate3d(0, 16px, 0) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes modalOut { to { opacity: 0; transform: translate3d(0, 10px, 0) scale(.98); } }

.sheet {
  margin: auto auto 0;
  width: 100%;
  max-height: calc(100% - 40px);
  background: var(--surface);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  border: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sheetIn var(--dur-3) var(--ease-out) both;
}
.scrim.closing .sheet { animation: sheetOut var(--dur-2) var(--ease) both; }
@keyframes sheetIn { from { transform: translate3d(0, 100%, 0); } to { transform: none; } }
@keyframes sheetOut { to { transform: translate3d(0, 100%, 0); } }
.sheet-grab { width: 40px; height: 4px; border-radius: var(--r-pill); background: var(--line-strong); margin: 10px auto 0; flex: 0 0 auto; }

.modal-head, .sheet-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap);
  padding: var(--pad);
  border-bottom: 1px solid var(--line);
  font-weight: 800; font-size: 15px; letter-spacing: -.02em;
}
.modal-body, .sheet-body { flex: 1 1 auto; min-height: 0; min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--pad); display: flex; flex-direction: column; gap: var(--gap); word-break: keep-all; }
.modal-foot, .sheet-foot { flex: 0 0 auto; display: flex; gap: var(--gap); padding: var(--pad); border-top: 1px solid var(--line); background: var(--surface-2); }
.modal-foot .btn, .sheet-foot .btn { flex: 1; }

/* --------------------------------- toast --------------------------------- */

.toasts { position: absolute; left: var(--gap); right: var(--gap); bottom: calc(var(--nav-h) + var(--gap)); z-index: 95; display: flex; flex-direction: column; gap: var(--gap); pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: var(--gap);
  padding: 12px 14px;
  border-radius: var(--r-input);
  background: color-mix(in oklab, var(--ink) 92%, transparent);
  color: var(--bg);
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-2);
  animation: toastIn var(--dur-3) var(--spring) both;
}
.toast.out { animation: toastOut var(--dur-2) var(--ease) both; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.err { background: var(--danger); color: #fff; }
.toast svg { width: 18px; height: 18px; flex: 0 0 auto; }
@keyframes toastIn { from { opacity: 0; transform: translate3d(0, 18px, 0) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translate3d(0, 10px, 0) scale(.98); } }

/* -------------------------------- loading -------------------------------- */
/* Attached only to the area that is loading. Never covers the header or tab bar. */

.loader {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  gap: var(--gap);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade var(--dur-2) var(--ease-out) both;
}
.loader .box { display: flex; flex-direction: column; align-items: center; gap: var(--gap); }
.loader .msg { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
/* The loader is the brand lockup breathing slowly - opacity only, so it stays
   on the compositor and never repaints the layout underneath. */
/* the whole box breathes, so the lockup and the "Loading" line stay in step */
.loader .box { animation: brandBreathe 2.6s var(--ease) infinite; }
.loader-mark { width: 168px; height: auto; }
@keyframes brandBreathe { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.86); opacity: .65; } }

/* boot splash, so the first paint never flashes the wrong screen */
#splash {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: var(--bg-deep);
  transition: opacity .28s var(--ease), visibility .28s;
}
#splash.hide { opacity: 0; visibility: hidden; }
#splash .logo-lockup { display: flex; flex-direction: column; align-items: center; gap: var(--gap); }
#splash .logo-lockup { padding: 26px 34px; border: 1px solid var(--accent-line); position: relative; }
#splash .logo-lockup::before,
#splash .logo-lockup::after {
  content: ""; position: absolute; left: 14px; right: 14px; height: 1px; background: var(--gold-hair);
}
#splash .logo-lockup::before { top: 7px; }
#splash .logo-lockup::after { bottom: 7px; }
#splash .logo-lockup .mark { width: min(58vw, 232px); height: auto; animation: brandBreathe 2.6s var(--ease) infinite; }

/* ---------------------------------- help ---------------------------------- */

.guide-modal { width: calc(100% - 2 * var(--gap)); height: calc(100% - 2 * var(--gap)); max-height: none; }
/* Search on top, the guide list folded behind a picker, the article below. */
.guide-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.guide-body > * { min-width: 0; }

.g-head {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--gap);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.g-head .input { min-height: 38px; font-size: 13px; }

.g-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-input);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.g-picker:hover { background: var(--surface-3); }
.g-picker[aria-expanded="true"] { border-color: var(--accent); }
.g-picker > i:first-child { color: var(--accent); font-size: 16px; flex: 0 0 auto; }
.g-picker-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.g-caret { color: var(--ink-3); flex: 0 0 auto; transition: transform var(--dur-2) var(--ease); }
.g-picker[aria-expanded="true"] .g-caret { transform: rotate(180deg); }

/* same fold as the table's filter panel: animate the grid row, not the height */
.g-panel {
  flex: 0 0 auto;
  display: grid;
  grid-template-rows: 0fr;
  background: var(--surface-2);
  transition: grid-template-rows var(--dur-3) var(--ease);
}
.g-panel > .inner { overflow: hidden; min-height: 0; }
.g-panel.open { grid-template-rows: 1fr; border-bottom: 1px solid var(--line); }
.g-panel .s-list {
  max-height: 46dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.g-panel .s-group { font-size: 9.5px; font-weight: 600; color: var(--ink-3); padding: 8px 8px 4px; }

.g-item {
  width: 100%; text-align: left; padding: 10px; border-radius: var(--r-input);
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); line-height: 1.35;
  display: flex; align-items: center; gap: 8px;
  word-break: normal; overflow-wrap: anywhere; flex: 0 0 auto;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.g-item:hover { background: var(--surface); color: var(--ink); }
.g-item:active { transform: scale(.99); }
.g-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); }
.g-item .new { width: 5px; height: 5px; background: var(--accent); flex: 0 0 auto; transform: rotate(45deg); }
.g-item[aria-current="true"] .new { background: var(--accent); }

.guide-main {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
/* There used to be a `@media (min-width: 900px)` sidebar variant here. It keyed
   off the VIEWPORT, but on a desktop the member app renders inside a ~420px
   device frame - so the browser was wide, the modal was not, and a 252px sidebar
   left the article about one character wide: the title came out spelled
   vertically. Help now has one shape on every screen, which is also what it
   should have been: the same thing on a phone and on a PC. */

/* the console pane is full width, so cap the measure or the lines run for miles */
#app.admin .guide-modal { width: min(760px, calc(100% - 2 * var(--gap))); }

.guide-main h3 { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.guide-main .lead { font-size: 13.5px; color: var(--ink-2); }
.g-step { display: flex; gap: var(--gap); padding: 12px; border: 1px solid var(--line); border-radius: var(--r-input); background: var(--surface); animation: fadeUp var(--dur-3) var(--ease-out) both; }
.g-step .body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.g-step { min-width: 0; }
.g-step .t { font-size: 13.5px; font-weight: 800; }
.g-step .d { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.g-steps > *:nth-child(1) { animation-delay: 40ms; }
.g-steps > *:nth-child(2) { animation-delay: 90ms; }
.g-steps > *:nth-child(3) { animation-delay: 140ms; }
.g-steps > *:nth-child(4) { animation-delay: 190ms; }
.g-steps > *:nth-child(5) { animation-delay: 240ms; }
.g-steps > *:nth-child(n+6) { animation-delay: 290ms; }
.g-steps { display: flex; flex-direction: column; gap: var(--gap); }

/* mini demo animations used inside help */
.g-demo { border: 1px solid var(--line); border-radius: var(--r-input); background: var(--surface-2); padding: var(--pad); display: grid; place-items: center; min-height: 128px; overflow: hidden; }
.demo-tap { position: relative; }
.demo-tap .ripple { position: absolute; inset: -10px; border-radius: var(--r-pill); border: 2px solid var(--accent); animation: ripple 1.8s var(--ease-out) infinite; }
@keyframes ripple { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.35); opacity: 0; } }
.demo-slide { display: flex; gap: var(--gap); animation: slideLoop 3.2s var(--ease) infinite; }
@keyframes slideLoop { 0%, 20% { transform: translateX(0); } 50%, 70% { transform: translateX(-88px); } 100% { transform: translateX(0); } }
.demo-list { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.demo-list i { display: block; height: 10px; border-radius: var(--r-pill); background: var(--line); animation: fillRow 2.4s var(--ease) infinite; }
.demo-list i:nth-child(2) { animation-delay: .18s; }
.demo-list i:nth-child(3) { animation-delay: .36s; }
.demo-list i:nth-child(4) { animation-delay: .54s; }
@keyframes fillRow { 0%, 100% { background: var(--line); transform: scaleX(.7); transform-origin: left; } 45% { background: var(--accent-line); transform: scaleX(1); } }

/* tour spotlight */
.tut-scrim { position: absolute; inset: 0; z-index: 120; pointer-events: auto; }
.tut-hole {
  position: absolute;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px color-mix(in oklab, #1b0d08 68%, transparent);
  border: 2px solid var(--accent);
  transition: all var(--dur-3) var(--ease-out);
  pointer-events: none;
}
.tut-hole::after { content: ""; position: absolute; inset: -6px; border-radius: 18px; border: 2px solid var(--accent); opacity: .5; animation: ripple 1.6s var(--ease-out) infinite; }
.tut-tip {
  position: absolute;
  left: var(--gap); right: var(--gap);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-2);
  padding: var(--pad);
  display: flex; flex-direction: column; gap: var(--gap);
  max-height: calc(100% - 2 * var(--gap));
  overflow-y: auto;
  animation: fadeUp var(--dur-3) var(--ease-out) both;
}
.tut-tip .t { font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: var(--gap); }
.tut-tip .d { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.tut-tip .acts { display: flex; gap: var(--gap); }
.tut-tip .acts .btn { flex: 1; min-height: 38px; font-size: 13px; }

/* ----------------------- pieces used by home and match ----------------------- */

.hero {
  position: relative;
  border-radius: var(--r-card);
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, color-mix(in oklab, var(--accent) 90%, #000 4%), color-mix(in oklab, var(--accent) 62%, #7a2f5c 30%));
  color: #fff;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  box-shadow: var(--shadow-2);
}
.hero::after {
  content: "";
  position: absolute;
  right: -46px; top: -46px;
  width: 190px; height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .3), transparent 62%);
  pointer-events: none;
}
.hero .label { font-size: 9.5px; font-weight: 600; letter-spacing: var(--track-label); text-transform: uppercase; opacity: .9; display: flex; align-items: center; gap: 7px; }
.hero .big { font-size: 38px; font-weight: 500; letter-spacing: .005em; font-variant-numeric: tabular-nums; line-height: 1.08; }
.hero .desc { font-size: 12px; opacity: .88; letter-spacing: .01em; }


.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.photo-slot {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-input);
  border: 1.5px dashed var(--line-strong);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--ink-3);
  transition: border-color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.photo-slot:hover { border-color: var(--accent); color: var(--accent); }
.photo-slot:active { transform: scale(.97); }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; animation: fade var(--dur-3) var(--ease-out) both; }
.photo-slot .del { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: var(--r-pill); background: color-mix(in oklab, var(--ink) 72%, transparent); color: #fff; display: grid; place-items: center; }
.photo-slot .badge-main { position: absolute; left: 6px; bottom: 6px; }
.photo-slot input[type="file"] { display: none; }

.progress { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--accent); transition: width var(--dur-3) var(--ease-out); }

.kv { display: grid; grid-template-columns: 88px 1fr; gap: var(--gap); align-items: center; font-size: 13px; }
.kv dt { color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }

.step-dots { display: flex; align-items: center; justify-content: center; gap: 6px; }
.step-dots i { width: 7px; height: 7px; border-radius: var(--r-pill); background: var(--line-strong); transition: width var(--dur-3) var(--spring), background var(--dur-2) var(--ease); }
.step-dots i.on { width: 22px; background: var(--accent); }

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--gap); padding: 36px var(--pad); text-align: center; color: var(--ink-3); font-size: 13.5px; }
.empty svg { width: 40px; height: 40px; opacity: .5; }

/* --------------------------- editorial layer ---------------------------- */
/* Everything that carries the reference poster's voice: didone display type,
   gold hairlines, engraved labels and the diamond ornament.                 */

/* the hero is the poster: paper, framed by a gold hairline, ink-green type */
.hero {
  background: var(--hero-bg);
  color: var(--hero-ink);
  border: 1px solid var(--hero-line);
  border-radius: var(--r-card);
  text-align: center;
  align-items: center;
  padding: 26px var(--pad) 24px;
}
.hero::before {
  content: "";
  position: absolute;
  left: 14px; right: 14px; top: 12px;
  height: 1px;
  background: var(--gold-hair);
  opacity: .8;
}
.hero::after {
  background: radial-gradient(circle, var(--hero-glow), transparent 64%);
}
.hero .label { justify-content: center; color: var(--accent); opacity: 1; }
.hero .label i { color: var(--accent); }
.hero .desc { color: var(--hero-ink-2); opacity: 1; }

/* a gold diamond used as a divider, like the poster's centre ornament */
.ornament {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--accent);
}
.ornament::before, .ornament::after {
  content: ""; height: 1px; flex: 1 1 auto; background: var(--gold-hair); opacity: .6;
}
.ornament i { width: 6px; height: 6px; background: currentColor; transform: rotate(45deg); display: block; }

.seg button {
  font-size: 10px; font-weight: 600; letter-spacing: var(--track-label); text-transform: uppercase;
}
.seg button[aria-pressed="true"] { color: var(--accent); }

/* gold hairlines draw themselves in rather than snapping on */
.card-title::after, .hero::before, .app-header::after { transform-origin: center; animation: hairline var(--dur-3) var(--ease-out) both; }
@keyframes hairline { from { opacity: 0; transform: scaleX(.2); } to { opacity: .6; transform: none; } }
.hero::before { animation-name: hairlineBright; }
@keyframes hairlineBright { from { opacity: 0; transform: scaleX(.2); } to { opacity: .8; transform: none; } }

/* The serif is for display type only.
   Playfair Display ships old-style figures and supports neither lnum nor tnum.
   Measured at 27px: 6px spread in digit height, 4px descent, 6.5px spread in
   width - so it can never hold a badge, a ticking clock or an aligned value.
   Anything the reader parses as a number uses the sans with tabular figures. */
.hero .big { font-family: var(--serif); letter-spacing: .01em; }
.tbl .num, .tbl td, .tbl th, .kv dd.num, .circ, .pager-meta {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* the circled step number becomes a gold seal (type stays sans - see below) */
.circ { background: var(--gold-grad); }
.circ-soft { background: var(--accent-soft); color: var(--accent); }
.circ-ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line-strong); }

/* table headers become engraved labels too */
.tbl th {
  font-size: 9.5px; font-weight: 600; letter-spacing: var(--track-label); text-transform: uppercase;
  color: var(--ink-2);
}
.tbl td { font-size: 12.5px; }
.pager button { border-radius: var(--r-chip); }
.pager-meta { font-size: 11px; letter-spacing: .04em; }

/* form labels: small, tracked, quiet */
.field > label {
  font-size: 9.5px; font-weight: 600; letter-spacing: var(--track-label);
  text-transform: uppercase; color: var(--ink-2);
}
.field .req { color: var(--accent); }

/* sheets and modals get the framing hairline */
.sheet-head, .modal-head { position: relative; }
.sheet-head::after, .modal-head::after {
  content: ""; position: absolute; left: var(--pad); right: var(--pad); bottom: 0; height: 1px;
  background: var(--gold-hair); opacity: .6;
}
.sheet-head > span:first-child, .modal-head > span:first-child {
  font-family: var(--serif); font-size: 18px; font-weight: 500; letter-spacing: .01em;
}

/* help modal headings */
.guide-main h3 { font-weight: 500; letter-spacing: .01em; }
.g-step .t { font-size: 10.5px; font-weight: 600; letter-spacing: var(--track-label); text-transform: uppercase; }
.s-group { letter-spacing: var(--track-label) !important; text-transform: uppercase; }

/* legal documents read like a printed contract */
.legal-sec h4 { font-weight: 500; letter-spacing: .01em; font-size: 15.5px; }
.legal-lead { font-family: var(--serif); font-size: 15px; font-weight: 400; line-height: 1.55; }
.legal-item > span > span:first-child { letter-spacing: .01em; }

/* ------------------------- new controls this release ------------------------ */

/* @ prefix inside the Instagram field */
.input-wrap .prefix {
  padding-left: 12px;
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 600;
  flex: 0 0 auto;
  pointer-events: none;
}
.input-wrap .prefix + .input { padding-left: 4px; }

/* "Continue with Google" sits above a hairline rule that says "or" */
.g-btn-holder { display: flex; justify-content: center; min-height: 44px; }
.or-rule {
  display: flex; align-items: center; gap: var(--gap);
  font-size: 9.5px; font-weight: 600; letter-spacing: var(--track-label);
  text-transform: uppercase; color: var(--ink-3);
}
.or-rule::before, .or-rule::after {
  content: ""; height: 1px; flex: 1 1 auto; background: var(--line);
}

/* the report sheet leads with its reason, so keep it calm and tall */
.report-sheet .sheet-body textarea { min-height: 108px; resize: vertical; }

/* --------------------------- sign-in screen ----------------------------- */
/* No cards here: the marble photograph IS the screen and the lockup, fields and
   buttons sit straight on the stone. Ink colours are hard-coded rather than
   tokenised because the photograph stays light in both themes.               */

/* the stone runs past the device frame as well, so no flat paper band is left
   above it on desktop; the surround is the same photograph, thrown out of focus
   so the two crops read as one table rather than two mismatched pictures */
/* Language switch, top right of the sign-in header. It is deliberately NOT in
   the form: sign-in is exactly one viewport tall, so anything added to the
   scrolling column gives the screen a scrollbar it must not have. */
.lang-seg {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px; border-radius: var(--r-pill); border: 1px solid var(--line);
  background: color-mix(in oklab, var(--surface-2) 74%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.lang-seg button {
  height: 22px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em; color: var(--ink-3);
  white-space: nowrap;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.lang-seg button:hover { color: var(--ink-2); }
.lang-seg button:active { transform: scale(.95); }
.lang-seg button[aria-pressed="true"] {
  background: var(--surface); color: var(--accent); box-shadow: var(--shadow-1);
}

body.on-auth #shell { background: #e7ded0; }
/* only the framed desktop layout shows anything outside the screen; on a phone
   the app fills the window and painting a blurred backdrop would be wasted */
@media (min-width: 620px) and (min-height: 700px) {
  body.on-auth #shell::before {
    content: "";
    position: absolute;
    inset: -4%;               /* overscan: the blur must not bleed a soft edge in */
    /* thrown out of focus and washed to a quiet beige, so the surround reads as
       the same stone without competing with the screen */
    background:
      linear-gradient(rgba(233, 223, 206, .62), rgba(233, 223, 206, .62)),
      url("/img/login-bg.jpg") 50% 50% / cover no-repeat;
    filter: blur(20px) saturate(.85);
    pointer-events: none;
  }
}

body.on-auth #app {
  /* border-box origin, or the 1px frame hairline shows the fallback colour and
     reads as a white line just inside the device frame.
     Sized past cover and hung from the bottom: that crops the heavy top of the
     vein, which otherwise runs straight through the field labels. */
  background:
    url("/img/login-bg.jpg") 22% 100% / auto 118% no-repeat border-box border-box,
    #efe6d6;
  border-color: transparent;
  /* re-point the palette at the photograph so header, type, fields and buttons
     all stay legible on it, dark theme included */
  --ink: #0d2b1d;
  --ink-2: #3f5a4a;
  --ink-3: #7b8a7c;
  --line: rgba(13, 43, 29, .2);
  --line-strong: rgba(13, 43, 29, .38);
  --accent: #a9782f;
  --accent-press: #8f6421;
  --accent-ink: #fbf6ed;
  --accent-soft: rgba(169, 120, 47, .16);
  --accent-line: rgba(169, 120, 47, .5);
  --gold-grad: linear-gradient(135deg, #8f6421, #c89d51 45%, #9c6d26);
  --surface-2: rgba(251, 246, 237, .55);
  --surface-3: rgba(251, 246, 237, .78);
  color: var(--ink);
}
/* the photograph carries its own grain */
body.on-auth #app::after { opacity: .04; }

/* the lockup already names the screen, so the header title is dead weight here;
   it stays in the DOM for the document title and screen readers */
body.on-auth .app-header .title { display: none; }

/* the header stops being a bar and becomes part of the photograph */
body.on-auth .app-header {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom-color: transparent;
}
body.on-auth .app-header::after { opacity: 0; }

/* the screen is full-bleed now, so give the type room from the edges */
body.on-auth .view { padding: 6px 50px 34px; }
body.on-auth .app-header { padding: 0 38px; }
body.on-auth .auth-body { gap: 18px; }

/* fields: label + hairline, no box */
body.on-auth .field { gap: 4px; }
body.on-auth .field > label {
  font-size: 9.5px; font-weight: 600; letter-spacing: var(--track-label);
  text-transform: uppercase; color: var(--ink-2);
}
body.on-auth .input {
  background: #fff;
  border: 1px solid rgba(13, 43, 29, .12);
  box-shadow: 0 1px 2px rgba(13, 43, 29, .06);
}
body.on-auth .input:hover { border-color: rgba(13, 43, 29, .24); }
body.on-auth .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(169, 120, 47, .18); }
body.on-auth .input::placeholder { color: #9aa79b; }
body.on-auth .input:-webkit-autofill,
body.on-auth .input:-webkit-autofill:hover,
body.on-auth .input:-webkit-autofill:focus {
  -webkit-text-fill-color: #0d2b1d;
  box-shadow: 0 0 0 40px #fff inset;
}

/* botanical sprig in the top corner. It hangs off .app-main, which starts below
   the header, so it clears the help button in both layouts; the negative
   z-index keeps it behind the type and above the photograph. */
body.on-auth .app-main::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 10px; right: -14px;
  width: 150px; height: 147px;
  background: url("/img/botanical.png") 100% 0 / contain no-repeat;
  opacity: .85;
  pointer-events: none;
}

/* the lockup sits a little above centre; the air it gives up falls between the
   headline and the first field */
body.on-auth .brand-lockup { margin-top: -22px; margin-bottom: 22px; }
@media (max-height: 720px) {
  body.on-auth .brand-lockup { margin-top: 0; margin-bottom: 0; }
}

/* both buttons carry the same block, so they read as a pair */
body.on-auth .auth-body .btn { min-height: 54px; }
body.on-auth .btn-ghost { background: rgba(255, 255, 255, .72); border-color: rgba(13, 43, 29, .14); }
body.on-auth .btn-ghost:hover { background: #fff; }

/* ------------------------------ brand lockup ------------------------------ */
/* The supplied wordmark, printed straight on the stone, with the gold ornaments
   and the headline below it.                                                 */

.brand-lockup {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px;
  padding: 10px 8px 2px;
  color: #0d2b1d;
}
.brand-lockup .bp-logo { margin: 0; line-height: 0; }
.brand-lockup .bp-logo img { width: min(74%, 300px); height: auto; margin: 0 auto; }

.brand-lockup .bp-orn { display: block; color: #a9782f; }
.brand-lockup .bp-orn-d { width: 7px; margin: 6px 0 0; }
.brand-lockup .bp-orn-h { width: 16px; margin: 8px 0 2px; }
.brand-lockup .bp-orn svg { display: block; width: 100%; height: auto; }

.brand-lockup .bp-headline {
  margin: 2px 0 0; font-family: var(--serif); font-size: 27px; font-weight: 500;
  line-height: 1.2; letter-spacing: -.005em; color: #0d2b1d;
  text-wrap: balance; max-width: 15ch;
}
.brand-lockup .bp-sub {
  margin: 0; font-family: var(--serif); font-size: 12.5px; line-height: 1.55;
  color: #3f5a4a; text-wrap: pretty; max-width: 34ch;
}

@media (max-height: 720px) {
  /* short phones: keep the form reachable without scrolling */
  .brand-lockup { gap: 6px; padding-top: 2px; }
  .brand-lockup .bp-logo img { width: min(62%, 240px); }
  .brand-lockup .bp-headline { font-size: 22px; }
  .brand-lockup .bp-sub { display: none; }
}

/* ------------------------- table: phone-fitted rows ----------------------- */
/* `fit` swaps the max-content table for one that shares the width it has, so a
   480px column never forces a horizontal drag. The columns it cannot show move
   into the detail sheet that opens when the row is tapped.                    */

table.tbl.tbl-fit { width: 100%; min-width: 0; max-width: 100%; table-layout: fixed; }
.tbl-fit td, .tbl-fit th { padding: 11px 6px; min-width: 0; }
.tbl-fit th .cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.tbl-fit .col-check .cell, .tbl-fit .col-more .cell { display: grid; place-items: center; }
/* nothing to drag sideways any more */
.tbl-fit + .tbl-scroll, .tbl-scroll:has(> .tbl-fit) { overflow-x: hidden; }
.tbl-fit td .cell, .tbl-fit th .cell { min-width: 0; }
/* long values shorten instead of widening the table */
.tbl-fit td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-fit td .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-flex; }

.tbl .col-more { color: var(--ink-3); }
.tbl .col-more i { font-size: 15px; }

.tbl tr.tappable { cursor: pointer; }
.tbl tr.tappable td { transition: background var(--dur-1) var(--ease); }
.tbl tr.tappable:hover td { background: var(--surface-2); }
.tbl tr.tappable:hover .col-more { color: var(--accent); }
.tbl tr.tappable:focus-visible { outline: 1.5px solid var(--accent); outline-offset: -2px; }
.tbl tr.tappable:active td { background: var(--surface-3); }

/* the sheet the row opens */
.record-sheet .record-head { padding-bottom: 2px; }
.record-sheet .sheet-foot { flex-wrap: wrap; }
.record-sheet .sheet-foot .btn { flex: 1 1 auto; min-width: 92px; }

/* --------------------------- legal / consent ---------------------------- */

/* one agreement per row: checkbox on the left, "View" on the right */
.consent-row { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); }
.consent-row .cb { flex: 1 1 auto; min-width: 0; align-items: flex-start; }
.consent-row .cb .box { margin-top: 1px; }
.consent-row .cb .txt { line-height: 1.45; word-break: normal; overflow-wrap: anywhere; }
.legal-view { flex: 0 0 auto; height: 30px; min-height: 30px; padding: 0 10px; font-size: 12px; color: var(--ink-2); }
.legal-view i { font-size: 14px; }

.link-btn {
  color: var(--accent); font-weight: 700; text-decoration: underline;
  text-underline-offset: 2px; text-decoration-thickness: 1.5px;
  transition: opacity var(--dur-1) var(--ease);
}
.link-btn:hover { opacity: .74; }

.other-wrap { animation: fadeUp var(--dur-2) var(--ease-out) both; }

/* document list on the profile screen */
.legal-list { display: flex; flex-direction: column; gap: 2px; }
.legal-item {
  display: flex; align-items: center; gap: var(--gap);
  padding: 10px 8px; border-radius: var(--r-input); text-align: left;
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.legal-item:hover { background: var(--surface-2); }
.legal-item:active { transform: scale(.985); }
.legal-item > i:first-child { color: var(--accent); font-size: 18px; flex: 0 0 auto; }
.legal-item > i:last-child { color: var(--ink-3); flex: 0 0 auto; }

/* the document itself */
.legal-sheet .sheet-body { gap: 14px; }
.legal-doc { display: flex; flex-direction: column; gap: 14px; font-size: 13.5px; line-height: 1.62; color: var(--ink-2); word-break: normal; overflow-wrap: anywhere; }
.legal-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.legal-lead { margin: 0; color: var(--ink); font-weight: 600; }
/* the translation is a reading aid, and has to say so before the text starts */
.legal-notice {
  margin: 0; padding: 11px 13px; border-radius: var(--r-input);
  background: var(--warn-soft); border: 1px solid color-mix(in oklab, var(--warn) 26%, transparent);
  color: var(--warn); font-size: 12px; line-height: 1.6; font-family: var(--sans);
}
.legal-sec { display: flex; flex-direction: column; gap: 6px; }
.legal-sec h4 { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.legal-sec p { margin: 0; }
.legal-sec ul { margin: 2px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.legal-sec li { list-style: disc; }

/* ------------------------- pre-JavaScript content ------------------------- */
/* The splash carries the page copy so crawlers that do not run JS still see it.
   It is the same wording the sign-in screen shows, set to match.             */

#splash .logo-lockup { max-width: min(88vw, 420px); text-align: center; }
#splash .seo-title {
  margin: 0; font-size: 0; line-height: 0;   /* the wordmark above already shows the name */
}
#splash .seo-title span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#splash .seo-lead {
  margin: 14px 0 0; font-family: var(--serif); font-size: 19px; font-weight: 500;
  line-height: 1.25; color: var(--ink); text-wrap: balance;
}
#splash .seo-sub {
  margin: 8px 0 0; font-family: var(--serif); font-size: 12px; line-height: 1.5;
  color: var(--ink-2); text-wrap: pretty;
}

.noscript-page {
  max-width: 640px; margin: 0 auto; padding: 40px 22px;
  font-family: var(--sans); color: var(--ink); line-height: 1.7;
}
.noscript-page h2 { font-family: var(--serif); font-size: 26px; font-weight: 500; margin: 0 0 14px; }
.noscript-page p { margin: 0 0 14px; }
.noscript-page ul { margin: 0 0 14px; padding-left: 20px; }
.noscript-page li { list-style: disc; margin-bottom: 6px; }
.noscript-page a { color: var(--accent); font-weight: 700; text-decoration: underline; }

/* ---------------------------- operations console --------------------------- */
/* Desktop only. Same tokens as the member app; the difference is density and the
   sidebar shell. No device frame, no page scroll: only the table body moves.  */

#shell.admin { display: block; background: var(--bg-deep); padding: 0; }
#app.admin {
  max-width: none;
  width: 100%;
  height: 100dvh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  grid-template-rows: var(--header-h) minmax(0, 1fr);
  grid-template-areas: "side top" "side main";
  background: var(--bg);
}
#app.admin::before { display: none; }            /* the phone notch has no place here */

#app.admin > .app-header {
  grid-area: top;
  height: var(--header-h) !important;
  padding: 0 var(--gap-2) !important;
  grid-template-columns: 1fr auto;
  border-left: 1px solid var(--line);
}
#app.admin > .app-header .title {
  font-size: 15px; font-weight: 600; text-align: left;
  letter-spacing: var(--track-label); text-transform: uppercase; font-family: var(--sans);
  color: var(--ink-2);
}
#app.admin > .app-main { grid-area: main; }
#app.admin > .view, #app.admin .app-main > .view { padding: var(--gap-2); }

/* sidebar */
#app.admin > .app-nav {
  grid-area: side;
  height: auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: var(--gap);
  background: var(--surface-2);
  border-top: 0;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.adm-brand { display: flex; align-items: center; gap: var(--gap); padding: 8px 8px 14px; border-bottom: 1px solid var(--line); }
.adm-brand img { border-radius: 3px; }
.adm-brand-name { font-family: var(--serif); font-size: 16px; font-weight: 500; letter-spacing: .01em; color: var(--ink); }
.adm-brand-sub { font-size: 8.5px; font-weight: 600; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--accent); }

.adm-links { display: flex; flex-direction: column; gap: 2px; }
.adm-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-input);
  font-size: 10.5px; font-weight: 600; letter-spacing: var(--track-label); text-transform: uppercase;
  color: var(--ink-2); text-align: left; width: 100%;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.adm-link i { font-size: 16px; color: var(--ink-3); transition: color var(--dur-1) var(--ease); }
.adm-link:hover { background: var(--surface); color: var(--ink); }
.adm-link:hover i { color: var(--accent); }
.adm-link[aria-current="page"] { background: var(--surface); color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.adm-link[aria-current="page"] i { color: var(--accent); }

/* the console door: one card, centred, nothing else on screen */
.gate-wrap { flex: 1 1 auto; min-height: 320px; display: flex; align-items: center; justify-content: center; position: relative; }
.gate-card {
  width: min(380px, 100%);
  display: flex; flex-direction: column; gap: var(--gap);
  padding: 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-2);
  animation: modalIn var(--dur-3) var(--ease-out) both;
}
.gate-card > i { font-size: 30px; color: var(--accent); }
.gate-card h2 { margin: 0; font-family: var(--sans); font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.gate-card .hint { word-break: keep-all; }
.gate-card .field + .btn { margin-top: 2px; }

/* screen header: the lead reads on the title's baseline, not under it */
.adm-head { flex: 0 0 auto; display: flex; align-items: flex-end; justify-content: space-between; gap: var(--gap); }
.adm-head-titles { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex-wrap: wrap; }
.adm-head-titles .hint { min-width: 0; }
.adm-title { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 500; letter-spacing: .01em; color: var(--ink); }

/* dashboard tiles: numbers breathe, no card chrome competing with them */
.adm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--gap); }
.adm-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 16px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  transition: border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.adm-tile:hover { border-color: var(--accent-line); }
.adm-tile:active { transform: translateY(1px); }
.adm-tile-label { font-size: 9.5px; font-weight: 600; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-3); }
.adm-tile-value { font-family: var(--serif); font-size: 34px; font-weight: 500; line-height: 1.05; color: var(--ink); }
.adm-tile.urgent { border-color: color-mix(in oklab, var(--danger) 42%, transparent); background: var(--danger-soft); }
.adm-tile.urgent .adm-tile-value, .adm-tile.urgent .adm-tile-label { color: var(--danger); }

/* the console is a wide surface: let the tables use it */
#app.admin .tbl-toolbar .row { flex-wrap: wrap; }
#app.admin .filter-panel .row { flex-wrap: wrap; }

/* one rhythm down the screen: 10px between every block, nothing bigger */
#app.admin .adm-head + #adm-table { margin-top: 0; }

/* the row count belongs on the pager's line, hard right */
#app.admin .pager-box { flex-direction: row; align-items: center; justify-content: space-between; }
#app.admin .pager-box .pager { justify-content: flex-start; }
#app.admin .pager-box .pager-meta { text-align: right; margin-left: auto; }

/* One rail for every control in the console chrome: the header actions and the
   whole toolbar sit on the same height, whatever element they are built from.
   Only the in-row Manage buttons stay small - a 40px button would fatten rows. */
#app.admin { --ctl-h: 40px; }
#app.admin > .app-header .btn,
#app.admin > .app-header .icon-btn,
#app.admin .tbl-toolbar .btn,
#app.admin .tbl-toolbar .input,
#app.admin .tbl-toolbar .cal-field .input {
  height: var(--ctl-h);
  min-height: var(--ctl-h);
}
/* a multi-select keeps growing with its chips, so it gets a floor, not a height */
#app.admin .tbl-toolbar .dd-btn { min-height: var(--ctl-h); }
#app.admin > .app-header .icon-btn { width: var(--ctl-h); }

/* The console reads in Korean. The label tracking and 10px sizes that suit
   uppercase Latin leave Hangul loose and small, so it is reset here; the member
   app keeps the original treatment. */
#app.admin .btn { font-size: 12px; letter-spacing: .01em; }
#app.admin .btn-sm { font-size: 11px; }
#app.admin .btn-lg { font-size: 13px; letter-spacing: .02em; }
#app.admin .adm-link { font-size: 12.5px; letter-spacing: 0; text-transform: none; }
#app.admin .adm-tile-label { font-size: 11px; letter-spacing: .01em; text-transform: none; }
#app.admin .app-header { grid-template-columns: auto 1fr auto; }
#app.admin > .app-header .title { font-size: 14px; letter-spacing: .01em; text-transform: none; }
#app.admin .adm-title, #app.admin .guide-main h3 { font-family: var(--sans); font-weight: 700; letter-spacing: -.01em; }
#app.admin .adm-title { font-size: 23px; }
#app.admin .hint, #app.admin .card-sub, #app.admin .adm-head .hint { word-break: keep-all; }
#app.admin .tbl thead th { letter-spacing: 0; }

/* dialogs are centred here rather than docked to the bottom, so they need a
   reading width instead of the full span of a 1900px console */
#app.admin .modal:not(.guide-modal) { width: min(680px, calc(100% - 2 * var(--gap-2))); }
#app.admin .modal.record-sheet { width: min(560px, calc(100% - 2 * var(--gap-2))); }
.record-sheet .modal-foot { flex-wrap: wrap; }
.record-sheet .modal-foot .btn { flex: 1 1 auto; min-width: 92px; }

/* below a laptop the sidebar folds to a strip; the console is not a phone app */
@media (max-width: 900px) {
  #app.admin { grid-template-columns: 62px minmax(0, 1fr); }
  .adm-brand-name, .adm-brand-sub, .adm-link > span { display: none; }
  .adm-brand { justify-content: center; padding: 8px 0 14px; }
  .adm-link { justify-content: center; padding: 11px 0; }
  #app.admin > .view, #app.admin .app-main > .view { padding: var(--gap); }
}

/* ---------------------------- icons (Phosphor) ---------------------------- */

i.ph, i.ph-fill { line-height: 1; display: inline-flex; align-items: center; justify-content: center; font-style: normal; }
.icon-btn i { font-size: 21px; }
.tab i { font-size: 22px; transition: transform var(--dur-2) var(--spring); }
.tab[aria-current="page"] i { transform: translateY(-2px) scale(1.06); }
.tab:active i { transform: scale(.88); }
.btn i { font-size: 17px; }
.btn-lg i { font-size: 19px; }
.chip i { font-size: 13px; }
.empty i { font-size: 40px; opacity: .45; }
.g-step i.lead-ico { font-size: 20px; color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
.cal-nav i, .cb .box i { font-size: 16px; }
.hero i { font-size: 15px; }
.circ i { font-size: 13px; }
.help-btn.has-new { position: relative; }
.help-btn.has-new::after {
  content: ""; position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: var(--r-pill);
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface);
  animation: dotIn var(--dur-3) var(--spring);
}

/* --------------------- accessibility: reduced motion --------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .tut-hole { transition: none; }
}

/* ==========================================================================
   the web layout - the homepage and the application form only
   The member app is a phone app and stays one: on a desktop it keeps its device
   frame, because that reads as an app rather than as a column stranded in the
   middle of a monitor. The two pages a stranger opens on a computer - the company
   site and the application form - are pages, so past 1000px they run full bleed:
   the measure is held by the content column, and cards that do not depend on each
   other sit two across. app.js puts .web on those pages and nothing else.
   ========================================================================== */
@media (min-width: 1000px) {
  #app.web {
    /* full bleed: a capped shell leaves a seam of a different paper down each
       side, which reads as an unfinished container rather than a page. The
       measure is held by the content column instead. */
    max-width: none;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
  }
  /* header, then the tabs, then the page - the phone order is the other way up */
  #app.web .app-header { order: -1; }
  #app.web > .app-nav { order: 0; }
  #app.web .app-main { order: 1; }
  /* the notch belongs to the frame */
  #app.web::before { display: none; }
  #app.web .app-header {
    padding-top: 0 !important;
    height: var(--header-h) !important;
    padding-left: 24px;
    padding-right: 24px;
  }
  #app.web .app-header .title { font-size: 17px; }

  /* tabs read as navigation up here, not as a thumb bar at the foot */
  #app.web > .app-nav {
    height: auto;
    padding: 0 24px 10px;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    justify-content: center;
    gap: 4px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: 0;
    border-bottom: 1px solid var(--line);
  }
  #app.web > .app-nav .tab {
    flex-direction: row;
    gap: 8px;
    padding: 9px 20px;
    border-radius: var(--r-input);
    font-size: 10px;
    transition: background 180ms ease-out, color 180ms ease-out;
  }
  #app.web > .app-nav .tab i { font-size: 17px; }
  #app.web > .app-nav .tab:hover {
    background: color-mix(in oklab, var(--accent) 8%, transparent);
    color: var(--ink);
  }
  #app.web > .app-nav .tab[aria-current="page"] {
    background: color-mix(in oklab, var(--accent) 13%, transparent);
  }
  #app.web > .app-nav .tab::after { display: none; }

  #app.web .view { padding: 26px 24px 44px; }
  #app.web .view > .stack { width: 100%; max-width: 1000px; margin: 0 auto; }

  /* Cards that stand on their own read fine side by side; a form does not, so
     this is opt-in per screen rather than a rule for every stack. */
  .cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: var(--gap);
  }
  .cols > .hero,
  .cols > .site-hero,
  .cols > .grid-2,
  .cols > .site-menu,
  .cols > .site-lead,
  .cols > .site-orn,
  .cols > .span-2 { grid-column: 1 / -1; }

  /* a long form stays one column: it is read top to bottom, not scanned */
  #app.web .view > .stack.reads { max-width: 760px; }
}
