/* Softlight Auth UI v1.0 — neumorphic sign-in (adapted for the NGT QA Portal) */
/* ==========================================================================
   Tokens
   --sx / --sy : direction shadows are cast (written by the light engine)
   --beta      : light bearing in degrees (0 = top, clockwise)
   --depth     : 0 → flat, 1 → fully extruded (animated on load)
   ========================================================================== */
@property --depth { syntax: "<number>"; inherits: true; initial-value: 1; }

:root {
  color-scheme: light;
  --bg: #e4e8ee;
  --text: #262e3d;
  --muted: #586376;
  --faint: #8792a4;
  --sh: rgba(136, 150, 175, .6);
  --hl: rgba(255, 255, 255, .95);
  --rim-hi: rgba(255, 255, 255, .75);
  --rim-lo: rgba(110, 125, 150, .16);
  --line: rgba(126, 140, 164, .42);
  --engrave: rgba(255, 255, 255, .85);
  --accent: #f3a03a;
  --accent-ink: #9a4a00;
  --on-accent: #2a1806;
  --accent-glow: rgba(243, 160, 58, .5);
  --accent-rim-hi: rgba(255, 236, 205, .9);
  --accent-rim-lo: rgba(150, 78, 4, .3);
  --accent-press-sh: rgba(160, 84, 6, .45);
  --accent-press-hl: rgba(255, 222, 170, .7);
  --ring: #9a4a00;
  --danger: #b3261e;
  --success: #1d7a4c;
  --lvl-1: #d93f3f;
  --lvl-2: #e8892a;
  --lvl-3: #c4a822;
  --lvl-4: #2a9d63;
  --glow: rgba(255, 250, 242, .55);
  --spec: rgba(255, 255, 255, .75);
  --vignette: rgba(70, 84, 110, .09);
  --grain: .05;

  --sx: 1;
  --sy: 1;
  --beta: 315;
  --depth: 1;
  --shadow-t: .3s;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.45, .64, 1);
  --f-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --f-ui: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #24272d;
  --text: #e8ebf0;
  --muted: #a3abb8;
  --faint: #78818f;
  --sh: rgba(6, 7, 10, .62);
  --hl: rgba(255, 255, 255, .06);
  --rim-hi: rgba(255, 255, 255, .07);
  --rim-lo: rgba(0, 0, 0, .3);
  --line: rgba(0, 0, 0, .5);
  --engrave: rgba(255, 255, 255, .06);
  --accent: #ffad47;
  --accent-ink: #ffb65c;
  --on-accent: #231303;
  --accent-glow: rgba(255, 160, 60, .42);
  --accent-rim-hi: rgba(255, 230, 190, .75);
  --accent-rim-lo: rgba(120, 58, 0, .45);
  --accent-press-sh: rgba(120, 58, 0, .6);
  --accent-press-hl: rgba(255, 214, 160, .5);
  --ring: #ffb65c;
  --danger: #ff8a80;
  --success: #6fd9a0;
  --lvl-1: #ff6b6b;
  --lvl-2: #ff9f43;
  --lvl-3: #e8cf4a;
  --lvl-4: #4fd18b;
  --glow: rgba(255, 150, 60, .1);
  --spec: rgba(255, 255, 255, .08);
  --vignette: rgba(0, 0, 0, .38);
  --grain: .06;
}

/* While the light is moving, shadows follow it 1:1 (no transition lag). */
:root.light-live { --shadow-t: 0s; }

/* ==========================================================================
   Neumorphic surface engine
   Raised and pressed lists keep the same slot types (outer, outer, inset,
   inset) so the browser can morph smoothly between them.
   ========================================================================== */
.nm {
  --d: 6px;
  --ox: calc(var(--d) * var(--sx) * var(--depth));
  --oy: calc(var(--d) * var(--sy) * var(--depth));
  --bl: calc(var(--d) * 2.2 * var(--depth));
  --rx: calc(var(--sx) * var(--depth) * 1px);
  --ry: calc(var(--sy) * var(--depth) * 1px);
  --raise:
    var(--ox) var(--oy) var(--bl) var(--sh),
    calc(var(--ox) * -1) calc(var(--oy) * -1) var(--bl) var(--hl),
    inset var(--rx) var(--ry) calc(var(--depth) * 1.5px) var(--rim-hi),
    inset calc(var(--rx) * -1) calc(var(--ry) * -1) calc(var(--depth) * 2px) var(--rim-lo);
  --press:
    0 0 0 transparent,
    0 0 0 transparent,
    inset var(--ox) var(--oy) var(--bl) var(--sh),
    inset calc(var(--ox) * -1) calc(var(--oy) * -1) var(--bl) var(--hl);
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 22px;
  padding: clamp(16px, 3.5vw, 40px);
  font: 400 15px/1.55 var(--f-ui);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Ambient light pool + vignette — the pool sits where the light is. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle 70vmax at calc(50% - var(--sx) * 36%) calc(50% - var(--sy) * 36%), var(--glow), transparent 62%),
    radial-gradient(140% 120% at 50% 42%, transparent 52%, var(--vignette));
}

