/* HACacare base styles
 * Brand colours extracted from the HACacare logo:
 *   Navy / dark header  : #1A2744
 *   Primary blue        : #1B6DC2  (acare lettering)
 *   Accent gold         : #F5A800  (HAC lettering)
 *   Success green       : #2D9E3F
 *   Warning red/orange  : #E05200
 */

:root {
  --color-bg: #f4f6fb;
  --color-text: #1e2330;
  --color-muted: #5a6277;
  --color-border: #dde2ee;
  --color-primary: #1B6DC2;
  --color-primary-hover: #155aa0;
  --color-accent: #F5A800;
  --color-accent-hover: #d48f00;
  --color-warn: #b34700;
  --color-success: #2D9E3F;
  --color-nav-bg: #1A2744;
  --color-nav-text: #e8edf8;
  --max-width: 960px;
  --radius: 7px;
}

* { box-sizing: border-box; }

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

header {
  background: var(--color-nav-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  padding: 0;
}

nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  height: 56px;
}

nav .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  text-decoration: none;
  color: var(--color-nav-text);
}

nav .brand img {
  height: 38px;
  width: auto;
}

nav .brand-name {
  font-size: 1.25em;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
}

nav .brand-name .hac  { color: var(--color-accent); }
nav .brand-name .a    { color: #fff; }
nav .brand-name .care { color: #6ab4ff; }

nav a:not(.brand) {
  color: rgba(232,237,248,0.82);
  text-decoration: none;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius);
  font-size: 0.93em;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

nav a:not(.brand):hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* Hamburger for mobile */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-nav-text);
  margin: 4px 0;
  border-radius: 2px;
  transition: 0.2s;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

@media (max-width: 600px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0; right: 0;
    background: var(--color-nav-bg);
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 1rem 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 100;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.55rem 0.5rem; font-size: 1em; }
  header { position: relative; }
}

main {
  max-width: var(--max-width);
  margin: 2rem auto;
  padding: 0 1rem;
}

footer {
  max-width: var(--max-width);
  margin: 3rem auto 1rem;
  padding: 1rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
}

h1 { font-size: 1.6rem; margin-top: 0; }
h2 { font-size: 1.2rem; margin-top: 1.5rem; }

p { margin: 0.6rem 0; }

ul, ol { margin: 0.6rem 0 0.6rem 1.2rem; }

