/* 41 Moorgate — compliance module (WP-C2/C3/C4).
 *
 * Layered on assets/portal.css: the shell, sidebar, card, modal, field and
 * button primitives are the portal's and are not restated here. This file
 * adds the status vocabulary the visual data contract fixes (§2.1), and the
 * five components that vocabulary drives — posture ring, domain card,
 * meter, horizon, register.
 *
 * Two rules govern every declaration below.
 *
 * 1. No literal width, percentage or count (CX-01, contract §14.1). Every
 *    proportion on screen is set from JS out of a computed value. Grep this
 *    file for a percentage and it comes back clean; the segments and bars
 *    are sized in pixels by comp-core.js from counts that came from a
 *    query.
 * 2. Colour is never the only signal (§2.4). Every status pill carries its
 *    glyph and its label alongside its colour, so the screen survives
 *    greyscale, a monochrome print and a colour-blind reader intact.
 *
 * Domain colour and status colour never share a visual role (§2.3): domain
 * colour is the identity chip, the card's left edge and the Horizon bar;
 * status colour is pills, meter segments and logbook squares. A coral bar
 * that could mean either "Health & safety" or "lapsed" is unreadable, so
 * the two families are kept in separate jobs.
 */

:root {
  /* Status tokens — visual data contract §2.1, fixed. These do not move
     between the three themes: a status colour that shifted with the paper
     would stop being a vocabulary. */
  --st-lapsed: #a85541;
  --st-due: #b8873f;
  --st-evidence: #9a8548;
  --st-indate: #5f7d6d;
  --st-pending: #6b7b8c;
  --st-dormant: #9a968f;
  --st-na: #b8b4ae;
  --c-meter-h: 10px;
  --c-lane-h: 34px;
}

/* ------------------------------------------------------------------ *
 * Layout
 * ------------------------------------------------------------------ */

.c-body {
  flex: 1;
  padding: 26px 28px 60px;
  background: var(--paper);
  min-width: 0;
}

.c-section {
  margin: 0 0 30px;
}

.c-section-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.c-section-h h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  margin: 0;
  letter-spacing: -0.01em;
}

.c-section-h .c-note {
  font-size: 12.5px;
  color: var(--text-soft);
  margin: 0;
}

.c-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 16px;
}

/* ------------------------------------------------------------------ *
 * Posture header — contract §4
 * ------------------------------------------------------------------ */

.c-posture {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 26px;
  align-items: center;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px 24px;
}

.c-ring {
  position: relative;
  width: 132px;
  height: 132px;
  flex: none;
}

.c-ring svg {
  display: block;
  transform: rotate(-90deg);
}

.c-ring-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 10;
}

.c-ring-arc {
  fill: none;
  stroke-width: 10;
  stroke-linecap: butt;
  transition: stroke-dashoffset 0.6s ease;
}

