﻿:root {
  --bg: #edf2fb;
  --panel: #ffffff;
  --ink: #172437;
  --sub: #688098;
  --line: #dce5f0;
  --primary: #1d4ed8;
  --primary-dark: #143fb5;
  --primary-soft: #e8efff;
  --ok: #0d9f6e;
  --danger: #c0362c;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #85a2dc #edf3ff;
}

[hidden] {
  display: none !important;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: linear-gradient(180deg, #f5f8ff 0%, #eaf1ff 100%);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6f92d9 0%, #4f74c8 100%);
  border: 2px solid #edf3ff;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #5f84d2 0%, #4367b9 100%);
}

*::-webkit-scrollbar-corner {
  background: #edf3ff;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 100% -20%, rgba(29, 78, 216, 0.14), transparent 42%),
    radial-gradient(circle at -10% 110%, rgba(14, 165, 233, 0.12), transparent 34%),
    linear-gradient(180deg, #f3f7fc 0%, #e8eff8 100%);
  color: var(--ink);
  font-family: 'Outfit', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  overflow: hidden;
  overflow-x: hidden;
}

.app-shell {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 4px 6px;
  display: grid;
  grid-template-columns: 218px 1fr;
  gap: 8px;
}

.side-nav,
.workspace-col,
.report-col {
  min-height: 0;
}

.side-nav {
  border-radius: 18px;
  padding: 14px 12px;
  background: linear-gradient(170deg, #2356ff 0%, #1a46d4 66%, #1439b8 100%);
  color: #f4f8ff;
  box-shadow: 0 20px 38px rgba(22, 59, 170, 0.35);
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: visible;
  position: relative;
  animation: panelIn 0.45s ease both;
}

.brand-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #dbe5f5;
  box-shadow: 0 8px 18px rgba(10, 30, 75, 0.16);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.brand-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

.brand-title {
  margin: 0;
  font-size: 18px;
}

.brand-subtitle {
  margin: 2px 0 0;
  opacity: 0.82;
  font-size: 12px;
}

.history-toggle {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 74;
  min-width: 104px;
  text-align: center;
  border: 1px solid rgba(188, 221, 255, 0.95);
  background: linear-gradient(140deg, #f5fbff 0%, #dfefff 44%, #c9e4ff 100%);
  color: #113f93;
  border-radius: 14px;
  padding: 11px 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
  box-shadow: 0 14px 30px rgba(27, 75, 165, 0.28);
  position: fixed;
  overflow: hidden;
  isolation: isolate;
  animation: glowPulse 2.8s ease-in-out infinite;
}

.history-toggle::before,
.chat-toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.55) 48%, transparent 100%);
  transform: translateX(-130%);
  animation: sheenMove 2.8s ease-in-out infinite;
  pointer-events: none;
}

.history-toggle::after {
  content: '◉';
  margin-left: 8px;
  font-size: 12px;
  vertical-align: 1px;
}

.history-toggle:hover {
  filter: brightness(1.04);
  transform: none;
}

.history-drawer {
  position: fixed;
  top: 60px;
  right: 18px;
  width: min(680px, 58vw);
  max-height: calc(100vh - 78px);
  background: #ffffff;
  border: 1px solid #d8e3f5;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(14, 30, 68, 0.26);
  padding: 12px;
  display: grid;
  gap: 8px;
  opacity: 0;
  transform: translateX(22px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 75;
}

.history-drawer.open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-head h3 {
  margin: 0;
  font-size: 16px;
  color: #1a2c42;
}

.drawer-close {
  border: 1px solid #d3def3;
  background: #eef4ff;
  color: #2f4f83;
  border-radius: 8px;
  padding: 6px 10px;
}

.drawer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.drawer-actions button {
  border-radius: 10px;
  padding: 7px 10px;
  border: 1px solid #d3def3;
  background: #eef4ff;
  color: #2f4f83;
  font-weight: 600;
}

.drawer-actions button.danger {
  background: #fff1f0;
  border-color: #f2c6c3;
  color: #c0362c;
}

.history-wrap {
  max-height: calc(100vh - 290px);
}

.history-search {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.history-search input {
  min-width: 0;
  border: 1px solid #d4e0f3;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  color: #23425d;
  background: #f8fbff;
}

.history-search input:focus {
  outline: 2px solid rgba(29, 78, 216, 0.2);
  border-color: rgba(29, 78, 216, 0.45);
}

.history-search button {
  border-radius: 10px;
  padding: 8px 12px;
}

.history-search .ghost {
  background: #f5f8ff;
  border-color: #d4e0f3;
  color: #33507f;
}

.history-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

#history-page-info {
  min-width: 98px;
  text-align: center;
  font-size: 13px;
  color: #4f6886;
}

.info-note {
  margin: 0 0 8px;
  color: #56708e;
  font-size: 12px;
  line-height: 1.5;
}
.agent-plan-summary {
  margin: 0 0 10px;
  padding: 9px 12px;
  border: 1px solid #d9e5f8;
  border-radius: 10px;
  background: linear-gradient(180deg, #f7faff 0%, #eef4ff 100%);
  color: #2f4f79;
  font-size: 13px;
  line-height: 1.5;
}

.trend-evidence {
  font-size: 12px;
  line-height: 1.4;
  color: #365377;
}

.trend-plain {
  display: inline-block;
  font-size: 12px;
  line-height: 1.45;
  color: #2f4f77;
}

.trend-evidence.muted {
  color: #7f94ad;
}

.trend-evidence a {
  color: #2053c5;
  text-decoration: none;
}

.trend-evidence a:hover {
  text-decoration: underline;
}

.menu-list {
  display: grid;
  gap: 8px;
}

.menu-item {
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.1);
  color: #eaf1ff;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.18s ease, background 0.18s ease;
}

.menu-item.active {
  background: #ffffff;
  color: #1740bd;
  box-shadow: 0 6px 14px rgba(15, 50, 161, 0.22);
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(2px);
}

.menu-item:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.66);
  outline-offset: 2px;
}

