/* ── Design tokens (restrained B2B SaaS) ── */
:root {
  --font: "Inter", "Noto Sans TC", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;

  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-hover: #fafafa;

  --text: #18181b;
  --text-secondary: #52525b;
  --text-tertiary: #a1a1aa;

  --border: rgba(24, 24, 27, 0.06);
  --border-strong: rgba(24, 24, 27, 0.1);

  --accent: #5e6ad2;
  --accent-hover: #4f58c4;
  --accent-soft: rgba(94, 106, 210, 0.1);

  --caution-soft: rgba(161, 98, 7, 0.08);
  --caution-text: #854d0e;
  --caution-border: rgba(161, 98, 7, 0.2);

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  --topbar-h: 48px;
  --layer-gap: 36px;
  --section-gap: 44px;

  --shadow-surface: 0 1px 2px rgba(0, 0, 0, 0.03);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.drawer-open {
  overflow: hidden;
}

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

.app {
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
}

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

.brand-mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.brand-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.btn-insight-report {
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #0e7c7b;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(14, 124, 123, 0.25);
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-insight-report:hover {
  background: #0b6867;
}

.btn-insight-report:active {
  transform: translateY(1px);
}

.btn-insight-report[hidden] {
  display: none !important;
}

.main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 32px 72px;
}

.layer {
  margin-bottom: var(--layer-gap);
}

.layer:last-child {
  margin-bottom: 0;
}

.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-surface);
}

.surface-table {
  box-shadow: none;
}

/* ── Control strip ── */
.layer-control {
  padding: 20px 24px;
}

.control-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}

.field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.field input,
.field select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-grow {
  flex: 1;
  min-width: 220px;
}

.field-sm {
  width: 160px;
  flex: 0 0 auto;
}

.control-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.btn {
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.btn-primary {
  background: var(--text);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #27272a;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.btn-text {
  background: none;
  border: none;
  padding: 4px 8px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
}

.btn-text:hover {
  color: var(--text-secondary);
}

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

.sync-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.sync-status-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
}

.sync-dot--ok { background: #22c55e; }
.sync-dot--syncing { background: var(--accent); animation: pulse 1.2s ease infinite; }
.sync-dot--err { background: #ef4444; }

@keyframes pulse {
  50% { opacity: 0.4; }
}

.sync-status-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.sync-status-meta {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.sync-details {
  margin-top: 10px;
}

.pipeline-log {
  margin: 0;
  max-height: 140px;
  overflow: auto;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  color: #a1a1aa;
  background: #18181b;
  border-radius: var(--radius-sm);
}

.alert {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border);
}

.alert-info {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-color: rgba(94, 106, 210, 0.2);
}

.alert-warn {
  background: var(--caution-soft);
  color: var(--caution-text);
  border-color: var(--caution-border);
}

.alert-error {
  background: rgba(239, 68, 68, 0.06);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.15);
}

/* ── Page header + metrics ── */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 36px 40px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.page-title {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
}

.page-lead {
  margin: 10px 0 0;
  max-width: 400px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.metrics-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: flex-start;
}

.metric {
  padding: 0 28px;
  min-width: 100px;
}

.metric:first-child {
  padding-left: 0;
}

.metric--divider {
  border-left: 1px solid var(--border);
}

.metric__label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.metric__value {
  display: block;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.2;
}

.metric--meta .metric__value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0;
  white-space: nowrap;
}

/* ── Callout (duplicates) ── */
.callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-left: 2px solid #d6d3d1;
}

.callout-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.callout-desc {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.45;
}

.workspace > .layer-actions {
  margin-bottom: var(--section-gap);
}

/* ── Section head ── */
.section-head {
  margin-bottom: 16px;
}

.section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Insight / action cards ── */
.action-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.action-card {
  position: relative;
  display: flex;
  gap: 0;
  text-align: left;
  padding: 18px 16px 18px 14px;
  min-height: 108px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.action-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.action-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  background: var(--surface);
}

.action-card.is-empty {
  opacity: 0.72;
}

.action-card.is-empty:hover {
  opacity: 0.9;
}

.action-card__accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--text-tertiary);
}

