/* =============================================
   DASHBOARD STYLES
   Extracted from main.css — Dashboard screen,
   user stats, tabs, history, credits, upgrade CTA
   ============================================= */

/* ── Dashboard Screen ────────────────────────── */
#dashboard-screen {
  display: none; position: fixed; inset: 0; z-index: 8000;
  background: var(--bg); overflow-y: auto;
}
.dash-wrap {
  max-width: 960px; margin: 0 auto; padding: 90px 24px 80px;
  position: relative; z-index: 1;
}
.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 40px;
}
.dash-title {
  font-family: var(--sans); font-size: 1.5rem; font-weight: 800;
  color: var(--text); letter-spacing: -0.5px;
}
.dash-title span { color: var(--accent); }
.dash-close-btn {
  background:linear-gradient(160deg, rgba(28,18,45,0.98) 0%, rgba(10,8,16,0.99) 100%); border:1px solid rgba(200,165,80,0.18);
  border-top:1px solid rgba(200,165,80,0.4); box-shadow:0 2px 0 rgba(200,165,80,0.12), 0 8px 32px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.03); border-radius: 8px; padding: 8px 16px; cursor: pointer;
  font-family: var(--mono); font-size: 0.72rem; color: #f1f5f9;
  text-transform: uppercase; letter-spacing: 1px; transition: color .2s, border-color .2s;
}
.dash-close-btn:hover { color: #fff; border-color: var(--accent); }

/* ── Dashboard Stats Row ────────────────────── */
.dash-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.dash-stat-card {
  background: var(--surface); border: 2px solid rgba(200,165,80,.35);
  border-radius: 10px; padding: 20px;
}
.dash-stat-label {
  font-family: var(--mono); font-size: 0.65rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px;
}
.dash-stat-value {
  font-family: var(--sans); font-size: 1.6rem; font-weight: 800;
  color: var(--text);
}
.dash-stat-value.accent { color: var(--accent); }
.dash-stat-value.green { color: var(--green); }
.dash-stat-sub {
  font-family: var(--mono); font-size: 0.68rem; color: var(--muted);
  margin-top: 4px;
}

/* ── Dashboard Progress Bar ─────────────────── */
.dash-progress-wrap { margin-top: 10px; }
.dash-progress-track {
  height: 4px; background: var(--border2); border-radius: 4px; overflow: hidden;
}
.dash-progress-fill {
  height: 100%; background: var(--accent); border-radius: 4px;
  transition: width .5s ease;
}
.dash-progress-fill.warn { background: #f59e0b; }
.dash-progress-fill.danger { background: var(--accent2); }

/* ── Dashboard Section Title ────────────────── */
.dash-section-title {
  font-family: var(--mono); font-size: 0.7rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 2px; margin-bottom: 16px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

/* ── Dashboard User Info Card ───────────────── */
.dash-user-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 24px; margin-bottom: 24px;
}
.dash-user-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.dash-user-email-big {
  font-family: var(--sans); font-size: 1.1rem; font-weight: 700;
  color: var(--text);
}
.dash-plan-badge {
  font-family: var(--mono); font-size: 0.65rem; padding: 4px 10px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: 1px;
  background: rgba(200,165,80,0.1); color: var(--accent);
  border: 1px solid rgba(200,165,80,0.3);
}
.dash-plan-badge.pro {
  background: rgba(34,197,94,0.1); color: var(--green);
  border-color: rgba(34,197,94,0.3);
}

/* ── Dashboard Table ────────────────────────── */
.dash-table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.dash-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--mono); font-size: 0.78rem;
}
.dash-table th {
  padding: 12px 16px; text-align: left;
  background: var(--surface2); color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; font-size: 0.65rem;
  border-bottom: 1px solid var(--border2);
}
.dash-table td {
  padding: 12px 16px; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover td { background: var(--surface2); }
.dash-badge {
  display: inline-block; font-size: 0.62rem; padding: 2px 8px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: 1px;
}
.dash-badge-free { background: rgba(90,99,128,0.2); color: var(--muted); border: 1px solid var(--border2); }
.dash-badge-pro { background: rgba(34,197,94,0.1); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.dash-badge-admin { background: rgba(200,165,80,0.1); color: var(--accent); border: 1px solid rgba(200,165,80,0.3); }
.dash-mini-bar {
  display: flex; align-items: center; gap: 8px;
}
.dash-mini-track {
  flex: 1; height: 3px; background: var(--border2);
  border-radius: 3px; overflow: hidden; min-width: 60px;
}
.dash-mini-fill {
  height: 100%; background: var(--accent); border-radius: 3px;
}
.dash-loading {
  padding: 40px; text-align: center;
  font-family: var(--mono); font-size: 0.78rem; color: var(--muted);
}
.dash-empty {
  padding: 40px; text-align: center;
  font-family: var(--mono); font-size: 0.78rem; color: var(--muted);
}

/* ── Dashboard Upgrade CTA ─────────────────── */
.dash-upgrade-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(135deg, rgba(200,165,80,0.12), rgba(124,92,255,0.08));
  border: 1px solid rgba(200,165,80,0.25); border-radius: 12px;
  padding: 20px 24px; margin-bottom: 20px; flex-wrap: wrap;
}
.dash-upgrade-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-family: var(--sans); font-size: 0.85rem; font-weight: 700;
  padding: 10px 20px; border-radius: 10px; text-decoration: none;
  white-space: nowrap; transition: opacity .2s;
}
.dash-upgrade-btn:hover { opacity: 0.85; }

