/* ===========================================================================
   THE TRANSITIONAL STYLESHEET
   ===========================================================================

   The look of the engineering views that have not yet been rebuilt as
   workspaces. They live under System in the navigation and they still work -
   requirement: "Do not remove functioning engineering capabilities merely
   because their finished workspace has not yet been built."

   EVERY RULE IS SCOPED TO #legacy. UI Standard 15 allows a scoped stylesheet
   for genuine specialization and forbids it from redefining shared tokens,
   button roles, modal behaviour, field treatment or collection behaviour for
   one part of the application. Unscoped, this file's `button { min-height:
   2.1rem }` would override the shell's 44px controls - exactly the failure
   that clause describes.

   This is a TRANSITIONAL scope rather than a second design system, and it is
   deleted when the last view it covers is replaced. Nothing new goes in it.

   WHAT WAS REMOVED on the way in, rather than scoped:
     * :root and the dark-mode block. tokens.css owns the palette, and Works
       has one palette. A second set of variables in inverted colours that no
       standard names is the competing design system section 15 warns about.
     * the universal box-sizing reset and the body rule, both of which
       tokens.css already does.

   WHAT STAYED GLOBAL: [hidden], below, for the reason its own comment gives.
   =========================================================================== */

/* The `hidden` attribute must win. An author rule like `.signin { display:
   grid }` beats the user-agent's [hidden] { display: none }, which left the
   sign-in panel on screen after a successful sign-in with the application
   rendered below it. Seen in a browser, 5 October 2026. */
[hidden] {
  display: none !important;
}


/* THE SCOPE HAS TO FOLLOW THE SECTION.

   Scoping every rule to #legacy was right about leakage and wrong about
   where these sections live: the shell BORROWS one into .workspace-body
   for as long as its workspace is open, and the moment it leaves #legacy
   not one of these rules applies. Seen in a browser, 15 October 2026 - the
   transitional workspaces rendered as unstyled markup. The section ids are
   the honest scope, because shell content is never inside one. */
