/* Cold Bore Bound Book — web UI
   Plain CSS, no build step, no CDN dependency (this runs on a shop
   network that may not have reliable internet) — self-contained by
   design, same reasoning as the rest of this codebase's dependency
   choices. */

:root {
  --ink: #1b2430;
  --ink-soft: #4b5563;
  --paper: #f7f8fa;
  --panel: #ffffff;
  --line: #e2e5ea;
  --navy: #16233b;
  --navy-soft: #223252;
  --brass: #b8860b;
  --brass-soft: #f2e6c8;
  --good: #1f7a4d;
  --good-bg: #e7f5ee;
  --warn: #9a6b00;
  --warn-bg: #fdf3d8;
  --bad: #b3261e;
  --bad-bg: #fbe9e7;
  --focus: #2f6fed;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--focus); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--navy);
  color: #dbe3f0;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.brand {
  padding: 0 20px 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 12px;
}
.brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  margin-bottom: 10px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.14);
}
.brand .name { font-weight: 700; font-size: 16px; color: #fff; }
.brand .sub { font-size: 12px; color: #9fb0cc; margin-top: 2px; }

.nav-section { padding: 10px 20px 4px 20px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #7e90b3; }

.nav a {
  display: block;
  padding: 8px 20px;
  color: #cfd9ec;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--navy-soft); text-decoration: none; }
.nav a.active { background: var(--navy-soft); border-left-color: var(--brass); color: #fff; font-weight: 600; }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 20px 0 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 13px;
  color: #b7c3dd;
}
.sidebar-footer form { margin-top: 8px; }
.role-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  background: var(--brass-soft);
  color: #6b4f00;
}

.main { flex: 1; min-width: 0; padding: 28px 36px 60px 36px; }

.page-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 8px; }
.page-header h1 { margin: 0; font-size: 22px; }
.page-header .lede { color: var(--ink-soft); font-size: 14px; margin-top: 4px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.card h2 { margin-top: 0; font-size: 16px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 900px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .shell { flex-direction: column; }
  .sidebar { width: 100%; }
}

.stat { }
.stat .num { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.stat-bad .num { color: var(--bad); }

/* Print-friendly rendering (bbb-39b, added 2026-09-09) - used by the trace-request
   item-history report's "Print report" button so staff can hand a serial's full
   history to a fax machine without an outbound fax integration. .print-only-heading
   elements are hidden on screen (the on-screen header already covers the same
   ground with live buttons) and shown only in the print stylesheet; .no-print is
   the reverse - nav, buttons, and anything not part of the report itself. */
.print-only-heading { display: none; }
@media print {
  .no-print { display: none !important; }
  .print-only-heading { display: block; }
  nav, .flash, .flash-list { display: none !important; }
  body { background: #fff; }
  .print-report { border: none; box-shadow: none; padding: 0; }
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-soft); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-neutral { background: #eef0f4; color: var(--ink-soft); }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 7px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--navy-soft); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.secondary:hover { background: #f1f3f6; }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 12px; }

form.inline { display: inline; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=email], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd2dc;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: var(--good-bg); color: var(--good); }
.flash-error { background: var(--bad-bg); color: var(--bad); }
.flash-info { background: #e8eefc; color: #1d4fb8; }

.empty-state { color: var(--ink-soft); font-style: italic; padding: 12px 0; }

.kv { display: grid; grid-template-columns: 220px 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--ink-soft); font-weight: 600; }
.kv dd { margin: 0; }

.mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; font-size: 14px; color: var(--ink-soft); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--brass); font-weight: 600; }

.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); }
.login-wrap { display: flex; flex-direction: column; align-items: center; }
.login-logo { width: 340px; height: 340px; border-radius: 40px; margin-bottom: 14px; box-shadow: 0 22px 54px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.12); }
.login-card { background: #fff; border-radius: 12px; padding: 22px 24px 20px 24px; width: 300px; box-shadow: 0 20px 50px rgba(0,0,0,0.25); }
.login-card h1 { font-size: 19px; margin: 0 0 4px 0; }
.login-card .sub { font-size: 13px; color: var(--ink-soft); margin-bottom: 20px; }
.login-toggle { display: flex; gap: 8px; margin-bottom: 18px; }
.login-toggle button { flex: 1; padding: 8px; border-radius: 7px; border: 1px solid var(--line); background: #f5f6f8; font-size: 13px; font-weight: 600; cursor: pointer; }
.login-toggle button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.badge-tier0 { background: #eef0f4; color: #55607a; }
.badge-tier1 { background: var(--good-bg); color: var(--good); }
.coming-soon { border: 1px dashed var(--line); border-radius: 10px; padding: 16px 18px; color: var(--ink-soft); font-size: 14px; background: #fbfbfc; }

/* Section A-style yes/no questions (app/web/templates/form_4473_detail.html) */
.question-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.question-row:last-child { border-bottom: none; }
.question-row .q-text { font-size: 14px; flex: 1; }
.question-row .q-choices { display: flex; gap: 12px; flex-shrink: 0; white-space: nowrap; }
.question-row .q-choices label { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.question-row.unanswered { background: var(--warn-bg); margin: 0 -20px; padding: 10px 20px; }

/* Practice/training mode banner (bbb-46, added 2026-09-09) - shown on
   EVERY page of a practice install, including the logged-out login
   screen (see base.html - this is placed outside the is_logged_in
   block, unlike every banner below it), so nobody can look at a
   practice install's screen - logged in or not - and mistake it for
   the real bound book. Deliberately a hazard-stripe yellow/black
   treatment: visually unrelated to .inspection-banner's solid red or
   .licensing-banner's orange/red/black, so this can never be confused
   with either of those (both of which mean something is wrong with a
   REAL install - this banner means the opposite: nothing here is real
   at all). Deliberately NOT added to the @media print hidden-elements
   list below (nav, .flash, .flash-list) - a printed practice Form 4473
   or A&D page must stay visibly marked as practice, on paper, same as
   on screen.
*/
.practice-mode-banner {
  background: repeating-linear-gradient(135deg, #f5c518, #f5c518 18px, #1a1a1a 18px, #1a1a1a 36px);
  color: #1a1a1a;
  padding: 10px 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.practice-mode-banner-tag {
  background: #1a1a1a;
  color: #f5c518;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 3px;
  white-space: nowrap;
}
.practice-mode-banner-text {
  font-weight: 700;
  background: rgba(255,255,255,0.88);
  padding: 3px 10px;
  border-radius: 3px;
}

/* IOI Inspection Mode (bbb-25) - persistent read-only banner + flag form */
.inspection-banner {
  background: var(--bad);
  color: #fff;
  padding: 10px 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.inspection-banner .tag {
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255,255,255,0.2);
  padding: 3px 9px;
  border-radius: 10px;
  margin-right: 10px;
}
.inspection-banner .meta { font-weight: 500; }
.inspection-banner form { margin: 0; }

/* Licensing degradation clock banner (lic-04/lic-05, added 2026-09-07) -
   escalates in severity with app.licensing.get_degradation_status's
   own stage names. full_function never renders one at all. */
.licensing-banner {
  padding: 10px 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.licensing-banner .meta a { color: inherit; font-weight: 700; text-decoration: underline; }
.licensing-banner-degraded { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--warn); }
.licensing-banner-ad_disabled { background: var(--bad); color: #fff; }
.licensing-banner-lockdown { background: #1a1a1a; color: #fff; }

.flag-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.flag-form .field { margin-bottom: 0; flex: 1; min-width: 180px; }
.flag-form .field.note-field { flex: 2; }

.cosign-toggle { display: flex; gap: 8px; margin: 4px 0 14px 0; }
.cosign-toggle button { flex: 1; padding: 7px; border-radius: 7px; border: 1px solid var(--line); background: #f5f6f8; font-size: 12px; font-weight: 600; cursor: pointer; }
.cosign-toggle button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
