/* shared.css — MOAC application styles */

/* ── Reset & Base ────────────────────────────────────────────────────────────── */

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

:root {
  --color-primary:      #1a4f7a;
  --color-primary-dark: #123a5c;
  --color-accent:       #2a7fc1;
  --color-bg:           #f4f6f9;
  --color-surface:      #ffffff;
  --color-border:       #d0d7e2;
  --color-text:         #1e2a38;
  --color-text-muted:   #6b7a8d;
  --color-danger:       #c0392b;
  --color-warning:      #d68910;
  --color-success:      #1e8449;
  --color-info:         #1a6fa0;
  --nav-width:          220px;
  --header-height:      56px;
  --radius:             6px;
  --shadow:             0 1px 4px rgba(0,0,0,0.10);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
}

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

/* ── Layout ──────────────────────────────────────────────────────────────────── */

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

.app-nav {
  width: var(--nav-width);
  background: var(--color-primary);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.app-nav__brand {
  padding: 1rem 1rem 0.875rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.app-nav__brand-icon {
  width: 34px;
  height: 40px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

.app-nav__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.app-nav__brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
}

.app-nav__brand span {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  opacity: 0.65;
  margin-top: 0.1rem;
  line-height: 1.3;
}

.app-nav__menu {
  list-style: none;
  padding: 0.5rem 0;
  flex: 1;
}

.app-nav__menu li a {
  display: block;
  padding: 0.55rem 1rem;
  color: rgba(255,255,255,0.85);
  font-size: 0.875rem;
  transition: background 0.15s;
}

.app-nav__menu li a:hover,
.app-nav__menu li a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  text-decoration: none;
}


/* ── C5 T9.1 — Nav hover tooltips ──────────────────────────────────────────
   Tooltip is appended to <body> by JS (nav has overflow-y:auto which clips
   pseudo-elements). The #nav-tooltip div is positioned fixed, appearing to
   the right of the nav bar. Triggered by data-tooltip on nav <a> tags.    */

#nav-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 0.4rem 0.7rem;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 9999;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  max-width: 220px;
  white-space: normal;
}

#nav-tooltip.visible {
  opacity: 1;
}

.app-nav__footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
}

.app-nav__footer button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0;
  margin-top: 0.25rem;
}

