/* ==========================================================
   AI Claim Management Dashboard — CI ผสมจาก reference 2 ภาพ
   (fintech dark-minimal + fitness light-pastel) รองรับ Light/Dark
   Categorical / status hues validated ผ่าน dataviz skill validator
   (light surface #ffffff, dark surface #1a1a1e) — ดู DATA_UNDERSTANDING.md
   ========================================================== */

@import url("../vendor/kanit.css");

:root {
  color-scheme: light;

  --page-bg: #f5f4fa;
  --sidebar-bg: #ffffff;
  --surface-1: #ffffff; /* card / chart surface */
  --surface-2: #f2f1f7; /* hover / nested surface */
  --border: rgba(17, 17, 26, 0.07);
  --border-strong: rgba(17, 17, 26, 0.12);
  --shadow-card: 0 1px 2px rgba(17, 17, 26, 0.04), 0 10px 28px rgba(17, 17, 26, 0.06);

  --text-primary: #13131a;
  --text-secondary: #13131a;
  --text-muted: #13131a;

  /* brand accent — โทนผสมระหว่างฟ้า (ภาพมืด) กับม่วง (ภาพสว่าง) */
  --accent: #5b57f0;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(91, 87, 240, 0.1);
  --accent-soft-strong: rgba(91, 87, 240, 0.18);

  /* categorical (fixed order, never cycled) — light column */
  --series-1: #2a78d6; /* blue */
  --series-2: #eb6834; /* orange */
  --series-3: #1baf7a; /* aqua */
  --series-4: #eda100; /* yellow */
  --series-5: #e87ba4; /* magenta */
  --series-6: #008300; /* green */
  --series-7: #4a3aa7; /* violet */
  --series-8: #e34948; /* red */

  /* status (fixed, never themed / never reused for series) */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;

  --delta-up-bg: #e5f9ee;
  --delta-up-text: #12864b;
  --delta-down-bg: #fdecec;
  --delta-down-text: #c0392b;

  --radius-card: 20px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --font: "Kanit", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;

    --page-bg: #0e0e12;
    --sidebar-bg: #161619;
    --surface-1: #18181c;
    --surface-2: #1f1f24;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.13);
    --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.02), 0 10px 28px rgba(0, 0, 0, 0.35);

    --text-primary: #f5f5f7;
    --text-secondary: #f5f5f7;
    --text-muted: #f5f5f7;

    --accent: #7c78ff;
    --accent-contrast: #ffffff;
    --accent-soft: rgba(124, 120, 255, 0.16);
    --accent-soft-strong: rgba(124, 120, 255, 0.26);

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;

    --delta-up-bg: rgba(34, 197, 94, 0.15);
    --delta-up-text: #4ade80;
    --delta-down-bg: rgba(239, 68, 68, 0.15);
    --delta-down-text: #f87171;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --page-bg: #0e0e12;
  --sidebar-bg: #161619;
  --surface-1: #18181c;
  --surface-2: #1f1f24;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.02), 0 10px 28px rgba(0, 0, 0, 0.35);

  --text-primary: #f5f5f7;
  --text-secondary: #f5f5f7;
  --text-muted: #f5f5f7;

  --accent: #7c78ff;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(124, 120, 255, 0.16);
  --accent-soft-strong: rgba(124, 120, 255, 0.26);

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;

  --delta-up-bg: rgba(34, 197, 94, 0.15);
  --delta-up-text: #4ade80;
  --delta-down-bg: rgba(239, 68, 68, 0.15);
  --delta-down-text: #f87171;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

a {
  color: inherit;
}

.app {
  display: flex;
  min-height: 100vh;
  gap: 14px;
  padding: 14px;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: relative;
  width: 244px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  transition: width 0.2s ease, padding 0.2s ease;
}

.sidebar-toggle {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-1);
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  font: 700 22px/1 var(--font);
  cursor: pointer;
}

.sidebar-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sidebar-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar.sidebar-collapsed {
  width: 68px;
  padding: 52px 8px 18px;
  gap: 14px;
}

.sidebar.sidebar-collapsed .sidebar-toggle {
  right: 50%;
  transform: translateX(50%);
}

.sidebar.sidebar-collapsed .brand,
.sidebar.sidebar-collapsed .nav-group-label,
.sidebar.sidebar-collapsed .nav-item .soon {
  display: none;
}

.sidebar.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px;
  border-radius: 14px;
}

.sidebar.sidebar-collapsed .nav-item .label {
  gap: 0;
  font-size: 0;
}