.button {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: white;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.button:hover {
  border-color: #bbb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.button-primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.button-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 2px 6px rgba(41,82,163,0.25);
}

.actions { margin-top: 1.2rem; }

.note {
  color: var(--color-muted);
  font-size: 0.95em;
  background: #fff8e1;
  border-left: 3px solid #ffc107;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
}

/* Alerts (flash messages, warnings) */
.alert {
  padding: 0.6rem 0.9rem;
  margin: 0.6rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}
.alert-info    { background: #e7f0fb; border-color: #b6cdf0; }
.alert-warn,
.alert-warning { background: #fff4e0; border-color: #ffd28a; }
.alert-error   { background: #fce4e4; border-color: #f5b6b6; }
.flash-messages { margin: 1rem 0; }

/* Forms */
.form         { margin: 1.2rem 0; }
.form label   { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.form-row     { display: flex; gap: 0.5rem; align-items: stretch; }
.form-row input[type="text"],
.form-row input[type="number"],
.form-row select {
  flex: 1;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
}
.field input[type="text"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
}
.field textarea {
  resize: vertical;
}
.inline-form {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}
.inline-form input[type="text"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.form .hint   { color: var(--color-muted); font-size: 0.9em; margin-top: 0.4rem; }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border);
}
.table th {
  background: #f0f0f0;
  font-weight: 600;
  font-size: 0.92em;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover         { background: #fafbfc; }

/* Cards */
.card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0.6rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card h3 { margin-top: 0; }

/* Collapsible card (details/summary) */
details.card > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.1rem 0;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before {
  content: "▸ ";
  color: var(--color-muted);
  font-size: 0.85em;
}
details.card[open] > summary::before {
  content: "▾ ";
}

/* Misc */
.muted    { color: var(--color-muted); }
.warn     { color: var(--color-warn); font-weight: 600; }
.small    { font-size: 0.88em; }
.source-tag {
  display: inline-block;
  font-size: 0.85em;
  padding: 1px 7px;
  border-radius: 9px;
  background: #eef;
  color: #225;
  border: 1px solid #cce;
}
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.5rem 0;
}

/* Fieldsets and radio rows for the release form */
fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  background: white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
fieldset legend {
  font-weight: 600;
  padding: 0 0.5rem;
  color: var(--color-primary);
}
.field {
  margin: 0.8rem 0;
}
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.4rem 0;
  font-weight: 400;
  cursor: pointer;
}
.radio-row input[type="radio"] {
  margin-top: 0.2rem;
}
.radio-row > div, .radio-row > span {
  flex: 1;
}
.unit-fixed {
  display: inline-flex;
  align-items: center;
  padding: 0 0.6rem;
  background: #f0f0f0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-muted);
  font-size: 0.95em;
  white-space: nowrap;
}
.unit-picker {
  min-width: 100px;
}

/* Audit log */
.audit-log {
  list-style: none;
  margin: 0.6rem 0;
  padding: 0;
}
.audit-log li {
  padding: 0.4rem 0.6rem;
  border-left: 3px solid #ccc;
  margin: 0.3rem 0;
  background: white;
  font-size: 0.95em;
}
.audit-info      { border-left-color: #5a9; }
.audit-warning   { border-left-color: #e80; background: #fff8f0; }
.audit-attention { border-left-color: #fc0; background: #fffce0; }
.audit-section {
  background: #eee;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.85em;
  color: #555;
}

/* Stepper / progress bar */
.stepper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1rem 0;
}
.stepper-inner {
  display: flex;
  align-items: center;
  gap: 0;
}
.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}
.stepper-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82em;
  font-weight: 600;
  border: 2px solid var(--color-border);
  background: white;
  color: var(--color-muted);
  transition: all 0.2s;
}
.stepper-step.active .stepper-dot {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: white;
}
.stepper-step.done .stepper-dot {
  border-color: #3a9a5c;
  background: #3a9a5c;
  color: white;
}
.stepper-label {
  font-size: 0.78em;
  color: var(--color-muted);
  white-space: nowrap;
}
.stepper-step.active .stepper-label {
  color: var(--color-primary);
  font-weight: 600;
}
.stepper-step.done .stepper-label {
  color: #3a9a5c;
}
.stepper-line {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  margin: 0 0.4rem;
  margin-bottom: 1.4rem;
  min-width: 20px;
}
.stepper-line.done {
  background: #3a9a5c;
}

/* ===================================================================
   Landing page — module selector
   =================================================================== */

.landing-hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.landing-hero img.hero-logo {
  height: 240px;
  width: auto;
  max-width: 100%;
  margin-bottom: 1rem;
}

.landing-hero h1 {
  font-size: 2rem;
  margin: 0.4rem 0 0.2rem;
  color: var(--color-text);
}

.landing-hero .tagline {
  font-size: 1.05em;
  color: var(--color-muted);
  margin: 0 0 0.5rem;
}

.landing-hero .sub-info {
  font-size: 0.88em;
  color: var(--color-muted);
}

/* Module grid */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.2rem;
  margin: 2rem 0 3rem;
}

.module-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.4rem 1.4rem 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
}

.module-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.10);
}

.module-card.available {
  border-top: 4px solid var(--color-primary);
}
.module-card.available:hover {
  transform: translateY(-2px);
}

.module-card.coming-soon {
  border-top: 4px solid var(--color-border);
  opacity: 0.8;
}

/* Status badge */
.module-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  width: fit-content;
}

.module-badge.badge-available {
  background: #e6f4ea;
  color: #1a6e30;
}

.module-badge.badge-soon {
  background: #eef0f4;
  color: #7a8299;
}

/* Standard label */
.module-standard {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--color-muted);
  letter-spacing: 0.02em;
  font-family: monospace;
}

/* Card title */
.module-title {
  font-size: 1.05em;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
  margin: 0;
}

/* Description */
.module-desc {
  font-size: 0.9em;
  color: var(--color-muted);
  line-height: 1.5;
  flex: 1;
}

/* Card action area */
.module-action {
  margin-top: 0.8rem;
}

.module-action .button {
  width: 100%;
  text-align: center;
  padding: 0.55rem 1rem;
}

.module-action .button:disabled,
.module-action .button.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Section divider on landing */
.landing-section-title {
  font-size: 0.78em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  margin: 2rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .landing-hero h1  { font-size: 1.5rem; }
  .landing-hero img.hero-logo { height: 170px; }
  .module-grid { grid-template-columns: 1fr; }
}

/* ===================================================================
   General responsive tweaks
   =================================================================== */

