/* ============================================================
   DESIGN SYSTEM — Industrial / Field-grade
   Sansom red + dark slate + high-contrast type
   Barlow Condensed headers, Barlow body
   ============================================================ */
:root {
  --red:        #BC2326;
  --red-dark:   #921b1e;
  --red-light:  #d92a2d;
  --red-bg:     rgba(188,35,38,0.08);
  --red-border: rgba(188,35,38,0.25);

  --bg:         #0f1923;
  --surface:    #162231;
  --surface2:   #1e2f42;
  --surface3:   #253648;
  --border:     rgba(255,255,255,0.08);
  --border2:    rgba(255,255,255,0.14);

  --text:       #e8edf2;
  --text-muted: #7a93a8;
  --text-dim:   #4a6070;

  --green:      #2ecc71;
  --green-bg:   rgba(46,204,113,0.1);
  --amber:      #f39c12;
  --amber-bg:   rgba(243,156,18,0.1);
  --blue:       #3498db;
  --blue-bg:    rgba(52,152,219,0.1);

  --radius:     6px;
  --radius-lg:  10px;
  --font-head:  'Barlow Condensed', sans-serif;
  --font-body:  'Barlow', sans-serif;

  --header-h:   56px;
  --nav-h:      44px;
}

/* ── LIGHT THEME ── */
body.light {
  --bg:         #f0f2f5;
  --surface:    #ffffff;
  --surface2:   #eaecf0;
  --surface3:   #d8dce2;
  --border:     rgba(0,0,0,0.10);
  --border2:    rgba(0,0,0,0.18);
  --text:       #1a2330;
  --text-muted: #4a5e70;
  --text-dim:   #8a9aaa;
  --green-bg:   rgba(46,204,113,0.12);
  --amber-bg:   rgba(243,156,18,0.12);
  --blue-bg:    rgba(52,152,219,0.12);
  --red-bg:     rgba(188,35,38,0.08);
}
/* Header stays dark in light mode for contrast */
body.light .app-header {
  background: #1a1a1a;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
body.light .nav-tabs { background: #1a1a1a; border-top-color: rgba(255,255,255,0.1); }
body.light .nav-tab  { color: rgba(255,255,255,0.5); }
body.light .nav-tab:hover { color: rgba(255,255,255,0.8); }
body.light .nav-tab.active { color: white; }
body.light .net-pill.online  { background: rgba(46,204,113,0.15); }
body.light .net-pill.offline { background: rgba(243,156,18,0.15); }
body.light .auth-btn { background: rgba(255,255,255,0.1); color: white; border-color: rgba(255,255,255,0.2); }
body.light .auth-btn:hover { background: rgba(255,255,255,0.2); }
body.light .theme-toggle { color: rgba(255,255,255,0.6); }
/* Cards and surfaces */
body.light .report-card { background: var(--surface); border-color: var(--border2); }
body.light .report-card:hover { border-color: var(--red); border-left-color: var(--red); }
body.light .section-card { background: var(--surface); border-color: var(--border2); }
body.light .section-head { background: var(--surface2); }
body.light .section-head:hover { background: var(--surface3); }
body.light .section-title { color: #1a2330; }
body.light .section-num  { background: var(--red); }
body.light .form-actions { background: var(--surface); border-color: var(--border2); box-shadow: 0 -4px 16px rgba(0,0,0,0.08); }
/* Form fields */
body.light .fg label { color: var(--text-muted); }
body.light .fg input, body.light .fg select, body.light .fg textarea {
  background: var(--surface2); border-color: var(--border2); color: var(--text);
}
body.light .fg input:not([readonly]):not([disabled]),
body.light .fg select:not([disabled]),
body.light .fg textarea:not([readonly]):not([disabled]) {
  background: white; border-color: rgba(0,0,0,0.22);
}
body.light .fg input:focus, body.light .fg select:focus, body.light .fg textarea:focus {
  border-color: var(--red); box-shadow: 0 0 0 3px var(--red-border);
}
body.light .dyn-table th { background: var(--surface2); color: var(--text-muted); }
body.light .dyn-table td input, body.light .dyn-table td select { background: white; color: var(--text); border-color: var(--border2); }
/* Badges */
body.light .badge-draft    { background: rgba(243,156,18,0.15);  color: #b07000; }
body.light .badge-complete { background: rgba(46,204,113,0.15);  color: #1a8a4a; }
body.light .badge-synced   { background: rgba(52,152,219,0.15);  color: #1a5fa0; }
/* Toggles */
body.light .toggle-switch { background: var(--surface2); border-color: var(--border2); color: var(--text); }
body.light .toggle-track  { background: var(--surface3); border-color: var(--border2); }
/* Info box / sync */
body.light .info-box { background: var(--surface2); border-color: var(--border2); color: var(--text-muted); }
body.light .info-box strong { color: var(--text); }
body.light .sync-row  { border-bottom-color: var(--border2); }
body.light .sync-info strong { color: var(--text); }
/* Buttons */
body.light .btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border2); }
body.light .btn-secondary:hover { background: var(--surface3); }
/* Reports bar */
body.light .reports-bar h2, body.light .form-topbar h2 { color: #1a2330; }
body.light .report-id { background: var(--surface2); color: var(--text-muted); border-color: var(--border2); }
body.light .rc-info h3 { color: #1a2330; }
/* Empty state */
body.light .empty-state { color: var(--text-muted); }
/* Tasks panel */
body.light #tasksPanel .section-title { color: #1a2330; }
/* Scrollbar */
body.light ::-webkit-scrollbar-track { background: var(--bg); }
body.light ::-webkit-scrollbar-thumb { background: var(--surface3); }
/* Modal */
body.light .modal-box h3 { color: var(--text); }

/* ── THEME TOGGLE ── */
.theme-toggle {
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none;
  font-family: var(--font-head); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted);
}
.theme-toggle-track {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--surface3); border: 1px solid var(--border2);
  position: relative; transition: background 0.2s;
  flex-shrink: 0;
}
.theme-toggle-track.on { background: var(--red); border-color: var(--red-dark); }
.theme-toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: white; transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.theme-toggle-track.on .theme-toggle-thumb { left: 18px; }

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

html { font-size: 15px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  position: sticky; top: 0; z-index: 200;
  background: var(--surface);
  border-bottom: 2px solid var(--red);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.header-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: var(--header-h);
  gap: 12px;
}
.header-logo {
  display: flex; align-items: center; gap: 10px;
}
.logo-mark {
  width: 36px; height: 36px; background: var(--red);
  border-radius: 4px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark svg { width: 22px; height: 22px; fill: white; }
.logo-text { display: flex; flex-direction: column; }
.logo-name {
  font-family: var(--font-head);
  font-size: 18px; font-weight: 800; letter-spacing: 0.5px;
  color: white; line-height: 1;
  text-transform: uppercase;
}
.logo-sub {
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  font-weight: 500;
}
.header-right {
  display: flex; align-items: center; gap: 10px;
}
.net-pill {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  transition: all 0.3s;
}
.net-pill.online  { background: var(--green-bg);  color: var(--green); border: 1px solid rgba(46,204,113,0.25); }
.net-pill.offline { background: var(--amber-bg);  color: var(--amber); border: 1px solid rgba(243,156,18,0.25); }
.net-dot { width: 6px; height: 6px; border-radius: 50%; }
.net-pill.online  .net-dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.net-pill.offline .net-dot { background: var(--amber); box-shadow: 0 0 6px var(--amber); }

/* auth button */
.auth-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border2);
  background: var(--surface2); color: var(--text);
  transition: all 0.2s; text-transform: uppercase; letter-spacing: 0.5px;
}
.auth-btn:hover { background: var(--surface3); border-color: var(--red); }
.auth-btn svg { width: 14px; height: 14px; }
.auth-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--red); color: white;
  font-family: var(--font-head); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── NAV TABS ── */
.nav-tabs {
  display: flex; overflow-x: auto; background: var(--surface);
  border-top: 1px solid var(--border); gap: 0;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  padding: 0 18px; height: var(--nav-h);
  font-family: var(--font-head); font-size: 13px; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--text-muted); cursor: pointer; white-space: nowrap;
  border-bottom: 3px solid transparent;
  display: flex; align-items: center; gap: 6px;
  transition: all 0.15s; user-select: none; flex-shrink: 0;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: white; border-bottom-color: var(--red); }
.tab-badge {
  background: var(--red); color: white;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 10px; display: flex; align-items: center; justify-content: center;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main { max-width: 900px; margin: 0 auto; padding: 20px 16px 80px; }

/* ── SECTION CARDS ── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden;
}
.section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
.section-head:hover { background: var(--surface3); }
.section-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--red); color: white;
  font-family: var(--font-head); font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.section-title {
  font-family: var(--font-head); font-size: 15px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px; color: white;
  flex: 1;
}
.section-chevron {
  color: var(--text-muted); font-size: 11px; transition: transform 0.2s;
}
.section-card.collapsed .section-chevron { transform: rotate(-90deg); }
.section-card.collapsed .section-body { display: none; }
.section-body { padding: 16px; }

/* ── FIELD GRID ── */
.fgrid   { display: grid; gap: 12px 16px; }
.fgrid-2 { grid-template-columns: 1fr 1fr; }
.fgrid-3 { grid-template-columns: 1fr 1fr 1fr; }
.fgrid-4 { grid-template-columns: repeat(4, 1fr); }
.full    { grid-column: 1 / -1; }

@media (max-width: 600px) {
  .fgrid-2, .fgrid-3, .fgrid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
  .fgrid-2, .fgrid-3, .fgrid-4 { grid-template-columns: 1fr; }
}

/* ── FIELD GROUP ── */
.fg { display: flex; flex-direction: column; gap: 5px; }
.fg label {
  font-family: var(--font-head);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted);
}
.fg input, .fg select, .fg textarea {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-family: var(--font-body); font-size: 14px;
  color: var(--text); width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
.fg input:focus, .fg select:focus, .fg textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-border);
}
.fg textarea { resize: vertical; min-height: 90px; }
.fg select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%237a93a8' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px;
}
.fg input::placeholder, .fg textarea::placeholder { color: var(--text-dim); }

