:root {
  --paper: #f5f3ee;
  --paper-2: #ebe8e0;
  --card: #ffffff;
  --ink: #131c33;
  --ink-2: #3a4459;
  --muted: #6b7385;
  --line: #d9d5cb;
  --line-2: #e6e2d9;
  --navy: #1c2f6e;
  --navy-ink: #ffffff;
  --red: #c4122f;
  --g1: #1c2f6e;
  --g1-soft: #e3e8f4;
  --g2: #b3122c;
  --g2-soft: #f6e2e5;
  --focus: #2f5bd3;
  --shadow: 0 1px 0 rgba(19, 28, 51, .04), 0 8px 24px -12px rgba(19, 28, 51, .18);
  --radius: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --display: "Noto Kufi Arabic", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1424;
    --paper-2: #151b2e;
    --card: #182036;
    --ink: #eef0f6;
    --ink-2: #c4c9d6;
    --muted: #8f97aa;
    --line: #2a3350;
    --line-2: #222a43;
    --navy: #2c4596;
    --g1: #8ea6f0;
    --g1-soft: #1d2848;
    --g2: #f08a99;
    --g2-soft: #3a1c26;
    --focus: #8ea6f0;
    --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 12px 28px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.mono { font-family: var(--mono); letter-spacing: .02em; direction: ltr; unicode-bidi: isolate; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar::before {
  /* the three rules from the institute logo */
  content: ""; display: block; height: 7px;
  background:
    linear-gradient(var(--navy) 0 0) top / 100% 3px no-repeat,
    linear-gradient(var(--red) 0 0) bottom / 100% 2px no-repeat;
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.wordmark { display: block; height: 26px; width: auto; aspect-ratio: 3802 / 721; color: var(--ink); flex: none; }
.brand .wordmark { padding-inline-end: 14px; border-inline-end: 1px solid var(--line); height: 40px; padding-block: 7px; box-sizing: border-box; }
.brand-text { display: grid; line-height: 1.25; }
.brand-text strong { font: 700 16px/1.3 var(--display); white-space: nowrap; }
.brand-text small { font-size: 12.5px; color: var(--muted); }
.brand-text small::before { content: ""; display: inline-block; width: 14px; height: 2px; background: var(--red); vertical-align: middle; margin-inline-end: 6px; }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; padding: 6px 12px; border-radius: 8px; font-size: 14.5px; color: var(--ink-2); }
.nav a:hover { background: var(--paper-2); color: var(--ink); }

/* ---------- hero ---------- */
.hero { padding: 56px 0 48px; border-bottom: 1px solid var(--line); }
.hero-in > * { max-width: 760px; }
.eyebrow { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
h1 {
  margin: 0 0 14px;
  font: 800 clamp(30px, 6vw, 50px)/1.3 var(--display);
  letter-spacing: -.01em;
}
.lede { margin: 0 0 28px; font-size: 17.5px; color: var(--ink-2); max-width: 58ch; }

.searchbox {
  position: relative; display: flex; align-items: center;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  transition: box-shadow .15s, transform .15s;
}
.searchbox:focus-within { box-shadow: 2px 2px 0 var(--ink); transform: translate(2px, 2px); }
.searchbox .ico { position: absolute; inset-inline-start: 18px; width: 22px; height: 22px; color: var(--muted); pointer-events: none; }
.searchbox input {
  width: 100%; border: 0; background: transparent; outline: none;
  padding: 18px 54px 18px 52px;
  font-size: 19px; font-weight: 500;
}
.searchbox input::placeholder { color: var(--muted); font-weight: 400; }
.searchbox input::-webkit-search-cancel-button { display: none; }
.kbd {
  position: absolute; inset-inline-end: 16px;
  font: 600 12px/1 var(--mono); color: var(--muted);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 5px 8px;
}
.searchbox:focus-within .kbd { display: none; }
.hint { margin: 14px 2px 0; font-size: 14px; color: var(--muted); }
.chip-ex {
  border: 1px dashed var(--line); background: transparent; border-radius: 6px;
  padding: 1px 8px; cursor: pointer; color: var(--ink-2); font-size: 13.5px;
}
.chip-ex:hover { border-style: solid; color: var(--ink); }

/* results */
.results { margin-top: 14px; }
.results:empty { display: none; }
.res-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.res-item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center;
  padding: 12px 16px; cursor: pointer; border-top: 1px solid var(--line-2);
}
.res-item:first-child { border-top: 0; }
.res-item:hover, .res-item[aria-selected="true"] { background: var(--paper); }
.res-name { font-weight: 600; }
.res-name mark { background: transparent; color: inherit; text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.res-sub { grid-column: 1; font-size: 13.5px; color: var(--muted); }
.res-sub .mono { color: var(--ink-2); }
.res-meta { font-size: 13px; color: var(--muted); padding: 10px 2px 0; }
.empty {
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 18px 20px; color: var(--ink-2);
}
.empty b { display: block; color: var(--ink); margin-bottom: 2px; }

/* group pill */
.gpill {
  grid-row: 1 / span 2; grid-column: 2;
  font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 999px; white-space: nowrap;
}
.gpill.g1, .tbl .gpill.g1 { background: var(--g1-soft); color: var(--g1); }
.gpill.g2, .tbl .gpill.g2 { background: var(--g2-soft); color: var(--g2); }

/* ---------- id card ---------- */
#card-slot:empty { display: none; }
#card-slot { margin-top: 18px; }
.idcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.idcard-top {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--navy); color: var(--navy-ink);
  border-bottom: 3px solid var(--red);
}
.idcard-top .wm-card { color: #fff; height: 18px; }
.idcard-top div { display: grid; line-height: 1.35; flex: 1; min-width: 0; }
.idcard-top b { font-size: 14px; }
.idcard-top small { font-size: 12px; opacity: .8; }
.x { border: 0; background: transparent; color: inherit; padding: 6px; border-radius: 8px; cursor: pointer; opacity: .8; display: grid; }
.x:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.x svg { width: 20px; height: 20px; }
.idcard-body { display: grid; grid-template-columns: 1fr 170px; }
.idcard-info { padding: 20px 22px; min-width: 0; }
.idcard-info h3 { margin: 0 0 14px; font: 700 22px/1.45 var(--display); }
.idcard dl { margin: 0; display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 8px 28px; }
.idcard dt { font-size: 12.5px; color: var(--muted); }
.idcard dd { margin: 0; font-weight: 600; font-size: 15.5px; }
.idcard dd.mono { font-size: 17px; }
.idcard-group {
  display: grid; place-content: center; text-align: center; gap: 2px;
  border-inline-start: 1.5px dashed var(--line);
  padding: 16px;
}
.idcard-group span { font-size: 13px; color: var(--muted); }
.idcard-group b { font: 800 72px/1 var(--display); }
.idcard-group em { font-style: normal; font-weight: 700; font-size: 15px; }
.idcard.g1 .idcard-group { background: var(--g1-soft); color: var(--g1); }
.idcard.g2 .idcard-group { background: var(--g2-soft); color: var(--g2); }
.idcard.g1 .idcard-group span, .idcard.g2 .idcard-group span { color: inherit; opacity: .75; }
.idcard-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--line-2); background: var(--paper); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card);
  font-weight: 600; font-size: 14.5px; text-decoration: none; line-height: 1.3;
}
.btn:hover { border-color: var(--ink-2); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--red)); }
.idcard.g1 .btn.primary { background: var(--g1); border-color: var(--g1); color: #fff; }
.idcard.g2 .btn.primary { background: var(--g2); border-color: var(--g2); color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .idcard.g1 .btn.primary,
  :root:not([data-theme="light"]) .idcard.g2 .btn.primary { color: #0f1424; }
}
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: 13.5px; }
.btn[aria-pressed="true"] { background: var(--paper-2); }

/* saved strip */
.saved {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 18px; padding: 12px 14px 12px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  border-inline-start: 5px solid var(--g1);
}
.saved.g2 { border-inline-start-color: var(--g2); }
.saved-txt { flex: 1; min-width: 180px; line-height: 1.5; }
.saved-txt small { display: block; color: var(--muted); font-size: 13px; }
.saved-txt b { font-size: 15.5px; }
.saved .btn.primary { background: var(--g1); border-color: var(--g1); color: #fff; }
.saved.g2 .btn.primary { background: var(--g2); border-color: var(--g2); }
.link-btn { border: 0; background: none; padding: 4px; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- groups ---------- */
section { padding: 56px 0; }
.sec-head { margin-bottom: 22px; }
.sec-head h2, .help h2 { margin: 0 0 4px; font: 700 24px/1.4 var(--display); }
.sec-head p { margin: 0; color: var(--ink-2); }
.group-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.group-tile {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; gap: 0 18px;
  padding: 22px; text-decoration: none; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  transition: border-color .15s, transform .15s;
}
.group-tile:hover { transform: translateY(-2px); }
.group-tile.g1:hover { border-color: var(--g1); }
.group-tile.g2:hover { border-color: var(--g2); }
.g-num { grid-row: 1 / span 2; font: 800 84px/1 var(--display); width: 76px; text-align: center; }
.g1 .g-num { color: var(--g1); } .g2 .g-num { color: var(--g2); }
.g-body { display: grid; align-content: start; }
.g-title { font: 700 19px/1.4 var(--display); }
.g-url { font: 500 14px var(--mono); color: var(--ink-2); justify-self: start; }
.g-count { margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.g-go { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; font-weight: 600; font-size: 14.5px; }
.g1 .g-go { color: var(--g1); } .g2 .g-go { color: var(--g2); }
.g-go svg { width: 16px; height: 16px; transition: transform .15s; }
.group-tile:hover .g-go svg { transform: translateX(-3px); }

.dist-title { margin: 34px 0 12px; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.dist { display: grid; gap: 10px; }
.dist-row { display: grid; grid-template-columns: 110px 1fr 64px; align-items: center; gap: 12px; font-size: 14px; }
.dist-row > span:first-child { color: var(--ink-2); }
.dist-row > span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; text-align: end; }
.bar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: var(--paper-2); gap: 2px; }
.bar i { display: block; height: 100%; }
.bar i.g1 { background: var(--g1); } .bar i.g2 { background: var(--g2); }
.dist-legend { display: flex; gap: 18px; font-size: 13px; color: var(--muted); }
.dist-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 6px; vertical-align: -1px; }
.dist-legend .l1::before { background: var(--g1); } .dist-legend .l2::before { background: var(--g2); }

/* ---------- browse ---------- */
.browse { background: var(--paper-2); border-block: 1px solid var(--line); }
.tabs { position: relative; display: inline-flex; padding: 4px; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 18px; }
.tabs button { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; transition: color .25s; border: 0; background: transparent; padding: 7px 14px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--paper); }
.tab-ind { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 7px; background: var(--ink); transition: transform .35s var(--spring), width .35s var(--spring); }
.lock-ico { width: 15px; height: 15px; transition: transform .3s var(--spring), opacity .3s; }
.tabs button.unlocked .lock-ico { opacity: .45; transform: rotate(-12deg); }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.6fr); gap: 10px; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field select, .field input, .field textarea {
  width: 100%; padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--card); font-size: 15px;
}
.field textarea { font-family: var(--mono); resize: vertical; line-height: 1.6; }
.field select:focus, .field input:focus, .field textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.list-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 2px 10px; font-size: 14px; color: var(--ink-2); min-height: 32px; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: start; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; }
.tbl td { padding: 9px 14px; border-top: 1px solid var(--line-2); white-space: nowrap; }
.tbl tbody tr:first-child td { border-top: 0; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--paper); }
.tbl td.c-n { color: var(--muted); font-variant-numeric: tabular-nums; width: 1%; }
.tbl td.name { white-space: normal; font-weight: 500; min-width: 220px; }
.tbl .gpill { display: inline-block; font-size: 12.5px; padding: 2px 10px; }
.tbl .miss td { color: var(--muted); }
.more { display: flex; justify-content: center; margin-top: 14px; }

