/* People Operations.
   Its own stylesheet rather than a copy of Platform Management's: the
   navigation is a top menu, not a rail, so most of PM's layout would be dead
   weight. The tokens are deliberately the same values, so the two consoles
   read as one estate. */

:root {
  --bg:     #F3F2F1;
  --s1:     #FFFFFF;
  --s2:     #F7F6F5;
  --s3:     #EFEDEB;
  --border: #E1DFDD;
  --text:   #201F1E;
  --dim:    #4A4845;
  --faint:  #6C6A67;
  --blue:   #0F6CBD;
  --blue-bg:#EFF4FA;
  --green:  #0E6B3F;
  --green-bg:#E6F2EB;
  --amber:  #8A5A00;
  --amber-bg:#FBF3E2;
  --red:    #A4262C;
  --red-bg: #F8E9E9;
}
html[data-theme="dark"] {
  --bg:#1B1A19; --s1:#262524; --s2:#2F2E2D; --s3:#383736; --border:#484644;
  --text:#F3F2F1; --dim:#C8C6C4; --faint:#A19F9D;
  --blue:#4DA3F0; --blue-bg:#21303F; --green:#4FC48A; --green-bg:#1E3329;
  --amber:#E0B050; --amber-bg:#3A3122; --red:#E98A8F; --red-bg:#3A2526;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }

/* ── Top bar and menu ──────────────────────────────────────────────────── */
.topbar {
  background: var(--s1); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-in {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; min-height: 56px;
}
.brand { display: flex; align-items: center; text-decoration: none; color: inherit; }
.brand-name {
  font-size: 14px; font-weight: 400; letter-spacing: -.01em; white-space: nowrap;
  color: var(--dim);
}
.brand-name strong { font-weight: 700; color: var(--text); }

/* The section bar: equal cells, icon over label, a hairline between each.
   Its own row under the wordmark so every cell is the same width regardless of
   label length. */
.menu { border-top: 1px solid var(--border); }
.menu-in {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: stretch;
}
.menu a {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 8px 9px; font-size: 12.5px; font-weight: 600;
  color: var(--dim); text-decoration: none; text-align: center;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid transparent;
}
.menu a:first-child { border-left: 1px solid var(--border); }
.menu a svg {
  width: 19px; height: 19px; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.menu a span { line-height: 1.2; }
.menu a:hover { color: var(--text); background: var(--s2); }
.menu a[aria-current="page"] {
  color: var(--blue); border-bottom-color: var(--blue); background: var(--blue-bg);
}
.menu a:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { font-size: 12px; color: var(--faint); max-width: 230px; overflow: hidden;
       text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  min-width: 36px; min-height: 36px; display: grid; place-items: center;
  border: 0; background: none; cursor: pointer; color: var(--faint); border-radius: 6px;
}
.icon-btn:hover { background: var(--s3); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* The per-employee section bar. Same shape as the top menu - icon over label,
   equal cells, hairline between - but scoped to one record, so it sits on the
   page rather than in the chrome and carries no page navigation. */
.subnav {
  display: flex; align-items: stretch; margin: 0 0 20px;
  background: var(--s1); border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden;
}
.subnav button {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 11px 6px 9px; font: inherit; font-size: 12px; font-weight: 600;
  color: var(--dim); background: none; cursor: pointer; text-align: center;
  border: 0; border-right: 1px solid var(--border); border-bottom: 2px solid transparent;
}
.subnav button:last-child { border-right: 0; }
.subnav button svg {
  width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.subnav button:hover { color: var(--text); background: var(--s2); }
.subnav button[aria-selected="true"] {
  color: var(--blue); border-bottom-color: var(--blue); background: var(--blue-bg);
}
.subnav button:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.tabpanel[hidden] { display: none; }

@media (max-width: 760px) {
  .subnav button { font-size: 10.5px; padding: 9px 3px 7px; }
  .subnav button svg { width: 16px; height: 16px; }
}

/* The onboarding stepper. Numbered rather than iconed: these are a sequence
   with an order that matters, and a number says "third of seven" where an
   icon only says "documents". */
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.steps li {
  flex: 1 1 120px; list-style: none; display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; background: var(--s1); border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; color: var(--faint);
}
.steps li b {
  width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid;
  place-items: center; background: var(--s3); color: var(--faint);
  font-size: 11px; font-weight: 700;
}
.steps li[data-state="current"] { border-color: var(--blue); color: var(--text); }
.steps li[data-state="current"] b { background: var(--blue); color: #FFF; }
.steps li[data-state="done"] { color: var(--dim); }
.steps li[data-state="done"] b { background: var(--green-bg); color: var(--green); }

.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; }
.checks label {
  display: flex; gap: 9px; align-items: flex-start; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 4px; font-size: 12.5px; cursor: pointer;
}
.checks label:hover { background: var(--s2); }
.checks input { margin: 2px 0 0; flex: none; }
.checks .pid { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
               font-size: 10.5px; color: var(--faint); display: block; }

.review dt { font-size: 11px; font-weight: 600; color: var(--faint);
             text-transform: uppercase; letter-spacing: .05em; margin-top: 12px; }
.review dd { margin: 3px 0 0; font-size: 13.5px; }
/* The envelope above the message. Shown because the subject is part of what
   somebody is approving on this step, and it is not visible anywhere in the
   body. */
.mailhead {
  border: 1px solid var(--border); border-bottom: 0; border-radius: 4px 4px 0 0;
  background: var(--s2); padding: 10px 14px; font-size: 12.5px;
}
.mailhead > div { display: flex; gap: 10px; padding: 2px 0; }
.mailhead span:first-child {
  width: 58px; flex: none; color: var(--faint); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; padding-top: 2px;
}
.mailhead strong { font-weight: 700; }

.mailprev {
  background: #FFF; color: #201F1E; border: 1px solid var(--border); border-radius: 4px;
  padding: 20px; font-family: Verdana, Geneva, sans-serif; font-size: 13px; line-height: 1.6;
}
.mailhead + .mailprev { border-radius: 0 0 4px 4px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px; }
h1 { font-size: 21px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 3px; }
.lede { color: var(--dim); font-size: 13px; margin: 0 0 20px; }

/* ── Panels, tables, forms ─────────────────────────────────────────────── */
.panel { background: var(--s1); border: 1px solid var(--border); border-radius: 8px; }
.panel > h2 {
  margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; background: var(--s2);
  border-radius: 8px 8px 0 0;
}
.panel-body { padding: 16px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.stat { background: var(--s1); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.stat b { display: block; font-size: 25px; font-weight: 600; letter-spacing: -.02em;
          font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 9px 14px; font-size: 10px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--faint);
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--s2);
}
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--s2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.pill-ok    { background: var(--green-bg); color: var(--green); }
.pill-warn  { background: var(--amber-bg); color: var(--amber); }
.pill-bad   { background: var(--red-bg);   color: var(--red); }
.pill-quiet { background: var(--s3);       color: var(--faint); }

label.f { display: block; font-size: 11px; font-weight: 600; color: var(--dim); margin-bottom: 5px; }
input.f, select.f, textarea.f {
  width: 100%; background: var(--s1); border: 1px solid #8A8886; border-radius: 3px;
  padding: 8px 10px; font: inherit; font-size: 13px; color: var(--text);
}
html[data-theme="dark"] input.f, html[data-theme="dark"] select.f, html[data-theme="dark"] textarea.f {
  border-color: #605E5C;
}
/* A locked field should read as locked rather than as an empty one somebody
   failed to fill in. */
input.f:disabled, select.f:disabled, textarea.f:disabled {
  background: var(--s3); color: var(--faint); cursor: not-allowed;
  border-color: var(--border);
}
input.f:focus, select.f:focus, textarea.f:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue);
}
textarea.f { resize: vertical; min-height: 150px; line-height: 1.6; }
.field { margin-bottom: 13px; }
.hint { font-size: 11px; color: var(--faint); margin-top: 5px; line-height: 1.5; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.btn {
  height: 36px; padding: 0 15px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--s1); color: var(--text); font: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer;
}
/* A .btn that is an <a> must not read as a link: the global `a` rule gives it
   the accent colour and an underline, which on a table row looked like text
   that had been styled by accident. */
a.btn { text-decoration: none; color: var(--text); display: inline-flex;
        align-items: center; }
a.btn:hover { text-decoration: none; color: var(--text); }
.btn:hover:not(:disabled) { background: var(--s2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #FFF; }
.btn-primary:hover:not(:disabled) { background: #0C5BA0; }
/* a.btn above sets color on an element+class selector, which outranks the
   plain .btn-primary class and left an anchor-shaped primary button with dark
   text on blue. Restated at the same weight so the variant wins. */
a.btn-primary, a.btn-primary:hover { color: #FFF; }
a.btn-danger, a.btn-danger:hover { color: var(--red); }
.btn-danger { color: var(--red); border-color: var(--red); background: var(--s1); }
.row-actions { display: flex; gap: 7px; flex-wrap: wrap; }
/* A button that leads with its icon. Sized explicitly: an inline <svg> with no
   width renders at its natural size, which next to 13px text is enormous. */
.btn-icon { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.btn-icon svg {
  width: 14px; height: 14px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ── Inbox ─────────────────────────────────────────────────────────────── */
.inbox-row {
  display: block; width: 100%; text-align: left; border: 0; cursor: pointer;
  background: none; font: inherit; color: inherit;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
}
.inbox-row:hover { background: var(--s2); }
.inbox-row.current { background: var(--blue-bg); }
.inbox-row .sub {
  font-size: 11.5px; color: var(--dim); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Inbound and outbound are offset rather than coloured alone: on a printed or
   greyscale copy the colour is the only difference and the thread stops
   reading as a conversation. */
.msg { padding: 10px 0; border-bottom: 1px solid var(--border); }
.msg:last-child { border-bottom: 0; }
.msg-meta { font-size: 11px; color: var(--faint); margin-bottom: 4px; }
.msg-body { font-size: 13px; white-space: pre-wrap; line-height: 1.6; }
.msg.out { padding-left: 22px; border-left: 2px solid var(--blue); }
.msg.out .msg-body { color: var(--dim); }

.empty { padding: 30px; text-align: center; color: var(--faint); font-size: 13px; }
.loading { padding: 30px; text-align: center; color: var(--faint); font-size: 13px; }
.spinner {
  display: inline-block; width: 15px; height: 15px; margin-right: 8px; vertical-align: -3px;
  border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Drawer, for editing one person ────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none; z-index: 40;
}
.scrim.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%);
  background: var(--s1); border-left: 1px solid var(--border); z-index: 41;
  transform: translateX(100%); transition: transform .18s ease; display: flex;
  flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.drawer-head h2 { margin: 0; font-size: 15px; font-weight: 600; flex-grow: 1; }
.drawer-body { padding: 18px; overflow-y: auto; flex-grow: 1; }
.drawer-foot {
  padding: 14px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ── Toast ─────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(12px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 6px;
  font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .15s; z-index: 60; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.error { background: var(--red); color: #FFF; }

/* ── Access denied ─────────────────────────────────────────────────────── */
.deny { max-width: 460px; margin: 90px auto; text-align: center; padding: 0 24px; }
.deny h1 { font-size: 19px; margin-bottom: 8px; }
.deny p { color: var(--dim); font-size: 13.5px; line-height: 1.65; }

@media (max-width: 760px) {
  .topbar-in { padding: 0 16px; }
  .menu-in { padding: 0; }
  .menu a { padding: 9px 4px 7px; font-size: 11px; }
  .menu a:first-child { border-left: 0; }
  .menu a:last-child { border-right: 0; }
  .wrap { padding: 18px 16px; }
  .two { grid-template-columns: 1fr; }
  .who { display: none; }
}
