/* ============================================
   Inner pages — shared deep-dive layout
   ============================================ */

.inner-hero { padding: 9rem 0 var(--space-xl); border-bottom: 1px solid var(--border-subtle); }
.inner-hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); margin: var(--space-sm) 0 var(--space-sm); max-width: 720px; }
.inner-hero .hero-sub { margin: 0; max-width: 580px; text-align: left; }

.container.narrow { max-width: 780px; }

.deep-section { padding-top: var(--space-2xl); }

.deep-block { padding-bottom: var(--space-2xl); border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--space-2xl); }
.deep-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.deep-index { font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent-gold-bright); display: block; margin-bottom: var(--space-xs); }
.deep-block h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: var(--space-sm); }
.deep-block > p { color: var(--text-secondary); font-size: 1rem; margin-bottom: var(--space-md); }

.deep-list { list-style: none; display: flex; flex-direction: column; gap: 0.85rem; }
.deep-list li { position: relative; padding-left: 1.5rem; font-size: 0.95rem; color: var(--text-primary); }
.deep-list li::before { content: ''; position: absolute; left: 0; top: 0.5em; width: 8px; height: 8px; border-radius: 2px; background: var(--accent-gold); transform: rotate(45deg); }
html[dir="rtl"] .deep-list li { padding-left: 0; padding-right: 1.5rem; }
html[dir="rtl"] .deep-list li::before { left: auto; right: 0; }

.deep-list a { color: var(--accent-gold-bright); }
.deep-block a { color: var(--accent-gold-bright); border-bottom: 1px solid rgba(212, 175, 55, 0.35); transition: border-color 0.2s ease; }
.deep-block a:hover { border-color: var(--accent-gold-bright); }

/* Tier comparison table */
.tier-table { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: var(--space-xl) 0; }

.tier-card { position: relative; overflow: hidden; background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-lg); }
.tier-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--accent-emerald), var(--accent-gold)); }
.tier-card.featured { border-color: rgba(212, 175, 55, 0.45); background: linear-gradient(160deg, var(--bg-panel), rgba(212, 175, 55, 0.05)); }
.tier-card.featured::before { background: var(--accent-gold-bright); }
.tier-card.tier-elite { border-color: rgba(240, 206, 99, 0.55); background: linear-gradient(160deg, var(--bg-panel), rgba(212, 175, 55, 0.1)); box-shadow: 0 0 30px rgba(212, 175, 55, 0.08); }
.tier-card.tier-elite::before { background: linear-gradient(90deg, var(--accent-gold), var(--accent-gold-bright), var(--accent-gold)); }
.tier-card.tier-custom { border-color: rgba(244, 239, 224, 0.3); background: linear-gradient(160deg, var(--bg-panel), rgba(244, 239, 224, 0.06)); }
.tier-card.tier-custom::before { background: linear-gradient(90deg, var(--text-primary), var(--accent-gold-bright)); }
.tier-card.tier-custom .tier-price { font-size: 1.3rem; }

.tier-card.locked { opacity: 0.6; filter: grayscale(0.4); }
.tier-card.locked:hover { opacity: 0.85; filter: none; }
.tier-card.active-tier { box-shadow: 0 0 0 2px var(--accent-gold-bright), 0 0 30px rgba(212,175,55,0.15); }
.tier-active-badge { position: absolute; top: var(--space-sm); right: var(--space-sm); background: var(--accent-gold-bright); color: #16250D; font-family: var(--font-mono); font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.2rem 0.55rem; border-radius: 999px; }

.tier-table.tier-table-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .tier-table.tier-table-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .tier-table.tier-table-4 { grid-template-columns: 1fr; } }
.tier-card:has(input:checked) { border-color: var(--accent-gold); box-shadow: 0 0 0 1px var(--accent-gold); }

.tier-card-brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-sm); }
.tier-card-brand span:first-child { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); }
.tier-card-brand svg { width: 20px; height: 20px; opacity: 0.7; }

.tier-card .tier-name { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-gold-bright); display: block; margin-bottom: var(--space-xs); }
.tier-card h3 { font-size: 1.3rem; margin-bottom: 0.3rem; }
.tier-card .tier-price { font-family: var(--font-display); font-size: 1.7rem; color: var(--accent-gold-bright); margin-bottom: var(--space-sm); }
.tier-card .tier-price .period { font-size: 0.85rem; color: var(--text-tertiary); font-family: var(--font-body); }

.tier-card ul { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; margin-top: var(--space-md); }
.tier-card ul li { font-size: 0.88rem; color: var(--text-secondary); padding-left: 1.1rem; position: relative; }
.tier-card ul li::before { content: '—'; position: absolute; left: 0; color: var(--text-tertiary); }
html[dir="rtl"] .tier-card ul li { padding-left: 0; padding-right: 1.1rem; }
html[dir="rtl"] .tier-card ul li::before { left: auto; right: 0; }

@media (max-width: 860px) { .tier-table { grid-template-columns: 1fr; } }