/* Fine material grain. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }

button { touch-action: manipulation; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic {
  display: block;
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Debossed micro-type: highlight sits on the side away from the light. */
.label, .switch-label, .dial-cap, .divider, .caps, .rules, .strength-label, .page-foot {
  text-shadow: calc(var(--sx) * 1px) calc(var(--sy) * 1px) 0 var(--engrave);
}

/* ==========================================================================
   Shell
   ========================================================================== */
.shell {
  --d: 18px;
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "brand auth" "inst auth";
  border-radius: 40px;
  background: var(--bg);
  box-shadow: var(--raise);
  animation: extrude 1.3s var(--ease) both;
}

@keyframes extrude {
  from { --depth: 0; transform: translateY(6px); }
  to   { --depth: 1; transform: none; }
}

/* Brand bar */
.brandbar {
  grid-area: brand;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 36px 44px 0;
}

.brand { display: inline-flex; align-items: center; gap: 14px; min-width: 0; }

.logo {
  --d: 4px;
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--raise);
}

.logo-core {
  --d: 2.5px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: var(--press);
}

.logo-core::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px 1px var(--accent-glow);
}

.wordmark { font: 500 23px/1 var(--f-display); letter-spacing: -.02em; white-space: nowrap; }
.wordmark em { font-style: italic; color: var(--accent-ink); }

/* Switch (theme / follow cursor) */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: -4px;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.switch-track {
  --d: 3px;
  position: relative;
  flex: none;
  width: 56px;
  height: 30px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: var(--press);
}

.switch-track::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--faint);
  opacity: .4;
  transition: background-color .3s, box-shadow .3s, opacity .3s;
}

.switch-thumb {
  --d: 3px;
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  box-shadow: var(--raise);
  transition: transform .5s var(--spring), color .3s, box-shadow var(--shadow-t) var(--ease);
}

.switch-thumb .ic { width: 12px; height: 12px; stroke-width: 2; }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(26px); color: var(--accent-ink); }
.switch[aria-checked="true"] .switch-track::before { background: var(--accent); opacity: 1; box-shadow: 0 0 8px 1px var(--accent-glow); }
.switch-theme .i-moon,
.switch-theme[aria-checked="true"] .i-sun { display: none; }
.switch-theme[aria-checked="true"] .i-moon { display: block; }

