@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;600;700;800&display=swap');

html {
  font-size: 120%; /* Scales all rem-based typography and layout ratios up by 20% globally */
}

:root {
  --bg-gradient: radial-gradient(circle at 50% 0%, #0d1527 0%, #050814 100%);
  --card-bg: rgba(10, 17, 34, 0.65);
  --card-border: rgba(255, 255, 255, 0.07);
  --card-border-glow: rgba(0, 210, 255, 0.15);
  
  --neon-blue: #00d2ff;
  --neon-purple: #a155ff;
  --neon-pink: #ff007f;
  
  --text-main: #e2e8f0;
  --text-muted: #718096;
  --text-bright: #ffffff;
  
  --color-buy: #00f5d4;
  --color-sell: #ff007f;
  --color-hold: #ffb703;
  
  --font-outfit: 'Outfit', sans-serif;
  --font-inter: 'Inter', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-gradient);
  color: var(--text-main);
  font-family: var(--font-inter);
  min-height: 100vh;
  padding: 2rem 1.5rem;
  overflow-x: hidden;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Header Design */
header {
  text-align: center;
  position: relative;
  padding: 1.5rem 0;
  margin-bottom: 1rem;
}

header::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 250px;
  height: 80px;
  background: radial-gradient(circle, rgba(0, 210, 255, 0.25) 0%, transparent 70%);
  filter: blur(20px);
  z-index: -1;
}

