:root {
  color-scheme: light;
  --bg: #faf9f5;
  --panel: #ffffff;
  --panel-wash: #f3f1ea;
  --ink: #2c2925;
  --muted: #6a655e;
  --caption: #8d8881;
  --line: #e7e4e0;
  --line-strong: #d8d4cd;
  --accent: #1f9d55;
  --accent-strong: #177a42;
  --accent-soft: #eaf6ef;
  --accent-border: #bfe3cd;
  --assistant: #eaf6ef;
  --dark: #1c2a22;
  --ok: #1f9d55;
  --warn: #b07d2e;
  --bad: #c0563f;
  --soft: #f3f1ea;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 24px 40px -24px rgba(31, 157, 85, 0.4);
  --run-count-width: 76px;
  --run-progress-count-width: 156px;
  font-family:
    Pretendard, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans KR", "Malgun Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  overflow: hidden;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 157, 85, 0.14);
  outline: none;
}

a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(28, 42, 34, 0.96), rgba(23, 122, 66, 0.9)),
    var(--dark);
}

.login-card {
  width: min(430px, 100%);
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.25);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-brand img {
  width: 86px;
  height: 86px;
  object-fit: contain;
}

.login-brand .eyebrow {
  margin-bottom: 4px;
}

.login-brand h1 {
  color: var(--ink);
  font-size: 30px;
}

.login-description {
  margin: 24px 0 20px;
  color: var(--muted);
  font-size: 15px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form input {
  min-height: 48px;
  font-size: 16px;
}

.login-button {
  min-height: 50px;
  margin-top: 4px;
  background: var(--accent);
  color: #ffffff;
  font-size: 16px;
}

.login-button:hover {
  background: var(--accent-strong);
}

.login-error {
  padding: 10px 12px;
  border: 1px solid rgba(192, 86, 63, 0.25);
  border-radius: 10px;
  background: rgba(192, 86, 63, 0.08);
  color: var(--bad);
  font-size: 14px;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: start;
  gap: 10px;
  height: 100vh;
  padding: 16px 22px;
  border-right: 0;
  background: linear-gradient(180deg, var(--dark) 0%, #203c2b 48%, var(--accent-strong) 100%);
  overflow-y: auto;
}

.brand {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 6px 0 10px;
}

.brand-mark {
  width: 76px;
  height: 76px;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.18));
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  color: #ffffff;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-subtitle {
  display: inline-flex;
  width: fit-content;
  margin: 8px 0 0;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(234, 246, 239, 0.32);
  background: rgba(234, 246, 239, 0.16);
  color: #eaf6ef;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.sidebar-status,
.sidebar-section {
  display: grid;
  gap: 10px;
}

.sidebar-status {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.sidebar-metrics {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.sidebar-metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid rgba(234, 246, 239, 0.16);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.sidebar-metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.sidebar-metric strong {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.sidebar-metric #refreshedAt {
  font-size: 17px;
  white-space: nowrap;
}

.sidebar-breakdown {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(234, 246, 239, 0.2);
  border-radius: 16px;
  background: rgba(250, 249, 245, 0.95);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.1);
}

.sidebar-breakdown h2 {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-breakdown .eyebrow {
  margin-bottom: 2px;
  font-size: 11px;
}

.sidebar-breakdown .category-list {
  grid-template-columns: 1fr;
  gap: 3px;
}

.sidebar-section {
  min-height: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.section-heading {
  display: grid;
  gap: 0;
}

.section-heading h2,
.panel-header h2 {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
}

.sidebar-section label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inline-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.inline-controls:has(button + button) {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.primary-side-button,
.secondary-button {
  min-height: 40px;
  padding: 0 15px;
}

.primary-side-button {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 12px 24px -16px rgba(31, 157, 85, 0.8);
}

.primary-side-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  width: fit-content;
  max-width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.ok {
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-pill.bad {
  border: 1px solid #edc7bd;
  background: #fff4ef;
  color: var(--bad);
}

.sidebar-note,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.workspace-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.workspace-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 62px;
  padding: 12px 24px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 249, 245, 0.96);
  overflow-x: auto;
}

.workspace-tab {
  min-width: 92px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.workspace-tab:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.workspace-tab.active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.03);
}

.workspace-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
  padding: 0 0 10px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.auth-role-badge {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
}

.logout-button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.logout-button:hover {
  border-color: var(--accent-border);
  color: var(--accent-strong);
}

.workspace-scroll {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 24px 28px;
}

.workspace-view {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.workspace-view[hidden] {
  display: none;
}

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

.control-panel {
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 220px));
  gap: 12px;
  align-items: end;
}

.form-grid > .control-group {
  min-width: 0;
}

.form-grid.compact-grid {
  grid-template-columns: repeat(2, minmax(160px, 220px));
}

.form-grid.ai-form-grid {
  grid-template-columns: minmax(150px, 180px) minmax(150px, 180px) minmax(170px, 220px) minmax(360px, 1fr);
}

.form-grid.automation-grid {
  grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) minmax(170px, 1fr) minmax(360px, 1.6fr);
}

.form-grid .model-control {
  min-width: 320px;
}

.form-grid.ai-form-grid > .keyword-run-control {
  grid-column: 1 / -1;
  min-width: 0;
}

.form-grid.compact-grid > .control-group {
  grid-column: auto;
}

.control-group {
  display: grid;
  gap: 6px;
}

.control-group label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.control-group.wide {
  min-width: 0;
}

.unit-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #ffffff;
  overflow: hidden;
}