.menu-item-premium {
  background: linear-gradient(135deg, #ffeec4 0%, #ffd36e 35%, #f8b11c 100%);
  color: #4b2b00;
  border: 1px solid rgba(255, 214, 133, 0.92);
  box-shadow: 0 10px 20px rgba(247, 171, 32, 0.3);
  font-weight: 700;
}

.menu-item-premium:hover {
  transform: translateX(2px) translateY(-1px);
  filter: brightness(1.03);
}

.menu-item-premium.active {
  color: #4b2b00;
  background: linear-gradient(135deg, #fff3d1 0%, #ffd880 40%, #f3b428 100%);
  border-color: rgba(255, 226, 162, 0.9);
  box-shadow: 0 12px 24px rgba(247, 171, 32, 0.35);
}

.side-note {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.14);
}

.side-note h2 {
  margin: 0 0 8px;
  font-size: 14px;
}

.side-note ol {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 5px;
  font-size: 13px;
}

.api-hint {
  margin: 10px 0 0;
  font-size: 12px;
  opacity: 0.9;
}

.workspace-col {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 28px rgba(16, 41, 74, 0.12);
  backdrop-filter: blur(4px);
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  animation: panelIn 0.5s ease both;
}

.workspace-col > * {
  min-width: 0;
}

.workspace-col.report-workspace-mode {
  overflow: hidden;
  align-content: stretch;
}

.workspace-col.report-workspace-mode > :not(#report-page) {
  display: none !important;
}

.workspace-col.report-workspace-mode #report-page {
  display: grid !important;
  height: 100%;
  min-height: 100%;
}

.workspace-col.report-workspace-mode #report-empty,
.workspace-col.report-workspace-mode #report-section,
.workspace-col.report-workspace-mode .report-card {
  min-height: 0;
}

.workspace-col.report-workspace-mode #report-section {
  height: 100%;
}

.workspace-col.report-workspace-mode .report-rendered,
.workspace-col.report-workspace-mode .report-raw {
  max-height: none;
  height: 100%;
}

.report-col {
  display: grid;
  gap: 12px;
  overflow: auto;
  align-content: start;
  animation: panelIn 0.55s ease both;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 10px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

h2,
h3 {
  margin: 0 0 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.max-value-legend {
  display: inline-block;
  margin-left: 10px;
  color: #c1121f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.upload-form {
  display: grid;
  gap: 10px;
}

.input-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.field-label {
  font-size: 13px;
  color: var(--sub);
}

.materials-select-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: -2px;
}

.materials-selected-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid #dce7f6;
  border-radius: 10px;
  background: #f8fbff;
  padding: 8px;
}