.switch-label {
  font: 500 10.5px/1.2 var(--f-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ==========================================================================
   Instrument (light dial)
   ========================================================================== */
.instrument {
  grid-area: inst;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 28px 44px 44px;
  text-align: center;
}

.dial {
  --dial: 248px;
  position: relative;
  flex: none;
  width: var(--dial);
  height: var(--dial);
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.dial.is-dragging { cursor: grabbing; }
.dial:focus-visible { outline-offset: 6px; }

.dial-ticks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(calc(var(--sx) * 1px) calc(var(--sy) * 1px) 0 var(--engrave));
}

.dial-ticks line { stroke: var(--faint); stroke-width: 1.5; stroke-linecap: round; }
.dial-ticks line.major { stroke: var(--muted); stroke-width: 2.2; }

.dial-groove {
  --d: 6px;
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--press);
}

.dial-trail {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from calc((var(--beta) - 60) * 1deg), transparent, var(--accent-glow) 60deg, transparent 120deg);
  -webkit-mask: radial-gradient(closest-side, transparent 69%, #000 72%, #000 96%, transparent 99%);
  mask: radial-gradient(closest-side, transparent 69%, #000 72%, #000 96%, transparent 99%);
}

.dial-knob {
  --d: 9px;
  position: absolute;
  inset: 21%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 50%;
  background-color: var(--bg);
  background-image: radial-gradient(circle at calc(50% - var(--sx) * 24%) calc(50% - var(--sy) * 24%), var(--spec), transparent 65%);
  box-shadow: var(--raise);
  pointer-events: none;
}

.dial-cap,
.dial-dir {
  font: 500 max(9px, calc(var(--dial) * .038))/1 var(--f-mono);
  letter-spacing: .2em;
  text-transform: uppercase;
  padding-left: .2em;
}

.dial-cap { color: var(--muted); }
.dial-dir { color: var(--accent-ink); }

.dial-deg {
  font: 500 calc(var(--dial) * .118)/1 var(--f-mono);
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.dial-arm {
  position: absolute;
  inset: 0;
  transform: rotate(calc(var(--beta) * 1deg));
  pointer-events: none;
}

.dial-sun {
  position: absolute;
  left: 50%;
  top: 15%;
  width: 6.4%;
  height: 6.4%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 38% 35%, #fff7e8 0 18%, var(--accent) 62%);
  box-shadow: 0 0 10px 2px var(--accent-glow), 0 0 28px 8px var(--accent-glow);
}

.dial-notch {
  position: absolute;
  left: 50%;
  top: 24.5%;
  width: 1.3%;
  height: 4.6%;
  border-radius: 999px;
  transform: translateX(-50%);
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.caption { display: grid; justify-items: center; gap: 12px; max-width: 34ch; }
.caption-title { margin: 0; font: 450 25px/1.15 var(--f-display); letter-spacing: -.02em; }
.caption-title em { font-style: italic; color: var(--accent-ink); }
.caption-text { margin: 0; font-size: 14px; color: var(--muted); }
.caption .switch { margin-top: 6px; }

/* ==========================================================================
   Auth panel
   ========================================================================== */
.auth {
  grid-area: auth;
  position: relative;
  min-width: 0;
  padding: 44px 56px 40px;
}

/* Engraved divider between the two halves. */
.auth::before {
  content: "";
  position: absolute;
  left: 0;
  top: 44px;
  bottom: 44px;
  width: 1px;
  background: var(--line);
  box-shadow: calc(var(--sx) * 1px) 0 0 var(--engrave);
}

/* Bleed keeps neumorphic shadows unclipped while the height morphs. */
.stage {
  --bleed: 24px;
  margin: calc(var(--bleed) * -1);
  padding: var(--bleed);
}

.stage.is-morphing { overflow: hidden; }

/* Tabs */
.tabs {
  --d: 4px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 30px;
  padding: 6px;
  border-radius: 20px;
  background: var(--bg);
  box-shadow: var(--press);
}

.tabs-thumb {
  --d: 4px;
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: calc(50% - 6px);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--raise);
  transition: transform .55s var(--spring), box-shadow var(--shadow-t) var(--ease);
}

.tabs[data-active="signup"] .tabs-thumb { transform: translateX(100%); }

.tab {
  position: relative;
  z-index: 1;
  height: 46px;
  padding: 0 8px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--muted);
  font: 600 14.5px/1 var(--f-ui);
  cursor: pointer;
  transition: color .3s;
  -webkit-tap-highlight-color: transparent;
}

.tab:hover, .tab[aria-selected="true"] { color: var(--text); }
.tab:focus-visible { outline-offset: -3px; }

/* Views */
.stack { display: flex; flex-direction: column; gap: 20px; }

.view:not([hidden]) .stack > * {
  animation: rise .6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}

@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.view-head { display: grid; gap: 8px; margin-bottom: 4px; }
.view-head.center { justify-items: center; text-align: center; }

.title {
  margin: 0;
  font: 450 clamp(30px, 3.4vw, 40px)/1.06 var(--f-display);
  letter-spacing: -.028em;
}

.title em { font-style: italic; color: var(--accent-ink); padding-right: .04em; }

.sub { margin: 0; font-size: 15px; color: var(--muted); }
.sub strong { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }

/* Fields */
.field { display: flex; flex-direction: column; min-width: 0; }

.label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  font: 500 10.5px/1.2 var(--f-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
  opacity: .5;
  transition: background-color .3s, box-shadow .3s, opacity .3s;
}

.field:focus-within .label::before { background: var(--accent); opacity: 1; box-shadow: 0 0 6px 1px var(--accent-glow); }
.field.is-valid .label::before { background: var(--success); opacity: 1; box-shadow: none; }
.field.is-invalid .label::before { background: var(--danger); opacity: 1; box-shadow: none; }

.control {
  --d: 4.5px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 8px 0 18px;
  border-radius: 17px;
  background: var(--bg);
  box-shadow: var(--press);
  outline: 2px solid transparent;
  outline-offset: 3px;
  transition: box-shadow var(--shadow-t) var(--ease), outline-color .2s;
}

.control:focus-within { --d: 5.5px; outline-color: var(--ring); }
.field.is-invalid .control { outline-color: var(--danger); }

.control > .ic { color: var(--faint); transition: color .25s; }
.control:focus-within > .ic:first-child { color: var(--accent-ink); }

.control input {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 500 16px/1.2 var(--f-ui);
  caret-color: var(--accent-ink);
  outline: none;
}

.control input::placeholder { color: var(--faint); opacity: 1; font-weight: 400; }
.control input[type="password"]:not(:placeholder-shown) { letter-spacing: .12em; }
.control input:focus-visible { outline: none; }

/* Keep autofill from painting over the neumorphic well. */
.control input:-webkit-autofill,
.control input:-webkit-autofill:hover,
.control input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--accent-ink);
  transition: background-color 600000s 0s, color 600000s 0s;
}
.control input:autofill { filter: none; }

