/* ================================================================
   HitBack — Clean Light Theme
   ================================================================ */

:root {
  --bg-page: #ffffff;
  --bg-card: #ffffff;
  --bg-card-dark: #0f172a;
  --bg-input: #ffffff;
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-on-dark: #f8fafc;
  
  --border-light: #e2e8f0;
  --border-dark: rgba(15, 23, 42, 0.2);
  --border-focus: #3b82f6;
  
  --color-green: #2563eb; /* Primary blue */
  --color-green-hover: #1d4ed8;
  --color-blue: #2563eb; /* Primary blue */
  --color-blue-hover: #1d4ed8;
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: #ffffff;
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* --- Utilities --- */
.text-center { text-align: center; }
.text-blue { color: var(--color-blue); }
.highlight-green { color: var(--color-green); font-weight: 700; }
.divider { height: 1px; background: var(--border-light); margin: 24px 0; }

/* --- Navigation --- */
.nav {
  position: fixed; top: 0; width: 100%;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  z-index: 100;
}
.nav-container {
  max-width: 900px; margin: 0 auto;
  min-height: 60px; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.nav-menu {
  display: flex; align-items: center; gap: 20px;
  flex: 1; justify-content: flex-end; min-width: 0;
}
.nav-pages {
  display: flex; align-items: center; gap: 16px;
}
.nav-start {
  display: flex; align-items: center; gap: 12px;
  min-width: 0; flex-shrink: 0;
}
.nav-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  text-decoration: none; white-space: nowrap;
  padding: 6px 10px; margin: -6px 0 -6px -10px;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
}
.nav-back:hover {
  color: var(--text-primary);
  background: #f8fafc;
}
.nav-back-icon {
  font-size: 18px; line-height: 1;
  font-weight: 400;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; color: var(--text-primary);
  text-decoration: none;
}
.nav-logo:hover { color: var(--text-primary); }
.site-logo {
  display: block; height: 28px; width: auto;
  object-fit: contain;
}
.site-logo--lg { height: 48px; margin: 0 auto 8px; }
.login-logo { text-align: center; margin-bottom: 8px; }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-link-short { display: none; }
.nav-link {
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  text-decoration: none; transition: color var(--transition);
}
.nav-link:hover { color: var(--text-primary); }
.nav-link--active { color: var(--text-primary); font-weight: 600; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: transform var(--transition), opacity var(--transition);
}
.nav-toggle.is-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.is-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle.is-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.home-portal-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 820px;
  margin: 32px auto;
  text-align: left;
}
.home-portal-card {
  display: block;
  padding: 28px;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition);
}
.home-portal-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.home-portal-title {
  font-size: 20px;
  font-weight: 700;
  margin: 8px 0 10px;
  color: var(--text-primary);
}
.home-portal-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-blue);
}
.portal-page { padding-top: 24px; padding-bottom: 48px; }
.portal-section { margin-bottom: 0; }
.portal-cta-row { margin-bottom: 24px; }

.user-profile {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 500; color: var(--text-primary);
}
.logout-btn {
  background: none; border: none; font-size: 13px; color: var(--text-muted);
  cursor: pointer; font-family: inherit; font-weight: 500;
}
.logout-btn:hover { color: var(--text-primary); text-decoration: underline; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm); transition: all var(--transition);
  border: none; text-decoration: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-large { padding: 16px 24px; font-size: 16px; border-radius: var(--radius-md); }
.btn-full { width: 100%; padding: 14px; font-size: 15px; border-radius: var(--radius-sm); }

.btn-secondary {
  background: #f1f5f9; color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-primary {
  background: var(--color-green); color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}
.btn-primary:hover { background: var(--color-green-hover); transform: translateY(-1px); }

.btn-blue {
  background: var(--color-blue); color: white;
}
.btn-blue:hover { background: var(--color-blue-hover); transform: translateY(-1px); }

.btn-dark-action {
  background: white; color: var(--text-primary);
  padding: 8px 16px; font-size: 13px; border-radius: var(--radius-sm);
}
.btn-dark-action:hover:not(:disabled) { background: #f8fafc; transform: translateY(-1px); }

.btn-outline {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border-light); padding: 10px 20px;
}
.btn-outline:hover { border-color: var(--text-muted); }

/* --- Layout --- */
.container { max-width: 680px; margin: 0 auto; padding: 100px 24px 60px; }

