/* ================================================================
   FALAH FINANSIAL — AI Trading Platform Design System
   Dark theme with neon cyan/blue accent
   ================================================================ */

/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --bg-base:     #0a0e1a;
  --bg-surface:  #0f1629;
  --bg-card:     #131c35;
  --bg-hover:    #1a2540;
  --border:      #1e2d4a;
  --border-glow: #00d4ff33;

  --neon:        #00d4ff;
  --neon-dim:    #00d4ff99;
  --neon-glow:   0 0 12px #00d4ff55;
  --green:       #00e676;
  --red:         #ff4d6d;
  --yellow:      #ffd600;
  --purple:      #b388ff;

  --text-primary:   #e8f0fe;
  --text-secondary: #7b93bc;
  --text-muted:     #4a6080;

  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.15s ease;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--neon); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── SPA Layout ────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: 230px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--neon);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-username {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 13px;
}

.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-link.active {
  background: linear-gradient(90deg, #00d4ff22, #00d4ff11);
  color: var(--neon);
  border-left: 2px solid var(--neon);
}

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

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* ── Page ──────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
}

/* ── Cards / Stats ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--neon), transparent);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-value.neon { color: var(--neon); }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }

/* ── Card ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--neon);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── License Cards ─────────────────────────────────────────────── */
.license-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.license-card:hover {
  border-color: var(--neon-dim);
  box-shadow: var(--neon-glow);
}

.license-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--neon);
  margin-bottom: 6px;
}

.license-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.license-price span {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 4px;
}

.license-details {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.9;
  margin-bottom: 20px;
}

/* ── Table ─────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead tr {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  font-weight: 600;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td { padding: 11px 14px; color: var(--text-primary); }

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green  { background: #00e67622; color: var(--green); }
.badge-red    { background: #ff4d6d22; color: var(--red); }
.badge-blue   { background: #00d4ff22; color: var(--neon); }
.badge-yellow { background: #ffd60022; color: var(--yellow); }
.badge-purple { background: #b388ff22; color: var(--purple); }
.badge-gray   { background: #7b93bc22; color: var(--text-secondary); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity var(--transition), box-shadow var(--transition);
  line-height: 1;
}

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

.btn-primary  { background: var(--neon); color: #000; }
.btn-success  { background: var(--green); color: #000; }
.btn-danger   { background: var(--red); color: #fff; }
.btn-warning  { background: var(--yellow); color: #000; }
.btn-purple   { background: var(--purple); color: #000; }
.btn-ghost    { background: var(--bg-hover); color: var(--text-primary); border: 1px solid var(--border); }
.btn-sm       { padding: 4px 10px; font-size: 11px; }
.btn-full     { width: 100%; }

/* ── Forms ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--neon);
  box-shadow: 0 0 0 2px #00d4ff1a;
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Alert / Error ─────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 12px;
}
.alert-error  { background: #ff4d6d1a; color: var(--red); border: 1px solid #ff4d6d33; }
.alert-success{ background: #00e6761a; color: var(--green); border: 1px solid #00e67633; }
.hidden { display: none !important; }

/* ── Info Row ──────────────────────────────────────────────────── */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-secondary); }
.info-row .value { font-weight: 500; }

/* ── Referral Code Box ─────────────────────────────────────────── */
.ref-code-box {
  background: #00d4ff0d;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 16px;
}
.ref-code-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.ref-code-value { font-size: 26px; font-weight: 800; color: var(--neon); letter-spacing: 0.06em; }
.ref-code-hint  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── Referral Link Box ─────────────────────────────────────────── */
.ref-link-box {
  background: linear-gradient(135deg, #00d4ff08 0%, #b388ff06 100%);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-top: 16px;
  position: relative;
  overflow: hidden;
}
.ref-link-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #00d4ff15 0%, transparent 60%);
  pointer-events: none;
}
.ref-link-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--neon-dim);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ref-link-section-title svg { width: 14px; height: 14px; }
.ref-link-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0a0e1a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 10px;
  transition: border-color var(--transition);
}
.ref-link-display:focus-within {
  border-color: var(--border-glow);
  box-shadow: 0 0 0 2px #00d4ff15;
}
.ref-link-text {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: all;
  cursor: text;
  background: none;
  border: none;
  outline: none;
}
.ref-link-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-copy-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: var(--neon);
  color: #0a0e1a;
  flex: 1;
  justify-content: center;
}
.btn-copy-link:hover {
  background: #33ddff;
  box-shadow: var(--neon-glow);
  transform: translateY(-1px);
}
.btn-copy-link.copied {
  background: var(--green);
  color: #0a0e1a;
}
.btn-copy-link svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-share-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--border-glow);
  background: transparent;
  color: var(--neon);
  flex: 1;
  justify-content: center;
}
.btn-share-link:hover {
  background: #00d4ff15;
  transform: translateY(-1px);
}
.btn-share-link svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Toast Notification ────────────────────────────────────────── */
.ref-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--green);
  color: #0a0e1a;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 999px;
  box-shadow: 0 4px 20px #00e67640;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ref-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.ref-toast svg { width: 16px; height: 16px; }