.action-card__accent--amber { background: #d4a574; }
.action-card__accent--emerald { background: #6ee7b7; }
.action-card__accent--blue { background: #93c5fd; }
.action-card__accent--indigo { background: #a5b4fc; }
.action-card__accent--rose { background: #fda4af; }

.action-card__main {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding-left: 8px;
  flex: 1;
}

.action-card__row-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.action-card__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.action-card__count {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}

.action-card__count.is-zero {
  color: var(--text-tertiary);
  font-weight: 500;
  font-size: 16px;
}

.action-card__desc {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.35;
}

.action-card__cta {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.35;
}

.action-card__cta.is-muted {
  color: var(--text-tertiary);
  font-weight: 400;
}

.action-card.is-active .action-card__cta:not(.is-muted) {
  color: var(--accent);
}

/* ── Toolbar ── */
.sticky-toolbar {
  position: sticky;
  top: calc(var(--topbar-h) + 12px);
  z-index: 40;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

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

.toolbar-search input {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
}

.toolbar-search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.toolbar-sort {
  width: 120px;
  flex: 0 0 auto;
}

.toolbar-sort label {
  margin-bottom: 4px;
}

.toolbar-count {
  margin: 0 0 0 auto;
  font-size: 12px;
  font-weight: 400;
  color: #b4b4bc;
  font-variant-numeric: tabular-nums;
}

.count-primary {
  font-weight: 500;
  color: var(--text-secondary);
}

.count-sep {
  margin: 0 2px;
  color: var(--text-tertiary);
}

.toolbar-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.tag-pill {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.tag-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.tag-pill.is-on {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

/* ── Table ── */
.surface-table {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.customer-table {
  width: 100%;
  border-collapse: collapse;
}

.customer-table th {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: transparent;
  white-space: nowrap;
}

.customer-table th.num {
  text-align: right;
}

.customer-table td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.customer-table tbody tr:last-child td {
  border-bottom: none;
}

.customer-table tbody tr.data-row {
  cursor: pointer;
  transition: background 0.1s;
}

.customer-table tbody tr.data-row:hover {
  background: var(--surface-hover);
}

.customer-table tbody tr.data-row.is-selected {
  background: var(--accent-soft);
}

.customer-table tbody tr.data-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.col-customer {
  min-width: 180px;
}

.customer-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.customer-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.customer-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.customer-key {
  font-size: 11px;
  font-weight: 400;
  color: #b4b4bc;
  line-height: 1.4;
  font-family: var(--font);
}

.col-situation {
  font-size: 12px;
  font-weight: 400;
  color: #b4b4bc;
  white-space: nowrap;
}

.col-rec {
  max-width: 160px;
}

.rec-short {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.col-money,
.col-date {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  text-align: right;
}

.col-money {
  font-weight: 500;
  color: var(--text);
}

.col-chevron {
  width: 32px;
  text-align: right;
}

.row-chevron {
  font-size: 14px;
  color: var(--text-tertiary);
  transition: color 0.12s, transform 0.12s;
}

.data-row:hover .row-chevron {
  color: var(--text-secondary);
  transform: translateX(2px);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 140px;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
}

.badge--caution {
  color: var(--text-tertiary);
  background: transparent;
  border-color: var(--border);
}

.badge--neutral {
  color: var(--text-secondary);
  background: var(--bg);
  border-color: var(--border);
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-tertiary);
}

.badge-tag__pct {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.badge-tag__pct::before {
  content: "·";
  margin-right: 3px;
}

.badge-tag--dormant {
  background: #fafaf9;
  border-color: rgba(161, 98, 7, 0.15);
  color: #78716c;
}

.badge-tag--high_value_customer {
  background: #f7fef9;
  border-color: rgba(22, 101, 52, 0.12);
  color: #3f6212;
}

.badge-tag--repeat_buyer {
  background: #f7fef9;
  border-color: rgba(21, 128, 61, 0.1);
  color: #166534;
}

.badge-tag--category_fan {
  background: #f8fafc;
  border-color: rgba(59, 130, 246, 0.12);
  color: #475569;
}

.badge-tag--discount_hunter {
  background: #fafafa;
  border-color: rgba(190, 24, 93, 0.1);
  color: #71717a;
}

.badge-tag--default {
  background: var(--bg);
  color: var(--text-tertiary);
}

.muted {
  color: var(--text-tertiary);
  font-size: 12px;
}

.mono {
  font-family: var(--font-mono);
}

.hidden {
  display: none !important;
}

/* ── Drawer ── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.2);
  z-index: 200;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 210;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.06);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.drawer-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.drawer-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.drawer-close:hover {
  background: var(--bg);
  color: var(--text);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 32px;
}

.drawer-panel {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.drawer-panel:last-child {
  border-bottom: none;
}

.drawer-panel--muted {
  background: var(--bg);
}

.drawer-panel--caution {
  background: var(--bg);
}

.drawer-panel--highlight {
  background: var(--bg);
}

.drawer-panel__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.decision-summary {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--text);
}

.basis-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.basis-card {
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--border);
}

.basis-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}


.basis-card__headline {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.basis-card__detail {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
  line-height: 1.45;
}

.basis-card__tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: #b4b4bc;
}

.basis-rfm-line {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-tertiary);
}

.drawer-panel--quiet {
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.drawer-panel--subtle {
  padding-top: 16px;
  padding-bottom: 16px;
}

.drawer-panel__label--muted {
  color: #b4b4bc;
  font-weight: 500;
}

.decision-card {
  padding: 0;
  margin-bottom: 14px;
  border: none;
  background: transparent;
}

.decision-card__label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 500;
  color: #b4b4bc;
}

.decision-card__main {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.decision-card__full {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.decision-meta {
  margin: 0;
  display: grid;
  gap: 10px;
}

.decision-meta > div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  font-size: 13px;
}

.decision-meta dt {
  margin: 0;
  font-weight: 500;
  color: var(--text-tertiary);
}

.decision-meta dd {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.drawer-details {
  margin-top: 10px;
  font-size: 12px;
}

.drawer-details--inline {
  margin-top: 8px;
}

.drawer-details summary {
  cursor: pointer;
  color: var(--text-tertiary);
  font-weight: 500;
  list-style: none;
  user-select: none;
}

.drawer-details summary::-webkit-details-marker {
  display: none;
}

.drawer-details summary::before {
  content: "▸ ";
  font-size: 10px;
}

.drawer-details[open] summary::before {
  content: "▾ ";
}

.drawer-details__body {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.5;
}

.score-list--compact .score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.score-list--compact .score-row:last-child {
  border-bottom: none;
}

.rec-list--compact {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.rec-list--compact li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.45;
}

.drawer-panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.drawer-panel__label {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.drawer-key {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-tertiary);
  word-break: break-all;
}

.drawer-caption {
  margin: 4px 0 10px;
  font-size: 12px;
  font-weight: 400;
  color: #b4b4bc;
  line-height: 1.45;
}

.drawer-placeholder {
  margin: 0;
  font-size: 13px;
  color: var(--text-tertiary);
}

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

.drawer-metrics__val {
  display: block;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.drawer-metrics__val--sm {
  font-size: 12px;
  font-weight: 500;
}

.drawer-metrics__lbl {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.score-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.score-val {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.reason-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.reason-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.reason-item:last-child {
  border-bottom: none;
}

.reason-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin-right: 8px;
}

.next-step {
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.next-step__badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.next-step__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}

.next-step__meta {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-tertiary);
}

.drawer-more .rec-list {
  margin-top: 12px;
}

.rec-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rec-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.rec-priority {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-right: 6px;
}

.rfm-inline {
  display: flex;
  gap: 20px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.rfm-inline em {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-right: 4px;
}

.related-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.related-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.related-item strong {
  font-weight: 600;
  color: var(--text);
}

.related-key {
  display: block;
  margin-top: 4px;
  font-size: 11px;
}

.related-meta {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .page-header {
    padding: 28px;
  }

  .action-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics-row {
    width: 100%;
  }

  .metric {
    padding: 0 20px;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 20px 16px 48px;
  }

  .topbar-inner {
    padding: 0 16px;
  }

  --layer-gap: 24px;

  .action-cards {
    grid-template-columns: 1fr;
  }

  .col-situation,
  .col-rec {
    display: none;
  }

  .metric {
    padding: 0 16px;
    min-width: 80px;
  }

  .metric__value {
    font-size: 18px;
  }

  .drawer-metrics {
    grid-template-columns: 1fr;
  }
}