/* ---------- help ---------- */
.help-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; align-items: start; }
.help h2 { margin-bottom: 14px; }
details { border-bottom: 1px solid var(--line); }
details:first-of-type { border-top: 1px solid var(--line); }
summary { cursor: pointer; list-style: none; padding: 14px 2px; font-weight: 600; display: flex; justify-content: space-between; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font: 400 22px/1 var(--mono); color: var(--muted); }
details[open] summary::after { content: "−"; }
details p { margin: 0 2px 16px; color: var(--ink-2); }
.support { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.support h3 { margin: 0 0 4px; font: 700 17px/1.4 var(--display); }
.support p { margin: 0 0 12px; font-size: 14px; color: var(--ink-2); }
.support-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-2); text-decoration: none; font-size: 14px; }
.support-line span { color: var(--muted); }
.support-line b { font: 500 14px var(--mono); }
.support-line:hover b { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding: 26px 0 34px; font-size: 13.5px; color: var(--muted); }
.foot-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.foot-brand { display: flex; align-items: center; gap: 12px; }
.foot-brand .wm-foot { height: 22px; }
.foot-brand p, .foot-note { margin: 0; line-height: 1.6; }
.foot-brand p { color: var(--ink-2); }
.foot-brand b { color: var(--ink); }

/* toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 10px; font-size: 14.5px; font-weight: 500;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .grow { grid-column: 1 / -1; }
  .help-grid { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 640px) {
  .nav { display: none; }
  .brand { gap: 10px; }
  .brand .wordmark { height: 34px; padding-inline-end: 10px; }
  .brand-text strong { font-size: 15px; }
  .idcard-top .wm-card { display: none; }
  .hero { padding: 36px 0 34px; }
  .lede { font-size: 16px; }
  .searchbox input { font-size: 17px; padding: 16px 48px 16px 16px; }
  .kbd { display: none; }
  section { padding: 40px 0; }
  .group-grid { grid-template-columns: 1fr; }
  .g-num { font-size: 64px; width: 56px; }
  .idcard-body { grid-template-columns: 1fr; }
  .idcard-group { grid-template-columns: auto auto 1fr; align-items: baseline; text-align: start; gap: 10px; border-inline-start: 0; border-top: 1.5px dashed var(--line); padding: 12px 22px; place-content: stretch; }
  .idcard-group b { font-size: 40px; }
  .idcard dl { grid-template-columns: auto auto; }
  .idcard-actions .btn { flex: 1 1 auto; justify-content: center; }
  .idcard-actions .btn.primary { flex-basis: 100%; }
  .dist-row { grid-template-columns: 78px 1fr 48px; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl tr { display: grid; grid-template-columns: auto auto 1fr auto; gap: 2px 10px; padding: 10px 14px; border-top: 1px solid var(--line-2); }
  .tbl tbody tr:first-child { border-top: 0; }
  .tbl td { padding: 0; border: 0; white-space: normal; }
  .tbl td.c-n { display: none; }
  .tbl td.name { grid-column: 1 / 4; grid-row: 1; min-width: 0; }
  .tbl td.c-code, .tbl td.c-year, .tbl td.c-dept { grid-row: 2; font-size: 13px; color: var(--muted); }
  .tbl td.c-code { grid-column: 1; } .tbl td.c-year { grid-column: 2; } .tbl td.c-dept { grid-column: 3; }
  .tbl td.c-group { grid-column: 4; grid-row: 1 / span 2; align-self: center; }
  .tbl td.c-miss { grid-column: 2 / 5; grid-row: 1; }
}


/* ============ search busy + notes ============ */
.spin {
  position: absolute; inset-inline-end: 18px; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--ink);
  opacity: 0; transform: scale(.6); transition: opacity .2s, transform .2s;
}
.searchbox.busy .spin { opacity: 1; transform: scale(1); animation: spin .7s linear infinite; }
.searchbox.busy .kbd { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.res-note { margin: 0; padding: 4px 2px; font-size: 14.5px; color: var(--ink-2); animation: fade-up .3s var(--ease); }
.res-note::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--red); margin-inline-end: 8px; vertical-align: 2px; }