/* --- Developer Hero --- */
.section-hero { text-align: center; margin-bottom: 60px; }
.hero-title {
  font-size: 48px; font-weight: 800; letter-spacing: -0.04em;
  margin-bottom: 16px; line-height: 1.1;
}
.hero-subtitle {
  font-size: 18px; color: var(--text-secondary); margin-bottom: 40px;
}

/* Developer Dashboard */
.dev-dashboard-panel { display: flex; flex-direction: column; gap: 16px; margin-bottom: 40px; }
.card {
  background: #ffffff; border: 1px solid var(--border-light);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  text-align: left;
}
.dark-card {
  background: var(--bg-card-dark); border: 1px solid var(--border-dark);
  color: var(--text-on-dark);
  box-shadow: var(--shadow-md);
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border-dark);
  display: flex; justify-content: space-between; align-items: center;
}
.card-header .label { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; color: var(--text-muted); }
.status-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 12px; }
.status-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.status-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.card-body { padding: 20px; }
.balance-row { display: flex; justify-content: space-between; align-items: center; }
.balance-text { font-family: var(--font-mono); font-size: 20px; font-weight: 700; }
.balance-sub { font-size: 13px; color: var(--text-muted); }

.info-card { padding: 24px; text-align: center; margin-bottom: 40px; }
.info-card p { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }

/* Install Block */
.install-block { margin-bottom: 24px; }
.links-block { display: flex; justify-content: center; gap: 24px; }
.text-link { font-size: 14px; color: var(--text-secondary); text-decoration: none; font-weight: 500; }
.text-link:hover { color: var(--text-primary); text-decoration: underline; }

/* Scroll Arrow */
.scroll-indicator { text-align: center; margin: 40px 0 80px; }
.scroll-indicator a { color: var(--text-muted); transition: color var(--transition); }
.scroll-indicator a:hover { color: var(--text-primary); }

/* --- Developer Earnings Portal --- */
.section-earnings { margin-bottom: 80px; scroll-margin-top: 80px; }
.earnings-header { text-align: center; margin-bottom: 32px; }
.text-green { color: #059669; }

.earnings-hero { padding: 24px; margin-bottom: 16px; }
.earnings-hero-top { margin-bottom: 20px; }
.earnings-balance-big {
  display: block; font-family: var(--font-mono); font-size: 40px; font-weight: 800;
  margin-top: 8px; letter-spacing: -0.02em;
}
.earnings-hero-actions {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border-dark);
}
.earnings-action-btns { display: flex; gap: 8px; }
.earnings-stripe-row { display: flex; justify-content: space-between; align-items: center; }

.earnings-stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px;
}
.stat-card { padding: 20px; text-align: center; }
.stat-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-family: var(--font-mono); font-size: 22px; font-weight: 700; }

.earnings-history-card { overflow: hidden; }
.earnings-history-header { border-bottom: 1px solid var(--border-light); }
.earnings-history-list { padding: 0; }
.earnings-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border-light);
}
.earnings-row:last-child { border-bottom: none; }
.earnings-row-left { display: flex; align-items: center; gap: 10px; }
.earnings-row-amount { font-family: var(--font-mono); font-weight: 700; font-size: 15px; }
.earnings-row-source { font-size: 12px; color: var(--text-muted); }
.earnings-row-date { font-size: 13px; color: var(--text-secondary); }
.earnings-empty { padding: 32px 20px; text-align: center; font-size: 14px; color: var(--text-muted); }

@media (max-width: 600px) {
  .earnings-stats-grid { grid-template-columns: 1fr; }
  .earnings-balance-big { font-size: 32px; }
}

/* --- Advertiser Section --- */
.section-advertisers { margin-bottom: 60px; scroll-margin-top: 80px; }
.advertiser-header { text-align: center; margin-bottom: 32px; }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; display: block; margin-bottom: 12px; }
.section-title { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 16px; line-height: 1.2; }
.section-desc { font-size: 16px; color: var(--text-secondary); max-width: 540px; margin: 0 auto; }