.sidebar.sidebar-collapsed .nav-item .icon {
  width: 20px;
  height: 20px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.company-logo {
  display: block;
  width: 100%;
  max-width: 190px;
  height: auto;
  object-fit: contain;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-group-label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  text-align: left;
  width: 100%;
  font-family: var(--font);
  transition: background-color 0.12s ease, color 0.12s ease;
}

.nav-item:not(.disabled):hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.nav-item .label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item .icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item .icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.active,
.nav-item.active:hover {
  background: var(--accent);
  color: var(--accent-contrast);
}

.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-item .soon {
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---------------- Main ---------------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar,
.filter-bar {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-size: 17px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.topbar .synced {
  font-size: 11.5px;
  color: var(--text-muted);
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  align-items: center;
  justify-content: center;
}

.theme-toggle .icon-sun {
  display: flex;
}
.theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: none;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: flex;
  }
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: flex;
}

.filter-bar {
  display: flex;
  position: relative;
  z-index: 500;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 22px;
  overflow: visible;
}

.filter-collapse-toggle {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 8;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.filter-collapse-toggle:hover {
  background: var(--accent-soft);
  box-shadow: 0 5px 14px rgba(36, 83, 151, .16);
}

.filter-collapse-toggle:focus-visible {
  outline: 3px solid var(--accent-soft-strong);
  outline-offset: 2px;
}

.filter-collapse-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .18s ease;
}

.filter-collapsed-summary {
  display: none;
  min-width: 0;
  padding-right: 42px;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.filter-collapsed-summary span {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.filter-collapsed-summary strong {
  min-width: 0;
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-bar.filter-collapsed {
  min-height: 42px;
  padding: 7px 14px;
  align-items: center;
  flex-wrap: nowrap;
  overflow: hidden;
}

.filter-bar.filter-collapsed > :not(.filter-collapse-toggle):not(.filter-collapsed-summary) {
  display: none !important;
}

.filter-bar.filter-collapsed .filter-collapsed-summary {
  display: flex;
  width: 100%;
}

.filter-bar.filter-collapsed .filter-collapse-toggle {
  top: 6px;
}

.filter-bar.filter-collapsed .filter-collapse-toggle svg {
  transform: rotate(180deg);
}

.saved-view-toolbar {
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 11px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
  padding-right: 38px;
}

.saved-view-title { margin-right: 4px; }
.saved-view-title span,
.saved-view-title strong { display: block; }
.saved-view-title span { color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.saved-view-title strong { margin-top: 1px; font-size: 10.5px; }
.saved-view-toolbar select {
  min-width: 230px;
  max-width: 320px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-primary);
  padding: 0 30px 0 12px;
  font: inherit;
  font-size: 10.5px;
}
.saved-view-toolbar .btn { padding: 7px 12px; font-size: 10.5px; }
.saved-view-toolbar .export-filter-btn { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 38%, var(--border)); }
.saved-view-toolbar .export-data-btn { margin-left: auto; }
.saved-view-toolbar .export-dashboard-btn { background: var(--accent); color: #fff; }
.saved-view-toolbar .export-dashboard-btn:hover { filter: brightness(.96); }
.dashboard-print-meta { display: none; }
.export-dashboard-dialog {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 0;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
}
.export-dashboard-dialog::backdrop { background: rgba(15, 23, 42, .48); backdrop-filter: blur(3px); }
.export-dashboard-dialog form { padding: 22px; }
.export-dashboard-dialog-head { display: flex; align-items: flex-start; gap: 13px; }
.export-dashboard-dialog-icon { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; border-radius: 13px; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.export-dashboard-dialog-head span { color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.export-dashboard-dialog-head h2,
.export-dashboard-dialog-head p { margin: 0; }
.export-dashboard-dialog-head h2 { margin-top: 3px; font-size: 18px; }
.export-dashboard-dialog-head p { margin-top: 4px; color: var(--text-muted); font-size: 10px; }
.export-format-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.export-format-grid button { position: relative; min-height: 150px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); color: var(--text-primary); padding: 18px 14px; text-align: left; cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.export-format-grid button:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 10px 24px rgba(15, 23, 42, .10); }
.export-format-grid button:focus-visible { outline: 3px solid var(--accent-soft-strong); border-color: var(--accent); }
.export-format-grid button:disabled { cursor: wait; opacity: .6; transform: none; }
.export-format-grid strong,
.export-format-grid span { display: block; }
.export-format-grid strong { color: var(--accent); font-size: 18px; }
.export-format-grid span { margin-top: 9px; color: var(--text-secondary); font-size: 10px; line-height: 1.55; }
.export-format-grid i { position: absolute; right: 12px; bottom: 10px; color: var(--text-muted); font-size: 9px; font-style: normal; font-weight: 700; }
.export-dashboard-status { min-height: 18px; margin: 10px 0 0; color: var(--text-muted); font-size: 9px; }
.export-dashboard-dialog-actions { display: flex; justify-content: flex-end; margin-top: 4px; }

body.dashboard-capturing .app,
body.dashboard-capturing .main,
body.dashboard-capturing .content { display: block !important; width: 1644px !important; max-width: none !important; height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; }
body.dashboard-capturing #dashboard-body { position: absolute !important; z-index: 9999; top: 0 !important; left: 0 !important; display: block !important; width: 1600px !important; max-width: 1600px !important; height: auto !important; margin: 0 !important; background: var(--page-bg); padding: 22px; overflow: visible !important; }
body.dashboard-capturing .kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
body.dashboard-capturing .ai-insights-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
body.dashboard-capturing .automated-briefing-body { grid-template-columns: minmax(0, 1fr) 210px !important; }
body.dashboard-capturing .briefing-summary { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
body.dashboard-capturing .chart-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
body.dashboard-capturing .chart-card.span-2 { grid-column: span 2 !important; }
body.dashboard-capturing .dashboard-print-meta { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; border-bottom: 2px solid #365f9d; background: var(--surface-1); padding: 14px 18px; }
body.dashboard-capturing .dashboard-print-brand { display: flex; align-items: center; gap: 12px; }
body.dashboard-capturing .dashboard-print-brand img { width: 92px; height: 48px; object-fit: contain; }
body.dashboard-capturing .dashboard-print-brand h1,
body.dashboard-capturing .dashboard-print-brand p { margin: 0; }
body.dashboard-capturing .dashboard-print-brand h1 { font-size: 22px; white-space: nowrap; }
body.dashboard-capturing .dashboard-print-brand p { color: var(--text-muted); font-size: 10px; }
body.dashboard-capturing .dashboard-print-context { max-width: 58%; text-align: right; }
body.dashboard-capturing .dashboard-print-context strong,
body.dashboard-capturing .dashboard-print-context span { display: block; }
body.dashboard-capturing .dashboard-print-context strong { font-size: 10px; }
body.dashboard-capturing .dashboard-print-context span { margin-top: 3px; color: var(--text-muted); font-size: 9px; }
body.dashboard-capturing .kpi-drill-label,
body.dashboard-capturing .chart-drill-btn,
body.dashboard-capturing .ai-insight-card > button,
body.dashboard-capturing .ai-insight-card details,
body.dashboard-capturing #copy-briefing-btn,
body.dashboard-capturing #automated-briefing-actions,
body.dashboard-capturing .briefing-method,
body.dashboard-capturing .metric-info { display: none !important; }
.danger-subtle:not(:disabled) { color: var(--status-critical); }

.saved-view-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 0;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
}
.saved-view-dialog::backdrop { background: rgba(15, 23, 42, .44); backdrop-filter: blur(3px); }
.saved-view-dialog form { display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 22px; }
.saved-view-dialog-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.saved-view-dialog h2,.saved-view-dialog p { margin: 0; }
.saved-view-dialog h2 { margin-top: 3px; font-size: 17px; }
.saved-view-dialog p { margin-top: 5px; color: var(--text-muted); font-size: 10px; line-height: 1.55; }
.saved-view-dialog-eyebrow { color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.saved-view-dialog label { grid-column: 1 / -1; display: grid; gap: 6px; font-size: 10.5px; font-weight: 700; }
.saved-view-dialog input { border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); color: var(--text-primary); padding: 10px 12px; font: inherit; }
.saved-view-dialog-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-field label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-field select,
.search-select-trigger,
.search-select-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 12.5px;
  font-family: var(--font);
  min-width: 130px;
}

.filter-field select:focus,
.search-select-trigger:focus,
.search-select-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.multi-select-field {
  width: 155px;
  min-width: 155px;
}

.multi-select-field.wide {
  width: 230px;
  min-width: 230px;
}

.search-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.search-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}

.search-select-trigger span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-select-arrow {
  flex-shrink: 0;
  font-size: 15px;
  color: var(--text-muted);
}

.search-select-menu {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 6px);
  left: 0;
  width: min(360px, 80vw);
  padding: 8px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.search-select-input {
  width: 100%;
  min-width: 0;
  margin-bottom: 7px;
}

.search-select-options {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-select-option {
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-primary);
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.search-select-option:hover,
.search-select-option:focus {
  background: var(--accent-soft);
  outline: none;
}

.filter-field .multi-select-option {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border-radius: 9px;
  background: transparent;
  color: var(--text-primary);
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}

.filter-field .multi-select-option:hover {
  background: var(--accent-soft);
}

.multi-select-option input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 1px 0 0;
  flex: 0 0 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.search-select-empty {
  padding: 12px 10px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.filter-actions {
  align-self: flex-end;
  flex-direction: row;
  gap: 8px;
}

.result-field {
  margin-left: auto;
  justify-content: center;
}

.btn {
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.btn:hover {
  filter: brightness(1.06);
}

.content {
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------------- KPI cards ---------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.kpi-card:hover,
.kpi-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-card);
  outline: none;
}

.kpi-drill-label {
  display: block;
  margin-top: auto;
  padding-top: 7px;
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.kpi-card:hover .kpi-drill-label,
.kpi-card:focus-visible .kpi-drill-label { opacity: 1; transform: translateY(0); }

.ai-insights-section {
  margin-top: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: var(--radius-card);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, var(--surface-1)), var(--surface-1) 44%);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.ai-insights-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.ai-insights-head span { color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.ai-insights-head h2,.ai-insights-head p { margin: 0; }
.ai-insights-head h2 { margin-top: 3px; font-size: 14px; }
.ai-insights-head p { margin-top: 3px; color: var(--text-muted); font-size: 9.5px; }
.ai-insights-context { max-width: 42%; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); padding: 6px 10px; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-insights-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ai-insight-card { min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: 14px; background: var(--surface-1); padding: 13px; }
.ai-insight-card.critical { border-top-color: var(--status-critical); }
.ai-insight-card.warning { border-top-color: var(--status-warning); }
.ai-insight-card.good { border-top-color: var(--status-good); }
.ai-insight-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-insight-top span { color: var(--text-muted); font-size: 7.5px; font-weight: 800; letter-spacing: .08em; }
.ai-insight-badges { display: flex; align-items: center; gap: 6px; }
.ai-insight-top i { border-radius: 999px; background: var(--delta-up-bg); color: var(--status-good); padding: 3px 7px; font-size: 7.5px; font-style: normal; font-weight: 700; }
.metric-info {
  position: relative;
  z-index: 5;
  display: inline-grid;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  border-radius: 50%;
  background: var(--surface-1);
  color: var(--accent);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  outline: none;
}
.metric-info::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 100;
  top: calc(100% + 8px);
  right: 0;
  width: min(300px, 72vw);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--text-primary);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .22);
  color: var(--surface-1);
  padding: 9px 11px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.55;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-3px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
  pointer-events: none;
}
.metric-info:hover::after,
.metric-info:focus::after,
.metric-info:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.ai-insight-card h3 { min-height: 34px; margin: 9px 0 4px; font-size: 11.5px; line-height: 1.45; overflow-wrap: anywhere; }
.ai-insight-metric { font-size: 21px; }
.ai-insight-card > p { min-height: 30px; margin: 4px 0 8px; color: var(--text-muted); font-size: 9px; line-height: 1.5; }
.ai-insight-card details { margin-top: auto; border-top: 1px solid var(--border); padding-top: 7px; color: var(--text-muted); font-size: 8.5px; line-height: 1.6; }
.ai-insight-card summary { cursor: pointer; color: var(--text-secondary); font-weight: 700; }
.ai-insight-card details div { margin-top: 6px; }
.ai-insight-card > button { margin-top: 9px; border: 0; border-radius: 9px; background: var(--accent-soft); color: var(--accent); padding: 8px 10px; font: inherit; font-size: 9px; font-weight: 800; cursor: pointer; }
.ai-insight-card > button:hover { filter: brightness(.97); }

.automated-briefing {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface-1);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.automated-briefing-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.automated-briefing-head > div:last-child { display: flex; align-items: center; gap: 9px; }
.automated-briefing-head span { color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.automated-briefing-head h2,.automated-briefing-head p { margin: 0; }
.automated-briefing-head h2 { margin-top: 3px; font-size: 14px; }
.automated-briefing-head p { margin-top: 3px; color: var(--text-muted); font-size: 9px; }
.automated-briefing-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 13px; }
.briefing-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.briefing-summary article { position: relative; min-width: 0; border-radius: 11px; background: var(--surface-2); padding: 10px 34px 10px 10px; }
.briefing-summary article > .metric-info { position: absolute; top: 8px; right: 8px; }
.briefing-summary span,.briefing-summary small,.briefing-summary strong { display: block; }
.briefing-summary span { color: var(--text-muted); font-size: 8.5px; }
.briefing-summary strong { margin-top: 4px; font-size: 14px; overflow-wrap: anywhere; }
.briefing-summary small { margin-top: 3px; color: var(--text-muted); font-size: 8px; line-height: 1.45; }
.briefing-evidence-btn { display: block; width: 100%; margin-top: 9px; border: 0; border-radius: 8px; background: var(--accent-soft); color: var(--accent); padding: 7px 9px; font: inherit; font-size: 8px; font-weight: 800; cursor: pointer; }
.briefing-evidence-btn:hover { background: var(--accent); color: #fff; }
.briefing-evidence-btn:disabled { cursor: not-allowed; opacity: .45; }
.briefing-actions { display: flex; flex-direction: column; gap: 7px; }
.briefing-actions-label { color: var(--text-muted); font-size: 8px; font-weight: 700; }
.briefing-actions button { border: 0; border-radius: 9px; background: var(--accent-soft); color: var(--accent); padding: 8px; font: inherit; font-size: 8.5px; font-weight: 800; cursor: pointer; }
.briefing-method { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; color: var(--text-muted); font-size: 8.5px; }
.briefing-method summary { cursor: pointer; color: var(--text-secondary); font-weight: 700; }
.briefing-method p { margin: 6px 0 0; }

.kpi-card .label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-card .value-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kpi-card .value {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.kpi-card .value.critical {
  color: var(--status-critical);
}

.kpi-card .sub {
  font-size: 11px;
  color: var(--text-muted);
}

.delta-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px 3px 7px;
  border-radius: var(--radius-pill);
}

.delta-badge.up {
  background: var(--delta-up-bg);
  color: var(--delta-up-text);
}

.delta-badge.down {
  background: var(--delta-down-bg);
  color: var(--delta-down-text);
}

/* ---------------- Chart grid ---------------- */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.chart-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  /* สูงคงที่ตายตัว (ไม่ใช่ min-height) เพื่อไม่ให้กราฟขยาย/หด เวลาเปลี่ยนตัวกรอง
     (legend ที่จำนวนบรรทัดเปลี่ยนได้ตามข้อมูล เคยทำให้การ์ดสูงไม่คงที่ และดันให้ canvas
     คำนวณขนาดใหม่วนไปเรื่อยๆ) */
  height: 320px;
}

.chart-card.cross-filter-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow-card);
}

.chart-card.span-2 {
  grid-column: span 2;
}

.chart-card .chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.chart-drill-btn {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--accent);
  padding: 4px 8px;
  font: inherit;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.chart-drill-btn:hover,
.chart-drill-btn:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }

.all-claims-drill-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  padding: 11px 14px;
}