/* Editable fields get a lighter background so they stand out */
.fg input:not([readonly]):not([disabled]),
.fg select:not([disabled]),
.fg textarea:not([readonly]):not([disabled]) {
  background: var(--surface3);
  border-color: rgba(255,255,255,0.22);
}

/* Section 1 locked state */
#sec1.sec1-locked .fg input,
#sec1.sec1-locked .fg select,
#sec1.sec1-locked .fg textarea {
  opacity: 0.65;
  pointer-events: none;
  background: var(--surface2);
  border-color: var(--border);
}

/* ── REQUIRED MARK ── */
.req { color: var(--red); margin-left: 2px; }

/* ── DIVIDER ── */
.divider {
  border: none; border-top: 1px solid var(--border);
  margin: 14px 0;
}

/* ── CHECKBOX ITEMS ── */
.cb-group { display: flex; flex-direction: column; gap: 8px; }
.cb-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 16px; }
.cb-item  {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer;
  color: var(--text); user-select: none;
}
.cb-item input[type=checkbox],
.cb-item input[type=radio] {
  width: 16px; height: 16px; flex-shrink: 0;
  accent-color: var(--red); cursor: pointer;
}

/* ── TOGGLE SWITCH ── */
.toggle-switch {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  font-size: 13px; color: var(--text);
  padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface2);
  transition: border-color 0.15s, background 0.15s;
}
.toggle-switch:hover { border-color: var(--red-border); }
.toggle-switch input { display: none; }
.toggle-track {
  width: 38px; height: 22px; border-radius: 11px;
  background: var(--surface3); border: 1px solid var(--border2);
  position: relative; transition: background 0.2s; flex-shrink: 0;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-muted); transition: left 0.2s, background 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
