/* ═══════════════════════════════════════════════════════════════════
   WeldAssign AI — Light Professional Theme
   NPCIL SM-11 Welding Assignment Demo
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Reset + Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --surface-hi:  #f8fafc;
  --surface-hov: #f1f5f9;
  --border:      #e2e8f0;
  --border-hi:   #cbd5e1;
  --text:        #0f172a;
  --muted:       #475569;
  --dim:         #94a3b8;
  --accent:      #0284c7;
  --accent-dim:  #0369a1;
  --c-green:     #16a34a;
  --c-amber:     #d97706;
  --c-red:       #dc2626;
  --c-purple:    #9333ea;
  --c-blue:      #2563eb;
  --c-teal:      #0d9488;
  --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:        'JetBrains Mono', 'Fira Code', monospace;
  --sidebar-w:   224px;
  --topbar-h:    52px;
  --guided-h:    44px;
  --radius:      6px;
  --radius-lg:   10px;
  --shadow:      0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.05);
  --shadow-lg:   0 12px 32px rgba(15,23,42,.12);
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; cursor: pointer; }

/* ─── App Shell ─────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ─── Sidebar (intentionally dark — enterprise mixed-theme) ─────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #1e293b;
  border-right: 1px solid #334155;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
  /* Scope dark vars inside sidebar so text stays readable */
  --text:       #f1f5f9;
  --muted:      #94a3b8;
  --dim:        #64748b;
  --accent:     #38bdf8;
  --surface:    #263347;
  --surface-hi: #2d3c50;
  --border:     #334155;
  --c-green:    #22c55e;
}

.sidebar-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid #334155;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0c1a2e;
  font-weight: 700;
  flex-shrink: 0;
}

.logo-icon svg { width: 18px; height: 18px; stroke-width: 2.5; }

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

.logo-title {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -.3px;
}

.logo-sub {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 8px 8px 4px;
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  user-select: none;
}

.nav-item svg { width: 15px; height: 15px; stroke-width: 2; flex-shrink: 0; }

.nav-item:hover { background: #263347; color: #f1f5f9; }

.nav-item.active {
  background: rgba(56,189,248,.15);
  color: #38bdf8;
  font-weight: 600;
}

.nav-separator {
  height: 1px;
  background: #334155;
  margin: 8px 0;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid #334155;
}

.shift-indicator { display: flex; flex-direction: column; gap: 3px; }

.shift-label {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.shift-badge {
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
  font-family: var(--mono);
}

/* ─── Main Wrapper ──────────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ─── Topbar ────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 10;
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }

.topbar-job { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }

.topbar-hint { color: var(--dim); font-size: 13px; font-style: italic; }

.topbar-job-tag {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(2,132,199,.08);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(2,132,199,.2);
  flex-shrink: 0;
}

.topbar-job-desc {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

.guided-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}

.guided-toggle:hover { border-color: var(--accent); color: var(--accent); }
.guided-toggle.on { border-color: var(--accent); color: var(--accent); background: rgba(2,132,199,.06); }

.guided-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
  transition: background .15s;
}

.guided-toggle.on .guided-dot { background: var(--accent); animation: pulse-dot 2s infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.topbar-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}

/* ─── Guided Bar ────────────────────────────────────────────────── */
.guided-bar {
  height: 0;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(2,132,199,.07) 0%, rgba(2,132,199,.02) 100%);
  border-bottom: 1px solid rgba(2,132,199,.2);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  transition: height .2s ease;
  flex-shrink: 0;
}

.guided-bar.visible { height: var(--guided-h); }

.guided-step-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--mono);
  white-space: nowrap;
  background: rgba(2,132,199,.1);
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.guided-hint {
  flex: 1;
  font-size: 12px;
  color: #0369a1;
  font-style: italic;
}

.guided-actions { display: flex; gap: 6px; flex-shrink: 0; }

.btn-guided {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(2,132,199,.3);
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
}

.btn-guided:hover { background: rgba(2,132,199,.1); }