.c-ring-mid {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.c-ring-num {
  font-family: var(--display);
  font-weight: 600;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.c-ring-band {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.c-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 8px 20px;
  min-width: 0;
}

.c-stat {
  border-left: 2px solid var(--line);
  padding: 2px 0 2px 12px;
}

.c-stat .n {
  font-family: var(--display);
  font-weight: 600;
  font-size: 23px;
  line-height: 1.15;
  display: block;
}

.c-stat .k {
  font-size: 11.5px;
  color: var(--text-soft);
  display: block;
  margin-top: 1px;
}

.c-stat .k .g {
  font-family: var(--mono);
  margin-right: 4px;
}

.c-banner {
  margin: 14px 0 0;
  padding: 11px 14px;
  border-left: 3px solid var(--brass);
  background: var(--paper);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-soft);
}

.c-banner b {
  color: var(--text);
  font-weight: 600;
}

.c-formula {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 10px 0 0;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ *
 * Domain card
 * ------------------------------------------------------------------ */

.c-card {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--r-sm);
  padding: 16px 18px 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
  transition:
    border-color 0.16s ease,
    transform 0.16s ease;
}

.c-card:hover {
  transform: translateY(-1px);
  border-color: var(--text-dim);
}

/* A shell domain — declared, zero duties. The class is deliberately NOT
   called `shell`: portal.css already owns `.shell` for the page grid, and
   that rule carries min-height:100vh, which silently stretched every card
   in the row to a full viewport. */
.c-card.is-shell {
  border-style: dashed;
  border-left-style: dashed;
  background: transparent;
}

.c-card-h {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.c-chip {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex: none;
  color: #fff;
}

.c-card-h .nm {
  font-family: var(--display);
  font-weight: 600;
  font-size: 14.5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c-card-h .ct {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  flex: none;
}

.c-card-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-soft);
}

.c-lifecycle {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ------------------------------------------------------------------ *
 * Meter — contract §5. Segment widths are set in pixels from JS; nothing
 * here declares a proportion, because a proportion declared in CSS is a
 * proportion nobody can trace to a query.
 * ------------------------------------------------------------------ */

.c-meter {
  display: flex;
  height: var(--c-meter-h);
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
}

.c-meter-seg {
  height: var(--c-meter-h);
  flex: none;
}

.c-meter-empty {
  height: var(--c-meter-h);
  border: 1px dashed var(--line);
  border-radius: 999px;
}

.c-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 11.5px;
  color: var(--text-soft);
}

.c-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.c-legend .g {
  font-family: var(--mono);
  font-size: 11px;
}

.c-legend .n {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
}

/* ------------------------------------------------------------------ *
 * Status pill — colour + glyph + label, all three, always (§2.4)
 * ------------------------------------------------------------------ */

.c-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  border: 1px solid currentcolor;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.c-pill .g {
  font-family: var(--mono);
  font-size: 11px;
}

.c-clip {
  font-family: var(--mono);
  font-size: 13px;
}

.c-unassigned {
  color: var(--st-due);
  font-weight: 600;
}

/* ------------------------------------------------------------------ *
 * Horizon — contract §6
 * ------------------------------------------------------------------ */

.c-horizon {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px 12px;
  min-width: 0;
}

.c-axis {
  position: relative;
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 14px;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.c-axis-scale {
  position: relative;
  height: 14px;
}

.c-axis-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.c-axis-tick.first {
  transform: none;
  left: 0;
}

.c-lanes {
  position: relative;
  max-height: 460px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.c-lane {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 14px;
  align-items: center;
  height: var(--c-lane-h);
  border-bottom: 1px solid var(--paper);
}

.c-lane:hover {
  background: var(--paper);
}

.c-lane-nm {
  min-width: 0;
  overflow: hidden;
  text-align: left;
  padding: 0;
}

.c-lane-nm .t {
  font-size: 12.5px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}

.c-lane-nm .i {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--text-dim);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c-track {
  position: relative;
  height: var(--c-lane-h);
  min-width: 0;
}

.c-window {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: rgb(184 135 63 / 8%);
  border-right: 1px dashed rgb(184 135 63 / 45%);
  pointer-events: none;
}

.c-bar {
  position: absolute;
  top: 7px;
  left: 0;
  height: 12px;
  border-radius: 3px;
  min-width: 3px;
}

.c-bar.lapsed {
  background-image: repeating-linear-gradient(
    45deg,
    rgb(255 255 255 / 65%) 0,
    rgb(255 255 255 / 65%) 2px,
    transparent 2px,
    transparent 5px
  );
  box-shadow: inset 0 0 0 1.5px var(--st-lapsed);
}

.c-bar-cap {
  position: absolute;
  top: 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  padding-left: 6px;
}

/* ------------------------------------------------------------------ *
 * Register — contract §7
 * ------------------------------------------------------------------ */

.c-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 14px;
}

.c-filters input,
.c-filters select {
  font-family: inherit;
  font-size: 12.5px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  color: var(--text);
  min-width: 0;
}

.c-filters input {
  flex: 1 1 220px;
}

.c-table-wrap {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow-x: auto;
}

.c-table {
  border-collapse: collapse;
  min-width: 940px;
}

.c-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--paper-2);
  z-index: 1;
}