.all-claims-drill-bar > div { min-width: 0; }
.all-claims-drill-bar span { display: block; color: var(--accent); font-size: 8.5px; font-weight: 800; letter-spacing: .08em; }
.all-claims-drill-bar strong { display: block; margin-top: 2px; font-size: 11px; overflow-wrap: anywhere; }
.all-claims-drill-bar button {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--text-secondary);
  padding: 7px 11px;
  font: inherit;
  font-size: 9.5px;
  font-weight: 700;
  cursor: pointer;
}

.chart-card .chart-title {
  font-size: 13.5px;
  font-weight: 700;
}

.chart-card .chart-note {
  font-size: 10.5px;
  color: var(--text-muted);
}

.chart-card .chart-body {
  position: relative;
  flex: 1;
  /* min-height: 0 (ไม่ใช่ auto ตาม default ของ flex item) ไม่งั้น canvas ข้างในจะบังคับให้
     กล่องนี้โตตามเนื้อหาแทนที่จะถูกบีบให้พอดีกับพื้นที่ที่เหลือใน .chart-card ที่สูงตายตัว */
  min-height: 0;
  overflow: hidden;
}

.chart-card .chart-body canvas {
  max-width: 100%;
  cursor: pointer;
}

.chart-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-1));
  color: var(--text-secondary);
  font-size: 12px;
}

.chart-filter-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-filter-heading {
  color: var(--text-primary);
  font-weight: 700;
}

#chart-filter-chips {
  color: var(--accent);
  font-weight: 600;
}

.chart-filter-clear {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.chart-filter-clear:hover {
  text-decoration: underline;
}

/* ---------------- All Claims ---------------- */
.all-claims-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.claims-view-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding: 0 2px 2px;
}

.claims-view-tabs button {
  display: flex;
  min-width: 120px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-1);
  color: var(--text-secondary);
  padding: 10px 12px;
  font: 600 10.5px var(--font);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.claims-view-tabs button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.claims-view-tabs button strong {
  display: grid;
  min-width: 28px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-primary);
  padding: 0 7px;
  font-size: 10px;
}

.claims-view-tabs button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 20%, transparent);
}

.claims-view-tabs button.active strong {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.claims-view-tabs button.critical:not(.active) strong {
  background: var(--delta-down-bg);
  color: var(--status-critical);
}

.claims-view-tabs button.predictive:not(.active) strong {
  background: var(--accent-soft);
  color: var(--accent);
}

.claims-toolbar,
.claims-table-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.claims-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
}

.claims-toolbar h2 {
  margin: 0 0 3px;
  font-size: 17px;
}

.claims-toolbar p {
  margin: 0;
  color: var(--text-muted);
  font-size: 11.5px;
}

.claims-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.claims-search input {
  width: min(360px, 38vw);
  min-width: 240px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-primary);
  padding: 9px 14px;
  font: 12.5px var(--font);
}

.claims-search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.claims-table-card {
  overflow: hidden;
}

.claims-table-meta,
.claims-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  font-size: 12px;
}

.claims-table-meta {
  border-bottom: 1px solid var(--border);
}

.claims-table-meta label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.claims-table-meta select {
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text-primary);
  padding: 5px 8px;
  font: inherit;
}

.claims-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 330px);
  min-height: 360px;
}

.claims-table {
  width: 100%;
  min-width: 1660px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11.5px;
}

.claims-table th,
.claims-table td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.claims-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.claims-table tfoot td {
  position: sticky;
  z-index: 3;
  bottom: 0;
  border-top: 2px solid var(--accent);
  border-bottom: 0;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-1));
  color: var(--text-primary);
  font-weight: 700;
  white-space: nowrap;
}

.claims-table th button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: inherit;
  padding: 0;
}

.claims-table th button::after {
  content: " ↕";
  color: var(--text-muted);
  opacity: 0.55;
}

.claims-table th button[data-sort-active="asc"]::after {
  content: " ↑";
  color: var(--accent);
  opacity: 1;
}

.claims-table th button[data-sort-active="desc"]::after {
  content: " ↓";
  color: var(--accent);
  opacity: 1;
}

.claims-table td {
  color: var(--text-secondary);
  background: var(--surface-1);
}

.claims-table tbody tr:hover td {
  background: var(--accent-soft);
}

.claims-table .number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.claims-table .claim-no {
  color: var(--text-primary);
  font-weight: 700;
  white-space: nowrap;
}

.claims-table .truncate {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill,
.priority-pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.status-closed {
  background: var(--delta-up-bg);
  color: var(--status-good);
}

.status-open {
  background: var(--accent-soft);
  color: var(--series-1);
}

.priority-high {
  background: var(--delta-down-bg);
  color: var(--status-critical);
}

.priority-medium {
  background: rgba(237, 161, 0, 0.13);
  color: var(--status-warning);
}

.priority-low {
  background: var(--delta-up-bg);
  color: var(--status-good);
}

.claims-detail-btn {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-primary);
  cursor: pointer;
  padding: 5px 10px;
  font: 600 11px var(--font);
}

.claims-empty {
  padding: 48px 20px !important;
  text-align: center !important;
  color: var(--text-muted) !important;
}

.claims-pagination {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.claims-pagination .btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

/* ---------------- Claim Detail ---------------- */
.claim-detail-page,
.claim-detail-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-lookup-card,
.claim-detail-hero,
.detail-section-card,
.claim-detail-empty {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-card);
}

.detail-lookup-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
}

.detail-search {
  flex: 1;
  min-width: 180px;
}

.detail-search input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-primary);
  padding: 0 14px;
  font: 500 12px var(--font);
}

.detail-search input:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
}

.detail-case-nav {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.detail-case-nav .btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.detail-search-message {
  max-width: 210px;
  color: var(--status-critical);
  font-size: 11px;
}

.claim-detail-empty {
  padding: 60px 24px;
  text-align: center;
}

.claim-detail-empty h2,
.claim-detail-empty p {
  margin: 0;
}

.claim-detail-empty p {
  margin-top: 7px;
  color: var(--text-muted);
}

.claim-detail-hero {
  display: grid;
  grid-template-columns: minmax(240px, 1.15fr) minmax(480px, 2fr);
  gap: 18px;
  padding: 20px;
}

.detail-eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail-hero-main h2 {
  margin: 5px 0 10px;
  font-size: clamp(20px, 2vw, 28px);
  overflow-wrap: anywhere;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.detail-group-badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-secondary);
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 700;
}

.detail-hero-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.detail-metric {
  min-width: 0;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 11px;
}

.detail-metric span,
.detail-item span {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
}

.detail-metric strong {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.claim-detail-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  padding: 5px;
  box-shadow: var(--shadow-card);
}

.claim-detail-tab {
  flex: 1;
  min-width: 112px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 9px 13px;
  font: 700 11.5px var(--font);
}

.claim-detail-tab:hover {
  background: var(--surface-2);
}

.claim-detail-tab.active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.claim-detail-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-section-card {
  min-width: 0;
  padding: 18px;
}

.claim-detail-panel:not([data-detail-panel="overview"]) .detail-section-card {
  grid-column: 1 / -1;
}

.detail-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.detail-section-head h3,
.document-card h4,
.document-card p {
  margin: 0;
}

.detail-section-head h3 {
  font-size: 14px;
}

.detail-section-head span {
  color: var(--text-muted);
  font-size: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.detail-item {
  min-width: 0;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 11px;
}

.detail-item.wide {
  grid-column: 1 / -1;
}

.detail-item strong {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.detail-lines-wrap {
  overflow-x: auto;
}

.detail-lines-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 11px;
}

.detail-lines-table th,
.detail-lines-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.detail-lines-table th {
  color: var(--text-muted);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-lines-table .number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.detail-lines-table .wrap-cell {
  min-width: 240px;
  white-space: normal;
}

.detail-timeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.timeline-event {
  position: relative;
  min-height: 90px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 12px 12px 12px 31px;
}

.timeline-dot {
  position: absolute;
  top: 15px;
  left: 12px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  background: var(--surface-1);
}

.timeline-event.complete .timeline-dot {
  border-color: var(--status-good);
  background: var(--status-good);
}

.timeline-column {
  display: block;
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
}

.timeline-event strong,
.timeline-event small {
  display: block;
  margin-top: 4px;
}

.timeline-event strong {
  font-size: 11px;
}

.timeline-event small {
  color: var(--text-muted);
}

.document-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.document-card {
  display: flex;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 14px;
}

.document-icon {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-1);
  color: var(--text-muted);
  font-weight: 800;
}

.document-card.available .document-icon {
  background: var(--delta-up-bg);
  color: var(--status-good);
}

.document-card small,
.document-card p {
  color: var(--text-muted);
  font-size: 10px;
}

.document-card h4 {
  margin-top: 3px;
  font-size: 12px;
}

.document-card p {
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.workflow-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
}

.sla-card {
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 18px;
}

.sla-value strong {
  font-size: 40px;
  line-height: 1;
}

.sla-value span {
  margin-left: 4px;
  color: var(--text-muted);
}

.sla-track {
  height: 8px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--border);
}

.sla-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--status-good);
}

.sla-card.warning .sla-track span { background: var(--status-warning); }
.sla-card.critical .sla-track span { background: var(--status-critical); }

.sla-card p {
  margin: 9px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.workflow-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ---------------- AI Executive Analytics ---------------- */
.ai-executive-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-executive-head {
  flex-wrap: wrap;
}

.rule-based-badge {
  display: inline-flex;
  margin-bottom: 5px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 8px;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.ai-executive-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#ai-executive-generated-at {
  color: var(--text-muted);
  font-size: 9.5px;
}

.executive-summary-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
  gap: 14px;
}

.executive-card,
.executive-kpi-card,
.executive-methodology {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-card);
}

.executive-card {
  padding: 17px;
}

.executive-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.executive-card-head h3,
.executive-card-head p,
.recommendation-card h4,
.recommendation-card p {
  margin: 0;
}

.executive-card-head h3 {
  margin-top: 3px;
  font-size: 14px;
}

.executive-card-head > span {
  color: var(--text-muted);
  font-size: 9.5px;
}