/* ─── Main Content ──────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  padding: 24px;
}

/* ─── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Section Head ──────────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.section-title { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.section-sub   { font-size: 12px; color: var(--muted); margin-top: 3px; }
.section-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ─── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .6px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
  white-space: nowrap;
  line-height: 1;
}

.btn svg { width: 14px; height: 14px; stroke-width: 2; flex-shrink: 0; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary   { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-dim); border-color: var(--accent-dim); }

.btn-secondary { background: var(--surface-hi); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-hov); border-color: var(--border-hi); }

.btn-ghost     { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hi); color: var(--text); }

.btn-danger    { background: rgba(220,38,38,.08); color: #b91c1c; border-color: rgba(220,38,38,.25); }
.btn-danger:hover:not(:disabled) { background: rgba(220,38,38,.15); }

.btn-success   { background: rgba(22,163,74,.1); color: #15803d; border-color: rgba(22,163,74,.25); }
.btn-success:hover:not(:disabled) { background: rgba(22,163,74,.18); }

.btn-warn      { background: rgba(217,119,6,.08); color: #92400e; border-color: rgba(217,119,6,.25); }
.btn-warn:hover:not(:disabled) { background: rgba(217,119,6,.15); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm svg { width: 12px; height: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }

/* ─── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
  line-height: 1.6;
}

.badge-green  { background: rgba(22,163,74,.1);   color: #15803d; border: 1px solid rgba(22,163,74,.25); }
.badge-amber  { background: rgba(217,119,6,.1);   color: #92400e; border: 1px solid rgba(217,119,6,.25); }
.badge-red    { background: rgba(220,38,38,.1);   color: #b91c1c; border: 1px solid rgba(220,38,38,.25); }
.badge-blue   { background: rgba(37,99,235,.1);   color: #1d4ed8; border: 1px solid rgba(37,99,235,.25); }
.badge-purple { background: rgba(147,51,234,.1);  color: #7e22ce; border: 1px solid rgba(147,51,234,.25); }
.badge-gray   { background: rgba(100,116,139,.1); color: #475569; border: 1px solid rgba(100,116,139,.2); }
.badge-teal   { background: rgba(13,148,136,.1);  color: #0f766e; border: 1px solid rgba(13,148,136,.25); }

/* ─── Tables ────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }

table { width: 100%; border-collapse: collapse; }

thead tr { background: var(--surface-hi); border-bottom: 1px solid var(--border); }

thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .5px;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .12s;
  cursor: pointer;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody tr.selected { background: rgba(2,132,199,.05); }

tbody td { padding: 11px 14px; font-size: 13px; vertical-align: middle; color: var(--text); }

.text-mono  { font-family: var(--mono); font-size: 12px; }
.text-muted { color: var(--muted); }
.text-dim   { color: var(--dim); }
.text-accent{ color: var(--accent); }
.text-green { color: var(--c-green); }
.text-red   { color: var(--c-red); }
.text-amber { color: var(--c-amber); }

/* ─── Filters Bar ───────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-select, .search-input {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font);
  padding: 6px 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  height: 32px;
  appearance: none;
}

.filter-select:focus, .search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(2,132,199,.1);
}
.search-input { width: 200px; }
.search-input::placeholder { color: var(--dim); }

/* ─── Guided Highlight ──────────────────────────────────────────── */
.guided-highlight {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px;
  border-radius: var(--radius);
  animation: glow-pulse 1.5s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(2,132,199,.35); }
  50%       { box-shadow: 0 0 0 6px rgba(2,132,199,0); }
}

.demo-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(2,132,199,.1);
  color: var(--accent);
  border: 1px solid rgba(2,132,199,.2);
  letter-spacing: .3px;
}

