.stock-portfolio-page {
  max-width: 1540px;
  margin: 0 auto;
  padding: 14px 18px;
  color: #172033;
}

.stock-portfolio-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.stock-portfolio-toolbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
  color: #111827;
}

.stock-portfolio-status {
  margin-top: 6px;
  min-height: 16px;
  color: #667085;
  font-size: 13px;
}

.market-index-strip {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.market-index-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #dfe5ee;
  background: #f8fafc;
  border-left: 3px solid #dfe5ee;
  flex: 0 0 auto;
  white-space: nowrap;
}

.market-index-item.stock-positive {
  border-left-color: #d92d20;
  background: #fffbfa;
}

.market-index-item.stock-negative {
  border-left-color: #1d4ed8;
  background: #fafbff;
}

.market-index-item.is-loading .market-index-value {
  color: #98a2b3;
}

.market-index-name {
  font-size: 12px;
  font-weight: 800;
  color: #667085;
}

.market-index-value {
  font-size: 15px;
  font-weight: 900;
  color: #111827;
}

.market-index-change {
  font-size: 13px;
  font-weight: 800;
}

.stock-portfolio-actions,
.stock-add-form {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.stock-select-label,
.stock-add-form label {
  display: grid;
  gap: 5px;
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
}

.stock-select-label select,
.stock-add-form input,
.stock-add-form select {
  min-height: 38px;
  border: 1px solid #d7dce5;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  padding: 0 10px;
  font: inherit;
  font-size: 14px;
  outline: none;
}

.stock-add-form input:focus,
.stock-add-form select:focus,
.stock-select-label select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.portfolio-btn {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.portfolio-btn.primary {
  background: #1f2937;
  color: #fff;
  border-color: #1f2937;
}

.portfolio-btn.primary:hover {
  background: #111827;
}

.portfolio-btn.secondary {
  background: #fff;
  color: #1f2937;
  border-color: #d7dce5;
}

.portfolio-btn.secondary:hover {
  border-color: #9aa4b2;
}

.portfolio-btn.danger {
  background: #fff;
  color: #b42318;
  border-color: #f3b6b0;
}

.stock-summary-grid {
  margin-bottom: 10px;
}

.stock-summary-hero {
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 12px;
  padding: 16px 20px 14px;
}

.summary-hero-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.summary-hero-label small {
  font-size: 11px;
  color: #98a2b8;
  font-weight: 400;
}

.summary-hero-value {
  font-size: 26px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.summary-hero-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  border-top: 1px solid #f2f4f7;
  padding-top: 10px;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-stat span {
  color: #8a94a8;
  font-size: 11px;
  font-weight: 600;
}

.summary-stat strong {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}

.portfolio-ai-comment {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f0f4ff;
  border: 1px solid #c7d6f7;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #1e3a8a;
  line-height: 1.65;
}

.portfolio-ai-comment.is-loading .ai-comment-body {
  opacity: 0.55;
}

.ai-comment-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  color: #3b82f6;
}

.ai-comment-body {
  flex: 1;
  min-width: 0;
}

.ai-comment-refresh {
  flex-shrink: 0;
  background: none;
  border: 1px solid #bfd1f5;
  border-radius: 6px;
  color: #3b82f6;
  font-size: 14px;
  padding: 2px 6px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}

.ai-comment-refresh:hover {
  background: #dbeafe;
}

.market-watch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.market-watch-card {
  min-height: 255px;
  border: 1px solid #dfe5ee;
  border-left: 3px solid #dfe5ee;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 6px;
  transition: border-color 0.2s, background 0.2s;
}

.market-watch-card.stock-positive {
  border-left-color: #d92d20;
  background: #fffbfa;
}

.market-watch-card.stock-negative {
  border-left-color: #1d4ed8;
  background: #fafbff;
}

.market-watch-card.is-loading {
  color: #667085;
  align-content: start;
  gap: 10px;
}

.watch-skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, #eef1f5 25%, #e2e6ec 37%, #eef1f5 63%);
  background-size: 400% 100%;
  animation: watch-skeleton-shimmer 1.4s ease infinite;
}

.watch-skeleton-title {
  width: 55%;
  height: 16px;
}

.watch-skeleton-price {
  width: 75%;
  height: 26px;
}

.watch-skeleton-chart {
  width: 100%;
  height: 112px;
}

@keyframes watch-skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.watch-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.watch-title {
  color: #111827;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.25;
}

.watch-code,
.watch-time,
.watch-meta {
  color: #667085;
  font-size: 12px;
}

.watch-price {
  color: #111827;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0;
}

.watch-change {
  font-size: 14px;
  font-weight: 900;
}

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

.watch-metric {
  border: 1px solid #edf1f6;
  border-radius: 6px;
  padding: 6px 8px;
  background: #f8fafc;
}

.watch-metric span,
.compare-panel-head span {
  display: block;
  color: #667085;
  font-size: 11px;
  font-weight: 800;
}

.watch-metric strong {
  display: block;
  margin-top: 4px;
  color: #172033;
  font-size: 12px;
  line-height: 1.2;
}

.watch-chart-box {
  width: 100%;
  height: 112px;
  min-height: 112px;
  position: relative;
  background: #fbfdff;
  border-radius: 6px;
  border: 1px solid #edf1f6;
  padding: 8px;
}

.watch-chart-box canvas,
.compare-chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.watch-chart-empty {
  height: 112px;
  display: grid;
  place-items: center;
  border: 1px dashed #d7dce5;
  border-radius: 6px;
  color: #7a8494;
  font-size: 12px;
  background: #f8fafc;
}

.portfolio-compare-panel {
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.compare-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.compare-panel-head h2 {
  margin: 0;
  color: #111827;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: 0;
}

.compare-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: #526071;
  font-size: 12px;
  font-weight: 800;
}

.compare-toggle-text {
  margin-left: 8px;
  color: #1d4ed8;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.legend-dot.samsung {
  background: #0f766e;
}

.legend-dot.hynix {
  background: #1d4ed8;
}

.compare-chart-box {
  width: 100%;
  height: 170px;
  min-height: 170px;
  position: relative;
}

.portfolio-compare-panel.is-collapsed .compare-chart-box,
.portfolio-compare-panel.is-collapsed .compare-extra-chips,
.portfolio-compare-panel.is-collapsed .compare-theme-row,
.portfolio-compare-panel.is-collapsed .compare-news {
  display: none;
}

.compare-news {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 14px 14px;
}

.compare-news-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #344054;
  text-decoration: none;
  overflow: hidden;
}