.focus-limit-row {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.focus-limit-label {
  margin: 0;
}

.focus-limit-control {
  display: grid;
  grid-template-columns: 110px minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
}

.focus-limit-control input {
  border: 1px solid #d4e0f3;
  border-radius: 10px;
  background: #f8fbff;
  color: #23425d;
  padding: 8px 10px;
  font-family: inherit;
}

.focus-limit-control input:focus {
  outline: 2px solid rgba(29, 78, 216, 0.2);
  border-color: rgba(29, 78, 216, 0.45);
}

.materials-preview-card {
  position: relative;
  border: 1px solid #cfddf2;
  border-radius: 12px;
  padding: 6px;
  background: #edf4ff;
  min-width: 0;
}

.materials-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #f0a7a7;
  background: linear-gradient(180deg, #ff5a5a 0%, #df2d2d 100%);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  display: inline-grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(192, 36, 36, 0.3);
}

.materials-remove-btn:hover {
  filter: brightness(1.04);
}

.materials-preview-media {
  width: 100%;
  height: 88px;
  border-radius: 10px;
  border: 1px solid #cadefb;
  background: #fff;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.materials-preview-media img,
.materials-preview-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.materials-preview-fallback {
  font-size: 12px;
  color: #3f5f88;
}

.materials-preview-info {
  display: grid;
  gap: 2px;
  margin-top: 6px;
}

.materials-preview-name {
  font-size: 12px;
  color: #1f3d61;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.materials-preview-meta {
  font-size: 11px;
  color: #4a6892;
}


input[type='file'],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fdfefe;
  color: var(--ink);
  font-family: inherit;
}

input[type='file']::file-selector-button {
  border: 1px solid #ccdcfa;
  border-radius: 8px;
  padding: 7px 12px;
  margin-right: 10px;
  background: #e8f0ff;
  color: #1f4bc1;
  font-weight: 600;
  cursor: pointer;
}

input[type='file']:focus,
textarea:focus {
  outline: 2px solid rgba(29, 78, 216, 0.18);
  border-color: rgba(29, 78, 216, 0.4);
}

button,
.tab-btn,
#report-link {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.18s ease, filter 0.18s ease;
}

button,
.tab-btn {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}

button:hover,
.tab-btn:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

button.ghost-btn {
  background: #f5f8ff;
  border-color: #d4e0f3;
  color: #33507f;
}

.history-drawer .drawer-actions button,
.history-drawer .history-load,
.history-drawer .history-delete {
  border: 1px solid #d3def3;
  background: #eef4ff;
  color: #2f4f83;
  padding: 6px 10px;
  border-radius: 9px;
}

.history-drawer .drawer-actions button.danger,
.history-drawer .history-delete {
  background: #fff1f0;
  border-color: #f2c6c3;
  color: #c0362c;
}

.status-chip {
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid #d8e2f3;
  color: #4d6480;
  background: #f2f7fd;
}

.status-chip.running {
  color: #124f96;
  border-color: #bfd5f6;
  background: #e8f2ff;
}

.status-chip.completed {
  color: #0a8759;
  border-color: #bee8d5;
  background: #ebfbf3;
}

.status-chip.failed {
  color: var(--danger);
  border-color: #f3c8c3;
  background: #fff2f1;
}

.runtime-box {
  margin-top: 12px;
  border: 1px dashed #cfdaeb;
  border-radius: 12px;
  background: #f8fbff;
  padding: 10px;
}

.status {
  margin: 0;
  min-height: 20px;
  color: var(--ok);
  font-size: 14px;
}

.status.is-running {
  color: #125dbe;
}

.progress-wrap {
  margin-top: 8px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #58708a;
}

.stage-tag {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  background: #e9f0ff;
  color: #2346a4;
  border: 1px solid #ccdaff;
  border-radius: 999px;
  padding: 1px 8px;
}

.progress-track {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  background: #e4ecfa;
  overflow: hidden;
  margin: 8px 0 7px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: repeating-linear-gradient(-45deg, #2c60ff, #2c60ff 12px, #4a7dff 12px, #4a7dff 24px);
  transition: width 0.35s ease;
  animation: stripeMove 1.1s linear infinite;
}

@keyframes stripeMove {
  from { background-position: 0 0; }
  to { background-position: 36px 0; }
}

.stage-message {
  margin: 0;
  color: #3e5c81;
  font-size: 13px;
}

.workflow-error-panel {
  margin-top: 9px;
  border: 1px solid #f0c6c1;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff7f6 0%, #fff1f0 100%);
  padding: 8px 10px;
}

.workflow-error-title {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  color: #a63128;
}

.workflow-error-reason {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #8f2a22;
  white-space: pre-wrap;
  word-break: break-word;
}

.workflow-error-log {
  margin: 7px 0 0;
  padding: 8px;
  max-height: 150px;
  overflow: auto;
  border: 1px solid #f2d8d4;
  border-radius: 8px;
  background: #fff;
  color: #5f2a26;
  font-size: 12px;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-wrap {
  margin-top: 9px;
  border-top: 1px solid #e3eaf6;
  padding-top: 8px;
}

.log-title {
  font-size: 12px;
  color: var(--sub);
  margin-bottom: 6px;
}

.stage-logs {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  max-height: 130px;
  overflow: auto;
}

.stage-logs li {
  background: #fff;
  border: 1px solid #e3eaf5;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  color: #445c78;
  animation: fadeIn 0.24s ease both;
}

.meta-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.meta-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fbfdff;
  display: grid;
  gap: 2px;
}

.meta-label,
.meta-note {
  color: var(--sub);
  font-size: 12px;
}

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

.metric-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #fafdff 0%, #f4f9ff 100%);
  animation: liftIn 0.36s ease both;
}

