/* ==========================================================================
   Summary Report Prof — stylesheet duy trì được (không minify)
   Design language: assistant-ui (Geist, ink trên nền sáng, sidebar tối,
   accent mint, border mảnh, radius vừa phải, hierarchy rõ ràng).
   ========================================================================== */

/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --ink: #0a0a0a;
  --muted: #737373;
  --muted-2: #a3a3a3;
  --line: #e5e5e5;
  --line-strong: #d4d4d4;

  --nav-bg: #0a0a0a;
  --nav-ink: #f5f5f5;
  --nav-muted: #9c9c9c;
  --nav-line: rgba(255, 255, 255, 0.09);

  --accent: #3ecf8e;
  --accent-strong: #2cb87a;
  --accent-ink: #06281a;
  --accent-soft: rgba(62, 207, 142, 0.12);

  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --danger: #dc2626;
  --danger-soft: #fdeaea;
  --muted-tone: #8a8a8a;
  --muted-tone-soft: #f0f0f0;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  --shadow-card: 0 1px 2px rgba(10, 10, 10, 0.04), 0 1px 1px rgba(10, 10, 10, 0.03);
  --font: 'Geist Variable', Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ── Reset & cơ bản ─────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-soft); }
h1, h2, h3, p, ul, dl { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Khung app: sidebar tối + workspace sáng ────────────────────────── */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
}
.workspace {
  min-width: 0;
  padding: 56px 44px 72px;
}
.workspace > * {
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Sidebar (trắng, kiểu ChatGPT/assistant-ui) ─────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 14px 16px;
  background: #ffffff;
  color: var(--ink);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.06;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
}
.brand-mark svg {
  width: 18px;
  height: 18px;
  color: var(--accent-ink);
}
.sidebar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
}
.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 8px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
}
.sidebar-footer small {
  display: block;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 450;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex: none;
}

/* ── Lịch sử (white theme) ──────────────────────────────────────────── */
.history-list { display: grid; gap: 2px; }
.history-empty {
  padding: 10px 8px;
  color: var(--muted-2);
  font-size: 12.5px;
}
.history-row {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 10px;
}
.history-row:hover { background: var(--surface-2); }
.history-row:has(.history-item.is-active) { background: var(--surface-2); }
.history-item {
  display: grid;
  gap: 6px;
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 10px 34px 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.history-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 580;
}
.history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}
.history-sub { display: inline-flex; gap: 8px; flex: none; }
.history-delete {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  color: var(--muted-2);
  transition: opacity 0.12s ease;
}
.history-row:hover .history-delete,
.history-delete:focus-visible { opacity: 1; }
.history-delete:hover { color: var(--danger); background: var(--danger-soft); }

/* ── Pills (status) ──────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.pill--ok { background: var(--ok-soft); color: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--danger { background: var(--danger-soft); color: var(--danger); }
.pill--muted { background: var(--muted-tone-soft); color: var(--muted); }
.pill--busy { background: var(--accent-soft); color: var(--accent-strong); }
.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  font-weight: 620;
  font-size: 13.5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.button:disabled { opacity: 0.55; cursor: default; }
.button--ink {
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
}
.button--ink:hover:not(:disabled) { background: #232323; }
.button--ink .icon-button-icon { font-size: 1.2em; }
.button--new {
  background: var(--ink);
  color: #fff;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 680;
  box-shadow: 0 1px 2px rgba(10, 10, 10, 0.08);
}
.button--new:hover { background: #232323; }
.button--new span { font-size: 16px; line-height: 1; margin-right: 2px; }
.button--cta {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14.5px;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
/* Animation động khi hover nút "Phân tích báo cáo": nhấc lên + đổ bóng + mũi tên trượt. */
.button--cta:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(10, 10, 10, 0.24), 0 3px 8px rgba(10, 10, 10, 0.2);
  background: #232323;
}
.button--cta:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(10, 10, 10, 0.2);
}
.button--cta svg {
  transition: transform 0.18s ease;
}
.button--cta:hover:not(:disabled) svg {
  animation: cta-nudge 0.55s ease infinite alternate;
}
@keyframes cta-nudge {
  from { transform: translateX(0); }
  to { transform: translateX(5px); }
}
.button--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
  padding: 9px 14px;
}
.button--ghost:hover { background: var(--surface-2); }
.button--sm { font-size: 12.5px; padding: 7px 12px; gap: 7px; }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}
.icon-button:hover { background: var(--surface-2); color: var(--ink); }
.icon-button--line { color: var(--ink); }
.icon-button--line:hover { background: var(--surface-2); }
/* Trên thẻ fact (nền trắng) */
.icon-button--soft { color: var(--muted-2); width: 26px; height: 26px; border-radius: 7px; }
.icon-button--soft:hover { color: var(--ink); background: var(--surface-2); }
.pin-toggle.is-on { color: var(--accent-strong); }
.pin-toggle.is-on:hover { color: var(--accent-strong); background: var(--accent-soft); }
.copy-toggle.is-copied { color: var(--ok); background: var(--ok-soft); }