/* ============ lock (reps only) ============ */
.lock {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px;
  max-width: 620px;
}
.lock-big { grid-row: 1 / span 3; width: 40px; height: 40px; color: var(--g1); stroke-width: 1.6; padding: 8px; box-sizing: content-box; background: var(--g1-soft); border-radius: 12px; }
.lock-txt b { font: 700 17px/1.5 var(--display); }
.lock-txt p { margin: 2px 0 6px; color: var(--ink-2); font-size: 14.5px; }
.lock-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lock-row input { flex: 1 1 180px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--paper); font-size: 15px; }
.lock-row input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.lock-err { grid-column: 2; margin: 0; min-height: 1.4em; color: var(--g2); font-size: 14px; font-weight: 600; }
.lock.shake { animation: shake .42s var(--ease); }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
.meta-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.btn.loading { pointer-events: none; opacity: .75; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; }

/* ============ motion ============ */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.5); } 100% { opacity: 1; transform: none; } }
@keyframes wipe { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0); } }
@keyframes slide-down { from { opacity: 0; transform: translateY(-8px); } }

/* page load */
.enter { animation: fade-up .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms + 60ms); }
.topbar { animation: fade-in .5s var(--ease) both; }

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.group-grid.reveal .group-tile { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease), border-color .15s; }
.group-grid.reveal .group-tile.g2 { transition-delay: .1s; }
.group-grid.reveal.in .group-tile { opacity: 1; transform: none; }
.group-grid.reveal.in .group-tile:hover { transform: translateY(-3px); transition-delay: 0s; }
.dist.reveal .bar { transform: scaleX(0); transform-origin: right; transition: transform .9s var(--ease); }
.dist.reveal .dist-row:nth-child(2) .bar { transition-delay: .08s; }
.dist.reveal .dist-row:nth-child(3) .bar { transition-delay: .16s; }
.dist.reveal .dist-row:nth-child(4) .bar { transition-delay: .24s; }
.dist.reveal.in .bar { transform: none; }

