/* iBCare Company Dashboard — application shell.
   Two stacked sticky bars: identity on top, the menu below it. The menu is
   ALWAYS visible; there is no sidebar to collapse or lose. */

body { background: var(--canvas); }

.i { width: 17px; height: 17px; flex: none; }

/* ============================================================
   Bar 1 — identity and account
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 16px;
  height: 58px; padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brand-400), var(--brand-700));
  color: #fff; font-weight: 800; font-size: 13.5px; letter-spacing: .2px;
}
.brand-text { display: flex; align-items: baseline; gap: 10px; }
.brand-text strong { font-size: 16.5px; font-weight: 730; letter-spacing: -.015em; }
.brand-text span {
  font-size: 10.5px; font-weight: 600; letter-spacing: .13em;
  text-transform: uppercase; color: var(--muted);
}

.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; transition: background .14s, color .14s, border-color .14s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--brand-300); }

/* Only one of the two theme glyphs is ever shown. Driven by the root theme
   state so it is correct on first paint, with no JS flicker. */
.icon-btn .sun { display: none; }
:root[data-theme="dark"] .icon-btn .moon { display: none; }
:root[data-theme="dark"] .icon-btn .sun  { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .moon { display: none; }
  :root:not([data-theme="light"]) .icon-btn .sun  { display: block; }
}

.who { display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; color: #fff;
  background: linear-gradient(145deg, var(--brand-400), var(--brand-700));
}
.who-text { display: flex; flex-direction: column; line-height: 1.25; }
.who-text strong { font-size: 13.5px; font-weight: 640; }
.who-role {
  font-size: 11px; font-weight: 620; letter-spacing: .02em;
  color: var(--role-accent, var(--brand));
}

/* ============================================================
   Bar 2 — the menu
   ============================================================ */
.mainnav {
  position: sticky; top: 58px; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(16,26,25,.02);
}

.nav-list {
  display: flex; align-items: center; gap: 2px;
  margin: 0; padding: 0; list-style: none;
  /* NOT `overflow-x: auto`. An overflow ancestor establishes a clipping
     context that cuts off absolutely-positioned descendants, and the dropdowns
     simply never appeared. There is nothing to scroll anyway: the widest role
     shows five groups, and below 860px the burger menu takes over. */
  overflow: visible;
  flex-wrap: nowrap;
}

.nav-item { position: relative; }

.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 0 13px; height: 46px;
  font: inherit; font-size: 14px; font-weight: 570;
  color: var(--ink-2); text-decoration: none; white-space: nowrap;
  background: transparent; border: 0; cursor: pointer;
  /* The active underline sits ON the bar's own border, so switching pages
     never shifts anything by a pixel. */
  border-bottom: 2px solid transparent;
  transition: color .14s, border-color .14s, background .14s;
}
.nav-link:hover { color: var(--ink); background: var(--surface-2); }
.nav-link.active { color: var(--brand); border-bottom-color: var(--brand); }
.nav-link .caret { width: 14px; height: 14px; opacity: .55; transition: transform .16s; }
.nav-item.open .nav-link .caret { transform: rotate(180deg); }
.nav-item.open > .nav-link { color: var(--ink); background: var(--surface-2); }

.dropdown {
  position: absolute; top: calc(100% + 1px); left: 0; z-index: 70;
  min-width: 256px; padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: none;
}
.nav-item.open .dropdown { display: block; }

.drop-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none;
}
.drop-item .di { margin-top: 2px; color: var(--muted); }
.drop-item .dt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.drop-item .dt strong { font-size: 13.6px; font-weight: 620; }
.drop-item .dt small { font-size: 11.8px; color: var(--muted); }
a.drop-item:hover { background: var(--brand-050); }
a.drop-item:hover .di { color: var(--brand); }

/* A planned page. Dimmed and unclickable, with the reason stated, rather than
   a link that 404s. */
.drop-item.is-soon { cursor: default; opacity: .58; }
.drop-item.is-soon .soon {
  margin-left: auto; align-self: center;
  padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-style: normal; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); background: var(--line-soft);
}

.nav-burger { display: none; }

/* ============================================================
   Page
   ============================================================ */
.page { max-width: 1320px; margin: 0 auto; padding: 26px 20px 70px; }

