/* ==========================================================================
   Labour Life practice system: pages (SPEC 7.3). Owner: core (M0).
   What every screen inside the shell is built from:
     .page (--wide, --narrow)      the frame: gutter and the widest line
     .ph (__back __eye __state __aside)   the page header (components/page.js)
     .dl (.dl__row)                label and value rows
     .cols (--even)                the two-column detail layout
     .tools (__grow __end)         the row of find box, filters and buttons above a list
     .seg, .seg__b (.is-on)        segmented buttons: a filter, a small set of choices
     .shortcuts, .shortcut         big link cards (Home, the Admin page)
     .hello, .hero-search          the Phase 1 home screen (views/home.js)
     .acct                         My account (views/account.js)

   A module file only ADDS classes with its own prefix. It never restates one
   of these. Phone first: the base styles are the phone.
   ========================================================================== */

/* ---------- the page frame ---------- */

.page {
  width: 100%; max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--s5) var(--gutter) var(--s7);
}
/* A narrow page starts where every other page starts, so the back link and
   the title line up from page to page (Jose, 22 Oct 2026); only its
   content stays 760px wide. */
.page--narrow > * { max-width: 760px; }
.page--wide { max-width: none; }
.page > * + * { margin-top: var(--s5); }

/* ---------- the page header ----------
   <header class="ph">: a back link, an eyebrow, the one <h1>, a state line
   (badges), and the actions. From 720px the actions sit on the right. */

.ph { display: grid; grid-template-columns: minmax(0, 1fr); }
.ph > * { min-width: 0; }
.ph h1 { overflow-wrap: anywhere; }

.ph__back {
  justify-self: start;
  display: inline-flex; align-items: center; gap: var(--s1);
  min-height: var(--tap); margin: calc(var(--s2) * -1) 0 var(--s1) calc(var(--s2) * -1); padding: 0 var(--s2);
  border-radius: var(--r-sm);
  color: var(--ink-soft); font-size: var(--fs-sm); font-weight: 600; text-decoration: none;
}
.ph__back:hover { color: var(--ink); background: var(--tint); }

.ph__eye {
  margin-bottom: var(--s1);
  font: 600 var(--fs-label)/1.25 var(--font-display);
  letter-spacing: var(--track-label); text-transform: uppercase;
  color: var(--ink-soft);
}
/* A code or a name in the eyebrow is data: it keeps its own letters. */
.ph__eye--data, .ph__eye a { text-transform: none; letter-spacing: 0; }
.ph__eye a { color: var(--link); }

.ph__state {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  margin-top: var(--s2);
  color: var(--ink-soft);
}
.ph__aside {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  margin-top: var(--s4);
}
/* On a phone the main action is a full-width button. */
@media (max-width: 719px) {
  .ph__aside > .btn--primary:first-child { flex: 1 1 100%; }
}
/* A header with a nav (the arrows of a company page, 27 Oct 2026): the nav
   stands on the line of the way back, on the right, on every width. */
.ph--nav { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "back nav" "eye eye" "h1 h1" "state state" "aside aside"; }
.ph--nav .ph__back { grid-area: back; }
.ph--nav .ph__eye { grid-area: eye; }
.ph--nav h1 { grid-area: h1; }
.ph--nav .ph__state { grid-area: state; }
.ph--nav .ph__aside { grid-area: aside; }
.ph__nav { grid-area: nav; justify-self: end; align-self: center; display: flex; align-items: center; gap: var(--s1); }
.ph__nav-pos { padding: 0 var(--s1); font-size: var(--fs-sm); color: var(--ink-mute); white-space: nowrap; }

@media (min-width: 720px) {
  .ph {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "back back" "eye aside" "h1 aside" "state aside";
    column-gap: var(--s5);
  }
  .ph__back { grid-area: back; }
  .ph__eye { grid-area: eye; }
  .ph h1 { grid-area: h1; }
  .ph__state { grid-area: state; }
  .ph__aside { grid-area: aside; margin: 0; align-self: end; justify-content: flex-end; max-width: 46vw; }
  .ph--nav { grid-template-areas: "back nav" "eye aside" "h1 aside" "state aside"; }
}

/* ---------- label and value rows ----------
   <dl class="dl"><div class="dl__row"><dt>Label</dt><dd>Value</dd></div>...</dl>
   A flat <dl class="dl"> with <dt> and <dd> as direct children works too.
   The label is above the value on a phone and beside it from 520px. */