.compare-news-item:hover .compare-news-title {
  color: #2563eb;
  text-decoration: underline;
}

.compare-news-item strong {
  flex-shrink: 0;
}

.compare-news-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #667085;
}

.compare-news-trend {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #475467;
  background: #f2f4f7;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}

.compare-news-momentum {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #b54708;
  background: #fef0e6;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}

.compare-news-empty {
  padding: 4px 14px 10px;
  font-size: 12px;
  color: #98a2b8;
}

.compare-extra-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px 0;
}

.compare-extra-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--chip-color) 12%, #fff);
  border: 1px solid var(--chip-color);
  color: var(--chip-color);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 4px 2px 10px;
}

.compare-extra-chip .chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.compare-extra-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}

.compare-theme-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 14px 0;
}

.compare-theme-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compare-theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--chip-color) 10%, #fff);
  border: 1.5px dashed var(--chip-color);
  color: var(--chip-color);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 4px 2px 10px;
}

.compare-theme-chip .chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.compare-theme-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}

.compare-theme-add {
  display: flex;
  gap: 6px;
  align-items: center;
}

.compare-theme-add input[type="search"] {
  flex: 1 1 180px;
  min-width: 0;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: #344054;
  background: #fff;
}

.compare-theme-add input[type="search"]:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.domestic-market-panel {
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  margin-bottom: 10px;
}

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

.domestic-market-head h2 {
  margin: 0;
  color: #111827;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: 0;
}

