/* Tortuga QC design system. Rules: .claude/skills/tortuga-ui/SKILL.md
   All colors are tokens on :root; dark mode redefines them. */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("../vendor/fonts/ibm-plex-sans-latin-wght-normal.b2c9031d9fd6.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../vendor/fonts/ibm-plex-sans-latin-wght-italic.ed273b4064f8.woff2") format("woff2");
  font-weight: 100 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;

  --bg: #efefef;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --border: #dadada;
  --border-strong: #b9b9b9;
  --text: #1a1a1a;
  --text-2: #4d4d4d;
  --text-3: #686868;

  /* Monochrome: ink is the only accent, for actions, links and focus. */
  --accent: #1c1c1c;
  --accent-hover: #363636;
  --accent-soft: #e9e9e9;
  --accent-text: #1c1c1c;

  /* Status colors carry meaning only (see .claude/skills/tortuga-ui). */
  --ok: #17703d;
  --ok-soft: #e4f2e9;
  --warn: #92560a;
  --warn-soft: #fbf0dc;
  --danger: #b42318;
  --danger-soft: #fbe8e6;

  --sidebar-bg: #f7f7f7;
  --sidebar-text: #2e2e2e;
  --sidebar-muted: #686868;
  --sidebar-hover: #ebebeb;
  --sidebar-active: #e4e4e4;

  --radius: 3px;
  --radius-sm: 2px;
  --shadow: none;
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 0.14);
  --sidebar-w: 236px;
  --on-accent: #ffffff;
  --on-warn: #ffffff;
  --sig-paper: #fcfcfa; /* signature box: light paper in both themes */
  --sig-rule: #b9bab5;
  --paper: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141518;
    --surface: #1b1d21;
    --surface-2: #212328;
    --border: #2e3137;
    --border-strong: #454950;
    --text: #dcdde0;
    --text-2: #b2b5ba;
    --text-3: #8f9298;
    --accent: #d6d8db;
    --accent-hover: #e8e9eb;
    --accent-soft: #2a2d33;
    --accent-text: #e6e7e9;
    --ok: #6cc995;
    --ok-soft: #12261b;
    --warn: #e0ad5c;
    --warn-soft: #2a1f0e;
    --danger: #ef8a80;
    --danger-soft: #2d1513;
    --sidebar-bg: #17181b;
    --sidebar-text: #c8cace;
    --sidebar-muted: #8f9298;
    --sidebar-hover: #212328;
    --sidebar-active: #2a2d33;
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.5);
  --on-accent: #141518;
  --on-warn: #141518;
  --paper: #e2e2de;
}
}

:root[data-theme="dark"] {
  --bg: #141518;
  --surface: #1b1d21;
  --surface-2: #212328;
  --border: #2e3137;
  --border-strong: #454950;
  --text: #dcdde0;
  --text-2: #b2b5ba;
  --text-3: #8f9298;
  --accent: #d6d8db;
  --accent-hover: #e8e9eb;
  --accent-soft: #2a2d33;
  --accent-text: #e6e7e9;
  --ok: #6cc995;
  --ok-soft: #12261b;
  --warn: #e0ad5c;
  --warn-soft: #2a1f0e;
  --danger: #ef8a80;
  --danger-soft: #2d1513;
  --sidebar-bg: #17181b;
  --sidebar-text: #c8cace;
  --sidebar-muted: #8f9298;
  --sidebar-hover: #212328;
  --sidebar-active: #2a2d33;
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.5);
  --on-accent: #141518;
  --on-warn: #141518;
  --paper: #e2e2de;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 15px; height: 15px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- App shell ---------- */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--frost-side);
  -webkit-backdrop-filter: blur(var(--frost-blur)) saturate(1.25);
  backdrop-filter: blur(var(--frost-blur)) saturate(1.25);
  border-right: 1px solid var(--border);
  color: var(--sidebar-text);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 10px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 15px;
}
.brand-name { font-weight: 600; font-size: 14.5px; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: var(--sidebar-muted); }

.nav { padding: 6px 10px 16px; flex: 1; }
.nav-group { margin-top: 12px; }
.nav-label {
  padding: 0 10px 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--sidebar-muted);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-weight: 500;
}
a.nav-item:hover { background: var(--sidebar-hover); text-decoration: none; color: var(--text); }
.nav-item[aria-current="page"] {
  background: var(--sidebar-active); color: var(--accent-text); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item.is-planned { color: var(--sidebar-muted); cursor: default; font-weight: 400; }
.nav-item.is-planned .icon { opacity: 0.6; }

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 8px 12px 14px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--sidebar-muted);
}
.sidebar-foot .user-chip { flex: 1; min-width: 0; padding-left: 0; }
.sidebar-foot .user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

.main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh;
  /* The work area is one sheet of frosted glass: the oil shows through as a soft glow,
     and the panels sit on it together instead of floating over a background. */
  background: var(--frost);
  -webkit-backdrop-filter: blur(var(--frost-blur)) saturate(1.25);
  backdrop-filter: blur(var(--frost-blur)) saturate(1.25);
}

.dev-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--warn-soft);
  color: var(--warn);
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: none; /* phones and tablets only; see the responsive rules */
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 420px;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-3);
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}
.search input:disabled { cursor: not-allowed; }
.kbd {
  font-size: 11px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-3);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.menu-btn { display: none; }
.topbar-brand { font-weight: 600; color: var(--text); }

.content { width: 100%; padding: 28px clamp(20px, 2.5vw, 40px); } /* full screen width */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-head p { margin-top: 4px; color: var(--text-2); }
/* Breadcrumb above a page title: plain links, sentence case. */
.crumbs { margin-bottom: 4px; font-size: 13px; color: var(--text-3); }
.crumbs a { color: var(--text-2); }
.crumbs .sep { margin: 0 6px; color: var(--border-strong); }