/* ── Sonner Toast System ─────────────────────────────────────── */
#sonner-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  width: 340px;
  max-width: calc(100vw - 32px);
}
.snr-toast {
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
  position: relative;
  overflow: hidden;
}
.snr-toast.snr-in {
  transform: translateX(0);
  opacity: 1;
}
.snr-toast.snr-out {
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.snr-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.snr-icon svg { width: 12px; height: 12px; stroke-width: 2.5; }
.snr-body { flex: 1; min-width: 0; }
.snr-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.snr-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}
.snr-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 16px;
  margin-top: -2px;
  transition: color var(--transition);
}
.snr-close:hover { color: var(--text-primary); }
.snr-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 12px 12px;
  transform-origin: left;
  animation: snr-shrink linear forwards;
}
@keyframes snr-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
/* variants */
.snr-success .snr-icon { background: #00e67622; color: var(--green); }
.snr-success .snr-progress { background: var(--green); }
.snr-success { border-left: 3px solid var(--green); }
.snr-error .snr-icon { background: #ff4d6d22; color: var(--red); }
.snr-error .snr-progress { background: var(--red); }
.snr-error { border-left: 3px solid var(--red); }
.snr-warning .snr-icon { background: #ffd60022; color: var(--yellow); }
.snr-warning .snr-progress { background: var(--yellow); }
.snr-warning { border-left: 3px solid var(--yellow); }
.snr-info .snr-icon { background: #00d4ff15; color: var(--neon); }
.snr-info .snr-progress { background: var(--neon); }
.snr-info { border-left: 3px solid var(--neon); }
.snr-loading .snr-icon { background: #b388ff22; color: var(--purple); }
.snr-loading .snr-progress { display: none; }
.snr-loading { border-left: 3px solid var(--purple); }

/* Spinner for loading toast */
.snr-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--purple);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Confirm Modal ───────────────────────────────────────────── */
#confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
#confirm-overlay.show {
  opacity: 1;
  pointer-events: all;
}
#confirm-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  text-align: center;
}
#confirm-overlay.show #confirm-box {
  transform: scale(1) translateY(0);
}
.confirm-icon-zone {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.confirm-icon-zone svg { width: 26px; height: 26px; }
.confirm-icon-zone.warn { background: #ffd60018; color: var(--yellow); }
.confirm-icon-zone.danger { background: #ff4d6d18; color: var(--red); }
.confirm-icon-zone.info  { background: #00d4ff12; color: var(--neon); }
.confirm-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.confirm-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}
.confirm-actions {
  display: flex;
  gap: 10px;
}
.confirm-actions button {
  flex: 1;
  padding: 10px 0;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}
.confirm-cancel {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border) !important;
}
.confirm-cancel:hover { background: var(--bg-hover); color: var(--text-primary); }
.confirm-ok {
  background: var(--neon);
  color: #0a0e1a;
}
.confirm-ok:hover { filter: brightness(1.1); box-shadow: var(--neon-glow); }
.confirm-ok.danger-btn { background: var(--red); color: #fff; }
.confirm-ok.danger-btn:hover { box-shadow: 0 0 12px #ff4d6d55; }

/* ── Pagination ────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

/* ── Toolbar / Filter Row ──────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
}

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

.modal-title { font-size: 16px; font-weight: 700; color: var(--neon); }

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.modal-close:hover { color: var(--text-primary); }

.modal-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin: 20px 0 10px;
}

.modal-scroll-list {
  max-height: 160px;
  overflow-y: auto;
}

/* ── Regenerate Buttons ────────────────────────────────────────── */
.regen-section {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ── Loading skeleton ──────────────────────────────────────────── */
.loading-text {
  color: var(--text-muted);
  font-size: 13px;
  padding: 16px 0;
}

/* ── Neon glow accent for inputs on dark bg ────────────────────── */
.input-sm {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}
.input-sm:focus { border-color: var(--neon); }

/* ================================================================
   RESPONSIVE — MOBILE FIRST
   Breakpoints:
     768px  = tablet / small desktop
     640px  = large phone (landscape)
     480px  = standard phone
   ================================================================ */

/* ── Hamburger Button (hidden on desktop) ───────────────────────── */
.hamburger {
  display: none;
  position: fixed;
  top: 8px;
  left: 16px;
  z-index: 1100;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 8px;
  cursor: pointer;
  color: var(--text-primary);
  line-height: 0;
  transition: all 0.2s ease;
}
.hamburger:hover {
  background: var(--bg-hover);
}
.hamburger svg { width: 24px; height: 24px; }
.hamburger.open {
  left: 276px;
  background: var(--bg-hover);
}
.hamburger.open svg path:nth-child(1) {
  d: path("M6 18L18 6");
}
.hamburger.open svg path:nth-child(2) {
  opacity: 0;
}
.hamburger.open svg path:nth-child(3) {
  d: path("M6 6l12 12");
}

/* Mobile header bar */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  z-index: 1050;
  align-items: center;
  padding: 0 16px 0 56px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.1);
}
.mobile-header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ── Mobile Overlay backdrop ───────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1050;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.open { display: block; }

/* ═══════════════════════════════════════════════════
   ≤ 900px  — collapse grids, adjust padding
   ═══════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .main-content { padding: 22px 20px; }
  #confirm-box { max-width: 360px; padding: 28px 20px 20px; }
}

/* ═══════════════════════════════════════════════════
   ≤ 768px  — sidebar drawer, stacked layout
   ═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Show hamburger and mobile header */
  .hamburger { display: flex; align-items: center; justify-content: center; }
  .mobile-header { display: flex; }

  /* Sidebar becomes a fixed drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 1080;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    width: 260px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  }
  .sidebar.open { transform: translateX(0); }

  /* Main content fills full width */
  .main-content {
    width: 100%;
    padding: 72px 16px 24px; /* increased top pad for header */
    min-height: 100vh;
  }

  /* Page title smaller */
  .page-title { font-size: 17px; margin-bottom: 18px; }

  /* Stats grid: 2 columns */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }

  /* Grids: all single column */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 14px; }

  /* Cards */
  .card { padding: 16px; margin-bottom: 14px; }

  /* Toolbar: stack vertically */
  .toolbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .filter-group { width: 100%; }
  .filter-group .form-control { flex: 1; min-width: 0; }

  /* Table: allow horizontal scroll, smaller text */
  .table-wrap { border-radius: var(--radius); }
  table { font-size: 12px; }
  thead th { padding: 10px 10px; font-size: 10px; }
  tbody td { padding: 9px 10px; }
  /* Action cell stacks buttons vertically */
  tbody td:last-child {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 80px;
  }

  /* Regen section */
  .regen-section { gap: 8px; }
  .regen-section .btn { font-size: 12px; padding: 6px 12px; }

  /* License cards: tighter */
  .license-card { padding: 16px; }
  .license-name { font-size: 16px; }
  .license-price { font-size: 24px; }

  /* Referral code input row */
  .ref-code-box > div[style*="display:flex"] {
    flex-wrap: wrap;
  }
  #refCodeInput { max-width: 100% !important; width: 100%; }

  /* Referral link actions: stack full width */
  .ref-link-actions { flex-direction: column; }
  .btn-copy-link,
  .btn-share-link { flex: unset; width: 100%; }

  /* Sonner: full-width bottom center on mobile */
  #sonner-container {
    bottom: 16px;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    padding: 0 12px;
    align-items: stretch;
  }
  .snr-toast { transform: translateY(120%); }
  .snr-toast.snr-in { transform: translateY(0); }
  .snr-toast.snr-out { transform: translateY(120%); }

  /* Ref toast */
  .ref-toast {
    bottom: 16px;
    left: 12px;
    right: 12px;
    transform: translateY(80px);
    width: auto;
  }
  .ref-toast.show { transform: translateY(0); }

  /* Confirm modal */
  #confirm-overlay { align-items: flex-end; padding: 0; }
  #confirm-box {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 28px 20px 32px;
    transform: translateY(100%);
  }
  #confirm-overlay.show #confirm-box { transform: translateY(0); }

  /* Profil form grid → single col */
  #page-profil .grid-2 { grid-template-columns: 1fr; }

  /* Pagination */
  .pagination { gap: 6px; }
}