.metric-title {
  color: var(--sub);
  font-size: 12px;
}

.metric-value {
  margin-top: 3px;
  font-size: 19px;
  font-weight: 700;
}

.metric-meta {
  margin-top: 4px;
  font-size: 11px;
  color: #6d83a0;
  line-height: 1.35;
}

.split-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.table-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fbfdff;
  min-width: 0;
}

.table-wrap {
  overflow: auto;
  border-radius: 10px;
  max-width: 100%;
}

.preview-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}

.preview-filter,
.preview-size {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #4f6886;
}

.preview-filter input,
.preview-size select {
  border: 1px solid #d4e0f3;
  border-radius: 10px;
  background: #f8fbff;
  color: #23425d;
  padding: 8px 10px;
  font-family: inherit;
}

.preview-filter input:focus,
.preview-size select:focus {
  outline: 2px solid rgba(29, 78, 216, 0.2);
  border-color: rgba(29, 78, 216, 0.45);
}

.preview-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.dash-table-tools {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

#section-themes > .dash-table-tools--section[data-table-key="themes"] {
  grid-column: 1 / -1;
  margin-bottom: 10px;
}

.dash-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  gap: 8px;
  align-items: end;
}

.dash-filter,
.dash-size {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #4f6886;
}

.dash-filter input,
.dash-size select {
  border: 1px solid #d4e0f3;
  border-radius: 10px;
  background: #f8fbff;
  color: #23425d;
  padding: 8px 10px;
  font-family: inherit;
}

.dash-filter input:focus,
.dash-size select:focus {
  outline: 2px solid rgba(29, 78, 216, 0.2);
  border-color: rgba(29, 78, 216, 0.45);
}

.dash-stat {
  border: 1px solid #d7e2f2;
  background: #f6f9ff;
  color: #47617f;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.dash-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: #4f6886;
  font-size: 12px;
}

.dash-page-numbers {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dash-page-btn {
  min-width: 30px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #d4e0f3;
  background: #f8fbff;
  color: #2d4866;
  font-size: 12px;
  font-weight: 600;
}

.dash-page-btn.active {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  border-color: #1d4ed8;
  color: #fff;
}

.dash-page-ellipsis {
  color: #8aa2bf;
  font-size: 12px;
  padding: 0 2px;
}

.dash-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dash-jump input {
  width: 72px;
  border: 1px solid #d4e0f3;
  border-radius: 8px;
  background: #f8fbff;
  color: #23425d;
  padding: 6px 8px;
  font-family: inherit;
}

.dash-jump input:focus {
  outline: 2px solid rgba(29, 78, 216, 0.2);
  border-color: rgba(29, 78, 216, 0.45);
}

.stat-chip {
  border: 1px solid #d7e2f2;
  background: #f6f9ff;
  color: #47617f;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
}

.ghost-btn {
  background: #f5f8ff;
  border-color: #d4e0f3;
  color: #33507f;
}

.preview-wrap {
  border: 1px solid #dbe6f6;
  background: #ffffff;
  overflow-x: auto;
  overflow-y: auto;
}

.preview-pin {
  position: relative;
}

.preview-pin-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(340px, 70vw);
  background: #ffffff;
  border: 1px solid #d5e1f3;
  border-radius: 12px;
  box-shadow: 0 14px 24px rgba(20, 40, 73, 0.2);
  padding: 10px;
  display: grid;
  gap: 8px;
  z-index: 20;
}

.pin-title {
  margin: 0;
  font-size: 12px;
  color: #597391;
}

.preview-pin-list {
  max-height: 200px;
  overflow: auto;
  display: grid;
  gap: 4px;
  padding-right: 2px;
}

.pin-option {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e2ebf9;
  background: #f8fbff;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  color: #2d4866;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#preview-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #e4ebf5;
  padding: 8px 6px;
  vertical-align: top;
}

th {
  color: #506984;
  font-weight: 700;
}

#packaging-table,
#materials-table {
  width: 100%;
  table-layout: fixed;
}