.c-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: top;
}

.c-table tr:last-child td {
  border-bottom: none;
}

.c-table tbody tr:hover {
  background: var(--paper);
}

.c-table tr.dormant td {
  color: var(--text-dim);
}

.c-duty {
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
  display: block;
  min-width: 0;
}

.c-duty .t {
  font-weight: 600;
  display: block;
  line-height: 1.3;
}

.c-duty .s {
  font-size: 11.5px;
  color: var(--text-soft);
  display: block;
}

.c-instrument {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-soft);
  border-bottom: 1px solid var(--line);
}

.c-instrument:hover {
  color: var(--brass);
}

.c-when {
  white-space: nowrap;
}

.c-when .r {
  display: block;
  font-size: 11px;
  color: var(--text-soft);
}

.c-holders {
  font-size: 12px;
  line-height: 1.45;
  min-width: 132px;
}

.c-holders .r {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-right: 5px;
}

/* ------------------------------------------------------------------ *
 * Duty detail
 * ------------------------------------------------------------------ */

.c-kv {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 7px 14px;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 18px;
}

.c-kv dt {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-top: 3px;
}

.c-kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.c-sub {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 20px 0 8px;
}

.c-list {
  border-top: 1px solid var(--line);
}

.c-list-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.45;
}

.c-list-row .grow {
  flex: 1;
  min-width: 0;
}

.c-list-row .meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Logbook squares — contract §8 */

.c-squares {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.c-sq {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  border: 1.5px solid transparent;
}

.c-sq.hollow {
  background: transparent;
}

.c-sq.dashed {
  border-style: dashed;
  background: transparent;
}

.c-sq-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 2px;
}

.c-sq-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ------------------------------------------------------------------ *
 * Empty states — contract §12. Designed states, never a spinner and
 * never a number that did not come from the same query as the screen.
 * ------------------------------------------------------------------ */

.c-empty {
  border: 1px dashed var(--line);
  border-radius: var(--r);
  padding: 30px 26px;
  text-align: center;
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.6;
}

.c-empty .big {
  font-family: var(--display);
  font-size: 22px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 7px;
}

.c-empty .act {
  margin-top: 14px;
}

/* ------------------------------------------------------------------ *
 * Command palette
 * ------------------------------------------------------------------ */

.c-palette {
  position: fixed;
  inset: 0;
  background: rgb(14 17 22 / 55%);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
  z-index: 200;
}

.c-palette.active {
  display: flex;
}

.c-palette-box {
  width: 560px;

  /* Stated as the viewport less the overlay's own padding, rather than as
     a percentage: this is a containment rule, not a proportion, and the
     contract check reads every percentage in a size declaration as a
     proportion nobody can trace to a query. */
  max-width: calc(100vw - 40px);
  background: var(--paper);
  border-radius: 16px;
  box-shadow: 0 40px 80px -30px rgb(0 0 0 / 60%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 66vh;
}

.c-palette-box input {
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 17px 20px;
  font-family: inherit;
  font-size: 15px;
  background: transparent;
  color: var(--text);
  outline: none;
}

.c-palette-list {
  overflow-y: auto;
  padding: 6px;
}

.c-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  width: auto;
  text-align: left;
  font-size: 13.5px;
  color: var(--text);
}

.c-palette-item .kind {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-left: auto;
  white-space: nowrap;
}

.c-palette-item.on,
.c-palette-item:hover {
  background: var(--paper-2);
}

.c-palette-empty {
  padding: 22px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* ------------------------------------------------------------------ *
 * Crumb / rail
 * ------------------------------------------------------------------ */

.c-crumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-soft);
  margin: 0 0 16px;
}