.control > .ic-ok {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  color: var(--success);
  opacity: 0;
  transform: scale(.5);
  transition: opacity .25s, transform .35s var(--spring);
}

.field.is-valid .control > .ic-ok { opacity: 1; transform: none; }

/* Show / hide password */
.peek {
  --d: 2.5px;
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 13px;
  background: var(--bg);
  color: var(--muted);
  box-shadow: var(--raise);
  cursor: pointer;
  transition: box-shadow var(--shadow-t) var(--ease), color .2s;
  -webkit-tap-highlight-color: transparent;
}

.peek:hover { color: var(--text); }
.peek[aria-pressed="true"] { box-shadow: var(--press); color: var(--accent-ink); }
.peek .ic { width: 18px; height: 18px; }
.peek .i-eye-off,
.peek[aria-pressed="true"] .i-eye { display: none; }
.peek[aria-pressed="true"] .i-eye-off { display: block; }

/* Messages collapse to zero height when empty. */
.msg-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); }
.field.is-invalid .msg-wrap { grid-template-rows: 1fr; }
.msg-in { min-height: 0; overflow: hidden; }
.msg { margin: 0; padding-top: 9px; font-size: 13px; font-weight: 500; color: var(--danger); }

.caps {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 0;
  font: 500 10.5px/1.2 var(--f-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.caps .ic { width: 14px; height: 14px; }

/* Password strength */
.strength { display: flex; align-items: center; gap: 14px; margin-top: 14px; }

.meter {
  --d: 2px;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  padding: 4px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: var(--press);
}

.meter i { height: 5px; border-radius: 999px; transition: background-color .3s, box-shadow .3s; }
.meter[data-score="1"] { --meter: var(--lvl-1); }
.meter[data-score="2"] { --meter: var(--lvl-2); }
.meter[data-score="3"] { --meter: var(--lvl-3); }
.meter[data-score="4"] { --meter: var(--lvl-4); }
.meter i.on { background: var(--meter); box-shadow: 0 0 8px -1px var(--meter); }

.strength-label {
  min-width: 13ch;
  font: 500 10.5px/1.2 var(--f-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
}

.rules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font: 500 10.5px/1.2 var(--f-mono);
  letter-spacing: .04em;
  color: var(--muted);
}

.rules li { display: inline-flex; align-items: center; gap: 7px; transition: color .25s; }

.rules li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  opacity: .5;
  transition: background-color .25s, box-shadow .25s, opacity .25s;
}

.rules li.ok { color: var(--text); }
.rules li.ok::before { background: var(--success); opacity: 1; box-shadow: 0 0 6px var(--success); }

/* Row + checkbox */
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }

.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  --d: 3px;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--bg);
  box-shadow: var(--press);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: box-shadow var(--shadow-t) var(--ease);
}

.check input::before {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--accent-ink);
  clip-path: polygon(4% 62%, 38% 96%, 98% 28%, 84% 14%, 38% 68%, 18% 48%);
  transform: scale(0);
  transition: transform .35s var(--spring);
}

.check input:checked::before { transform: scale(1); }
.field.is-invalid .check input { outline: 2px solid var(--danger); outline-offset: 3px; }