.executive-eyebrow {
  color: var(--accent);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.executive-context-pill {
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  padding: 5px 9px;
  font-weight: 600;
}

.executive-summary-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.executive-summary-list li {
  position: relative;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 10px 12px 10px 31px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.55;
}

.executive-summary-list li::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 13px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.executive-risk-card {
  display: flex;
  align-items: center;
  gap: 18px;
}

.executive-risk-card h3,
.executive-risk-card p {
  margin: 0;
}

.executive-risk-card h3 {
  margin-top: 4px;
  font-size: 20px;
}

.executive-risk-card p {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.55;
}

.executive-risk-gauge {
  --gauge-color: var(--status-good);
  display: grid;
  flex: 0 0 116px;
  width: 116px;
  height: 116px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--gauge-color) calc(var(--risk-score, 0) * 1%), var(--surface-2) 0);
}

.executive-risk-gauge::before {
  content: "";
  grid-area: 1 / 1;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: var(--surface-1);
}

.executive-risk-gauge > div {
  z-index: 1;
  grid-area: 1 / 1;
  text-align: center;
}

.executive-risk-gauge strong {
  display: block;
  font-size: 29px;
  line-height: 1;
}

.executive-risk-gauge span {
  color: var(--text-muted);
  font-size: 9px;
}

.executive-risk-gauge[data-level="medium"] { --gauge-color: var(--status-warning); }
.executive-risk-gauge[data-level="high"] { --gauge-color: var(--status-serious); }
.executive-risk-gauge[data-level="critical"] { --gauge-color: var(--status-critical); }

.executive-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.executive-kpi-card {
  padding: 15px;
}

.executive-kpi-card > span,
.executive-kpi-card small {
  display: block;
  color: var(--text-muted);
  font-size: 9.5px;
}

.executive-kpi-card strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.executive-kpi-card.good strong { color: var(--status-good); }
.executive-kpi-card.warning strong { color: var(--status-warning); }
.executive-kpi-card.critical strong { color: var(--status-critical); }

.executive-analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.executive-link-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 3px;
  font: 700 9.5px var(--font);
  white-space: nowrap;
}

.executive-link-btn:hover {
  text-decoration: underline;
}

.executive-table-scroll {
  max-height: 290px;
  overflow: auto;
}

.executive-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.executive-table th,
.executive-table td {
  border-bottom: 1px solid var(--border);
  padding: 9px 7px;
  text-align: left;
  vertical-align: middle;
}

.executive-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 8.5px;
  white-space: nowrap;
}

.executive-table .number {
  text-align: right;
  white-space: nowrap;
}

.executive-table .wrap-name {
  min-width: 180px;
  max-width: 280px;
  overflow-wrap: anywhere;
}

.executive-ranked-list {
  display: grid;
  gap: 9px;
}

.executive-ranked-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
}

.executive-ranked-item .rank {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.executive-ranked-item strong,
.executive-ranked-item small {
  display: block;
}

.executive-ranked-item strong {
  font-size: 10.5px;
}

.executive-ranked-item small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 9px;
}

.executive-rank-bar {
  display: block;
  height: 5px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
}

.executive-rank-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.executive-trend-insight {
  display: grid;
  gap: 12px;
}

.trend-period-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.trend-period-row > span {
  color: var(--text-muted);
}

.trend-period-row small,
.trend-period-row strong,
.trend-period-row div > span {
  display: block;
}

.trend-period-row small,
.trend-period-row div > span {
  color: var(--text-muted);
  font-size: 9px;
}

.trend-period-row strong {
  margin: 4px 0;
  font-size: 13px;
}

.trend-change-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.trend-change-grid > div {
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 11px;
}

.trend-change-grid span,
.trend-change-grid strong {
  display: block;
}

.trend-change-grid span {
  color: var(--text-muted);
  font-size: 9px;
}

.trend-change-grid strong {
  margin-top: 5px;
  font-size: 16px;
}

.trend-change-grid .critical strong { color: var(--status-critical); }
.trend-change-grid .good strong { color: var(--status-good); }

.executive-trend-insight p {
  margin: 0;
  color: var(--text-muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.executive-recommendations {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.recommendation-card {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 12px;
}

.recommendation-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 11px;
  font-weight: 800;
}

.recommendation-card h4 {
  font-size: 11px;
}

.recommendation-card p {
  min-height: 46px;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.recommendation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 5px;
}

.recommendation-meta span {
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  color: var(--text-muted);
  padding: 3px 7px;
  font-size: 8.5px;
}

.recommendation-meta strong {
  color: var(--text-primary);
}

.executive-empty {
  padding: 24px 10px !important;
  color: var(--text-muted);
  text-align: center !important;
}

.executive-methodology {
  padding: 0;
  overflow: hidden;
}

.executive-methodology summary {
  cursor: pointer;
  padding: 14px 17px;
  font-size: 10.5px;
  font-weight: 700;
}

.executive-methodology > div {
  border-top: 1px solid var(--border);
  padding: 12px 17px;
}

.executive-methodology p {
  margin: 0;
  color: var(--text-muted);
  font-size: 9.5px;
  line-height: 1.65;
}

.executive-methodology p + p {
  margin-top: 7px;
}

/* ---------------- Advanced Analytics ---------------- */
.advanced-analytics-page,
.advanced-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.year-compare-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 9px;
}

.advanced-page-head {
  flex-wrap: wrap;
}

.compare-period-control {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.year-compare-controls label {
  color: var(--text-muted);
  font-size: 10px;
}

.year-compare-controls select {
  display: block;
  min-width: 126px;
  min-height: 36px;
  margin-top: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-primary);
  padding: 0 13px;
  font: 600 11.5px var(--font);
}

.compare-month-picker {
  position: relative;
  display: block;
  margin-top: 4px;
}

.compare-month-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 190px;
  min-height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-primary);
  cursor: pointer;
  padding: 0 13px;
  font: 600 11px var(--font);
  text-align: left;
}

.compare-month-trigger:hover,
.compare-month-trigger[aria-expanded="true"] {
  border-color: var(--accent);
}

.compare-month-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 80;
  display: block;
  width: 230px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  padding: 8px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.16);
}

.compare-month-menu-head {
  display: block;
  padding: 4px 6px 8px;
  color: var(--text-muted);
  font-size: 9.5px;
}

.compare-month-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
}

.compare-month-option {
  display: grid !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 7px;
  border-radius: 8px;
  color: var(--text-primary) !important;
  cursor: pointer;
  padding: 6px;
}

.compare-month-option:hover {
  background: var(--accent-soft);
}

.compare-month-option input {
  grid-row: 1 / span 2;
  accent-color: var(--accent);
}

.compare-month-option span,
.compare-month-option small {
  display: block;
}

.compare-month-option span {
  font-size: 10.5px;
  font-weight: 600;
}

.compare-month-option small {
  color: var(--text-muted);
  font-size: 8px;
}

.compare-month-option.unavailable {
  cursor: pointer;
  opacity: 0.72;
}

.compare-month-option.compare-month-all {
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 4px 4px;
}

.year-compare-controls select:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
}

.compare-vs {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
}

.advanced-compare-card,
.advanced-chart-card,
.advanced-table-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-card);
}

.advanced-compare-card,
.advanced-chart-card,
.advanced-table-card {
  padding: 17px;
}

.advanced-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.advanced-section-head h3,
.advanced-section-head p {
  margin: 0;
}

.advanced-section-head h3 {
  font-size: 13px;
}

.advanced-section-head p,
.advanced-section-head > span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 9.5px;
}

.advanced-metric-control {
  display: flex;
  flex-direction: column;
  flex: 0 1 270px;
  gap: 4px;
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 600;
}

.advanced-chart-controls {
  display: flex;
  flex: 0 1 520px;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
}

.advanced-chart-mode {
  display: inline-flex;
  min-height: 36px;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
}

.advanced-chart-mode button {
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0 12px;
  font: 600 10px var(--font);
  white-space: nowrap;
}

.advanced-chart-mode button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 28%, transparent);
}

.advanced-metric-control select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-primary);
  padding: 0 13px;
  font: 600 11px var(--font);
}

.advanced-metric-control select:hover,
.advanced-metric-control select:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
}

@media (max-width: 760px) {
  .advanced-compare-card > .advanced-section-head {
    flex-wrap: wrap;
  }

  .advanced-metric-control {
    flex-basis: 100%;
  }

  .advanced-chart-controls {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

.advanced-compare-kpis,
.analysis-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.compare-kpi-card,
.analysis-kpi-card {
  min-width: 0;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 13px;
}

.compare-kpi-label,
.analysis-kpi-card > span,
.analysis-kpi-card small {
  display: block;
  color: var(--text-muted);
  font-size: 9.5px;
}

.compare-values {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}

.compare-values > span {
  color: var(--text-muted);
  font-size: 12px;
}

.compare-values small,
.compare-values strong {
  display: block;
}

.compare-values small {
  color: var(--text-muted);
  font-size: 9px;
}

.compare-values strong {
  margin-top: 2px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.compare-change,
.table-change {
  display: inline-flex;
  margin-top: 8px;
  border-radius: var(--radius-pill);
  padding: 3px 7px;
  font-size: 9.5px;
  font-weight: 700;
}

.compare-change.up,
.table-change.up {
  background: var(--accent-soft);
  color: var(--accent);
}

.compare-change.down,
.table-change.down {
  background: var(--delta-down-bg);
  color: var(--status-critical);
}

.compare-change.neutral,
.table-change.neutral {
  background: var(--surface-1);
  color: var(--text-muted);
}

.advanced-compare-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(360px, 0.9fr);
  gap: 14px;
  margin-top: 14px;
}

.advanced-chart-box {
  position: relative;
  height: 330px;
  min-height: 0;
}

.advanced-chart-box.tall {
  height: 350px;
}

.advanced-compare-table-wrap,
.advanced-table-scroll {
  overflow: auto;
}

.advanced-compare-table-wrap {
  max-height: 350px;
}

.advanced-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
}

.advanced-data-table th,
.advanced-data-table td {
  border-bottom: 1px solid var(--border);
  padding: 9px 8px;
  text-align: left;
  vertical-align: middle;
}

.advanced-data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 9px;
  white-space: nowrap;
}

.advanced-data-table tbody tr:hover td {
  background: var(--accent-soft);
}