/* ═══════════════════════════════════════════════════
   ≤ 480px  — small phones, final polish
   ═══════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .main-content { padding: 60px 12px 20px; }

  /* Stats: single column on very small */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-label { font-size: 10px; }
  .stat-value { font-size: 18px; }

  /* Hide less-important table columns via classes */
  .page-title { font-size: 16px; }

  /* License card price */
  .license-price { font-size: 22px; }

  /* Ref code value */
  .ref-code-value { font-size: 22px; }

  /* Confirm box actions stack on tiny screens */
  .confirm-actions { flex-direction: column-reverse; }
  .confirm-actions button { width: 100%; padding: 12px; }

  /* Sonner narrower padding */
  #sonner-container { padding: 0 8px; }
  .snr-toast { padding: 12px 12px; }

  /* Table: hide low-priority columns on tasks page */
  #tasksBody tr td:nth-child(7),
  #tasksBody tr td:nth-child(8) {
    display: none;
  }
  thead tr th:nth-child(7),
  thead tr th:nth-child(8) {
    display: none;
  }
}

/* ══════════════════════════════════════════════
   TASK CARDS
   ══════════════════════════════════════════════ */
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.task-card.task-card-locked {
  border-color: rgba(255, 214, 0, 0.25);
  box-shadow: 0 0 0 1px rgba(255, 214, 0, 0.08), inset 0 0 0 1px rgba(255, 214, 0, 0.03);
}
.task-card.task-card-locked .task-card-top {
  position: relative;
}
.task-card.task-card-locked .task-card-top::after {
  content: '🔒';
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  color: var(--yellow);
  opacity: 0.7;
}
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.task-card:hover {
  border-color: var(--neon);
  box-shadow: 0 0 0 1px rgba(0, 245, 160, 0.08);
}