header h1 {
  font-family: var(--font-outfit);
  font-weight: 800;
  font-size: 2.8rem;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 30%, var(--neon-blue) 70%, var(--neon-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

header p {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.5px;
}

header p span {
  color: var(--neon-blue);
  font-weight: 600;
}

/* Base Card / Glass Layout */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 1.75rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover {
  border-color: rgba(0, 210, 255, 0.2);
  box-shadow: 0 12px 40px 0 rgba(0, 210, 255, 0.05);
}

.card-title {
  font-family: var(--font-outfit);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
}

.card-title i {
  color: var(--neon-blue);
  filter: drop-shadow(0 0 5px rgba(0, 210, 255, 0.5));
}

/* TOP 10 Section */
.top-stocks-table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
}

.top-stocks-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.top-stocks-table th {
  padding: 1rem;
  font-family: var(--font-outfit);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-stocks-table td {
  padding: 1.1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.95rem;
}

.top-stocks-table tr {
  transition: background-color 0.2s ease;
}

.top-stocks-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.top-stocks-table tr:last-child td {
  border-bottom: none;
}

.rank-badge {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
}

tr:nth-child(1) .rank-badge { background: #ffd700; color: #000; }
tr:nth-child(2) .rank-badge { background: #c0c0c0; color: #000; }
tr:nth-child(3) .rank-badge { background: #cd7f32; color: #000; }

.stock-name-cell {
  font-weight: 600;
  color: var(--text-bright);
}

.stock-code-lbl {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.5rem;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}

.badge-buy { background: rgba(0, 245, 212, 0.12); color: var(--color-buy); border: 1px solid rgba(0, 245, 212, 0.2); }
.badge-sell { background: rgba(255, 0, 127, 0.12); color: var(--color-sell); border: 1px solid rgba(255, 0, 127, 0.2); }
.badge-hold { background: rgba(255, 183, 3, 0.12); color: var(--color-hold); border: 1px solid rgba(255, 183, 3, 0.2); }

.price-txt {
  font-family: monospace;
  font-weight: 600;
}

.indicator-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.pill {
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.pill.active {
  background: rgba(0, 210, 255, 0.08);
  border-color: rgba(0, 210, 255, 0.25);
  color: var(--neon-blue);
}

/* Split Layout for Search & Analysis */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Search Box Style */
.search-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Segmented Control Switch */
.segmented-control {
  display: flex;
  background: rgba(2, 6, 16, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.25rem;
  gap: 0.25rem;
}

.segment-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 7px;
  padding: 0.6rem 1rem;
  color: var(--text-muted);
  font-family: var(--font-outfit);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.segment-btn i {
  font-size: 0.85rem;
}

.segment-btn.active {
  background: linear-gradient(135deg, var(--neon-blue) 0%, var(--neon-purple) 100%);
  color: #02060f;
  box-shadow: 0 4px 12px rgba(0, 210, 255, 0.2);
}

.segment-btn:hover:not(.active) {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.03);
}

.search-input-group {
  display: flex;
  gap: 0.75rem;
}

.search-input-group input {
  flex: 1;
  background: rgba(2, 6, 16, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  font-family: var(--font-inter);
  font-size: 1rem;
  color: var(--text-bright);
  transition: all 0.25s ease;
  outline: none;
}

.search-input-group input:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.25);
}

.search-input-group button {
  background: linear-gradient(135deg, var(--neon-blue) 0%, var(--neon-purple) 100%);
  border: none;
  border-radius: 10px;
  padding: 0 1.5rem;
  color: #000;
  font-family: var(--font-outfit);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.25s ease;
}

.search-input-group button:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(0, 210, 255, 0.35);
}

.search-input-group button:active {
  transform: translateY(1px);
}

/* Live Terminal Panel */
.terminal-window {
  background: #02060f;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 1rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  color: #38bdf8;
  height: 180px;
  overflow-y: auto;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

.terminal-header {
  display: flex;
  gap: 5px;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 0.5rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #eab308; }
.dot-green { background: #22c55e; }

.terminal-log {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.log-line span {
  color: var(--text-muted);
}
.log-line.success { color: var(--color-buy); }
.log-line.error { color: var(--color-sell); }
.log-line.info { color: #38bdf8; }

/* Analysis Results Section */
.analysis-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.analysis-header h3 {
  font-family: var(--font-outfit);
  font-size: 1.5rem;
  color: var(--text-bright);
}

.analysis-header .status-badge {
  font-size: 0.9rem;
}

.visuals-container {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.5rem;
  align-items: center;
}

.donut-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
}

.chart-center-lbl {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: var(--font-outfit);
}

.chart-center-lbl .percent {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-bright);
}

.chart-center-lbl .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Dual Progress bars */
.gauge-bars-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.bar-label .label-buy { color: var(--color-buy); }
.bar-label .label-sell { color: var(--color-sell); }

.bar-track {
  width: 100%;
  height: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 8px rgba(255,255,255,0.2);
}

.bar-fill-buy {
  background: linear-gradient(90deg, #00b4d8, var(--color-buy));
  box-shadow: 0 0 10px rgba(0, 245, 212, 0.3);
}

.bar-fill-sell {
  background: linear-gradient(90deg, #b7094c, var(--color-sell));
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.3);
}

/* Checklist and Trading Guide */
.checklist-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 1.25rem;
}

.checklist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  padding-bottom: 0.6rem;
}

.checklist-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

.check-val {
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.check-val[style*="pointer"]:hover {
  transform: scale(1.05);
  filter: brightness(1.2);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.status-ok { background: rgba(0,245,212,0.1); color: var(--color-buy); }
.status-nok { background: rgba(255,0,127,0.1); color: var(--color-sell); }
.status-warn { background: rgba(255,183,3,0.1); color: var(--color-hold); }

/* Trading Guide Callout */
.trading-guide-box {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.05) 0%, rgba(161, 85, 255, 0.05) 100%);
  border: 1px solid rgba(0, 210, 255, 0.15);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.guide-target, .guide-stop {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.guide-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.guide-price {
  font-family: var(--font-outfit);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-bright);
}

.guide-target .guide-price { color: var(--neon-blue); }
.guide-stop .guide-price { color: var(--neon-pink); }

/* Sticky Disclaimer */
footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 1.5rem;
  line-height: 1.5;
}

/* Custom Scrollbar for Chrome, Safari, and Edge */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  background: #02060f;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--neon-blue) 0%, var(--neon-purple) 100%);
  border-radius: 6px;
  border: 3px solid #02060f;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--color-buy) 0%, var(--neon-blue) 100%);
}
::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, var(--color-buy) 0%, var(--neon-purple) 100%);
}

/* Custom Scrollbar for Firefox */
html {
  scrollbar-width: auto;
  scrollbar-color: var(--neon-blue) #02060f;
}

/* Pagination styling */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.2rem;
}
.page-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}
.page-btn:hover {
  background: rgba(0, 245, 212, 0.1);
  border-color: var(--neon-mint);
  color: #fff;
  box-shadow: 0 0 8px rgba(0, 245, 212, 0.3);
}
.page-btn.active {
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-mint));
  border-color: transparent;
  color: #0b0f19;
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.4);
}

/* Modal Popup Dialog Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 6, 16, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: rgba(11, 15, 25, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  width: 90%;
  max-width: 850px;
  padding: 2rem;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 245, 212, 0.15);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-family: var(--font-outfit);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-title span {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-bright);
}

.modal-body {
  position: relative;
  min-height: 480px;
}

.chart-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
}

#modalChart,
#splitChartUpper,
#splitChartLower {
  width: 100% !important;
  height: 100% !important;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#modalChart.loaded,
#splitChartUpper.loaded,
#splitChartLower.loaded {
  opacity: 1;
}

/* Allow hovering pill badges to signal clickable charts */
.top-stocks-table tbody tr td .pill {
  cursor: pointer;
}
.top-stocks-table tbody tr td .pill:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(0, 245, 212, 0.4);
  border-color: rgba(0, 245, 212, 0.6);
}