.advanced-data-table .number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.advanced-data-table .wrap-name {
  min-width: 180px;
  max-width: 340px;
  overflow-wrap: anywhere;
}

.advanced-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  padding: 5px;
  box-shadow: var(--shadow-card);
}

.advanced-tab {
  flex: 1;
  min-width: 140px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 9px 13px;
  font: 700 11px var(--font);
}

.advanced-tab:hover {
  background: var(--surface-2);
}

.advanced-tab.active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.analysis-kpi-card strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.advanced-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.advanced-table-scroll {
  max-height: 520px;
}

.risk-score {
  display: inline-grid;
  min-width: 30px;
  height: 25px;
  place-items: center;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 800;
}

.risk-score.high {
  background: var(--delta-down-bg);
  color: var(--status-critical);
}

.risk-score.medium {
  background: rgba(237, 161, 0, 0.13);
  color: var(--status-warning);
}

.risk-score.low {
  background: var(--delta-up-bg);
  color: var(--status-good);
}

.salein-kpi-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.salein-chart-box {
  height: 365px;
}

.salein-load-error {
  border: 1px solid var(--status-critical);
  border-radius: var(--radius-md);
  background: var(--delta-down-bg);
  color: var(--status-critical);
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 700;
}

.salein-table-scroll {
  max-height: 580px;
}

.salein-data-table {
  min-width: 1320px;
}

.salein-data-table tbody td {
  font-size: 12.5px;
  font-weight: 400;
}

.salein-data-table tbody strong {
  font-weight: 400;
}

.salein-data-table td:first-child {
  min-width: 210px;
  max-width: 300px;
  overflow-wrap: anywhere;
}

.salein-product-column {
  min-width: 230px;
  max-width: 330px;
  overflow-wrap: anywhere;
}

.salein-cj-item-column {
  min-width: 130px;
  max-width: 190px;
  overflow-wrap: anywhere;
}

.salein-supplier-row td {
  background: var(--surface-1);
  font-weight: 400;
}

.salein-supplier-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.salein-expand-btn {
  display: inline-grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  font: 800 15px/1 var(--font);
}

.salein-expand-btn:hover,
.salein-expand-btn:focus-visible {
  background: var(--accent);
  color: #fff;
  outline: none;
}

.salein-product-summary {
  color: var(--text-muted);
  font-weight: 400 !important;
}

.salein-product-row td {
  background: var(--surface-2);
  color: var(--text-secondary);
}

.salein-product-branch {
  display: block;
  padding-left: 31px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
}

.salein-table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.salein-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.salein-sort-btn.number {
  justify-content: flex-end;
}

.salein-sort-btn span {
  color: var(--text-muted);
  font-size: 10px;
}

.salein-sort-btn.active,
.salein-sort-btn:hover,
.salein-sort-btn:focus-visible {
  color: var(--accent);
}

.salein-match-badge {
  display: inline-flex;
  border-radius: var(--radius-pill);
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.salein-match-badge.exact {
  background: var(--delta-up-bg);
  color: var(--status-good);
}

.salein-match-badge.fuzzy {
  background: rgba(237, 161, 0, 0.13);
  color: var(--status-warning);
}

.salein-match-badge.supplier-only {
  background: var(--accent-soft);
  color: var(--accent);
}

.salein-match-badge.unmatched {
  background: var(--delta-down-bg);
  color: var(--status-critical);
}

.salein-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 10px;
}

@media (max-width: 1280px) {
  .salein-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .salein-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------------- My Tasks ---------------- */
.my-tasks-page,
.service-status-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.workspace-page-head,
.tasks-table-card,
.service-overview-card,
.service-note-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-card);
}

.workspace-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 19px;
}

.workspace-page-head h2,
.workspace-page-head p,
.service-note-card h3,
.service-note-card p,
.service-overview-card h3 {
  margin: 0;
}

.workspace-page-head h2 {
  font-size: 18px;
}

.workspace-page-head p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

.tasks-controls {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}

.tasks-controls label {
  color: var(--text-muted);
  font-size: 10px;
}

.tasks-controls select,
.tasks-search input {
  display: block;
  min-height: 36px;
  margin-top: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-primary);
  padding: 0 13px;
  font: 500 11.5px var(--font);
}

.tasks-controls select {
  min-width: 170px;
}

.tasks-search input {
  width: min(340px, 34vw);
}

.tasks-controls select:focus,
.tasks-search input:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
}

.tasks-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.task-kpi-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
  padding: 16px;
  text-align: left;
  box-shadow: var(--shadow-card);
  font-family: var(--font);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.task-kpi-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.task-kpi-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-card);
}

.task-kpi-card span,
.task-kpi-card small {
  display: block;
  color: var(--text-muted);
}

.task-kpi-card span {
  font-size: 10.5px;
  font-weight: 600;
}

.task-kpi-card strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 25px;
}

.task-kpi-card small {
  font-size: 9.5px;
}

.task-kpi-card.critical strong {
  color: var(--status-critical);
}

.task-kpi-card.predictive strong { color: var(--series-1); }

.tasks-table-card {
  min-width: 0;
  overflow: hidden;
}

.tasks-table-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 11px 15px;
  color: var(--text-muted);
  font-size: 10.5px;
}

#tasks-active-view {
  color: var(--accent);
  font-weight: 700;
}

.tasks-table-wrap {
  overflow-x: auto;
}

.tasks-table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
  font-size: 10.5px;
}

.tasks-table th,
.tasks-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 9px;
  text-align: left;
  vertical-align: middle;
}

.tasks-table th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
}

.tasks-table tbody tr:hover td {
  background: var(--accent-soft);
}

.tasks-table .claim-no {
  font-weight: 700;
  white-space: nowrap;
}

.tasks-table .number {
  text-align: right;
  white-space: nowrap;
}

.tasks-table .wrap-cell {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-sla-pill {
  display: inline-flex;
  border-radius: var(--radius-pill);
  padding: 4px 8px;
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
}

.task-sla-pill.sla-normal {
  background: var(--delta-up-bg);
  color: var(--status-good);
}

.task-sla-pill.sla-due-soon {
  background: rgba(237, 161, 0, 0.13);
  color: var(--status-warning);
}

.task-sla-pill.sla-overdue {
  background: var(--delta-down-bg);
  color: var(--status-critical);
}

.predictive-pill { display: inline-flex; flex-direction: column; gap: 1px; min-width: 92px; border-radius: 9px; padding: 5px 7px; white-space: nowrap; }
.predictive-pill b { font-size: 8.5px; }
.predictive-pill small { font-size: 7.5px; opacity: .78; }
.predictive-pill.risk-low { background: var(--delta-up-bg); color: var(--status-good); }
.predictive-pill.risk-medium { background: color-mix(in srgb, var(--status-warning) 14%, transparent); color: var(--status-warning); }
.predictive-pill.risk-high { background: var(--delta-down-bg); color: var(--status-critical); }

/* ---------------- Service Status ---------------- */
.service-page-head .btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.service-overview-card {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) minmax(150px, 0.65fr) minmax(230px, 0.9fr);
  align-items: center;
  gap: 18px;
  padding: 18px;
}

.service-score {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border: 8px solid var(--border);
  border-radius: 50%;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 800;
}

.service-score.healthy {
  border-color: var(--status-good);
  color: var(--status-good);
}

.service-score.warning {
  border-color: var(--status-warning);
  color: var(--status-warning);
}

.service-overview-label,
.service-overview-meta span,
.service-overview-meta small {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
}

.service-overview-card h3 {
  margin-top: 4px;
  font-size: 17px;
}

#service-last-checked {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 10px;
}

.service-overview-meta {
  min-width: 0;
  border-left: 1px solid var(--border);
  padding-left: 18px;
}

.service-overview-meta strong {
  display: block;
  margin: 4px 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.service-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.data-quality-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.data-quality-head {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) minmax(210px, 0.55fr);
  align-items: center;
  gap: 16px;
}

.data-quality-head h3,
.data-quality-head p { margin: 0; }
.data-quality-head h3 { margin-top: 3px; font-size: 16px; }
.data-quality-head p { margin-top: 5px; color: var(--text-muted); font-size: 10.5px; }

.data-quality-score {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border: 7px solid var(--status-good);
  border-radius: 50%;
  color: var(--status-good);
  font-size: 23px;
  font-weight: 800;
}
.data-quality-score.warning { border-color: var(--status-warning); color: var(--status-warning); }
.data-quality-score.critical { border-color: var(--status-critical); color: var(--status-critical); }

.data-quality-meta { border-left: 1px solid var(--border); padding-left: 18px; }
.data-quality-meta span,
.data-quality-meta small { display: block; color: var(--text-muted); font-size: 10px; }
.data-quality-meta strong { display: block; margin: 4px 0; font-size: 14px; }
.quality-passed { color: var(--status-good); }
.quality-critical { color: var(--status-critical); }

.data-quality-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.data-quality-kpis article { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); padding: 12px; }
.data-quality-kpis span,
.data-quality-kpis small { display: block; color: var(--text-muted); font-size: 9.5px; }
.data-quality-kpis strong { display: block; margin: 5px 0 2px; color: var(--text-primary); font-size: 18px; }

.data-quality-issues { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.quality-issue { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); padding: 9px 11px; }
.quality-issue summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-size: 10.5px; }
.quality-issue summary::-webkit-details-marker { display: none; }
.quality-issue p { margin: 7px 0 0 17px; color: var(--text-muted); font-size: 9.5px; line-height: 1.5; }
.quality-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--text-muted); }
.quality-issue.passed .quality-dot { background: var(--status-good); }
.quality-issue.info .quality-dot { background: var(--series-1); }
.quality-issue.warning .quality-dot { background: var(--status-warning); }
.quality-issue.critical .quality-dot { background: var(--status-critical); }
.quality-count { margin-left: auto; color: var(--text-secondary); font-weight: 700; }
.data-quality-rules { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; color: var(--text-muted); font-size: 10px; }
.data-quality-rules summary { cursor: pointer; color: var(--text-secondary); font-weight: 700; }
.data-quality-rules ul { margin: 8px 0 0 18px; padding: 0; line-height: 1.7; }

.service-status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  padding: 15px;
  box-shadow: var(--shadow-card);
}

.service-status-dot {
  flex: 0 0 11px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 0 5px var(--surface-2);
}