/* ─── Right Drawer ──────────────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.25);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 500px;
  max-width: 95vw;
  background: #ffffff;
  border-left: 1px solid var(--border);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.16,1,.3,1);
  box-shadow: var(--shadow-lg);
}

.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: #ffffff;
}

.drawer-title { font-size: 15px; font-weight: 700; color: var(--text); }

.drawer-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.drawer-close:hover { background: var(--surface-hi); color: var(--text); }
.drawer-close svg { width: 14px; height: 14px; stroke-width: 2; }

.drawer-body { flex: 1; overflow-y: auto; padding: 20px; background: #ffffff; }

.drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: #ffffff;
}

/* ─── Loading State ─────────────────────────────────────────────── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 80px 20px;
  color: var(--muted);
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── AI Loading Overlay ────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(241,245,249,.85);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.loading-overlay.active { opacity: 1; pointer-events: auto; }

.loading-modal {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 40px 32px;
  width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 20px 50px rgba(15,23,42,.14);
}

.loading-spinner-wrap {
  position: relative;
  width: 72px;
  height: 72px;
}

.loading-ring-outer {
  position: absolute;
  inset: 0;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

.loading-ring-inner {
  position: absolute;
  inset: 10px;
  border: 2px solid transparent;
  border-bottom-color: rgba(2,132,199,.35);
  border-radius: 50%;
  animation: spin .6s linear infinite reverse;
}

.loading-center-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.loading-title { font-size: 16px; font-weight: 700; color: var(--text); text-align: center; }
.loading-msg   { font-size: 13px; color: var(--muted); text-align: center; min-height: 20px; }

.loading-progress-track { width: 100%; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.loading-progress-bar   { height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); border-radius: 2px; width: 0%; transition: width .3s ease; }

.loading-sub { font-size: 11px; color: var(--dim); font-family: var(--mono); letter-spacing: .5px; }

/* ─── Toast (stays dark for contrast on any theme) ─────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius);
  border: 1px solid #334155;
  background: #0f172a;
  box-shadow: 0 4px 16px rgba(15,23,42,.2);
  font-size: 13px;
  animation: slideUp .25s ease;
  max-width: 340px;
}

.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-msg  { flex: 1; color: #f1f5f9; }

@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ─── WPS Extraction Layout ─────────────────────────────────────── */
.wps-layout { display: grid; grid-template-columns: 1fr 400px; gap: 20px; align-items: start; }

.pdf-panel { display: flex; flex-direction: column; gap: 8px; }

.pdf-thumb {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: all .15s;
}

.pdf-thumb:hover { border-color: var(--border-hi); }
.pdf-thumb.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(2,132,199,.15); }

.pdf-thumb-label {
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .4px;
  text-transform: uppercase;
  background: var(--surface-hi);
  border-top: 1px solid var(--border);
}

.pdf-viewer {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  max-height: 600px;
  padding: 14px;
  box-shadow: var(--shadow);
}

/* ─── WPS Document (ASME QW-482 paper style) ────────────────────── */
.wps-doc {
  background: #fafafa;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: #374151;
  padding: 16px;
  line-height: 1.6;
}

.wps-doc-org-header {
  text-align: center;
  border-bottom: 2px solid #d1d5db;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.wps-doc-org-name {
  font-size: 13px;
  font-weight: 700;
  color: #0369a1;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.wps-doc-form-title {
  font-size: 10px;
  color: #6b7280;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-top: 4px;
}