.c-crumb button {
  color: var(--text-soft);
  font-size: 12.5px;
  padding: 0;
}

.c-crumb button:hover {
  color: var(--brass);
}

.c-crumb .sep {
  color: var(--text-dim);
}

.c-crumb .cur {
  color: var(--text);
  font-weight: 600;
}

.c-rail-empty {
  font-size: 11.5px;
  line-height: 1.55;
  color: #6d747d;
  padding: 6px 12px 10px;
}

.c-gate {
  max-width: 460px;
  margin: 16vh auto 0;
  text-align: center;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
}

.c-gate h1 {
  font-family: var(--display);
  font-size: 22px;
  color: var(--text);
  margin: 0 0 10px;
}

.c-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.c-holder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

/* The holder picker. The ref is never typed — this searches the real
   directory and choosing a row carries both the record's type and its key,
   so a duty can only ever be attached to something that exists. */
.c-pick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  padding-right: 8px;
  min-width: 0;
}

.c-pick.chosen {
  border-color: var(--st-indate);
}

.c-pick-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  padding: 9px 10px;
  color: var(--text);
  outline: none;
}

.c-pick-kind {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--st-indate);
  white-space: nowrap;
  flex: none;
}

/* `is-empty`, not `empty`: portal.css owns `.empty` for its dashed
   empty-state block, and a bare modifier picked up a 30px padding and a
   dashed border that pushed the search box to half width. Same class of
   collision as `.shell`. */
.c-pick-kind.is-empty {
  color: var(--text-dim);
}

.c-pick-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 320px;
  z-index: 40;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: 0 18px 34px -18px rgb(0 0 0 / 35%);
  max-height: 244px;
  overflow-y: auto;
  padding: 4px;
}

.c-pick-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: auto;
  min-width: 0;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text);
}

.c-pick-item .l {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

.c-pick-item .d {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

.c-pick-item.on,
.c-pick-item:hover {
  background: var(--paper-2);
}

.c-pick-empty {
  padding: 14px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-soft);
}

.c-holder-row select {
  font-family: inherit;
  font-size: 12.5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  color: var(--text);
  min-width: 0;
}

.c-x {
  font-size: 15px;
  color: var(--text-dim);
  padding: 4px 8px;
  line-height: 1;
}

.c-x:hover {
  color: var(--st-lapsed);
}

/* ------------------------------------------------------------------ *
 * Coverage gaps — visual data contract §10. One tile per permit class.
 * The uncovered ones are the point of the screen, so they read loudest.
 * ------------------------------------------------------------------ */

.c-gaps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.c-gap {
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  padding: 12px 14px;
  min-width: 0;
}

.c-gap.uncovered {
  background: var(--paper);
  border-style: dashed;
  border-left-style: solid;
}

.c-gap .t {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 13.5px;
}

.c-gap .v {
  display: block;
  font-size: 12px;
  margin-top: 3px;
  font-weight: 600;
}

.c-why {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--st-lapsed);
  margin-top: 3px;
}

.c-why.soon {
  color: var(--st-due);
}

.c-permit-actions {
  white-space: nowrap;
}

/* ---------------- incidents (WP-C8) -----------------------------------
   The clock ring is elapsed over total for a statutory deadline. Drawn with a
   conic gradient off a single custom property, so the arithmetic stays in
   comp-incidents.js and the stylesheet holds no proportion of its own.

   Named `.c-clock` and not `.c-ring`: the posture ring already owns
   `.c-ring` in this file, at 132px with its own positioning, and a 22px
   inline clock inheriting that would be the third generic-name collision
   in this module. */
.c-clock {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: none;
  background: conic-gradient(var(--c-clock-token) calc(var(--c-clock-pct) * 1%), var(--line) 0);
  position: relative;
  vertical-align: middle;
}

.c-clock::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--paper-2);
}