.service-status-card.operational .service-status-dot {
  background: var(--status-good);
  box-shadow: 0 0 0 5px var(--delta-up-bg);
}

.service-status-card.unavailable .service-status-dot {
  background: var(--status-critical);
  box-shadow: 0 0 0 5px var(--delta-down-bg);
}

.service-status-card.optional .service-status-dot {
  background: var(--status-warning);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--status-warning) 16%, transparent);
}

.service-status-card.checking .service-status-dot {
  background: var(--status-warning);
}

.service-card-main,
.service-status-card > div {
  min-width: 0;
}

.service-status-card h3,
.service-status-card p {
  margin: 0;
}

.service-status-card h3 {
  font-size: 12px;
}

.service-status-card p {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.service-card-result {
  margin-left: auto;
  text-align: right;
}

.service-card-result strong,
.service-card-result small {
  display: block;
  white-space: nowrap;
}

.service-card-result strong {
  color: var(--status-good);
  font-size: 10px;
}

.unavailable .service-card-result strong {
  color: var(--status-critical);
}

.service-card-result small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 9px;
}

.service-note-card {
  padding: 16px 18px;
}

.service-note-card h3 {
  font-size: 12px;
}

.service-note-card p {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .automated-briefing-body { grid-template-columns: 1fr; }
  .briefing-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tasks-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ai-insights-grid { grid-template-columns: 1fr; }
  .ai-insight-card h3,
  .ai-insight-card > p { min-height: 0; }
  .data-quality-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .chart-card.span-2 {
    grid-column: span 2;
  }
  .claim-detail-hero {
    grid-template-columns: 1fr;
  }
  .detail-hero-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .detail-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tasks-kpi-grid,
  .service-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .service-overview-card {
    grid-template-columns: auto 1fr 1fr;
  }
  .service-overview-meta:last-child {
    grid-column: 2 / -1;
  }
  .advanced-compare-layout {
    grid-template-columns: 1fr;
  }
  .advanced-compare-kpis,
  .analysis-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .executive-summary-layout {
    grid-template-columns: 1fr;
  }
  .executive-recommendations {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .automated-briefing-head,
  .automated-briefing-head > div:last-child { flex-direction: column; align-items: stretch; }
  .briefing-summary,
  .tasks-kpi-grid { grid-template-columns: 1fr; }
  .saved-view-toolbar { align-items: stretch; }
  .saved-view-toolbar,
  .ai-insights-head { flex-direction: column; }
  .saved-view-toolbar select,
  .ai-insights-context { width: 100%; max-width: none; }
  .saved-view-toolbar .export-data-btn { margin-left: 0; }
  .filter-collapsed-summary strong { font-size: 9.5px; }
  .data-quality-head { grid-template-columns: auto 1fr; }
  .data-quality-meta { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); padding: 10px 0 0; }
  .data-quality-kpis,
  .data-quality-issues { grid-template-columns: 1fr; }
  .export-format-grid { grid-template-columns: 1fr; }
  .export-format-grid button { min-height: 110px; }
}

@media print {
  @page { size: A4 landscape; margin: 9mm; }

  html,
  body {
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
    color: #111827 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sidebar,
  .topbar,
  .filter-bar,
  #state-banner,
  #chart-filter-bar,
  .ai-chat-widget,
  .kpi-drill-label,
  .chart-drill-btn,
  .ai-insight-card > button,
  .ai-insight-card details,
  #copy-briefing-btn,
  #automated-briefing-actions,
  .briefing-method,
  .metric-info,
  #advanced-analytics-page,
  #ai-executive-page,
  #all-claims-page,
  #claim-detail-page,
  #my-tasks-page,
  #service-status-page {
    display: none !important;
  }

  .app,
  .main,
  .content,
  #dashboard-body {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .dashboard-print-meta {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 8mm;
    border-bottom: 2px solid #365f9d;
    padding: 0 0 4mm;
  }

  .dashboard-print-brand { display: flex; align-items: center; gap: 12px; }
  .dashboard-print-brand img { width: 78px; height: 42px; object-fit: contain; }
  .dashboard-print-brand h1,
  .dashboard-print-brand p { margin: 0; }
  .dashboard-print-brand h1 { font-size: 20px; white-space: nowrap; }
  .dashboard-print-brand p { margin-top: 2px; color: #64748b; font-size: 10px; }
  .dashboard-print-context { max-width: 55%; text-align: right; }
  .dashboard-print-context strong,
  .dashboard-print-context span { display: block; }
  .dashboard-print-context strong { font-size: 10px; overflow-wrap: anywhere; }
  .dashboard-print-context span { margin-top: 3px; color: #64748b; font-size: 9px; }

  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 7px !important; }
  .kpi-card { min-height: 82px !important; box-shadow: none !important; break-inside: avoid; }
  .ai-insights-section,
  .automated-briefing,
  .chart-card { box-shadow: none !important; break-inside: avoid; page-break-inside: avoid; }
  .ai-insights-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .automated-briefing-body { grid-template-columns: 1fr !important; }
  .briefing-summary { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
  .chart-card.span-2 { grid-column: span 2 !important; }
  .chart-card { min-height: 250px; }
  .chart-body { min-height: 205px; }
  canvas { max-width: 100% !important; }
  details { display: none !important; }
}

@media (max-width: 760px) {
  .app {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .chart-grid {
    grid-template-columns: 1fr;
  }
  .chart-card.span-2 {
    grid-column: span 1;
  }
  .chart-filter-bar {
    align-items: flex-start;
    flex-direction: column;
  }
  .claims-toolbar,
  .claims-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .claims-search input {
    width: 100%;
    min-width: 0;
  }
  .detail-lookup-card,
  .detail-case-nav {
    align-items: stretch;
    flex-direction: column;
  }
  .detail-case-nav {
    width: 100%;
    margin-left: 0;
  }
  .detail-search-message {
    max-width: none;
  }
  .detail-hero-metrics,
  .claim-detail-panel,
  .detail-grid,
  .detail-timeline,
  .document-grid,
  .workflow-layout,
  .workflow-grid {
    grid-template-columns: 1fr;
  }
  .detail-item.wide {
    grid-column: 1;
  }
  .workspace-page-head,
  .tasks-controls {
    align-items: stretch;
    flex-direction: column;
  }
  .tasks-search input,
  .tasks-controls select {
    width: 100%;
  }
  .tasks-kpi-grid,
  .service-status-grid,
  .service-overview-card {
    grid-template-columns: 1fr;
  }
  .service-score {
    width: 72px;
    height: 72px;
  }
  .service-overview-meta,
  .service-overview-meta:last-child {
    grid-column: auto;
    border-top: 1px solid var(--border);
    border-left: 0;
    padding-top: 12px;
    padding-left: 0;
  }
  .year-compare-controls {
    align-items: stretch;
    flex-direction: column;
  }
  .compare-period-control,
  .year-compare-controls label {
    flex: 1;
  }
  .compare-period-control {
    align-items: stretch;
    flex-direction: column;
  }
  .year-compare-controls select {
    width: 100%;
  }
  .compare-month-trigger {
    width: 100%;
  }
  .compare-month-menu {
    right: auto;
    left: 0;
    width: min(270px, 82vw);
  }
  .advanced-compare-kpis,
  .analysis-kpi-grid,
  .advanced-chart-grid {
    grid-template-columns: 1fr;
  }
  .advanced-chart-box,
  .advanced-chart-box.tall {
    height: 300px;
  }
  .ai-executive-actions,
  .executive-risk-card {
    align-items: flex-start;
    flex-direction: column;
  }
  .executive-kpi-grid,
  .executive-analysis-grid,
  .executive-recommendations {
    grid-template-columns: 1fr;
  }
  .executive-risk-card {
    display: flex;
  }
  .recommendation-card p {
    min-height: 0;
  }
}

/* ---------------- States ---------------- */
.state-banner {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  box-shadow: var(--shadow-card);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.state-banner.error {
  border-color: rgba(208, 59, 59, 0.4);
  color: var(--status-critical);
  background: var(--delta-down-bg);
}

.hidden {
  display: none !important;
}
/* ============================================================
   Floating SAHAMIT AI Chat
   ============================================================ */
.nav-item[data-label="AI Chat"] {
  display: none;
}

.ai-chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  pointer-events: none;
}

.ai-chat-widget.ai-chat-left {
  right: auto;
  left: 24px;
  align-items: flex-start;
}

.ai-chat-widget > * {
  pointer-events: auto;
}

.ai-chat-launcher {
  position: relative;
  width: 92px;
  height: 92px;
  padding: 11px 8px 8px;
  border: 3px solid #2f5d9b;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 14px 36px rgba(20, 48, 91, 0.28), 0 0 0 5px rgba(47, 93, 155, 0.12);
  color: #254f87;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  display: grid;
  place-items: center;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.ai-chat-launcher.dragging,
.ai-chat-launcher.dragging:hover {
  cursor: grabbing;
  transition: none;
  box-shadow: 0 18px 42px rgba(20, 48, 91, 0.34), 0 0 0 6px rgba(47, 93, 155, 0.16);
}

.ai-chat-launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 42px rgba(20, 48, 91, 0.34), 0 0 0 6px rgba(47, 93, 155, 0.16);
}

.ai-chat-launcher:focus-visible {
  outline: 3px solid #f4b740;
  outline-offset: 4px;
}

.ai-chat-launcher img {
  width: 68px;
  max-height: 39px;
  object-fit: contain;
  display: block;
}

.ai-chat-launcher-label {
  margin-top: -5px;
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .04em;
}

.ai-chat-launcher-dot {
  position: absolute;
  right: 3px;
  top: 5px;
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #19a765;
  box-shadow: 0 1px 5px rgba(0,0,0,.2);
}

.ai-chat-panel {
  width: min(506px, calc(100vw - 32px));
  height: min(716px, calc(100vh - 32px));
  min-height: 430px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
  border: 1px solid rgba(47, 93, 155, .3);
  border-radius: 22px;
  background: var(--surface-1);
  color: var(--text-primary);
  box-shadow: 0 26px 70px rgba(10, 28, 55, .3);
  transform-origin: bottom right;
  animation: ai-chat-enter 180ms ease-out;
}

.ai-chat-widget.ai-chat-left .ai-chat-panel {
  transform-origin: bottom left;
}

@keyframes ai-chat-enter {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-chat-header {
  min-height: 72px;
  padding: 12px 12px 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #fff;
  background: linear-gradient(135deg, #244f88, #3974bc);
}

.ai-chat-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-chat-heading img {
  width: 54px;
  height: 42px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 9px;
  object-fit: contain;
  background: #fff;
}

.ai-chat-heading strong,
.ai-chat-heading small {
  display: block;
}

.ai-chat-heading strong {
  font-size: 17px;
}

.ai-chat-heading small {
  margin-top: 3px;
  color: rgba(255,255,255,.82);
  font-size: 12.5px;
  white-space: nowrap;
}

.ai-chat-heading small i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  background: #5ee5a3;
}

.ai-chat-window-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.ai-chat-window-actions button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #fff;
  font: 700 22px/1 Arial, sans-serif;
  cursor: pointer;
}

.ai-chat-window-actions button:first-child {
  padding-bottom: 8px;
}

.ai-chat-window-actions button:hover,
.ai-chat-window-actions button:focus-visible {
  background: rgba(255,255,255,.16);
  outline: none;
}

.ai-chat-context {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-chat-messages {
  min-height: 0;
  padding: 16px 14px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 42%, transparent), transparent 35%);
}

.ai-chat-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 13px;
}