/* Form */
.form-card {
  padding: 32px;
  box-shadow: var(--shadow-lg);
  background: #fff;
  border: 1px solid #e2e8f0;
}
.form-group { margin-bottom: 24px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.form-label .label-hint { font-weight: 500; color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.form-label .required { color: #dc2626; }
.form-input {
  width: 100%; padding: 12px 16px; font-family: var(--font-sans); font-size: 15px;
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text-primary);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: all var(--transition); outline: none;
}
/* Advertiser checkout — solid fields (glass inputs vanish on white cards) */
.form-card .form-input,
.form-card .form-textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-primary);
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.form-card .form-textarea {
  min-height: 72px;
  resize: vertical;
}
.form-card .form-input::placeholder,
.form-card .form-textarea::placeholder {
  color: #94a3b8;
}
.form-card .form-input:hover,
.form-card .form-textarea:hover {
  border-color: #94a3b8;
}
.form-card .form-input:focus,
.form-card .form-textarea:focus {
  background: #fff;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.form-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); background: rgba(255,255,255,0.9); }
.form-input::placeholder { color: var(--text-muted); }
.form-hint { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.form-section-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

/* Headline field — isolated from glass .form-input (textarea/input was collapsing) */
.headline-field-wrap {
  display: block !important;
  border: 2px solid #64748b !important;
  border-radius: 10px;
  background: #fff !important;
  overflow: visible !important;
  min-height: 52px;
  margin-top: 8px;
}
.headline-input,
input#ad-text.headline-input {
  display: block !important;
  width: 100% !important;
  min-height: 52px !important;
  height: auto !important;
  padding: 14px 16px !important;
  font-family: var(--font-sans);
  font-size: 16px !important;
  line-height: 1.4 !important;
  color: #0f172a !important;
  background: #fff !important;
  border: none !important;
  outline: none;
  box-shadow: none !important;
  -webkit-text-fill-color: #0f172a !important;
  opacity: 1 !important;
  visibility: visible !important;
  appearance: auto;
  -webkit-appearance: none;
}
.headline-field-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.headline-input::placeholder {
  color: #94a3b8;
}

/* Tier Grid */
.tier-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tier-option {
  padding: 16px; border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  text-align: center; cursor: pointer; transition: all var(--transition);
  background: #ffffff;
}
.tier-option:hover { border-color: var(--border-focus); }
.tier-option.selected { border-color: var(--border-focus); background: rgba(59, 130, 246, 0.08); }
.tier-impressions { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--text-primary); }
.tier-price { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

.form-error { margin-top: 16px; padding: 12px; background: #fee2e2; color: #b91c1c; border-radius: var(--radius-sm); font-size: 14px; text-align: left; }

/* Ad preview (advertiser form) */
.ad-preview { margin-bottom: 24px; }
.ad-preview-card {
  margin-top: 8px; padding: 20px; border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-primary); text-align: center;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}
.ad-preview-image {
  max-width: 100%; max-height: 120px; border-radius: 10px;
  margin-bottom: 12px; object-fit: contain;
}
.ad-preview-text {
  font-size: 16px; font-weight: 700; line-height: 1.35;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.ad-preview-cta {
  display: inline-block; font-size: 13px; font-weight: 600;
  padding: 8px 20px; border-radius: 8px;
  background: var(--color-blue);
  color: #ffffff;
}

/* Active Campaigns */
.advertiser-dashboard { margin-bottom: 20px; }
.advertiser-stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.campaigns-list { display: flex; flex-direction: column; gap: 12px; }
.campaign-item {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 18px; border: 1px solid var(--border-light); border-radius: var(--radius-md);
  background: #ffffff;
}
.camp-thumb {
  width: 56px; height: 56px; border-radius: 8px; object-fit: cover;
  flex-shrink: 0; background: #f1f5f9;
}
.camp-main { flex: 1; min-width: 0; }
.camp-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.camp-status-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  padding: 3px 10px; border-radius: 999px; text-transform: uppercase;
}
.camp-status--active { background: rgba(16, 185, 129, 0.15); color: #059669; }
.camp-status--paused { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.camp-status--exhausted { background: rgba(100, 116, 139, 0.15); color: #64748b; }
.camp-status--draft { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.camp-cpm { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text-muted); }
.camp-text { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.camp-url { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 12px; }
.camp-progress { margin-bottom: 10px; }
.camp-progress-bar {
  height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin-bottom: 6px;
}
.camp-progress-fill {
  height: 100%; background: linear-gradient(90deg, #2563eb, #3b82f6);
  border-radius: 999px; transition: width 0.3s ease;
}
.camp-progress-label { font-size: 12px; color: var(--text-secondary); }
.camp-stats-row {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.camp-stats-row span { font-family: var(--font-mono); }
.camp-action-btn { flex-shrink: 0; margin-top: 4px; min-width: 80px; }
.camp-exhausted-label {
  flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--text-muted);
  padding-top: 6px;
}

@media (max-width: 768px) {
  .advertiser-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Live Market --- */
.section-market { margin-bottom: 60px; }
.market-header { text-align: center; margin-bottom: 24px; }
.market-card { padding: 0; overflow: hidden; }
.queue-list { display: flex; flex-direction: column; }
.queue-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  padding: 16px 24px; border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}
.queue-item:last-child { border-bottom: none; }
.q-left { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.q-rank { font-family: var(--font-mono); font-weight: 700; color: var(--text-muted); width: 24px; flex-shrink: 0; }
.q-text { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.q-bid { font-family: var(--font-mono); font-weight: 600; color: var(--text-primary); }
.q-served { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.q-rem { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.queue-empty { padding: 32px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* --- Footer --- */
.footer { padding: 40px 0; border-top: 1px solid var(--border-light); font-size: 14px; color: var(--text-muted); }
.footer a { color: inherit; text-decoration: none; }
.footer a:hover { color: var(--text-primary); }

/* --- Legal Pages --- */
.legal-page { padding: 100px 0 60px; min-height: calc(100vh - 120px); }
.legal-container { max-width: 720px; }
.legal-container h1 {
  font-size: 36px; font-weight: 800; letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.legal-updated { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; }
.legal-container section { margin-bottom: 28px; }
.legal-container h2 {
  font-size: 20px; font-weight: 700; margin-bottom: 10px;
  color: var(--text-primary);
}
.legal-container h3 {
  font-size: 15px; font-weight: 600; margin: 14px 0 8px;
  color: var(--text-secondary);
}
.legal-container p, .legal-container li {
  font-size: 15px; line-height: 1.7; color: var(--text-secondary);
  margin-bottom: 10px;
}
.legal-container ul { padding-left: 20px; margin-bottom: 12px; }
.legal-container a { color: var(--color-blue); text-decoration: none; }
.legal-container a:hover { text-decoration: underline; }
.legal-back {
  margin-top: 40px; padding-top: 24px;
  border-top: 1px solid var(--border-light);
  font-size: 14px; color: var(--text-muted);
}
.legal-back a { color: var(--text-secondary); font-weight: 600; }

/* --- Toast --- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px; border-radius: var(--radius-sm);
  background: var(--text-primary); color: white;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.16,1,0.3,1);
}
.toast--error { background: #ef4444; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* --- Sign In Modal --- */
body.modal-open { overflow: hidden; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.modal-overlay.is-open {
  opacity: 1; visibility: visible; pointer-events: auto;
}

.modal-card {
  position: relative; width: 100%; max-width: 420px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  box-shadow:
    0 24px 48px -12px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  overflow: hidden;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.is-open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.modal-brand {
  display: flex; align-items: center; gap: 10px;
}
.modal-brand-icon { border-radius: 8px; }
.modal-brand-text {
  font-size: 15px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text-primary);
}
.modal-close {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  color: var(--text-muted); cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.modal-close:hover {
  background: #fff; color: var(--text-primary);
  border-color: rgba(15, 23, 42, 0.14);
}

.modal-body { padding: 24px 28px 28px; }

.modal-mode-tabs {
  display: flex; gap: 4px;
  padding: 4px; margin-bottom: 22px;
  background: #f1f5f9;
  border-radius: 10px;
}
.modal-mode-tab {
  flex: 1; padding: 10px 12px;
  background: transparent; border: none; border-radius: 8px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.modal-mode-tab:hover { color: var(--text-secondary); }
.modal-mode-tab.is-active {
  background: #fff; color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.modal-title {
  font-size: 24px; font-weight: 800; letter-spacing: -0.03em;
  margin-bottom: 6px; text-align: left;
}
.modal-subtitle {
  font-size: 14px; line-height: 1.5;
  color: var(--text-muted); margin-bottom: 22px; text-align: left;
}

.modal-google-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 13px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--text-primary); cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.modal-google-btn:hover {
  background: #f8fafc; border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.modal-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0 20px;
  color: var(--text-muted); font-size: 12px; font-weight: 500;
  text-transform: lowercase;
}
.modal-divider::before, .modal-divider::after {
  content: ""; flex: 1; height: 1px; background: #e2e8f0;
}
.modal-divider span { white-space: nowrap; }

.modal-form-group { margin-bottom: 14px; text-align: left; }
.modal-form-group .form-label {
  font-size: 13px; font-weight: 600; letter-spacing: 0;
  color: var(--text-secondary); margin-bottom: 6px;
}
.modal-input {
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 15px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.modal-input:focus {
  background: #fff;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.modal-error {
  margin-bottom: 14px; padding: 11px 14px;
  background: #fef2f2; color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 10px; font-size: 13px; line-height: 1.45;
  text-align: left;
}
.modal-submit-btn {
  margin-top: 4px;
  padding: 14px; font-size: 15px; font-weight: 600;
  border-radius: 10px;
}

.link-btn {
  background: none; border: none; color: var(--color-blue);
  font-weight: 600; cursor: pointer; font-family: inherit; font-size: 13px;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: row;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    position: relative;
  }
  .nav-container--portal .nav-logo-text { display: none; }
  .nav-back {
    padding: 8px 10px;
    margin: 0;
    font-size: 15px;
  }
  .nav-toggle { display: flex; margin-left: auto; }
  .nav-menu {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    padding: 12px 16px 16px;
    z-index: 110;
  }
  .nav-menu.is-open { display: flex; }
  body.nav-open { overflow: hidden; }
  .nav-pages {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
  }
  .nav-pages .nav-link {
    flex: none;
    text-align: left;
    font-size: 15px;
    padding: 12px 4px;
    border-radius: 6px;
  }
  .nav-pages .nav-link:hover { background: #f8fafc; }
  .nav-link-full { display: inline; }
  .nav-link-short { display: none; }
  #auth-section {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    padding: 4px 0;
  }
  .user-profile {
    width: 100%;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 12px;
    font-size: 14px;
  }
  .user-profile span {
    max-width: none;
    flex: 1;
  }
  .container { padding: 88px 16px 48px; }
  .section-hero { margin-bottom: 40px; }
  .hero-title { font-size: 36px; }
  .hero-subtitle { font-size: 17px; margin-bottom: 28px; }
  .home-portal-cards { grid-template-columns: 1fr; margin: 20px auto; gap: 16px; }
  .home-portal-card { padding: 22px 20px; }
  .section-title { font-size: 26px; }
  .section-desc { font-size: 15px; max-width: 100%; }
  .form-card { padding: 20px 16px; }
  .form-group { margin-bottom: 20px; }
  .form-label .label-hint { display: inline; }
  .form-card .form-input,
  .headline-input,
  input#ad-text.headline-input {
    font-size: 16px !important;
    min-height: 48px !important;
  }
  .tier-grid { grid-template-columns: 1fr; gap: 10px; }
  .tier-option { padding: 14px; }
  .advertiser-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 16px 12px; }
  .stat-value { font-size: 18px; }
  .earnings-hero { padding: 20px 16px; }
  .earnings-hero-actions {
    flex-direction: column; align-items: stretch; gap: 12px;
  }
  .earnings-action-btns {
    flex-direction: column; width: 100%;
  }
  .earnings-action-btns .btn { width: 100%; }
  .queue-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
    gap: 10px;
  }
  .q-right {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
  .ad-preview-card { padding: 16px; }
  .btn-install { width: 100%; }
  .btn-full { padding: 16px; font-size: 16px; }
  .info-card { padding: 20px 16px; }
}

@media (max-width: 640px) {
  .hero-title { font-size: 32px; }
  .section-title { font-size: 24px; }
  .section-label { font-size: 11px; }
  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal-card { border-radius: 16px 16px 0 0; max-width: 100%; }
  .modal-body { padding: 20px 20px 28px; }
  .modal-title { font-size: 22px; }
  .campaign-item { flex-direction: column; }
  .camp-action-btn { width: 100%; margin-top: 8px; }
  .camp-header { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 28px; }
  .nav-logo span { font-size: 16px; }
  .advertiser-stats-grid { grid-template-columns: 1fr; }
  .earnings-stats-grid { grid-template-columns: 1fr; }
  .earnings-balance-big { font-size: 30px; }
  .form-section-title { font-size: 11px; }
  .form-hint { font-size: 12px; }
  .q-served, .q-rem { font-size: 12px; }
}