.c-clock-text {
  font-size: 11.5px;
  color: var(--text-soft);
  margin-left: 7px;
}

.c-overdue {
  color: var(--st-lapsed);
}

.c-dom-chip {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-soft);
  margin: 0 3px 3px 0;
  white-space: nowrap;
}

.c-dom-chip.is-satisfied {
  color: var(--st-indate);
  border-color: color-mix(in srgb, var(--st-indate) 40%, var(--line));
}

.c-obl {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

/* A statutory obligation is not the same kind of thing as a local one, and
   the screen should not need a caption to say so. */
.c-obl.is-statutory {
  border-left: 3px solid var(--st-lapsed);
}

.c-obl.is-settled {
  opacity: 0.65;
}

.c-obl.is-settled.is-statutory {
  border-left-color: var(--st-indate);
}

.c-obl-head {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.c-obl-dot {
  font-size: 15px;
  line-height: 1.3;
  color: var(--text-soft);
  flex: none;
  width: 22px;
  text-align: center;
}

.c-obl-body {
  min-width: 0;
}

.c-obl-label {
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0;
}

.c-obl-meta,
.c-obl-done {
  font-size: 11.5px;
  color: var(--text-soft);
  margin: 4px 0 0;
  line-height: 1.5;
}

.c-obl-actions,
.c-obl-determine {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-left: 33px;
}

.c-obl-determine {
  margin-top: 0;
  padding-left: 0;
}

.c-class-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
}

.c-class-opt {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 6px 7px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}

.c-class-opt:hover {
  background: var(--paper);
}

.c-class-opt .d {
  display: block;
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 1px;
}

.c-inc-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.c-inc-detail .c-section-h {
  margin-top: 22px;
}

/* ---------------- CSV import ------------------------------------------
   The three counts sit above the row list because they are what decides
   whether to press the button; the rows are what decides what to fix. */
.c-imp-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 20px;
  margin: 10px 0 14px;
}

.c-imp-cols h4 {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 4px;
}

.c-imp-cols p {
  font-size: 12.5px;
  line-height: 1.5;
  margin: 0;
}