/* Active-package card (developer dashboard) */
.package-card { position: relative; overflow: hidden; aspect-ratio: 1.9/1; border-radius: var(--radius-lg); padding: var(--space-md) var(--space-lg); display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(135deg, rgba(212,175,55,0.18), var(--bg-panel) 55%, var(--bg-primary)); border: 1px solid rgba(212,175,55,0.35); margin-bottom: var(--space-lg); }
.package-card::after { content: ''; position: absolute; top: -40%; right: -20%; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(212,175,55,0.25), transparent 70%); pointer-events: none; }
.package-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.package-card-brand { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); }
.package-card-tier { font-family: var(--font-display); font-size: 1.3rem; color: var(--accent-gold-bright); }
.package-card-quota { font-size: 0.85rem; color: var(--text-secondary); margin-top: var(--space-xs); }
.package-card-quota strong { color: var(--text-primary); }
.package-card-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 0.4rem; }
.package-card-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-emerald), var(--accent-gold-bright)); border-radius: 999px; }
.package-card-price { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-tertiary); }

/* Referral / level chain */
.level-chain { display: flex; flex-direction: column; gap: 1rem; margin: var(--space-lg) 0; }

.level-row {
  display: flex; align-items: center; gap: var(--space-md);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
}

.level-badge {
  font-family: var(--font-mono); font-size: 0.85rem; color: #16250D;
  background: var(--accent-gold-bright);
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-weight: 700;
}

.level-row.l2 .level-badge { background: var(--accent-emerald); color: #06180F; }
.level-row.l3 .level-badge, .level-row.l4 .level-badge, .level-row.l5 .level-badge { background: var(--border-subtle); color: var(--text-primary); }

/* ---------- referral tree (pure-CSS org chart) ---------- */
.ref-tree-scroll { overflow-x: auto; padding: 0.5rem 0 1rem; }
.ref-tree, .ref-tree ul { list-style: none; margin: 0; padding: 0; display: flex; }
.ref-tree { display: inline-flex; }
.ref-tree li {
  position: relative; padding: 20px 10px 0 10px; text-align: center;
}
.ref-tree li::before, .ref-tree li::after {
  content: ''; position: absolute; top: 0; right: 50%;
  border-top: 2px solid var(--border-subtle); width: 50%; height: 20px;
}
.ref-tree li::after { right: auto; left: 50%; border-left: 2px solid var(--border-subtle); }
.ref-tree li:only-child::after, .ref-tree li:only-child::before { display: none; }
.ref-tree li:only-child { padding-top: 0; }
.ref-tree li:first-child::before, .ref-tree li:last-child::after { border: 0 none; }
.ref-tree li:last-child::before { border-right: 2px solid var(--border-subtle); border-radius: 0 6px 0 0; }
.ref-tree li:first-child::after { border-radius: 6px 0 0 0; }
.ref-tree ul::before {
  content: ''; position: absolute; top: 0; left: 50%;
  border-left: 2px solid var(--border-subtle); width: 0; height: 20px;
}
.ref-tree > li { padding-top: 0; }
.ref-tree > li::before, .ref-tree > li::after, .ref-tree > li > ul::before { display: none; }
.ref-tree a {
  border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--bg-panel);
  color: var(--text-primary); display: inline-block; padding: 0.4rem 0.7rem;
  font-size: 0.78rem; white-space: nowrap; text-decoration: none;
}
.ref-tree > li > a { border-color: var(--accent-gold); color: var(--accent-gold-bright); font-weight: 700; }

.level-info h4 { font-size: 1.05rem; margin-bottom: 0.2rem; }
.level-info p { color: var(--text-secondary); font-size: 0.88rem; }

.example-box { background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-lg); margin: var(--space-lg) 0; }
.example-box h4 { font-family: var(--font-mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary); margin-bottom: var(--space-sm); }
.example-box p { font-size: 0.94rem; color: var(--text-primary); margin-bottom: 0.6rem; }
.example-box p:last-child { margin-bottom: 0; }

.note-box {
  border-left: 3px solid var(--accent-gold);
  padding: var(--space-sm) var(--space-md);
  background: rgba(212, 175, 55, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: var(--space-md) 0;
}
html[dir="rtl"] .note-box { border-left: none; border-right: 3px solid var(--accent-gold); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

/* ============================================
   Dashboard shell (developer / user / admin)
   ============================================ */

.dash-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.dash-sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-lg) var(--space-md);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
html[dir="rtl"] .dash-sidebar { border-right: none; border-left: 1px solid var(--border-subtle); }

.dash-sidebar .nav-logo { margin-bottom: var(--space-lg); }

.dash-nav { list-style: none; display: flex; flex-direction: column; gap: 0.2rem; }

.dash-nav a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.dash-nav a:hover { background: var(--bg-panel-hover); color: var(--text-primary); }
.dash-nav a.active { background: rgba(212,175,55,0.1); color: var(--accent-gold-bright); }

.dash-main { padding: var(--space-lg) var(--space-xl); }

.dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-lg); flex-wrap: wrap; gap: var(--space-sm); }
.dash-header h1 { font-size: 1.6rem; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: var(--space-lg); }