.ai-chat-message.user {
  justify-content: flex-end;
}

.ai-chat-avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  padding: 3px;
  border: 1px solid rgba(47,93,155,.28);
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
}

.ai-chat-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 15px 15px 15px 4px;
  background: var(--surface-1);
  box-shadow: 0 4px 14px rgba(14, 35, 67, .06);
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.ai-chat-message.user .ai-chat-bubble {
  border-color: transparent;
  border-radius: 15px 15px 4px 15px;
  background: #3268aa;
  color: #fff;
}

.ai-chat-bubble small {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 11.5px;
}

.ai-chat-bubble.thinking {
  color: var(--muted);
  font-style: italic;
}

.ai-chat-bubble.thinking::after {
  content: "";
  display: inline-block;
  width: 1.2em;
  animation: ai-chat-thinking 1.2s steps(4, end) infinite;
}

@keyframes ai-chat-thinking {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

.ai-chat-message.user .ai-chat-bubble small {
  color: rgba(255,255,255,.7);
}

.ai-chat-suggestions {
  padding: 5px 12px 8px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.ai-chat-suggestions button {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, #3268aa 45%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, #3268aa 7%, var(--surface-1));
  color: color-mix(in srgb, #3268aa 78%, var(--text-primary));
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.ai-chat-suggestions button:hover {
  background: color-mix(in srgb, #3268aa 14%, var(--surface-1));
}

.ai-chat-compose {
  margin: 0 12px;
  padding: 6px 6px 6px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface-2);
}

.ai-chat-compose:focus-within {
  border-color: #3974bc;
  box-shadow: 0 0 0 3px rgba(57,116,188,.12);
}

.ai-chat-compose textarea {
  flex: 1;
  max-height: 92px;
  padding: 5px 0;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.45;
}

.ai-chat-compose button {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 8px;
  border: 0;
  border-radius: 11px;
  background: #3268aa;
  color: #fff;
  cursor: pointer;
}

.ai-chat-compose button:hover {
  background: #244f88;
}

.ai-chat-compose button svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.ai-chat-disclaimer {
  padding: 8px 12px 10px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.35;
  text-align: center;
}

@media (max-width: 700px) {
  .ai-chat-widget {
    right: 12px;
    bottom: 12px;
  }

  .ai-chat-widget.ai-chat-left {
    right: auto;
    left: 12px;
  }

  .ai-chat-launcher {
    width: 72px;
    height: 72px;
    padding: 8px 6px 6px;
    border-width: 2px;
  }

  .ai-chat-launcher img {
    width: 54px;
    max-height: 31px;
  }

  .ai-chat-launcher-label {
    font-size: 11px;
  }

  .ai-chat-launcher-dot {
    width: 14px;
    height: 14px;
    border-width: 2px;
  }

  .ai-chat-panel {
    width: calc(100vw - 24px);
    height: min(706px, calc(100dvh - 24px));
    min-height: 380px;
    border-radius: 18px;
  }
}

/* ==========================================================
   Intelligence Experience 2026 — Daily Pulse / Smart KPI /
   Anomaly / Pattern / Supplier 360
   ========================================================== */
body {
  background:
    radial-gradient(circle at 78% -12%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 30%),
    radial-gradient(circle at 15% 35%, color-mix(in srgb, var(--series-1) 5%, transparent), transparent 27%),
    var(--page-bg);
}

.topbar {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--accent) 16%, var(--border));
  background: linear-gradient(120deg, var(--surface-1) 65%, color-mix(in srgb, var(--accent) 8%, var(--surface-1)));
}

.topbar::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -70px;
  top: -115px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 50%;
  pointer-events: none;
}

.filter-bar {
  border-color: color-mix(in srgb, var(--accent) 10%, var(--border));
  backdrop-filter: blur(16px);
}

.daily-pulse {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 76px minmax(280px, 1.2fr) minmax(360px, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 158px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: 24px;
  background:
    linear-gradient(112deg, color-mix(in srgb, var(--accent) 16%, var(--surface-1)), var(--surface-1) 48%, color-mix(in srgb, var(--series-1) 8%, var(--surface-1)));
  box-shadow: 0 20px 55px color-mix(in srgb, var(--accent) 10%, transparent), var(--shadow-card);
  padding: 22px;
}

.daily-pulse::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image: linear-gradient(color-mix(in srgb, var(--accent) 5%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--accent) 5%, transparent) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(90deg, #000, transparent 70%);
}

.daily-pulse-orb {
  position: relative;
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-1));
  box-shadow: inset 0 0 26px color-mix(in srgb, var(--accent) 18%, transparent), 0 0 34px color-mix(in srgb, var(--accent) 14%, transparent);
}

.daily-pulse-orb::before,
.daily-pulse-orb::after,
.daily-pulse-orb span {
  content: "";
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 50%;
}
.daily-pulse-orb::before { width: 34px; height: 34px; opacity: .28; animation: intelligence-orbit 8s linear infinite; }
.daily-pulse-orb::after { width: 18px; height: 18px; opacity: .7; }
.daily-pulse-orb span { width: 7px; height: 7px; border: 0; background: var(--accent); box-shadow: 0 0 15px var(--accent); }

@keyframes intelligence-orbit { to { transform: rotate(360deg) scale(.82); } }

.daily-pulse-main { min-width: 0; }
.daily-pulse-kicker { display: flex; align-items: center; gap: 7px; color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.daily-pulse-kicker i { border-radius: 999px; background: var(--surface-1); color: var(--text-secondary); padding: 4px 8px; font-style: normal; letter-spacing: 0; }
.daily-pulse-kicker i.critical { color: var(--status-critical); }
.daily-pulse-kicker i.watch { color: var(--status-warning); }
.daily-pulse-kicker i.stable { color: var(--status-good); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--status-good); box-shadow: 0 0 0 5px color-mix(in srgb, var(--status-good) 12%, transparent); animation: intelligence-pulse 1.8s ease-in-out infinite; }
@keyframes intelligence-pulse { 50% { box-shadow: 0 0 0 9px transparent; } }
.daily-pulse h2 { margin: 8px 0 4px; font-size: clamp(18px, 1.5vw, 25px); letter-spacing: -.025em; }
.daily-pulse-main > p { margin: 0; max-width: 720px; color: var(--text-secondary); font-size: 11.5px; line-height: 1.65; }
.daily-pulse-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.daily-pulse-meta span { border: 1px solid var(--border); border-radius: 999px; background: color-mix(in srgb, var(--surface-1) 78%, transparent); color: var(--text-muted); padding: 4px 8px; font-size: 8.5px; }