.c-imp-sum {
  display: flex;
  gap: 24px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.c-imp-sum > div {
  font-size: 12px;
  color: var(--text-soft);
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.c-imp-sum .n {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.c-imp-sum .bad .n {
  color: var(--st-lapsed);
}

.c-imp-table td {
  vertical-align: top;
  font-size: 12.5px;
  line-height: 1.5;
}

.c-imp-table .s {
  display: block;
  font-size: 11px;
  color: var(--text-soft);
}

.c-imp-line {
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.c-imp-row.refused {
  background: color-mix(in srgb, var(--st-lapsed) 6%, transparent);
}

.c-imp-row.unchanged {
  opacity: 0.62;
}

/* A note's own words, marked as quoted text rather than as our prose —
   what is written here is what will be on the duty forever. */
.c-quote {
  font-style: italic;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.c-imp-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

/* A second step that is deliberately quieter than the first. Citing a new
   instrument is legitimate and rare; it should not compete with choosing
   one that is already on the register. */
.c-linkbtn {
  background: none;
  border: 0;
  padding: 4px 0 0;
  font: inherit;
  font-size: 12px;
  color: var(--text-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.c-linkbtn:hover,
.c-linkbtn:focus-visible {
  color: var(--text);
}

/* The countersignature readout. Two columns so the eye can run down the
   labels, and the free-text fields wrap rather than truncate — a truncated
   isolation is worse than no isolation, because it reads as complete. */
.c-readout {
  border-top: 1px solid var(--line);
  margin: 14px 0 16px;
}

.c-read {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

.c-read-k {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.c-read-v {
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.c-read-v.is-none {
  color: var(--text-soft);
  font-style: italic;
}

@media (max-width: 560px) {
  .c-read {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.c-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 14px;
}

.c-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text);
}

.c-check input {
  flex: none;
}

/* The inline "add someone" panel. Deliberately not a second dialog: two
   overlays share one z-index, so the later one in the document wins and a
   stacked panel renders behind the editor that opened it. Inline also
   matches what the contract asked for — three fields that never leave the
   modal. */
.c-inline-panel {
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  border-radius: var(--r-sm);
  background: var(--paper);
  padding: 16px 18px 6px;
  margin: 12px 0 0;
  animation: c-panel-in 0.18s ease-out;
}

@keyframes c-panel-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .c-inline-panel {
    animation: none;
  }
}

.c-err {
  color: var(--st-lapsed);
  font-size: 12.5px;
  margin: 10px 0 0;
  line-height: 1.5;
}

.c-ok {
  color: var(--st-indate);
  font-size: 12.5px;
  margin: 10px 0 0;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ *
 * Responsive — contract §6: the name column narrows, the instrument
 * line hides, nothing else changes.
 * ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .c-posture {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

/* Below the shell's own breakpoint the rail is hidden by portal.css, so the
   hamburger is the only way back to it. Without one, a domain's screens are
   unreachable on a phone — which is where a duty gets checked. */
@media (max-width: 980px) {
  .c-rail-empty {
    color: #b3bac2;
  }

  #c-sidebar.m-open nav {
    overflow-y: auto;
  }
}

@media (max-width: 640px) {
  .c-body {
    padding: 18px 14px 50px;
  }

  .topbar {
    flex-wrap: wrap;
    padding: 12px 14px;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .top-actions .lbl {
    display: none;
  }

  .c-axis,
  .c-lane {
    grid-template-columns: 126px 1fr;
    gap: 10px;
  }

  .c-lane-nm .i {
    display: none;
  }

  .c-kv {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }

  .c-kv dd {
    margin-bottom: 8px;
  }

  .c-holder-row {
    grid-template-columns: 1fr auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .c-card,
  .c-ring-arc {
    transition: none;
  }

  .c-card:hover {
    transform: none;
  }
}

/* ---------------- evacuation and roll call (WP-C10) -------------------
   Read at an assembly point, on a tablet, by somebody with three hundred
   people looking at them. Larger type, higher contrast, nothing that
   animates — a marshal tapping a name needs the row to change immediately
   and everything else to stay still. */
.c-drill-head {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-left: 4px solid var(--st-due);
  border-radius: var(--r-sm);
  padding: 18px 20px;
  margin: 0 0 20px;
  background: var(--paper-2);
}

.c-drill-head.is-live {
  border-left-color: var(--st-lapsed);
}

.c-drill-head h2 {
  font-family: var(--display);
  font-size: 20px;
  margin: 4px 0 4px;
  letter-spacing: -0.01em;
}

.c-drill-counts {
  display: flex;
  gap: 22px;
}

.c-drill-counts > div {
  font-size: 11.5px;
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
}

.c-drill-counts .n {
  font-family: var(--display);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.05;
  color: var(--text);
}

.c-drill-counts .bad .n {
  color: var(--st-lapsed);
}

.c-drill-counts .good .n {
  color: var(--st-indate);
}

.c-drill-bar {
  display: flex;
  gap: 10px;
  margin: 0 0 22px;

  /* Wraps rather than overflowing. On a phone these buttons sit under a
   * certificate somebody is about to print, and a row that runs off the
   * side of the screen puts half of one of them out of reach. */
  flex-wrap: wrap;
}

.c-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-soft);
  margin-left: 6px;
}

.c-roll-row.is-safe {
  opacity: 0.6;
}

.c-roll-actions {
  white-space: nowrap;
}

.c-roll-actions .btn {
  margin-left: 6px;
}

.c-roll-actions .btn:first-child {
  margin-left: 0;
}

/* ---- the drill certificate as a document (WP-C14) --------------------
 *
 * Two renderings of one artefact: on screen, so the building team can read
 * what they are about to publish; on paper, so an occupier can hand it to
 * an auditor. They are the same markup, and they must stay legible in
 * black on white — a certificate is not a dashboard.
 */

.c-cert {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 34px 36px 30px;
  max-width: 46rem;
  color: #1a1e24;
}

.c-cert-head {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid var(--brass);
  padding-bottom: 14px;
  margin-bottom: 22px;
}

.c-cert-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #0e1116;
  color: var(--brass);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  flex: none;
}

.c-cert-org {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  flex: 1 1 auto;
}

.c-cert-org b {
  font-size: 15px;
}

.c-cert-org span {
  font-size: 12.5px;
  color: var(--text-soft);
}

.c-cert-ref {
  font-size: 11.5px;
  color: var(--text-soft);
  white-space: nowrap;
}

.c-cert-title {
  font-size: 21px;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.c-cert-for {
  margin: 0 0 4px;
  font-size: 15px;
}

.c-cert-article {
  margin: 0 0 24px;
  font-size: 12.5px;
  color: var(--text-soft);
}

.c-cert-facts {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: 9px 18px;
  margin: 0 0 24px;
  font-size: 14.5px;
}

.c-cert-facts dt {
  color: var(--text-soft);
  font-size: 13px;
}

.c-cert-facts dd {
  margin: 0;
}

.c-cert-statement {
  border-left: 3px solid var(--line);
  padding: 2px 0 2px 14px;
  margin: 0 0 26px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
}

.c-cert-foot {
  display: flex;
  gap: 30px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  flex-wrap: wrap;
}

.c-cert-sign {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--text-soft);
  flex: 1 1 15rem;
}

.c-cert-sign b {
  font-size: 15px;
  color: #1a1e24;
  margin-bottom: 3px;
}

.c-cert-check {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-soft);
  flex: 0 1 15rem;
  line-height: 1.5;
}

/* Sized in absolute units rather than as a proportion of anything: this
 * ends up on paper, where 108px is about 28mm, which is comfortably above
 * the size a phone camera reads a code of this density from arm's length. */
.c-cert-qr svg {
  width: 108px;
  height: 108px;
  display: block;
}

.c-cert-url {
  overflow-wrap: anywhere;
  font-size: 10.5px;
}

/* On a phone the two-column reading fails: a 15rem label column leaves so
 * little for the value that "4 minutes 12 seconds" sets one word per line.
 * Label above value reads properly, and it is what the printed sheet falls
 * back to on a narrow paper size too. */
@media (max-width: 44rem) {
  .c-cert {
    padding: 24px 20px 22px;
  }

  .c-cert-facts {
    grid-template-columns: 1fr;
    gap: 1px 0;
  }

  .c-cert-facts dt {
    margin-top: 12px;
  }

  .c-cert-facts dt:first-of-type {
    margin-top: 0;
  }

  .c-cert-foot {
    gap: 22px;
  }
}

#cert-print {
  display: none;
}

@media print {
  /* portal.css blanks the shell for printing; the certificate is what
   * replaces it, and only while a certificate is actually being printed. */
  body.c-printing #cert-print {
    display: block !important;
  }

  #cert-print .c-cert {
    border: 0;
    padding: 0;
    max-width: none;
    color: #111;
    font-family: Georgia, 'Times New Roman', serif;
  }

  #cert-print .c-cert-mark {
    background: #0e1116;
    color: #c8a24b;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  #cert-print .c-cert-head {
    border-bottom-color: #c8a24b;
  }

  #cert-print .c-cert-facts dt,
  #cert-print .c-cert-statement,
  #cert-print .c-cert-sign,
  #cert-print .c-cert-check,
  #cert-print .c-cert-org span,
  #cert-print .c-cert-ref,
  #cert-print .c-cert-article {
    color: #3c444e;
  }

  #cert-print .c-cert-foot {
    page-break-inside: avoid;
    break-inside: avoid;
  }
}