.stat-card { background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-md); }
.stat-card .stat-label { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); margin-bottom: 0.5rem; display: block; }
.stat-card .stat-value { font-family: var(--font-display); font-size: 1.7rem; color: var(--accent-gold-bright); }
.stat-card .stat-sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.3rem; }

@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .dash-shell { grid-template-columns: 1fr; } .dash-sidebar { position: static; height: auto; } }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.panel h3 { font-size: 1.05rem; margin-bottom: var(--space-sm); }

/* data table */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th { text-align: left; font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border-subtle); }
.data-table td { padding: 0.7rem; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
html[dir="rtl"] .data-table th, html[dir="rtl"] .data-table td { text-align: right; }

.table-actions { display: flex; gap: 0.4rem; }

/* form elements shared by dashboards */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

.form-field { margin-bottom: var(--space-md); }
.form-field label { display: block; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.4rem; }
.form-field .hint { font-size: 0.75rem; color: var(--text-tertiary); margin-top: 0.3rem; display: block; }

.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: var(--accent-gold); }
.form-field textarea { resize: vertical; min-height: 100px; }

.file-drop {
  border: 1.5px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.file-drop:hover { border-color: var(--accent-gold); }
.file-drop.has-file { border-style: solid; border-color: var(--accent-emerald); color: var(--accent-emerald); }

/* pending / approval banner */
.pending-banner {
  display: flex; align-items: center; gap: var(--space-sm);
  background: var(--danger-bg);
  border: 1px solid rgba(226,114,107,0.35);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.pending-banner .countdown { font-family: var(--font-mono); font-size: 1.1rem; color: var(--danger); }

.approval-timeline { display: flex; flex-direction: column; gap: 0; margin: var(--space-lg) 0; }
.timeline-step { display: flex; gap: var(--space-md); padding-bottom: var(--space-lg); position: relative; }
.timeline-step:last-child { padding-bottom: 0; }
.timeline-dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-panel-hover); border: 2px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 0.8rem; font-family: var(--font-mono);
  z-index: 1;
}
.timeline-step.done .timeline-dot { background: var(--accent-emerald); border-color: var(--accent-emerald); color: #06180F; }
.timeline-step.active .timeline-dot { background: var(--accent-gold-bright); border-color: var(--accent-gold-bright); color: #16250D; }
.timeline-step:not(:last-child)::before {
  content: ''; position: absolute; left: 14px; top: 30px; bottom: 0; width: 2px; background: var(--border-subtle);
}
.timeline-step h4 { font-size: 0.95rem; margin-bottom: 0.2rem; }
.timeline-step p { font-size: 0.82rem; color: var(--text-secondary); }

/* AI placeholder widgets */
.ai-widget {
  background: linear-gradient(160deg, var(--bg-panel), rgba(212,175,55,0.04));
  border: 1.5px dashed rgba(212, 175, 55, 0.4);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  position: relative;
}

.ai-widget > .badge:first-child { position: absolute; top: var(--space-md); right: var(--space-md); }
html[dir="rtl"] .ai-widget > .badge:first-child { right: auto; left: var(--space-md); }
.ai-widget h4 { font-size: 1rem; margin-bottom: 0.3rem; display: flex; align-items: center; gap: 0.5rem; }
.ai-widget p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.6rem; }

.ai-gauge {
  width: 84px; height: 84px; border-radius: 50%;
  border: 6px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-tertiary);
  margin: 0.4rem 0;
}

.ai-chat-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 90;
  background: var(--accent-gold-bright);
  color: #16250D;
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px -8px rgba(0,0,0,0.6);
}
html[dir="rtl"] .ai-chat-fab { right: auto; left: 1.5rem; }
.ai-chat-fab svg { width: 24px; height: 24px; }

.ai-chat-panel {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  z-index: 90;
  width: 320px;
  max-width: calc(100vw - 2rem);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: none;
  box-shadow: 0 20px 50px -10px rgba(0,0,0,0.6);
}
html[dir="rtl"] .ai-chat-panel { right: auto; left: 1.5rem; }
.ai-chat-panel.open { display: block; }
.ai-chat-panel textarea { width: 100%; min-height: 70px; margin-top: 0.6rem; }

/* Contact / manager link block (business pool) */
.contact-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: var(--space-md); }
.contact-btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.2rem; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 600; }
.contact-btn.telegram { background: rgba(63,174,123,0.14); color: var(--accent-emerald); border: 1px solid rgba(63,174,123,0.4); }
.contact-btn.whatsapp { background: rgba(212,175,55,0.14); color: var(--accent-gold-bright); border: 1px solid rgba(212,175,55,0.4); }

.cross-support-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); margin: var(--space-lg) 0; }
@media (max-width: 760px) { .cross-support-grid { grid-template-columns: 1fr; } }
