/* =====================================================================
   PathBuilder Password Vault
   One stylesheet. No framework, no build step, no external request.

   Built on the PathBuilder design system:
     cream #FAFAF7, navy #0A1628, PathBuilder Blue #0636CA,
     green #22C55E, amber #F59E0B, red #EF4444.

   Two rules run through the whole file. Surfaces are WHITE, never tinted
   and never given a coloured accent strip. Numbers are heroes: figures
   that matter are set large, never buried inside prose.
   ===================================================================== */

/* ------------------------------------------------------------ typeface */
/* Inter, self hosted. No external request, so the content security policy
   stays at font-src 'self'. Licensed under the SIL Open Font License,
   copy in fonts/Inter-OFL-LICENSE.txt */

@font-face {
  font-family: 'InterVariable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'InterVariable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-variable-ext.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------------------------------------------------------------- tokens */

:root {
  --cream:      #FAFAF7;
  --surface:    #FFFFFF;
  --navy:       #0A1628;
  --navy-soft:  #16243B;
  --ink:        #0A1628;
  --steel:      #4A5A6E;
  --mute:       #8494A6;
  --line:       #E4E7EC;
  --line-soft:  #EFF1F4;

  --blue:       #0636CA;
  --blue-dark:  #05299B;
  --blue-tint:  #EEF2FE;

  --green:      #16A34A;
  --green-tint: #EAF7EF;
  --amber:      #B4740A;
  --amber-tint: #FDF4E3;
  --red:        #DC2626;
  --red-tint:   #FDEEEE;

  --radius:     10px;
  --radius-sm:  7px;
  --radius-lg:  14px;

  --shadow-sm:  0 1px 2px rgba(10, 22, 40, .05);
  --shadow:     0 1px 3px rgba(10, 22, 40, .07), 0 6px 18px rgba(10, 22, 40, .05);
  --shadow-lg:  0 12px 40px rgba(10, 22, 40, .16);

  --sans: 'InterVariable', -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Text',
          'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, 'JetBrains Mono', Menlo,
          Consolas, 'Liberation Mono', monospace;

  --rail: 236px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: 'cv05' 1, 'cv08' 1, 'ss03' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Figures line up in columns. Non negotiable in a table of counts. */
table, .mono, .stat .n, .countdown, .meter .lab, .codes { font-variant-numeric: tabular-nums; }

h1, h2, h3, h4 { margin: 0 0 .35rem; font-weight: 640; letter-spacing: -.019em; line-height: 1.22; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.0625rem; letter-spacing: -.012em; }
h3 { font-size: .9375rem; }
p  { margin: 0 0 .75rem; }
a  { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

.mono { font-family: var(--mono); font-size: .8125rem; letter-spacing: -.01em; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--navy); color: #fff; padding: .7rem 1.1rem;
  border-radius: 0 0 var(--radius) 0; font-weight: 560;
}
.skip:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ----------------------------------------------------------------- shell */

.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail); flex: 0 0 var(--rail);
  background: var(--navy);
  color: #C3CCD9;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

/* A desktop rail is never collapsible. Even if the script fails to load, the
   sections stay on screen: the summary is inert and the panel is always shown. */
.rail > summary { list-style: none; cursor: default; }
@media (min-width: 901px) {
  .rail > nav, .rail > .rail-foot { display: block !important; }
  .rail > summary { pointer-events: none; }
}
.rail > summary::-webkit-details-marker { display: none; }
.rail .burger,
.rail .here { display: none; }

.rail-brand { padding: 1.35rem 1.1rem 1.15rem; }
.rail-brand .lockup { display: flex; align-items: center; }
.rail-brand .lockup img { width: 26px; height: 26px; display: block; flex: 0 0 26px; }
.rail-brand .lockup .words { margin-left: .6rem; }
.rail-brand strong {
  display: block; color: #fff; font-size: .875rem;
  font-weight: 620; letter-spacing: -.014em; line-height: 1.25;
}
.rail-brand span { display: block; font-size: .75rem; color: #7C8EA6; margin-top: .1rem; }

.rail nav { padding: .35rem .625rem; flex: 1 1 auto; overflow-y: auto; }
.rail nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem .7rem; margin-bottom: 1px;
  color: #C3CCD9; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.rail nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.rail nav a[aria-current] { background: var(--blue); color: #fff; font-weight: 560; }
.rail nav .group-head {
  display: block; padding: 1.1rem .7rem .3rem;
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .09em;
  color: #64778F; font-weight: 620;
}
.rail nav .pill {
  background: rgba(255,255,255,.14); color: #fff;
  border-radius: 20px; padding: .05rem .45rem; font-size: .6875rem; font-weight: 600;
}

.rail-foot { padding: .9rem 1.25rem 1.1rem; border-top: 1px solid rgba(255,255,255,.09); }
.rail-foot .who { color: #fff; font-size: .875rem; font-weight: 560; }
.rail-foot .where { font-size: .75rem; color: #7C8EA6; margin-bottom: .6rem; }
.rail-foot button {
  background: transparent; border: 1px solid rgba(255,255,255,.2);
  color: #C3CCD9; padding: .34rem .7rem; border-radius: var(--radius-sm);
  font: inherit; font-size: .8125rem; cursor: pointer; width: 100%;
  transition: background .12s ease, color .12s ease;
}
.rail-foot button:hover { background: rgba(255,255,255,.1); color: #fff; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.wrap { padding: 1.75rem 2rem 4rem; max-width: 1180px; width: 100%; }

/* --------------------------------------------------------------- lockbar */
/* The one deliberately loud element. It answers the only question that
   matters on a screen full of credentials: can this tab show one right now. */

.lockbar {
  display: flex; align-items: center;
  padding: .6rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: .875rem;
  position: sticky; top: 0; z-index: 30;
}
.lockbar > * + * { margin-left: .7rem; }
.lockbar .dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px;
  background: var(--mute);
}
.lockbar.is-open { background: var(--green-tint); border-bottom-color: #CDEBD9; }
.lockbar.is-open .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.16); }
.lockbar .state { font-weight: 620; letter-spacing: -.01em; }
.lockbar.is-open .state { color: #10693A; }
.lockbar .countdown { font-family: var(--mono); font-size: .8125rem; color: #10693A; font-weight: 500; }
.lockbar .note { color: var(--steel); }
.lockbar .spacer { flex: 1 1 auto; margin-left: 0; }

/* -------------------------------------------------------------- messages */

.flash {
  padding: .7rem .9rem; border-radius: var(--radius);
  margin-bottom: 1rem; border: 1px solid; font-size: .9375rem;
}
.flash.ok    { background: var(--green-tint); border-color: #CDEBD9; color: #10693A; }
.flash.warn  { background: var(--amber-tint); border-color: #F2DFB6; color: #8A5A08; }
.flash.error { background: var(--red-tint);   border-color: #F5CDCD; color: #A61B1B; }

.note { color: var(--steel); font-size: .875rem; }
.lede { color: var(--steel); }

.empty {
  padding: 3rem 1.5rem; text-align: center; color: var(--steel);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.empty strong { display: block; color: var(--ink); font-size: 1rem; margin-bottom: .3rem; }

/* ---------------------------------------------------------------- header */

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; margin-bottom: 1.4rem;
}
.page-head > * { margin-bottom: .5rem; }
.page-head .sub { color: var(--steel); font-size: .9375rem; margin: .15rem 0 0; }
.page-head .actions { display: flex; align-items: center; }
.page-head .actions > * + * { margin-left: .5rem; }

/* ---------------------------------------------------------------- panels */
/* White. Always. No tint, no coloured top strip, no coloured left rule. */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel > header {
  padding: .95rem 1.15rem; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.panel > header > * { margin: 0 .6rem .2rem 0; }
.panel > header > *:last-child { margin-right: 0; }
.panel .body { padding: 1.15rem; }
.panel .body > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 1rem; }
.grid.two   { grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* Numbers are heroes. */
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow-sm);
}
.stat .n {
  font-size: 2.25rem; font-weight: 660; line-height: 1.05;
  letter-spacing: -.035em; color: var(--ink);
}
.stat .k { color: var(--steel); font-size: .8125rem; margin-top: .15rem; }
.stat.is-seal  .n { color: var(--green); }
.stat.is-warn  .n { color: var(--amber); }
.stat.is-alert .n { color: var(--red); }

/* --------------------------------------------------------------- toolbar */

.toolbar {
  display: flex; align-items: flex-end; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: .9rem 1rem;
  margin-bottom: 1.25rem; box-shadow: var(--shadow-sm);
}
.toolbar > * { margin: 0 .6rem .4rem 0; }
.toolbar > *:last-child { margin-right: 0; }
.toolbar .field { margin-bottom: 0; }
.toolbar .field.grow { flex: 1 1 240px; min-width: 180px; }

/* ---------------------------------------------------------------- tables */

.t-scroll { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; font-size: .875rem; }
th {
  text-align: left; padding: .6rem .9rem;
  background: #FCFCFB;
  border-bottom: 1px solid var(--line);
  color: var(--steel); font-weight: 600;
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .07em;
  white-space: nowrap;
}
td { padding: .7rem .9rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s ease; }
tbody tr:hover { background: #FCFCFB; }
td.shrink, th.shrink { width: 1%; white-space: nowrap; }
td.right, th.right { text-align: right; }

.t-title { font-weight: 560; letter-spacing: -.01em; }
.t-title a { color: var(--ink); }
.t-title a:hover { color: var(--blue); }
.t-sub { color: var(--steel); font-size: .8125rem; }

.tree-name { display: flex; align-items: flex-start; }
.tree-name .rule { color: #C6CFDA; font-family: var(--mono); white-space: pre; margin-right: .35rem; }

.tag {
  display: inline-block; padding: .12rem .48rem; border-radius: 20px;
  background: #F1F3F6; color: var(--steel);
  font-size: .75rem; font-weight: 540; white-space: nowrap;
  border: 1px solid var(--line);
}
.tag.seal  { background: var(--green-tint); color: #10693A; border-color: #CDEBD9; }
.tag.warn  { background: var(--amber-tint); color: #8A5A08; border-color: #F2DFB6; }
.tag.alert { background: var(--red-tint);   color: #A61B1B; border-color: #F5CDCD; }

.pager { display: flex; align-items: center; margin-top: 1rem; }
.pager > * { margin-right: .5rem; }
.pager .cur { color: var(--steel); font-size: .875rem; }

.rowlist { list-style: none; margin: 0; padding: 0; }
.rowlist li {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 0; border-bottom: 1px solid var(--line-soft);
}
.rowlist li:last-child { border-bottom: 0; }

/* ----------------------------------------------------------------- forms */

.field { margin-bottom: 1rem; }
.field > label,
label.lbl {
  display: block; font-size: .8125rem; font-weight: 560;
  color: var(--ink); margin-bottom: .3rem; letter-spacing: -.005em;
}
.hint { color: var(--steel); font-size: .8125rem; margin-top: .3rem; }

input[type=text], input[type=password], input[type=email], input[type=search],
input[type=number], input[type=date], input[type=file], select, textarea {
  width: 100%; padding: .55rem .7rem;
  border: 1px solid #D7DCE3; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: .9375rem;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:hover, select:hover, textarea:hover { border-color: #C2C9D3; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(6, 54, 202, .13);
}
input:disabled, select:disabled, textarea:disabled { background: #F5F6F8; color: var(--mute); }
input::placeholder, textarea::placeholder { color: #9BA7B5; }
textarea { min-height: 6rem; resize: vertical; line-height: 1.55; }

/* The default control arrow is the single thing that dates an interface
   fastest, so the chevron is drawn here instead. */
select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%234A5A6E' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
}

.inline { display: flex; align-items: center; flex-wrap: wrap; }
.inline > * { margin: 0 .5rem .35rem 0; }
.inline > *:last-child { margin-right: 0; }

.check {
  display: flex; align-items: flex-start; font-size: .9375rem;
  margin-bottom: .45rem; padding: .5rem .65rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .12s ease;
}
.check:hover { border-color: #C2C9D3; }
.check > * + * { margin-left: .55rem; }
.check input { margin-top: .28rem; flex: 0 0 auto; accent-color: var(--blue); }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .5rem .9rem;
  border: 1px solid var(--blue); border-radius: var(--radius-sm);
  background: var(--blue); color: #fff;
  font: inherit; font-size: .875rem; font-weight: 560; letter-spacing: -.005em;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn.ghost {
  background: var(--surface); color: var(--ink); border-color: #D7DCE3;
}
.btn.ghost:hover { background: #F7F8FA; border-color: #C2C9D3; color: var(--ink); }

.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: #B91C1C; border-color: #B91C1C; }

.btn.small { padding: .3rem .6rem; font-size: .8125rem; }

/* --------------------------------------------------------------- secrets */

.secret {
  display: flex; align-items: center;
  font-family: var(--mono); font-size: .875rem;
  background: #FAFBFC; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .3rem .35rem .3rem .6rem;
  word-break: break-all;
}
.secret > * + * { margin-left: .35rem; }
.secret .val { flex: 1 1 auto; min-width: 0; }
/* A real password may be long and must wrap. The masked placeholder must not,
   or it breaks into two ragged lines of dots. */
.secret .val.hidden { letter-spacing: .16em; color: var(--mute); white-space: nowrap; }

.meter { display: inline-flex; align-items: center; }
.meter > * + * { margin-left: .45rem; }
.meter .bar {
  display: inline-block; width: 62px; height: 5px;
  background: #E7EAEE; border-radius: 20px; overflow: hidden;
}
.meter .bar i { display: block; height: 100%; background: var(--green); border-radius: 20px; transition: width .2s ease; }
.meter .lab { font-size: .75rem; color: var(--steel); white-space: nowrap; }
.meter.w2 .bar i { background: var(--red); }
.meter.w3 .bar i { background: var(--amber); }

.kv { display: grid; grid-template-columns: 190px 1fr; gap: .7rem 1.25rem; align-items: start; }
.kv dt { color: var(--steel); font-size: .875rem; }
.kv dd { margin: 0; word-break: break-word; }

.codes {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .45rem; margin-bottom: 1rem;
}
.codes span {
  font-family: var(--mono); font-size: .875rem; text-align: center;
  background: #FAFBFC; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .45rem .3rem;
}

/* ------------------------------------------------------------- bare page */

.bare {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem; background: var(--navy);
  background-image:
    radial-gradient(900px 460px at 12% -8%, rgba(6,54,202,.42), transparent 62%),
    radial-gradient(700px 420px at 105% 108%, rgba(6,54,202,.20), transparent 60%);
}
.bare-mark-top { text-align: center; margin-bottom: 1.15rem; }
.bare-mark-top img { width: 42px; height: 42px; }
.bare-mark-top strong {
  display: block; color: #fff; font-size: 1rem; font-weight: 620;
  letter-spacing: -.015em; margin-top: .5rem;
}
.bare-mark-top span { display: block; color: #8B9CB2; font-size: .8125rem; }
.bare-card {
  width: 100%; background: var(--surface);
  border-radius: var(--radius-lg); padding: 1.85rem;
  box-shadow: var(--shadow-lg);
}
.bare-card h1 { font-size: 1.25rem; }
.bare-card .lede { font-size: .9375rem; margin-bottom: 1.35rem; }
.bare-card .btn { width: 100%; }
.bare-mark { text-align: center; color: #7C8EA6; font-size: .8125rem; margin-top: 1.1rem; }

/* --------------------------------------------------------------- dialogs */

dialog {
  border: 0; border-radius: var(--radius-lg); padding: 0;
  box-shadow: var(--shadow-lg); max-width: 420px; width: calc(100% - 2rem);
  color: var(--ink);
}
dialog::backdrop { background: rgba(10, 22, 40, .55); }
dialog .body { padding: 1.5rem; }
dialog h2 { font-size: 1.0625rem; margin-bottom: .3rem; }

/* --------------------------------------------------------------- details */

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .shell { display: block; }

  /* The rail collapses to a single bar. Tapping it opens the sections as a
     full width list, one per row, at a size a thumb can actually hit. */
  .rail {
    width: auto; flex: none; height: auto; position: sticky; top: 0; z-index: 40;
    display: block;
  }
  .rail > summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: .85rem 1rem; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .rail-brand .lockup { min-width: 0; }
  .rail-brand strong { font-size: .9375rem; }
  .rail .here {
    display: block; color: #7C8EA6; font-size: .8125rem; margin-top: .05rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

  .rail .burger { display: block; flex: 0 0 22px; width: 22px; }
  .rail .burger i {
    display: block; height: 2px; background: #C3CCD9; border-radius: 2px;
    margin: 4px 0; transition: transform .15s ease, opacity .15s ease;
  }
  .rail[open] .burger i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .rail[open] .burger i:nth-child(2) { opacity: 0; }
  .rail[open] .burger i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .rail nav {
    display: block; padding: .25rem .6rem .6rem;
    border-top: 1px solid rgba(255,255,255,.09);
    max-height: 65vh; overflow-y: auto;
  }
  .rail nav a {
    display: flex; padding: .8rem .7rem; margin: 0 0 2px;
    font-size: .9375rem; border-radius: var(--radius-sm);
  }
  .rail nav .group-head { display: block; padding: .9rem .7rem .25rem; }

  .rail-foot {
    display: flex; align-items: center; justify-content: space-between;
    padding: .8rem 1rem; border-top: 1px solid rgba(255,255,255,.09);
  }
  .rail-foot .where { margin-bottom: 0; }
  .rail-foot form { flex: 0 0 auto; }
  .rail-foot button { width: auto; }
  .rail:not([open]) .rail-foot { display: none; }

  .wrap { padding: 1.1rem 1rem 3rem; }

  .lockbar { padding: .6rem 1rem; flex-wrap: wrap; top: 0; }
  .lockbar .note { display: none; }

  .page-head { display: block; }
  .page-head h1 { font-size: 1.35rem; }
  .page-head .actions { margin-top: .6rem; }

  /* A phone cannot show five columns, so each row stacks into a card and the
     column headings are dropped rather than squeezed. */
  .panel .t-scroll { overflow-x: visible; }
  .panel table, .panel tbody, .panel tr, .panel td { display: block; width: 100%; }
  .panel thead { display: none; }
  .panel tr {
    padding: .85rem 1rem; border-bottom: 1px solid var(--line-soft);
  }
  .panel tr:last-child { border-bottom: 0; }
  .panel td {
    padding: .18rem 0; border: 0;
  }
  .panel td[data-label]::before {
    content: attr(data-label);
    display: block; font-size: .6875rem; text-transform: uppercase;
    letter-spacing: .07em; color: var(--mute); font-weight: 600;
    margin-bottom: .1rem;
  }
  .panel td.shrink, .panel th.shrink { width: auto; white-space: normal; }
  .panel td.right { text-align: left; }
  .panel td:empty { display: none; }
  .secret { margin: .35rem 0; }

  .toolbar { display: block; }
  .toolbar > * { margin: 0 0 .7rem; width: 100%; }
  .toolbar .btn { width: 100%; }

  .kv { grid-template-columns: 1fr; gap: .15rem 0; }
  .kv dt { font-size: .8125rem; }
  .kv dd { margin-bottom: .8rem; }

  .grid.two, .grid.three { grid-template-columns: 1fr; }

  .stat { padding: .9rem 1rem; }
  .stat .n { font-size: 1.85rem; }

  .btn { padding: .55rem .9rem; }
  .btn.small { padding: .4rem .7rem; }
}

@media (max-width: 560px) {
  .bare { padding: 1rem .8rem; }
  .bare-card { padding: 1.35rem 1.1rem; }
  .codes { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media print {
  .rail, .lockbar, .btn, .toolbar { display: none !important; }
  body { background: #fff; }
  .secret .val { color: transparent !important; }
}

/* --------------------------------------------------- registration checklist */
/* Nothing here is a security control. It exists so somebody filling in the
   form for the first time can see what is still wrong while they can fix it. */

.rules { list-style: none; margin: .25rem 0 0; padding: 0; }
.rules .rule {
  display: flex; align-items: flex-start;
  font-size: .8125rem; line-height: 1.45;
  color: var(--steel); margin-bottom: .3rem;
}
.rules .mark {
  flex: 0 0 16px; width: 16px; height: 16px; margin: .1rem .5rem 0 0;
  border-radius: 50%; border: 1.5px solid #D7DCE3; position: relative;
}
.rules .rule.is-ok { color: #10693A; }
.rules .rule.is-ok .mark { background: var(--green); border-color: var(--green); }
.rules .rule.is-ok .mark::after {
  content: ''; position: absolute; left: 4.5px; top: 1.5px;
  width: 4px; height: 8px; border: solid #fff;
  border-width: 0 1.7px 1.7px 0; transform: rotate(45deg);
}
.btn:disabled { background: #AFB8C4; border-color: #AFB8C4; }
.btn.ghost:disabled { background: var(--surface); color: var(--mute); }

/* ------------------------------------------------- group pickers */
/* Tick boxes for choosing groups. With many groups this becomes a scrolling
   column rather than a page that will not end. */
.pickers {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .35rem; max-height: 320px; overflow-y: auto;
  padding: .1rem; margin-bottom: .3rem;
}
.pickers .check { margin-bottom: 0; }
.pickers .check.is-locked { background: #FAFBFC; color: var(--steel); }
.picker-tools { display: flex; align-items: center; margin-bottom: .5rem; }
.picker-tools > * { margin-right: .5rem; }
.picker-tools input[type=search] { max-width: 260px; }

/* ------------------------------------------------------- tree pickers */
/* A flat list of tick boxes hides the shape of the organisation. Indentation
   plus a connecting rule shows which group sits under which, so choosing is a
   matter of reading the tree rather than remembering it. */

.treepick {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .4rem; background: var(--surface);
  max-height: 380px; overflow-y: auto;
}
.treepick .check {
  border: 0; border-radius: var(--radius-sm);
  margin-bottom: 1px; padding: .5rem .6rem;
  position: relative; background: transparent;
}
.treepick .check:hover { background: #F5F7FA; }
.treepick .check.is-locked { background: var(--blue-tint); color: var(--ink); }

/* One step of indentation per level, with a rule marking the branch. */
.treepick .tp-1 { margin-left: 1.25rem; }
.treepick .tp-2 { margin-left: 2.5rem; }
.treepick .tp-3 { margin-left: 3.75rem; }
.treepick .tp-4 { margin-left: 5rem; }
.treepick .tp-5 { margin-left: 6.25rem; }
.treepick .tp-6 { margin-left: 7.5rem; }
.treepick .check[data-depth]:not([data-depth="0"])::before {
  content: ''; position: absolute; left: -.7rem; top: 0; bottom: 0;
  border-left: 1px solid var(--line);
}
.treepick .check[data-depth="0"] { font-weight: 560; }

.pick-head {
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--mute); font-weight: 620; padding: .6rem .2rem .25rem;
  grid-column: 1 / -1;
}

/* The Organisation table uses the same indentation as the pickers. */
.tree-name { position: relative; }
.tree-name.tp-1 { padding-left: 1.25rem; }
.tree-name.tp-2 { padding-left: 2.5rem; }
.tree-name.tp-3 { padding-left: 3.75rem; }
.tree-name.tp-4 { padding-left: 5rem; }
.tree-name.tp-5 { padding-left: 6.25rem; }
.tree-name[data-depth]::before {
  content: ''; position: absolute; top: -.2rem; bottom: -.2rem;
  left: calc(1.25rem * (var(--d, 1)) - .85rem);
  border-left: 1px solid var(--line);
}
.tree-name.tp-1::before { --d: 1; }
.tree-name.tp-2::before { --d: 2; }
.tree-name.tp-3::before { --d: 3; }
.tree-name.tp-4::before { --d: 4; }
.tree-name.tp-5::before { --d: 5; }