.task-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 0;
}

.task-icon-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.task-coin-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: block;
}
.task-direction-badge {
  position: absolute;
  bottom: -2px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  border: 2px solid var(--bg-card);
}
.dir-buy  { background: rgba(0, 200, 83, 0.18); color: var(--green); }
.dir-sell { background: rgba(255, 77, 109, 0.18); color: var(--red); }

.task-pair-name {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.task-status-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}
.task-status-tag.task-badge-active  { background: rgba(0, 130, 255, 0.12); color: #4dabf7; }
.task-status-tag.task-badge-done    { background: rgba(0, 200, 83, 0.12);  color: var(--green); }
.task-status-tag.task-badge-expired { background: rgba(255, 77, 109, 0.12); color: var(--red); }

.task-card-body {
  padding: 12px 16px;
  flex: 1;
}

.task-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.task-meta-item {
  display: flex;
  flex-direction: column;
}
.task-meta-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.task-meta-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.reward-value {
  color: var(--green);
}

.task-card-footer {
  padding: 0 16px 14px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.task-expired-msg,
.task-done-msg {
  display: block;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  padding: 8px;
  border-radius: 8px;
}
.task-expired-msg {
  color: var(--red);
  background: rgba(255, 77, 109, 0.08);
}
.task-locked-msg {
  color: var(--yellow);
  background: rgba(255, 214, 0, 0.08);
}
.task-done-msg {
  color: var(--green);
  background: rgba(0, 200, 83, 0.08);
}
.countdown-value {
  font-variant-numeric: tabular-nums;
}

.tasks-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── DEPLOY TERMINAL OVERLAY ── */
#deployOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#deployOverlay.show { display: flex !important; }
#deployBox {
  width: 100%;
  max-width: 640px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 16px 64px rgba(0,0,0,0.6);
}

@media (max-width: 768px) {
  #deployOverlay {
    padding: 10px;
  }
  #deployBox {
    max-width: 100%;
    border-radius: 8px;
  }
  .deploy-body {
    min-height: 200px;
    max-height: 280px;
    font-size: 11px;
    padding: 12px;
  }
}
.deploy-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
}
.deploy-dots { display: flex; gap: 6px; }
.deploy-dot { width: 12px; height: 12px; border-radius: 50%; }
.deploy-title { font-size: 12px; font-weight: 600; color: #8b949e; letter-spacing: 0.02em; }
.deploy-body {
  padding: 14px 16px;
  min-height: 240px;
  max-height: 360px;
  overflow-y: auto;
  font-family: 'SF Mono','Cascadia Code','Fira Code','JetBrains Mono',monospace;
  font-size: 13px;
  line-height: 1.7;
  color: #c9d1d9;
}
.deploy-body::-webkit-scrollbar { width: 6px; }
.deploy-body::-webkit-scrollbar-track { background: transparent; }
.deploy-body::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
.deploy-line { padding: 2px 0; animation: deployFadeIn 0.2s ease; }
@keyframes deployFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.deploy-prompt { color: #3fb950; margin-right: 8px; font-weight: 700; user-select: none; }
.deploy-cmd { color: #d2a8ff; }
.deploy-success { color: #3fb950; font-weight: 600; }
.deploy-progress-wrap { height: 3px; background: #21262d; }
.deploy-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3fb950, #2ea043);
  transition: width 0.1s linear;
}
.deploy-time {
  padding: 8px 16px;
  font-size: 11px;
  color: #8b949e;
  font-family: 'SF Mono', monospace;
  border-top: 1px solid #21262d;
}