.domestic-market-head span {
  display: block;
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.domestic-market-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.domestic-market-controls input,
.domestic-market-controls select {
  min-height: 36px;
  border: 1px solid #d7dce5;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  outline: none;
}

.domestic-market-controls input {
  width: 220px;
}

.domestic-market-controls input:focus,
.domestic-market-controls select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.domestic-market-table-wrap {
  max-height: 300px;
  overflow: auto;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
}

.domestic-market-insight {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
}

.domestic-market-insight > * {
  min-width: 0;
}

.market-insight-loading {
  color: #667085;
  font-size: 13px;
}

.market-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.market-overview-card {
  border: 1px solid #edf1f6;
  border-radius: 6px;
  background: #f8fafc;
  padding: 9px 10px;
  min-width: 0;
}

.market-overview-card span,
.market-overview-card small {
  display: block;
  color: #667085;
  font-size: 11px;
  font-weight: 800;
}

.market-overview-card strong {
  display: block;
  margin-top: 4px;
  color: #111827;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: 0;
}

.market-overview-card small {
  margin-top: 3px;
  font-weight: 700;
}

.market-ai-commentary {
  padding: 10px 12px;
  border: 1px solid #d0e3ff;
  border-radius: 8px;
  background: #f5f9ff;
}

.market-ai-commentary h3 {
  margin: 0 0 6px;
  color: #1849a9;
  font-size: 14px;
}

.market-ai-commentary p {
  margin: 0;
  color: #344054;
  font-size: 13px;
  line-height: 1.5;
}

.market-ai-commentary-time {
  display: block;
  margin-top: 6px;
  color: #98a2b3;
  font-size: 11px;
}

.market-top-picks h3 {
  margin: 0 0 8px;
  color: #111827;
  font-size: 14px;
}

.market-top-picks-empty {
  color: #98a2b3;
  font-size: 12px;
  background: #f9fafb;
  border: 1px solid #eaecf0;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.market-top-picks-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.market-top-pick-card {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  border: 1px solid #eaecf0;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
}

.market-top-pick-card:hover {
  background: #f8fafc;
  border-color: #d0d5dd;
}

.market-top-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.market-top-pick-head strong {
  font-size: 13px;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-top-pick-head em {
  font-style: normal;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}

.market-top-pick-reason,
.market-top-pick-news {
  display: block;
  font-size: 11px;
  color: #667085;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-top-pick-news {
  color: #475467;
}

.market-top-picks-warn {
  margin: 12px 0 8px;
  color: #b42318;
  font-size: 14px;
}

.market-top-pick-card.is-down {
  border-color: #fda29b;
  background: #fffbfa;
}

.market-top-pick-card.is-down:hover {
  background: #fef3f2;
  border-color: #f04438;
}

.market-extra-stats {
  margin-top: 12px;
  border: 1px solid #eaecf0;
  border-radius: 8px;
  padding: 8px 12px;
  background: #f9fafb;
}

.market-extra-stats summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #344054;
  padding: 4px 0;
  list-style: none;
}

.market-extra-stats summary::-webkit-details-marker {
  display: none;
}

.market-extra-stats[open] summary {
  margin-bottom: 8px;
}

.market-signal-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #667085;
  margin-bottom: 8px;
}

.market-signal-accuracy,
.market-backtest {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #344054;
  background: #f9fafb;
  border: 1px solid #eaecf0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.market-signal-accuracy-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  color: #98a2b3;
  text-align: center;
}

.market-chart-box {
  position: relative;
  height: 150px;
  width: 100%;
}

.market-rank-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 8px;
}

.market-rank-card {
  border: 1px solid #edf1f6;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
}

.market-rank-card h3 {
  margin: 0 0 6px;
  color: #111827;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0;
}

.market-rank-list {
  display: grid;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
}

.market-rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: #f8fafc;
  padding: 5px 7px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.market-rank-item:hover {
  background: #eef4ff;
}

.market-rank-item span,
.market-rank-item strong,
.market-rank-item small {
  display: block;
  min-width: 0;
}

.market-rank-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #111827;
  font-size: 12px;
  font-weight: 900;
}

.market-rank-item small {
  margin-top: 1px;
  color: #667085;
  font-size: 11px;
}

.market-rank-item em {
  flex: 0 0 auto;
  color: #172033;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.market-rank-empty {
  color: #667085;
  font-size: 12px;
}

.market-rank-item-wrap {
  display: grid;
  gap: 2px;
}

.market-rank-news {
  display: block;
  overflow: hidden;
  padding: 0 7px;
  color: #4b5a76;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.market-rank-news:hover {
  color: #2563eb;
  text-decoration: underline;
}

.stock-analysis-panel {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
  margin-bottom: 10px;
}

.stock-analysis-panel.is-empty {
  border-style: dashed;
  background: #fff;
}

.stock-analysis-placeholder {
  color: #667085;
  font-size: 13px;
}

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

.stock-analysis-head h3 {
  margin: 0;
  color: #111827;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0;
}

.stock-analysis-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

.stock-analysis-head span {
  display: block;
  margin-top: 3px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.analysis-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 7px;
  margin-bottom: 8px;
}

.analysis-card {
  border: 1px solid #edf1f6;
  border-radius: 6px;
  background: #fff;
  padding: 8px 9px;
}

.analysis-card span,
.analysis-card small {
  display: block;
  color: #667085;
  font-size: 11px;
  font-weight: 800;
}

.analysis-card strong {
  display: block;
  margin-top: 4px;
  color: #111827;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0;
}

.analysis-card small {
  margin-top: 3px;
  font-weight: 700;
}

.analysis-card strong.stock-positive,
.market-overview-card strong.stock-positive {
  color: #d92d20;
}

.analysis-card strong.stock-negative,
.market-overview-card strong.stock-negative {
  color: #1d4ed8;
}