.wps-doc-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.wps-doc-table td { padding: 3px 6px; border: 1px solid #d1d5db; vertical-align: top; font-size: 10.5px; }
.wps-doc-fl { color: #6b7280; white-space: nowrap; width: 40%; }
.wps-doc-fv { color: #111827; font-weight: 600; }

.wps-doc-section { margin-bottom: 10px; }
.wps-doc-section-hdr {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #0369a1;
  background: rgba(2,132,199,.05);
  border-left: 3px solid #0284c7;
  padding: 3px 8px;
  margin-bottom: 4px;
  border-radius: 0 3px 3px 0;
}

.wps-hi {
  background: rgba(2,132,199,.12);
  color: #0369a1;
  border-bottom: 1px dashed rgba(2,132,199,.4);
  padding: 0 2px;
  border-radius: 2px;
}
.wps-hi::after { content: ' ◉'; font-size: 9px; opacity: .7; }

.wps-doc-stamp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #d1d5db;
  font-size: 9px;
  color: #9ca3af;
}

.wps-conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(22,163,74,.1);
  color: #15803d;
  border: 1px solid rgba(22,163,74,.25);
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
}

.wps-conf-badge.warn { background: rgba(217,119,6,.1); color: #92400e; border-color: rgba(217,119,6,.25); }

.wps-pass-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 10px; }
.wps-pass-table th { background: rgba(2,132,199,.06); padding: 3px 6px; text-align: left; font-size: 9px; color: #0369a1; letter-spacing: .5px; text-transform: uppercase; border: 1px solid #d1d5db; }
.wps-pass-table td { padding: 3px 6px; border: 1px solid #d1d5db; color: #374151; }

/* ─── Extracted Fields Panel ────────────────────────────────────── */
.wps-fields-panel { display: flex; flex-direction: column; gap: 0; }

.tab-bar { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }

.tab {
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: -1px;
  white-space: nowrap;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.field-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  background: #f8fafc;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: border-color .15s, box-shadow .15s;
  cursor: default;
}

.field-row:hover { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(2,132,199,.08); }

.field-label { font-size: 10px; font-weight: 600; color: var(--dim); letter-spacing: .4px; text-transform: uppercase; }
.field-value { font-size: 12px; font-weight: 600; color: var(--text); font-family: var(--mono); }
.field-value.hi { color: var(--accent); }

.field-conf { display: inline-flex; align-items: center; gap: 3px; font-size: 9px; font-weight: 700; color: var(--c-green); margin-top: 2px; }
.field-conf.warn { color: var(--c-amber); }

/* ─── Validation ────────────────────────────────────────────────── */
.check-table { width: 100%; border-collapse: collapse; }

.check-row {
  display: grid;
  grid-template-columns: 30px 1fr 180px 160px;
  align-items: start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}

.check-row:last-child { border-bottom: none; }
.check-row:hover { background: var(--surface-hi); }

.check-icon-wrap {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  margin-top: 1px;
}

.check-pass { background: rgba(22,163,74,.12);  color: #15803d; }
.check-fail { background: rgba(220,38,38,.12);  color: #b91c1c; }
.check-warn { background: rgba(217,119,6,.12);  color: #92400e; }

.check-name { font-size: 13px; font-weight: 600; color: var(--text); }
.check-detail-txt { font-size: 11px; color: #92400e; font-style: italic; margin-top: 3px; }
.check-req  { font-size: 12px; color: var(--muted); font-family: var(--mono); line-height: 1.4; }
.check-act  { font-size: 12px; color: var(--text);  font-family: var(--mono); line-height: 1.4; }

/* ─── Qual Mapping ──────────────────────────────────────────────── */
.mapping-card { background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }

.mapping-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: start;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.mapping-row:last-child { border-bottom: none; }
.mapping-row:hover { background: var(--surface-hi); }

.mapping-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.mapping-value { font-size: 13px; color: var(--text); }

.ticket-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(2,132,199,.08);
  border: 1px solid rgba(2,132,199,.2);
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all .15s;
}

.ticket-link:hover { background: rgba(2,132,199,.14); }

/* ─── Welder Matching ───────────────────────────────────────────── */
.welder-rank-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-hi);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  flex-shrink: 0;
}

.welder-rank-1 { background: rgba(2,132,199,.12); color: #0284c7; }
.welder-rank-2 { background: rgba(22,163,74,.1);  color: #15803d; }
.welder-rank-3 { background: rgba(217,119,6,.1);  color: #92400e; }

.welder-name { font-size: 13px; font-weight: 600; color: var(--text); }
.welder-id   { font-size: 10px; color: var(--dim); font-family: var(--mono); margin-top: 1px; }

.warn-chip {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(217,119,6,.1);
  color: #92400e;
  border: 1px solid rgba(217,119,6,.2);
  white-space: nowrap;
}

.reject-chip {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(220,38,38,.1);
  color: #b91c1c;
  border: 1px solid rgba(220,38,38,.2);
  white-space: nowrap;
}

/* ─── Constraint Table (Reasoning Drawer) ───────────────────────── */
.constraint-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.constraint-table th { padding: 7px 10px; background: var(--surface-hi); text-align: left; font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.constraint-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.constraint-table tr:last-child td { border-bottom: none; }
.constraint-table tr:hover td { background: var(--surface-hi); }

.cr-pass { color: #15803d; font-weight: 700; }
.cr-fail { color: #b91c1c; font-weight: 700; }
.cr-warn { color: #92400e; font-weight: 700; }

/* ─── Exception Cards ───────────────────────────────────────────── */
.exc-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border-left: 4px solid #dc2626;
  box-shadow: var(--shadow);
}

.exc-card.warn   { border-left-color: #d97706; }
.exc-card.purple { border-left-color: #9333ea; }

.exc-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-hi);
}

.exc-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.exc-icon.red    { background: rgba(220,38,38,.1);  color: #b91c1c;  }
.exc-icon.amber  { background: rgba(217,119,6,.1);  color: #92400e;  }
.exc-icon.purple { background: rgba(147,51,234,.1); color: #7e22ce;  }
.exc-icon svg { width: 18px; height: 18px; stroke-width: 2; }

.exc-job-tag  { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--accent); }
.exc-reason   { font-size: 14px; font-weight: 700; color: var(--text); }

.exc-body { padding: 14px 18px; display: flex; flex-direction: column; gap: 9px; }

.exc-row { display: grid; grid-template-columns: 120px 1fr; gap: 8px; font-size: 13px; align-items: start; }
.exc-row-label { color: var(--muted); font-size: 12px; font-weight: 600; }

.exc-actions { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-hi); }

/* ─── Execution Ticket (official document style) ─────────────────── */
.ticket-shell {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-family: var(--mono);
  box-shadow: 0 2px 12px rgba(15,23,42,.08);
}

.ticket-header {
  background: linear-gradient(135deg, #0f2942 0%, #1a3a5c 100%);
  padding: 20px 24px;
  border-bottom: 1px solid #1e3352;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.ticket-org   { font-size: 12px; font-weight: 700; color: #7dd3fc; letter-spacing: 1px; text-transform: uppercase; }
.ticket-title { font-size: 20px; font-weight: 800; color: #f1f5f9; margin-top: 4px; letter-spacing: -.5px; }
.ticket-sub   { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.ticket-stamp { text-align: right; font-size: 10px; color: #64748b; line-height: 1.8; }

.ticket-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }

.ticket-section { display: flex; flex-direction: column; gap: 10px; }

.ticket-section-hdr {
  font-size: 9px;
  font-weight: 700;
  color: #0369a1;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

.ticket-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ticket-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.ticket-field { display: flex; flex-direction: column; gap: 3px; }
.ticket-fl { font-size: 9px; font-weight: 600; color: #94a3b8; letter-spacing: .5px; text-transform: uppercase; }
.ticket-fv { font-size: 13px; font-weight: 600; color: #0f172a; }

.ticket-approved-box {
  background: rgba(22,163,74,.06);
  border: 1px solid rgba(22,163,74,.2);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ticket-approved-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(22,163,74,.12);
  color: #15803d;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.ticket-approved-icon svg { width: 18px; height: 18px; stroke-width: 2.5; }

.ticket-sig-box {
  border-top: 1px dashed var(--border);
  padding-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
}

.ticket-sig-line  { height: 1px; background: #cbd5e1; margin-top: 28px; margin-bottom: 4px; }
.ticket-sig-label { font-size: 9px; color: var(--dim); letter-spacing: .5px; text-transform: uppercase; }

/* ─── Detail Drawer Sections ────────────────────────────────────── */
.detail-section { margin-bottom: 18px; }

.detail-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}

.detail-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: start;
}

.detail-row:last-child { border-bottom: none; }
.detail-key { color: var(--muted); font-size: 12px; padding-top: 1px; }
.detail-val { color: var(--text); font-weight: 500; }

/* ─── Summary Banner ────────────────────────────────────────────── */
.summary-banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.summary-banner svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; margin-top: 1px; }

.summary-banner.pass   { background: rgba(22,163,74,.07);  border: 1px solid rgba(22,163,74,.2);  color: #15803d; }
.summary-banner.fail   { background: rgba(220,38,38,.07);  border: 1px solid rgba(220,38,38,.2);  color: #b91c1c; }
.summary-banner.warn   { background: rgba(217,119,6,.07);  border: 1px solid rgba(217,119,6,.2);  color: #92400e; }
.summary-banner.info   { background: rgba(2,132,199,.07);  border: 1px solid rgba(2,132,199,.2);  color: #0369a1; }
.summary-banner.purple { background: rgba(147,51,234,.07); border: 1px solid rgba(147,51,234,.2); color: #7e22ce; }

/* ─── Locked / Empty ────────────────────────────────────────────── */
.locked-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 70px 20px;
  text-align: center;
}

.locked-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--surface-hi);
  display: flex; align-items: center; justify-content: center;
  color: var(--dim);
  border: 1px solid var(--border);
}

.locked-icon svg { width: 24px; height: 24px; stroke-width: 1.5; }
.locked-title { font-size: 16px; font-weight: 700; color: var(--text); }
.locked-sub   { font-size: 13px; color: var(--muted); max-width: 300px; }

/* ─── Alert ─────────────────────────────────────────────────────── */
.alert { display: flex; gap: 10px; padding: 12px 16px; border-radius: var(--radius); font-size: 13px; }
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; stroke-width: 2; }
.alert-amber { background: rgba(217,119,6,.07);  border: 1px solid rgba(217,119,6,.2);  color: #92400e; }
.alert-red   { background: rgba(220,38,38,.07);  border: 1px solid rgba(220,38,38,.2);  color: #991b1b; }
.alert-blue  { background: rgba(2,132,199,.07);  border: 1px solid rgba(2,132,199,.2);  color: #075985; }
.alert-green { background: rgba(22,163,74,.07);  border: 1px solid rgba(22,163,74,.2);  color: #14532d; }

/* ─── Tooltip ───────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #f1f5f9;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: var(--radius);
  border: 1px solid #334155;
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(15,23,42,.2);
  font-family: var(--font);
  font-weight: 500;
}

/* ─── PDF Thumb Content ─────────────────────────────────────────── */
.pdf-thumb-doc { padding: 7px; background: #f9fafb; }
.pdf-thumb-doc-hdr { background: rgba(2,132,199,.1); padding: 3px; margin-bottom: 5px; text-align: center; border-radius: 2px; height: 8px; }
.pdf-thumb-doc-row { display: flex; gap: 4px; margin-bottom: 3px; }
.pdf-thumb-doc-cell { flex: 1; height: 5px; background: #e5e7eb; border-radius: 2px; }
.pdf-thumb-doc-cell.hi { background: rgba(2,132,199,.4); }
.pdf-thumb-doc-section-hdr { height: 5px; background: rgba(2,132,199,.15); border-left: 2px solid #0284c7; margin: 5px 0 3px; border-radius: 0 2px 2px 0; }
.pdf-thumb-doc-divider { height: 1px; background: #e5e7eb; margin: 4px 0; }

.pdf-thumb-table { padding: 6px 7px; background: #f9fafb; }
.pdf-thumb-hdr-row { display: flex; gap: 3px; margin-bottom: 4px; }
.pdf-thumb-hdr-cell { flex: 1; height: 5px; background: rgba(2,132,199,.18); border-radius: 1px; }
.pdf-thumb-data-row { display: flex; gap: 3px; margin-bottom: 3px; }
.pdf-thumb-data-cell { flex: 1; height: 4px; background: #e5e7eb; border-radius: 1px; }
.pdf-thumb-data-cell.hi { background: rgba(22,163,74,.35); }

.pdf-thumb-schematic { padding: 6px 7px; background: #f9fafb; min-height: 50px; }

/* ─── Plant Strip (sidebar — inherits sidebar dark scope) ───────── */
.plant-strip {
  background: rgba(56,189,248,.07);
  border-bottom: 1px solid #334155;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.plant-name {
  font-size: 9.5px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: .8px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plant-unit {
  font-size: 9px;
  color: #64748b;
  font-family: var(--mono);
  letter-spacing: .4px;
}

/* ─── Engineer Badge (sidebar footer — dark scope) ──────────────── */
.eng-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0 6px;
  position: relative;
}
.eng-avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(56,189,248,.15);
  border: 1.5px solid rgba(56,189,248,.3);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font);
  letter-spacing: -.5px;
}
.eng-name { font-size: 12px; font-weight: 600; color: #f1f5f9; }
.eng-role { font-size: 9.5px; color: #64748b; margin-top: 1px; }
.eng-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22c55e;
  position: absolute;
  bottom: 8px; left: 22px;
  border: 1.5px solid #1e293b;
}

/* ─── Topbar User Chip ──────────────────────────────────────────── */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  background: #ffffff;
}
.topbar-user-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #16a34a;
  flex-shrink: 0;
}

/* ─── Welder Avatar (matching table) ───────────────────────────── */
.welder-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  font-family: var(--font);
  letter-spacing: -.3px;
}

/* ─── Nuclear Safety Class Badge ───────────────────────────────── */
.nuke-class-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(147,51,234,.07);
  border: 1px solid rgba(147,51,234,.2);
  color: #7e22ce;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  font-family: var(--mono);
}

/* ─── DCN Field ─────────────────────────────────────────────────── */
.dcn-field {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: .5px;
  background: rgba(2,132,199,.06);
  border: 1px solid rgba(2,132,199,.15);
  border-radius: 4px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* ─── Radiation/Dosimetry Chip ──────────────────────────────────── */
.dose-chip {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(22,163,74,.08);
  color: #15803d;
  border: 1px solid rgba(22,163,74,.2);
  font-family: var(--mono);
  white-space: nowrap;
}
.dose-chip.warn { background: rgba(217,119,6,.08); color: #92400e; border-color: rgba(217,119,6,.2); }

/* ─── Misc Helpers ──────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; align-items: center; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }

/* ─── Contradiction Check Row ───────────────────────────────────── */
.check-row-contradiction {
  background: rgba(239,68,68,.04) !important;
  border-left: 3px solid var(--c-red) !important;
}

.check-row-contradiction:hover {
  background: rgba(239,68,68,.08) !important;
}

/* ─── Alert Variants ────────────────────────────────────────────── */
.alert-blue {
  background: rgba(37,99,235,.06);
  border: 1px solid rgba(37,99,235,.2);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--text);
}

.alert-blue i,
.alert-blue svg {
  color: var(--c-blue);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ─── Disruption Panel ──────────────────────────────────────────── */
.disruption-panel .btn-danger {
  animation: disruption-pulse 2s ease-in-out infinite;
}

@keyframes disruption-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.3); }
  50%       { box-shadow: 0 0 0 4px rgba(239,68,68,0); }
}

/* ─── Data Ingestion Summary Cards ──────────────────────────────── */
.ingestion-stat {
  text-align: center;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}

.ingestion-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15,23,42,.1);
}

/* ─── Exception Card Contradiction Detail ───────────────────────── */
.exc-card .exc-row[style*="rgba(239,68,68"] {
  margin-left: -10px;
  margin-right: -10px;
  padding-left: 14px;
  padding-right: 14px;
  border-radius: 6px;
}

/* ─── Realistic PDF Thumbnails ──────────────────────────────────── */
.pdf-thumb-real {
  padding: 6px 5px 4px;
  background: #fefefe;
  font-family: var(--mono);
  line-height: 1.3;
  min-height: 90px;
}

/* ─── Loading Sub-Status ────────────────────────────────────────── */
.loading-sub-msg {
  font-size: 11px;
  color: var(--dim);
  font-family: var(--mono);
  text-align: center;
  min-height: 16px;
  margin-top: 2px;
  transition: opacity .3s;
}

.loading-sub-msg .loading-pulse {
  display: inline-block;
  animation: sub-pulse 1.2s ease-in-out infinite;
}

@keyframes sub-pulse {
  0%, 100% { opacity: .4; }
  50% { opacity: 1; }
}
