:root {
  --bg: #071016;
  --panel: #101b22;
  --panel-soft: #142631;
  --line: #29485a;
  --text: #edf7fb;
  --muted: #9bb9c6;
  --accent: #33c6d8;
  --accent-2: #f1b850;
  --danger: #ff817d;
  --ok: #72e39f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Text", "Noto Sans TC", "Segoe UI", Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 1000;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 22, 0.92);
  backdrop-filter: blur(12px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.2s ease;
}

.topbar.topbar-hidden {
  transform: translateY(-100%);
}

@media (max-width: 768px) {
  .topbar {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .brand-mark {
    width: 44px !important;
    min-width: 44px !important;
    height: 36px !important;
    font-size: 0.85rem !important;
  }
  .brand strong {
    font-size: 0.9rem !important;
  }
  .brand-sub-title {
    display: none !important;
  }
  .nav {
    gap: 6px !important;
  }
  .nav a,
  .action-button {
    padding: 5px 8px !important;
    font-size: 0.78rem !important;
  }
}

.brand,
.nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 58px;
  min-width: 58px;
  height: 50px;
  padding: 0 6px;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand small,
.eyebrow,
.section-head p,
.page-header p {
  color: var(--muted);
}

.brand strong,
.brand small {
  display: block;
}

.nav a,
.back-link,
.refresh-button,
.action-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
  font: inherit;
  cursor: pointer;
}

.refresh-button:disabled,
.action-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.action-button.primary {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(51, 198, 216, 0.08);
}

.page-shell {
  width: 98%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 12px 12px 48px;
}

[hidden] {
  display: none !important;
}

.hero,
.page-header,
.section {
  margin-bottom: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.hero,
.page-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
}

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

.hero h1,
.page-header h1,
.empty-state h1 {
  margin: 4px 0 8px;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 650;
  line-height: 1.08;
}

.stock-title {
  margin: 4px 0 8px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  line-height: 1.1;
}

.stock-title .ticker {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
}

.stock-title .company-name {
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.85;
}

.hero-copy {
  max-width: 720px;
}

.hero-stat {
  min-width: 132px;
  text-align: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.hero-stat strong {
  display: block;
  color: var(--accent-2);
  font-size: 42px;
}

.hero-stat.compact strong {
  font-size: 34px;
}

.dashboard-total {
  display: grid;
  min-width: 132px;
  min-height: 92px;
  place-items: center;
}

.dashboard-total strong {
  font-size: 44px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
}

.section-head h2 {
  margin: 0;
  font-size: 28px;
}

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

.panel-desc {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.panel-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.panel-badge .badge-label {
  color: var(--muted);
  font-size: 13px;
}

.panel-badge .badge-value {
  color: var(--accent-2);
  font-size: 20px;
  font-weight: 750;
}

.dashboard-switcher,
.kpi-style-toolbar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.dashboard-tab,
.kpi-style-button {
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.dashboard-tab[aria-selected="true"],
.kpi-style-button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(51, 198, 216, 0.12);
  box-shadow: none;
}

.dashboard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.toolbar-left .dashboard-switcher {
  margin-bottom: 0;
}

.dashboard-list-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-list-buttons .action-button {
  min-height: 40px;
  padding: 0 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dashboard-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
}

.dashboard-search-form .search-input {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: 6px 8px;
  width: 180px;
  outline: none;
}

.dashboard-search-form .search-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.dashboard-search-form .search-button {
  background: rgba(51, 198, 216, 0.12);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dashboard-search-form .search-button:hover {
  background: var(--accent);
  color: var(--bg);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn:not(.disabled):hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(51, 198, 216, 0.08);
}

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

.pagination-info {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.dashboard-panel[hidden] {
  display: none;
}

.industry-grid,
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.policy-map-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.industry-card,
.kpi-card {
  min-height: 158px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.kpi-card {
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.kpi-card:hover,
.kpi-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
  outline: none;
}

.kpi-card[data-kpi-code="01"],
.kpi-card[data-kpi-code="02"],
.kpi-card[data-kpi-code="03"],
.kpi-card[data-kpi-code="04"],
.kpi-card[data-kpi-code="05"],
.kpi-card[data-kpi-code="06"],
.kpi-card[data-kpi-code="07"] {
  background: linear-gradient(180deg, rgba(244, 143, 177, 0.22), rgba(20, 38, 49, 0.96));
}

.kpi-card[data-kpi-code="08"],
.kpi-card[data-kpi-code="09"],
.kpi-card[data-kpi-code="10"],
.kpi-card[data-kpi-code="11"] {
  background: linear-gradient(180deg, rgba(86, 166, 255, 0.20), rgba(20, 38, 49, 0.96));
}

.kpi-card[data-kpi-code="12"],
.kpi-card[data-kpi-code="13"],
.kpi-card[data-kpi-code="14"],
.kpi-card[data-kpi-code="15"],
.kpi-card[data-kpi-code="16"],
.kpi-card[data-kpi-code="17"] {
  background: linear-gradient(180deg, rgba(114, 227, 159, 0.20), rgba(20, 38, 49, 0.96));
}

.kpi-card[data-kpi-code="18"],
.kpi-card[data-kpi-code="19"],
.kpi-card[data-kpi-code="20"] {
  background: linear-gradient(180deg, rgba(241, 184, 80, 0.22), rgba(20, 38, 49, 0.96));
}

.industry-card {
  display: grid;
  align-content: center;
  gap: 10px;
}

.industry-card.policy-card {
  background: linear-gradient(180deg, rgba(51, 198, 216, 0.14), rgba(20, 38, 49, 0.96));
}

.map-card {
  position: relative;
  min-height: 172px;
  padding: 26px 18px 18px;
  border-color: rgba(71, 123, 148, 0.8);
  background: linear-gradient(180deg, rgba(18, 53, 63, 0.98), rgba(15, 35, 44, 0.98));
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
}


.map-card-mark {
  display: block;
  width: 28px;
  height: 28px;
  margin-bottom: 18px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: rgba(51, 198, 216, 0.08);
}

.map-card strong {
  line-height: 1.28;
}

.map-card small {
  margin-top: 8px;
}

.industry-card strong {
  font-size: 20px;
}

.industry-card.wide {
  min-height: 138px;
}

.industry-card small,
.kpi-card dt {
  color: var(--muted);
}

.tile-count {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent-2);
  font-weight: 800;
}

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

.compact-table {
  margin-top: 18px;
}

.score-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.score-table th,
.score-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.score-table th {
  color: var(--muted);
  font-size: 13px;
}

.ticker-map {
  display: grid;
  gap: 18px;
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.ticker-map-group {
  display: grid;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(41, 72, 90, 0.7);
}

.ticker-map-group:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.ticker-map-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
}

.ticker-map-label::before {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 900;
  content: attr(class);
}

.ticker-map-label.red {
  color: #ffdfdf;
}

.ticker-map-label.gray {
  color: #d6dde2;
}

.ticker-map-label.red::before {
  background: #c90010;
  content: "A";
}

.ticker-map-label.gray::before {
  background: #656b70;
  content: "B";
}

.ticker-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.ticker-pill {
  display: inline-flex;
  min-width: 78px;
  min-height: 34px;
  justify-content: center;
  align-items: center;
  padding: 6px 14px;
  border-radius: 9px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 4px 10px rgba(0, 0, 0, 0.22);
}

.ticker-pill.red {
  border: 1px solid rgba(255, 120, 120, 0.55);
  background: linear-gradient(180deg, #d70b16, #a8000d);
}

.ticker-pill.gray {
  border: 1px solid rgba(208, 216, 222, 0.35);
  background: linear-gradient(180deg, #747b80, #4e5357);
}

.empty-pill {
  color: var(--muted);
}

.stock-link,
.total-score {
  color: var(--accent-2);
  font-weight: 800;
}

.score-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 18px;
}

.score-strip > span {
  min-width: 188px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.score-strip .total {
  min-width: 112px;
  min-height: auto;
  padding-top: 16px;
  border-color: var(--accent-2);
}

.score-strip small {
  display: block;
  color: var(--muted);
  font-weight: 600;
}

.score-strip strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
}

.score-strip .total strong {
  margin-top: 10px;
  font-size: 34px;
}

.policy-info-strip {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(130px, 1fr) minmax(130px, 1fr);
  gap: 14px;
  flex: 1 1 520px;
  margin-left: auto;
}

.policy-info-block {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.policy-info-block small {
  display: block;
  color: var(--muted);
  font-weight: 600;
}

.policy-info-block strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.policy-info-block.benefit strong {
  color: #2ed573;
}

@media (max-width: 720px) {
  .policy-info-strip {
    grid-template-columns: 1fr;
    flex-basis: 100%;
    margin-left: 0;
  }
}

.star-row {
  display: flex;
  gap: 1px;
  margin-top: 12px;
  color: var(--accent-2);
  font-size: 18px;
  line-height: 1;
}

.star {
  position: relative;
  display: inline-block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  -webkit-text-stroke: 1px var(--accent-2);
}

.star.full {
  color: var(--accent-2);
}

.star.empty {
  color: transparent;
}

.star.half::before {
  position: absolute;
  inset: 0;
  width: 50%;
  overflow: hidden;
  color: var(--accent-2);
  content: "★";
  -webkit-text-stroke: 0;
}

.backtest-panel {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.backtest-panel[hidden] {
  display: none;
}

.backtest-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.backtest-summary > span {
  min-width: 128px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.backtest-summary small,
.backtest-status {
  display: block;
  color: var(--muted);
}

.backtest-summary strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 18px;
}

.backtest-status {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.backtest-charts {
  display: grid;
  gap: 14px;
}

.backtest-chart {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c171e;
}

.backtest-chart h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.backtest-chart svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(41, 72, 90, 0.72);
  border-radius: 8px;
  background: #081218;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

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

.chart-legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 99px;
}

.kpi-card h2 {
  min-height: 44px;
  margin: 14px 0;
  font-size: 18px;
}

.kpi-style-toolbar {
  width: 100%;
}

.kpi-style-toolbar > span {
  padding: 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 620;
}

.kpi-grid[data-kpi-style-root] {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

@media (min-width: 992px) {
  .kpi-grid[data-kpi-style-root] {
    grid-template-columns: repeat(5, 1fr);
  }
}

.kpi-grid[data-kpi-style-root] .kpi-card {
  min-height: 320px;
  padding: 20px 14px 16px;
  border-radius: 8px;
  color: #f7fbff;
  background: linear-gradient(180deg, rgba(67, 49, 65, 0.92) 0%, rgba(22, 45, 55, 0.96) 100%);
  font-feature-settings: "tnum";
}

.kpi-grid[data-kpi-style-root] .kpi-head {
  align-items: flex-start;
  color: inherit;
}

.kpi-grid[data-kpi-style-root] .kpi-head span {
  color: rgba(247, 251, 255, 0.86);
}

.kpi-grid[data-kpi-style-root] .kpi-head strong {
  position: relative;
  border-bottom: 0;
}

.kpi-grid[data-kpi-style-root] .kpi-head strong::after {
  position: absolute;
  right: 0;
  bottom: -6px;
  width: 100%;
  height: 1px;
  border-radius: 99px;
  background: rgba(50, 212, 232, 0.9);
  content: "";
}

.kpi-grid[data-kpi-style-root] .metric-value {
  margin-top: 12px;
  margin-bottom: 12px;
  color: #ffffff;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
}

.kpi-grid[data-kpi-style-root] .status-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(69, 181, 133, 0.16);
  color: #62f2a4;
  font-size: 11px;
}

.kpi-grid[data-kpi-style-root] .status-pill.alert {
  background: rgba(255, 129, 125, 0.13);
  color: #ff9d98;
}

.kpi-grid[data-kpi-style-root] .card-hint {
  margin-top: 14px;
  color: #9edbf3;
  font-size: 11px;
}

.kpi-card.tech-style {
  border-color: rgba(50, 212, 232, 0.46);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 46px rgba(14, 52, 66, 0.24);
  font-family: Sora, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.kpi-card.tech-style .kpi-head span {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.kpi-card.tech-style .kpi-head strong {
  font-size: 20px;
  font-weight: 800;
  text-shadow: 0 0 15px rgba(75, 220, 255, 0.18);
}

.kpi-card.tech-style .kpi-head strong::after {
  height: 2px;
  background: #32d4e8;
  box-shadow: 0 0 8px rgba(50, 212, 232, 0.45);
}

.kpi-card.tech-style h2 {
  margin-top: 16px;
  margin-bottom: 16px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.22;
}

.kpi-card.tech-style .metric-value {
  font-size: 30px;
  font-weight: 800;
}

.kpi-card.finance-style {
  border-color: rgba(80, 190, 215, 0.35);
  font-family: "IBM Plex Sans", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.kpi-card.finance-style .kpi-head span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.kpi-card.finance-style .kpi-head strong {
  font-size: 20px;
  font-weight: 700;
}

.kpi-card.finance-style h2 {
  margin-top: 16px;
  margin-bottom: 16px;
  color: #f8fafc;
  font-size: 15px;
  font-weight: 560;
  line-height: 1.22;
}

.kpi-card.finance-style .metric-value {
  font-size: 30px;
  font-weight: 750;
}

.kpi-card.luxury-style {
  border-color: rgba(169, 215, 233, 0.26);
  background: linear-gradient(180deg, rgba(43, 48, 55, 0.94) 0%, rgba(16, 30, 36, 0.98) 100%);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.18);
  font-family: Manrope, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.kpi-card.luxury-style .kpi-head span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.kpi-card.luxury-style .kpi-head strong {
  font-size: 19px;
  font-weight: 700;
}

.kpi-card.luxury-style .kpi-head strong::after {
  bottom: -7px;
  background: rgba(50, 212, 232, 0.65);
}

.kpi-card.luxury-style h2 {
  margin-top: 20px;
  margin-bottom: 20px;
  color: rgba(255, 255, 255, 0.96);
  font-size: 14px;
  font-weight: 540;
  line-height: 1.3;
}

.kpi-card.luxury-style .metric-value {
  color: rgba(255, 255, 255, 0.94);
  font-size: 32px;
  font-weight: 650;
}

.kpi-card.luxury-style .status-pill {
  border-radius: 999px;
  background: rgba(67, 183, 132, 0.13);
  font-size: 11px;
}

.bullet-score {
  display: grid;
  gap: 6px;
  margin: 0 0 13px;
}

.bullet-labels,
.bullet-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.bullet-labels span:nth-child(2) {
  text-align: center;
}

.bullet-labels span:nth-child(3) {
  text-align: right;
}

.bullet-track {
  position: relative;
  height: 14px;
  overflow: hidden;
  border: 1px solid rgba(237, 247, 251, 0.16);
  border-radius: 3px;
  background: #081218;
}

.bullet-range {
  position: absolute;
  top: 0;
  bottom: 0;
}

.bullet-range.low {
  left: 0;
  width: 33.333%;
  background: repeating-linear-gradient(90deg, rgba(255, 129, 125, 0.18) 0 2px, rgba(255, 129, 125, 0.04) 2px 4px);
}

.bullet-range.mid {
  left: 33.333%;
  width: 33.333%;
  background: repeating-linear-gradient(90deg, rgba(241, 184, 80, 0.24) 0 2px, rgba(241, 184, 80, 0.05) 2px 4px);
}

.bullet-range.high {
  left: 66.666%;
  width: 33.334%;
  background: repeating-linear-gradient(90deg, rgba(114, 227, 159, 0.24) 0 2px, rgba(114, 227, 159, 0.05) 2px 4px);
}

.bullet-value {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  min-width: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #33c6d8, #edf7fb);
}

.bullet-average {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--accent-2);
  transform: translateX(-1px);
}

.bullet-meta {
  grid-template-columns: 1fr auto;
}

.bullet-meta span:last-child {
  color: var(--accent-2);
}

.kpi-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--accent);
  font-weight: 800;
}

.kpi-head strong {
  padding-bottom: 3px;
  border-bottom: 2px solid currentColor;
  font-size: 22px;
  line-height: 1;
}

.metric-value {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-block;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 129, 125, 0.14);
  color: var(--danger);
  overflow-wrap: anywhere;
}

.status-pill.ok {
  background: rgba(114, 227, 159, 0.14);
  color: var(--ok);
}

.card-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
}

.modal-backdrop[hidden] {
  display: none;
}

.kpi-modal {
  width: min(760px, 100%);
  max-height: min(760px, 88vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
}

.kpi-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.kpi-modal-head h2 {
  margin: 0;
  font-size: 22px;
}

.modal-close {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-soft);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.kpi-modal-body {
  margin: 0;
  padding: 18px 20px 22px;
}

.kpi-modal-body dt {
  margin: 0 0 7px;
  color: var(--accent);
  font-weight: 800;
}

.kpi-modal-body dd {
  margin: 0 0 18px;
  color: var(--text);
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.empty-state {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

@media (max-width: 720px) {
  .topbar,
  .hero,
  .page-header,
  .section-head {
    display: grid;
  }

  .topbar {
    gap: 12px;
    padding: 12px 16px;
  }

  .stock-actions {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-switcher,
  .kpi-style-toolbar {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }
}

/* Theme Switcher Controls */
.theme-switcher {
  display: inline-flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.theme-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.theme-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.theme-btn.active {
  background: var(--accent);
  color: #071016;
  font-weight: 700;
}

/* Default Theme: Classic Dark Tech Blue */
[data-theme="default"] body {
  background-color: var(--bg);
  background-image: none;
}

/* Theme 1: Sakura & Shinobu */
[data-theme="sakura"] {
  --bg: #120610;
  --panel: rgba(35, 10, 26, 0.42);
  --panel-soft: rgba(55, 15, 40, 0.48);
  --line: rgba(255, 122, 162, 0.30);
  --text: #ffffff;
  --muted: #ffc4e0;
  --accent: #ff7aa2;
  --accent-2: #ffb86c;
  --danger: #ff5555;
  --ok: #50fa7b;
}

[data-theme="sakura"] body {
  background-color: var(--bg);
  background-image: linear-gradient(180deg, rgba(15, 6, 15, 0.35), rgba(24, 8, 28, 0.50)), url('sakura_shinobu_bg.png');
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
}

[data-theme="sakura"] .topbar {
  background: rgba(18, 6, 16, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

[data-theme="sakura"] .industry-card,
[data-theme="sakura"] .dashboard-panel,
[data-theme="sakura"] .page-shell,
[data-theme="sakura"] .backtest-chart,
[data-theme="sakura"] .table-wrap {
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 122, 162, 0.12);
}

[data-theme="sakura"] .industry-card:hover {
  background: rgba(55, 15, 42, 0.58);
  border-color: rgba(255, 122, 162, 0.6);
  box-shadow: 0 10px 35px rgba(255, 122, 162, 0.25);
}

[data-theme="sakura"] .industry-card strong {
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

[data-theme="sakura"] .industry-card small,
[data-theme="sakura"] .panel-desc {
  color: #ffd2e6;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

/* Theme 2: Space & Orion */
[data-theme="space"] {
  --bg: #040710;
  --panel: rgba(8, 16, 36, 0.38);
  --panel-soft: rgba(14, 26, 54, 0.45);
  --line: rgba(56, 189, 248, 0.30);
  --text: #ffffff;
  --muted: #bae6fd;
  --accent: #38bdf8;
  --accent-2: #fbbf24;
  --danger: #f87171;
  --ok: #34d399;
}

[data-theme="space"] body {
  background-color: var(--bg);
  background-image: linear-gradient(180deg, rgba(4, 7, 16, 0.30), rgba(8, 14, 28, 0.45)), url('orion_space_bg.png');
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
}

[data-theme="space"] .topbar {
  background: rgba(4, 7, 16, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

[data-theme="space"] .industry-card,
[data-theme="space"] .backtest-chart {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.12);
}

[data-theme="space"] .page-shell,
[data-theme="space"] .section,
[data-theme="space"] .dashboard-panel {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
}

[data-theme="space"] .table-wrap {
  background: rgba(15, 23, 42, 0.35) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: none !important;
}

[data-theme="space"] .industry-card:hover {
  background: rgba(14, 28, 58, 0.58);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 10px 35px rgba(56, 189, 248, 0.25);
}

[data-theme="space"] .industry-card strong {
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

[data-theme="space"] .industry-card small,
[data-theme="space"] .panel-desc {
  color: #c7d2fe;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
