:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #687385;
  --line: #dfe4ea;
  --accent: #0d9373;
  --accent-soft: rgba(13, 147, 115, 0.08);
  --accent-2: #2e6fbd;
  --warn: #b7791f;
  --danger: #b4232f;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 28px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  --radius-lg: 8px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: none;
  background: var(--ink);
  color: #fff;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  transition: all var(--transition);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 35, 50, 0.2);
}

button:active {
  transform: translateY(0);
}

button.ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

button.ghost:hover {
  background: var(--bg);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

input,
select {
  height: 38px;
  padding: 0 12px;
}

textarea {
  min-height: 118px;
  padding: 12px;
  resize: vertical;
  overflow: hidden;
  line-height: 1.6;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 20px 16px;
  background: #121820;
  color: #f0f4f8;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #0d9373;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 12px rgba(13, 147, 115, 0.3);
}

.brand h1,
.brand p {
  margin: 0;
}

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

.brand p {
  color: rgba(176, 196, 210, 0.7);
  font-size: 11px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 4px;
  margin: 20px 0;
}

.nav a {
  color: rgba(224, 236, 244, 0.8);
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.08);
}

.nav a:target,
.nav a.active {
  background: rgba(13, 147, 115, 0.15);
  color: #5cdbba;
  border-color: rgba(13, 147, 115, 0.3);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
}

.sidebar .panel {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.compact {
  padding: 16px;
}

.compact summary,
.panel h3 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.checklist {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: rgba(224, 236, 244, 0.85);
  font-size: 13px;
}

.checklist-panel:not([open]) {
  padding-bottom: 14px;
}

.checklist-panel:not([open]) summary {
  margin-bottom: 0;
}

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

.checklist input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.workspace {
  min-width: 0;
  max-width: 1560px;
  padding: 20px 24px 48px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: rgba(245, 246, 247, 0.9);
  border: 1px solid rgba(223, 228, 234, 0.78);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px) saturate(1.6);
  box-shadow: none;
}

.topbar > div {
  min-width: 112px;
}

.topbar > div:nth-child(4) {
  flex: 1;
  min-width: 160px;
}

.actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.status-pill {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.section {
  margin-bottom: 18px;
}

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

.sub-heading {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.source-note,
.small {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-command {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(420px, 0.72fr);
  gap: 12px;
  margin-bottom: 12px;
}

.command-main,
.command-side article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.command-main {
  display: grid;
  align-content: space-between;
  min-height: 172px;
  padding: 22px;
}

.command-eyebrow,
.command-side span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.command-main h2 {
  max-width: 980px;
  margin: 12px 0 16px;
  color: #111827;
  font-size: clamp(24px, 2.4vw, 36px);
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: 0;
}

.command-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.command-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #354253;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
}

.command-side {
  display: grid;
  gap: 8px;
}

.command-side article {
  display: grid;
  grid-template-columns: minmax(86px, 0.38fr) minmax(96px, 0.45fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 14px;
}

.command-side strong {
  color: #111827;
  font-size: 16px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.command-side small {
  color: #526070;
  font-size: 12px;
  line-height: 1.35;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: 12px;
  align-items: start;
}

.statement,
.scenario,
.ticker-panel {
  padding: 14px;
}

.statement textarea {
  min-height: 90px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.65;
}

.read-block {
  min-height: 0;
  padding: 4px 0;
  color: #1e2d3a;
}

.read-block p {
  margin: 0 0 10px;
  line-height: 1.7;
}

.read-block p:last-child {
  margin-bottom: 0;
}

.compact-read p {
  line-height: 1.6;
  font-size: 13px;
}

.read-list ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 0 0 18px;
}

.read-list li {
  line-height: 1.55;
}

.empty {
  color: var(--muted);
  font-style: italic;
}

.edit-drawer {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.edit-drawer summary,
.raw-drawer summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: color var(--transition);
}

.edit-drawer summary:hover,
.raw-drawer summary:hover {
  color: var(--accent);
}

.edit-drawer textarea {
  margin-top: 8px;
}

.quick-read {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.quick-read article {
  display: grid;
  grid-template-columns: minmax(76px, 0.45fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.quick-read span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quick-read strong {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.view-group {
  scroll-margin-top: 140px;
  margin-bottom: 20px;
}

.template-panel {
  padding: 12px 14px;
  margin-top: 12px;
}

.template-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
}

.quiet-drawer {
  box-shadow: none;
  background: #fafbfc;
}

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

.template-grid article {
  padding: 14px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.template-grid h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.template-grid p {
  margin: 0 0 8px;
  color: #3b4f5c;
  font-size: 13px;
  line-height: 1.55;
}

.template-grid p:last-child {
  margin-bottom: 0;
}

.probability-list {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.probability-list label {
  grid-template-columns: minmax(0, 1fr) 70px 18px;
  align-items: center;
  color: var(--ink);
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.meter {
  height: 8px;
  margin: 0 14px 8px;
  border-radius: 999px;
  background: #edf1f5;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--warn), var(--danger));
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#probabilityTotal {
  margin: 0;
  padding: 0 14px 14px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: none;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f8fa;
  color: var(--muted);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td input,
td select,
td textarea {
  border-color: transparent;
  background: transparent;
}

td input:focus,
td select:focus,
td textarea:focus {
  border-color: var(--accent);
  background: #fff;
}

td textarea {
  min-height: 58px;
  line-height: 1.4;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(11, minmax(92px, 1fr));
  gap: 8px;
}

.score-card {
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.score-card:hover {
  border-color: var(--accent);
  box-shadow: none;
}

.score-card label {
  color: var(--ink);
  font-size: 11px;
  min-height: 32px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.score-card input {
  margin-top: 8px;
  accent-color: var(--accent);
  height: 6px;
}

.score-card output {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.score-footer {
  display: grid;
  grid-template-columns: 120px 150px 190px minmax(260px, 1fr);
  gap: 10px;
  align-items: end;
  margin-top: 10px;
}

.score-total {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #1a2332 0%, #243346 100%);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(26, 35, 50, 0.2);
}

.score-total span {
  color: rgba(176, 196, 210, 0.7);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-total strong {
  font-size: 18px;
  font-weight: 800;
}

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

.valuation-card {
  padding: 14px;
  transition: all var(--transition);
}

.valuation-card:hover {
  box-shadow: var(--shadow);
}

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

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

.valuation-head h3 {
  font-size: 14px;
  font-weight: 700;
}

.valuation-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.valuation-head strong {
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.valuation-thermo {
  position: relative;
  display: grid;
  grid-template-columns: 28% 36% 36%;
  height: 10px;
  margin: 16px 0 8px;
  border-radius: 999px;
  overflow: visible;
  background: #edf1f5;
}

.valuation-thermo .zone {
  display: block;
  height: 100%;
}

.valuation-thermo .cheap {
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, #5eb88f, #71b898);
}

.valuation-thermo .fair {
  background: linear-gradient(90deg, #d4c06a, #dab95a);
}

.valuation-thermo .rich {
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, #cd7060, #c55550);
}

.valuation-thermo i {
  position: absolute;
  top: -5px;
  width: 4px;
  height: 20px;
  border-radius: 999px;
  background: #1a2332;
  box-shadow: 0 0 0 3px rgba(26, 35, 50, 0.15);
  transform: translateX(-50%);
  transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.valuation-scale,
.valuation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.valuation-meta {
  justify-content: flex-start;
  margin-top: 12px;
}

.valuation-level {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #edf1f5;
  font-size: 12px;
  font-weight: 700;
}

.valuation-level.danger {
  background: rgba(197, 58, 58, 0.1);
  color: var(--danger);
}

.valuation-level.warning {
  background: rgba(199, 122, 26, 0.1);
  color: var(--warn);
}

.valuation-level.positive {
  background: rgba(13, 147, 115, 0.1);
  color: var(--accent);
}

.valuation-card p {
  margin: 10px 0 0;
  color: #2a3d4a;
  font-size: 13px;
  line-height: 1.55;
}

.valuation-card .secondary-note {
  color: var(--muted);
}

.valuation-card footer {
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.valuation-card footer a {
  color: var(--accent-2);
  font-weight: 700;
  text-decoration: none;
  transition: color var(--transition);
}

.valuation-card footer a:hover {
  color: var(--accent);
}

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

.history-card {
  padding: 12px;
  transition: all var(--transition);
}

.history-card:hover {
  box-shadow: var(--shadow);
}

.history-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

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

.history-head h3 {
  font-size: 14px;
  font-weight: 700;
}

.history-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.history-head strong {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.history-range {
  position: relative;
  height: 8px;
  margin: 14px 0 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #5eb88f, #d4c06a 48%, #c55550);
}

.history-range span {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 16px;
  border-radius: 999px;
  background: #1a2332;
  transform: translateX(-50%);
  box-shadow: 0 0 0 2px rgba(26, 35, 50, 0.12);
  transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-scale {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
}

.history-scale span:nth-child(2) {
  text-align: center;
}

.history-scale span:nth-child(3) {
  text-align: right;
}

.history-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 0;
}

.history-card dl div {
  display: grid;
  gap: 2px;
}

.history-card dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.history-card dd {
  margin: 0;
  color: #2a3d4a;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

.options-card {
  padding: 14px;
}

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

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

.options-head h3 {
  font-size: 16px;
  font-weight: 800;
}

.options-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.options-head strong {
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
}

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

.options-kpis div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.options-kpis span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.options-kpis strong {
  font-size: 16px;
  font-weight: 800;
}

.options-state {
  margin: 0 0 10px;
  color: #243142;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.pcr-signal {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(260px, 1fr);
  gap: 12px;
  margin-top: 10px;
  padding: 14px;
  border-left: 4px solid #94a3b8;
}

.pcr-signal.warning {
  border-left-color: #d97706;
  background: #fffaf0;
}

.pcr-signal.caution {
  border-left-color: #eab308;
  background: #fffdf0;
}

.pcr-signal.positive {
  border-left-color: #059669;
  background: #f0fdf4;
}

.pcr-signal span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pcr-signal strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
}

.pcr-signal p,
.pcr-signal small {
  margin: 0;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.pcr-signal small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.pcr-compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 10px;
}

.pcr-chart-card {
  padding: 18px 20px;
}

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

.pcr-chart-head h3,
.pcr-chart-head p {
  margin: 0;
}

.pcr-chart-head h3 {
  font-size: 16px;
  font-weight: 850;
}

.pcr-chart-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.pcr-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.pcr-latest-val {
  color: #111827;
  font-size: 13px;
  font-weight: 850;
}

.pcr-latest-num {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.pcr-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 280px;
}

.chart-bg {
  fill: #fafbfd;
}

.chart-grid-line {
  stroke: #d8e0e8;
  stroke-width: 1;
}

.chart-hgrid {
  stroke: #edf1f5;
  stroke-width: 1;
}

.chart-hgrid.xtick {
  stroke: #c8d0d8;
  stroke-width: 1;
}

.chart-ygrid-label {
  fill: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-anchor: end;
  dominant-baseline: middle;
}

.chart-ygrid-label-right {
  fill: #f97316;
  font-size: 9px;
  font-weight: 700;
  text-anchor: start;
  dominant-baseline: middle;
}

.price-line,
.pcr-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.price-line {
  stroke: #2563eb;
}

.pcr-line {
  stroke: #f97316;
}

.pcr-threshold {
  stroke-dasharray: 6 4;
  stroke-width: 1.2;
}

.pcr-threshold.high,
.pcr-axis-label.high {
  stroke: #dc2626;
  fill: #dc2626;
}

.pcr-threshold.low,
.pcr-axis-label.low {
  stroke: #059669;
  fill: #059669;
}

.chart-axis-label,
.pcr-axis-label {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.chart-axis-label.mid {
  text-anchor: middle;
}

.chart-axis-label.end,
.pcr-axis-label {
  text-anchor: end;
}

.pcr-marker {
  stroke: #ffffff;
  stroke-width: 1.5;
}

.pcr-marker.high {
  fill: #dc2626;
}

.pcr-marker.low {
  fill: #059669;
}

.pcr-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 8px;
  color: #475569;
  font-size: 11px;
  font-weight: 750;
}

.pcr-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pcr-chart-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.price-dot {
  background: #2563eb;
}

.pcr-dot {
  background: #f97316;
}

.high-dot {
  background: #dc2626;
}

.low-dot {
  background: #059669;
}

.pcr-range-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.pcr-range-btn,
.pcr-reset-btn {
  padding: 4px 12px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.pcr-range-btn:hover,
.pcr-reset-btn:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.pcr-range-btn.active {
  background: #1e293b;
  border-color: #1e293b;
  color: #fff;
  box-shadow: 0 2px 6px rgba(30, 41, 59, 0.2);
}

.pcr-reset-btn {
  margin-left: 6px;
  border-color: #cbd5e1;
}

.pcr-zoom-hint {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  opacity: 0.7;
}

.pcr-chart-wrap {
  position: relative;
  border: 1px solid #e8ecf0;
  border-radius: 6px;
  overflow: hidden;
  background: #fafbfd;
}

.pcr-crosshair,
.pcr-crosshair-h {
  stroke: #94a3b8;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.pcr-brush-rect {
  fill: rgba(37, 99, 235, 0.1);
  stroke: #2563eb;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

.pcr-hover-zone {
  cursor: crosshair;
}

.pcr-tooltip {
  position: absolute;
  top: 8px;
  display: flex;
  gap: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 5;
}

.pcr-tooltip span {
  display: inline-flex;
  align-items: center;
}

.pcr-tooltip .tip-price {
  color: #93bbfc;
}

.pcr-tooltip .tip-pcr {
  color: #fbbf80;
}

.pcr-tooltip .tip-pct {
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 11px;
}

.pcr-tooltip .tip-pct.high {
  background: rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

.pcr-tooltip .tip-pct.low {
  background: rgba(5, 150, 105, 0.3);
  color: #6ee7b7;
}

/* Mini-map navigator */
.pcr-minimap-wrap {
  margin-top: 4px;
  border: 1px solid #e8ecf0;
  border-radius: 5px;
  overflow: hidden;
  background: #f5f7f9;
}

.pcr-minimap {
  display: block;
  width: 100%;
  height: 40px;
  cursor: pointer;
  user-select: none;
}

.minimap-bg {
  fill: #f0f3f6;
}

.minimap-line {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 1.2;
  stroke-linejoin: round;
}

.minimap-shade-l,
.minimap-shade-r {
  fill: rgba(100, 116, 139, 0.2);
}

.minimap-window {
  fill: transparent;
  stroke: #2563eb;
  stroke-width: 1.5;
  cursor: grab;
}

.minimap-handle {
  fill: #2563eb;
  cursor: ew-resize;
  opacity: 0.8;
}

.minimap-handle:hover {
  opacity: 1;
}

.minimap-hover-zone {
  cursor: pointer;
}

.options-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.options-table {
  min-width: 560px;
  box-shadow: none;
}

.options-table th,
.options-table td {
  padding: 8px 9px;
  font-size: 12px;
}

.option-signal {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #edf1f5;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.option-signal.warning {
  background: rgba(183, 121, 31, 0.12);
  color: var(--warn);
}

.option-signal.positive {
  background: rgba(13, 147, 115, 0.1);
  color: var(--accent);
}

.options-explain {
  margin-top: 10px;
  color: #415064;
  font-size: 12px;
}

.options-explain summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.options-explain p {
  margin: 8px 0;
  line-height: 1.55;
}

.options-explain ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

/* ── Quant Factor Indicator ──────────────────────── */

.quant-signal-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.quant-signal-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.quant-signal-pill.bull {
  background: rgba(13, 147, 115, 0.1);
  color: #0d9373;
}

.quant-signal-pill.bear {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.quant-signal-pill.neutral {
  background: #edf1f5;
  color: #64748b;
}

.quant-chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.quant-chart-card {
  padding: 18px 20px;
}

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

.quant-chart-head h3,
.quant-chart-head p {
  margin: 0;
}

.quant-chart-head h3 {
  font-size: 16px;
  font-weight: 850;
}

.quant-chart-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.quant-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.quant-net-label {
  font-size: 13px;
  font-weight: 850;
}

.quant-net-label.bull { color: #0d9373; }
.quant-net-label.bear { color: #dc2626; }
.quant-net-label.flat { color: #64748b; }

.quant-net-detail {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.quant-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 320px;
}

.quant-chart-wrap {
  position: relative;
}

.signal-bar-pos {
  fill: rgba(13, 147, 115, 0.55);
}

.signal-bar-neg {
  fill: rgba(220, 38, 38, 0.55);
}

.signal-dot {
  stroke: #fff;
  stroke-width: 1.2;
}

.signal-dot.bull-dot {
  fill: #0d9373;
}

.signal-dot.bear-dot {
  fill: #dc2626;
}

.quant-zero-line {
  stroke: #94a3b8;
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.quant-tooltip {
  position: absolute;
  display: none;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.55;
  pointer-events: none;
  white-space: nowrap;
  z-index: 20;
  max-width: 260px;
}

.quant-tooltip .tt-date {
  color: #111827;
  font-weight: 850;
  margin-bottom: 3px;
}

.quant-tooltip .tt-price {
  color: #2563eb;
}

.quant-tooltip .tt-signal-list {
  margin-top: 4px;
  display: grid;
  gap: 2px;
}

.quant-tooltip .tt-bull {
  color: #0d9373;
}

.quant-tooltip .tt-bear {
  color: #dc2626;
}

.quant-crosshair {
  stroke: #94a3b8;
  stroke-width: 1;
  stroke-dasharray: 3 2;
}

.quant-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 8px;
  color: #475569;
  font-size: 11px;
  font-weight: 750;
}

.quant-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.quant-chart-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.quant-chart-legend i.qprice { background: #2563eb; }
.quant-chart-legend i.qbull  { background: #0d9373; }
.quant-chart-legend i.qbear  { background: #dc2626; }
.quant-chart-legend i.qnet   { background: #8b5cf6; border-radius: 2px; }
.quant-chart-legend i.qcfi   { background: #8b5cf6; }
.quant-chart-legend i.qbull-zone { background: rgba(13, 147, 115, 0.35); border-radius: 2px; }
.quant-chart-legend i.qbear-zone { background: rgba(220, 38, 38, 0.35); border-radius: 2px; }

/* ── CFI Composite Factor Index chart ───────────── */

.cfi-line {
  fill: none;
  stroke: #8b5cf6;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cfi-bg {
  fill: #f8f6ff;
}

.cfi-fill-bull {
  fill: rgba(13, 147, 115, 0.22);
}

.cfi-fill-bear {
  fill: rgba(220, 38, 38, 0.18);
}

.cfi-threshold-line {
  stroke: #94a3b8;
  stroke-width: 1;
  stroke-dasharray: 6 4;
}

.cfi-mid-line {
  stroke: #cbd5e1;
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

/* Weight slider panel */
.cfi-weight-panel {
  margin-top: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.cfi-weight-panel summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: color var(--transition);
}

.cfi-weight-panel summary:hover {
  color: #8b5cf6;
}

/* Preset bar */
.cfi-preset-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f4f8;
}

.cfi-preset-select {
  flex: 1;
  max-width: 220px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.cfi-preset-select:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.cfi-btn-save,
.cfi-btn-delete {
  padding: 0 12px;
  min-height: 30px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  transition: all var(--transition);
}

.cfi-btn-save {
  background: #0d9373;
  color: #fff;
  border: none;
}

.cfi-btn-save:hover {
  background: #0a7d63;
  box-shadow: 0 3px 10px rgba(13, 147, 115, 0.3);
}

.cfi-btn-delete {
  background: #fff;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.cfi-btn-delete:hover {
  background: #fef2f2;
  border-color: #dc2626;
  box-shadow: none;
}

/* Zone stats */
.cfi-zone-stats {
  margin-bottom: 4px;
}

.cfi-stats-card {
  padding: 10px 12px;
  background: #f8fafb;
  border: 1px solid #e8f0e8;
  border-radius: 6px;
  margin-bottom: 8px;
}

.cfi-stats-title {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.cfi-stats-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 11px;
}

.cfi-stats-table th {
  position: static;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
}

.cfi-stats-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #f0f4f8;
  font-weight: 700;
}

.cfi-stats-table td.positive {
  color: #0d9373;
}

.cfi-stats-table td.negative {
  color: #dc2626;
}

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

.cfi-slider-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
}

.cfi-slider-row label {
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.cfi-weight-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border: none;
  border-radius: 999px;
  background: #e2e8f0;
  outline: none;
  padding: 0;
  cursor: pointer;
}

.cfi-weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #8b5cf6;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(139, 92, 246, 0.35);
  cursor: pointer;
  transition: transform 0.15s;
}

.cfi-weight-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.cfi-weight-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #8b5cf6;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(139, 92, 246, 0.35);
  cursor: pointer;
}

.cfi-weight-val {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.cfi-weight-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.cfi-btn-optimize,
.cfi-btn-equal {
  padding: 0 14px;
  min-height: 30px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: all var(--transition);
}

.cfi-btn-optimize {
  background: #8b5cf6;
  color: #fff;
  border: none;
}

.cfi-btn-optimize:hover {
  background: #7c3aed;
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.3);
}

.cfi-btn-equal {
  background: #f8fafc;
  color: #475569;
  border: 1px solid var(--line);
}

.cfi-btn-equal:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.cfi-btn-timing {
  background: #0d9373;
  color: #fff;
  border: none;
}

.cfi-btn-timing:hover {
  background: #0a7d63;
  box-shadow: 0 3px 10px rgba(13, 147, 115, 0.3);
}

/* Tooltip CFI value */
.cfi-tt-val {
  font-weight: 850;
  margin: 3px 0;
}

.cfi-tt-val.bull { color: #0d9373; }
.cfi-tt-val.bear { color: #dc2626; }
.cfi-tt-val.flat { color: #64748b; }

.cfi-zone-legend {
  color: #64748b;
}

/* Invert toggle button */
.cfi-btn-invert {
  padding: 4px 12px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  margin-left: 4px;
}

.cfi-btn-invert:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.cfi-btn-invert.active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

/* Factor family grid */

.quant-family-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.quant-family-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.quant-family-table th {
  background: #f1f5f9;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 7px 10px;
  text-align: left;
  border-bottom: 2px solid var(--line);
}

.quant-family-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f4f8;
  vertical-align: middle;
}

.quant-family-table tr:hover td {
  background: #f8fafc;
}

.qf-name {
  font-weight: 800;
  color: #111827;
}

.qf-count {
  font-weight: 700;
  color: var(--muted);
}

.qf-hit {
  font-weight: 800;
}

.qf-hit.good { color: #0d9373; }
.qf-hit.ok   { color: #b7791f; }
.qf-hit.bad  { color: #dc2626; }

.qf-verdict {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.qf-verdict.strong {
  background: rgba(13, 147, 115, 0.12);
  color: #0d9373;
}

.qf-verdict.usable {
  background: rgba(183, 121, 31, 0.1);
  color: #b7791f;
}

.positions-helper {
  margin-bottom: 12px;
}

.raw-drawer {
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.portfolio-dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.chart-panel {
  padding: 14px;
}

.bar-chart {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.bar-label span {
  color: #3a4d58;
  font-weight: 700;
}

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

.bar-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.positive {
  color: var(--accent);
}

.negative {
  color: var(--danger);
}

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

.bar-track .positive {
  background: linear-gradient(90deg, #0d9373, #10b990);
}

.bar-track .negative {
  background: linear-gradient(90deg, #c53a3a, #e04848);
}

.bar-track .neutral {
  background: var(--muted);
}

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

.recommend-card {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.recommend-card:hover {
  box-shadow: var(--shadow);
}

.recommend-card.positive {
  border-left-color: var(--accent);
}

.recommend-card.negative {
  border-left-color: var(--danger);
}

.recommend-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.recommend-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

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

.recommend-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.recommend-card dl div {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
}

.recommend-card dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.recommend-card dd {
  margin: 0;
  color: #2a3d4a;
  font-size: 13px;
  line-height: 1.5;
}

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

.metric-card {
  display: grid;
  grid-template-columns: minmax(70px, 0.6fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.metric-card:hover {
  box-shadow: var(--shadow);
}

.metric-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-card strong {
  font-size: 16px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.ai-note {
  padding: 14px;
  margin-bottom: 10px;
}

.ai-note textarea {
  min-height: 132px;
}

.table-tools {
  margin-top: 0;
}

.source-note.error {
  color: var(--danger);
  font-weight: 700;
}

.positions-helper textarea {
  min-height: 74px;
}

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

.scenario textarea {
  display: none;
}

.scenario {
  min-height: 150px;
  transition: all var(--transition);
}

.scenario:hover {
  box-shadow: var(--shadow);
}

.scenario.danger {
  border-color: rgba(197, 58, 58, 0.25);
  background: linear-gradient(180deg, #fff 0%, rgba(197, 58, 58, 0.02) 100%);
}

.watch-grid {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.watch-grid textarea {
  min-height: 220px;
}

.watch-panel {
  padding: 18px;
}

.ticker-panel p {
  margin: 0;
  color: #3a4d58;
}

.tracked-summary {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.tracked-group {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.tracked-group > span {
  color: #3a4d58;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill-list,
.theme-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-list span,
.theme-list span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafb;
  color: #2a3d4a;
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
  transition: all var(--transition);
}

.pill-list span:hover,
.theme-list span:hover {
  background: var(--accent-soft);
  border-color: rgba(13, 147, 115, 0.2);
  color: var(--accent);
}

.theme-list span {
  border-radius: 6px;
  font-weight: 600;
}

.pill-list .empty-pill,
.theme-list .empty-pill {
  color: var(--muted);
  font-weight: 500;
  font-style: italic;
}

.pill-list .empty-pill:hover,
.theme-list .empty-pill:hover {
  background: #f8fafb;
  border-color: var(--line);
  color: var(--muted);
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .quick-read,
  .dashboard-command,
  .command-side,
  .summary-grid,
  .score-grid,
  .score-footer,
  .valuation-grid,
  .history-grid,
  .options-grid,
  .pcr-signal,
  .pcr-compare-grid,
  .portfolio-cards,
  .portfolio-dashboard,
  .recommendation-grid,
  .template-grid,
  .scenario-grid,
  .watch-grid {
    grid-template-columns: 1fr;
  }

  .command-main {
    min-height: auto;
    padding: 18px;
  }

  .command-main h2 {
    font-size: 22px;
  }

  .command-side article {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .quick-read article,
  .metric-card,
  .options-kpis {
    grid-template-columns: 1fr;
  }

  .actions-row {
    justify-content: stretch;
  }

  .actions-row button {
    flex: 1;
  }

  .workspace {
    padding: 16px;
  }
}

@media print {
  .sidebar,
  .topbar,
  button {
    display: none;
  }

  .workspace {
    padding: 0;
  }

  .panel,
  .table-wrap {
    box-shadow: none;
  }
}