.page-head {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head .ph-text { min-width: 0; }
.page-head h1 { margin: 0 0 4px; font-size: 1.65rem; font-weight: 730; letter-spacing: -.025em; }
.page-head .sub { margin: 0; color: var(--muted); font-size: 14px; }
.page-head .ph-actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px;
  font: inherit; font-size: 14px; font-weight: 620;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { color: #fff; background: linear-gradient(180deg, var(--brand-600), var(--brand-700)); box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { color: var(--ink-2); background: var(--surface); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }

.stat {
  position: relative; overflow: hidden;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
/* The coloured cap is the only thing distinguishing the four tiles, so it is a
   real element rather than a border — borders get clipped by the radius. */
.stat::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--tone, var(--brand));
}
.stat .st-ico {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; margin-bottom: 13px;
  color: var(--tone, var(--brand));
  background: color-mix(in srgb, var(--tone, var(--brand)) 13%, transparent);
}
.stat .st-ico .i { width: 19px; height: 19px; }
.stat .v { font-size: 2.05rem; font-weight: 750; letter-spacing: -.035em; line-height: 1; }
.stat .k { margin-top: 5px; font-size: 13px; color: var(--muted); font-weight: 540; }

.tone-brand  { --tone: var(--brand); }
.tone-indigo { --tone: var(--role-indigo); }
.tone-green  { --tone: var(--ok); }
.tone-amber  { --tone: var(--warn); }
.tone-rose   { --tone: var(--role-rose); }

/* ---------- toolbar (search + count) ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.search { position: relative; flex: 1; display: flex; align-items: center; }
.search .i { position: absolute; left: 14px; color: var(--muted); }
.search input {
  width: 100%; padding: 12px 14px 12px 41px;
  font: inherit; font-size: 14.5px; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-050);
}
.count-chip {
  padding: 10px 15px; border-radius: 999px;
  font-size: 13px; font-weight: 620; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); white-space: nowrap;
}

/* ---------- sections ---------- */
.section { margin-top: 30px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.section-head .i { color: var(--tone, var(--brand)); width: 19px; height: 19px; }
.section-head h2 { margin: 0; font-size: 1.06rem; font-weight: 690; letter-spacing: -.012em; }
.section-head .n {
  padding: 1px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  color: var(--tone, var(--brand));
  background: color-mix(in srgb, var(--tone, var(--brand)) 13%, transparent);
}
.section > .sd { margin: 0 0 15px; color: var(--muted); font-size: 13.4px; }

/* ---------- person cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(276px, 1fr)); gap: 15px; }

.pcard {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .16s, border-color .16s, transform .16s;
}
.pcard:hover { box-shadow: var(--shadow-md); border-color: var(--brand-300); transform: translateY(-1px); }

.pcard-top {
  padding: 20px 18px 16px; text-align: center;
  background: linear-gradient(180deg, var(--brand-050), transparent);
  border-bottom: 1px solid var(--line-soft);
}
.pcard .pavatar {
  width: 62px; height: 62px; margin: 0 auto 11px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 730; color: #fff;
  background: linear-gradient(145deg, var(--brand-400), var(--brand-700));
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm);
}
.pcard h3 { margin: 0 0 3px; font-size: 15px; font-weight: 680; letter-spacing: -.012em; }
.pcard .prole { margin: 0; font-size: 12.8px; color: var(--muted); line-height: 1.45; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.tag {
  padding: 3px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .045em; text-transform: uppercase;
  color: var(--tone, var(--brand));
  background: color-mix(in srgb, var(--tone, var(--brand)) 13%, transparent);
}

.pcard-body { padding: 14px 16px; display: grid; gap: 9px; }
.frow { display: flex; align-items: center; gap: 9px; font-size: 12.9px; color: var(--ink-2); min-width: 0; }
.frow .i { width: 15px; height: 15px; color: var(--muted); }
.frow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pcard-foot {
  margin-top: auto; padding: 11px 16px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600;
}
.pcard-foot .i { width: 15px; height: 15px; }
.pcard-foot.ok   { color: var(--ok); }
.pcard-foot.warn { color: var(--warn); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 680px; }
table.data th, table.data td { padding: 11px 15px; text-align: left; border-bottom: 1px solid var(--line-soft); }
table.data th {
  font-size: 11px; font-weight: 660; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
.mono { font-family: var(--mono); font-size: 12.3px; color: var(--muted); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; }
.pill-ok   { color: var(--ok);     background: var(--ok-bg); }
.pill-bad  { color: var(--danger); background: var(--danger-bg); }
.pill-warn { color: var(--warn);   background: var(--warn-bg); }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.empty .i { width: 30px; height: 30px; opacity: .4; margin-bottom: 9px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
}
.card h3 { margin: 0 0 5px; font-size: 14.5px; font-weight: 660; }
.card p  { margin: 0; color: var(--muted); font-size: 13.3px; line-height: 1.5; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

/* ---------- error page ---------- */
.errpage { min-height: 70vh; display: grid; place-items: center; padding: 24px; }
.errcard { max-width: 27rem; text-align: center; }
.errcard .code { font-size: 3.4rem; font-weight: 780; letter-spacing: -.04em; color: var(--brand); line-height: 1; }
.errcard h1 { margin: 10px 0 8px; font-size: 1.3rem; font-weight: 700; }
.errcard p { margin: 0 0 20px; color: var(--muted); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .topbar { padding: 0 14px; gap: 10px; }
  /* The name goes first: the avatar still identifies the account and the role
     still says which desk you are at. */
  .who-text { display: none; }
  .brand-text span { display: none; }

  .mainnav { padding: 0 14px; }
  .nav-burger {
    display: grid; gap: 4px; place-content: center;
    width: 38px; height: 44px; padding: 0;
    background: transparent; border: 0; cursor: pointer;
  }
  .nav-burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink-2); }

  /* Off the flow entirely when closed, so it cannot be tabbed into while
     invisible. */
  .nav-list {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px; overflow: visible;
    background: var(--surface); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    display: none;
  }
  .mainnav.open .nav-list { display: flex; }
  .nav-link { height: 44px; width: 100%; border-bottom: 0; border-radius: 9px; }
  .nav-link.active { background: var(--brand-050); }
  .nav-link .caret { margin-left: auto; }
  .dropdown {
    position: static; display: none; min-width: 0;
    margin: 2px 0 6px 26px; box-shadow: none;
    border-color: var(--line-soft); background: var(--surface-2);
  }
  .nav-item.open .dropdown { display: block; }
}