.unit-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 157, 85, 0.14);
}

.unit-input input {
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.unit-input input:focus {
  border: 0;
  box-shadow: none;
}

.unit-input span {
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.automation-status-panel {
  display: grid;
  gap: 14px;
}

.automation-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 16px;
  align-items: center;
}

.automation-hero h2 {
  font-size: 24px;
}

.automation-hero p:last-child {
  margin-top: 4px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.pipeline-countdown {
  display: grid;
  gap: 4px;
  justify-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--accent-soft);
  box-shadow: var(--shadow);
}

.pipeline-countdown span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pipeline-countdown strong {
  color: var(--accent-strong);
  font-size: 26px;
  line-height: 1.1;
  white-space: nowrap;
}

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

.pipeline-step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  min-height: 88px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.pipeline-step span {
  grid-row: span 3;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 900;
}

.pipeline-step strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-step em {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-range-cluster {
  display: grid;
  grid-column: span 2;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.search-bar .date-range-cluster {
  grid-column: auto;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.date-range-cluster > .control-group {
  min-width: 0;
}

.date-preset-button {
  align-self: end;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.date-preset-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.search-bar .date-preset-button {
  margin-top: 0;
  min-height: 38px;
  padding: 0 10px;
}

.pipeline-step small {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-step.active {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px rgba(31, 157, 85, 0.12), var(--shadow);
}

.pipeline-step.active span,
.pipeline-step.done span {
  background: var(--accent);
  color: #ffffff;
}

.pipeline-step.failed {
  border-color: #edc7bd;
}

.pipeline-step.failed span {
  background: var(--bad);
  color: #ffffff;
}

.automation-run-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.settings-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--line);
}

.settings-block h3 {
  margin: 4px 0 4px;
  font-size: 22px;
  letter-spacing: 0;
}

.settings-model-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.settings-model-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 10px 14px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.settings-model-item strong {
  font-size: 15px;
  color: var(--ink);
}

.settings-model-status {
  justify-self: end;
  min-width: 86px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef2f0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.settings-model-status.available {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.settings-model-status.subscription_required {
  background: #fff4d8;
  color: #8a5a00;
}

.settings-model-status.error {
  background: #fde8e8;
  color: #a01818;
}

.settings-model-error {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.settings-empty {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-soft);
}

.automation-run-item {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.automation-run-item > strong {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
}

.automation-run-item.success > strong {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.automation-run-item.running > strong {
  background: #fff7e8;
  color: var(--warn);
}

.automation-run-item.failed > strong,
.automation-run-item.cancelled > strong {
  background: #fff4ef;
  color: var(--bad);
}

.automation-run-item h3 {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-run-item p {
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-run-item .automation-run-error {
  color: var(--bad);
}

#aiView .panel-actions button {
  inline-size: 150px;
  min-height: 40px;
  justify-content: center;
  padding: 0 12px;
  white-space: nowrap;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 14px;
  min-height: 96px;
  padding: 15px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  overflow-wrap: anywhere;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

.panel {
  padding: 18px;
}

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

.group-run-control {
  display: grid;
  gap: 5px;
  min-width: min(520px, 48vw);
}

.group-run-control label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.run-list,
.category-list {
  display: grid;
  gap: 8px;
}

.ai-runs-panel .panel-header {
  align-items: center;
}

#toggleAiRunsButton {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}

.ai-run-history {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.run-item,
.category-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.run-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) var(--run-count-width);
  gap: 12px;
  align-items: center;
  padding: 11px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.025);
}

.run-item > .muted:last-child {
  width: var(--run-count-width);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.run-status {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  text-align: center;
  color: var(--muted);
}

.run-status.success {
  color: var(--ok);
}

.run-status.failed {
  color: var(--bad);
}

.run-status.running {
  color: var(--warn);
}

.run-status.cancelled {
  color: #9b1c1c;
}

.run-status.partial,
.run-status.skipped {
  color: var(--muted);
}

.run-progress {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.run-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.run-progress-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-progress-meta strong {
  flex: 0 0 var(--run-progress-count-width);
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.run-progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--accent-soft);
}

.run-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.search-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

#searchQ {
  grid-column: span 2;
}

.search-bar button {
  min-height: 38px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 12px 24px -18px rgba(31, 157, 85, 0.9);
}

.search-bar button:hover {
  background: var(--accent-strong);
}

.search-bar .reset-search-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.search-bar .reset-search-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.search-bar .date-range-cluster {
  grid-column: span 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.search-bar .date-preset-button {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  box-shadow: none;
}

.search-bar .date-preset-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.danger-button {
  border: 1px solid #edc7bd;
  background: #fff4ef;
  color: var(--bad);
}

.danger-button:hover:not(:disabled) {
  border-color: #dc9b8a;
  background: #ffece4;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.archive-table {
  table-layout: fixed;
}

.archive-time-column {
  width: 170px;
}

.archive-category-column {
  width: 120px;
}

.archive-source-column {
  width: 180px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

td.time-cell {
  width: 170px;
  min-width: 170px;
  white-space: nowrap;
  color: var(--muted);
}

td.category-cell {
  width: 120px;
  font-weight: 800;
}

td.source-cell {
  width: 180px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

tr.article-row {
  cursor: pointer;
}

tr.article-row:hover td {
  background: #fcfbf8;
}

tr.article-row.selected td {
  background: var(--accent-soft);
}

.article-list-title,
.article-list-summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

.article-list-title {
  -webkit-line-clamp: 2;
}

.article-list-summary {
  margin-top: 3px;
  -webkit-line-clamp: 2;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.article-detail-row td {
  padding: 0;
  background: #fffdf9;
}

.article-inline-detail {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fffdf9;
}

.article-detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.article-detail-header h3 {
  font-size: 15px;
  line-height: 1.35;
}

.article-detail-header a {
  flex: 0 0 auto;
  white-space: nowrap;
}

.article-detail-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.article-detail-content {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}

.article-detail-content p {
  margin: 0;
}

.ai-group-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.ai-impact-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.ai-impact-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.impact-score {
  display: grid;
  place-items: center;
  min-height: 56px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.impact-score strong {
  font-size: 22px;
  line-height: 1;
}

.impact-score span {
  font-size: 11px;
  font-weight: 800;
}

.impact-score.high {
  background: #e4f4ec;
  color: var(--accent-strong);
}

.impact-score.mid {
  background: #fff7e8;
  color: var(--warn);
}

.impact-score.low {
  background: var(--soft);
  color: var(--muted);
}

.ai-impact-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.ai-impact-main > a {
  overflow: hidden;
  font-size: 16px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-impact-original {
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-impact-main p {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}

.ai-impact-main .ai-impact-reason {
  padding: 9px 11px;
  border: 1px solid #cfe2d8;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: #f2faf6;
  color: #143326;
  font-size: 14px;
  line-height: 1.55;
}

.ai-impact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-grid.signal-form-grid {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
}

.form-grid.signal-form-grid > .signal-run-control {
  grid-column: span 2;
}

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

.signal-count {
  color: var(--accent-strong);
  font-size: 14px;
  white-space: nowrap;
}

.signal-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.signal-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.signal-item.positive {
  border-left: 4px solid var(--accent);
}

.signal-item.negative {
  border-left: 4px solid var(--bad);
}

.signal-score {
  display: grid;
  place-items: center;
  min-height: 56px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.signal-score.high {
  background: #e4f4ec;
  color: var(--accent-strong);
}

.signal-score.mid {
  background: #fff7e8;
  color: var(--warn);
}

.signal-score.low {
  background: var(--soft);
  color: var(--muted);
}

.signal-score strong {
  font-size: 22px;
  line-height: 1;
}

.signal-score span {
  font-size: 11px;
  font-weight: 800;
}

.signal-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.signal-main h3 {
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-original {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-main p {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.signal-main .signal-reason {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.signal-meta,
.signal-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.signal-meta b {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
}

.signal-item.positive .signal-meta b {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.signal-item.negative .signal-meta b {
  background: #fff4ef;
  color: var(--bad);
}

.signal-bottom {
  justify-content: space-between;
}

.signal-bottom span {
  min-width: 0;
}

.signal-bottom a {
  flex: 0 0 auto;
  white-space: nowrap;
}

.report-form-grid {
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(180px, 1fr) minmax(360px, 1.7fr);
}

.ticker-form-grid {
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) minmax(150px, 190px);
}

.ticker-stage {
  display: grid;
  gap: 14px;
  min-height: clamp(650px, 82vh, 900px);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 18px;
  background:
    radial-gradient(circle at 16% 10%, rgba(255, 255, 255, 0.38), transparent 18%),
    radial-gradient(circle at 82% 20%, rgba(0, 136, 68, 0.22), transparent 28%),
    radial-gradient(circle at 64% 86%, rgba(125, 183, 151, 0.2), transparent 30%),
    linear-gradient(145deg, #102018 0%, #264b35 43%, #f3f2ec 43.2%, #ffffff 100%);
  box-shadow: 0 30px 90px -58px rgba(0, 0, 0, 0.54);
  overflow: hidden;
}

#tickerView:fullscreen {
  box-sizing: border-box;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  padding: clamp(12px, 1.4vw, 24px);
  overflow: hidden;
  background: #102018;
}

#tickerView:fullscreen .control-panel {
  display: none;
}

#tickerView:fullscreen .ticker-stage {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  padding: clamp(16px, 1.8vw, 30px);
  border-radius: 22px;
}

#tickerView:fullscreen .ticker-layout {
  grid-template-columns: minmax(0, 2.15fr) minmax(390px, 0.85fr);
  gap: 16px;
  height: 100%;
}

#tickerView:fullscreen .ticker-card,
#tickerView:fullscreen .ticker-queue-panel {
  height: 100%;
  min-height: 0;
}

#tickerView:fullscreen .ticker-card {
  padding: clamp(30px, 3.2vw, 58px);
}

#tickerView:fullscreen .ticker-queue-panel {
  padding: 14px;
}

#tickerView:fullscreen .ticker-queue-list {
  --ticker-queue-step: 64px;
}

#tickerView:fullscreen .ticker-slide h3 {
  max-width: 24ch;
  font-size: clamp(48px, 5.8vw, 104px);
}

#tickerView:fullscreen .ticker-slide p {
  max-width: 60ch;
  font-size: clamp(24px, 2.4vw, 42px);
}

@media (max-width: 900px) {
  #tickerView:fullscreen {
    height: auto;
    overflow: auto;
  }

  #tickerView:fullscreen .ticker-stage,
  #tickerView:fullscreen .ticker-layout {
    height: auto;
  }

  #tickerView:fullscreen .ticker-stage {
    grid-template-rows: auto;
  }

  #tickerView:fullscreen .ticker-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  #tickerView:fullscreen .ticker-card,
  #tickerView:fullscreen .ticker-queue-panel {
    height: auto;
    min-height: min(70vh, 620px);
  }
}

.ticker-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #eaf6ef;
  font-size: 15px;
  font-weight: 800;
}

.ticker-topline span:last-child {
  min-width: 0;
  overflow: hidden;
  color: #08140e;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.72fr);
  gap: 18px;
  min-height: 0;
}

.ticker-card {
  display: grid;
  align-items: center;
  min-height: clamp(540px, 70vh, 780px);
  padding: clamp(28px, 5vw, 64px);
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.46));
  box-shadow:
    0 34px 90px -48px rgba(0, 0, 0, 0.56),
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    inset 0 -1px 0 rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(26px) saturate(1.28);
  -webkit-backdrop-filter: blur(26px) saturate(1.28);
  perspective: 1400px;
}

.ticker-queue-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: clamp(540px, 70vh, 780px);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 18px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.42));
  box-shadow:
    0 30px 76px -50px rgba(0, 0, 0, 0.56),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(22px) saturate(1.22);
  -webkit-backdrop-filter: blur(22px) saturate(1.22);
}

.ticker-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 12px;
  color: #102219;
  font-size: 15px;
  font-weight: 900;
}

