/* ==============================================================================
   Faswell AI Stock Trading Agent — Stylesheet (ChatGPT Dark Aesthetic)
   ============================================================================== */

:root {
  --bg-primary: #0d0d0f;
  --bg-secondary: #16161a;
  --bg-tertiary: #1f1f24;
  --bg-card: #18181d;
  --bg-input: #202027;
  --border-color: #2b2b34;
  --border-focus: #4e4e5e;
  
  --text-main: #f3f3f7;
  --text-muted: #9696a4;
  --text-dim: #676775;
  
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.2);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.2);
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.2);
  --accent-red: #ef4444;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* APP LAYOUT */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: 290px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 18px;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  z-index: 100;
}

.new-chat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.new-chat-btn:hover {
  background-color: #272730;
  border-color: var(--border-focus);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  padding-left: 6px;
}

.model-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.model-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.model-name {
  font-size: 13px;
  font-weight: 600;
}

.model-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.quick-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-nav-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
}

.quick-nav-item .icon {
  font-size: 14px;
}

/* GATE CARD */
.gate-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.pause-toggle-btn {
  background: #064e3b;
  color: #a7f3d0;
  border: 1px solid #059669;
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pause-toggle-btn.paused {
  background: #7f1d1d;
  color: #fecaca;
  border-color: #dc2626;
}

.clock-display {
  font-family: var(--font-mono);
  color: var(--text-main);
  font-size: 12px;
}

.market-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: #2a2a35;
  color: var(--text-main);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.bot-status-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
}

.bot-avatar {
  font-size: 20px;
  background: var(--bg-tertiary);
  padding: 6px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
}

.bot-name {
  font-size: 12px;
  font-weight: 600;
}

.bot-channel {
  font-size: 11px;
  color: var(--text-dim);
}

/* CHAT CONTAINER */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.chat-header {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(13, 13, 15, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mobile-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.header-title-box h1 {
  font-size: 15px;
  font-weight: 600;
  display: inline-block;
}

.header-badge {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  background: var(--bg-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
}

.status-indicator-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

.tg-config-btn {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.tg-config-btn:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

/* CHAT FEED */
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px 120px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

/* WELCOME HERO */
.welcome-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 40px;
  gap: 14px;
}

.hero-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #2563eb, #10b981);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
  margin-bottom: 6px;
}

.welcome-hero h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.welcome-hero p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 580px;
  line-height: 1.5;
}

.prompt-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 24px;
  width: 100%;
  max-width: 720px;
}

.suggestion-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.sugg-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-main);
}

.sugg-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}

/* BUBBLES */
.chat-row {
  display: flex;
  gap: 14px;
  width: 100%;
}

.chat-row.user {
  justify-content: flex-end;
}

.user-bubble {
  background: #23232b;
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: 18px 18px 4px 18px;
  max-width: 80%;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid #33333f;
}

.assistant-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #18181f;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.assistant-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 90%;
}

.assistant-text-box {
  font-size: 14px;
  line-height: 1.6;
  color: #e4e4e9;
  white-space: pre-wrap;
}

/* SIGNAL CARD COMPONENT */
.signal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.signal-card-header {
  padding: 16px 20px;
  background: #141418;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.card-title-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ticker-symbol {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.market-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: #272733;
  color: #c4c4d4;
}

.tier-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tier-badge.priority {
  background: #064e3b;
  color: #6ee7b7;
  border: 1px solid #10b981;
  box-shadow: 0 0 12px var(--accent-green-glow);
}

.tier-badge.await {
  background: #78350f;
  color: #fde68a;
  border: 1px solid #f59e0b;
  box-shadow: 0 0 12px var(--accent-amber-glow);
}

.tier-badge.watchlist {
  background: #1e3a8a;
  color: #bfdbfe;
  border: 1px solid #3b82f6;
  box-shadow: 0 0 12px var(--accent-blue-glow);
}

/* CARD TABS */
.card-nav-tabs {
  display: flex;
  background: #101014;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.card-tab-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.card-tab-btn:hover {
  color: var(--text-main);
}

.card-tab-btn.active {
  color: var(--text-main);
  border-bottom-color: var(--accent-green);
  background: #17171d;
}

.card-tab-content {
  padding: 20px;
}

/* TAB PANELS */
.score-overview-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.score-number-badge {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-green);
}

.score-progress-track {
  flex: 1;
  height: 8px;
  background: #272731;
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.score-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}