/* ---------- Components ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head p { color: var(--text-3); font-size: 12.5px; }
.card-body { padding: 16px 18px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.module-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
}
.module-card p { color: var(--text-2); font-size: 13px; }
.module-card .meta { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 7px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot-danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-top: 1px solid var(--border);
}
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .sub { color: var(--text-3); font-size: 12.5px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th {
  text-align: left;
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-strong);
}
td { padding: 9px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }

/* Phase timeline */
.phases { list-style: none; margin: 0; padding: 0; }
.phase {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.phase:first-child { border-top: 0; }
.phase-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 650;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.phase.is-current .phase-num { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.phase .sub { color: var(--text-3); font-size: 12.5px; }

/* Status banner */
.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  margin-bottom: 16px;
}
.status-line.ok { background: var(--ok-soft); color: var(--ok); }
.status-line.fail { background: var(--danger-soft); color: var(--danger); }

.skeleton { color: var(--text-3); padding: 14px 18px; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 550; font-size: 13px; }
.help { color: var(--text-3); font-size: 12px; }
.error { color: var(--danger); font-size: 12.5px; font-weight: 550; }

input[type="text"], input[type="password"], input[type="email"], input[type="search"]:not(.search input),
input[type="date"], input[type="number"], select, textarea {
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
textarea { height: auto; padding: 8px 11px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.has-error input { border-color: var(--danger); }
.auth-card input[inputmode="numeric"] { font-family: var(--mono); font-size: 18px; letter-spacing: 0.3em; height: 44px; }

.btn-block { justify-content: center; width: 100%; height: 40px; }
.link-btn {
  border: 0; background: none; padding: 0; color: var(--accent-text);
  font: inherit; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.alert {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px;
  font-weight: 550; font-size: 13px;
  background: var(--accent-soft); color: var(--accent-text);
}
.alert-danger, .alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }

.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sub { color: var(--text-3); font-size: 12.5px; }

/* ---------- Sign-in pages ---------- */

/* ---------- Sign-in pages ----------
   Split screen: a crisp grating panel with the name on a solid plate (like a figure
   standing on the grate), and the form on a plain surface. */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; background: var(--surface); }
.auth-split {
  flex: 1; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 0;
  position: relative; background: var(--bg);
}
/* The page follows the light or dark theme like the app. The oil runs from the left and
   fades out before the form, so there is no edge anywhere. */
.auth-art { grid-column: 1 / -1; grid-row: 1; position: relative; overflow: hidden; color: var(--text); }
/* Oil on water (templates/includes/oil.html): thin-film bands in patches, faint. */
.auth-art .oil {
  position: absolute; top: -8%; left: -6%; width: 72%; height: 116%;
  opacity: var(--oil-signin); mix-blend-mode: var(--oil-blend);
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 45%, transparent 96%);
  mask-image: linear-gradient(to right, #000 0%, #000 45%, transparent 96%);
  animation: oil-drift 90s ease-in-out infinite alternate, oil-sheen 53s ease-in-out infinite alternate;
}
.shell { position: relative; z-index: 1; }
.auth-wordmark { position: absolute; left: 48px; bottom: 48px; z-index: 1; display: flex; align-items: center; gap: 16px; }
.auth-wordmark .brand-mark { width: 44px; height: 44px; font-size: 22px; }
.auth-wordmark-name { font-size: 34px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.05; }
.auth-wordmark-sub { font-size: 14px; opacity: 0.7; margin-top: 4px; }
.auth-panel {
  grid-column: 2; grid-row: 1; position: relative; z-index: 2;
  display: flex; flex-direction: column; justify-content: center; gap: 28px;
  padding: 48px clamp(24px, 7vw, 112px);
}
.auth-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.auth-card .btn-block { height: 42px; margin-top: 4px; }
.auth-card input[type="text"], .auth-card input[type="password"] { height: 40px; }
.auth-alt { text-align: left; }
.auth-foot { color: var(--text-3); font-size: 12px; margin: 0; }
@media (max-width: 860px) {
  .auth-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; }
  .auth-art { grid-column: 1; grid-row: 1; }
  .auth-panel { grid-column: 1; grid-row: 2; padding: 28px 20px; }
  .auth-art { min-height: 160px; }
  .auth-wordmark { left: 20px; bottom: 20px; }
  .auth-wordmark-name { font-size: 24px; }
  .auth-panel { justify-content: flex-start; }
}

.step-pill {
  align-self: flex-start; font-size: 11.5px; font-weight: 600; color: var(--accent-text);
  background: var(--accent-soft); padding: 2px 8px; border-radius: var(--radius-sm);
}
.setup-steps { margin: 0; padding-left: 20px; color: var(--text-2); }
.qr {
  align-self: center; padding: 10px; background: #fff; border-radius: var(--radius);
  border: 1px solid var(--border); line-height: 0;
}
.qr svg { width: 184px; height: 184px; }
.secret summary { cursor: pointer; color: var(--accent-text); font-size: 13px; }
.secret code { display: block; margin-top: 8px; word-break: break-all; padding: 8px; background: var(--surface-2); border-radius: var(--radius); }

/* ---------- Topbar user ---------- */

.user-chip { display: inline-flex; align-items: center; gap: 8px; padding-left: 6px; }
.avatar {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; font-weight: 650;
}
.user-name { font-weight: 550; }

/* ---------- Audit trail ---------- */

.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px; margin-bottom: 16px;
}
.filters .grow { flex: 1 1 260px; width: auto; }
.events td { font-size: 13px; }
.events .reason { color: var(--text-2); font-style: italic; margin-bottom: 4px; }
.changes summary { cursor: pointer; color: var(--accent-text); font-size: 12.5px; }
.changes dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 12.5px; }
.changes dt { color: var(--text-3); font-family: var(--mono); }
.changes dd { margin: 0; word-break: break-word; }
.changes .old { color: var(--danger); text-decoration: line-through; }
.changes .new { color: var(--ok); }
.empty { text-align: center; color: var(--text-3); padding: 28px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; border-top: 1px solid var(--border); }

.icon-tile {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent-text); flex: none;
}
.icon-tile.sm { width: 28px; height: 28px; border-radius: var(--radius); }
.icon-tile.lg { width: 52px; height: 52px; border-radius: var(--radius); }
.export-label { vertical-align: middle; margin-left: 6px; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 12px; padding: 80px 16px; color: var(--text-2);
}
.empty-state h1 { color: var(--text); }

@media (max-width: 760px) {
  .user-name { display: none; }
}