.ticker-queue-head span {
  color: var(--accent-strong);
  font-weight: 900;
}

.ticker-queue-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  --ticker-queue-step: 66px;
  will-change: transform;
}

.ticker-queue-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(14px) saturate(1.18);
  -webkit-backdrop-filter: blur(14px) saturate(1.18);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.ticker-queue-list.queue-forward {
  animation: tickerQueueScrollUp 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ticker-queue-list.queue-backward {
  animation: tickerQueueScrollDown 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ticker-queue-list.queue-fast {
  animation-duration: 120ms;
}

.ticker-queue-item.active {
  border-color: rgba(0, 136, 68, 0.62);
  background: rgba(237, 248, 241, 0.72);
  box-shadow:
    inset 4px 0 0 var(--accent),
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 14px 34px -24px rgba(0, 0, 0, 0.44);
  transform: translateX(-2px);
}

.ticker-queue-main {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ticker-queue-title {
  overflow: hidden;
  color: #082116;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker-queue-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker-queue-link {
  align-self: stretch;
  display: grid;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(224, 244, 232, 0.72);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.ticker-queue-link:hover,
.ticker-queue-link:focus-visible {
  border-color: rgba(0, 136, 68, 0.72);
  background: rgba(0, 136, 68, 0.92);
  color: #ffffff;
  box-shadow:
    0 10px 24px -14px rgba(0, 80, 40, 0.68),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
  transform: translateY(-1px);
  outline: none;
}

.ticker-queue-empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-weight: 800;
}

.ticker-slide {
  display: grid;
  gap: 22px;
  transform-origin: bottom center;
  will-change: transform, opacity;
}

.ticker-slide.flip-up {
  animation: tickerFlipUp 700ms cubic-bezier(0.18, 0.84, 0.24, 1) both;
}

.ticker-slide.flip-down {
  animation: tickerFlipDown 700ms cubic-bezier(0.18, 0.84, 0.24, 1) both;
}

.ticker-slide.flip-fast.flip-up,
.ticker-slide.flip-fast.flip-down {
  animation-duration: 95ms;
}

.ticker-slide.flip-out-up {
  animation: tickerFlipOutUp 460ms cubic-bezier(0.62, 0.02, 0.84, 0.28) both;
}

.ticker-slide.flip-out-down {
  animation: tickerFlipOutDown 460ms cubic-bezier(0.62, 0.02, 0.84, 0.28) both;
}

.ticker-slide.flip-fast.flip-out-up,
.ticker-slide.flip-fast.flip-out-down {
  animation-duration: 70ms;
}

.ticker-score {
  width: fit-content;
  min-width: 150px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(224, 244, 232, 0.74);
  color: var(--accent-strong);
  font-size: clamp(18px, 2.2vw, 28px);
  font-weight: 900;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 14px 30px -24px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px) saturate(1.18);
  -webkit-backdrop-filter: blur(12px) saturate(1.18);
}

.ticker-slide h3 {
  max-width: 18ch;
  color: #08140e;
  font-size: clamp(42px, 6.4vw, 92px);
  line-height: 1.04;
  font-weight: 900;
  word-break: keep-all;
}

.ticker-slide p {
  max-width: 48ch;
  color: #1f2923;
  font-size: clamp(22px, 2.6vw, 38px);
  line-height: 1.38;
  font-weight: 700;
  word-break: keep-all;
}

.ticker-summary-text {
  min-height: calc(1.38em * 6);
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 360ms ease, transform 360ms ease;
}

.ticker-summary-text.typing-active,
.ticker-summary-text.typing-done {
  opacity: 1;
  transform: translateY(0);
}

.ticker-summary-text.typing-active::after {
  display: inline-block;
  width: 0.46em;
  margin-left: 5px;
  border-right: 3px solid var(--accent);
  content: "";
  animation: tickerCursor 860ms steps(2, end) infinite;
  transform: translateY(0.12em);
}

.ticker-summary-text.typing-done::after {
  content: none;
}

.ticker-skip-summary {
  min-height: 0;
}

.ticker-empty {
  color: var(--muted);
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 900;
}

@keyframes tickerFlipUp {
  0% {
    opacity: 0;
    transform: translateY(74px) rotateX(-62deg);
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
  }
}

@keyframes tickerFlipOut {
  0% {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-74px) rotateX(62deg);
  }
}

@keyframes tickerFlipDown {
  0% {
    opacity: 0;
    transform: translateY(-74px) rotateX(62deg);
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
  }
}

@keyframes tickerFlipOutUp {
  0% {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-74px) rotateX(62deg);
  }
}