.app-nav__footer button:hover { color: #fff; }

.app-main {
  margin-left: var(--nav-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-header {
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-header h1 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-primary);
}

#session-info {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.app-content {
  padding: 1.5rem;
  flex: 1;
}

/* ── Status Banner ────────────────────────────────────────────────────────────── */

.status-banner {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 999;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

.status-banner--info    { background: #d1ecf1; color: #0c5460; border-bottom: 1px solid #bee5eb; }
.status-banner--success { background: #d4edda; color: #155724; border-bottom: 1px solid #c3e6cb; }
.status-banner--error   { background: #f8d7da; color: #721c24; border-bottom: 1px solid #f5c6cb; }
.status-banner--warning { background: #fff3cd; color: #856404; border-bottom: 1px solid #ffeeba; }

/* ── Cards ────────────────────────────────────────────────────────────────────── */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

/* ── Tables ───────────────────────────────────────────────────────────────────── */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--color-surface);
}

thead th {
  background: var(--color-primary);
  color: #fff;
  padding: 0.6rem 0.875rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background 0.1s;
}

tbody tr:hover { background: #f0f4f8; }

tbody td {
  padding: 0.55rem 0.875rem;
  vertical-align: middle;
}

.empty-row td { color: var(--color-text-muted); text-align: center; padding: 1.5rem; }

/* ── Forms ────────────────────────────────────────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-surface);
  width: 100%;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(42,127,193,0.15);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn--primary   { background: var(--color-primary); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--color-primary-dark); }

.btn--accent    { background: var(--color-accent); color: #fff; }
.btn--accent:hover:not(:disabled) { background: #1e6da8; }

.btn--danger    { background: var(--color-danger); color: #fff; }
.btn--danger:hover:not(:disabled) { background: #a93226; }

.btn--secondary { background: var(--color-border); color: var(--color-text); }
.btn--secondary:hover:not(:disabled) { background: #b8c2cf; }

.btn--ghost {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.btn--ghost:hover:not(:disabled) { background: var(--color-bg); }

.btn--sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }

/* ── Badges ───────────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge--green  { background: #d4edda; color: #155724; }
.badge--amber  { background: #fff3cd; color: #856404; }
.badge--red    { background: #f8d7da; color: #721c24; }
.badge--grey   { background: #e2e8f0; color: #4a5568; }
.badge--blue   { background: #cce5ff; color: #004085; }

/* ── KPI Cards (Dashboard) ────────────────────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.kpi-card__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.kpi-card__label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-card--warning .kpi-card__value { color: var(--color-warning); }
.kpi-card--danger  .kpi-card__value { color: var(--color-danger); }
.kpi-card--success .kpi-card__value { color: var(--color-success); }

/* ── Toolbar ──────────────────────────────────────────────────────────────────── */

.toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.toolbar input[type="text"],
.toolbar select {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-surface);
}

/* ── Login Page ───────────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
}

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
}

.login-card__logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-card__logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
}

.login-card__logo p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* ── Misc ─────────────────────────────────────────────────────────────────────── */

.loading-message { color: var(--color-text-muted); padding: 1rem 0; font-style: italic; }
.error-message   { color: var(--color-danger); padding: 1rem 0; }

.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.25rem 0;
}

.text-muted  { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); }
.text-right  { text-align: right; }

/* ── Responsive — T6 Mobile Layout ───────────────────────────────────────────── */

/* Nav overlay — darkens page behind open nav on mobile.
   Hamburger button is now fully inline-styled by auth.js — no CSS needed for it. */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 499;
}

.nav-overlay.visible { display: block; }

@media (max-width: 768px) {

  /* Nav slides in from the left — hidden by default */
  .app-nav {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 500;
  }

  /* Nav open state — triggered by JS adding .open class */
  .app-nav.open { transform: translateX(0); }

  /* Main content fills full width — no sidebar margin */
  .app-main {
    margin-left: 0;
  }

  /* Reduce content padding on small screens */
  .app-content { padding: 1rem; }

  /* Two-column panel-grid (list + form) collapses to single column */
  .panel-grid {
    grid-template-columns: 1fr !important;
  }

  /* Form panel fills full width when stacked */
  #form-panel {
    width: 100%;
  }

  /* Form date grids collapse to single column */
  .form-grid { grid-template-columns: 1fr; }

  /* KPI grid — 2 columns on mobile */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Tables stretch full width */
  .table-wrapper {
    width: 100%;
  }

  /* Toolbar wraps onto multiple lines gracefully */
  .toolbar {
    flex-wrap: wrap;
  }

  /* Toolbar search input takes full row on mobile */
  .toolbar input[type="text"] {
    width: 100%;
    flex-basis: 100%;
  }

  /* Card padding reduced slightly on mobile */
  .card { padding: 1rem; }

}

/* ── Offline Connectivity Indicator ──────────────────────────────────────────── */

.offline-indicator {
  display: none;
  align-items: center;
  gap: 0.4rem;
  background: rgba(214, 137, 16, 0.18);
  border: 1px solid rgba(214, 137, 16, 0.4);
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fbbf24;
  margin-top: 0.5rem;
  letter-spacing: 0.03em;
}

.offline-indicator::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fbbf24;
  flex-shrink: 0;
}

.offline-indicator.visible {
  display: flex;
}

/* ── Guided Tour Overlay ──────────────────────────────────────────────────── */

#tour-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.tour-card {
  position: relative;
  background: var(--color-surface);
  border-radius: calc(var(--radius) * 2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: 2rem 2rem 1.5rem;
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: tour-in 0.22s ease;
}

@keyframes tour-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.tour-icon {
  font-size: 2.25rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.tour-progress {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.tour-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-border);
  flex-shrink: 0;
  transition: background 0.2s;
}

.tour-dot--active {
  background: var(--color-primary);
  width: 20px;
  border-radius: 4px;
}

.tour-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
  line-height: 1.3;
}

.tour-body {
  font-size: 0.92rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  margin: 0;
}

.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  gap: 0.75rem;
}

.tour-nav {
  display: flex;
  gap: 0.5rem;
}

.tour-btn {
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.45rem 1rem;
  transition: opacity 0.15s, background 0.15s;
}

.tour-btn:hover { opacity: 0.85; }

.tour-btn--primary {
  background: var(--color-primary);
  color: #fff;
}

.tour-btn--secondary {
  background: var(--color-border);
  color: var(--color-text);
}

.tour-btn--skip {
  background: none;
  color: var(--color-text-muted);
  padding-left: 0;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ── Nav Footer Links (Take a Tour / User Manual) ────────────────────────── */

.nav-footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 0.4rem;
}