.toggle-switch input:checked ~ .toggle-track { background: var(--red); border-color: var(--red-dark); }
.toggle-switch input:checked ~ .toggle-track .toggle-thumb { left: 18px; background: white; }
.toggle-switch input:checked ~ span { color: var(--text); font-weight: 600; }
.toggle-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius);
  font-family: var(--font-head); font-size: 13px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  cursor: pointer; border: none; transition: all 0.15s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary   { background: var(--red);      color: white; }
.btn-primary:hover   { background: var(--red-light); }
.btn-secondary { background: var(--surface2); color: var(--text);  border: 1px solid var(--border2); }
.btn-secondary:hover { background: var(--surface3); border-color: var(--border2); }
.btn-success   { background: var(--green-bg); color: var(--green); border: 1px solid rgba(46,204,113,0.25); }
.btn-success:hover   { background: rgba(46,204,113,0.2); }
.btn-danger    { background: rgba(176,28,38,0.15); color: #e05560; border: 1px solid var(--red-border); }
.btn-danger:hover    { background: rgba(176,28,38,0.25); }
.btn-amber     { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(243,156,18,0.25); }
.btn-sm { padding: 5px 12px; font-size: 11px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── REPORTS LIST ── */
.reports-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 10px; flex-wrap: wrap;
}
.reports-bar h2 {
  font-family: var(--font-head); font-size: 20px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px; color: white;
}
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-lg);
  padding: 14px 16px; margin-bottom: 10px;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.report-card:hover {
  border-color: var(--red);
  border-left-color: var(--red);
  transform: translateX(2px);
}
.rc-info h3 {
  font-family: var(--font-head); font-size: 16px; font-weight: 700;
  color: white; margin-bottom: 3px;
}
.rc-info p { font-size: 12px; color: var(--text-muted); }
.rc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }

/* ── BADGES ── */
.badge {
  padding: 3px 9px; border-radius: 3px;
  font-family: var(--font-head); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-draft    { background: var(--amber-bg);  color: var(--amber); }
.badge-complete { background: var(--green-bg);  color: var(--green); }
.badge-synced   { background: var(--blue-bg);   color: var(--blue); }

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state svg { width: 52px; height: 52px; opacity: 0.2; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ── FORM TOP BAR ── */
.form-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.form-topbar h2 {
  font-family: var(--font-head); font-size: 20px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px; color: white;
}
.report-id {
  font-family: monospace; font-size: 11px;
  background: var(--surface2); color: var(--text-muted);
  padding: 2px 8px; border-radius: 3px; border: 1px solid var(--border);
}

/* ── FORM ACTIONS BAR ── */
.form-actions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  position: sticky; bottom: 16px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
  z-index: 10;
}

/* ── DYNAMIC TABLES ── */
.dyn-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dyn-table th {
  background: var(--surface2); padding: 8px 10px; text-align: left;
  font-family: var(--font-head); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.dyn-table td { padding: 4px 3px; border-bottom: 1px solid var(--border); }
.dyn-table td:last-child { width: 36px; }
.dyn-table td input, .dyn-table td select, .dyn-table td textarea {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 4px; padding: 6px 8px;
  font-family: var(--font-body); font-size: 13px; color: var(--text); width: 100%;
}
.dyn-table td input:focus, .dyn-table td select:focus, .dyn-table td textarea:focus {
  outline: none; border-color: var(--red);
}
.dyn-table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* ── SIGNATURE ── */
.sig-canvas {
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  cursor: crosshair; display: block;
  background: var(--surface2); touch-action: none; width: 100%; height: 130px;
}

/* ── TASKS CALENDAR ── */
.tasks-view-toggle { display: flex; gap: 6px; margin-bottom: 12px; }
.tasks-cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tasks-cal-nav span { font-family: var(--font-head); font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.tasks-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-family: var(--font-head); font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; padding: 4px 0; }
.cal-day {
  min-height: 56px; border-radius: 4px; padding: 4px;
  background: var(--surface2); border: 1px solid var(--border);
  font-size: 10px; position: relative; vertical-align: top;
}
.cal-day.other-month { opacity: 0.3; }
.cal-day.today { border-color: var(--red); }
.cal-day-num { font-family: var(--font-head); font-size: 11px; font-weight: 700; color: var(--text-muted); display: block; margin-bottom: 2px; }
.cal-task-dot {
  background: var(--red); color: white; border-radius: 3px;
  padding: 2px 4px; font-size: 9px; font-family: var(--font-head); font-weight: 700;
  margin-bottom: 2px; display: block; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; cursor: pointer; letter-spacing: 0.3px;
}
.cal-task-dot:hover { background: var(--red-light); }

/* ── ATTACHMENTS ── */
.attach-dropzone {
  border: 2px dashed var(--border2); border-radius: var(--radius-lg);
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--surface2);
}
.attach-dropzone:hover, .attach-dropzone.dragover {
  border-color: var(--red); background: var(--red-bg);
}
.attach-dropzone svg { width: 36px; height: 36px; color: var(--red); margin-bottom: 8px; }
.attach-dropzone p { font-size: 13px; color: var(--text); font-weight: 500; }
.attach-dropzone small { font-size: 11px; color: var(--text-muted); }
#attachFileInput { display: none; }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 14px; }
.attach-card {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 10px;
  display: flex; flex-direction: column; gap: 7px;
  position: relative; transition: border-color 0.15s;
}
.attach-card:hover { border-color: var(--red); }
.attach-thumb {
  width: 100%; height: 100px; border-radius: 4px;
  background: var(--surface3); display: flex; align-items: center;
  justify-content: center; overflow: hidden;
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-thumb-icon { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 5px; width: 100%; height: 100%; }
.attach-thumb-icon svg { width: 28px; height: 28px; opacity: 0.5; }
.attach-thumb-icon span { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.attach-name { font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-meta { font-size: 10px; color: var(--text-muted); }
.attach-label-select { font-size: 11px; background: var(--surface3); border: 1px solid var(--border2); border-radius: 4px; padding: 3px 6px; color: var(--text); width: 100%; }
.attach-del-btn {
  position: absolute; top: 7px; right: 7px;
  background: var(--red-bg); border: 1px solid var(--red-border); border-radius: 50%;
  width: 20px; height: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--red); font-size: 12px; line-height: 1;
  opacity: 0; transition: opacity 0.15s;
}
.attach-card:hover .attach-del-btn { opacity: 1; }
.attach-download-btn { font-size: 11px; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 0; text-align: left; text-decoration: underline; }
.attach-download-btn:hover { color: var(--text); }

/* ── SYNC PANEL ── */
.sync-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px;
}
.sync-row:last-child { border-bottom: none; }
.sync-info strong { font-weight: 600; color: white; font-size: 14px; }
.sync-info small { font-size: 11px; color: var(--text-muted); display: block; margin-top: 2px; }
.sync-actions { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }

.info-box {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 14px 16px;
  font-size: 13px; color: var(--text-muted); margin-bottom: 16px;
  line-height: 1.7;
}
.info-box strong { color: var(--text); }

/* ── JHA HAZARD GRID ── */
.hazard-section-label {
  font-family: var(--font-head); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px; color: var(--red);
  margin: 14px 0 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--red-border);
}

/* ── UNSAVED CHANGES MODAL ── */
#unsavedModal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
#unsavedModal.hidden { display: none; }
.modal-box {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: 28px 24px;
  max-width: 360px; width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.modal-box h3 {
  font-family: var(--font-head); font-size: 18px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.8px; color: white;
  margin-bottom: 10px;
}
.modal-box p { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.6; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--surface2); color: var(--text);
  padding: 12px 22px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 9999; opacity: 0; transition: all 0.3s;
  white-space: nowrap; pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.success { border-color: rgba(46,204,113,0.4); color: var(--green); }
#toast.error   { border-color: var(--red-border); color: #e05560; }
#toast.info    { border-color: rgba(52,152,219,0.4); color: var(--blue); }

/* ── AUTH OVERLAY ── */
#authOverlay {
  position: fixed; inset: 0; z-index: 1000;
  background: #0f1923;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 32px;
}
#authOverlay.hidden { display: none; }
.auth-logo {
  width: 64px; height: 64px; background: var(--red);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.auth-logo svg { width: 40px; height: 40px; fill: white; }
.auth-title {
  font-family: var(--font-head); font-size: 28px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px; color: white;
}
.auth-sub { font-size: 14px; color: #7a93a8; text-align: center; max-width: 300px; }
.auth-login-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 28px; border-radius: var(--radius-lg);
  background: var(--red); color: white; border: none;
  font-family: var(--font-head); font-size: 16px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  cursor: pointer; transition: background 0.2s;
}
.auth-login-btn:hover { background: var(--red-light); }

.hidden { display: none !important; }