/* nav underline */
.nav a { position: relative; }
.nav a::after { content: ""; position: absolute; inset-inline: 12px; bottom: 3px; height: 2px; background: var(--red); transform: scaleX(0); transition: transform .25s var(--ease); }
.nav a:hover::after { transform: scaleX(1); }

/* results */
.res-list { animation: fade-in .2s var(--ease); }
.res-item { animation: fade-up .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms); transition: background-color .15s; }
.res-item .res-name { transition: transform .2s var(--ease); }
.res-item:hover .res-name { transform: translateX(-3px); }
.empty { animation: fade-up .3s var(--ease); }

/* id card */
.idcard { animation: rise .45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.idcard-top > * { animation: fade-in .4s var(--ease) both .1s; }
.idcard-info h3 { animation: fade-up .45s var(--ease) both .12s; }
.idcard dl > div { animation: fade-up .45s var(--ease) both; }
.idcard dl > div:nth-child(1) { animation-delay: .18s; }
.idcard dl > div:nth-child(2) { animation-delay: .23s; }
.idcard dl > div:nth-child(3) { animation-delay: .28s; }
.idcard-group b { display: inline-block; animation: pop .6s var(--spring) both .22s; }
.idcard-group em, .idcard-group span { animation: fade-in .4s var(--ease) both .35s; }
.idcard-actions .btn { animation: fade-up .4s var(--ease) both; }
.idcard-actions .btn:nth-child(1) { animation-delay: .3s; }
.idcard-actions .btn:nth-child(2) { animation-delay: .35s; }
.idcard-actions .btn:nth-child(3) { animation-delay: .4s; }
.idcard-actions .btn:nth-child(4) { animation-delay: .45s; }
.check { width: 16px; height: 16px; stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .4s var(--ease) forwards .05s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; }

/* buttons */
.btn { position: relative; overflow: hidden; transition: transform .15s var(--ease), background-color .2s, border-color .2s, box-shadow .2s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn svg { transition: transform .2s var(--ease); }
.btn:hover svg { transform: translateX(-3px); }
.btn.primary:hover { box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--ink) 70%, transparent); }
.group-tile { overflow: hidden; }
.ripple {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: currentColor; opacity: .18; pointer-events: none;
  animation: ripple .6s var(--ease) forwards;
}
@keyframes ripple { to { transform: scale(40); opacity: 0; } }