@media (max-width: 600px) {
  main { margin: 1rem auto; }

  fieldset { padding: 0.8rem; }

  .form-row {
    flex-wrap: wrap;
  }
  .form-row input[type="text"],
  .form-row input[type="number"],
  .form-row select {
    min-width: 0;
  }

  .stepper-label { display: none; }
  .stepper-line  { min-width: 12px; }

  h1 { font-size: 1.3rem; }
}

/* ===================================================================
   Inerting module styles (CEN/TR 15281)
   =================================================================== */

/* Page wrapper */
.inerting-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

/* Module header banner */
.module-header {
  background: var(--color-nav-bg);
  color: #e8edf8;
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem 0;
  margin-bottom: 0;
}
.module-header-inner {
  margin-bottom: 0.8rem;
}
.module-header h1 {
  color: #fff;
  margin: 0.2rem 0 0.1rem;
  font-size: 1.4rem;
}
.module-header p {
  margin: 0;
  color: #aab5cc;
  font-size: 0.88rem;
}
.module-standard-tag {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

/* Method tabs inside the header */
.inerting-tabs {
  display: flex;
  gap: 0;
  margin-top: 0.8rem;
}
.itab {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #aab5cc;
  text-decoration: none;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: background 0.15s, color 0.15s;
}
.itab:hover {
  background: rgba(255,255,255,0.08);
  color: #e8edf8;
}
.itab-active {
  background: var(--color-bg);
  color: var(--color-text);
}

/* Two-column layout: form left, results right */
.inerting-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  background: var(--color-bg);
  border-radius: 0 0 var(--radius) var(--radius);
  padding-top: 1.5rem;
}

.inerting-form-panel,
.inerting-results-panel {
  min-width: 0;
}

.inerting-form-panel h2,
.inerting-results-panel h3 {
  font-size: 1rem;
  color: var(--color-primary);
  margin: 0 0 0.5rem;
}

.help-text {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
}

/* Fieldsets */
.calc-fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.calc-fieldset legend {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0.4rem;
}

/* Field rows */
.field-group { margin-bottom: 1rem; }
.field-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.field-col { flex: 1; min-width: 0; }

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--color-text);
}
.field-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--color-muted);
  font-weight: 400;
  margin-top: 0.15rem;
  line-height: 1.4;
}

/* Inputs */
.input-field {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.92rem;
  background: #fff;
  color: var(--color-text);
  transition: border-color 0.15s;
}
.input-field:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(27,109,194,0.12);
}
.select-field { cursor: pointer; }

/* Value + unit-selector pair */
.pressure-input {
  display: flex;
  gap: 0.4rem;
}
.pressure-input .input-field:first-child { flex: 1 1 auto; min-width: 0; }
.pressure-input .select-field {
  flex: 0 0 5.5rem;
  width: 5.5rem;
}