.stat-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat-item {
  background: #1b1b22;
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.stat-item .label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-item .val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

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

.indicators-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #23232c;
  color: var(--text-muted);
}

.indicators-table td:nth-child(2) {
  text-align: right;
  font-family: var(--font-mono);
  color: var(--text-main);
  font-weight: 500;
}

/* TRADE PLAN PANEL */
.plan-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.plan-status-banner.aktif {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #6ee7b7;
}

.plan-status-banner.menunggu {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid #3b82f6;
  color: #bfdbfe;
}

.plan-status-banner.kejar {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
}

.plan-price-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.price-card {
  background: #1b1b22;
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-sm);
}

.price-card .title {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.price-card .amount {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.price-card .sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.triggers-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trigger-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: #1b1b22;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.badge-check {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-weight: 600;
}

.badge-check.pass {
  background: #064e3b;
  color: #a7f3d0;
}

.badge-check.fail {
  background: #451a1a;
  color: #fca5a5;
}

/* TELEGRAM PREVIEW & ACTIONS */
.tg-preview-box {
  background: #0f141c;
  border: 1px solid #23344d;
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: #cbd5e1;
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin-bottom: 14px;
}

.tg-action-buttons {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-tg-send {
  background: #0284c7;
  color: #fff;
}

.btn-tg-send:hover {
  background: #0369a1;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #2b2b35;
}

/* SCAN RESULTS TABLE */
.scan-table-wrapper {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 10px;
}

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

.scan-table th {
  background: #141419;
  padding: 10px 12px;
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.scan-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #1f1f28;
  color: var(--text-muted);
}

.scan-table tr:hover {
  background: #1a1a23;
}

/* FLOATING INPUT */
.chat-input-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 24px 20px 24px;
  background: linear-gradient(180deg, rgba(13, 13, 15, 0) 0%, rgba(13, 13, 15, 0.95) 30%, #0d0d0f 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 20;
}

.ticker-chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 800px;
  width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
}

.chips-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-right: 4px;
}

.ticker-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ticker-chip:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.chat-form {
  max-width: 800px;
  width: 100%;
}

.input-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s ease;
}

.input-pill:focus-within {
  border-color: #3b82f6;
}

.input-pill textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  resize: none;
  max-height: 120px;
  padding: 4px 0;
}

.send-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.send-btn:hover {
  background: #1d4ed8;
  transform: scale(1.05);
}

.chat-disclaimer {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  max-width: 700px;
}

/* MODAL CONFIG */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop.show {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.close-modal-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
}

.form-group input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-mono);
  outline: none;
}

.form-group input:focus {
  border-color: #3b82f6;
}

.form-group small {
  font-size: 11px;
  color: var(--text-dim);
}

.modal-footer {
  padding: 14px 20px;
  background: #141418;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* TYPING INDICATOR */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 6px 0;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* SIDEBAR BACKDROP & CLOSE BUTTON */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.close-sidebar-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  align-items: center;
  justify-content: center;
}

.close-sidebar-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

/* ==============================================================================
   RESPONSIVE DESIGN (TABLET & MOBILE)
   ============================================================================== */