/* saved strip */
.saved:not([hidden]) { animation: slide-down .45s var(--spring); }
.saved.out { animation: slide-down .22s var(--ease) reverse forwards; }

/* tabs + panels */
.panel:not([hidden]) { animation: fade-up .35s var(--ease); }
#list-body:not([hidden]) { animation: fade-up .4s var(--ease); }
.tbl tbody tr { animation: fade-in .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 18ms); }

/* faq */
details { interpolate-size: allow-keywords; }
details::details-content { block-size: 0; overflow: hidden; transition: block-size .3s var(--ease), content-visibility .3s allow-discrete; }
details[open]::details-content { block-size: auto; }
summary::after { transition: transform .3s var(--ease); }
details[open] summary::after { content: "+"; transform: rotate(45deg); }
summary:hover { color: var(--g1); }

/* toast */
.toast { transition: opacity .25s var(--ease), transform .35s var(--spring); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .reveal, .group-grid.reveal .group-tile { opacity: 1; transform: none; }
  .dist.reveal .bar { transform: none; }
}
@media (max-width: 640px) {
  .lock { grid-template-columns: 1fr; padding: 18px; }
  .lock-big { grid-row: auto; }
  .lock-err { grid-column: 1; }
  .lock-row .btn { flex: 1 1 100%; justify-content: center; }
}