@media (max-width: 620px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat .v { font-size: 1.6rem; }
  .stat .st-ico { width: 32px; height: 32px; margin-bottom: 9px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .page { padding: 20px 14px 56px; }
  .page-head h1 { font-size: 1.35rem; }
  /* Sharing one row leaves the search box too narrow to read what you typed.
     Search takes a full row; the count sits above it, where it also acts as
     the result readout while filtering. */
  .toolbar { flex-wrap: wrap; gap: 9px; }
  .count-chip { order: -1; }
  .search { flex: 1 1 100%; }
  .page-head .ph-actions { margin-left: 0; width: 100%; }
  .page-head .ph-actions .btn { flex: 1; justify-content: center; }
}

/* ============================================================
   Pages copied from the live vault
   ============================================================ */

/* A real photograph rather than initials. Same 62px circle, so a mixed grid
   (22 of 38 have a photo) stays on one baseline. */
.pavatar-img { object-fit: cover; display: block; }

/* `.pcard` is display:flex, and an AUTHOR rule beats the UA stylesheet's
   `[hidden]{display:none}` no matter the specificity — so the search filter
   silently did nothing to the cards without this. */
.pcard[hidden] { display: none !important; }

/* The completeness line can run long ("4/7 · missing photo, address, DBS"),
   so it wraps instead of pushing the card wider. */
.pcard-foot .fs { line-height: 1.35; }

.readonly-note {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 34px 0 0; padding: 13px 15px;
  font-size: 13px; line-height: 1.55; color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.readonly-note .i { margin-top: 2px; color: var(--brand); }
.readonly-note strong { color: var(--ink-2); }

/* Overview tiles — a stat you can click through to the page behind it. */
.tile {
  display: flex; flex-direction: column; gap: 2px;
  padding: 18px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: box-shadow .16s, border-color .16s, transform .16s;
}
.tile:hover { box-shadow: var(--shadow-md); border-color: var(--brand-300); transform: translateY(-1px); }
.tile-ico {
  width: 38px; height: 38px; border-radius: 11px; margin-bottom: 11px;
  display: grid; place-items: center;
  color: var(--tone, var(--brand));
  background: color-mix(in srgb, var(--tone, var(--brand)) 13%, transparent);
}
.tile-ico .i { width: 19px; height: 19px; }
.tile-v { font-size: 1.85rem; font-weight: 750; letter-spacing: -.035em; line-height: 1.05; }
.tile-v small { font-size: 1rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.tile-k { font-size: 14px; font-weight: 640; }
.tile-s { font-size: 12.6px; color: var(--muted); line-height: 1.45; }

/* ============================================================
   Staff cards — the register's own card, larger than .pcard
   ============================================================
   A bigger photograph is the point: this page is how the office recognises
   people, and a 62px avatar is a thumbnail, not a face. 104px matches what the
   original vault used. The curved wash behind the photo is an elliptical
   bottom radius on a real element rather than a border, because a border gets
   clipped by the card's own corner radius. */

.scards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(304px, 1fr));
  gap: 18px;
}

.scard {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .18s, border-color .18s, transform .18s;
}
.scard:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-300);
  transform: translateY(-2px);
}
/* `.scard` is display:flex, and an author rule beats the UA stylesheet's
   [hidden]{display:none} regardless of specificity — without this the search
   filter silently does nothing. */