.nav-footer-link {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0;
  text-align: left;
  transition: color 0.15s;
}

.nav-footer-link:hover {
  color: #fff;
}

/* ── Clickable KPI Cards ──────────────────────────────────────────────────── */

.kpi-card--clickable {
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}

.kpi-card--clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.13);
  border-color: var(--color-primary);
}

.kpi-card--clickable:active {
  transform: translateY(0);
}

/* ── Empty State Guidance ────────────────────────────────────────────────── */

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
}

.empty-state__icon {
  font-size: 2rem;
  margin-bottom: 0.6rem;
  line-height: 1;
}

.empty-state__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 0.35rem;
}

.empty-state__body {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0 0 1rem;
  line-height: 1.55;
}

.empty-state__action {
  display: inline-block;
}

/* ── Bulk Action Bar ─────────────────────────────────────────────────────── */

.bulk-bar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  margin-bottom: 0.75rem;
}

.bulk-bar.visible { display: flex; }

.bulk-bar__count {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-right: 0.25rem;
}

.bulk-bar__divider {
  width: 1px;
  height: 1.2rem;
  background: var(--color-border);
}

/* ─── OCR Document Scanning ──────────────────────────────────────────────── */

.ocr-scan-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  border: 1.5px dashed var(--color-primary);
  background: transparent;
  color: var(--color-primary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  width: 100%;
  justify-content: center;
  margin-bottom: 0.75rem;
}
.ocr-scan-btn:hover {
  background: var(--color-primary);
  color: #fff;
}

/* Modal overlay */
.ocr-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Modal box */
.ocr-modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg, 10px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.ocr-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
}
.ocr-modal__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}
.ocr-modal__close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.ocr-modal__close:hover { background: var(--color-bg); }

/* Loading / error states */
.ocr-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
}
.ocr-state__msg {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  max-width: 340px;
}
.ocr-state__icon { font-size: 2rem; }
.ocr-state__icon--error { color: var(--color-danger); }

/* Spinner */
.ocr-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: ocr-spin 0.7s linear infinite;
}
@keyframes ocr-spin { to { transform: rotate(360deg); } }

/* Notice bar */
.ocr-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  font-size: 0.8rem;
  color: #1e40af;
  margin: 0.75rem 1.25rem 0;
}
.ocr-notice__icon { flex-shrink: 0; font-size: 1rem; }

/* Preview */
.ocr-preview {
  padding: 0.75rem 1.25rem 0;
  text-align: center;
}
.ocr-preview__img {
  max-width: 100%;
  max-height: 180px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  object-fit: contain;
}
.ocr-preview__pdf-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Field rows */
#ocr-fields-list {
  padding: 0.75rem 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.ocr-field-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.ocr-field-row--low .ocr-field-input {
  border-color: #f59e0b;
  background: #fffbeb;
}
.ocr-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ocr-field-input {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-surface);
  width: 100%;
  box-sizing: border-box;
}
.ocr-field-input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: transparent;
}

/* Confidence badges */
.ocr-conf-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  flex-shrink: 0;
}
.ocr-conf--high {
  background: #d1fae5;
  color: #065f46;
}
.ocr-conf--low {
  background: #fef3c7;
  color: #92400e;
}

/* Legend */
.ocr-confidence-legend {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.5rem 1.25rem 0;
  font-size: 0.72rem;
  font-weight: 600;
}
.ocr-conf-chip {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

/* Actions */
.ocr-modal__actions {
  display: flex;
  gap: 0.6rem;
  padding: 1rem 1.25rem 1.25rem;
  justify-content: flex-end;
  border-top: 1px solid var(--color-border);
  margin-top: 0.75rem;
}

/* ─── Certificate Verification ───────────────────────────────────────────── */

/* Verification panel container */
#verification-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1rem;
  background: var(--color-bg);
}

.verif-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.verif-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

/* Meta row */
.verif-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}
.verif-url-link {
  font-size: 0.8rem;
  color: var(--color-primary);
  text-decoration: none;
}
.verif-url-link:hover { text-decoration: underline; }