@keyframes tickerFlipOutDown {
  0% {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(74px) rotateX(-62deg);
  }
}

@keyframes tickerQueueScrollDown {
  0% {
    transform: translateY(calc(var(--ticker-queue-step) * -1));
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes tickerCursor {
  0%,
  45% {
    opacity: 1;
  }
  46%,
  100% {
    opacity: 0;
  }
}

@keyframes tickerQueueScrollUp {
  0% {
    transform: translateY(var(--ticker-queue-step));
  }
  100% {
    transform: translateY(0);
  }
}

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

.report-sub-tab {
  min-width: 118px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 900;
}

.report-sub-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.check-combo {
  position: relative;
  min-width: 220px;
}

.check-combo-button {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-align: left;
}

.check-combo-button::after {
  content: "▾";
  float: right;
  color: var(--muted);
}

.check-combo-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  width: min(360px, 90vw);
  max-height: 360px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.check-combo-actions {
  display: flex;
  gap: 6px;
  padding: 4px 4px 8px;
  border-bottom: 1px solid var(--line);
}

.check-combo-actions button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.check-combo-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.check-combo-option input {
  width: 16px;
  height: 16px;
}

.report-pane {
  display: grid;
  gap: 12px;
}

.report-pane:not(.active) {
  display: none;
}

.report-pane.active {
  display: grid;
}

.report-pane[hidden] {
  display: none;
}

.search-report-form-grid {
  grid-template-columns: minmax(280px, 2fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(170px, 1fr) minmax(360px, 1.7fr);
}

.search-report-form-grid .wide {
  min-width: 280px;
}

.impact-report-page {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.report-status-text {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.55;
}

.report-progress {
  display: grid;
  gap: 12px;
}

.report-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.report-progress-meta strong {
  color: var(--accent-strong);
}

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

.report-prompt-stats > div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.report-prompt-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-prompt-stats strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
}

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

.report-page-head h2 {
  margin: 2px 0 4px;
  font-size: 26px;
  line-height: 1.2;
}

.report-page-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.report-page-head > strong {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 26px;
  line-height: 1.2;
  white-space: nowrap;
}

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

.report-stat-grid > div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.report-stat-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-stat-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
}

.report-summary-box {
  padding: 16px 18px;
  border: 1px solid #cfe2d8;
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: #f2faf6;
}

.report-summary-box h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.report-summary-box h2 {
  margin: 0 0 10px;
  font-size: 29px;
  line-height: 1.25;
}

.report-summary-box p {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.95;
}

.report-summary-box p:last-child {
  margin-bottom: 0;
}

.report-summary-box ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.report-summary-box li {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.85;
}

.report-footnote {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.report-article {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.report-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.report-article-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.report-article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-article-meta b {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
}

.report-article-meta b.positive {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.report-article-meta b.negative {
  background: #fff4ef;
  color: var(--bad);
}

.report-article-meta strong {
  color: var(--accent-strong);
}

.report-article h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 21px;
  line-height: 1.35;
}

.report-original {
  overflow: hidden;
  color: var(--muted);
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-article p {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.55;
}

.report-score-comment {
  padding: 8px 10px;
  border: 1px solid #cfe2d8;
  border-left: 4px solid var(--accent);
  border-radius: 9px;
  background: #f7fcf9;
}

.ib-opinion-box {
  padding: 10px 12px;
  border: 1px solid #d8dfe8;
  border-left: 4px solid #2f6f9f;
  border-radius: 10px;
  background: #f5f8fb;
  font-weight: 700;
}

.report-article a {
  justify-self: start;
  font-size: 17px;
  font-weight: 800;
}

.ai-category-section {
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.ai-category-section.focused {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px rgba(31, 157, 85, 0.12), var(--shadow);
}

.ai-category-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.ai-category-head h3 {
  overflow: hidden;
  font-size: 18px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-category-head strong {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
}

.ai-category-groups {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.ai-group-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf9;
}

.ai-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.ai-group-head > div {
  min-width: 0;
}

.ai-group-head h3 {
  overflow: hidden;
  font-size: 16px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-group-head p {
  display: block;
  overflow: visible;
  color: var(--ink);
  white-space: normal;
  overflow-wrap: anywhere;
}

.ai-group-head strong {
  flex: 0 0 auto;
  color: var(--accent-strong);
  white-space: nowrap;
}

.ai-member-list {
  display: grid;
  gap: 4px;
  min-width: 0;
  max-height: 420px;
  overflow: auto;
}

.ai-member-item {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 140px;
  gap: 8px;
  align-items: start;
  min-width: 0;
  overflow: visible;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  font-size: 12px;
  line-height: 1.35;
}

.ai-member-item span,
.ai-member-item em {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-member-item a {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-member-main {
  display: grid;
  gap: 4px;
  min-width: 0;
  overflow: visible;
}

.ai-member-main p {
  display: block;
  overflow: visible;
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
}

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-height: 24px;
  padding: 4px 8px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.category-item:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.category-item:focus-visible {
  outline: 2px solid rgba(31, 157, 85, 0.28);
  outline-offset: 2px;
}

.category-item span {
  min-width: 0;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.category-item strong {
  color: var(--accent-strong);
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--dark);
  color: #ffffff;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

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

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

  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .brand {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
  }

  .brand-mark {
    width: 72px;
    height: 72px;
  }

  h1 {
    font-size: 28px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .workspace-panel {
    position: static;
    height: auto;
    min-height: 0;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .monitor-grid,
  .search-bar,
  .form-grid,
  .form-grid.ai-form-grid,
  .form-grid.signal-form-grid,
  .form-grid.ticker-form-grid,
  .form-grid.automation-grid,
  .form-grid.compact-grid {
    grid-template-columns: 1fr;
  }

  .form-grid.signal-form-grid > .signal-run-control {
    grid-column: auto;
  }

  .form-grid .model-control {
    min-width: 0;
  }

  .ticker-stage {
    min-height: 720px;
    padding: 16px;
  }

  .ticker-topline {
    display: grid;
  }

  .ticker-topline span:last-child {
    text-align: left;
    white-space: normal;
  }

  .ticker-layout {
    grid-template-columns: 1fr;
  }

  .ticker-card {
    min-height: 560px;
    padding: 24px;
  }

  .ticker-queue-panel {
    min-height: 260px;
    max-height: 360px;
  }

  .automation-hero,
  .pipeline-steps,
  .signal-grid,
  .report-stat-grid {
    grid-template-columns: 1fr;
  }

  .pipeline-countdown {
    justify-items: start;
  }

  .run-item {
    grid-template-columns: 1fr;
  }

  .ai-member-item {
    grid-template-columns: 1fr;
  }

  .ai-impact-item {
    grid-template-columns: 1fr;
  }

  .signal-item {
    grid-template-columns: 1fr;
  }

  .report-page-head {
    display: grid;
  }

  .report-prompt-stats {
    grid-template-columns: 1fr;
  }

  .report-article {
    grid-template-columns: 1fr;
  }

  .automation-run-item {
    grid-template-columns: 1fr;
  }

  .settings-block,
  .settings-model-item {
    grid-template-columns: 1fr;
  }

  .settings-block {
    display: grid;
    align-items: start;
  }

  .settings-model-status {
    justify-self: start;
  }

  .impact-score {
    grid-template-columns: auto auto;
    justify-content: start;
    gap: 4px;
    min-height: 38px;
    padding: 0 10px;
  }

  .signal-score {
    grid-template-columns: auto auto;
    justify-content: start;
    gap: 4px;
    min-height: 38px;
    padding: 0 10px;
  }
}

@media (max-width: 640px) {
  .login-screen {
    padding: 14px;
  }

  .login-card {
    padding: 26px 22px;
  }

  .login-brand img {
    width: 72px;
    height: 72px;
  }

  .login-brand h1 {
    font-size: 25px;
  }

  .workspace-auth {
    margin-left: 8px;
    padding-left: 8px;
  }

  .workspace-auth #authUserName,
  .auth-role-badge {
    display: none;
  }

  :root {
    --run-count-width: auto;
    --run-progress-count-width: 112px;
  }

  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  input,
  select,
  button {
    min-width: 0;
  }

  .sidebar {
    gap: 8px;
    padding: 12px;
  }

  .brand {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
    padding: 0 0 4px;
  }

  .brand-mark {
    width: 56px;
    height: 56px;
  }

  h1 {
    font-size: 23px;
  }

  .brand-subtitle {
    margin-top: 5px;
    padding: 3px 7px;
    font-size: 10px;
  }

  .sidebar-status {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .sidebar-metrics {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-metric {
    min-height: 34px;
    padding: 6px 8px;
  }

  .sidebar-metric strong,
  .sidebar-metric #refreshedAt {
    font-size: 14px;
  }

  .sidebar-breakdown {
    gap: 5px;
    padding: 9px;
    border-radius: 13px;
  }

  .sidebar-breakdown .category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-item {
    gap: 4px;
    min-height: 26px;
    padding: 4px 6px;
  }

  .category-item span,
  .category-item strong {
    font-size: 10px;
  }

  .workspace-panel,
  .workspace-scroll,
  .workspace-view,
  .workspace-view > *,
  .panel,
  .control-panel {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .workspace-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    min-height: 0;
    padding: 8px 12px;
    overflow: visible;
  }

  .workspace-tab {
    min-width: 0;
    min-height: 38px;
    padding: 0 4px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .workspace-tab.active {
    border-color: var(--line);
    box-shadow: var(--shadow);
  }

  .workspace-scroll {
    gap: 12px;
    padding: 14px 12px 24px;
    overflow-x: hidden;
  }

  .workspace-view {
    gap: 12px;
  }

  .panel {
    padding: 14px;
    border-radius: 14px;
  }

  .panel-header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .panel-header h2,
  .section-heading h2 {
    font-size: 18px;
  }

  .form-grid,
  .search-bar,
  .form-grid.ai-form-grid,
  .form-grid.signal-form-grid,
  .form-grid.ticker-form-grid,
  .form-grid.automation-grid,
  .form-grid.compact-grid,
  .report-form-grid,
  .search-report-form-grid {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid > *,
  .search-bar > *,
  .search-report-form-grid .wide,
  .form-grid .model-control {
    min-width: 0;
    max-width: 100%;
  }

  #searchQ,
  .search-bar .date-range-cluster,
  .date-range-cluster {
    grid-column: auto;
  }

  .date-range-cluster,
  .search-bar .date-range-cluster {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .date-range-cluster input {
    min-width: 0;
    padding: 0 7px;
    font-size: 13px;
  }

  .date-range-cluster .date-preset-button,
  .search-bar .date-range-cluster .date-preset-button {
    grid-column: 1 / -1;
    justify-self: start;
    min-height: 30px;
    margin: 0;
  }

  .panel-actions {
    gap: 8px;
    margin-top: 12px;
  }

  .panel-actions button,
  #aiView .panel-actions button {
    inline-size: auto;
    max-width: 100%;
    min-height: 38px;
    padding: 0 12px;
  }

  .muted,
  .run-item,
  .automation-run-item,
  .report-article,
  .ai-impact-item,
  .signal-item {
    overflow-wrap: anywhere;
  }

  .run-item {
    gap: 7px;
    padding: 10px;
  }

  .run-status {
    justify-content: flex-start;
  }

  .run-item > .muted:last-child {
    width: auto;
    text-align: left;
  }

  .run-progress-meta {
    align-items: start;
    gap: 8px;
  }

  .run-progress-meta span {
    white-space: normal;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .table-wrap table,
  .table-wrap tbody {
    display: block;
    width: 100%;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tr.article-row {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 4px 8px;
    width: 100%;
    margin-bottom: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: var(--shadow);
  }

  .table-wrap tr.article-row td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .table-wrap td.time-cell,
  .table-wrap td.category-cell,
  .table-wrap td.source-cell {
    width: auto;
    min-width: 0;
    font-size: 11px;
  }

  .table-wrap tr.article-row td:last-child {
    grid-column: 1 / -1;
    padding-top: 4px;
  }

  .table-wrap tr.article-detail-row {
    display: block;
    width: 100%;
    margin: -4px 0 8px;
  }

  .table-wrap tr.article-detail-row > td {
    display: block;
    width: 100%;
  }

  .article-inline-detail {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .article-detail-header {
    display: grid;
  }

  .article-detail-header a {
    justify-self: start;
  }

  .ai-impact-main > a,
  .ai-impact-original,
  .signal-main h3,
  .signal-original {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .report-sub-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 5px;
  }

  .report-sub-tab {
    min-width: 0;
    padding: 9px 5px;
    font-size: 12px;
  }

  .check-combo {
    min-width: 0;
    max-width: 100%;
  }

  .check-combo-menu {
    width: min(320px, calc(100vw - 48px));
  }

  .impact-report-page {
    min-width: 0;
    padding: 14px;
  }

  .report-summary-box {
    padding: 14px;
  }

  .report-summary-box h2 {
    font-size: 22px;
  }

  .report-summary-box p,
  .report-summary-box li,
  .report-article p {
    font-size: 15px;
    line-height: 1.7;
  }

  .report-article h3 {
    font-size: 18px;
  }

  .report-original {
    font-size: 14px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .automation-hero,
  .pipeline-steps,
  .automation-status-panel,
  .automation-run-list {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .automation-run-list {
    overflow-x: hidden;
  }

  .automation-run-item,
  .automation-run-item > div,
  .automation-run-item h3,
  .automation-run-item p {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .pipeline-countdown strong {
    max-width: 100%;
    font-size: 21px;
    white-space: normal;
  }

  .ticker-stage {
    min-height: 0;
    gap: 10px;
    padding: 12px;
  }

  .ticker-card {
    min-height: 500px;
    padding: 18px;
  }

  .ticker-slide {
    gap: 16px;
  }

  .ticker-slide h3 {
    max-width: none;
    font-size: clamp(30px, 9vw, 42px);
    line-height: 1.12;
  }

  .ticker-slide p {
    max-width: none;
    font-size: 18px;
    line-height: 1.5;
  }

  .ticker-score {
    min-width: 0;
    max-width: 100%;
    font-size: 16px;
  }

  .ticker-queue-panel {
    min-height: 250px;
    max-height: 340px;
    padding: 12px;
  }
}

@media print {
  body {
    overflow: visible;
    background: #ffffff;
  }

  .sidebar,
  .workspace-tabs,
  .control-panel,
  #toast {
    display: none !important;
  }

  .app-shell,
  .workspace-panel,
  .workspace-scroll,
  .workspace-view.active {
    display: block;
    height: auto;
    min-height: 0;
    padding: 0;
    overflow: visible;
  }

  .workspace-view:not(.active) {
    display: none !important;
  }

  .impact-report-page {
    border: 0;
    box-shadow: none;
  }
}
