/* Sentinel Log prototype: component behaviour and states (see screen S1 and S2).
   Look comes from utility classes in the markup; this file adds what utilities cannot:
   hover, focus, pressed, disabled and busy states. */

/* Buttons */
.btn { cursor: pointer; text-decoration: none; }
/* One height for every single-line control so buttons, selects and fields
   line up in any row. Doubled class beats the py-N utilities. */
.btn.btn, .select.select, .field.field:not(:has(textarea)) { box-sizing: border-box; min-height: var(--control-h); padding-top: 0; padding-bottom: 0; align-items: center; }
.btn:hover { text-decoration: none; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger:hover { filter: brightness(0.92); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }

/* Filter chips: <button aria-pressed> */
.chip:hover:not([aria-pressed="true"]) { background: var(--surface-hover); }

/* Text fields and selects: the wrapper carries the border */
.field input, .field select { border: 0; background: transparent; padding: 0; appearance: none; outline: none; min-width: 0; }
.field textarea { border: 0; background: transparent; padding: 0; outline: none; width: 100%; min-width: 0; resize: vertical; }
.field select { width: 100%; }
.field:focus-within { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.field[aria-invalid="true"], .field:has(input[aria-invalid="true"]) { border-color: var(--error); }

/* Standalone select control (register toolbar Group/Sort/Columns). Chevron
   colour matches --border-strong; a var() cannot live inside a data URI. */
.select {
  appearance: none;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A8392' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 32px 8px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  cursor: pointer;
}
.select:focus-visible { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); outline: none; }

/* Checkboxes and radios */
.check { margin: 0; width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
/* WCAG 2.2 AA target-size (D-13): a bare 16px checkbox is below the 24px minimum, but its label row is the click target (label wraps input plus text). Enforce the row minimum here, prototype-first per D-04. */
label:has(> input.check) { min-height: 24px; }

/* Tabs */
.tab { text-decoration: none; }
.tab:hover:not([aria-current="page"]) { border-bottom: 3px solid var(--border-strong); }

/* Top navigation */
.mainnav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
/* Links never overlap the user chip; narrow viewports scroll the row. */
.mainnav { min-width: 0; overflow-x: auto; scrollbar-width: thin; }

/* Detail-page tabs: tab bar on desktop, select form on phone. */
.tab-select-form { display: none; }
@media (max-width: 768px) {
  .tab-select-form { display: block; }
}

/* Home sign-out block */
.signout-form { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 12px; }
.signout-form[hidden] { display: none; }
.signout-form button { margin: 0; }

/* Tables built with ARIA roles in the prototype; Django templates should use <table> */
.table [role="row"] + [role="row"]:hover { background: var(--surface-hover); }

/* Status change: closure fields appear only once Closed is picked. */
form:not(:has(input[name="target_status"][value="closed"]:checked)) .closing-fields { display: none; }

/* Risk chips and status badges: always icon or dot plus word */
.risk, .status { white-space: nowrap; }

/* Register tables: <table class="register-table"> in a rounded border card
   (register, actions, controls, evidence, audits). Auto layout so column
   widths follow content; colgroup widths act as hints. */
.register-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.register-table th, .register-table td { padding: 10px 12px; text-align: left; vertical-align: middle; }
.register-table tbody tr:hover td { background: var(--surface-hover); }

/* Overdue flag inside table cells (register results) */
.overdue-flag { display: inline-flex; align-items: center; gap: 2px; color: var(--error); font-size: 12px; font-weight: 600; }

/* Phone-only filter panel: hidden on desktop where the toolbar owns the
   controls; on small screens it collapses to a summary toggle and opens
   into roomy full-width fields. */
.phone-filter-panel { display: none; }
details.phone-filter-panel[hidden] { display: none; }
.phone-filter-panel .panel-field { margin: 16px 0; }
.phone-filter-panel .panel-field label { display: block; font-weight: 600; margin-bottom: 4px; }
.phone-filter-panel .panel-field input, .phone-filter-panel .panel-field select { width: 100%; min-height: 44px; }
.phone-filter-panel .panel-actions { display: grid; gap: 8px; margin-top: 16px; }
.phone-filter-panel .panel-actions .btn-primary, .phone-filter-panel .panel-actions .btn-secondary { min-height: 44px; justify-content: center; }
.phone-filter-panel[open] summary { display: none; }

/* Phone card list replaces the register table on small screens */
.register-cards { display: none; list-style: none; margin: 12px 0; padding: 0; }
.register-card { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.register-card .card-title { font-weight: 600; }

@media (max-width: 768px) {
  .phone-filter-panel { display: block; }
  .register-results-card .register-table { display: none; }
  .register-cards { display: grid; gap: 8px; margin: 0; }
}

/* Print: greyscale-safe, marking repeated by the print template.
   D-08: A4 print rules ported from hazards/static/hazards/css/print.css
   (plan 05.1.1-09). Tokens only, mapped to the prototype class names the
   rebuilt B2 page uses. Type below 11px lives here, nowhere else. */
@page {
  size: A4 portrait;
  margin: 10mm 10mm;
  @bottom-right {
    content: "Page " counter(page) " of " counter(pages);
    font-size: 8pt;
  }
}
@media print {
  .topnav, .skip-link, .print-only-screen { display: none; }
  .bt-1 { border-top: 1px solid var(--text-1); }
  .bb-1, .bb-2 { break-after: avoid; }
}

/* Sign-in split panel (i1): brand panel left, form card right. */
.signin-split { display: flex; flex-direction: row; width: 100%; }
.signin-brand { position: relative; overflow: hidden; flex: 1 1 auto; min-width: 0; min-height: 560px; }
.signin-brand-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.signin-brand-copy { position: absolute; left: 0; right: 0; bottom: 0; padding: 32px; width: 100%; max-width: none; }
.signin-mark { filter: brightness(0) invert(1); }
.signin-form-side { flex: 0 0 auto; width: 484px; display: flex; align-items: stretch; padding: 48px 0 64px; background: var(--bg); }
.signin-form-side > .col { width: 100%; border-right: 0; border-radius: 12px 0 0 12px; }
@media (max-width: 768px) {
.signin-split { flex-direction: column; }
.signin-brand { min-height: 0; height: 280px; flex: none; }
.signin-form-side { width: 100%; padding: 32px 16px; }
}

/* Sign-in page fills the viewport: shell is a flex column, main absorbs leftover height at any screen size. */
body.auth-page { min-height: 100vh; display: flex; flex-direction: column; }
body.auth-page > main { flex: 1 0 auto; }
body.auth-page main.col > .signin-split { flex-grow: 1; }