#packaging-table th,
#materials-table th {
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  text-wrap: nowrap;
  vertical-align: middle;
}

#packaging-table td,
#materials-table td {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

#packaging-table .col-evidence,
#packaging-table td:last-child,
#materials-table .col-evidence,
#materials-table .col-summary {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

#packaging-table th:nth-child(1),
#packaging-table td:nth-child(1) {
  width: 12%;
}

#packaging-table th:nth-child(2),
#packaging-table td:nth-child(2),
#packaging-table th:nth-child(3),
#packaging-table td:nth-child(3),
#packaging-table th:nth-child(4),
#packaging-table td:nth-child(4) {
  width: 7%;
}

#packaging-table th:nth-child(5),
#packaging-table td:nth-child(5) {
  width: auto;
}

#materials-table th:nth-child(1),
#materials-table td:nth-child(1) {
  width: 16%;
}

#materials-table th:nth-child(2),
#materials-table td:nth-child(2) {
  width: 6%;
}

#materials-table th:nth-child(3),
#materials-table td:nth-child(3),
#materials-table th:nth-child(4),
#materials-table td:nth-child(4) {
  width: 8%;
}

#materials-table th:nth-child(5),
#materials-table td:nth-child(5),
#materials-table th:nth-child(6),
#materials-table td:nth-child(6) {
  width: 7%;
}

#materials-table th:nth-child(7),
#materials-table td:nth-child(7) {
  width: 10%;
}

#materials-table th:nth-child(8),
#materials-table td:nth-child(8) {
  width: 12%;
}

#materials-table th:nth-child(9),
#materials-table td:nth-child(9) {
  width: auto;
}

#materials-table .col-type,
#materials-table .col-level,
#materials-table .col-mode {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

#packaging-table td:nth-child(2),
#packaging-table td:nth-child(3),
#packaging-table td:nth-child(4) {
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
}

#packaging-table td:nth-child(2) .packaging-metric-wrap,
#packaging-table td:nth-child(3) .packaging-metric-wrap,
#packaging-table td:nth-child(4) .packaging-metric-wrap {
  display: inline-block;
  max-width: 5ch;
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

#materials-table .col-score {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

#packaging-table .trend-evidence,
#materials-table .summary-text {
  max-width: min(72ch, 100%);
}

.th-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.th-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #c7d8f3;
  background: #eef5ff;
  color: #2d5ea8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}

.th-help::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, 70vw);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d7e4f8;
  background: #f8fbff;
  color: #23425d;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  white-space: normal;
  box-shadow: 0 8px 20px rgba(27, 57, 102, 0.15);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 20;
}

.th-help:hover::after,
.th-help:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

#preview-table th {
  position: sticky;
  top: 0;
  background: #f3f7ff;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

#preview-table td {
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#preview-table tbody tr:nth-child(even) {
  background: #f9fbff;
}

#preview-table tbody tr:hover {
  background: #eef4ff;
}

#preview-table .index-col {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 52px;
  width: 52px;
  text-align: center;
  background: #f6f9ff;
  color: #4d6480;
  font-weight: 700;
}

#preview-table tbody .index-col {
  background: #fafdff;
}

#preview-table tbody tr:nth-child(even) .index-col {
  background: #f2f7ff;
}

#preview-table .pinned-col {
  position: sticky;
  z-index: 2;
  background: #fbfdff;
}

#preview-table th.pinned-col {
  z-index: 4;
  background: #eef4ff;
}

#preview-table td.pinned-col {
  z-index: 3;
}

td.cell-max-highlight {
  color: #c1121f;
  font-weight: 700;
}

#preview-table tbody tr:hover td.cell-max-highlight {
  color: #a10e19;
}

.preview-head-cell {
  position: sticky;
  top: 0;
  padding-right: 18px;
}

.preview-head-cell .head-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sortable-col {
  cursor: pointer;
  user-select: none;
}

.sortable-col .head-label::after {
  content: '  ↕';
  color: #95aaca;
  font-size: 11px;
}

.sortable-col.is-sorted.sort-asc .head-label::after {
  content: '  ↑';
  color: #2b57be;
  font-weight: 700;
}

.sortable-col.is-sorted.sort-desc .head-label::after {
  content: '  ↓';
  color: #2b57be;
  font-weight: 700;
}

.col-resize-handle {
  position: absolute;
  top: 0;
  right: -8px;
  width: 16px;
  height: 100%;
  cursor: col-resize;
  z-index: 12;
  touch-action: none;
}

.col-resize-handle::before {
  content: '';
  position: absolute;
  right: 7px;
  top: 22%;
  height: 56%;
  width: 2px;
  border-radius: 999px;
  background: rgba(73, 106, 155, 0.34);
  transition: background 0.15s ease;
}