@media (max-width: 768px) {
  /* LAYOUT & SIDEBAR */
  .app-layout {
    position: relative;
    height: 100vh;
    height: 100dvh;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(310px, 86vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    z-index: 100;
    box-shadow: 12px 0 35px rgba(0, 0, 0, 0.65);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-right: 1px solid var(--border-color);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .new-chat-btn {
    flex: 1;
  }

  .close-sidebar-btn {
    display: flex;
  }

  /* HEADER */
  .chat-header {
    height: 54px;
    padding: 0 12px;
  }

  .mobile-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    flex-shrink: 0;
  }

  .header-left {
    gap: 10px;
    min-width: 0;
    flex: 1;
  }

  .header-title-box {
    min-width: 0;
  }

  .header-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .title-full {
    display: none;
  }

  .header-badge {
    display: none;
  }

  .header-right {
    gap: 6px;
    flex-shrink: 0;
  }

  .status-indicator-pill {
    padding: 4px 8px;
    font-size: 11px;
    gap: 5px;
  }

  .status-indicator-pill .status-text {
    display: none;
  }

  .btn-text-hide-mobile {
    display: none;
  }

  .tg-config-btn {
    padding: 7px 8px;
  }

  /* CHAT CONTAINER */
  .chat-container {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .chat-messages-container {
    padding: 14px 12px calc(140px + env(safe-area-inset-bottom, 12px)) 12px;
    gap: 16px;
  }

  .chat-row {
    gap: 8px;
  }

  .assistant-avatar {
    width: 28px;
    height: 28px;
    font-size: 13px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .user-bubble {
    max-width: 88%;
    font-size: 13.5px;
    padding: 9px 13px;
    line-height: 1.45;
  }

  .assistant-text-box {
    font-size: 13.5px;
    line-height: 1.55;
  }

  /* WELCOME HERO */
  .welcome-hero {
    margin-top: 14px;
    gap: 10px;
  }

  .hero-logo {
    width: 52px;
    height: 52px;
  }

  .welcome-hero h2 {
    font-size: 18px;
  }

  .welcome-hero p {
    font-size: 12.5px;
    padding: 0 4px;
    line-height: 1.45;
  }

  .prompt-suggestions-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .suggestion-card {
    padding: 12px;
  }

  .sugg-title {
    font-size: 13px;
  }

  .sugg-desc {
    font-size: 11.5px;
  }

  /* TRADING SIGNAL CARDS */
  .signal-card {
    border-radius: var(--radius-md);
    padding: 12px 10px;
    max-width: 100%;
    width: 100%;
  }

  .signal-card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .ticker-symbol {
    font-size: 17px;
  }

  .tier-badge {
    font-size: 10.5px;
    padding: 3px 8px;
  }

  .card-nav-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 5px;
    margin: 8px -10px 10px -10px;
    padding: 0 10px 4px 10px;
  }

  .card-nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .card-tab-btn {
    flex-shrink: 0;
    padding: 5px 9px;
    font-size: 11.5px;
    border-radius: 6px;
  }

  .stat-grid-5 {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .stat-grid-5 .stat-box:last-child {
    grid-column: span 2;
  }

  .stat-box {
    padding: 8px 10px;
  }

  .stat-label {
    font-size: 10px;
  }

  .stat-val {
    font-size: 13px;
  }

  .plan-price-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .plan-price-grid .plan-price-item:last-child {
    grid-column: span 2;
  }

  .plan-price-item {
    padding: 8px 10px;
  }

  .plan-price-item .val {
    font-size: 14px;
  }

  .scan-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 8px -4px;
  }

  .scan-table th,
  .scan-table td {
    padding: 8px 10px;
    font-size: 11.5px;
    white-space: nowrap;
  }

  .tg-action-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .tg-action-buttons .btn {
    width: 100%;
    justify-content: center;
    padding: 10px;
    font-size: 13px;
  }

  .tg-preview-box {
    font-size: 11px;
    padding: 10px;
    max-height: 200px;
  }

  /* INPUT WRAPPER DI BAWAH */
  .chat-input-wrapper {
    padding: 6px 10px calc(8px + env(safe-area-inset-bottom, 10px)) 10px;
    gap: 6px;
  }

  .ticker-chips-row {
    padding: 0 2px 4px 2px;
    gap: 5px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .ticker-chips-row::-webkit-scrollbar {
    display: none;
  }

  .chips-label {
    font-size: 10px;
  }

  .ticker-chip {
    padding: 4px 10px;
    font-size: 11.5px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
  }

  .input-pill {
    padding: 6px 10px;
    border-radius: 20px;
    gap: 8px;
  }

  .input-pill textarea {
    font-size: 16px; /* Wajib 16px untuk elak auto-zoom di iOS */
    padding: 4px 0;
    min-height: 22px;
  }

  .send-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  .chat-disclaimer {
    font-size: 9.5px;
    line-height: 1.3;
    padding: 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* MODAL */
  .modal-content {
    width: 94%;
    margin: 12px;
  }
}

/* OPTIMASI TAMBAHAN UNTUK SKRIN SANGAT KECIL (< 420px) */
@media (max-width: 420px) {
  .chat-messages-container {
    padding: 10px 8px calc(145px + env(safe-area-inset-bottom, 10px)) 8px;
  }

  .signal-card {
    padding: 10px 8px;
  }

  .stat-grid-5 {
    grid-template-columns: 1fr;
  }

  .stat-grid-5 .stat-box:last-child {
    grid-column: span 1;
  }

  .plan-price-grid {
    grid-template-columns: 1fr;
  }

  .plan-price-grid .plan-price-item:last-child {
    grid-column: span 1;
  }
}
