/* ── AHS Personnel Register — shared components (on top of tokens.css) ── */

a { color: var(--brand-600); }
a:hover { color: var(--accent-600); }
::selection { background: var(--brand-100); }

/* attribute `hidden` must always win over class display rules */
[hidden] { display: none !important; }

.page { min-height: 100vh; background: var(--surface-page); color: var(--text-primary);
  font: var(--fw-regular) var(--text-base)/1.6 var(--font-body); text-wrap: pretty; }

/* ── Top bar ── */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--white); border-bottom: 1px solid var(--border-subtle); }
.topbar-in { max-width: 1320px; margin: 0 auto; min-height: 60px; padding: 10px clamp(16px,4vw,32px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.topbar-seal { width: 32px; height: 32px; object-fit: cover; border-radius: 50%; flex-shrink: 0; }
.topbar-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.topbar-title b { font: var(--fw-semibold) 15px/1.2 var(--font-display); white-space: nowrap; }
.topbar-title small { font: var(--fw-medium) 10px/1.2 var(--font-mono); letter-spacing: .14em; color: var(--text-tertiary); }
.topbar nav { display: flex; align-items: center; gap: 2px; margin-left: 22px; }
.topbar nav a { font: var(--fw-medium) 13.5px/1 var(--font-body); color: var(--text-secondary);
  text-decoration: none; padding: 8px 10px; border-radius: 5px; }
.topbar nav a:hover { color: var(--brand-700); background: var(--brand-50); text-decoration: none; }
.topbar nav a[aria-current="page"] { font-weight: var(--fw-semibold); color: var(--brand-700); background: var(--brand-50); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-date { font: var(--fw-regular) 12px/1 var(--font-mono); color: var(--text-tertiary); }
.topbar-sep { width: 1px; height: 20px; background: var(--border-subtle); }
.topbar-user { display: flex; align-items: center; gap: 8px; font: var(--fw-semibold) 13px/1.2 var(--font-body); }
.topbar-logout { font: var(--fw-medium) 12px/1 var(--font-body); color: var(--text-tertiary); background: none;
  border: none; cursor: pointer; padding: 6px 8px; border-radius: 5px; }
.topbar-logout:hover { color: var(--red-700); background: var(--red-100); }

.container { max-width: 1320px; margin: 0 auto; padding: clamp(28px,5vw,52px) clamp(16px,4vw,32px) 0; }

/* ── Avatar (initials) ── */
.av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--brand-100); color: var(--brand-700); font: var(--fw-semibold) 11px/1 var(--font-body);
  flex-shrink: 0; user-select: none; }
.av-sm { width: 28px; height: 28px; }
.av-md { width: 40px; height: 40px; font-size: 14px; }
.av-xs { width: 26px; height: 26px; font-size: 10px; }

/* portrait tile (team directory / focus grid) */
.tile { position: relative; aspect-ratio: 1/1; border-radius: 6px; overflow: hidden; background: var(--slate-100); }
.tile-init { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.92); font: 650 clamp(28px,4vw,40px)/1 var(--font-display); }
.tile-tag { position: absolute; top: 9px; left: 9px; pointer-events: none; font: var(--fw-semibold) 10px/1 var(--font-mono);
  letter-spacing: .08em; color: var(--white); background: rgba(17,19,31,.55); padding: 3px 7px; border-radius: 4px; }

/* ── Forms ── */
.fld label { display: block; font: var(--fw-medium) 12.5px/1.4 var(--font-body); color: var(--text-secondary); margin-bottom: 6px; }
.fld input, .fld select { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-default);
  border-radius: var(--radius-md); background: var(--white); color: var(--text-primary);
  font: var(--fw-regular) 14px/1.4 var(--font-body); box-sizing: border-box; }
.fld input:focus, .fld select:focus { outline: 2px solid var(--focus-ring); outline-offset: 0; border-color: var(--brand-500); }
.fld input::placeholder { color: var(--text-tertiary); }
.fld.err input { border-color: var(--red-600); }

.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 44px; }
.pass-toggle { position: absolute; right: 4px; top: 4px; bottom: 4px; width: 36px;
  border: none; background: none; cursor: pointer; color: var(--text-tertiary);
  display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }
.pass-toggle:hover { color: var(--brand-700); background: var(--slate-100); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; cursor: pointer;
  border-radius: var(--radius-md); font: var(--fw-semibold) 14px/1 var(--font-body);
  transition: background .15s var(--ease-out), transform .15s var(--ease-out); }
.btn-primary { background: var(--brand-700); color: var(--white); height: 46px; padding: 0 20px; }
.btn-primary:hover { background: var(--brand-600); }
.btn-primary:disabled { background: var(--slate-300); cursor: default; }
.btn-ghost { background: var(--white); color: var(--text-secondary); border: 1px solid var(--border-default);
  height: 40px; padding: 0 16px; font-weight: var(--fw-medium); font-size: 13px; }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text-primary); }
.btn-block { width: 100%; }

/* ── Tabs (underline + count pills) ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-subtle); overflow-x: auto; }
.tabs button { display: inline-flex; align-items: center; gap: 7px; background: none; border: none; cursor: pointer;
  padding: 11px 12px; font: var(--fw-medium) 13.5px/1 var(--font-body); color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--brand-700); }
.tabs button[aria-selected="true"] { color: var(--brand-700); font-weight: var(--fw-semibold); border-bottom-color: var(--brand-700); }
.tabs .n { font: var(--fw-semibold) 10.5px/1 var(--font-mono); background: var(--slate-100); color: var(--slate-600);
  padding: 3px 7px; border-radius: var(--radius-pill); }
.tabs button[aria-selected="true"] .n { background: var(--brand-100); color: var(--brand-700); }

/* ── Misc ── */
.kicker { font: var(--fw-semibold) 11px/1 var(--font-mono); letter-spacing: .16em; color: var(--brand-600); }
.pill { font: var(--fw-medium) 11.5px/1.3 var(--font-body); padding: 4px 9px; border-radius: var(--radius-pill); }
.footer { margin-top: 56px; border-top: 2px solid var(--slate-900); padding: 18px 0 44px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; }
.footer span:first-child { font: var(--fw-regular) 13px/1.5 var(--font-body); color: var(--text-secondary); }
.footer span:last-child { font: var(--fw-regular) 11px/1.5 var(--font-mono); letter-spacing: .08em; color: var(--text-tertiary); }

.bar { height: 5px; background: var(--slate-100); border-radius: 2px; overflow: hidden; display: block; }
.bar > span { display: block; height: 100%; }

dialog.modal { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 28px;
  width: min(420px, 92vw); }
dialog.modal::backdrop { background: rgba(17,19,31,.45); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 90;
  background: var(--slate-900); color: var(--white); font: var(--fw-medium) 13.5px/1.4 var(--font-body);
  padding: 12px 20px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.toast.err { background: var(--red-700); }

@keyframes lg-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.lg-fill { animation: lg-fill 900ms cubic-bezier(.16,.8,.3,1) both; transform-origin: left center; }
@keyframes oc-grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.oc-tick { animation: oc-grow-y var(--dur-base) var(--ease-out) both; transform-origin: top; }
@media (prefers-reduced-motion: reduce) { .lg-fill, .oc-tick { animation: none !important; } }