.daily-pulse-signals { display: grid; grid-template-columns: repeat(3, minmax(105px, 1fr)); gap: 8px; }
.daily-pulse-signals article { min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface-1) 86%, transparent); padding: 10px; }
.daily-pulse-signals article.critical { border-color: color-mix(in srgb, var(--status-critical) 35%, var(--border)); }
.daily-pulse-signals article.warning,
.daily-pulse-signals article.watch { border-color: color-mix(in srgb, var(--status-warning) 42%, var(--border)); }
.daily-pulse-signals article.good,
.daily-pulse-signals article.normal { border-color: color-mix(in srgb, var(--status-good) 32%, var(--border)); }
.daily-pulse-signals span,.daily-pulse-signals strong,.daily-pulse-signals small { display: block; overflow: hidden; text-overflow: ellipsis; }
.daily-pulse-signals span { color: var(--text-muted); font-size: 7.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.daily-pulse-signals strong { margin-top: 5px; font-size: 12px; white-space: nowrap; }
.daily-pulse-signals small { margin-top: 3px; color: var(--text-muted); font-size: 7.8px; line-height: 1.35; }
.daily-pulse-signals button { margin-top: 6px; padding: 0; border: 0; background: transparent; color: var(--accent); font: 700 8px var(--font); cursor: pointer; }
.daily-pulse-actions { display: flex; flex-direction: column; gap: 8px; }
.daily-pulse-actions button { min-width: 100px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 11px; background: var(--surface-1); color: var(--accent); padding: 9px 11px; font: 700 9px var(--font); cursor: pointer; }
.daily-pulse-actions button:last-child { border-color: var(--accent); background: var(--accent); color: #fff; }

.kpi-grid { grid-template-columns: repeat(6, minmax(155px, 1fr)); gap: 10px; }
.kpi-card { min-height: 148px; overflow: hidden; padding: 16px; border-radius: 18px; background: linear-gradient(155deg, var(--surface-1), color-mix(in srgb, var(--accent) 2.5%, var(--surface-1))); }
.kpi-card::before { content: ""; position: absolute; width: 72px; height: 72px; right: -34px; top: -34px; border: 1px solid color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 50%; }
.kpi-card .value { font-size: clamp(20px, 1.8vw, 28px); }
.kpi-sparkline { height: 35px; margin: 1px -2px -2px; opacity: .92; }
.kpi-sparkline svg { width: 100%; height: 100%; overflow: visible; }
.kpi-sparkline polyline { stroke-width: 2; }
.sparkline-accent { stroke: var(--accent); fill: var(--accent); }
.sparkline-warning { stroke: var(--status-warning); fill: var(--status-warning); }
.sparkline-good { stroke: var(--status-good); fill: var(--status-good); }
.sparkline-critical { stroke: var(--status-critical); fill: var(--status-critical); }
.kpi-intelligence { min-height: 14px; color: var(--text-muted); font-size: 8px; line-height: 1.4; }
.kpi-drill-label { padding-top: 1px; }
.delta-badge { font-size: 8px; padding: 3px 6px; }
.delta-badge.neutral { background: var(--accent-soft); color: var(--accent); }
.delta-badge.good { background: var(--delta-up-bg); color: var(--delta-up-text); }
.delta-badge.bad { background: var(--delta-down-bg); color: var(--delta-down-text); }

.intelligence-lab { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 14px; margin-top: 14px; }
.intelligence-card { min-width: 0; border: 1px solid color-mix(in srgb, var(--accent) 15%, var(--border)); border-radius: 22px; background: linear-gradient(145deg, var(--surface-1), color-mix(in srgb, var(--series-1) 3%, var(--surface-1))); box-shadow: var(--shadow-card); padding: 17px; }
.intelligence-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.intelligence-card-head span { color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .11em; }
.intelligence-card-head h2 { margin: 3px 0 0; font-size: 14px; }
.intelligence-card-head p { margin: 3px 0 0; color: var(--text-muted); font-size: 8.5px; }
.intelligence-status { flex: 0 0 auto; border-radius: 999px; background: var(--surface-2); color: var(--text-secondary); padding: 5px 9px; font-size: 8px; font-weight: 700; }
.intelligence-status.critical { background: var(--delta-down-bg); color: var(--status-critical); }
.intelligence-status.warning,.intelligence-status.watch { background: color-mix(in srgb, var(--status-warning) 15%, transparent); color: color-mix(in srgb, var(--status-warning) 82%, var(--text-primary)); }
.intelligence-status.normal { background: var(--delta-up-bg); color: var(--status-good); }
.anomaly-chart-wrap { height: 190px; margin-top: 12px; }
.root-cause-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
.root-cause-list button { min-width: 0; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); padding: 9px; text-align: left; font-family: var(--font); cursor: pointer; }
.root-cause-list span,.root-cause-list strong,.root-cause-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.root-cause-list span { color: var(--text-muted); font-size: 7.5px; }
.root-cause-list strong { margin-top: 3px; font-size: 9px; }
.root-cause-list i { display: inline-block; margin-top: 6px; border-radius: 999px; background: var(--delta-down-bg); color: var(--status-critical); padding: 2px 6px; font-size: 8px; font-style: normal; font-weight: 700; }
.root-cause-list small { margin-top: 4px; color: var(--text-muted); font-size: 7px; }
.intelligence-footer { display: flex; justify-content: flex-end; gap: 7px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border); }
.intelligence-footer button { border: 0; border-radius: 9px; background: var(--accent-soft); color: var(--accent); padding: 7px 10px; font: 700 8px var(--font); cursor: pointer; }
.intelligence-footer button:disabled { opacity: .4; cursor: default; }
.intelligence-footer button:last-child { background: var(--accent); color: #fff; }
.intelligence-empty { display: grid; min-height: 80px; place-items: center; color: var(--text-muted); font-size: 9px; text-align: center; }

.pattern-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 328px; overflow: auto; padding-right: 3px; }
.pattern-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); padding: 9px; }
.pattern-rank { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 8px; font-weight: 800; }
.pattern-content { min-width: 0; }
.pattern-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pattern-title button { max-width: 58%; overflow: hidden; border: 0; background: transparent; color: var(--text-primary); padding: 0; font: 700 9px var(--font); text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.pattern-title span { overflow: hidden; border-radius: 999px; background: var(--surface-1); color: var(--text-secondary); padding: 2px 6px; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.pattern-content p { margin: 3px 0; overflow: hidden; color: var(--text-secondary); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.pattern-content small { display: block; overflow: hidden; color: var(--text-muted); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.pattern-metrics { text-align: right; }
.pattern-metrics strong,.pattern-metrics > span { display: block; }
.pattern-metrics strong { font-size: 11px; }
.pattern-metrics > span { color: var(--text-muted); font-size: 7px; }
.pattern-metrics div { display: flex; justify-content: flex-end; gap: 3px; margin-top: 3px; }
.pattern-metrics i { border-radius: 999px; background: var(--surface-1); color: var(--text-secondary); padding: 2px 5px; font-size: 6.5px; font-style: normal; }
.pattern-metrics i.rising { background: var(--delta-down-bg); color: var(--status-critical); }
.pattern-evidence { border: 0; background: transparent; color: var(--accent); font: 700 7.5px var(--font); white-space: nowrap; cursor: pointer; }

.chart-head { gap: 8px; }
.chart-intelligence-btn { margin-left: auto; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: 999px; background: var(--accent-soft); color: var(--accent); padding: 5px 8px; font: 700 8px var(--font); cursor: pointer; }
.supplier-360-link { border: 0; background: transparent; color: inherit; padding: 0; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.supplier-360-link span { margin-left: 5px; color: var(--accent); font-size: 8px; }

.supplier-360-backdrop { position: fixed; z-index: 1090; inset: 0; background: rgba(8, 13, 26, .38); backdrop-filter: blur(5px); animation: drawer-fade .18s ease; }
.supplier-360-drawer { position: fixed; z-index: 1100; top: 12px; right: 12px; bottom: 12px; width: min(560px, calc(100vw - 24px)); overflow-y: auto; border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border)); border-radius: 24px; background: color-mix(in srgb, var(--surface-1) 96%, transparent); box-shadow: -20px 0 70px rgba(12, 20, 40, .24); padding: 20px; animation: drawer-in .22s ease; }
@keyframes drawer-in { from { opacity: 0; transform: translateX(28px); } }
@keyframes drawer-fade { from { opacity: 0; } }
.supplier-360-head { display: flex; justify-content: space-between; gap: 14px; }
.supplier-360-head span { color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.supplier-360-head h2 { margin: 5px 0 0; font-size: 20px; overflow-wrap: anywhere; }
.supplier-360-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 8.5px; }
.supplier-360-head > button { flex: 0 0 34px; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-2); color: var(--text-primary); font-size: 20px; cursor: pointer; }
.supplier-360-score { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; border-radius: 16px; background: linear-gradient(120deg, var(--accent-soft), var(--surface-2)); padding: 13px; }
.supplier-360-score span,.supplier-360-score strong { display: block; }
.supplier-360-score span { color: var(--text-muted); font-size: 8px; }
.supplier-360-score strong { margin-top: 3px; font-size: 17px; }
.supplier-360-score strong.risk-high { color: var(--status-critical); }
.supplier-360-score strong.risk-medium { color: var(--status-warning); }
.supplier-360-score strong.risk-low { color: var(--status-good); }
.supplier-360-score p { margin: 0; color: var(--text-secondary); font-size: 9px; text-align: right; }
.supplier-360-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
.supplier-360-kpis article { min-width: 0; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); padding: 10px; }
.supplier-360-kpis span,.supplier-360-kpis strong,.supplier-360-kpis small { display: block; overflow: hidden; text-overflow: ellipsis; }
.supplier-360-kpis span { color: var(--text-muted); font-size: 7.5px; }
.supplier-360-kpis strong { margin-top: 4px; font-size: 13px; white-space: nowrap; }
.supplier-360-kpis small { margin-top: 3px; color: var(--text-muted); font-size: 7px; white-space: nowrap; }
.supplier-360-section { margin-top: 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-1); padding: 12px; }
.supplier-360-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.supplier-360-section-head h3 { margin: 0; font-size: 11px; }
.supplier-360-section-head span { color: var(--text-muted); font-size: 7.5px; }
.supplier-360-chart { height: 175px; margin-top: 8px; }
.supplier-driver-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 9px; }
.supplier-driver-grid > div > span { color: var(--accent); font-size: 7px; font-weight: 800; letter-spacing: .08em; }
.supplier-driver-grid p { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 5px 0 0; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.supplier-driver-grid b { overflow: hidden; font-size: 8px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.supplier-driver-grid i { flex: 0 0 auto; color: var(--text-muted); font-size: 7px; font-style: normal; }
.supplier-360-actions { position: sticky; bottom: -20px; display: flex; gap: 7px; margin: 14px -20px -20px; border-top: 1px solid var(--border); background: var(--surface-1); padding: 12px 20px 18px; }
.supplier-360-actions button { flex: 1; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text-primary); padding: 9px; font: 700 8px var(--font); cursor: pointer; }
.supplier-360-actions button:first-child { border-color: var(--accent); background: var(--accent); color: #fff; }

@media (max-width: 1450px) {
  .daily-pulse { grid-template-columns: 64px minmax(260px, 1fr) minmax(330px, .9fr); }
  .daily-pulse-actions { grid-column: 2 / -1; flex-direction: row; justify-content: flex-end; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
}

@media (max-width: 1080px) {
  .daily-pulse { grid-template-columns: 56px 1fr; }
  .daily-pulse-signals,.daily-pulse-actions { grid-column: 1 / -1; }
  .intelligence-lab { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .daily-pulse { grid-template-columns: 1fr; padding: 16px; }
  .daily-pulse-orb { width: 48px; height: 48px; border-radius: 16px; }
  .daily-pulse-signals { grid-template-columns: 1fr; }
  .daily-pulse-actions { justify-content: stretch; }
  .daily-pulse-actions button { flex: 1; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-card { min-height: 160px; }
  .root-cause-list { grid-template-columns: 1fr; }
  .pattern-item { grid-template-columns: 28px minmax(0, 1fr); }
  .pattern-metrics,.pattern-evidence { grid-column: 2; justify-self: start; text-align: left; }
  .supplier-360-kpis { grid-template-columns: 1fr 1fr; }
  .supplier-driver-grid { grid-template-columns: 1fr; }
  .supplier-360-actions { flex-wrap: wrap; }
  .supplier-360-actions button { flex: 1 0 42%; }
}

@media (prefers-reduced-motion: reduce) {
  .daily-pulse-orb::before,.live-dot { animation: none; }
  .supplier-360-drawer,.supplier-360-backdrop { animation: none; }
}