#legacy,
section[id^='view-'] {
  /* THE NAMES THE TRANSITIONAL VIEWS WERE WRITTEN AGAINST, as ALIASES onto
     the tokens that now own those meanings. The :root block that defined
     them was removed on the way in - correctly, because Works has one
     palette - which left 34 declarations below pointing at variables that
     did not exist, so they resolved to the guaranteed-invalid value and
     were dropped. No value is decided here; every one of these is a
     forwarding address to tokens.css. */
  --bg: var(--surface-sunken);
  --panel: var(--surface);
  --line: var(--border);
  --muted: var(--ink-muted);
  --accent: var(--brand-brass);
  --warn: var(--state-warn);
  --error: var(--state-error);
  --on: var(--state-success);
  --off: var(--ink-muted);
  --line-faint: var(--border-subtle);
  --fg: var(--ink);
  h1 {
    font-size: 1.3rem;
    margin: 0 0 0.25rem;
  }
  h2 {
    font-size: 1.05rem;
    margin: 1.75rem 0 0.35rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--line);
  }
  h3 {
    font-size: 1rem;
    margin: 1.25rem 0 0.35rem;
  }

  .muted {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0.2rem 0 0.6rem;
    max-width: 70ch;
  }
  .hint {
    margin-top: -0.3rem;
  }
  .warn {
    color: var(--warn);
    font-weight: 600;
  }
  .error {
    color: var(--error);
  }
  .on {
    color: var(--on);
    font-weight: 600;
  }
  .off {
    color: var(--off);
  }
  .dim {
    opacity: 0.55;
  }

  /* ---------------------------------------------------------------- sign in */
  .signin {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
  }
  .card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: min(380px, 100%);
    display: grid;
    gap: 0.75rem;
  }

  label {
    display: grid;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--muted);
  }
  label.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  input,
  select {
    font: inherit;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--ink);
    min-width: 0;
  }
  input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
  }

  button {
    font: inherit;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--ink);
    cursor: pointer;
    min-height: 2.1rem;
  }
  button:hover {
    border-color: var(--accent);
  }
  button.primary,
  #signin-form button[type="submit"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 600;
  }
  nav button.active {
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
  }

  /* ------------------------------------------------------------------ chrome */
  .chrome-stack {
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .chrome {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
  }
  .chrome nav {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
  }
  .spacer {
    flex: 1;
  }

  .view {
    padding: 0.5rem 1rem 3rem;
  }

  /* THE BANNER HAS TO BE WHERE THE EYES ARE.
     It was a non-sticky sibling after the sticky chrome, so it sat at the top of
     the document - and every form below a long table could fail with its
     explanation rendered off-screen. Sticking it under the chrome makes every
     refusal visible wherever the page is scrolled, which is the systemic half of
     the Check "no message appeared" defect. The field-level message below is the
     specific half. */
  .banner {
    margin: 0;
    padding: 0.6rem 1rem;
    background: color-mix(in srgb, var(--accent) 12%, var(--panel));
    border-bottom: 1px solid var(--line);
  }
  .banner.error {
    background: color-mix(in srgb, var(--error) 14%, var(--panel));
    color: var(--error);
    font-weight: 600;
  }

  /* ------------------------------------------------------------------ tables */
  .table-scroll {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    display: block;
    overflow-x: auto;
  }
  thead th {
    text-align: left;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding: 0.35rem 0.5rem;
    white-space: nowrap;
  }
  tbody td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
  }
  tbody tr:hover {
    background: color-mix(in srgb, var(--accent) 5%, transparent);
  }
  td.num,
  th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  td.total {
    font-weight: 700;
  }
  td pre {
    margin: 0;
    font-size: 0.75rem;
    max-width: 28ch;
    white-space: pre-wrap;
    color: var(--muted);
  }
  .actions {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
  }

  form.inline {
    display: flex;
    gap: 0.6rem;
    align-items: end;
    flex-wrap: wrap;
    margin: 0.5rem 0 1rem;
  }
  form.inline label.grow {
    flex: 1;
    min-width: 18ch;
  }

  ul {
    margin: 0.3rem 0 0;
    padding-left: 1.2rem;
  }
  li {
    margin: 0.15rem 0;
  }

  /* ------------------------------------------------------------------ dialog */
  dialog {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--ink);
    padding: 1.25rem;
    width: min(520px, 92vw);
  }
  dialog::backdrop {
    background: rgb(0 0 0 / 45%);
  }
  dialog #prompt-fields {
    display: grid;
    gap: 0.6rem;
    margin: 0.75rem 0 1rem;
  }
  dialog menu {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
  }

  /* ------------------------------------------------------- Slice 1: jobs */
  /* A status is a word, not a colour, so it survives being read aloud. */
  .pill {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    font-size: 0.85em;
    white-space: nowrap;
  }

  .cards {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  }

  /* A record card used as a grid cell: take the column, align to the top, and
     breathe a little more than a list row does. */
  .cards > .record-card {
    padding: 1.25rem;
    gap: 0.5rem;
    align-content: start;
    background: var(--panel);
  }

  .stack {
    display: grid;
    gap: 0.5rem;
    max-width: 36rem;
  }

  .stack label {
    display: grid;
    gap: 0.2rem;
  }

  /* A handoff item is read and copied from, so the label and the value must be
     adjacent rather than in distant columns. */
  .detail {
    margin: 0;
  }

  .detail .kv {
    display: grid;
    grid-template-columns: minmax(8rem, 12rem) 1fr;
    gap: 0.5rem;
    padding: 0.15rem 0;
    border-bottom: 1px solid var(--line-faint);
  }

  .detail dt {
    font-weight: 600;
  }

  .detail dd {
    margin: 0;
    white-space: pre-wrap;
  }

  /* Distinct from .card, which is the fixed-width sign-in panel. */
  .handoff-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: grid;
    gap: 0.75rem;
    align-content: start;
  }

  .handoff-card h3 {
    margin: 0;
  }

  /* ------------------------------------------------ Slice 2: record surfaces */
  /* One list shape for every list of records, and one panel shape for every
     labelled block of facts, so the later visual pass is a restyle rather than a
     rebuild. */
  .record-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
  }

  .record-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: grid;
    gap: 0.3rem;
  }

  .record-main {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: baseline;
  }

  .record-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.4rem;
  }

  .record-title {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: baseline;
    margin: 1rem 0;
  }

  .record-title h2 {
    margin: 0;
  }

  .panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    display: grid;
    gap: 0.5rem;
  }

  .panel-head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
  }

  .panel-head h3 {
    margin: 0;
  }

  .search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
  }

  .search-row form {
    display: flex;
    /* It wraps for the same reason the chrome bar does: the Search control
       has to go somewhere when the field cannot shrink any further. */
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: end;
  }

  .search-row label {
    /* Without this a flex item refuses to shrink below its content, and the
       field below took the row to 447px inside a 380px phone. */
    min-width: 0;
  }

  .search-row input[type='search'] {
    /* 22rem WHERE THERE IS ROOM. A min-width of 22rem is a floor the browser
       cannot go under, so on a phone the row simply overflowed the page -
       seen at 380px on 15 October 2026. A width with a max-width is the same
       field on a desktop and a field that fits on a phone. */
    width: 22rem;
    min-width: 0;
    max-width: 100%;
  }

  .pill.warn {
    border-color: var(--error);
    color: var(--error);
  }

  /* ------------------------------------------------------- password reveal
     The control sits INSIDE the field's box rather than beside it, so the form
     keeps one column and the label still reads straight down the page. */
  .password-field {
    position: relative;
    display: block;
  }
  .password-field input {
    width: 100%;
    /* Room for the button, so a long password never runs underneath it. */
    padding-right: 5rem;
  }
  .password-field .reveal {
    position: absolute;
    top: 50%;
    right: 0.35rem;
    transform: translateY(-50%);
    width: auto;
    margin: 0;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 4px;
    cursor: pointer;
    /* A real target for a finger on a touchscreen, not a 12px word. */
    min-height: 2rem;
    min-width: 3.5rem;
  }
  .password-field .reveal:hover,
  .password-field .reveal:focus-visible {
    color: var(--fg);
  }

  /* Announced, never shown. */
  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  /* ---------------------------------------------------------------- media
     Slice 3. Structural only: this is the arrangement the final design will be
     applied TO, not the final design. One item per block, its state in words
     beside its name, and the preview fetched only when somebody asks for it. */
  .media-group-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 1rem 0 0.25rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--line);
  }
  .media-group {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
  .media-item {
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0.6rem 0.75rem;
  }
  .media-item-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: baseline;
  }
  .media-item p {
    margin: 0.2rem 0;
    font-size: 0.85rem;
  }
  .media-preview {
    margin-top: 0.4rem;
  }
  /* max-width, never a fixed size: a photograph of a water heater and a
     photograph of a house are different shapes and neither should be cropped
     by a stylesheet that assumed one of them. */
  .media-view {
    max-width: 100%;
    max-height: 60vh;
    display: block;
  }

  /* -------------------------------------------------------- the employee record
     These reuse .record-card, the existing record-list cell, rather than
     redefining it — so the employee record looks like every other record list in
     HQ instead of introducing a second card that is nearly the same. Only what
     the record actually adds is styled here: a heading, one large figure, and a
     two-column list of the facts behind it. */
  .record-card h4 {
    margin: 0;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--muted);
  }

  /* The number being asked about, large enough to read at arm's length on the
     office screen — a balance squinted at is a balance misread. */
  .record-card .figure {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  .record-card dl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.2rem 0.75rem;
    margin: 0;
  }

  .record-card dt {
    color: var(--muted);
  }

  .record-card dd {
    margin: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  /* ----------------------------------------------- a message about one field
     Beside the control it concerns, not at the top of the page. Calm: it states
     what cannot be done and what to do instead, so it reads as information and
     not as a telling-off. */
  .field-error {
    margin: -0.25rem 0 0;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--error);
    background: color-mix(in srgb, var(--error) 8%, var(--panel));
    color: var(--error);
    font-size: 0.9rem;
    line-height: 1.4;
  }

  /* The control it belongs to, while it is showing. */
  select[aria-invalid='true'],
  input[aria-invalid='true'] {
    border-color: var(--error);
  }

}