/* ==============================================================================
   KIS OpenAPI Trading Center Styles
   ============================================================================== */

.trading-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.trading-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .trading-grid {
    grid-template-columns: 1fr;
  }
}

.trading-col-left {
  display: flex;
  flex-direction: column;
}

.trading-col-right {
  display: flex;
  flex-direction: column;
}

.trading-panel-sub {
  background: rgba(2, 6, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.05);
  position: relative;
}

.trading-panel-sub.h-100 {
  height: 100%;
}

.sub-panel-title {
  font-family: var(--font-outfit);
  font-size: 1rem;
  font-weight: 600;
  color: var(--neon-blue);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sub-panel-title i {
  font-size: 0.9rem;
}

.form-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.kis-input, .kis-select {
  background: rgba(2, 6, 16, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-inter);
  font-size: 0.9rem;
  color: var(--text-bright);
  outline: none;
  transition: all 0.25s ease;
}

.kis-input:focus, .kis-select:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

.kis-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.02);
}

.kis-btn {
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.2rem;
  font-family: var(--font-outfit);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.25s ease;
}

.kis-btn.btn-primary {
  background: linear-gradient(135deg, var(--neon-blue) 0%, var(--neon-purple) 100%);
  color: #02060f;
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.25);
}

.kis-btn.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 210, 255, 0.35);
}

.kis-btn.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

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

.kis-btn.btn-order-buy {
  background: linear-gradient(135deg, #00f5d4 0%, #00b4d8 100%);
  color: #02060f;
  box-shadow: 0 4px 15px rgba(0, 245, 212, 0.25);
}

.kis-btn.btn-order-buy:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 245, 212, 0.35);
}

.kis-btn.btn-order-sell {
  background: linear-gradient(135deg, #ff007f 0%, #b7094c 100%);
  color: var(--text-bright);
  box-shadow: 0 4px 15px rgba(255, 0, 127, 0.25);
}

.kis-btn.btn-order-sell:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 0, 127, 0.35);
}

.kis-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
}

.kis-status-badge.connected {
  background: rgba(0, 245, 212, 0.1);
  color: var(--color-buy);
  border: 1px solid rgba(0, 245, 212, 0.2);
}

.kis-status-badge.disconnected {
  background: rgba(255, 0, 127, 0.1);
  color: var(--color-sell);
  border: 1px solid rgba(255, 0, 127, 0.2);
}

/* Key Credentials Status Dot */
.creds-status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-left: auto;
  position: relative;
}

.creds-status-dot.connected {
  background-color: var(--color-buy);
  box-shadow: 0 0 8px var(--color-buy);
}

.creds-status-dot.disconnected {
  background-color: var(--color-sell);
  box-shadow: 0 0 8px var(--color-sell);
}

/* Assets Balance Widgets */
.balance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.balance-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.bal-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.bal-label.font-buy {
  color: rgba(0, 245, 212, 0.75);
}

.bal-value {
  font-family: monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-bright);
}

.bal-value.font-buy {
  color: var(--color-buy);
}

