/* ============================================================
   AUDITEX — Application CSS
   ============================================================ */

:root {
  --bg:       #080f1e;
  --bg-2:     #0c1525;
  --bg-card:  #0f1d35;
  --bg-card2: #122040;
  --bg-hover: #1a2d4d;
  --border:   rgba(255,255,255,0.07);
  --border-2: rgba(255,255,255,0.13);

  --blue:     #3b82f6;
  --blue-d:   #2563eb;
  --green:    #22c55e;
  --green-d:  #16a34a;
  --amber:    #eab308;
  --red:      #ef4444;
  --red-d:    #dc2626;

  --text:     #e2e8f0;
  --text-2:   #94a3b8;
  --text-3:   #4b6280;

  --radius:   10px;
  --radius-lg: 16px;
  --shadow:   0 4px 24px rgba(0,0,0,0.5);
  --font:     'Inter', system-ui, sans-serif;
  --mono:     'JetBrains Mono', 'Fira Code', monospace;
  --sidebar-w: 224px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow: hidden; }
button { cursor: pointer; font-family: var(--font); }
textarea, input { font-family: var(--font); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.sidebar-logo svg { color: var(--blue); flex-shrink: 0; }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: all 0.15s ease;
  position: relative;
  width: 100%;
}
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active { background: rgba(59,130,246,0.12); color: var(--blue); }
.nav-item svg { flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--amber);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.nav-badge:empty, .nav-badge[hidden] { display: none; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(59,130,246,0.2);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 10px; color: var(--text-3); margin-top: 1px; }
.sidebar-compliance {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-3);
}
.compliance-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: pulse-dot 2.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Main ---- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 52px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}
.topbar-breadcrumb {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.topbar-date { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.topbar-alerts {
  position: relative;
  color: var(--text-3);
  cursor: pointer;
}
.alert-count {
  position: absolute;
  top: -4px;
  right: -5px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Content / Views ---- */
.content {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.view {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 28px 28px 40px;
}
.view.active { display: flex; }
.view::-webkit-scrollbar { width: 6px; }
.view::-webkit-scrollbar-track { background: transparent; }
.view::-webkit-scrollbar-thumb { background: var(--bg-card2); border-radius: 3px; }

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.view-header h1 { font-size: 22px; font-weight: 700; line-height: 1.2; }
.view-subtitle { font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  transition: border-color 0.15s;
}
.kpi-card:hover { border-color: var(--border-2); }
.kpi-label { font-size: 11px; color: var(--text-3); margin-bottom: 8px; line-height: 1.4; }
.kpi-value { font-size: 32px; font-weight: 800; line-height: 1; color: var(--text); margin-bottom: 6px; }
.kpi-value small { font-size: 16px; font-weight: 600; }
.kpi-sub { font-size: 11px; color: var(--text-3); }
.kpi-green { border-left: 3px solid var(--green); }
.kpi-green .kpi-value { color: var(--green); }
.kpi-amber { border-left: 3px solid var(--amber); }
.kpi-amber .kpi-value { color: var(--amber); }
.kpi-red { border-left: 3px solid var(--red); }
.kpi-red .kpi-value { color: var(--red); }
.kpi-blue { border-left: 3px solid var(--blue); }
.kpi-blue .kpi-value { color: var(--blue); }

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title-row h2 { font-size: 15px; font-weight: 600; }
.link-btn {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--blue);
  cursor: pointer;
  font-weight: 500;
}
.link-btn:hover { text-decoration: underline; }

/* Priority queue (dashboard) */
.priority-queue { display: flex; flex-direction: column; gap: 8px; }
.pq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.pq-item:hover { border-color: var(--border-2); background: var(--bg-hover); }
.pq-priority-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pq-score {
  font-size: 22px;
  font-weight: 800;
  width: 60px;
  text-align: center;
  flex-shrink: 0;
}
.pq-proc { flex: 1; font-size: 13px; font-weight: 600; }
.pq-cid { font-size: 11px; color: var(--text-3); font-family: var(--mono); margin-top: 2px; }
.pq-status { }
.pq-action {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.pq-action:hover { background: var(--blue-d); }

/* Compliance strip */
.compliance-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 900px) { .compliance-strip { grid-template-columns: repeat(2, 1fr); } }
.comp-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.comp-status {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.comp-ok { background: rgba(34,197,94,0.15); color: var(--green); }
.comp-label { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.comp-desc { font-size: 11px; color: var(--text-3); line-height: 1.4; }

/* ============================================================
   QUEUE TABLE
   ============================================================ */
.queue-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--border-2); color: var(--text); }
.filter-btn.active { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.3); color: var(--blue); }

.queue-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex: 1;
}
.queue-table {
  width: 100%;
  border-collapse: collapse;
}
.queue-table th {
  background: var(--bg-card);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.queue-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13px;
}
.queue-table tr:last-child td { border-bottom: none; }
.queue-table tbody tr {
  background: var(--bg);
  transition: background 0.12s;
}
.queue-table tbody tr:hover { background: var(--bg-card); }
.queue-table tbody tr.row-done { opacity: 0.6; }
.queue-table tbody tr.row-auto { opacity: 0.8; }

.td-id { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.td-proc { font-weight: 500; max-width: 260px; }
.td-proc small { display: block; font-size: 11px; color: var(--text-3); font-family: var(--mono); margin-top: 2px; font-weight: 400; }
.td-cid { font-family: var(--mono); font-size: 12px; }
.td-patient { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.td-score { white-space: nowrap; }
.score-bar-wrap { display: flex; align-items: center; gap: 8px; }
.score-bar-bg {
  width: 60px;
  height: 4px;
  background: var(--bg-card2);
  border-radius: 2px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 2px;
}
.score-num-s { font-size: 13px; font-weight: 700; width: 34px; text-align: right; }
.td-prazo { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.prazo-urgent { color: var(--red); font-weight: 600; }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-high    { background: rgba(239,68,68,0.12);  color: var(--red);   border: 1px solid rgba(239,68,68,0.25); }
.badge-pending { background: rgba(234,179,8,0.12);  color: var(--amber); border: 1px solid rgba(234,179,8,0.25); }
.badge-auto    { background: rgba(34,197,94,0.1);   color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.badge-done    { background: rgba(148,163,184,0.1); color: var(--text-3);border: 1px solid var(--border); }

.btn-audit {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-audit-primary { background: var(--blue); color: #fff; }
.btn-audit-primary:hover { background: var(--blue-d); }
.btn-audit-ghost { background: var(--bg-card); color: var(--text-2); border: 1px solid var(--border); }
.btn-audit-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-audit-disabled { background: var(--bg-card); color: var(--text-3); cursor: not-allowed; }

/* ============================================================
   AUDIT DETAIL
   ============================================================ */
.audit-header {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: nowrap;
}
.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  margin-top: 4px;
  flex-shrink: 0;
}
.back-btn:hover { border-color: var(--border-2); color: var(--text); }
.audit-title-wrap { flex: 1; min-width: 0; }
.audit-title-wrap h1 { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-meta-bar { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.mono-tag {
  font-size: 11px;
  font-family: var(--mono);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-3);
  padding: 2px 8px;
  border-radius: 4px;
}
.audit-header-actions { flex-shrink: 0; margin-top: 4px; }
.hitl-pill {
  background: rgba(234,179,8,0.1);
  border: 1px solid rgba(234,179,8,0.2);
  color: var(--amber);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 100px;
  white-space: nowrap;
}

/* Workspace: 2 panels */
.audit-workspace {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 1000px) { .audit-workspace { grid-template-columns: 1fr; overflow: visible; } }

.audit-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.panel-label {
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ai-badge {
  margin-left: auto;
  font-size: 10px;
  background: rgba(59,130,246,0.12);
  color: var(--blue);
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

/* Left panel: guide data */
.panel-left {
  overflow-y: auto;
  padding: 16px;
  gap: 14px;
}
.panel-left::-webkit-scrollbar { width: 4px; }
.panel-left::-webkit-scrollbar-thumb { background: var(--bg-card2); border-radius: 2px; }
.guide-section { display: flex; flex-direction: column; gap: 4px; }
.guide-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.guide-field-label { font-size: 10px; font-weight: 700; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; }
.guide-field-value { font-size: 13px; color: var(--text); }
.guide-field-value.mono { font-family: var(--mono); font-size: 12px; }
.guide-justificativa { font-size: 12px; color: var(--text-2); line-height: 1.7; background: var(--bg-card2); border-radius: 8px; padding: 10px 12px; border: 1px solid var(--border); }

/* Right panel: analysis */
.panel-right { overflow-y: auto; padding: 16px; }
.panel-right::-webkit-scrollbar { width: 4px; }
.panel-right::-webkit-scrollbar-thumb { background: var(--bg-card2); border-radius: 2px; }

/* Analysis loading */
.analysis-loading { padding: 8px 0; }
.analysis-steps { display: flex; flex-direction: column; gap: 0; }
.a-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.a-step:last-child { border-bottom: none; }
.a-pending { color: var(--text-3); }
.a-done { color: var(--green); }
.a-spin {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(59,130,246,0.2);
  border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
.a-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; }
.a-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(34,197,94,0.15);
  color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Score row */
.score-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.score-ring-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  flex-shrink: 0;
}
.score-ring { width: 110px; height: 110px; }
.ring-track { fill: none; stroke: var(--bg-card2); stroke-width: 10; }
.ring-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 314.16 314.16;
  stroke-dashoffset: 314.16;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4,0,0.2,1), stroke 0.2s;
}
.score-center-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: baseline;
  gap: 1px;
}
#score-num { font-size: 26px; font-weight: 800; line-height: 1; }
.score-pct-s { font-size: 13px; font-weight: 600; color: var(--text-2); }
.score-meta { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.result-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  width: fit-content;
}
.badge-PERTINENTE     { background: rgba(34,197,94,0.12);  color: var(--green); border: 1px solid rgba(34,197,94,0.25); }
.badge-NAO_PERTINENTE { background: rgba(239,68,68,0.12); color: var(--red);   border: 1px solid rgba(239,68,68,0.25); }
.badge-COMPLEMENTACAO { background: rgba(234,179,8,0.12); color: var(--amber); border: 1px solid rgba(234,179,8,0.25); }
.confidence-row { display: flex; align-items: center; justify-content: space-between; }
.conf-label { font-size: 11px; color: var(--text-3); }
.conf-value { font-size: 12px; font-weight: 600; color: var(--text-2); font-family: var(--mono); }

/* Analysis tabs */
.atabs {
  display: flex;
  gap: 2px;
  background: var(--bg-card2);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 14px;
}
.atab {
  flex: 1;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.atab.active { background: var(--bg-card); color: var(--text); }
.atab:hover:not(.active) { color: var(--text-2); }
.atab-pane { display: none; }
.atab-pane.active { display: block; }

/* Reasoning */
.reasoning-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.8;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}
.reasoning-text::-webkit-scrollbar { width: 3px; }
.reasoning-text::-webkit-scrollbar-thumb { background: var(--bg-card2); border-radius: 2px; }
.reasoning-text strong { color: var(--text); }

/* Guidelines */
.guideline-card {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.gl-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.gl-fonte {
  font-size: 10px; font-weight: 700;
  background: rgba(59,130,246,0.12); color: var(--blue);
  padding: 2px 8px; border-radius: 4px;
}
.gl-nivel {
  font-size: 10px; font-weight: 700;
  background: rgba(34,197,94,0.1); color: var(--green);
  padding: 2px 6px; border-radius: 4px;
}
.gl-titulo { font-size: 12px; font-weight: 600; }
.gl-ano { font-size: 11px; color: var(--text-3); }
.gl-descricao { font-size: 12px; color: var(--text-2); line-height: 1.5; margin-top: 6px; }

/* CFM doc */
.cfm-doc {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  max-height: 300px;
  overflow-y: auto;
}
.cfm-doc::-webkit-scrollbar { width: 3px; }
.cfm-doc::-webkit-scrollbar-thumb { background: var(--bg-card); border-radius: 2px; }
.cfm-head { font-size: 12px; font-weight: 700; text-align: center; margin-bottom: 12px; color: var(--text); }
.cfm-sub { font-size: 10px; color: var(--text-3); text-align: center; margin-top: 2px; font-weight: 400; }
.cfm-sep { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.cfm-row { margin-bottom: 10px; }
.cfm-lbl { font-size: 9px; font-weight: 700; color: var(--text-3); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 2px; }
.cfm-val { font-size: 12px; color: var(--text); line-height: 1.5; }
.cfm-val.mono { font-family: var(--mono); font-size: 11px; }
.cfm-dec { font-weight: 700; font-size: 13px; }

/* Audit log */
.log-pre {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 11px;
  line-height: 1.7;
  color: #6db3f2;
  font-family: var(--mono);
  max-height: 300px;
  overflow: auto;
  white-space: pre;
}
.log-pre::-webkit-scrollbar { width: 3px; height: 3px; }
.log-pre::-webkit-scrollbar-thumb { background: var(--bg-card); border-radius: 2px; }

/* ============================================================
   DECISION PANEL
   ============================================================ */
.decision-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  padding: 16px;
  margin-top: 14px;
  flex-shrink: 0;
}
.decision-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 14px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.decision-label svg { color: var(--amber); }
.decision-mandatory {
  font-size: 10px;
  background: rgba(234,179,8,0.1);
  color: var(--amber);
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.decision-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
}
.decision-notes {
  width: 100%;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  resize: none;
  height: 72px;
  outline: none;
  transition: border-color 0.15s;
  margin-top: 6px;
}
.decision-notes:focus { border-color: var(--border-2); }
.decision-notes::placeholder { color: var(--text-3); }
.decision-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dec-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.dec-approve    { background: var(--green);  color: #fff; }
.dec-approve:hover { background: var(--green-d); }
.dec-complement { background: rgba(234,179,8,0.15); color: var(--amber); border: 1px solid rgba(234,179,8,0.3); }
.dec-complement:hover { background: rgba(234,179,8,0.25); }
.dec-deny       { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.25); }
.dec-deny:hover { background: rgba(239,68,68,0.22); }

/* Decision confirmed */
.decision-confirmed {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  padding: 20px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.confirmed-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}
.icon-approve { background: rgba(34,197,94,0.15); color: var(--green); }
.icon-deny    { background: rgba(239,68,68,0.12); color: var(--red); }
.icon-complement { background: rgba(234,179,8,0.12); color: var(--amber); }
.confirmed-content { flex: 1; }
.confirmed-title { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.confirmed-sub { font-size: 12px; color: var(--text-3); }

.btn-primary-sm {
  padding: 8px 16px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-primary-sm:hover { background: var(--blue-d); }
.btn-ghost-sm {
  padding: 8px 16px;
  background: none;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-ghost-sm:hover { border-color: var(--border-2); color: var(--text); }

/* ============================================================
   HISTORY VIEW
   ============================================================ */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-3);
  gap: 12px;
  min-height: 300px;
}
.empty-icon { font-size: 40px; opacity: 0.4; }
.empty-state p { font-size: 14px; line-height: 1.7; }
.empty-state strong { color: var(--text-2); }

#history-list { display: flex; flex-direction: column; gap: 12px; }
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
}
.hist-decision-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.hist-proc { font-size: 13px; font-weight: 600; }
.hist-meta { font-size: 11px; color: var(--text-3); margin-top: 3px; font-family: var(--mono); }
.hist-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* ============================================================
   DOCUMENT MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; }
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--bg-card2); border-radius: 2px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-note { font-size: 11px; color: var(--amber); }

/* Full document style in modal */
.full-cfm-doc {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-2);
}
.full-cfm-doc .doc-title {
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  margin-bottom: 4px;
}
.full-cfm-doc .doc-subtitle {
  font-size: 11px;
  text-align: center;
  color: var(--text-3);
  margin-bottom: 16px;
}
.full-cfm-doc hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.full-cfm-doc .doc-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.full-cfm-doc .doc-value { font-size: 13px; color: var(--text); margin-bottom: 10px; }
.full-cfm-doc .doc-value.mono { font-family: var(--mono); font-size: 12px; }
.full-cfm-doc .doc-decision { font-size: 15px; font-weight: 800; color: var(--text); padding: 10px 14px; background: var(--bg-card2); border-radius: 8px; margin: 8px 0; }
.full-cfm-doc .doc-signature-box {
  border: 1px dashed var(--border-2);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  margin-top: 8px;
}