.link {
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.link:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.row .link { font-size: 14px; }

/* Buttons */
.btn {
  --d: 6px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  padding: 0 24px;
  border: 0;
  border-radius: 17px;
  background: var(--bg);
  color: var(--text);
  font: 600 15px/1 var(--f-ui);
  letter-spacing: .01em;
  box-shadow: var(--raise);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow var(--shadow-t) var(--ease), transform .2s var(--ease), color .2s, background-color .3s;
}

.btn:hover { --d: 7px; }
.btn:active, .btn.is-busy { --d: 5px; box-shadow: var(--press); transform: scale(.992); }
.btn .ic { width: 19px; height: 19px; transition: transform .3s var(--ease), opacity .2s; }
.btn-label { transition: opacity .2s; }

.btn-primary {
  width: 100%;
  margin-top: 4px;
  --rim-hi: var(--accent-rim-hi);
  --rim-lo: var(--accent-rim-lo);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--raise), calc(var(--sx) * 6px) calc(var(--sy) * 10px) 28px -12px var(--accent-glow);
}

.btn-primary:hover .btn-ic { transform: translateX(4px); }

.btn-primary:active,
.btn-primary.is-busy {
  --sh: var(--accent-press-sh);
  --hl: var(--accent-press-hl);
  box-shadow: var(--press), 0 0 0 0 transparent;
}

.btn-soft { color: var(--muted); }
.btn-soft:hover { color: var(--text); }
.btn[aria-disabled="true"]:not(.is-busy) { --d: 3px; color: var(--faint); cursor: not-allowed; }
.w-full { width: 100%; }