.scard[hidden] { display: none !important; }

.scard-top { position: relative; padding: 26px 20px 20px; text-align: center; }

/* The curve. A shallow ellipse on the bottom two corners only. */
.scard-wash {
  position: absolute; inset: 0 0 auto 0; height: 104px;
  /* Symmetric on purpose. An angled gradient here reads as a smudge in one
     corner rather than as a curved band under the photo. */
  background: linear-gradient(180deg, var(--brand-100) 0%, var(--brand-050) 62%, transparent 100%);
  border-radius: 0 0 50% 50% / 0 0 30px 30px;
  pointer-events: none;
}

.scard-photo {
  position: relative;
  width: 104px; height: 104px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brand-400), var(--brand-700));
  color: #fff; font-size: 31px; font-weight: 730; letter-spacing: .5px;
  /* A ring in the surface colour lifts the photo off the wash without a
     hard outline. */
  box-shadow: 0 0 0 5px var(--surface), 0 6px 18px rgba(16,26,25,.14);
  overflow: hidden;
}
.scard-photo img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: 50%;
}

.scard h3 {
  position: relative;
  margin: 0 0 5px; font-size: 16.5px; font-weight: 700;
  letter-spacing: -.015em; line-height: 1.3;
}

/* Roles as chips rather than one run-on line — a staff member works three or
   four, and comma-separated text reads as a sentence. */
.scard-roles {
  position: relative;
  display: flex; flex-wrap: wrap; gap: 5px; justify-content: center;
  margin-bottom: 10px;
}
.rchip {
  padding: 3px 9px; border-radius: 8px;
  font-size: 11.5px; font-weight: 580; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
}

.scard .tags { position: relative; margin-top: 0; }

.scard-body { padding: 4px 18px 16px; display: grid; gap: 10px; }
.scard-body .frow { font-size: 13.2px; }
.scard-body .frow .i { width: 16px; height: 16px; }

.scard-foot {
  margin-top: auto;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 12.8px; font-weight: 620; line-height: 1.4;
}
.scard-foot .i { width: 16px; height: 16px; margin-top: 1px; flex: none; }
.scard-foot.ok   { color: var(--ok); }
.scard-foot.warn { color: var(--warn); }

@media (max-width: 620px) {
  .scards { grid-template-columns: 1fr; gap: 14px; }
  /* Still clearly a face, but not half the screen on a phone. */
  .scard-photo { width: 88px; height: 88px; font-size: 26px; }
  .scard-wash { height: 90px; }
}

/* ============================================================
   Staff profile — view and edit on one page
   ============================================================ */
.prof { display: grid; grid-template-columns: 320px 1fr; gap: 22px; align-items: start; }
.prof-side { position: sticky; top: 118px; }

.crumb { margin: 0 0 6px; font-size: 13px; }
.crumb a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--brand); }
.crumb .i { width: 15px; height: 15px; }