#preview-table th:hover .col-resize-handle::before {
  background: rgba(34, 81, 163, 0.62);
}

body.preview-resizing {
  user-select: none;
  cursor: col-resize;
}

.preview-pager {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#preview-page-info {
  color: #3f5d80;
  font-size: 13px;
  min-width: 90px;
  text-align: center;
}

.preview-page-numbers {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-num-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border-radius: 10px;
  border: 1px solid #d2ddf0;
  background: #f5f8ff;
  color: #35527f;
}

.page-num-btn.active {
  border-color: #2a58c7;
  background: linear-gradient(180deg, #3567e6 0%, #234db9 100%);
  color: #ffffff;
}

.page-ellipsis {
  color: #6f88a8;
  font-size: 13px;
  padding: 0 2px;
}

.preview-jump {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #4f6886;
  font-size: 12px;
}

.preview-jump input {
  width: 74px;
  border: 1px solid #d4e0f3;
  border-radius: 9px;
  background: #f8fbff;
  color: #23425d;
  padding: 7px 8px;
  font-family: inherit;
}

.preview-jump input:focus {
  outline: 2px solid rgba(29, 78, 216, 0.2);
  border-color: rgba(29, 78, 216, 0.45);
}

.preview-col-menu {
  position: fixed;
  z-index: 88;
  min-width: 180px;
  border: 1px solid #cadbf2;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 16px 28px rgba(19, 40, 74, 0.22);
  padding: 6px;
  display: grid;
  gap: 4px;
}

.preview-col-menu button {
  text-align: left;
  border: 1px solid transparent;
  background: #f4f8ff;
  color: #27476f;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
}

.preview-col-menu button:hover {
  background: #e8f1ff;
  border-color: #d0def4;
}

.weights-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.weights-actions button.is-disabled,
.weights-actions button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.weights-head-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 27, 55, 0.42);
  backdrop-filter: blur(2px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.floating-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% + 8px)) scale(0.985);
  width: min(1040px, calc(100vw - 40px));
  max-height: calc(100vh - 72px);
  overflow: auto;
  z-index: 1001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 26px 44px rgba(14, 30, 68, 0.28);
}

.floating-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

#weights-table input[type='number'] {
  width: 104px;
  border: 1px solid #d4e0f3;
  border-radius: 8px;
  background: #f8fbff;
  color: #23425d;
  padding: 5px 7px;
  font-family: inherit;
}

#weights-table input[type='number']:focus {
  outline: 2px solid rgba(29, 78, 216, 0.18);
  border-color: rgba(29, 78, 216, 0.4);
}

.weight-delta.up {
  color: #0f7b52;
  font-weight: 700;
}

.weight-delta.down {
  color: #b6432f;
  font-weight: 700;
}

.weight-delta.flat {
  color: #5d7591;
  font-weight: 700;
}

.theme-bars {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  gap: 4px;
  animation: fadeIn 0.3s ease both;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  color: #506984;
  font-size: 12px;
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: #e3ebfa;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2556ee, #5f86ff);
  transition: width 0.45s ease;
}

.report-card {
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.report-page {
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
}

.report-page-head {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.empty-copy {
  margin: 0;
  color: #58708a;
  line-height: 1.6;
  max-width: 42ch;
}

#report-empty {
  min-height: 180px;
  align-content: start;
}

#report-section {
  min-height: 420px;
}

#report-section.report-card {
  grid-template-rows: 1fr;
}

.report-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn {
  background: #e5edff;
  color: #36517a;
}

.tab-btn.active {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}

#report-link {
  text-decoration: none;
  background: var(--primary-soft);
  color: #1d4ed8;
  border-color: #d2deff;
}

.report-rendered,
.report-raw {
  margin: 0;
  overflow: auto;
  padding: 14px 8px;
  max-height: 66vh;
}

.report-rendered h1,
.report-rendered h2,
.report-rendered h3 {
  color: #17365f;
  margin-top: 0.2em;
  margin-bottom: 0.65em;
}

.report-rendered p,
.report-rendered li {
  color: #26425f;
  line-height: 1.68;
}

.report-rendered table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 12px 0;
  border: 1px solid #d8e5f6;
  border-radius: 12px;
  overflow: hidden;
}