/* ── Mobile bar + drawer (white theme) ───────────────────────────────── */
.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: #ffffff;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.mobile-bar .brand { padding: 0; font-size: 13px; }
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 10, 10, 0.5);
  backdrop-filter: blur(2px);
}
.drawer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(320px, 86vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 12px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 12px 0 32px rgba(0, 0, 0, 0.18);
  animation: slide-in 0.18s ease;
}
@keyframes slide-in {
  from { transform: translateX(-24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 4px;
}
.drawer-title {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
}
.drawer-actions { display: flex; gap: 2px; }
.drawer-scroll { flex: 1; min-height: 0; overflow-y: auto; }

/* ── Upload view ─────────────────────────────────────────────────────── */
.upload-view { max-width: 760px; }
.hero { margin-bottom: 30px; }
.hero h1 {
  margin: 10px 0 12px;
  font-size: 42px;
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.08;
}
.hero-sub {
  max-width: 560px;
  color: var(--muted);
  font-size: 15.5px;
}
.flow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 620;
}
.flow-step { display: inline-flex; align-items: center; gap: 7px; }
.flow-step i {
  font-style: normal;
  color: var(--accent-strong);
  font-weight: 750;
}
.flow-link {
  width: 34px;
  height: 1px;
  background: var(--line-strong);
}

.upload-card {
  display: grid;
  gap: 20px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.dropzone {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 38px 22px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.dropzone.is-dragover .dropzone-icon { transform: translateY(-3px); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 21px;
  margin-bottom: 4px;
}
.dropzone-title { font-size: 15.5px; font-weight: 680; max-width: 100%; overflow-wrap: anywhere; }
.dropzone-hint { color: var(--muted); font-size: 13px; }
.dropzone-limit {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 650;
}
.field { display: grid; gap: 8px; }
.field label { font-size: 13px; font-weight: 650; }
.field-optional { color: var(--muted-2); font-weight: 500; font-size: 12px; }
.field textarea {
  width: 100%;
  min-height: 92px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.upload-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.upload-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
  max-width: 380px;
}
.form-error {
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 560;
}

/* ── Đang xử lý (thinking-orb) ──────────────────────────────────────── */
.processing-panel {
  display: grid;
  gap: 22px;
  max-width: 720px;
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.processing-head {
  display: flex;
  align-items: center;
  gap: 22px;
}
.orb-host { display: grid; place-items: center; flex: none; }
.processing-title { min-width: 0; }
.processing-title h2 {
  margin: 5px 0 4px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.run-meta {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.processing-percent {
  margin-left: auto;
  font-size: 30px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.meter {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.45s ease;
}
.processing-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
}

/* ── Stepper 6 bước ──────────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 4px 0 2px;
}
.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  position: relative;
}
.stepper-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 12px;
  left: calc(50% + 14px);
  width: calc(100% - 28px);
  height: 2px;
  background: var(--line);
  border-radius: 2px;
}
.stepper-step--done:not(:last-child)::after { background: var(--accent); }
.stepper-step--current:not(:last-child)::after { background: var(--line); }
.stepper-dot {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1.5px solid var(--line-strong);
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  z-index: 1;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.stepper-step--done .stepper-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.stepper-step--current .stepper-dot {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.stepper-label {
  font-size: 10.5px;
  font-weight: 620;
  color: var(--muted-2);
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
  padding: 0 2px;
  overflow-wrap: anywhere;
  /* Cho phép xuống dòng thay vì cắt mất chữ */
}
.stepper-step--done .stepper-label { color: var(--muted); }
.stepper-step--current .stepper-label { color: var(--ink); font-weight: 700; }

/* ── Panel trạng thái tĩnh (terminal) ───────────────────────────────── */
.status-panel {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  max-width: 660px;
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.status-panel-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  font-size: 26px;
  flex: none;
}
.status-panel--muted .status-panel-icon { background: var(--muted-tone-soft); color: var(--muted-tone); }
.status-panel--danger .status-panel-icon { background: var(--danger-soft); color: var(--danger); }
.status-panel--ok .status-panel-icon { background: var(--ok-soft); color: var(--ok); }
.status-panel--warn .status-panel-icon { background: var(--warn-soft); color: var(--warn); }
.status-panel-body { display: grid; gap: 8px; }
.status-panel-body h2 { font-size: 21px; font-weight: 720; letter-spacing: -0.015em; }
.status-panel-text { color: var(--muted); font-size: 14px; display: grid; gap: 10px; }
.status-panel-text .run-meta { color: var(--muted-2); }
.status-panel-body .button { justify-self: start; margin-top: 8px; }
.loading-line { color: var(--muted); font-size: 14px; }

/* ── Chi tiết báo cáo ───────────────────────────────────────────────── */
.report-detail {
  display: grid;
  gap: 20px;
}
.report-head {
  display: grid;
  gap: 14px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.report-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.report-title-row h1 {
  font-size: 29px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.report-meta { color: var(--muted); font-size: 13.5px; }
.cost-meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
.cost-cell { padding: 13px 18px; border-left: 1px solid var(--line); }
.cost-cell:first-child { border-left: 0; }
.cost-cell dt {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.cost-cell dd {
  margin-top: 3px;
  font-size: 18px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.export-bar { display: flex; gap: 8px; flex-wrap: wrap; }

.notice {
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 560;
}
.notice--warn { background: var(--warn-soft); color: #92400e; border-left: 3px solid var(--warn); }

/* ── Trust panel ─────────────────────────────────────────────────────── */
.trust-panel { display: grid; gap: 14px; }
.trust-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.trust-head h2 { font-size: 17px; font-weight: 720; margin-top: 5px; letter-spacing: -0.01em; }
.trust-total {
  font-size: 15px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  padding: 7px 12px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  white-space: normal;
  text-align: right;
}
.trust-meter {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
  gap: 2px;
}
.trust-segment { display: block; height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.trust-segment--ok { background: var(--accent); }
.trust-segment--warn { background: var(--warn); }
.trust-segment--muted { background: var(--muted-2); }
.trust-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 12.5px;
}
.trust-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.trust-legend-item strong { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.trust-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.trust-dot--ok { background: var(--accent); }
.trust-dot--warn { background: var(--warn); }
.trust-dot--muted { background: var(--muted-2); }
.trust-dot--filtered { background: var(--line-strong); border: 1px dashed var(--muted-2); }
.trust-legend-item--filtered { color: var(--muted-2); }
.trust-reasons {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: grid;
  gap: 8px;
}
.trust-reasons h3 {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}
.trust-reasons ul { display: grid; gap: 6px; }
.trust-reasons li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12.5px;
  color: #404040;
}
.trust-reasons li span { min-width: 0; overflow-wrap: anywhere; }
.trust-reasons li strong {
  color: var(--warn);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  flex: none;
}

.card {
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card--warn { border-left: 3px solid var(--warn); }
.card--warn h2 { font-size: 17px; margin-bottom: 8px; }
.card--warn p { color: var(--muted); font-size: 13.5px; }

.summary-card h2 {
  margin: 8px 0 12px;
  font-size: 23px;
  font-weight: 740;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.summary-overview { color: var(--ink); font-size: 15px; line-height: 1.7; }
.summary-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.summary-col h3 {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.check-list, .flag-list { display: grid; gap: 8px; }
.check-list li, .flag-list li {
  display: flex;
  gap: 9px;
  align-items: baseline;
  font-size: 14px;
  line-height: 1.55;
}
.check-list li::before { content: '✓'; color: var(--accent-strong); font-weight: 800; flex: none; }
.flag-list li::before { content: '!'; color: var(--warn); font-weight: 800; flex: none; }

.chart-card h2 { font-size: 17px; margin: 6px 0 12px; }
.chart-head { display: flex; align-items: baseline; gap: 10px; }
.chart-note { color: var(--muted-2); font-size: 11.5px; }
.chart-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.chart-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.chart-tab:hover { border-color: var(--accent); color: var(--ink); }
.chart-tab.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}
.chart-tab-count {
  font-size: 10px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.chart-tab.is-active .chart-tab-count { background: #fff; color: var(--accent-strong); }
.kpi-chart { width: 100%; height: 320px; }
.kpi-label { fill: #525252; font-size: 13px; }
.kpi-value { fill: var(--ink); font-size: 13px; font-weight: 620; }
.kpi-bar { fill: var(--accent); opacity: 0.9; }

.fact-section { display: grid; gap: 12px; }
.fact-section-head { display: flex; align-items: center; gap: 10px; }
.fact-section-head h2 {
  font-size: 16px;
  font-weight: 720;
  letter-spacing: -0.01em;
}
.fact-section--pinned .fact-section-head h2 { color: var(--accent-strong); }
.count-badge {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.fact-card {
  display: grid;
  gap: 9px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  align-content: start;
}
.fact-card--verified { border-left-color: var(--accent); }
.fact-card--needs_review { border-left-color: var(--warn); }
.fact-card--rejected { opacity: 0.62; border-left-color: var(--muted-2); }
.fact-card.is-pinned {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-card);
}
.fact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.fact-actions { display: inline-flex; align-items: center; gap: 6px; }
.fact-category {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.fact-card h3 { font-size: 14.5px; font-weight: 660; line-height: 1.4; }
.fact-value {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.fact-unit { color: var(--muted); font-size: 14px; font-weight: 560; letter-spacing: 0; }
.fact-context { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 13px; }
.fact-evidence { display: grid; gap: 7px; }
.fact-evidence blockquote {
  margin: 0;
  padding: 9px 12px;
  background: var(--surface-2);
  border-left: 3px solid var(--line-strong);
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #404040;
  display: grid;
  gap: 3px;
}
.fact-evidence strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.citation { display: grid; gap: 6px; }
.citation-toggle {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  padding: 2px 0;
}
.citation-toggle:hover { text-decoration: underline; }
.citation-source {
  padding: 10px 12px;
  background: #fffdf5;
  border: 1px solid #f0e6c8;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #404040;
  max-height: 220px;
  overflow-y: auto;
}
.citation-source mark {
  background: #ffe58f;
  color: #3d2e00;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 600;
}
.citation-note {
  color: var(--warn);
  font-size: 11.5px;
  font-style: italic;
}
.citation-note--miss { color: var(--danger); }
.source-miss { color: var(--danger); font-size: 12px; font-style: italic; }
.fact-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted-2);
  font-size: 11.5px;
}
.fact-confidence strong { color: var(--muted); font-weight: 650; }
.fact-note { font-style: italic; }

.report-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-2);
  font-size: 12px;
  padding: 4px 2px;
}

/* ── Hover popover nguồn + animations ───────────────────────────────── */
.fact-card { transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease; }
.fact-card:hover { box-shadow: 0 6px 18px rgba(10, 10, 10, 0.08), var(--shadow-card); }
.fact-card.is-highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 6px 18px rgba(10, 10, 10, 0.08);
  animation: highlight-pulse 1.6s ease 2;
}
@keyframes highlight-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft), 0 6px 18px rgba(10, 10, 10, 0.08); }
  50% { box-shadow: 0 0 0 10px rgba(62, 207, 142, 0.28), 0 6px 18px rgba(10, 10, 10, 0.08); }
}
.citation-popover {
  margin-top: 4px;
  padding: 10px 12px;
  background: #fffdf5;
  border: 1px solid #f0e6c8;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.55;
  color: #404040;
  animation: popover-in 0.16s ease;
}
.citation-popover mark { background: #ffe58f; color: #3d2e00; border-radius: 3px; padding: 0 2px; font-weight: 600; }
.citation-popover-locator {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
@keyframes popover-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.citation-source { animation: popover-in 0.18s ease; }
.compare-toggle.is-on { color: var(--accent-strong); background: var(--accent-soft); }

/* ── Panel So sánh / quá khứ ────────────────────────────────────────── */
.related-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  animation: popover-in 0.18s ease;
}
.related-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
}
.related-status { color: var(--muted-2); font-weight: 560; font-size: 11px; }
.related-empty { color: var(--muted); font-size: 12px; }
.related-list { display: grid; gap: 6px; }
.related-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.related-main {
  min-width: 0;
  display: grid;
  gap: 2px;
  color: inherit;
  text-decoration: none;
}
.related-main:hover .related-label { color: var(--accent-strong); }
.related-value { font-size: 15px; font-weight: 720; font-variant-numeric: tabular-nums; }
.related-label {
  font-size: 11.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
  line-height: 1.35;
}

/* ── Tìm kiếm toàn văn ──────────────────────────────────────────────── */
.search-box { position: relative; }
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  font-size: 13px;
  pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 9px 30px 9px 32px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 12px;
}
.search-clear:hover { color: var(--ink); background: var(--surface-2); }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(10, 10, 10, 0.14);
  padding: 8px;
  display: grid;
  gap: 6px;
  animation: popover-in 0.15s ease;
}
.search-empty { color: var(--muted); font-size: 12.5px; padding: 8px 10px; }
.search-group { display: grid; gap: 2px; }
.search-group-title {
  padding: 6px 10px 3px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.search-result:hover { background: var(--surface-2); }
.search-result-label { font-size: 12.5px; font-weight: 650; color: var(--ink); }
.search-result-value { font-size: 12px; font-weight: 700; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.search-result-snippet {
  font-size: 11px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Batch view ─────────────────────────────────────────────────────── */
.batch-view { display: grid; gap: 22px; }
.batch-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.batch-head h1 { font-size: 26px; font-weight: 750; letter-spacing: -0.03em; margin: 6px 0 4px; }
.batch-sub { color: var(--muted); font-size: 13.5px; }
.batch-list { display: grid; gap: 10px; }
.batch-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  animation: popover-in 0.2s ease;
}
.batch-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 19px;
  flex: none;
}
.batch-icon--complete { background: var(--ok-soft); color: var(--ok); }
.batch-icon--partial { background: var(--warn-soft); color: var(--warn); }
.batch-icon--failed { background: var(--danger-soft); color: var(--danger); }
.batch-icon--needs_ai { background: var(--muted-tone-soft); color: var(--muted-tone); }
.batch-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.batch-info { flex: 1; min-width: 0; display: grid; gap: 4px; }
.batch-name {
  font-size: 14px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-meta { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.batch-meta--usage { color: var(--muted-2); font-size: 11.5px; }
.meter--sm { height: 4px; max-width: 320px; }

/* ── Danh sách file đã chọn (upload) ────────────────────────────────── */
.file-list {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}
.file-row svg { flex: none; color: var(--accent-strong); }
.file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 560;
}
.file-size { flex: none; color: var(--muted-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.file-remove { flex: none; }

/* ── Chi tiết số liệu (collapsible) ─────────────────────────────────── */
.detail-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.detail-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 4px 0;
  cursor: pointer;
}
.detail-toggle:hover { color: var(--accent-strong); }
.detail-chevron {
  display: inline-block;
  font-size: 11px;
  color: var(--muted-2);
  transition: transform 0.2s ease;
}
.detail-chevron.is-open { transform: rotate(90deg); }
.detail-hint {
  padding: 0 16px 12px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}
.detail-body {
  border-top: 1px solid var(--line);
  padding: 16px;
  display: grid;
  gap: 22px;
  animation: popover-in 0.2s ease;
}
.button--detail { flex: none; }

/* ── Terminal giả lập agent ─────────────────────────────────────────── */
.agent-terminal {
  border: 1px solid #1e2a24;
  border-radius: 10px;
  overflow: hidden;
  background: #0c110e;
  color: #c8d8d0;
  font-family: ui-monospace, 'Cascadia Code', Consolas, 'Courier New', monospace;
  font-size: 12px;
}
.terminal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: #151c18;
  color: #7d8f86;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.terminal-dots { display: inline-flex; gap: 5px; }
.terminal-dots i { width: 9px; height: 9px; border-radius: 50%; background: #3a4a42; }
.terminal-dots i:nth-child(1) { background: #ff5f57; }
.terminal-dots i:nth-child(2) { background: #febc2e; }
.terminal-dots i:nth-child(3) { background: #28c840; }
.terminal-body {
  padding: 10px 12px;
  min-height: 96px;
  max-height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.terminal-line { margin: 0; line-height: 1.55; color: #9fb3a8; }
.terminal-line--live { color: #3ecf8e; }
.terminal-prompt { color: #3ecf8e; margin-right: 7px; }
.terminal-cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: #3ecf8e;
  animation: terminal-blink 1s steps(1) infinite;
}
@keyframes terminal-blink { 50% { opacity: 0; } }

/* ── Ảnh trang gốc (PDF bounding box) ───────────────────────────────── */
.source-page { display: grid; gap: 8px; }
.source-page img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}
.source-page-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.source-page-caption { color: var(--muted); font-size: 11.5px; }
.source-page-toggle {
  border: 0;
  background: none;
  color: var(--accent-strong);
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  padding: 2px 0;
}
.source-page-toggle:hover { text-decoration: underline; }

/* ── Detail đang chạy — giữ bản cũ ──────────────────────────────────── */
.detail-processing { display: grid; gap: 16px; }
.processing-panel--compact { padding: 16px; }
.detail-processing-old {
  opacity: 0.55;
  filter: saturate(0.85);
  pointer-events: none;
  position: relative;
}

/* ── Highlight trong summary («…») ──────────────────────────────────── */
mark.hl {
  background: #ffe58f;
  color: #3d2e00;
  border-radius: 3px;
  padding: 0 3px;
  font-weight: 650;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .mobile-bar { display: flex; }
  .workspace { padding: 30px 18px 56px; }
  .hero h1 { font-size: 32px; }
  .cost-meter { grid-template-columns: 1fr 1fr; }
  .cost-cell:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .cost-cell:nth-child(4) { border-top: 1px solid var(--line); }
  .summary-columns { grid-template-columns: 1fr; }
  .processing-head { gap: 16px; }
}
@media (max-width: 480px) {
  .processing-head { flex-direction: column; align-items: flex-start; }
  .processing-percent { margin-left: 0; }
  .status-panel { flex-direction: column; align-items: flex-start; }
  .upload-footer { flex-direction: column; align-items: stretch; }
  .upload-footer .button { width: 100%; }
  .report-title-row h1 { font-size: 24px; }
  .fact-grid { grid-template-columns: 1fr; }
}