/* Input with preset buttons */
.input-with-preset {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.preset-buttons {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.preset-btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  background: #eef2f9;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--color-primary);
  font-weight: 600;
  transition: background 0.1s;
}
.preset-btn:hover { background: #dce6f5; }

/* Radio groups */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #fff;
}
.radio-option:hover { border-color: var(--color-primary); }
.radio-selected {
  border-color: var(--color-primary);
  background: #eef4fc;
}
.radio-option input[type="radio"] { margin-top: 0.15rem; flex-shrink: 0; }
.radio-option span { display: flex; flex-direction: column; }
.radio-option strong { font-size: 0.88rem; }
.radio-option small { font-size: 0.78rem; color: var(--color-muted); }

.radio-inline {
  display: flex;
  gap: 1rem;
  margin-top: 0.25rem;
}
.radio-inline label {
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

/* Form actions */
.form-actions {
  margin-top: 1.2rem;
  display: flex;
  gap: 0.8rem;
}

/* Result panel */
.result-hero {
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
}
.result-ok   { background: #edfaf0; border: 2px solid var(--color-success); }
.result-warn { background: #fff8ec; border: 2px solid var(--color-accent); }
.result-hero-number {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-text);
}
.result-ok .result-hero-number   { color: var(--color-success); }
.result-warn .result-hero-number { color: var(--color-warn); }
.result-hero-label {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-top: 0.25rem;
}

/* Result table */
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
  margin-bottom: 1rem;
}
.result-table th, .result-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}
.result-table th {
  color: var(--color-muted);
  font-weight: 600;
  width: 55%;
}
.result-highlight {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 1rem;
}

/* Cycle table */
.cycle-table th { width: auto; }
.cycle-target-row { background: #edfaf0; font-weight: 600; }

/* Status badges */
.badge-ok {
  background: var(--color-success);
  color: #fff;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 12px;
  font-weight: 700;
}
.badge-selected {
  background: var(--color-primary);
  color: #fff;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 12px;
  font-weight: 700;
}

/* Info / notes boxes */
.info-box {
  background: #eef4fc;
  border: 1px solid #bbd3f0;
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.86rem;
  margin-bottom: 1rem;
}
.notes-box {
  background: #f7f8fa;
  border-left: 3px solid var(--color-primary);
  padding: 0.6rem 0.9rem;
  font-size: 0.83rem;
  color: var(--color-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1rem;
}
.notes-box p { margin: 0.2rem 0; }

/* Flash messages */
.flash {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.87rem;
  margin-bottom: 0.8rem;
}
.flash-error { background: #fff0f0; border: 1px solid #f5b8b8; color: #8b1a1a; }
.flash-warn  { background: #fff8ec; border: 1px solid #f5d99a; color: var(--color-warn); }

/* Empty state */
.empty-state {
  color: var(--color-muted);
  font-size: 0.9rem;
}
.reference-box {
  background: #f7f8fa;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  font-size: 0.83rem;
  margin-top: 0.8rem;
  line-height: 1.7;
}

/* Responsive: stack panels on narrow screens */
@media (max-width: 720px) {
  .inerting-layout {
    grid-template-columns: 1fr;
  }
  .field-row { flex-direction: column; gap: 0; }
}


/* ===================================================================
   Auth + module sub-nav (Phase 1 security)
   =================================================================== */

.nav-user {
  color: rgba(232, 237, 248, 0.85);
  font-size: 0.85rem;
  font-weight: 500;
  align-self: center;
  padding: 0.3rem 0.5rem;
}
.nav-signin {
  background: var(--color-primary);
  color: #fff !important;
  padding: 0.35rem 0.9rem;
  border-radius: 5px;
  font-weight: 600;
}
.nav-signin:hover { background: var(--color-primary-hover); }
.nav-logout-form { margin: 0; display: inline; }
.nav-logout-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.25);
  color: #e8edf8;
  padding: 0.3rem 0.8rem;
  border-radius: 5px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}
.nav-logout-btn:hover { background: rgba(255,255,255,0.1); }

.module-subnav {
  background: #16203a;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.module-subnav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
.module-subnav-label {
  color: #6b7896;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.module-subnav-inner a {
  color: #cdd7ea;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}
.module-subnav-inner a:hover { color: #fff; }

.auth-page {
  max-width: 440px;
  margin: 2.5rem auto;
  padding: 0 1rem;
}
.auth-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.6rem 1.8rem;
  box-shadow: 0 2px 10px rgba(26,39,68,0.06);
}
.auth-card h1 { font-size: 1.4rem; margin: 0 0 0.4rem; }
.auth-card .field-group { margin-bottom: 1rem; }

/* ===================================================================
   Admin user-management page
   =================================================================== */

.admin-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.nav-admin {
  background: var(--color-accent);
  color: #1A2744 !important;
  padding: 0.3rem 0.7rem;
  border-radius: 5px;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.nav-admin:hover {
  background: var(--color-accent-hover);
  color: #1A2744 !important;
}

.admin-users-table { margin-top: 1rem; }
.admin-users-table th,
.admin-users-table td { font-size: 0.88rem; vertical-align: middle; }
.admin-users-table .small-cell {
  font-size: 0.78rem;
  color: var(--color-muted);
  white-space: nowrap;
}
.user-inactive {
  background: #fafbfc;
  color: var(--color-muted);
}
.user-inactive td:first-child::after {
  content: " (inactive)";
  color: var(--color-warn);
  font-size: 0.78rem;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.admin-actions form { margin: 0; }

.button-small {
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.radio-inline + .radio-inline { margin-left: 1.2rem; }

/* Failed-login badge (orange-red) */
.badge-warn {
  background: var(--color-warn);
  color: #fff;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Auth log page */
.filter-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0 1.2rem;
  flex-wrap: wrap;
}
.auth-log-table { margin-top: 0.5rem; font-size: 0.85rem; }
.auth-log-table th,
.auth-log-table td { vertical-align: middle; }
.auth-log-table .small-cell { font-size: 0.8rem; white-space: nowrap; }
.auth-log-table .mono { font-family: monospace; }
.auth-log-table .ua-cell {
  max-width: 28rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.78rem;
  color: var(--color-muted);
}
.auth-log-table .ua-cell span { cursor: help; }

/* ===================================================================
   Project sharing (Phase 2.1)
   =================================================================== */

.badge-shared {
  display: inline-block;
  background: #eef4fc;
  color: var(--color-primary);
  border: 1px solid #bbd3f0;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 12px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.shared-banner {
  background: #eef4fc;
  border: 1px solid #bbd3f0;
  border-left: 4px solid var(--color-primary);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-text);
  margin: 0.8rem 0 1rem;
}

/* Safety-factor explanation list (inerting flow-through) */
.factor-help {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: var(--color-muted);
  line-height: 1.45;
}
.factor-help li { margin: 0.2rem 0; }
.factor-help strong { color: var(--color-text); }

/* ===================================================================
   D.1 table visualisation (result page)
   =================================================================== */

.zone-badge {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.2rem 0.75rem;
  border-radius: 12px;
}

.d1-table-wrap {
  margin: 0.8rem 0 1rem;
}

.d1-table-svg {
  max-width: 100%;
  overflow-x: auto;
}

.d1-table-svg svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Collapsible details below the D.1 table */
.d1-details {
  margin-top: 6px;
  border: 1px solid #dde2ee;
  border-radius: 5px;
  overflow: hidden;
}
.d1-details summary {
  cursor: pointer;
  padding: 5px 12px;
  background: #f7f8fa;
  font-size: 0.82rem;
  font-weight: 600;
  color: #5a6277;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.d1-details summary::before {
  content: '\25B6';
  font-size: 9px;
  color: var(--color-primary);
  transition: transform 0.15s;
}
.d1-details[open] summary::before { transform: rotate(90deg); }
.d1-details summary:hover { background: #eef1f8; }
.d1-details-body { padding: 8px 14px 10px; }

.d1-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 8px;
}
.d1-leg {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #cdd2de;
}
.d1-leg-arr {
  font-size: 0.82rem;
  font-weight: 700;
}

.d1-fn {
  font-size: 0.78rem;
  color: #7a8299;
  line-height: 1.55;
  margin: 0;
}

/* -----------------------------------------------------------------------
 * Generic tab bar (used by spray booth and other multi-tab modules)
 * ----------------------------------------------------------------------- */
.tab-bar {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0;
  flex-wrap: wrap;
}
.tab-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-muted);
  text-decoration: none;
  border-radius: var(--radius) var(--radius) 0 0;
  border: 2px solid transparent;
  border-bottom: none;
  transition: background 0.15s, color 0.15s;
}
.tab-link:hover {
  background: rgba(27,109,194,0.07);
  color: var(--color-primary);
}
.tab-active {
  background: var(--color-bg);
  color: var(--color-primary);
  border-color: var(--color-border);
  border-bottom-color: var(--color-bg);
  margin-bottom: -2px;
}
.tab-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50%;
  width: 1.1em;
  height: 1.1em;
  line-height: 1.1em;
  text-align: center;
  margin-left: 0.25rem;
}
.tab-badge-ok {
  color: var(--color-success);
}

/* -----------------------------------------------------------------------
 * Result summary boxes — small KPI cards
 * Used by spray booth results (and can be reused by other modules)
 * ----------------------------------------------------------------------- */
.result-box {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
}
.result-box-ok {
  background: #edfaf0;
  border-color: var(--color-success);
}
.result-box-warn {
  background: #fff8ec;
  border-color: var(--color-accent);
}
.result-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}
.result-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}
.result-box-ok .result-value   { color: var(--color-success); }
.result-box-warn .result-value { color: var(--color-warn); }
.result-sub {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-top: 0.15rem;
}

/* -----------------------------------------------------------------------
 * Verdict banner — spray booth results pass/fail header
 * ----------------------------------------------------------------------- */
.verdict-banner {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 1rem;
}
.verdict-ok {
  background: #edfaf0;
  border: 2px solid var(--color-success);
  color: #1a6930;
}
.verdict-warn {
  background: #fff8ec;
  border: 2px solid var(--color-accent);
  color: #7a5200;
}
.verdict-icon {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
}

/* -----------------------------------------------------------------------
 * Static value display (non-editable field look)
 * ----------------------------------------------------------------------- */
.input-static {
  padding: 0.4rem 0.6rem;
  background: var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-text);
  min-height: 2rem;
  display: flex;
  align-items: center;
}

/* -----------------------------------------------------------------------
 * Table row warning state
 * ----------------------------------------------------------------------- */
.row-warn {
  background: #fff8ec;
}
.row-warn td {
  border-color: #f5d580;
}