.spinner {
  position: absolute;
  inset: 0;
  width: 22px;
  height: 22px;
  margin: auto;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.btn.is-busy { cursor: progress; }
.btn.is-busy .spinner { opacity: 1; animation: spin .75s linear infinite; }
.btn.is-busy .btn-label, .btn.is-busy .ic { opacity: 0; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Form-level alert */
.alert {
  --d: 3px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 15px;
  background: var(--bg);
  box-shadow: var(--press);
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.alert .ic { width: 18px; height: 18px; margin-top: 1px; }

/* Back link */
.back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  font: 600 14px/1 var(--f-ui);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.back:hover { color: var(--text); }

.back-ic {
  --d: 3px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--raise);
  transition: box-shadow var(--shadow-t) var(--ease);
}

.back:active .back-ic { box-shadow: var(--press); }
.back .ic { width: 18px; height: 18px; }

/* Success view */
.seal {
  --d: 8px;
  width: 104px;
  height: 104px;
  margin: 6px auto 4px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--raise);
}

.seal-core {
  --d: 4px;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: var(--press);
  color: var(--accent-ink);
}

.seal-core .ic {
  width: 30px;
  height: 30px;
  stroke-width: 2.4;
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.view:not([hidden]) .seal-core .ic { animation: draw .7s .45s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.progress {
  --d: 2.5px;
  height: 14px;
  padding: 4px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: var(--press);
}

.progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.view:not([hidden]) .progress i { animation: fill 2.4s .5s var(--ease) forwards; }
@keyframes fill { to { width: 100%; } }

.note { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.note code { font: 500 12px/1 var(--f-mono); color: var(--text); }

/* Social + footer */
.social { margin-top: 28px; }

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 20px;
  font: 500 10px/1 var(--f-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
  box-shadow: 0 calc(var(--sy) * 1px) 0 var(--engrave);
}

.social-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.social-row .btn { height: 52px; padding: 0 10px; font-size: 14px; }
.brand-ic { width: 18px; height: 18px; flex: none; fill: currentColor; }

.auth-foot { margin: 24px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.auth[data-view="signin"] [data-when="signup"],
.auth[data-view="signup"] [data-when="signin"] { display: none; }

/* Page footer + toast */
.page-foot {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0;
  text-align: center;
  font: 400 10.5px/1.8 var(--f-mono);
  letter-spacing: .04em;
  color: var(--muted);
}

.page-foot code { font: inherit; font-weight: 500; color: var(--text); }

.toast {
  --d: 6px;
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 14px 20px 14px 16px;
  border-radius: 18px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--raise);
  opacity: 0;
  transform: translate(-50%, calc(100% + 40px));
  transition: transform .55s var(--spring), opacity .3s, box-shadow var(--shadow-t) var(--ease);
  pointer-events: none;
}

.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.toast .led {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px 1px var(--accent-glow);
}

.toast[data-tone="error"] .led { background: var(--danger); box-shadow: 0 0 8px 1px var(--danger); }
.toast[data-tone="success"] .led { background: var(--success); box-shadow: 0 0 8px 1px var(--success); }

/* Smooth theme switch ("lamp" on / off). */
.theme-anim,
.theme-anim *:not(input),
.theme-anim *::before,
.theme-anim *::after {
  transition:
    background-color .6s var(--ease),
    color .6s var(--ease),
    box-shadow .6s var(--ease),
    outline-color .6s,
    fill .6s,
    stroke .6s,
    opacity .3s,
    transform .5s var(--spring) !important;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (min-width: 960px) and (max-height: 840px) {
  .dial { --dial: 212px; }
  .brandbar { padding-top: 30px; }
  .instrument { gap: 22px; padding-bottom: 32px; }
  .auth { padding-top: 34px; padding-bottom: 30px; }
  .tabs { margin-bottom: 24px; }
  .stack { gap: 16px; }
  .control, .btn { height: 52px; }
  .social { margin-top: 22px; }
  .auth-foot { margin-top: 18px; }
}

@media (max-width: 959.98px) {
  .shell {
    width: min(560px, 100%);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "brand" "auth" "inst";
    border-radius: 34px;
  }

  .brandbar { padding: 28px 32px 0; }
  .auth { padding: 30px 32px 34px; }
  .auth::before { display: none; }

  .instrument {
    position: relative;
    flex-direction: row;
    gap: 26px;
    padding: 30px 32px 34px;
    text-align: left;
  }

  .instrument::before {
    content: "";
    position: absolute;
    top: 0;
    left: 32px;
    right: 32px;
    height: 1px;
    background: var(--line);
    box-shadow: 0 calc(var(--sy) * 1px) 0 var(--engrave);
  }

  .dial { --dial: 168px; }
  .caption { justify-items: start; }
  .caption-title { font-size: 22px; }
}

@media (max-width: 519.98px) {
  .shell { --d: 12px; border-radius: 30px; }
  .brandbar { padding: 22px 22px 0; }
  .auth { padding: 24px 22px 28px; }
  .stage { --bleed: 18px; }
  .instrument { flex-direction: column; padding: 28px 22px 30px; text-align: center; }
  .instrument::before { left: 22px; right: 22px; }
  .caption { justify-items: center; }
  .dial { --dial: 196px; }
  .social-row { gap: 10px; }
  .tab { font-size: 13.5px; }
}

@media (max-width: 419.98px) {
  .switch-theme .switch-label,
  .social-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
}

@media (max-width: 359.98px) {
  .brandbar { padding: 20px 18px 0; }
  .auth { padding: 22px 16px 24px; }
  .stage { --bleed: 14px; }
  .instrument { padding: 26px 16px 28px; }
  .instrument::before { left: 16px; right: 16px; }
}

/* ==========================================================================
   Accessibility preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }

  .btn.is-busy .spinner {
    animation-duration: 1.2s !important;
    animation-iteration-count: infinite !important;
  }
}

@media (forced-colors: active) {
  .shell, .control, .tabs, .btn, .alert, .toast, .switch-track, .switch-thumb,
  .progress, .peek, .back-ic, .dial-groove, .dial-knob, .check input, .seal { border: 1px solid CanvasText; }
  .tabs-thumb { forced-color-adjust: none; background: Highlight; }
  .tab[aria-selected="true"] { forced-color-adjust: none; color: HighlightText; }
  .dial-sun, .dial-notch, .logo-core::after { forced-color-adjust: none; background: Highlight; }
}

/* ── NGT additions ── */
.wordmark small{display:block;font-family:var(--f-ui);font-size:.62rem;letter-spacing:.14em;text-transform:uppercase;color:var(--faint);margin-top:2px}
.hint-admin{font-size:.8rem;color:var(--muted)}
.page-foot code{font-family:var(--f-mono)}

/* ── phones: brand block clears the theme switch, nothing runs wide ── */
@media (max-width: 519.98px) {
  html, body { overflow-x: clip; }
  .wordmark { min-width: 0; padding-right: 3.75rem; line-height: 1.15; }
  .wordmark small { white-space: normal; letter-spacing: .1em; font-size: .56rem; }
  .field input { font-size: 16px; }
}
