/* The whole stylesheet, served as it is — no build step. Conventions follow
   risk-assess's (see claude-notes/cladd-app.md): nothing on the page moves
   when something appears, every control is one height, and colour lives in
   the tokens below.

   The palette is Dan's mockup's (https://claude.ai/artifact/7qGy5De1orRbUgtSVqHUA2),
   which is dark only — so there's one palette, not a light one and a dark
   one: a near-black page, cards a step lighter (#17171A, #26262A border),
   form fields back at the page colour inside them, and safety orange. */
:root {
  --text: #c9c9cc;
  --text-h: #f5f5f0;
  --text-muted: #9a9a9e;
  --bg: #0e0e10;
  /* Cards and tiles. */
  --surface: #17171a;
  /* A card's header and footer strips, a step off the card. */
  --bg-alt: #141416;
  --border: #26262a;
  --accent: #ff5a1f;
  --accent-text: #fff;
  --error: #f85149;

  --row-pass: #16271b;
  --row-pending: #2b2418;
  --row-attention: #321c1e;
  --row-inactive: #1a1a1d;
  --row-hover: #3a2115;

  --radius: 16px;

  --sans: system-ui, 'Segoe UI', Roboto, sans-serif;
  font: 16px/1.5 var(--sans);
  color-scheme: dark;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
/* The scrollbar's space is always reserved, so a page that grows past the
   bottom doesn't shift sideways as the bar appears. */
html { scrollbar-gutter: stable; overflow-y: scroll; }
h1, h2, h3, h4 { color: var(--text-h); font-weight: 600; margin: 0 0 8px; }
h1 { font-size: 26px; }
a { color: var(--accent); }
.muted { color: var(--text-muted); font-size: 14px; margin: 2px 0; }
.muted-inline { color: var(--text-muted); font-weight: 400; }

.app-shell { min-height: 100svh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; border-bottom: 1px solid var(--border);
}
.topbar-nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.topbar-nav a:not(.brand) { color: var(--text-h); text-decoration: none; }
.topbar-nav a:not(.brand):hover { color: var(--accent); }
.brand { font-weight: 700; font-size: 18px; text-decoration: none; color: var(--accent); letter-spacing: 0.02em; }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 14px; }
@media (max-width: 600px) {
  .topbar { padding: 12px 16px; }
  .topbar-user > span { display: none; }
}

/* Container widths follow Bootstrap's .container ladder: 540 / 720 / 960 /
   1140 / 1320 at its sm/md/lg/xl/xxl breakpoints. */
.content { width: 100%; margin: 0 auto; padding: 24px; flex: 1; }
@media (max-width: 600px) { .content { padding: 16px; } }
@media (min-width: 576px)  { .content { max-width: 540px; } }
@media (min-width: 768px)  { .content { max-width: 720px; } }
@media (min-width: 992px)  { .content { max-width: 960px; } }
@media (min-width: 1200px) { .content { max-width: 1140px; } }
@media (min-width: 1400px) { .content { max-width: 1320px; } }

.link-button {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font-size: 14px; padding: 0; text-decoration: underline; font-family: inherit;
}

/* Both forms of control share every box metric — the transparent border
   included — so a <button> and a .button anchor side by side are exactly
   the same height (41px). */
button:not(.link-button), .button {
  background: var(--accent); color: var(--accent-text);
  border: 1px solid transparent; border-radius: 6px;
  padding: 9px 16px; font-size: 14px; line-height: 1.5; cursor: pointer;
  font-family: inherit;
}
/* .button is the same control rendered as a link, for plain navigation —
   a <button> inside an <a> isn't valid HTML. */
.button { display: inline-block; text-decoration: none; }
button:disabled { opacity: 0.6; cursor: default; }
button.secondary, .button.secondary { background: var(--surface); color: var(--text-h); border-color: var(--border); }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }

.auth-card {
  max-width: 380px; margin: 60px auto; padding: 28px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
}
.auth-subtitle { font-size: 14px; opacity: 0.75; margin-bottom: 16px; }
.auth-switch { margin-top: 16px; }
.demo-hint { margin-top: 20px; font-size: 12px; opacity: 0.65; line-height: 1.6; }
.demo-email-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.demo-email-copy {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  color: inherit; font-size: 12px; padding: 4px 0; text-decoration: none; opacity: 0.85;
}
.demo-email-copy:hover { opacity: 1; color: var(--accent); }
.demo-email-role { opacity: 0.6; font-size: 11px; white-space: nowrap; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.form input:not([type=checkbox]), .form select, .form textarea {
  font-size: 16px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg); color: var(--text-h); font-family: inherit;
}
/* 16px text in fields stops iOS Safari zooming the page when one is tapped. */
.form .checkbox-row { flex-direction: row; align-items: flex-start; gap: 10px; font-size: 15px; font-weight: 400; }
.form .checkbox-row input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.checks { border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.checks legend { font-size: 13px; font-weight: 600; padding: 0 6px; }

/* Confirmation of what a POST just did, and the error a rejected form comes
   back with. Both float rather than being inserted above the content, so a
   validation failure doesn't shove the form you're filling in down the page.
   The layer tracks the container's width, so the toast sits against the
   container's right edge. */
.toast-layer {
  position: fixed; top: 64px; left: 0; right: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  width: 100%; margin: 0 auto; padding: 0 24px; pointer-events: none;
}
@media (min-width: 576px)  { .toast-layer { max-width: 540px; } }
@media (min-width: 768px)  { .toast-layer { max-width: 720px; } }
@media (min-width: 992px)  { .toast-layer { max-width: 960px; } }
@media (min-width: 1200px) { .toast-layer { max-width: 1140px; } }
@media (min-width: 1400px) { .toast-layer { max-width: 1320px; } }
.toast {
  pointer-events: auto; max-width: 360px; background: var(--surface);
  border: 1px solid var(--accent); border-radius: 8px;
  padding: 12px 16px; font-size: 14px; line-height: 1.45;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  animation: toast-fade 400ms ease 6s forwards;
}
/* An error stays put: it has to still be there while you fix it. */
.toast-error { border-color: var(--error); color: var(--error); animation: none; }
@keyframes toast-fade { to { opacity: 0; visibility: hidden; } }
@media (max-width: 600px) {
  .toast-layer { padding: 0 16px; }
  .toast { max-width: none; align-self: stretch; }
}

/* Lists share one shape: fixed layout so column widths are predictable, and
   every row the same height whatever its content. Cells truncate to one line
   with an ellipsis; the full text is in the cell's title. */
.table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.table td { height: 44px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table a { color: inherit; text-decoration: none; }
@media (max-width: 600px) { .hide-narrow { display: none; } }

/* Row tint carries status, so lists don't need a status badge. */
.row-pass, .row-status-active { background: var(--row-pass); }
.row-pending, .row-status-scheduled { background: var(--row-pending); }
.row-attention, .row-status-on_hold { background: var(--row-attention); }
.row-inactive, .row-status-complete, .row-status-cancelled, .row-status-quoted { background: var(--row-inactive); }
.row-inactive td { opacity: 0.75; }
/* Whole-row click target. The hover tint overrides the status tint so it's
   obvious which row you're about to open. */
.row-link { cursor: pointer; }
.row-link:hover, .row-link:focus-visible { background: var(--row-hover); outline: none; }

.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.card-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-alt); font-weight: 600; font-size: 14px; border-radius: var(--radius) var(--radius) 0 0;
}
.card-body { padding: 16px; }
/* Page actions sit bottom right, primary first then Cancel — in a card's
   footer when there is one, otherwise in a row at the end of the page. */
.card-footer {
  padding: 12px 16px; border-top: 1px solid var(--border);
  background: var(--bg-alt); display: flex; gap: 8px; align-items: center;
  justify-content: flex-end; border-radius: 0 0 var(--radius) var(--radius);
}
.page-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.job-summary, .form-card { margin-top: 16px; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; font-size: 14px; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; font-size: 13px; margin-bottom: 16px; }
.crumb { display: inline-flex; align-items: center; }
.crumb-sep { margin: 0 8px; opacity: 0.4; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs [aria-current="page"] { color: var(--text-h); font-weight: 500; }

.inline-form { display: inline-block; margin: 0; }

/* Dashboard tiles — cards that are entirely a link. */
.tile-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px; margin-top: 20px;
}
.tile {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 20px; text-decoration: none; color: var(--text);
}
.tile:hover { background: var(--row-hover); }
.tile-disabled { opacity: 0.55; cursor: default; }
.tile-disabled:hover { background: var(--surface); }
.tile-title { font-size: 16px; font-weight: 600; color: var(--text-h); }
.tile-desc { font-size: 14px; }
.tile-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