.report-rendered thead th {
  background: linear-gradient(180deg, #eff5ff 0%, #e8f0ff 100%);
  color: #2a4568;
  font-size: 12px;
  white-space: nowrap;
}

.report-rendered tbody td {
  background: #ffffff;
}

.report-rendered tbody tr:nth-child(even) td {
  background: #f8fbff;
}

.report-rendered blockquote {
  margin: 10px 0;
  border-left: 4px solid #2b6bff;
  background: #f3f8ff;
  color: #1f3f66;
  border-radius: 8px;
  padding: 8px 12px;
}

.report-rendered .report-callout {
  border: 1px solid #d8e5f6;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0;
  line-height: 1.65;
}

.report-rendered .report-callout-good {
  background: linear-gradient(180deg, #eefbf5 0%, #e6f8ef 100%);
  border-color: #bfe8d2;
  color: #0f5e41;
}

.report-rendered .report-callout-info {
  background: linear-gradient(180deg, #eef5ff 0%, #e7f0ff 100%);
  border-color: #c5d8fb;
  color: #194c97;
}

.report-rendered .report-callout-warn {
  background: linear-gradient(180deg, #fff7ee 0%, #ffefdf 100%);
  border-color: #f4d2a8;
  color: #8e4f0e;
}

.report-raw {
  white-space: pre-wrap;
  font-family: 'Cascadia Code', Consolas, monospace;
  background: #f9fbff;
  border: 1px solid #dce5f3;
  border-radius: 10px;
  font-size: 12px;
}

.app-toast {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 120;
  max-width: min(460px, calc(100vw - 36px));
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 14px 26px rgba(20, 43, 86, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.app-toast.is-success {
  color: #0f5e41;
  background: linear-gradient(180deg, #f1fcf7 0%, #e6f7ef 100%);
  border-color: #bee8d2;
}

.app-toast.is-warn {
  color: #8a4f14;
  background: linear-gradient(180deg, #fff8ef 0%, #fff0df 100%);
  border-color: #f2d2ac;
}

.app-toast.is-error {
  color: #9b2e27;
  background: linear-gradient(180deg, #fff4f3 0%, #ffe9e7 100%);
  border-color: #f0c4c1;
}

.chat-toggle {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 40;
  min-width: 110px;
  background: linear-gradient(140deg, #2b6bff 0%, #1d4ed8 45%, #123fb8 100%);
  color: #fff;
  border: 1px solid rgba(167, 196, 255, 0.75);
  border-radius: 14px;
  padding: 11px 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 16px 30px rgba(18, 72, 188, 0.36);
  overflow: hidden;
  isolation: isolate;
  animation: glowPulse 2.8s ease-in-out infinite;
}

.chat-toggle::after {
  content: '●';
  margin-left: 8px;
  font-size: 12px;
  color: #c6dbff;
  vertical-align: 1px;
}

.chat-panel {
  position: fixed;
  right: 18px;
  bottom: 70px;
  width: min(470px, 92vw);
  max-height: 74vh;
  border: 1px solid #d6e1ef;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 36px rgba(20, 40, 73, 0.24);
  z-index: 50;
  display: grid;
  grid-template-rows: auto 1fr auto;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #e3eaf4;
}

.chat-head h3 {
  margin: 0;
}

.chat-close {
  background: #eff4ff;
  color: #33507f;
}

.chat-messages {
  overflow: auto;
  padding: 12px;
  display: grid;
  gap: 8px;
  align-content: start;
  overscroll-behavior: contain;
}

.msg {
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: break-word;
  animation: fadeIn 0.2s ease both;
}

.msg.user {
  background: #edf4ff;
  border: 1px solid #d5e5ff;
}

.msg.assistant {
  background: #f8fbff;
  border: 1px solid #e1eaf7;
}

.msg p,
.msg ul,
.msg ol,
.msg blockquote {
  margin: 0;
}

.msg p + p,
.msg p + ul,
.msg p + ol,
.msg ul + p,
.msg ol + p {
  margin-top: 7px;
}

.msg.assistant.streaming::after {
  content: '▌';
  margin-left: 2px;
  color: #2b6bff;
  font-weight: 700;
  animation: chatCaretBlink 0.9s steps(1, end) infinite;
}

.msg.assistant code {
  font-family: 'Cascadia Code', Consolas, monospace;
  background: #edf3ff;
  border: 1px solid #d8e4f8;
  border-radius: 6px;
  padding: 1px 5px;
}

.msg.assistant pre {
  overflow: auto;
  background: #f2f7ff;
  border: 1px solid #dce6f5;
  border-radius: 8px;
  padding: 8px;
}

.chat-form {
  border-top: 1px solid #e3eaf4;
  padding: 10px 10px 9px;
  display: grid;
  gap: 6px;
}

.chat-upload-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chat-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid #cfe0fb;
  background: #eef4ff;
  color: #284771;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

#chat-files-input {
  display: none;
}

.chat-files-list {
  max-height: 84px;
  overflow: auto;
  border: 1px solid #dbe7f7;
  border-radius: 10px;
  background: #f8fbff;
  padding: 6px;
  display: grid;
  gap: 5px;
}

.chat-stream-status {
  margin: 0;
  font-size: 12px;
  color: #44638d;
  border: 1px dashed #d1e0f5;
  background: #f4f8ff;
  border-radius: 8px;
  padding: 5px 8px;
}

.chat-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid #d8e5f8;
  background: #ffffff;
  padding: 4px 7px;
  font-size: 12px;
  color: #35527f;
}

.chat-file-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex: 1;
}

.chat-file-remove {
  min-width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid #efc9c6;
  background: #fff3f2;
  color: #b42318;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}

.chat-input-tip {
  margin: 0;
  font-size: 11px;
  color: #6280a7;
}

#chat-input {
  min-height: 78px;
  max-height: 160px;
  resize: vertical;
}

.chat-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.chat-files-meta {
  font-size: 11px;
  color: #5f7ea6;
}

.chat-mode-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.chat-mode-group label {
  font-size: 11px;
  color: #5b789e;
}

.chat-mode-group select {
  height: 30px;
  border-radius: 9px;
  border: 1px solid #cfdbef;
  background: #f8fbff;
  color: #2d4f7c;
  font-size: 12px;
  padding: 0 8px;
}

.chat-send-btn {
  min-width: 110px;
  height: 36px;
  border-radius: 10px;
  padding: 0 16px;
  flex-shrink: 0;
}

#chat-files-clear {
  height: 30px;
  padding: 0 11px;
  border-radius: 9px;
}

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

@keyframes chatCaretBlink {
  0% { opacity: 1; }
  50% { opacity: 0; }
  100% { opacity: 1; }
}

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

@keyframes liftIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes floatPulse {
  0% { box-shadow: 0 14px 28px rgba(24, 71, 168, 0.26); }
  50% { box-shadow: 0 18px 34px rgba(24, 71, 168, 0.38); }
  100% { box-shadow: 0 14px 28px rgba(24, 71, 168, 0.26); }
}

@keyframes glowPulse {
  0% { box-shadow: 0 14px 28px rgba(24, 71, 168, 0.26); }
  50% { box-shadow: 0 18px 34px rgba(24, 71, 168, 0.38); }
  100% { box-shadow: 0 14px 28px rgba(24, 71, 168, 0.26); }
}

@keyframes sheenMove {
  0% { transform: translateX(-130%); }
  60% { transform: translateX(130%); }
  100% { transform: translateX(130%); }
}

.history-toggle:hover,
.history-toggle:active,
.history-toggle:focus-visible,
.chat-toggle:hover,
.chat-toggle:active,
.chat-toggle:focus-visible {
  transform: none !important;
}

@media (max-width: 1320px) {
  body { overflow: auto; }

  .app-shell {
    height: auto;
    grid-template-columns: 204px 1fr;
  }

  .history-drawer { width: min(650px, 66vw); }

  .report-col { grid-column: 1 / -1; }

  .report-card { min-height: 48vh; }
  #report-empty { min-height: 180px; }

  .report-rendered,
  .report-raw { max-height: 50vh; }
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: 100%;
    margin: 0;
    padding: 8px;
  }

  .side-nav,
  .workspace-col,
  .report-col {
    overflow: visible;
  }

  .history-toggle {
    top: 10px;
    right: 10px;
    z-index: 75;
  }

  .history-drawer {
    top: 52px;
    right: 10px;
    width: min(96vw, 680px);
    max-height: 64vh;
  }

  .menu-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-row { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .menu-list,
  .metric-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }
  .report-actions { flex-wrap: wrap; }

  .chat-toggle {
    right: 10px;
    bottom: 10px;
  }

  .chat-panel {
    right: 10px;
    bottom: 62px;
    width: calc(100vw - 20px);
  }

  .chat-upload-row {
    flex: 1 1 230px;
  }

  .chat-mode-group {
    margin-left: 0;
  }

  .chat-send-btn {
    margin-left: auto;
  }

  .history-search {
    grid-template-columns: 1fr;
  }

  .history-pager {
    justify-content: center;
    flex-wrap: wrap;
  }

  .preview-toolbar {
    grid-template-columns: 1fr;
  }

  .dash-toolbar {
    grid-template-columns: 1fr;
  }

  .preview-jump {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .dash-jump {
    width: 100%;
    justify-content: flex-start;
  }

  .preview-pin-panel {
    right: auto;
    left: 0;
    width: min(92vw, 340px);
  }
}