.analysis-body-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.4fr) minmax(240px, .8fr);
  gap: 8px;
}

.analysis-chart-wrap {
  height: 190px;
  min-height: 190px;
  border: 1px solid #edf1f6;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  position: relative;
}

.analysis-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.analysis-signal-box {
  border: 1px solid #edf1f6;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
}

.analysis-signal-box h4 {
  margin: 0 0 6px;
  color: #111827;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0;
}

.analysis-signal {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-radius: 5px;
  padding: 6px 7px;
  margin-top: 5px;
  background: #f8fafc;
  color: #172033;
}

.analysis-signal span {
  color: #667085;
  font-size: 11px;
  font-weight: 800;
}

.analysis-signal strong {
  color: #111827;
  font-size: 12px;
  text-align: right;
}

.analysis-signal.good {
  background: #ecfdf3;
}

.analysis-signal.warn {
  background: #fffaeb;
}

.analysis-signal.risk {
  background: #fef3f2;
}

.domestic-market-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
}

.domestic-market-table th,
.domestic-market-table td {
  padding: 7px 9px;
  border-bottom: 1px solid #edf1f6;
  text-align: right;
  vertical-align: middle;
  font-size: 13px;
}

.domestic-market-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #526071;
  font-size: 12px;
  font-weight: 900;
}

.domestic-market-table th:first-child,
.domestic-market-table td:first-child {
  width: 220px;
  text-align: left;
}

.domestic-stock-pick {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.domestic-stock-pick strong,
.domestic-stock-pick span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domestic-stock-pick strong {
  color: #111827;
  font-weight: 900;
}

.domestic-stock-pick span {
  margin-top: 2px;
  color: #667085;
  font-size: 12px;
}

.domestic-stock-pick:hover strong {
  color: #1d4ed8;
}

.stock-theme-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.stock-theme-tag {
  display: inline-block;
  border-radius: 4px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.6;
  padding: 0 5px;
  white-space: nowrap;
}

.market-rank-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.market-rank-signal {
  display: inline-block;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.7;
  padding: 0 7px;
  white-space: nowrap;
}

.market-rank-signal.is-strong {
  background: #12b76a;
  color: #fff;
}

.market-rank-signal.is-mid {
  background: #f79009;
  color: #fff;
}

.market-rank-signal.is-low {
  background: #f2f4f7;
  color: #667085;
}

.market-rank-signal.is-down {
  background: #f04438;
  color: #fff;
}

.market-rank-item-wrap.has-is-strong {
  border-left: 3px solid #12b76a;
  background: #f6fef9;
}

.market-rank-item-wrap.has-is-mid {
  border-left: 3px solid #f79009;
  background: #fffaf2;
}

.portfolio-holdings-panel {
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: #fff;
  padding: 0 0 8px;
  margin-bottom: 10px;
}

.holdings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
}

.holdings-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #111827;
}

.holdings-add-toggle {
  font-size: 12px;
  padding: 5px 12px;
}

.holdings-cards {
  display: flex;
  flex-direction: column;
}

.holding-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid #f2f4f7;
  gap: 12px;
}

.holding-card:first-child {
  border-top: none;
}

.holding-card-left {
  flex: 1;
  min-width: 0;
}

.holding-name {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.holding-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-size: 12px;
  color: #667085;
}

.holding-meta-sep {
  color: #d0d5dd;
}

.holding-card-right {
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  position: relative;
  padding-right: 28px;
}

.holding-value {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

.holding-gain {
  font-size: 12px;
  font-weight: 600;
}

.holding-delete-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #d0d5dd;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.holding-delete-btn:hover {
  color: #ef4444;
}

.holdings-add-form-wrap {
  padding: 12px 16px 4px;
  border-top: 1px solid #f2f4f7;
}

.holdings-add-form-wrap[hidden] {
  display: none;
}