/* Holdings balance table */
.holdings-table-wrapper {
  overflow-x: auto;
  max-height: 250px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.holdings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.holdings-table th {
  padding: 0.65rem 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-outfit);
  font-weight: 600;
  background: rgba(2, 6, 16, 0.7);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.holdings-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.holdings-table tr {
  transition: background-color 0.2s ease;
}

.holdings-table tr.holding-row:hover {
  background-color: rgba(0, 210, 255, 0.04);
  cursor: pointer;
}

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

.holding-name-cell {
  font-weight: 600;
  color: var(--text-bright);
}

.holding-code-lbl {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 0.08rem 0.25rem;
  border-radius: 3px;
  margin-left: 0.35rem;
}

.mod-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mod-btn:hover {
  background: rgba(0, 210, 255, 0.08);
  border-color: rgba(0, 210, 255, 0.3);
  color: var(--neon-blue);
}

.mod-btn.pct-btn {
  background: rgba(161, 85, 255, 0.05);
  border-color: rgba(161, 85, 255, 0.12);
  color: #c084fc;
}

.mod-btn.pct-btn:hover {
  background: rgba(161, 85, 255, 0.15);
  border-color: rgba(161, 85, 255, 0.4);
  color: #e9d5ff;
}

.clear-log-btn {
  transition: color 0.2s ease;
}

.clear-log-btn:hover {
  color: var(--neon-pink) !important;
}

/* Color Helper Utilities */
.text-buy {
  color: var(--color-buy) !important;
}
.text-sell {
  color: var(--color-sell) !important;
}
.text-hold {
  color: var(--color-hold) !important;
}

/* ==============================================================================
   Mobile & Tablet Responsive Adjustments (iPhone & Android Apps)
   ============================================================================== */

@media (max-width: 1024px) {
  body {
    padding: 1rem 0.5rem;
  }

  .container {
    gap: 1.25rem;
  }

  header {
    padding: 1rem 0;
    margin-bottom: 0.5rem;
  }

  header h1 {
    font-size: 2rem;
  }

  header p {
    font-size: 0.85rem;
    word-break: keep-all;
  }

  .glass-card {
    padding: 1.25rem 1rem;
    border-radius: 12px;
  }

  .card-title {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
  }

  /* 가로 스크롤 및 찌그러짐 기본 방지 세팅 */
  .top-stocks-table-wrapper, 
  .holdings-table-wrapper {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.05);
  }

  .top-stocks-table, 
  .holdings-table {
    width: 100%;
  }

  .top-stocks-table th, 
  .top-stocks-table td,
  .holdings-table th,
  .holdings-table td {
    padding: 0.75rem 0.6rem;
    font-size: 0.85rem;
  }

  /* --- 세로 모드 (Portrait): 오늘의 추천 매수 포트폴리오 좌우 스크롤 활성화 --- */
  @media (orientation: portrait) {
    .top-stocks-table-wrapper {
      overflow-x: auto !important;
      -webkit-overflow-scrolling: touch;
    }
    .top-stocks-table {
      min-width: 950px !important; /* 세로 모드에서도 글자가 다 펼쳐질 수 있도록 충분한 최소 너비 설정 */
    }
    .top-stocks-table th, 
    .top-stocks-table td {
      white-space: nowrap !important; /* 글자가 1열(한 줄)로만 나오게 강제 설정 */
    }
    .stock-name-cell {
      white-space: nowrap !important;
      display: inline-flex !important;
      align-items: center !important;
    }
    .indicator-pills {
      flex-wrap: nowrap !important; /* 이평선&거래량 등의 조건 칩들이 아래로 꺾이지 않고 한 줄로 정렬되도록 설정 */
    }
  }

  /* --- 가로 모드 (Landscape): 가로 스크롤 비활성화 및 화면 맞춤 --- */
  @media (orientation: landscape) {
    .top-stocks-table-wrapper {
      overflow-x: hidden !important; /* 가로 스크롤 방지 */
    }
    .top-stocks-table {
      min-width: 100% !important; /* 가로 모드일 때는 화면이 넓으므로 가로폭에 딱 맞춤 */
    }
    .top-stocks-table th, 
    .top-stocks-table td {
      white-space: normal !important; /* 필요 시 자동 개행 허용 */
      word-break: keep-all !important; /* 단어 단위 줄바꿈 */
    }
    .stock-name-cell {
      white-space: normal !important;
      display: inline-block !important;
    }
  }

  /* 보유 주식 잔고는 기존처럼 스크롤 유지 */
  .holdings-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .holdings-table {
    min-width: 600px !important;
  }
  .holdings-table th,
  .holdings-table td {
    white-space: nowrap !important;
  }
  .holding-name-cell {
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* 도넛 차트 및 게이지 영역 반응형 배치 */
  .visuals-container {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 1rem;
  }

  .donut-wrapper {
    margin: 0 auto;
  }

  .gauge-bars-container {
    width: 100%;
  }

  /* 자산 현황 레이아웃 조정 */
  .balance-grid {
    grid-template-columns: 1fr; /* 모바일에서 1열로 넓게 보여주기 */
    gap: 0.5rem;
  }

  /* API 환경 설정 및 주문 작성 그리드 */
  .form-row-grid {
    grid-template-columns: 1fr; /* 입력 폼 모바일에서 1열 배치 */
    gap: 0.75rem;
  }

  /* 타겟/손절가 상자 배치 조정 */
  .trading-guide-box {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .guide-price {
    font-size: 1.3rem;
  }

  /* 모바일 페이징 버튼 크기 조절 */
  .pagination {
    margin-top: 1rem;
    gap: 0.35rem;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.7rem;
  }

  .glass-card {
    padding: 1rem 0.75rem;
  }

  /* 폼 요소 내부 레이아웃 */
  .kis-input, .kis-select {
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
  }

  .kis-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
}