.dl { display: grid; grid-template-columns: minmax(0, 1fr); }
.dl__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: var(--s3) 0; border-top: 1px solid var(--line); }
.dl__row:first-child { border-top: 0; padding-top: 0; }
.dl__row:last-child { padding-bottom: 0; }
.dl dt { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-mute); line-height: var(--lh-snug); }
.dl dd { min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.dl dd.is-empty { color: var(--ink-mute); }
.dl > dt { padding-top: var(--s3); border-top: 1px solid var(--line); }
.dl > dt:first-child { padding-top: 0; border-top: 0; }
.dl > dd { padding-bottom: var(--s3); }
.dl > dd:last-child { padding-bottom: 0; }
/* A heading between groups of rows (Personal, Work). */
.dl__h { margin: var(--s5) 0 var(--s2); font-size: var(--fs-h3); }
.dl__h:first-child { margin-top: 0; }

@media (min-width: 520px) {
  .dl { grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr); column-gap: var(--s4); }
  .dl__row, .dl__h { grid-column: 1 / -1; }
  .dl__row { grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr); gap: var(--s4); align-items: baseline; }
  .dl > dt, .dl > dd { padding: var(--s3) 0; border-top: 1px solid var(--line); }
  .dl > dt:first-child, .dl > dt:first-child + dd { padding-top: 0; border-top: 0; }
  .dl > dd:last-child, .dl > dt:nth-last-child(2) { padding-bottom: 0; }
}

/* ---------- the two-column detail layout ----------
   One column until 960px. Then the main part on the left and a narrower
   column on the right (a summary card, the details beside a preview). */

.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-items: start; }
.cols > * { min-width: 0; }
.cols > * > * + * { margin-top: var(--s5); }
@media (min-width: 960px) {
  .cols { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
  .cols--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- list tools ---------- */

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); min-width: 0; }
.tools__grow { flex: 1 1 220px; min-width: 0; }
.tools__end { margin-left: auto; }

/* Segmented buttons. The whole control is 44px high. The chosen one is ink,
   and it also carries aria-pressed or aria-current, so colour is not the
   only signal. */
.seg {
  display: inline-flex; max-width: 100%; gap: 2px; padding: 2px;
  border: 1px solid var(--field-line); border-radius: var(--r-sm);
  background: var(--surface);
  overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg__b {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); flex: none;
  min-height: calc(var(--control-h) - 6px); min-width: var(--tap); padding: 0 var(--s3);
  border: 0; border-radius: var(--r-xs); background: transparent;
  color: var(--ink-soft); font: 600 var(--fs-sm)/1.2 var(--font-body);
  white-space: nowrap; text-decoration: none; cursor: pointer;
}
@media (pointer: coarse) { .seg__b { min-height: var(--tap); } }
.seg__b:hover { background: var(--tint); color: var(--ink); }
.seg__b.is-on, .seg__b[aria-pressed="true"], .seg__b[aria-current="true"], .seg__b[aria-current="page"] {
  background: var(--ink); color: var(--surface);
}
.seg__b:focus-visible { outline-offset: -3px; }

/* ---------- shortcut cards ----------
   A big link or button with an icon, a name and one line of help. One
   column on a phone, a grid from 720px. */

.shortcuts { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
@media (min-width: 720px) { .shortcuts { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s4); } }

.shortcut {
  display: flex; align-items: center; gap: var(--s4);
  width: 100%; height: 100%; min-height: 72px; padding: var(--s3) var(--s4);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-soft);
  font: inherit; text-align: left; text-decoration: none; cursor: pointer;
  transition: border-color var(--dur-1) ease, box-shadow var(--dur-1) ease;
}
.shortcut:hover { border-color: var(--field-line); box-shadow: var(--shadow-lift); }
.shortcut:active { background: var(--sunken); }
.shortcut__i {
  display: grid; place-items: center; flex: none;
  width: var(--tap); height: var(--tap); border-radius: var(--r-sm);
  background: var(--sunken); color: var(--ink);
}
.shortcut__b { display: grid; gap: 2px; min-width: 0; }
.shortcut__t { font-size: var(--fs-lg); font-weight: 600; line-height: var(--lh-snug); }
.shortcut__d { font-size: var(--fs-sm); color: var(--ink-mute); line-height: var(--lh-snug); }

/* ---------- Home, the Phase 1 placeholder ---------- */

.hello { display: grid; gap: var(--s2); }
.hello h1 { overflow-wrap: anywhere; }

.hero-search { max-width: 680px; }
.hero-search .sbox .input { min-height: var(--control-h-lg); font-size: var(--fs-lg); }

.shortcuts-wrap > .label { margin-bottom: var(--s3); }

/* ---------- My account ---------- */

.acct__h { font-size: var(--fs-h3); margin-bottom: var(--s4); }
.acct > .note { margin-bottom: var(--s4); }
.acct > .dl { margin-bottom: var(--s3); }
.acct > .btns { margin-top: var(--s4); }
/* Your mailbox (decision 268): one row per mailbox the person added. */
.acct > p + .acct-mb__list { margin-top: var(--s3); }
.acct-mb { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.acct-mb__row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.acct-mb__t { display: grid; gap: var(--s1); min-width: 0; }
.acct-mb__t strong { overflow-wrap: anywhere; }

/* ---------- contrast, print ---------- */

@media (forced-colors: active) {
  .seg__b.is-on, .seg__b[aria-pressed="true"], .seg__b[aria-current="true"], .seg__b[aria-current="page"] {
    background: Highlight; color: HighlightText; forced-color-adjust: none;
  }
  .shortcut { border: 1px solid ButtonText; }
}

@media print {
  .page { max-width: none; padding: 0; }
  .ph__aside, .ph__back, .tools { display: none !important; }
}
