:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-alt: #f9fbfd;
  --surface-soft: #f1f5f9;
  --ink: #102033;
  --ink-soft: #32445a;
  --muted: #67788f;
  --line: #dbe4ee;
  --line-strong: #c4d0dc;
  --brand: #2d5bff;
  --brand-soft: rgba(45, 91, 255, 0.08);
  --green: #0f6d5b;
  --green-soft: rgba(15, 109, 91, 0.08);
  --amber: #9a5e08;
  --amber-soft: rgba(154, 94, 8, 0.08);
  --shadow: 0 12px 34px rgba(16, 32, 51, 0.06);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --font-sans: "Avenir Next", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, #fbfcfd 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: var(--font-sans);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.app-root {
  min-height: 100vh;
  padding: 20px;
}

.login-view,
.workspace-view {
  min-height: calc(100vh - 40px);
}

.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card,
.panel,
.topbar,
.desk-panel,
.message {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.login-card {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 360px;
  max-width: 1180px;
  width: 100%;
  overflow: hidden;
}

.login-copy {
  padding: 36px;
  background:
    linear-gradient(180deg, rgba(45, 91, 255, 0.04), transparent 42%),
    var(--surface);
}

.login-panel {
  padding: 32px;
  background: linear-gradient(180deg, #11233b 0%, #152d49 100%);
  color: #f7fbff;
}

.eyebrow,
.panel-kicker,
.subsection-kicker,
.field-label,
.speaker,
.message-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  color: var(--brand);
}

.login-panel .panel-kicker,
.login-panel .field-label {
  color: rgba(247, 251, 255, 0.78);
}

.login-copy h1,
.topbar h2 {
  margin: 0 0 14px;
  font-size: 46px;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.login-lead,
.panel-copy,
.summary-copy,
.detail-block p,
.detail-block ul,
.rank-title-group p,
.rank-footnote,
.secondary-text,
.application-line p,
.message-body p,
.message-body li {
  color: var(--ink-soft);
  line-height: 1.65;
}

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

.feature-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.feature-card strong {
  display: block;
  margin-bottom: 6px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
}

.login-panel h2 {
  margin: 0 0 10px;
  font-size: 32px;
  line-height: 1.08;
}

.login-panel .panel-copy {
  color: rgba(247, 251, 255, 0.78);
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.login-form input,
.search-input,
#promptInput {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}

.login-form input {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.login-form input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

#loginButton,
#submitButton {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--brand);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

#loginButton:disabled,
#submitButton:disabled {
  opacity: 0.7;
  cursor: wait;
}

.error-text {
  min-height: 24px;
  margin: 10px 0 0;
  color: #ffb3c1;
  font-size: 13px;
}

.workspace-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 40px); /* app-root has 20px padding top+bottom */
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 20px;
  flex-shrink: 0;
}

.topbar h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.topbar-title .eyebrow {
  margin-bottom: 4px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ══ 两列布局 ══ */
.nb-layout {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 每列面板 */
.nb-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ── 上半：排名图区 ── */
.nb-ranking-section {
  flex: 0 0 50%;          /* 占列高度约 50% */
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.nb-panel-head {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.nb-panel-head h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.nb-panel-head .panel-kicker {
  margin-bottom: 3px;
}

.nb-search-wrap {
  flex-shrink: 0;
  padding: 10px 14px 0;
}

.nb-search-wrap .search-input {
  padding: 8px 12px;
  font-size: 13px;
}

.nb-chart-legend {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px 4px;
  font-size: 12px;
  color: var(--muted);
}

.nb-legend-hint {
  font-size: 11px;
  color: var(--line-strong);
}

.nb-chart {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 6px 10px 10px;
}

/* ── 内部分隔线 ── */
.nb-inner-divider {
  flex-shrink: 0;
  height: 1px;
  background: var(--line);
}

/* ── 下半：展开详情区 ── */
.nb-detail-section {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 16px;
}

.nb-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.nb-detail-head .subsection-kicker {
  width: 100%;
  margin: 0;
}

.nb-detail-head .subsection-title {
  flex: 1;
  min-width: 0;
}

.nb-detail-head .inline-btn {
  margin-left: auto;
}

.nb-placeholder {
  color: var(--muted);
  font-weight: 400;
  font-size: 14px;
}

/* ── Chart rows (compact) ── */
.nb-chart .chart-row {
  padding: 7px 10px;
  border-radius: 10px;
  margin-bottom: 5px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}

.nb-chart .chart-row:hover {
  background: var(--surface-soft);
}

.nb-chart .chart-row.selected {
  border-color: #cad7ff;
  background: linear-gradient(180deg, #f7faff 0%, #ffffff 100%);
}

.nb-chart .chart-label-row {
  grid-template-columns: 26px minmax(0, 1fr) auto;
  margin-bottom: 4px;
}

.nb-chart .chart-rank  { font-size: 11px; }
.nb-chart .chart-name  { font-size: 12px; }
.nb-chart .chart-value { font-size: 11px; }

.nb-chart .chart-sub {
  margin: 0 0 4px 26px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nb-chart .chart-bar-track { height: 5px; }

/* ── 柱状图 (Column Chart) ── */
.nb-chart.nb-col-chart {
  overflow: hidden;
  padding: 0;
}

.col-chart-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.col-scroll-area {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

.col-bars-row {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 5px;
  padding: 10px 10px 0;
}

.col-item {
  flex: 1;
  min-width: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.15s;
}
.col-item:hover { opacity: 0.75; }

.col-spacer { flex-shrink: 0; }

.col-val {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  color: var(--amber);
  text-align: center;
  line-height: 1.4;
}

.col-bar {
  width: 72%;
  max-width: 38px;
  border-radius: 5px 5px 0 0;
  background: var(--amber-soft);
  border: 1.5px solid var(--amber);
  border-bottom: none;
  min-height: 3px;
  transition: background 0.2s;
}

.col-item.col-selected .col-val { color: var(--brand); }
.col-item.col-selected .col-bar {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(154,94,8,0.15);
}

.col-labels-row {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  gap: 5px;
  padding: 5px 10px 8px;
  border-top: 1px solid var(--line);
}

.col-label {
  flex: 1;
  min-width: 32px;
  font-size: 9.5px;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s;
}
.col-label.col-label-selected {
  color: var(--amber);
  font-weight: 700;
}
/* Top 10 全局标注 */
.col-item.col-top10 .col-bar {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  border-color: #b45309;
  box-shadow: 0 0 0 1.5px rgba(180,83,9,0.18);
}
.col-item.col-top10.col-selected .col-bar {
  background: linear-gradient(180deg, #f59e0b 0%, #92400e 100%);
  border-color: #92400e;
}
.col-item.col-top10 .col-val {
  color: #b45309;
  font-weight: 900;
}
.col-crown {
  font-size: 9px;
  line-height: 1;
  text-align: center;
  flex-shrink: 0;
}
.col-label.col-label-top10 {
  color: #b45309;
  font-weight: 700;
}

/* ══ 底部 Chatbot 横条 ══ */
.chatbar-resize-handle {
  flex-shrink: 0;
  height: 8px;
  cursor: ns-resize;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chatbar-resize-handle::after {
  content: '';
  width: 36px;
  height: 3px;
  border-radius: 3px;
  background: var(--line-strong);
  transition: background 0.15s;
}
.chatbar-resize-handle:hover::after,
.chatbar-resize-handle.dragging::after {
  background: var(--brand);
}

.nb-chatbar {
  flex-shrink: 0;
  height: 200px;
  padding: 0;
  overflow: hidden;
}

.nb-chatbar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.nb-chatbar-label {
  flex-shrink: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nb-chatbar-label .panel-kicker {
  margin: 0;
}

.nb-chatbar-label .chat-context-card {
  margin: 0;
  padding: 8px 10px;
}

.nb-chatbar-label .prompt-row {
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
}

.nb-chatbar-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.nb-chatbar-body .chat-log {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 14px 4px;
  margin: 0;
}

.nb-chatbar-body .chat-form {
  flex-shrink: 0;
  padding: 8px 12px 10px;
  margin: 0;
  border-top: 1px solid var(--line);
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 8px;
}

.nb-chatbar-body #promptInput {
  min-height: 52px;
  padding: 8px 12px;
  font-size: 13px;
}

.nb-chatbar-body #submitButton {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.status-chip,
.small-pill,
.context-chip,
.priority-badge,
.priority-chip,
.rank-index,
.user-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-chip,
.small-pill {
  background: var(--surface-soft);
  color: var(--ink-soft);
}

.context-chip,
.priority-badge {
  background: var(--brand-soft);
  color: var(--brand);
}

.priority-chip {
  background: var(--green-soft);
  color: var(--green);
}

.rank-index {
  background: var(--amber-soft);
  color: var(--amber);
  min-width: 46px;
}

.user-badge {
  background: #142a49;
  color: #ffffff;
}

.ghost-button {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  cursor: pointer;
}

.desk-panel {
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow: visible;
}

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

.desk-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.legend-row {
  display: flex;
  gap: 12px;
  margin: 10px 0 12px;
  font-size: 12px;
  color: var(--muted);
}

.ranking-section-label {
  margin: 6px 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
}

.legend-dot.amber {
  background: var(--amber);
}

.legend-dot.teal {
  background: var(--green);
}

.panel-list,
.detail-stack,
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-chart {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.chart-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
}

.chart-row.selected {
  border-color: #cad7ff;
  background: linear-gradient(180deg, #f7faff 0%, #ffffff 100%);
}

.chart-label-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.chart-rank,
.chart-value {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.chart-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-bar-track {
  height: 8px;
  border-radius: 999px;
  background: #e9eef5;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) 0%, #7ea0ff 100%);
}

.panel-list {
  min-height: auto;
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
  padding-right: 2px;
}

.rank-card {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.rank-card.selected {
  border-color: #cad7ff;
  border-left-color: var(--brand);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.rank-card-head,
.customer-score-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.rank-card-head {
  margin-bottom: 10px;
}

.rank-title-group {
  flex: 1;
  min-width: 0;
}

.rank-title-group strong {
  display: block;
  margin-bottom: 4px;
  font-size: 17px;
}

.rank-title-group p,
.rank-footnote,
.customer-score-line {
  margin: 0;
  font-size: 13px;
}

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

.mini-score,
.metric-box {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
}

.mini-score span,
.metric-box span {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.mini-score strong,
.metric-box strong {
  display: block;
  font-size: 20px;
}

.mini-score.amber {
  background: linear-gradient(180deg, #fffaf1 0%, #ffffff 100%);
}

.mini-score.teal {
  background: linear-gradient(180deg, #f3fbf8 0%, #ffffff 100%);
}

.rank-footnote {
  margin-top: 10px;
  color: var(--muted);
}

.section-divider {
  height: 1px;
  margin: 14px 0;
  background: var(--line);
}

.subsection-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.subsection-head .subsection-kicker {
  width: 100%;
  margin-bottom: 0;
}

.subsection-head .subsection-title {
  flex: 1;
  min-width: 0;
}

.subsection-head .inline-btn {
  margin-left: auto;
}

.subsection-head.with-divider {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.subsection-kicker {
  color: var(--muted);
}

.subsection-title {
  font-size: 18px;
  line-height: 1.3;
}

.summary-copy {
  margin: 0 0 10px;
  font-size: 14px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.compact {
  gap: 8px;
}

.detail-stack {
  min-height: auto;
}

.detail-scroll {
  overflow: visible;
  padding-right: 2px;
  flex: 0 0 auto;
}

.detail-block {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
}

.detail-block span {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-block p,
.detail-block ul {
  margin: 0;
  font-size: 13px;
}

.detail-block ul,
.message-body ul,
.message-body ol {
  padding-left: 18px;
}

.application-line {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.application-line strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.application-line p {
  margin: 0 0 8px;
  font-size: 13px;
}

.chip-row,
.source-list,
.prompt-row,
.message-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-context-card {
  margin-top: 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
}

.chat-context-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.chat-context-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  color: var(--ink);
}

.chat-context-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.tag-chip,
.prompt-chip,
.followup-chip,
.source-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font-size: 12px;
}

.tag-chip {
  color: var(--ink-soft);
  font-weight: 700;
}

.prompt-chip,
.followup-chip {
  cursor: pointer;
}

.source-list {
  margin-top: 10px;
}

.source-chip {
  color: var(--ink-soft);
  text-decoration: none;
}

.chat-panel {
  min-height: 0;
}

.bottom-panel {
  min-height: 420px;
}

.chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  margin-top: 10px;
}

.message {
  padding: 16px;
  border-radius: 14px;
}

.assistant-message {
  background: white;
}

.user-message {
  align-self: flex-end;
  max-width: 100%;
  background: #f7faff;
  border-color: #d4defa;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.speaker {
  color: var(--muted);
}

.message-tag {
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 4px 8px;
}

.message-headline {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.1;
}

.message-body h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.analysis-block {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
}

.analysis-block.emphasis {
  background: linear-gradient(180deg, #f7faff 0%, #ffffff 100%);
  border-color: #cad7ff;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.score-line {
  margin: 0 0 8px;
  color: var(--brand);
}

.sources-title {
  margin: 14px 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 10px;
  margin-top: 12px;
}

#promptInput {
  min-height: 104px;
  resize: none;
}

#submitButton {
  justify-self: end;
  align-self: end;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1;
}

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

.fade-up {
  animation: fade-up 240ms ease both;
}

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

@media (max-width: 1080px) {
  .app-root {
    padding: 12px;
  }

  .workspace-view {
    height: auto;
    min-height: 100vh;
  }

  .nb-layout {
    grid-template-columns: 1fr;
    flex: none;
    height: auto;
    overflow: visible;
  }

  .nb-panel {
    min-height: 500px;
    height: auto;
  }

  .nb-ranking-section {
    flex: 0 0 auto;
    max-height: 360px;
  }

  .nb-chatbar {
    height: auto;
    min-height: 220px;
  }

  .nb-chatbar-inner {
    grid-template-columns: 1fr;
    height: auto;
  }

  .nb-chatbar-label {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 120px;
  }

  .login-card,
  .feature-grid,
  .metric-strip,
  .mini-score-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .login-copy,
  .login-panel {
    padding: 24px 20px;
  }

  .login-copy h1,
  .topbar h2 {
    font-size: 34px;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }
}

/* ─── Action List Button ─── */
.action-list-btn {
  position: relative;
  padding: 9px 14px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.action-list-btn:hover {
  background: var(--brand);
  color: white;
}

.action-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
}

.action-list-btn:hover .action-badge {
  background: white;
  color: var(--brand);
}

/* ─── Side Panel ─── */
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 32px rgba(16, 32, 51, 0.12);
  z-index: 400;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slide-in-right 220ms ease both;
}

@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.side-panel-header strong {
  font-size: 16px;
}

.side-panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 32, 51, 0.3);
  z-index: 300;
  backdrop-filter: blur(2px);
  animation: fade-in 200ms ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--line);
}

/* ─── Action Cards ─── */
.action-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-alt);
}

.action-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.action-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.action-industry {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
}

.urgency-tag {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.urgency-high {
  background: rgba(220, 50, 50, 0.1);
  color: #b91c1c;
}

.urgency-mid {
  background: var(--amber-soft);
  color: var(--amber);
}

.urgency-low {
  background: var(--green-soft);
  color: var(--green);
}

.action-signal,
.action-strategy,
.action-last-visit {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.action-last-visit {
  color: var(--muted);
  font-size: 12px;
}

.action-goto {
  margin-top: 10px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  cursor: pointer;
}

.action-goto:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

/* ─── Visit History ─── */
.visit-history-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.visit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.visit-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
}

.visit-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.visit-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.visit-type-tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.visit-conclusion-tag {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.conclusion-positive {
  background: var(--green-soft);
  color: var(--green);
}

.conclusion-negative {
  background: rgba(154, 94, 8, 0.06);
  color: var(--amber);
}

.conclusion-neutral {
  background: var(--surface-soft);
  color: var(--muted);
}

.visit-summary {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.visit-pain,
.visit-next {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.visit-meta {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.visit-meta span {
  font-size: 11px;
  color: var(--muted);
}

/* ─── Feedback Widget ─── */
.feedback-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.feedback-widget {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-alt);
  margin-top: 10px;
}

.feedback-prompt {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}

.feedback-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}

.star-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.star-row label {
  margin-right: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  min-width: 56px;
}

.star-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  color: #dbe4ee;
  transition: color 120ms, transform 120ms;
}

.star-btn.hovered,
.star-btn.selected {
  color: #f59e0b;
}

.star-btn:hover {
  transform: scale(1.15);
}

.feedback-detail {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feedback-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.feedback-row span {
  color: var(--ink-soft);
  min-width: 60px;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
}

.feedback-comment {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 13px;
  resize: none;
  margin-top: 4px;
}

.submit-feedback-btn {
  margin-top: 10px;
  padding: 8px 16px;
  border: none;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.submit-feedback-btn:hover {
  opacity: 0.88;
}

.feedback-done {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
}

/* ─── Visit Modal ─── */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  background: rgba(16, 32, 51, 0.4);
  backdrop-filter: blur(3px);
  padding: 20px;
}

.modal-box {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(16, 32, 51, 0.18);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-header strong {
  font-size: 16px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: var(--surface);
}

.visit-form {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-row label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-row input,
.form-row select,
.form-row textarea {
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}

.form-row input:read-only {
  background: var(--surface-soft);
  color: var(--ink-soft);
}

.form-row textarea {
  resize: none;
}

.required {
  color: #dc2626;
}

.primary-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn:hover {
  opacity: 0.9;
}

/* ─── Inline Button ─── */
.inline-btn {
  padding: 5px 10px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.inline-btn:hover {
  background: var(--brand);
  color: white;
}

/* ─── Warning Note ─── */
.warning-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(154, 94, 8, 0.25);
  border-radius: 10px;
  background: var(--amber-soft);
  font-size: 13px;
  color: var(--amber);
  line-height: 1.5;
}

/* ─── Empty Hint ─── */
.empty-hint {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