.stock-summary-card {
  min-height: 72px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.stock-summary-card span {
  display: block;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.stock-summary-card strong {
  display: block;
  margin-top: 5px;
  color: #111827;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: 0;
}

.stock-summary-card small {
  display: block;
  margin-top: 4px;
  color: #7a8494;
  font-size: 12px;
}

.stock-add-form {
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
  margin-bottom: 10px;
}

.stock-add-form label:first-child {
  min-width: 210px;
}

.stock-add-form label {
  min-width: 130px;
}

.stock-quick-buttons {
  display: flex;
  align-items: end;
  gap: 6px;
  flex-wrap: wrap;
}

.stock-quick-buttons button {
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #172033;
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.stock-quick-buttons button:hover {
  border-color: #2563eb;
  color: #1d4ed8;
}

.stock-table-wrap {
  overflow-x: auto;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #fff;
}

.stock-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

.stock-table th,
.stock-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #edf1f6;
  text-align: right;
  vertical-align: middle;
  font-size: 14px;
}

.stock-table th {
  background: #f8fafc;
  color: #526071;
  font-size: 12px;
  font-weight: 900;
}

.stock-table th:first-child,
.stock-table td:first-child {
  text-align: left;
  width: 210px;
}

.stock-table th:last-child,
.stock-table td:last-child {
  width: 82px;
}

.stock-symbol strong {
  display: block;
  color: #111827;
  font-size: 14px;
  line-height: 1.25;
}

.stock-symbol span {
  display: block;
  margin-top: 3px;
  color: #7a8494;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-row-input {
  width: 112px;
  height: 34px;
  border: 1px solid #d7dce5;
  border-radius: 6px;
  padding: 0 8px;
  text-align: right;
  font: inherit;
  color: #111827;
}

.stock-row-input:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.stock-number-muted {
  color: #7a8494;
}

/* 국내 증시 관례: 상승=빨강, 하락=파랑 (미국식 초록/빨강 반대) */
.stock-positive {
  color: #d92d20;
}

.stock-negative {
  color: #1d4ed8;
}

.stock-empty {
  display: none;
  margin-top: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  color: #526071;
}

.stock-empty strong,
.stock-empty span {
  display: block;
}

.stock-empty span {
  margin-top: 5px;
  font-size: 13px;
}

@media (max-width: 980px) {
  .stock-portfolio-page {
    padding: 14px;
  }

  .stock-portfolio-toolbar {
    display: grid;
  }

  .summary-hero-value {
    font-size: 22px;
  }

  .market-watch-grid {
    grid-template-columns: 1fr;
  }

  .compare-panel-head {
    display: grid;
  }

  .domestic-market-head {
    display: grid;
  }

  .domestic-market-controls {
    justify-content: flex-start;
  }

  .market-overview-grid,
  .market-rank-grid,
  .analysis-card-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .analysis-body-grid {
    grid-template-columns: 1fr;
  }

  .stock-add-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: end;
  }

  .stock-add-form label,
  .stock-add-form label:first-child,
  .stock-quick-buttons {
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .market-watch-grid,
  .stock-add-form {
    grid-template-columns: 1fr;
  }

  .summary-hero-value {
    font-size: 20px;
  }

  .summary-hero-stats {
    gap: 14px;
  }

  .stock-portfolio-actions {
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  .stock-portfolio-actions > * {
    flex: 0 0 auto;
  }

  .stock-portfolio-actions select {
    font-size: 12px;
    padding: 5px 6px;
  }

  .stock-portfolio-actions .portfolio-btn {
    font-size: 12px;
    padding: 6px 12px;
  }

  .market-watch-card {
    min-height: 0;
  }

  .watch-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .watch-metric {
    padding: 5px 6px;
  }

  .watch-metric span {
    font-size: 10px;
  }

  .watch-metric strong {
    font-size: 12px;
  }

  .portfolio-holdings-panel > summary {
    display: grid;
    align-content: center;
    gap: 3px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .portfolio-holdings-panel > summary::after {
    margin-left: 0;
  }

  .domestic-market-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .domestic-market-controls input {
    width: auto;
    grid-column: 1 / -1;
  }

  .domestic-market-controls .portfolio-btn {
    grid-column: 1 / -1;
  }

  .market-overview-grid,
  .market-rank-grid,
  .analysis-card-grid {
    grid-template-columns: 1fr;
  }

  .stock-analysis-head {
    display: grid;
  }

  .watch-chart-box {
    height: 80px;
    min-height: 80px;
  }

  .watch-chart-empty {
    height: 80px;
  }

  /* 종목 테이블: 폰에서 시장·거래량·시가총액·거래시각 숨김, 종목·현재가·등락률만 표시 */
  .domestic-market-table {
    min-width: 0;
  }

  .domestic-market-table th:nth-child(2),
  .domestic-market-table td:nth-child(2),
  .domestic-market-table th:nth-child(5),
  .domestic-market-table td:nth-child(5),
  .domestic-market-table th:nth-child(6),
  .domestic-market-table td:nth-child(6),
  .domestic-market-table th:nth-child(7),
  .domestic-market-table td:nth-child(7) {
    display: none;
  }

  .domestic-market-table th:first-child,
  .domestic-market-table td:first-child {
    width: auto;
    min-width: 0;
  }

  .domestic-stock-pick {
    gap: 2px;
  }

  .domestic-market-table-wrap {
    max-height: 420px;
  }
}