/* ---------- Document control ---------- */

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-section { padding: 14px 18px; border-top: 1px solid var(--border); }
.card-section h3 { margin-bottom: 8px; }
.workflow .card-body { padding-bottom: 14px; }
.sign-form { gap: 10px; }
.sign-meaning {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; font-weight: 550;
}
.sign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-card { max-width: 820px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; }
.readers summary { cursor: pointer; color: var(--accent-text); font-size: 13px; font-weight: 550; }
.check-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.check-columns .field > div { display: flex; flex-direction: column; gap: 4px; }
.check-columns label { font-weight: 400; display: inline-flex; gap: 6px; align-items: center; }
.check-columns .field > label { font-weight: 550; }
.upload-row { display: flex; gap: 8px; align-items: center; padding: 10px 18px 0; flex-wrap: wrap; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input { width: 160px; height: 30px; }
.inline-form .btn { height: 30px; padding: 0 10px; }
.task-alert { justify-content: space-between; flex-wrap: wrap; }
.task-alert form { margin-left: auto; }
.obsolete-banner {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 14px 18px;
  border-radius: var(--radius); border: 2px solid var(--danger);
  background: var(--danger-soft); color: var(--danger); font-weight: 650; letter-spacing: 0.02em;
}
.my-work { margin-bottom: 16px; }
h3 a { color: inherit; }

@media (max-width: 760px) {
  .sign-grid, .form-row, .check-columns { grid-template-columns: 1fr; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgb(0 0 0 / 0.4);
  }
  .menu-btn { display: inline-grid; }
  .topbar { display: flex; padding: 0 12px; height: 52px; }
  .shell { background: none; }
  .content { padding: 20px 16px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .kbd { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; }
}

.doc-number { font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 4px; }
.card-section .upload-row { padding: 10px 0 0; }
.card-section .list-row { padding-left: 0; padding-right: 0; }
input[type="file"] { font: inherit; font-size: 13px; color: var(--text-2); }
input[type="file"]::file-selector-button {
  height: 32px; padding: 0 12px; margin-right: 10px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer;
}

.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.file-actions { display: flex; gap: 6px; }
.content.wide { max-width: none; padding-bottom: 12px; }
.editor-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.editor-head h1 { font-size: 17px; }
.editor-head .grow { flex: 1; min-width: 200px; }
.office-frame {
  display: block; width: 100%; height: calc(100vh - 190px); min-height: 480px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}

/* ---------- Document page and editor ---------- */

.doc-head h1 { font-size: 21px; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; color: var(--text-2); }
.rev-tabs { display: flex; gap: 4px; margin: -6px 0 14px; border-bottom: 1px solid var(--border); }
.rev-tabs a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent;
  margin-bottom: -1px; text-decoration: none;
}
.rev-tabs a:hover { color: var(--text); }
.rev-tabs a[aria-current="page"] { color: var(--accent-text); border-bottom-color: var(--accent); }
.rev-tabs .count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-sm); background: var(--warn); color: var(--on-warn); font-size: 11px; font-weight: 600;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 24vw, 440px); gap: 16px; align-items: start; }
.viewer { overflow: hidden; }
.viewer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.viewer-actions { display: flex; gap: 6px; }
.draft-ribbon {
  padding: 6px 16px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 600;
}
.paper {
  max-width: 820px; margin: 0 auto; padding: 44px 56px 56px; background: var(--paper); color: #111;
  font-size: 14.5px; line-height: 1.6; min-height: 60vh;
}
.viewer .paper { box-shadow: none; }
.paper h1 { font-size: 24px; margin: 0 0 14px; }
.paper h2 { font-size: 18px; margin: 22px 0 8px; }
.paper h3 { font-size: 15.5px; margin: 18px 0 6px; }
.paper h4 { font-size: 14.5px; margin: 14px 0 6px; }
.paper p { margin: 0 0 8px; }
.paper ul, .paper ol { margin: 0 0 8px; padding-left: 24px; }
.paper li p { margin: 0 0 2px; }
.paper blockquote { margin: 8px 0; padding: 6px 14px; border-left: 3px solid #c7cdd6; color: #374151; }
.paper table { border-collapse: collapse; width: 100%; margin: 8px 0 14px; table-layout: fixed; }
.paper th, .paper td { border: 1px solid #c7cdd6; padding: 6px 8px; vertical-align: top; text-transform: none;
  letter-spacing: 0; font-size: 14px; color: #111; background: var(--paper); }
.paper th { background: color-mix(in srgb, var(--paper) 93%, #5f6670); font-weight: 650; }
.paper td p, .paper th p { margin: 0; }
.paper a { color: #1d4ed8; }
.paper.is-obsolete { opacity: 0.75; }
.preview-frame { display: block; width: 100%; height: 78vh; border: 0; background: var(--surface-2); }
.viewer-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 70px 16px; text-align: center; }
.side .card-head { padding: 12px 16px; }
.btn-col { display: flex; flex-direction: column; gap: 8px; }
.btn-col .btn { justify-content: center; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; padding: 14px 16px; font-size: 13px; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; }
.file-row { align-items: flex-start; }
.file-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; align-items: center; }
.link-sm { font-size: 12.5px; color: var(--accent-text); cursor: pointer; }
.remove-file summary { list-style: none; }
.remove-file[open] summary { margin-bottom: 6px; }
.doc-table .row-title { color: var(--text); font-weight: 550; }
.doc-table .doc-number { font-size: 13px; }
.start-choice ul, .start-choice div > div { display: flex; flex-direction: column; gap: 6px; padding: 0; margin: 0; list-style: none; }
.start-choice label { font-weight: 400; display: inline-flex; gap: 8px; align-items: center; }
.start-choice > label { font-weight: 550; }

.dialog {
  width: min(520px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialog-wide { width: min(760px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgb(15 23 42 / 0.45); }
.dialog h2 { font-size: 17px; }

.editor-shell { display: flex; flex-direction: column; gap: 10px; }
.editor-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.editor-top h1 { font-size: 17px; }
.editor-top .grow { flex: 1; min-width: 220px; }
.save-status { font-size: 12.5px; color: var(--text-3); min-width: 120px; text-align: right; }
.save-status[data-kind="dirty"] { color: var(--warn); }
.save-status[data-kind="saving"] { color: var(--accent-text); }
.save-status[data-kind="error"] { color: var(--danger); font-weight: 600; }
.editor-toolbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow);
}
.ed-group { display: flex; gap: 2px; padding-right: 6px; border-right: 1px solid var(--border); }
.ed-group:last-child { border-right: 0; }
.ed-btn {
  min-width: 32px; height: 30px; padding: 0 8px; border: 0; border-radius: var(--radius); background: transparent;
  color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer;
}
.ed-btn:hover:not(:disabled) { background: var(--surface-2); }
.ed-btn.is-active { background: var(--accent-soft); color: var(--accent-text); }
.ed-btn:disabled { color: var(--text-3); cursor: default; }
.ed-style { height: 30px; padding: 0 8px; font-size: 13px; }
.editor-canvas { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 12px; }
.editor-paper { box-shadow: var(--shadow); border-radius: var(--radius); }
.editor-paper .tiptap { outline: none; min-height: 60vh; }
.editor-paper .tiptap p.is-editor-empty:first-child::before {
  content: attr(data-placeholder); color: #9ca3af; float: left; height: 0; pointer-events: none;
}
.editor-paper .selectedCell { background: #e8eefc; }

@media (max-width: 1080px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .paper { padding: 24px 18px; }
  .editor-toolbar { top: 0; }
}
.facts dd, .file-row .grow { min-width: 0; overflow-wrap: anywhere; }

/* ---------- House document format ---------- */

.paper { font-family: Arial, "Liberation Sans", Helvetica, sans-serif; }
.doc-masthead {
  display: flex; align-items: center; gap: 14px; padding-bottom: 10px; margin-bottom: 22px;
  border-bottom: 1.5px solid #1f2937; color: #111;
}
.mh-logo { height: 46px; width: auto; flex: none; }
.mh-title { flex: 1; min-width: 0; font-size: 14px; }
.mh-rev { text-align: right; font-size: 13px; white-space: nowrap; }
.mh-sub { color: #6b7280; font-size: 11.5px; margin-top: 2px; }
.doc-footer {
  margin-top: 36px; padding-top: 8px; border-top: 1px solid #d1d5db;
  color: #6b7280; font-size: 11.5px; font-weight: 600;
}
.paper-sheet { max-width: 1100px; }
.sheet-view { overflow-x: auto; }
table.sheet { border-collapse: collapse; table-layout: fixed; width: auto; margin: 0 0 14px; }
table.sheet td {
  border: 1px solid #c7cdd6; padding: 4px 6px; vertical-align: top; font-size: 13px; color: #111;
  background: var(--paper); overflow-wrap: anywhere; text-transform: none; letter-spacing: 0;
}
.sheet-name { font-size: 14px; margin: 14px 0 6px; }
.sheet-canvas {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px;
  overflow: auto; color: #111;
}
.convert-form { margin-top: 2px; }
.section-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.section-chips a {
  padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-weight: 550; text-decoration: none;
}
.section-chips a span { color: var(--text-3); margin-left: 4px; }
.section-chips a:hover { border-color: var(--accent); color: var(--accent-text); }
.doc-section { margin-bottom: 16px; scroll-margin-top: 70px; }
.doc-section .card-head h2 .sub { margin-left: 6px; font-weight: 500; }
.doc-table .col-number { width: 110px; }

/* Word nests lists inside empty list items; hide those empty bullet levels. */
.paper li:not(:has(> p)):has(> ul, > ol) { list-style: none; }
.doc-table { table-layout: fixed; }
.doc-table th:nth-child(3), .doc-table td:nth-child(3) { width: 90px; }
.doc-table th:nth-child(4), .doc-table td:nth-child(4) { width: 130px; }
.doc-table th:nth-child(5), .doc-table td:nth-child(5) { width: 240px; }
.doc-table th:nth-child(6), .doc-table td:nth-child(6) { width: 90px; }
.sheet-canvas .jss_worksheet tbody td:not(.jss_row) { text-align: left; vertical-align: top; }

/* Approval pipeline: sign-off checklist on the document page */
.signoff-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.signoff { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.signoff .sub { color: var(--text-3); font-size: 12.5px; }
.signoff-name { font-weight: 600; font-size: 13.5px; }
.signoff-mark { flex: none; width: 22px; height: 22px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.signoff.is-signed .signoff-mark { background: var(--ok-soft); color: var(--ok); }
.signoff.is-current { border-color: var(--warn); background: var(--warn-soft); }
.signoff.is-current .signoff-mark { background: var(--warn); color: #fff; }

/* ---------- Settings (admins only) ---------- */

.settings-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.settings-item {
  display: grid; grid-template-columns: 260px 1fr auto; gap: 4px 20px; align-items: baseline;
  padding: 14px 18px; border-top: 1px solid var(--border); color: var(--text); text-decoration: none;
}
.settings-item:first-child { border-top: 0; }
.settings-item:hover { background: var(--surface-2); text-decoration: none; }
.settings-name { font-weight: 600; color: var(--accent-text); }
.settings-desc { color: var(--text-2); }
.settings-meta { color: var(--text-3); font-size: 12.5px; }
.settings-advanced { margin-top: 28px; }
.settings-advanced h2 { font-size: 16px; margin: 0 0 4px; }
.settings-advanced > p { margin: 0 0 12px; max-width: 72ch; }
.settings-table td { vertical-align: top; }
.settings-table select { width: 100%; max-width: 320px; }
.row-title { color: var(--text); font-weight: 600; }
.step-summary { margin: 0; padding-left: 18px; }
.step-summary li + li { margin-top: 2px; }

.settings-form { display: flex; flex-direction: column; gap: 0; }
.form-section { display: grid; grid-template-columns: clamp(220px, 18vw, 320px) minmax(0, 1fr); gap: 32px; padding: 22px 0; border-top: 1px solid var(--border); }
.form-section:first-of-type { border-top: 0; padding-top: 4px; }
.form-section-head h2 { font-size: 15px; }
.form-section-head p { margin-top: 6px; color: var(--text-2); font-size: 13px; }
.form-section-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.form-section-last { grid-template-columns: minmax(0, 1fr); }
.settings-form .card + .form-section { border-top: 0; }
.field-label { font-weight: 550; font-size: 13px; }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field legend { font-weight: 550; font-size: 13px; padding: 0; margin-bottom: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips > div { display: contents; }
.chip-check {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  font-size: 13px; cursor: pointer; user-select: none;
}
.chip-check input { margin: 0; accent-color: var(--accent); }
.chip-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 550; }
.chip-check:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.step-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.step-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 14px; align-items: start;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.step-row.has-error { border-color: var(--danger); }
.step-num {
  display: grid; place-items: center; width: 26px; height: 26px; margin-top: 22px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 13px;
}
.step-fields { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.step-line { display: flex; gap: 12px; flex-wrap: wrap; }
.step-line .grow { flex: 1 1 220px; }
.step-tools { display: flex; align-items: center; gap: 4px; margin-top: 21px; }
.step-tools .btn:disabled { opacity: 0.4; cursor: default; background: var(--surface); }
.step-tools [data-action="step-remove"] { margin-left: 6px; }
.facts-plain { padding: 0; }

@media (max-width: 900px) {
  .form-section { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .settings-item { grid-template-columns: 1fr; }
  .step-row { grid-template-columns: 28px minmax(0, 1fr); }
  .step-tools { grid-column: 2; margin-top: 0; }
}

/* Links that are controls or row titles don't carry the underline. */
.nav-item, .btn, .brand, .topbar-brand, .rev-tabs a, .section-chips a, .settings-item,
.doc-number, .row-title, td a, .list-row a { text-decoration: none; }
td a:hover, .list-row a:hover, .row-title:hover, .doc-number:hover { text-decoration: underline; }

/* ---------- Dashboard ---------- */
.work-panel {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 16px;
}
.work-col { min-width: 0; border-left: 1px solid var(--border); }
.work-col:first-child { border-left: 0; }
.work-col h2 { display: flex; align-items: center; gap: 8px; padding: 14px 18px 10px; font-size: 14px; }
.work-col .list-row:first-child { border-top: 1px solid var(--border); }
.count-tag {
  display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.count-tag.is-due { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(360px, 30vw, 520px); gap: 16px; align-items: start; }
.tally { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; }
.tally > div { padding: 14px 18px; border-left: 1px solid var(--border); }
.tally > div:first-child { border-left: 0; }
.tally dt { color: var(--text-3); font-size: 12.5px; }
.tally dd { margin: 2px 0 0; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 1080px) {
  .work-panel, .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .work-col { border-left: 0; border-top: 1px solid var(--border); }
  .work-col:first-child { border-top: 0; }
}

/* Documents list: one table, sections as row groups. */
.doc-table .group-row th {
  padding: 18px 16px 7px; font-size: 13.5px; font-weight: 600; color: var(--text);
  background: var(--surface-2); border-bottom: 1px solid var(--border-strong);
}
.doc-table .group-row th .sub { font-weight: 400; margin-left: 6px; }
.doc-table tbody tr:last-child td { border-bottom: 1px solid var(--border); }
.doc-table tbody:last-child tr:last-child td { border-bottom: 0; }
.doc-section { scroll-margin-top: 16px; }
.filters { border-radius: var(--radius); }


/* ---------- Borders ----------
   One system, so edges look deliberate: every line is 1px.
   - Panels, tables, dividers: --border, all four sides alike.
   - Controls (buttons, inputs, selects, chips): --border-strong.
   - Selected, focused, primary: ink (--accent).
   - Status tags: tinted fill with a thin border in the same status colour.
   Corners: --radius (3px) for panels, --radius-sm (2px) for controls and tags. */
.card, .settings-list, .work-panel, .step-row, .signoff, .filters {
  border: 1px solid var(--border); border-radius: var(--radius);
}
.dialog { border: 1px solid var(--border-strong); border-radius: var(--radius); }
.btn { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.btn:hover { border-color: var(--text-3); }
.btn-primary, .btn-primary:hover { border-color: var(--accent); }
input[type="text"], input[type="password"], input[type="email"], input[type="date"],
input[type="number"], select, textarea, .search {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.search input, .search input:focus { border: 0; box-shadow: none; }
input:focus, select:focus, textarea:focus, .search:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent);
}
.has-error input, .has-error select, .has-error textarea, .step-row.has-error { border-color: var(--danger); }
.badge {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-2);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); border-color: var(--border-strong); }
.count-tag { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.count-tag.is-due { border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.chip-check, .section-chips a { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.chip-check:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.section-chips a:hover { border-color: var(--accent); }
.signoff.is-current { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.avatar { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); }

/* Whole rows act as one button: the row's main link stretches over the row.
   Buttons inside a row (Edit, Review) sit above it and keep their own action. */
.row-link { position: relative; cursor: pointer; }
.row-link:hover > td, li.row-link:hover { background: var(--accent-soft); }
.row-link:hover .row-title, .row-link:hover .stretch { text-decoration: underline; }
.stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.stretch:focus-visible { outline: none; }
.row-link:has(.stretch:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.row-link .btn, .row-link form { position: relative; z-index: 2; }

/* Page headers: the title wraps; the action buttons keep their size on one line and move
   below the title only when the window is too narrow. Nothing gets squeezed or cut off. */
.page-head { flex-wrap: wrap; row-gap: 12px; }
.page-head > div:first-child { flex: 1 1 360px; min-width: 0; }
.page-head > .head-actions { flex: none; flex-wrap: nowrap; }
.pipeline-fact .btn { margin-top: 6px; }

/* About this revision: the change as a headline, the reason under it, the pipeline on
   one line, and other revisions as a compact clickable list. */
.about-body { display: flex; flex-direction: column; }
.about-body > * { padding: 14px 16px; border-top: 1px solid var(--border); }
.about-body > *:first-child { border-top: 0; }
.about-label { font-size: 12.5px; color: var(--text-3); }
.change-title { margin: 0; font-size: 15.5px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.change-why { margin: 4px 0 0; color: var(--text-2); overflow-wrap: anywhere; }
.change-note { margin: 8px 0 0; font-size: 12.5px; color: var(--text-3); }
.about-pipeline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pipeline-name { flex: 1; min-width: 0; font-weight: 550; }
.rev-history summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; list-style: none;
}
.rev-history summary::-webkit-details-marker { display: none; }
.rev-history summary::before {
  content: "+"; display: inline-grid; place-items: center; width: 18px; height: 18px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-weight: 500; color: var(--text-2);
}
.rev-history[open] summary::before { content: "\2212"; }
.rev-history ul { list-style: none; margin: 10px -16px -14px; padding: 0; }
.rev-history-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline;
  padding: 10px 16px; border-top: 1px solid var(--border); color: var(--text); text-decoration: none;
}
.rev-history-row:hover { background: var(--accent-soft); text-decoration: none; }
.rev-history-rev { font-weight: 600; white-space: nowrap; }
.rev-history-text { color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.rev-history-when { font-size: 12.5px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Dashboard modules as large tiles: easy to find, read and click. Live ones first. */
.module-tiles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 16px;
}
.module-tile {
  position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 104px;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text-2); text-decoration: none;
}
.module-tile-name { font-size: 16px; font-weight: 600; line-height: 1.3; }
.module-tile-meta { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.module-tile-state, .module-tile-go { margin-top: auto; font-size: 13px; }
.module-tile-state { color: var(--text-3); }
.module-tile.is-live {
  background: var(--surface); color: var(--text); border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.module-tile.is-live .module-tile-go { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
a.module-tile.is-live:hover { background: var(--accent-soft); text-decoration: none; }
a.module-tile.is-live:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Dashboard rows: counts beside a compact status grid, then the module tiles full width. */
.dash-row { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 2fr); gap: 16px; align-items: stretch; margin-bottom: 16px; }
.dash-row > .card { min-width: 0; }
.status-card .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.status-card .list-row { border-top: 1px solid var(--border); }
.status-card .list-row:first-child { border-top: 1px solid var(--border); }
.status-card .list { margin-top: -1px; }
.modules-card .module-tiles { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 1080px) { .dash-row { grid-template-columns: minmax(0, 1fr); } }
.dash-row-single { grid-template-columns: minmax(0, 1fr); }
.dash-row-single .tally > div { padding: 16px 20px; }
.change-pending { margin: 0; color: var(--text-3); font-size: 13px; }

/* Signature box (SIG-006, SIG-007). The box is always light "paper" with dark ink, in
   both themes, like signing on a printed form. */
@font-face { font-family: "Allura"; src: url("../vendor/fonts/signature/Allura-Regular.c6f8bf4a8d9d.ttf") format("truetype"); font-display: block; }
@font-face { font-family: "Dancing Script"; src: url("../vendor/fonts/signature/DancingScript.02ed13c946ba.ttf") format("truetype"); font-weight: 400 700; font-display: block; }
.sig-pad { display: grid; gap: 8px; }
.sig-tabs { display: flex; gap: 4px; }
.sig-tab { font: inherit; font-size: 13px; padding: 5px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: transparent; color: var(--text-2); cursor: pointer; }
.sig-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sig-box { position: relative; background: var(--sig-paper); border: 1px solid var(--border-strong); border-radius: var(--radius); aspect-ratio: 900 / 240; overflow: hidden; }
.sig-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sig-saved { position: absolute; inset: 12% 4%; width: 92%; height: 76%; object-fit: contain; object-position: left center; }
.sig-line { position: absolute; left: 4%; right: 4%; bottom: 22%; border-bottom: 1px solid var(--sig-rule); pointer-events: none; }
.sig-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sig-tools .hint { color: var(--text-3); font-size: 13px; flex: 1; }
.sig-text { flex: 1; min-width: 160px; }
.sig-error { margin: 0; color: var(--danger); font-size: 13px; }
.printed-name { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.printed-name .about-label { color: var(--text-3); font-size: 13px; }
.sig-record { display: block; max-width: 220px; max-height: 56px; margin: 4px 0 2px; padding: 4px 8px; background: var(--sig-paper); border-radius: var(--radius); }
[hidden] { display: none !important; }
a.user-chip { color: inherit; text-decoration: none; border-radius: var(--radius); }
a.user-chip:hover .user-name { text-decoration: underline; }

/* Compare revisions (DOC-025): a one-column redline that reads as the newer revision.
   Added text is underlined green. Text that replaced old wording, and red cut marks where
   words were taken out, show the old words in a pop-up on hover, focus or tap. Removed
   paragraphs fold into one line that drops down. */
.compare-pick { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 16px; }
.compare-pick .field { margin: 0; min-width: 240px; flex: 1; }
.redline-key { display: inline-flex; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.redline { font-size: 14.5px; line-height: 1.6; }
.redline ins { color: var(--ok); background: var(--ok-soft); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.redline del, .redline-key del { color: var(--danger); background: var(--danger-soft); text-decoration: line-through; }
.redline-key ins { color: var(--ok); background: var(--ok-soft); text-decoration: underline; }
.redline .rl { margin: 0 0 10px; padding-left: 12px; border-left: 3px solid transparent; scroll-margin-top: 80px; }
.redline h3.rl { font-size: 16px; margin-top: 20px; }
.redline .rl-li::before { content: "•"; margin-right: 8px; color: var(--text-3); }
.redline .rl-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); margin-left: 0; padding: 0; }
.redline .rl-row > span { background: var(--paper); padding: 4px 8px; font-size: 13px; }
.redline .rl-added { border-left-color: var(--ok); }
.redline .rl-removed { border-left-color: var(--danger); }
.redline .rl-changed { border-left-color: var(--warn); }
.redline .rl-row.rl-added, .redline .rl-row.rl-removed, .redline .rl-row.rl-changed { border-left-width: 3px; }
.redline .rl:target { outline: 2px solid var(--accent); outline-offset: 2px; }
.change-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.change-list li + li { border-top: 1px solid var(--border); }
.change-list a { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 10px 16px; color: inherit; text-decoration: none; }
.change-list a:hover { background: var(--surface-2); }
.change-list .change-where { font-size: 13px; font-weight: 600; }
.change-list .change-text { grid-column: 2; color: var(--text-3); font-size: 13px; }
.about-compare { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.change-title.is-long { font-size: 14px; font-weight: 500; line-height: 1.5; }
.fill-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: -4px; }
.fill-status { font-size: 13px; }
.settings-form .card + .card { margin-top: 16px; }
.settings-form .form-section + .card { margin-top: 8px; }
.change-list a { grid-template-columns: 76px minmax(0, 1fr); }
.change-list .badge { justify-self: start; }
.redline .rl-row { margin-bottom: -1px; }
.redline .rl-row + .rl:not(.rl-row) { margin-top: 11px; }
/* Pictures (posters, photos) are shown as pictures, not in the PDF viewer. */
.image-view { display: grid; place-items: center; padding: 20px; background: var(--surface-2); min-height: 40vh; }
.image-view img { display: block; max-width: 100%; max-height: 78vh; height: auto; box-shadow: var(--shadow-lg); }

/* Back button above the title on every page that sits below another. */
.back-btn { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 6px -4px; padding: 4px 10px 4px 4px; font: inherit; font-size: 13px; font-weight: 550; color: var(--text-2); background: transparent; border: 1px solid transparent; border-radius: var(--radius); text-decoration: none; cursor: pointer; }
.back-btn:hover { color: var(--text); border-color: var(--border); background: var(--surface); }
.editor-top .back-btn { margin: 0; }

/* Admin menu (History and other admin tools on a record's page). */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; width: 6px; height: 6px; margin-left: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.menu[open] > summary::after { transform: translateY(1px) rotate(225deg); }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 200px; padding: 4px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.menu-list { min-width: 260px; }
.menu-list a, .menu-list button { display: block; width: 100%; padding: 8px 10px; font: inherit; font-size: 14px; text-align: left; color: var(--text); background: none; border: 0; text-decoration: none; border-radius: var(--radius-sm); white-space: nowrap; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); }
.menu-hint { display: block; font-size: 12px; color: var(--text-3); white-space: normal; }

/* In progress list: wider author column so names never run into the status. */
.doc-table.is-progress th:nth-child(3), .doc-table.is-progress td:nth-child(3) { width: 130px; }
.doc-table.is-progress th:nth-child(4), .doc-table.is-progress td:nth-child(4) { width: 220px; }
.doc-table.is-progress th:nth-child(5), .doc-table.is-progress td:nth-child(5) { width: 120px; }
.doc-table.is-progress th:nth-child(6), .doc-table.is-progress td:nth-child(6) { width: 160px; text-align: right; }
.doc-table .author-cell { overflow-wrap: anywhere; }
/* The redline sits on light document paper in both themes, so it keeps the light-theme
   status colours there. */
.paper.redline { --ok: #17703d; --ok-soft: #e4f2e9; --warn: #92560a; --danger: #b42318; --danger-soft: #fbe8e6;
  --text: #111; --text-2: #4b4d53; --text-3: #6b6d73; --border: #d4d5d0; --border-strong: #b9bab5; }

/* Redline pop-ups: the old wording behind changed text (DOC-025). */
.redline .rl-swap { position: relative; cursor: help; border-radius: 2px; }
.redline .rl-swap > ins { text-decoration-style: dashed; }
.redline .rl-swap:hover > ins, .redline .rl-swap:focus > ins { outline: 1px solid var(--ok); }
.redline .rl-swap:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.redline .rl-was { display: none; position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 5; width: max-content; max-width: min(420px, 70vw); padding: 6px 10px; font-size: 13px; line-height: 1.45; color: var(--text); background: var(--paper); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); white-space: normal; }
.redline .rl-swap:hover > .rl-was, .redline .rl-swap:focus > .rl-was, .redline .rl-swap:focus-within > .rl-was { display: block; }
.redline .rl-was-label { font-weight: 600; color: var(--text-2); }
.redline .rl-cut { display: inline-block; width: 9px; height: 9px; margin: 0 2px; vertical-align: 1px; background: var(--danger); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.redline .rl-gone { padding-left: 12px; }
.redline .rl-gone > summary { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--danger); cursor: pointer; }
.redline .rl-gone[open] > summary { margin-bottom: 6px; }
.redline .rl-gone-body { display: grid; gap: 8px; }
.redline .rl-gone-body .rl-old { margin: 0; }

/* Revision history (the changelog) on a document page: every revision, newest first. The
   one on screen is marked and shows its full change note; the others show two lines. */
.rev-log { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow: auto; }
.rev-entry { padding: 12px 16px 12px 13px; border-top: 1px solid var(--border); border-left: 3px solid transparent; }
.rev-entry:first-child { border-top: 0; }
.rev-entry-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rev-entry-name { font-weight: 650; }
.rev-entry-when { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rev-entry-text { margin: 6px 0 4px; color: var(--text-2); font-size: 13.5px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rev-entry-text + .rev-entry-why { margin-top: 2px; }
.rev-compare { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.rev-compare .btn { width: 100%; justify-content: center; height: 36px; }
/* A clearly visible secondary action: accent outline and text, not a filled primary. */
.btn-accent { border-color: var(--accent); color: var(--accent-text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent); }
.btn-accent:hover { background: var(--accent-soft); border-color: var(--accent); }
.rev-entry .change-why, .rev-entry .change-pending { margin: 6px 0 4px; font-size: 13.5px; }
.about-rev > .about-pipeline { padding: 12px 16px; border-top: 1px solid var(--border); }

/* Everyone's / Mine switch on the In progress list. */
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.seg a { padding: 5px 12px; font-size: 13.5px; font-weight: 550; color: var(--text-2); text-decoration: none; border-radius: var(--radius-sm); }
.seg a:hover { color: var(--text); }
.seg a[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.seg-count { margin-left: 4px; font-variant-numeric: tabular-nums; color: var(--text-3); }
/* Dashboard: the link from a short list to the full one. */
.work-more { display: block; padding: 10px 18px 14px; border-top: 1px solid var(--border); font-size: 13.5px; font-weight: 550; }

/* Settings > People: the invitation link, shown once. */
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-family: var(--mono, monospace); font-size: 13px; }
.invite-fresh { border-color: var(--accent); }
.inline-form { display: inline; }
.invite-note { margin: -6px 0 0; }
/* Read-only values in forms (username, invited email) don't look editable. */
.form input[readonly]:not([data-copy-source]) { background: var(--surface-2); color: var(--text-2); border-style: dashed; }
.account-page .card + .card { margin-top: 16px; }
.account-page .sig-record { max-height: 80px; }

/* Redline pop-ups: one floating box, placed by site.js so it is never cut off by the page
   edge. Without JavaScript the inline box (.rl-was) shows instead. Added text is underlined
   solid; changed text (which has old wording to show) dashed. */
.redline .rl-swap > ins { text-decoration-style: solid; }
.redline .rl-swap[tabindex] > ins, .redline-key ins.is-changed { text-decoration-style: dashed; }
.redline.has-tips .rl-swap > .rl-was { display: none; }
.rl-tip {
  position: fixed; z-index: 60; max-width: min(460px, calc(100vw - 16px)); padding: 7px 10px;
  font-size: 13px; line-height: 1.45; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  pointer-events: none; overflow-wrap: anywhere;
}
.rl-tip[hidden] { display: none; }
.rl-tip .rl-was-label { font-weight: 600; color: var(--text-2); }
.rl-tip del { color: var(--danger); background: var(--danger-soft); text-decoration: line-through; }

/* Documents search suggestions. */
.search { position: relative; }
.suggest {
  position: absolute; top: calc(100% + 4px); left: -1px; right: -1px; z-index: 30;
  margin: 0; padding: 4px; list-style: none; max-height: 380px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); color: var(--text);
}
.suggest[hidden] { display: none; }
.suggest a {
  display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; align-items: baseline; gap: 2px 10px;
  padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none;
}
.suggest a:hover, .suggest [aria-selected="true"] a { background: var(--surface-2); }
.suggest .doc-number { font-size: 13px; }
.suggest-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-state { font-size: 12px; color: var(--text-3); }
.suggest-old { grid-column: 2 / -1; font-size: 12px; color: var(--text-3); }
.suggest mark { background: var(--warn-soft); color: inherit; border-radius: 2px; }
.suggest-empty, .suggest-all a { padding: 7px 10px; font-size: 13px; color: var(--text-2); }
.suggest-all { border-top: 1px solid var(--border); margin-top: 4px; }
.suggest-all a { display: block; }

/* Count chips: the font has more room above its capitals than below its baseline, so a
   number centred on its text box sits 1-2px off. Where the browser can trim that room
   (text-box), centre the capitals and digits themselves. Other browsers keep the boxes above. */
@supports (text-box: trim-both cap alphabetic) {
  .rev-tabs a { height: 39px; padding-top: 0; padding-bottom: 0; }
  .rev-tabs a > span, .work-col h2 > span { text-box: trim-both cap alphabetic; }
  .rev-tabs .count { display: block; height: auto; padding: 5px 5px; line-height: 1; text-align: center; }
  .count-tag { display: block; height: auto; padding: 5px 6px; line-height: 1; text-align: center; text-box: trim-both cap alphabetic; }
  .section-chips a { padding-top: 9px; padding-bottom: 9px; line-height: 1; text-box: trim-both cap alphabetic; }
}

/* Badges hold icons as well as text, so they stay flex boxes: their text is lowered by the
   ~0.75px that IBM Plex Sans sits high in a flex-centred line (measured); icons stay centred. */
.badge { padding-top: 1.5px; }
.badge > svg { margin-top: -1.5px; }

/* ---------- Maintenance ---------- */
.dash-row-even { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.tally > div.is-bad dd { color: var(--danger); }
.tally > div.is-due dd { color: var(--warn); }
.maint-due { margin-bottom: 16px; }
.maint-due .list-row { gap: 12px; }
.maint-due-date { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.maint-table th:nth-child(3), .maint-table td:nth-child(3) { width: 150px; }
.maint-table th:nth-child(4), .maint-table td:nth-child(4) { width: 230px; }
.maint-table th:nth-child(5), .maint-table td:nth-child(5) { width: 220px; }
.pm-table td { vertical-align: top; }
.pm-table th { white-space: nowrap; }
.pm-table .row-title { font-weight: 550; }
.pm-actions { text-align: right; }
.pm-actions .link-sm { margin-left: 8px; }
.maint-text { overflow-wrap: anywhere; }
.maint-history .list-row { align-items: flex-start; gap: 14px; }
.maint-date { flex: none; width: 84px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; padding-top: 2px; }
.maint-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.card-foot { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--border); }
.form-page { max-width: 760px; padding: 20px; }
.form-page + .form-page { margin-top: 16px; }
.stop-task h2 { font-size: 15px; margin: 0; }


/* ---------- Calibration ---------- */
.cal-table th:nth-child(3), .cal-table td:nth-child(3) { width: 150px; }
.cal-table th:nth-child(4), .cal-table td:nth-child(4) { width: 170px; }
.cal-table th:nth-child(5), .cal-table td:nth-child(5) { width: 120px; }
.import-table th:nth-child(1), .import-table td:nth-child(1) { width: 64px; }
.import-table th:nth-child(2), .import-table td:nth-child(2) { width: auto; }
.import-table th:nth-child(3), .import-table td:nth-child(3) { width: 120px; }
.import-table th:nth-child(4), .import-table td:nth-child(4) { width: 45%; }
.cal-alert { margin-bottom: 16px; border-color: var(--danger); }
th.num, td.num { text-align: right; }
.mono-num { font-variant-numeric: tabular-nums; }
.is-out { color: var(--danger); font-weight: 600; }
.facts-wide { grid-template-columns: 170px 1fr; font-size: 14px; }
.form-wide { max-width: 980px; }
.form-section { font-size: 16px; margin: 10px 0 0; display: flex; align-items: baseline; gap: 10px; }
.form-section .sub { font-size: 13px; font-weight: 400; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-in-card { max-width: none; }
.form-in-card h2 { font-size: 16px; margin: 0; }
.choice-field > div { display: flex; flex-direction: column; gap: 6px; }
.choice-field > div label { font-weight: 400; display: inline-flex; gap: 8px; align-items: center; }
.cal-readings td { vertical-align: middle; }
.cal-readings input.reading { width: 9.5em; font-variant-numeric: tabular-nums; }
.cal-readings select { width: 9.5em; }
.reading-result { font-size: 13px; font-weight: 600; }
.reading-result.is-in { color: var(--ok); }
.reading-result.is-adjusted { color: var(--warn); }
.reading-result.is-out { color: var(--danger); }
.point-editor input { width: 100%; min-width: 6em; }
.point-editor td:first-child input { min-width: 14em; }
.point-editor td:nth-child(6) input { min-width: 4em; width: 5em; }
.import-tally { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.error-text { color: var(--danger); font-weight: 550; font-size: 13px; }
@media (max-width: 760px) { .form-row-3, .import-tally { grid-template-columns: 1fr 1fr; } }
/* A tally label that wraps to two lines keeps its number level with its neighbours. */
.tally > div { display: flex; flex-direction: column; }
.tally > div > dd { margin-top: auto; }
.point-editor td { vertical-align: middle; }