.banner {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 18px; padding: 12px 15px;
  font-size: 13.6px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.banner .i { margin-top: 1px; }
.banner.ok  { color: var(--ok);     background: var(--ok-bg);     border-color: color-mix(in srgb, var(--ok) 26%, transparent); }
.banner.bad { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }

.meter { height: 8px; border-radius: 99px; background: var(--line-soft); overflow: hidden; margin-top: 10px; }
.meter span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-400), var(--brand-700)); }
.missing { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.missing li { display: flex; align-items: center; gap: 7px; font-size: 12.8px; color: var(--warn); }
.missing .i { width: 14px; height: 14px; }

.fset {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.fset > h2 {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 4px; font-size: 15px; font-weight: 680;
}
.fset > h2 .i { color: var(--brand); }
.fset-note { margin: 0 0 15px; font-size: 12.8px; color: var(--muted); line-height: 1.5; }
.fset > h2 + .fgrid { margin-top: 15px; }

.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fgrid.one { grid-template-columns: 1fr; }

.fld label {
  display: block; margin-bottom: 6px;
  font-size: 12.5px; font-weight: 620; color: var(--ink-2);
}
.fld input, .fld select, .fld textarea {
  width: 100%; padding: 10px 12px;
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface-2);
  border: 1.5px solid var(--line); border-radius: 10px;
  transition: border-color .14s, box-shadow .14s, background .14s;
}
.fld textarea { resize: vertical; min-height: 76px; }
.fld input:hover, .fld select:hover, .fld textarea:hover { border-color: var(--brand-300); }
.fld input:focus, .fld select:focus, .fld textarea:focus {
  outline: none; background: var(--surface);
  border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-050);
}
.fld.has-err input, .fld.has-err select, .fld.has-err textarea { border-color: var(--danger); }
.fld-err { margin: 6px 0 0; font-size: 12.3px; color: var(--danger); }

/* The save bar sticks to the bottom: the form is long enough that Save would
   otherwise be off-screen for the whole time someone is editing. */
.formbar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; gap: 10px; align-items: center;
  padding: 14px 0 16px;
  background: linear-gradient(180deg, transparent, var(--canvas) 38%);
}

@media (max-width: 1000px) {
  .prof { grid-template-columns: 1fr; }
  .prof-side { position: static; }
}
@media (max-width: 620px) {
  .fgrid { grid-template-columns: 1fr; }
  .formbar .btn { flex: 1; justify-content: center; }
}

/* The whole card is the link to the profile. */
.scard-link { text-decoration: none; color: inherit; display: block; }
.scard-link:hover .scard { box-shadow: var(--shadow-lg); border-color: var(--brand-300); transform: translateY(-2px); }
.scard-link:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 3px; border-radius: 22px; }
/* The search filter now hides the LINK, not the article. display:block is an
   author rule and beats the UA's [hidden]{display:none}, same trap as .scard. */
.scard-link[hidden] { display: none !important; }

/* ============================================================
   Mail
   ============================================================ */
.mailtabs { display: flex; gap: 6px; margin-bottom: 18px; }
.mailtab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 15px; border-radius: 11px;
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  text-decoration: none; background: var(--surface);
  border: 1px solid var(--line);
}
.mailtab:hover { background: var(--surface-2); color: var(--ink); }
.mailtab.active { color: var(--brand); border-color: var(--brand); background: var(--brand-050); }
.mailtab em { font-style: normal; font-size: 12.5px; color: var(--muted); font-weight: 550; }
.mailtab .badge {
  padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; color: #fff; background: var(--role-rose);
}

table.maillist tbody tr { cursor: pointer; }
table.maillist tbody tr.unread td { background: var(--brand-050); }
table.maillist tbody tr.unread strong,
table.maillist tbody tr.unread .mlink { font-weight: 730; }
.mlink { color: var(--ink); text-decoration: none; font-weight: 620; }
.mlink:hover { color: var(--brand); text-decoration: underline; }
.snip { margin-top: 3px; font-size: 12.3px; color: var(--muted);
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }

.pager { display: flex; align-items: center; gap: 14px; margin-top: 18px; font-size: 13.5px; color: var(--muted); }

.msg-head { display: grid; gap: 8px; }
.mh-row { display: flex; gap: 12px; font-size: 13.6px; }
.mh-k { flex: none; width: 78px; color: var(--muted); font-weight: 600; }
.mh-v { min-width: 0; word-break: break-word; }

/* Message bodies are other people's text: preserve their line breaks, but wrap
   so a long URL cannot force the page sideways. */
.mbody {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.62;
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink);
}
.msg-body { padding: 20px; }

.attlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.att {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.att:hover { border-color: var(--brand-300); background: var(--surface-2); }
.att .i { color: var(--brand); }
.att-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.att-t strong { font-size: 13.4px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-t small { font-size: 11.8px; color: var(--muted); }

@media (max-width: 620px) {
  .mailtabs { flex-wrap: wrap; }
  .mh-row { flex-direction: column; gap: 2px; }
  .mh-k { width: auto; }
}