/* ── Dashboard Tabs ────────────────────────── */
.dash-tabs {
  display: flex; gap: 0; margin-bottom: 24px;
  border-bottom: 1px solid var(--border2);
}
.dash-tab {
  flex: 1; padding: 12px 16px; text-align: center; cursor: pointer;
  font-family: var(--sans); font-size: 0.85rem; font-weight: 600;
  color: var(--muted); background: none; border: none;
  border-bottom: 2px solid transparent; transition: color .2s, border-color .2s;
}
.dash-tab.active { color: #fff; border-bottom-color: var(--accent); }
.dash-tab:hover { color: var(--text); }

/* ── Credits Badge ──────────────────────────── */
.credits-badge {
  display: none; align-items: center; justify-content: center; gap: 6px;
  font-family: 'IBM Plex Mono', var(--mono), monospace; font-size: 0.7rem; color: #7b8aab;
  margin-top: 12px; text-align: center;
}
.credits-badge.visible { display: flex; }
.credits-badge.low { color: #f97316; }
.credits-badge.empty { color: #ef4444; }

/* ── History ────────────────────────────────── */
.dash-history-wrap { margin-top: 32px; }
.dash-history-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.dash-history-item {
  background: linear-gradient(160deg, rgba(28,18,45,0.98) 0%, rgba(10,8,16,0.99) 100%);
  border: 1px solid rgba(200,165,80,0.15);
  border-top: 1px solid rgba(200,165,80,0.35);
  border-radius: 12px; padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transition: border-color .2s;
}
.dash-history-item:hover { border-color: rgba(200,165,80,0.3); }
.dash-history-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: rgba(200,165,80,0.12); border: 1px solid rgba(200,165,80,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #f1f5f9;
}
.dash-history-info { flex: 1; min-width: 0; }
.dash-history-url {
  font-family: var(--sans); font-size: 0.82rem; font-weight: 600;
  color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 280px;
}
.dash-history-meta {
  font-family: var(--mono); font-size: 0.68rem; color: #94a3b8;
  margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap;
}
.dash-history-meta span { display: flex; align-items: center; gap: 4px; }
.dash-history-lang {
  font-family: var(--mono); font-size: 0.7rem; font-weight: 600;
  color: var(--accent); background: rgba(200,165,80,0.1);
  border: 1px solid rgba(200,165,80,0.2); border-radius: 6px;
  padding: 2px 8px; flex-shrink: 0;
}

.dash-history-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.dash-action-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(200,165,80,0.08); border: 1px solid rgba(200,165,80,0.18);
  color: #cbd5e1; text-decoration: none; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  flex-shrink: 0;
}
.dash-action-btn:hover { opacity: 0.8; }
.dash-action-btn svg { width: 13px; height: 13px; }
/* Download MP3 — verde */
.dash-act-download { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.35); color: #10b981; }
/* Download MP4 — oro */
.dash-act-video { background: rgba(200,165,80,0.15); border-color: rgba(200,165,80,0.35); color: #c8a550; }
/* Transcript TXT — viola */
.dash-act-transcript { background: rgba(200,165,80,0.15); border-color: rgba(200,165,80,0.35); color: #c8a550; }
/* Share link — blu */
.dash-act-share { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.35); color: #3b82f6; }
.dash-act-share.share-copied { background: rgba(34,197,94,0.15); color: #22c55e; border-color: rgba(34,197,94,0.35); }
/* Summary TXT — teal/ciano */
.dash-act-summary-text { background: rgba(6,182,212,0.15); border-color: rgba(6,182,212,0.35); color: #06b6d4; }
/* Summary MP3 — rosa/pink */
.dash-act-summary-audio { background: rgba(236,72,153,0.15); border-color: rgba(236,72,153,0.35); color: #ec4899; }
/* Re-dub — arancione */
.dash-act-redub { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.35); color: #f59e0b; }
/* Delete — rosso */
.dash-act-delete { background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.25); color: #f87171; }
.dash-act-delete:hover { background: rgba(248,113,113,0.25) !important; border-color: rgba(248,113,113,0.45); }
.dash-history-empty {
  font-family: var(--mono); font-size: 0.78rem; color: var(--muted);
  text-align: center; padding: 24px; opacity: 0.6;
}
.dash-history-loading {
  font-family: var(--mono); font-size: 0.75rem; color: var(--muted);
  text-align: center; padding: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   PRODUCT HUB — schermata iniziale "Cosa vuoi gestire?"
   con 2 tasti grossi per scegliere prodotto
   ═══════════════════════════════════════════════════════════════ */
.dash-product-hub {
  margin: 28px 0 20px;
}
.dash-product-hub-title {
  font-family: 'Sora', var(--sans, 'Inter'), sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #e8ecf5;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}
.dash-product-hub-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.dash-product-hub-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 6px;
  padding: 28px 24px;
  border: 1.5px solid transparent;
  border-radius: 16px;
  color: #1a1a2e;
  font-family: 'Sora', var(--sans, 'Inter'), sans-serif;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.3, 1);
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.dash-product-hub-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.4);
}
/* Study card — sfondo avorio chiaro con accento dorato */
.dash-hub-study {
  background: linear-gradient(160deg, #fef8e8 0%, #f5ead0 100%);
  border-color: rgba(200,165,80,0.45);
}
.dash-hub-study:hover {
  background: linear-gradient(160deg, #fef3d8 0%, #f2e2b8 100%);
  border-color: #c8a550;
  box-shadow: 0 14px 36px rgba(200,165,80,0.35);
}
/* Vaivox card — sfondo lavanda chiaro con accento viola */
.dash-hub-vaivox {
  background: linear-gradient(160deg, #f5efff 0%, #e7daff 100%);
  border-color: rgba(168,85,247,0.4);
}
.dash-hub-vaivox:hover {
  background: linear-gradient(160deg, #ede0ff 0%, #dac4ff 100%);
  border-color: #a855f7;
  box-shadow: 0 14px 36px rgba(168,85,247,0.3);
}
.dash-product-hub-icon {
  font-size: 2.6rem;
  line-height: 1;
  margin-bottom: 10px;
}
.dash-product-hub-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1a1a2e;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.dash-hub-study .dash-product-hub-name { color: #5c4a1a; }
.dash-hub-vaivox .dash-product-hub-name { color: #4a1d7c; }
.dash-product-hub-desc {
  font-family: var(--sans, 'Inter'), sans-serif;
  font-size: 0.85rem;
  color: #3d3d5c;
  font-weight: 500;
  line-height: 1.45;
  margin-bottom: 14px;
}
.dash-product-hub-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono, 'IBM Plex Mono'), monospace;
  font-size: 0.75rem;
  color: #555;
  font-weight: 600;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.dash-product-hub-stat-sep {
  color: rgba(0,0,0,0.25);
}
.dash-hub-study .dash-product-hub-stat { color: #8b6f2e; }
.dash-hub-vaivox .dash-product-hub-stat { color: #6d28d9; }
.dash-product-hub-enter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding: 11px 20px;
  border-radius: 100px;
  font-family: 'Sora', var(--sans), sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  transition: gap 0.2s, transform 0.2s, box-shadow 0.2s;
}
.dash-hub-study .dash-product-hub-enter {
  background: linear-gradient(135deg, #c8a550, #a07830);
  color: #fff;
  box-shadow: 0 2px 10px rgba(200,165,80,0.4);
}
.dash-hub-vaivox .dash-product-hub-enter {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  color: #fff;
  box-shadow: 0 2px 10px rgba(168,85,247,0.4);
}
.dash-product-hub-card:hover .dash-product-hub-enter {
  gap: 10px;
  transform: scale(1.02);
}

/* Back-to-hub button (dentro panel) — ben leggibile su light bg */
.dash-back-to-hub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  margin-bottom: 22px;
  background: #fff;
  border: 1.5px solid rgba(200,165,80,0.4);
  border-radius: 10px;
  color: #5c4a1a;
  font-family: 'Sora', var(--sans), sans-serif;
  font-size: 0.8rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.dash-back-to-hub:hover {
  background: #fef8e8;
  border-color: #c8a550;
  color: #8b6f2e;
  box-shadow: 0 4px 12px rgba(200,165,80,0.2);
}

@media (max-width: 600px) {
  .dash-product-hub-cards { grid-template-columns: 1fr; gap: 12px; }
  .dash-product-hub-card { padding: 22px 20px; }
  .dash-product-hub-icon { font-size: 2rem; }
  .dash-product-hub-name { font-size: 1.15rem; }
  .dash-product-hub-desc { font-size: 0.78rem; }
}

/* ═══════════════════════════════════════════════════════════════
   VAIVOX STUDY — Dashboard section (credits + manuali + transazioni)
   ═══════════════════════════════════════════════════════════════ */
.dash-study-credits-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* Balance hero card — sfondo avorio solido, testo scuro per max leggibilità */
.dash-study-balance-card {
  background: linear-gradient(160deg, #fef8e8 0%, #f5ead0 100%);
  border: 1.5px solid #c8a550;
  border-radius: 14px;
  padding: 22px 24px;
  position: relative;
  box-shadow: 0 4px 18px rgba(200,165,80,0.22);
}
.dash-study-balance-label {
  font-family: var(--mono, 'IBM Plex Mono'), monospace;
  font-size: 0.7rem;
  color: #8b6f2e;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 6px;
}
.dash-study-balance-value {
  font-family: 'Sora', var(--sans), sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  color: #5c4a1a;
  line-height: 1;
  letter-spacing: -2px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.dash-study-balance-unit {
  font-size: 1.3rem;
  opacity: 0.85;
}
.dash-study-balance-sub {
  font-size: 0.78rem;
  color: #6b5422;
  font-weight: 500;
  margin-top: 6px;
  font-family: var(--sans, 'Inter'), sans-serif;
}
.dash-study-balance-actions {
  margin-top: 14px;
}
.dash-study-buy-btn {
  display: inline-block;
  padding: 10px 18px;
  background: linear-gradient(135deg, #c8a550, #a07830);
  color: #fff !important;
  border-radius: 8px;
  font-family: 'Sora', var(--sans, 'Inter'), sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 3px 10px rgba(160,120,48,0.35);
}
.dash-study-buy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(160,120,48,0.5);
}

/* Stat card dentro il panel Study — sfondo chiaro con border colorato */
.dash-study-credits-row .dash-stat-card {
  background: #fff;
  border: 1.5px solid rgba(200,165,80,0.35);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.dash-study-credits-row .dash-stat-card .dash-stat-label {
  color: #64648c;
  font-weight: 700;
}
.dash-study-credits-row .dash-stat-card .dash-stat-value {
  color: #1a1a2e;
}
.dash-study-credits-row .dash-stat-card .dash-stat-sub {
  color: #555;
  font-weight: 500;
}
.dash-study-credits-row .dash-stat-card .dash-stat-value.accent {
  color: #a07830;
}

.dash-study-plan-card {
  background: linear-gradient(160deg, #faf5e7 0%, #f2e9d0 100%) !important;
  border-color: #c8a550 !important;
}
.dash-study-plan-card .dash-stat-value {
  color: #5c4a1a !important;
}
.dash-study-plan-card .dash-stat-label { color: #8b6f2e !important; }
.dash-study-plan-card .dash-stat-sub { color: #6b5422 !important; }

/* Study item: sfumatura dorata in hover per distinguerlo dal dubbing */
.dash-study-item:hover {
  border-color: rgba(200,165,80,0.3) !important;
  background: rgba(200,165,80,0.03) !important;
}

/* ═══════════════════════════════════════════════════════════════
   REFERRAL CARD — "Invita amici 2+2 crediti"
   dentro #dash-study-panel, sopra lo storico crediti
   ═══════════════════════════════════════════════════════════════ */
.dash-referral-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 24px;
  padding: 20px 22px;
  background: linear-gradient(135deg, #fef8e8 0%, #fae9c5 100%);
  border: 1.5px solid #c8a550;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(200,165,80,0.2);
}
.dash-referral-emoji {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
}
.dash-referral-body { flex: 1; min-width: 0; }
.dash-referral-title {
  font-family: 'Sora', var(--sans), sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 4px;
  line-height: 1.3;
}
.dash-referral-title strong {
  color: #a07830;
  font-weight: 800;
}
.dash-referral-sub {
  font-family: var(--sans, 'Inter'), sans-serif;
  font-size: 0.82rem;
  color: #3d3d5c;
  margin-bottom: 12px;
  line-height: 1.4;
}
.dash-referral-link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.dash-referral-link-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1.5px solid rgba(200,165,80,0.4);
  border-radius: 8px;
  background: #fff;
  font-family: var(--mono, 'IBM Plex Mono'), monospace;
  font-size: 0.78rem;
  color: #5c4a1a;
  outline: none;
}
.dash-referral-link-row input:focus {
  border-color: #c8a550;
}
.dash-referral-copy-btn,
.dash-referral-share-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-family: 'Sora', var(--sans), sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.dash-referral-copy-btn {
  background: linear-gradient(135deg, #c8a550, #a07830);
  color: #fff;
  box-shadow: 0 2px 8px rgba(200,165,80,0.3);
}
.dash-referral-copy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(200,165,80,0.45);
}
.dash-referral-copy-btn.copied {
  background: #15803d;
}
.dash-referral-share-btn {
  background: #fff;
  color: #8b6f2e;
  border: 1.5px solid #c8a550;
}
.dash-referral-share-btn:hover {
  background: #fef8e8;
}
.dash-referral-stats {
  font-family: var(--mono, 'IBM Plex Mono'), monospace;
  font-size: 0.72rem;
  color: #8b6f2e;
  font-weight: 600;
}
.dash-referral-sep {
  margin: 0 8px;
  color: rgba(139,111,46,0.4);
}

@media (max-width: 600px) {
  .dash-referral-card { flex-direction: column; padding: 16px 18px; }
  .dash-referral-emoji { font-size: 1.8rem; }
  .dash-referral-link-row { flex-direction: column; gap: 6px; }
  .dash-referral-link-row input { width: 100%; }
  .dash-referral-copy-btn,
  .dash-referral-share-btn { width: 100%; }
}

/* Storico transazioni crediti — sfondo avorio solido con testo scuro */
.dash-study-tx-wrap { margin-top: 24px; }
.dash-study-tx-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fef8e8;
  border: 1.5px solid rgba(200,165,80,0.45);
  border-radius: 10px;
  color: #8b6f2e;
  font-family: 'Sora', var(--sans), sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 8px rgba(200,165,80,0.12);
}
.dash-study-tx-toggle:hover {
  background: #fef3d8;
  border-color: #c8a550;
  color: #5c4a1a;
}
.dash-study-tx-toggle svg { transition: transform 0.25s; }
.dash-study-tx-toggle.open svg { transform: rotate(180deg); }

.dash-study-tx-list {
  margin-top: 10px;
  background: #fff;
  border: 1.5px solid rgba(200,165,80,0.3);
  border-radius: 10px;
  padding: 10px 6px;
  max-height: 360px;
  overflow-y: auto;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.dash-study-tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(200,165,80,0.12);
  font-size: 0.82rem;
  color: #1a1a2e;
}
.dash-study-tx-row:last-child { border-bottom: none; }
.dash-study-tx-label {
  font-family: var(--sans, 'Inter'), sans-serif;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #3d3d5c;
}
.dash-study-tx-date {
  font-family: var(--mono, 'IBM Plex Mono'), monospace;
  font-size: 0.68rem;
  color: #8b6f2e;
  font-weight: 500;
  margin-left: 4px;
}
.dash-study-tx-amt {
  font-family: 'Sora', var(--sans), sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
}
.dash-study-tx-amt.tx-positive { color: #15803d; }
.dash-study-tx-amt.tx-negative { color: #c2410c; }

/* Empty state study (manuali) + section titles dentro #dash-study-panel */
#dash-study-panel .dash-history-empty {
  background: #faf7f0;
  border: 1.5px dashed rgba(200,165,80,0.4);
  border-radius: 10px;
  color: #5c4a1a;
  opacity: 1;
  font-weight: 600;
  padding: 28px;
}
#dash-study-panel .dash-history-empty a {
  color: #a07830;
  font-weight: 700;
  text-decoration: underline;
}
#dash-study-panel .dash-section-title {
  color: #8b6f2e;
  font-weight: 700;
  border-bottom-color: rgba(200,165,80,0.25);
}
#dash-study-panel .dash-section-title a {
  color: #a07830 !important;
  font-weight: 700;
}

/* Mobile responsive Study section */
@media (max-width: 800px) {
  .dash-study-credits-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .dash-study-balance-value { font-size: 2.2rem; }
}

/* ── Dashboard Mobile ──────────────────────────── */
@media (max-width: 600px) {
  .dash-wrap { padding: 70px 14px 60px; }
  .dash-header { margin-bottom: 24px; }
  .dash-title { font-size: 1.2rem; }
  .dash-close-btn { padding: 6px 12px; font-size: 0.65rem; }

  .dash-stats { grid-template-columns: 1fr; gap: 10px; margin-bottom: 20px; }
  .dash-stat-card { padding: 14px 16px; }
  .dash-stat-value { font-size: 1.3rem; }

  .dash-user-card { padding: 16px; }
  .dash-user-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .dash-user-email-big { font-size: 0.95rem; }

  .dash-upgrade-cta { flex-direction: column; align-items: stretch; gap: 12px; text-align: center; }

  /* History items: titolo sopra, bottoni sotto */
  .dash-history-item {
    flex-wrap: wrap; padding: 12px 14px; gap: 10px;
  }
  .dash-history-icon { width: 30px; height: 30px; font-size: 0.85rem; }
  .dash-history-info { width: calc(100% - 44px); min-width: 0; }
  .dash-history-url { max-width: 100%; font-size: 0.78rem; }
  .dash-history-meta { font-size: 0.63rem; gap: 8px; }
  .dash-history-lang { font-size: 0.63rem; padding: 2px 6px; }
  .dash-history-actions {
    width: 100%; justify-content: flex-start; gap: 8px;
    padding-top: 6px; border-top: 1px solid rgba(200,165,80,0.1);
  }
  .dash-action-btn { width: 34px; height: 34px; }
}