/* Notice bars */
.verif-notice {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}
.verif-notice--warn  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.verif-notice--error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* CTO section */
.verif-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}
.verif-cto-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.verif-cto-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.8rem;
}
.verif-cto-name {
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.15rem;
}
.verif-cto-types {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  margin-bottom: 0.3rem;
}
.verif-cto-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.78rem;
}
.verif-cto-link:hover { text-decoration: underline; }
.verif-cto-notes {
  color: var(--color-text-muted);
  font-size: 0.73rem;
  margin-top: 0.25rem;
  font-style: italic;
}
.verif-no-cto {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Action row */
.verif-action-row {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}
.verif-label {
  display: block;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}
.verif-select,
.verif-input {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-surface);
  box-sizing: border-box;
}
.verif-select:focus,
.verif-input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: transparent;
}
.verif-file-input {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Evidence link */
.verif-evidence-link {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
}
.verif-evidence-link a {
  color: var(--color-primary);
  text-decoration: none;
}
.verif-evidence-link a:hover { text-decoration: underline; }

/* Banner */
.verif-banner {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}
.verif-banner--success { background: #d1fae5; color: #065f46; }
.verif-banner--error   { background: #fee2e2; color: #991b1b; }

/* Verification badge in list table */
.verif-col { min-width: 100px; }

/* ─── Vessel Readiness Score ─────────────────────────────────────────────── */

.readiness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.readiness-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 10px);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

.readiness-card__vessel {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Score ring */
.readiness-ring {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}
.readiness-ring svg {
  transform: rotate(-90deg);
  width: 80px;
  height: 80px;
}
.readiness-ring__bg {
  fill: none;
  stroke: var(--color-border);
  stroke-width: 7;
}
.readiness-ring__fill {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}
.readiness-ring__label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.readiness-ring__score {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-text);
}
.readiness-ring__pct {
  font-size: 0.62rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

/* Band label */
.readiness-band {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.readiness--ready        .readiness-band { background: #d1fae5; color: #065f46; }
.readiness--mostly-ready .readiness-band { background: #fef3c7; color: #92400e; }
.readiness--at-risk      .readiness-band { background: #ffedd5; color: #9a3412; }
.readiness--not-ready    .readiness-band { background: #fee2e2; color: #991b1b; }

/* Ring colour by band */
.readiness--ready        .readiness-ring__fill { stroke: #059669; }
.readiness--mostly-ready .readiness-ring__fill { stroke: #d97706; }
.readiness--at-risk      .readiness-ring__fill { stroke: #ea580c; }
.readiness--not-ready    .readiness-ring__fill { stroke: #dc2626; }

/* Breakdown bar */
.readiness-breakdown {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.25rem;
}
.readiness-breakdown__row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
}
.readiness-breakdown__label {
  flex: 0 0 70px;
  text-align: left;
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.readiness-breakdown__bar-wrap {
  flex: 1;
  height: 5px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.readiness-breakdown__bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--color-primary);
  transition: width 0.5s ease;
}
.readiness-breakdown__pct {
  flex: 0 0 26px;
  text-align: right;
  color: var(--color-text-muted);
  font-weight: 600;
}

/* Section wrapper */
.readiness-section {
  margin-bottom: 1.25rem;
}
.readiness-section__title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

/* ─── Record Attachments (Priority 5) ───────────────────────────────────── */

.att-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.85rem;
  margin-top: 1rem;
  background: var(--color-bg);
}

.att-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.att-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
.att-count {
  background: var(--color-primary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

/* List */
.att-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}
.att-empty {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0;
}
.att-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
}
.att-icon { font-size: 1rem; flex-shrink: 0; }
.att-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.att-name {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.att-name:hover { text-decoration: underline; }
.att-meta {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

/* Upload zone */
.att-upload-zone {
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.att-upload-zone:hover,
.att-upload-zone.att-drag-over {
  border-color: var(--color-primary);
  background: #eff6ff;
}
.att-file-input {
  display: none;
}
.att-upload-label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  cursor: pointer;
  display: block;
}

/* Progress bar */
.att-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.att-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--color-primary);
  border-radius: 999px;
  width: 0%;
  transition: width 0.2s;
}
.att-progress-pct {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* Error */
.att-error {
  font-size: 0.78rem;
  color: var(--color-danger, #dc2626);
  margin-top: 0.4rem;
  font-weight: 600;
}
/* ─────────────────────────────────────────────────────────────────
   GAP & RESOLVED BADGE STYLES — append to assets/css/shared.css
   Add these lines after the existing .badge--blue line (line 337).
   ───────────────────────────────────────────────────────────────── */

/* GAP — dark charcoal, clearly distinct from any existing badge */
.badge--gap {
  background: #1e1e2e;
  color:      #e2e2f0;
  border:     1px solid #4a4a6a;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
}

/* RESOLVED — muted teal, signals the gap was closed */
.badge--resolved {
  background: #e6f4f1;
  color:      #2a7a6a;
  border:     1px solid #b2d8d0;
  font-weight: 600;
}

/* ── Induction checklist display ──────────────────────────────────────────── */

.induction-checklist {
  margin-top: 0.5rem;
}

.induction-checklist__category {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0.75rem 0 0.35rem;
}

.induction-checklist__item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.875rem;
}

.induction-checklist__item:last-child {
  border-bottom: none;
}

.induction-checklist__item input[type="checkbox"] {
  margin-top: 0.1rem;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.induction-checklist__item label {
  cursor: pointer;
  line-height: 1.4;
  color: var(--color-text);
}

.induction-inducted-by {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* ── Induction certificate badge ──────────────────────────────────────────── */

.induction-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #6ee7b7;
  border-radius: var(--radius);
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.induction-badge--pending {
  background: #fffbeb;
  color: #92400e;
  border-color: #fcd34d;
}

/* ── Induction template topic editor (settings.html) ─────────────────────── */

.induction-topic-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
  max-height: 260px;
  overflow-y: auto;
}

.induction-topic-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.induction-topic-row span {
  flex: 1;
  color: var(--color-text);
}

.induction-topic-row .category-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-muted);
  background: var(--color-bg-subtle, #f3f4f6);
  border-radius: 3px;
  padding: 0.15rem 0.4rem;
  white-space: nowrap;
}

.induction-topic-add {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: center;
}

/* ── Supernumerary form section ───────────────────────────────────────────── */

.supernumerary-section {
  display: none;
}

.supernumerary-section.visible {
  display: block;
}

/* ── Readiness sub-dials (C1 — Tier 5) ───────────────────────────────────── */

/* Row that holds the two sub-dials side by side */
.readiness-sub-dials {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: flex-start;
  margin-top: 0.25rem;
}

/* Each sub-dial wrapper (ring + label) */
.readiness-sub-dial {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  position: relative;
}

/* Small ring modifier — 50px diameter, r=20, circumference ≈ 125.7 */
.readiness-ring--sm {
  width: 50px;
  height: 50px;
}
.readiness-ring--sm svg {
  width: 50px;
  height: 50px;
}
.readiness-ring--sm .readiness-ring__bg {
  stroke-width: 5;
}
.readiness-ring--sm .readiness-ring__fill {
  stroke-width: 5;
}
.readiness-ring--sm .readiness-ring__score {
  font-size: 0.82rem;
  font-weight: 800;
}
.readiness-ring--sm .readiness-ring__pct {
  font-size: 0.48rem;
}

/* Sub-dial fill colours — independent of card band class */
.readiness-ring--green .readiness-ring__fill { stroke: #059669; }
.readiness-ring--amber .readiness-ring__fill { stroke: #d97706; }
.readiness-ring--red   .readiness-ring__fill { stroke: #dc2626; }

/* Sub-dial label */
.readiness-sub-dial__label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Tooltip — appears above the dial on hover */
.readiness-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 0.35rem 0.6rem;
  border-radius: 5px;
  white-space: nowrap;
  max-width: 220px;
  white-space: normal;
  text-align: center;
  pointer-events: none;
  z-index: 100;
  transition: opacity 0.15s ease;
}

/* Tooltip arrow */
.readiness-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(15, 23, 42, 0.92);
}

/* Show tooltip on hover of the dial wrapper */
.readiness-sub-dial:hover .readiness-tooltip,
.readiness-main-dial:hover .readiness-tooltip {
  visibility: visible;
  opacity: 1;
}

/* Main dial tooltip wrapper */
.readiness-main-dial {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

/* ── Tier 8.4 — Nav section headers ─────────────────────────────────────────── */
.app-nav__menu li.nav-section-header {
  padding: 0.75rem 1rem 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.45);
  pointer-events: none;
  user-select: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 0.25rem;
}
.app-nav__menu li.nav-section-header:first-child {
  border-top: none;
  margin-top: 0;
}

/* ── SEATAG nav footer attribution ──────────────────────────────────────────── */
.app-nav__seatag {
  padding: 0.5rem 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}

.app-nav__seatag img {
  height: 26px;
  width: auto;
  opacity: 0.75;
  filter: brightness(0) invert(1);
  transition: opacity 0.2s;
}

.app-nav__seatag img:hover { opacity: 1; }
