/* =========================================================
   Portail entrepreneur — modernisé
   Le Réseau Réno design system (navy + cool grey, dual theme)
   ========================================================= */

@import url("/static/entrepreneur-portal-tokens.css");

/* --- Level metal colors (added; silver = brand grey, gold = brand amber) --- */
:root {
  --metal-bronze:      #b07a43;
  --metal-bronze-deep: #8a5a2a;
  --metal-bronze-soft: #d8b58a;

  --metal-silver:      #9ca6b1;
  --metal-silver-deep: #6f7884;
  --metal-silver-soft: #d2d9e0;

  --metal-gold:        #e8a417;
  --metal-gold-deep:   #b8790b;
  --metal-gold-soft:   #f7d27a;

  --maxw: 960px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-md);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font-family: inherit; }

/* ============ App shell ============ */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--space-6);
  padding: 0 var(--space-9);
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-shrink: 0;
}
.topbar-brand img {
  height: 64px;
  width: auto;
  display: block;
  margin: 0 0 0 -10px;
  padding: 0;
  line-height: 0;
}
/* desktop tabs live in the bar */
.topbar-nav { display: flex; gap: var(--space-2); margin-left: var(--space-3); }
.topbar-spacer { flex: 1; }

.navtab {
  appearance: none; border: 0; background: transparent;
  color: var(--muted); font-weight: 600; font-size: var(--text-md);
  height: 64px; padding: 0 var(--space-3);
  cursor: pointer; position: relative;
  display: inline-flex; align-items: center; gap: var(--space-2);
  text-decoration: none; white-space: nowrap;
  font-family: inherit;
}
a.navtab { color: var(--muted); }
a.navtab:hover { color: var(--text); }
.navtab svg { width: 18px; height: 18px; }
.navtab:hover { color: var(--text); }
.navtab.active { color: var(--text); }
.navtab.active::after {
  content: ""; position: absolute; left: var(--space-3); right: var(--space-3); bottom: 0;
  height: 2px; background: var(--accent); border-radius: 2px;
}

/* ---- Account chip + dropdown ---- */
.acct { position: relative; flex-shrink: 0; }
.acct-chip {
  display: inline-flex; align-items: center; gap: var(--space-3);
  height: 44px; padding: 0 var(--space-3) 0 var(--space-2);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-pill); cursor: pointer; color: var(--text);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.acct-chip:hover { border-color: var(--accent); }
.acct-chip .chev { width: 16px; height: 16px; color: var(--muted); transition: transform 0.15s ease; }
.acct-chip[aria-expanded="true"] .chev { transform: rotate(180deg); }
.acct-name { font-weight: 600; font-size: var(--text-md); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

.avatar {
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  background: var(--avatar-user); color: var(--avatar-user-fg);
  display: grid; place-items: center; font-weight: 700; font-size: var(--text-sm);
  flex-shrink: 0;
}

.acct-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 300px; max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-popover);
  padding: var(--space-3); z-index: 50;
  animation: pop 0.13s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.acct-head { display: flex; gap: var(--space-4); align-items: center; padding: var(--space-4); }
.acct-head .avatar { width: 40px; height: 40px; font-size: var(--text-md); }
.acct-head-text { min-width: 0; }
.acct-head-name { font-weight: 700; font-size: var(--text-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-head-mail { color: var(--muted); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.acct-info {
  display: grid; gap: var(--space-3);
  padding: var(--space-4); margin: var(--space-2) 0;
  background: var(--panel-soft); border: 1px solid var(--line); border-radius: var(--radius-md);
}
.acct-info-row { display: flex; align-items: flex-start; gap: var(--space-3); font-size: var(--text-sm); }
.acct-info-row svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; margin-top: 2px; }
.acct-info-row .k { color: var(--muted); }
.acct-info-row .v { color: var(--text); font-weight: 500; }

.acct-sep { height: 1px; background: var(--line); margin: var(--space-2) 0; }

.menu-item {
  display: flex; align-items: center; gap: var(--space-4); width: 100%;
  appearance: none; border: 0; background: transparent; cursor: pointer;
  text-align: left; color: var(--text); font-size: var(--text-md); font-weight: 500;
  padding: var(--space-4); border-radius: var(--radius-md);
}
.menu-item svg { width: 18px; height: 18px; color: var(--muted); }
.menu-item:hover { background: var(--surface-hover); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }
a.menu-item { text-decoration: none; }
.menu-item-home { display: none; }

.menu-theme { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); }
.menu-theme-label { display: flex; align-items: center; gap: var(--space-4); font-size: var(--text-md); font-weight: 500; }
.menu-theme-label svg { width: 18px; height: 18px; color: var(--muted); }

/* theme switch (from DS) */
.theme-switch { width: 46px; height: 26px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.theme-switch-track {
  display: block; width: 46px; height: 26px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-soft); position: relative;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.theme-switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 999px;
  background: var(--accent-muted); transition: transform 0.2s ease, background 0.2s ease;
}
.theme-switch[aria-checked="true"] .theme-switch-track { background: var(--accent); border-color: var(--accent); }
.theme-switch[aria-checked="true"] .theme-switch-thumb { transform: translateX(20px); background: var(--accent-fg); }

/* mobile tab bar (hidden on desktop) */
.mobile-tabs { display: none; }

/* ============ Main ============ */
.main {
  flex: 1; width: 100%; max-width: var(--maxw);
  margin: 0 auto; padding: var(--space-12) var(--space-9) var(--space-16);
}

/* ---- Level hero ---- */
.level-hero {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--panel);
  padding: var(--space-9);
  display: grid; grid-template-columns: auto 1fr; gap: var(--space-9);
  align-items: center;
}

/* Medal */
.medal { position: relative; width: 120px; height: 120px; flex-shrink: 0; justify-self: center; }
.medal-disc {
  position: absolute; inset: 0; border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: inset 0 2px 6px rgba(255,255,255,0.45), inset 0 -6px 12px rgba(0,0,0,0.25);
}
.medal-disc svg { width: 46px; height: 46px; }
.medal-ring {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid transparent;
}
.medal-num {
  position: absolute; bottom: -4px; right: -4px;
  min-width: 30px; height: 30px; padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center;
  font-weight: 800; font-size: var(--text-sm); font-variant-numeric: tabular-nums;
  color: var(--text);
}
.medal[data-level="bronze"] .medal-disc { background: radial-gradient(circle at 38% 30%, var(--metal-bronze-soft), var(--metal-bronze) 55%, var(--metal-bronze-deep)); color: #3a2410; }
.medal[data-level="argent"] .medal-disc { background: radial-gradient(circle at 38% 30%, var(--metal-silver-soft), var(--metal-silver) 55%, var(--metal-silver-deep)); color: #2a2f36; }
.medal[data-level="or"]     .medal-disc { background: radial-gradient(circle at 38% 30%, var(--metal-gold-soft), var(--metal-gold) 55%, var(--metal-gold-deep)); color: #5a3c05; }

/* medal entrance + level-up pulse */
.medal-anim { animation: medalIn 0.5s cubic-bezier(0.2,0.7,0.3,1) both; }
@keyframes medalIn { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }
.medal.pulse .medal-ring { animation: ringPulse 0.9s ease-out 2; }
@keyframes ringPulse {
  0%   { box-shadow: 0 0 0 0 var(--accent); opacity: 0.9; }
  100% { box-shadow: 0 0 0 16px transparent; opacity: 0; }
}

.level-body { min-width: 0; }
.level-eyebrow { font-size: var(--text-2xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--space-2); }
.level-name { font-size: var(--text-3xl); font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: var(--leading-tight); }
.level-count { color: var(--muted); margin: var(--space-2) 0 0; font-size: var(--text-md); }
.level-count strong { color: var(--text); font-variant-numeric: tabular-nums; }

.progress { margin-top: var(--space-7); }
.progress-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: var(--text-sm); margin-bottom: var(--space-3);
}
.progress-meta .next { color: var(--muted); }
.progress-meta .next b { color: var(--text); font-variant-numeric: tabular-nums; }
.progress-meta .pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-track {
  height: 12px; border-radius: var(--radius-pill);
  background: var(--panel-soft); border: 1px solid var(--line);
  overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: var(--radius-pill);
  transition: width 0.7s cubic-bezier(0.2,0.7,0.3,1);
}
.progress-fill[data-level="bronze"] { background: var(--metal-bronze); }
.progress-fill[data-level="argent"] { background: var(--metal-silver-deep); }
.progress-fill[data-level="or"]     { background: var(--metal-gold); }

.level-benefit {
  display: flex; gap: var(--space-3); align-items: flex-start;
  margin-top: var(--space-7); padding-top: var(--space-6);
  border-top: 1px solid var(--line);
  font-size: var(--text-sm); color: var(--muted);
}
.level-benefit svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.level-benefit b { color: var(--text); font-weight: 600; }

/* ---- Upload zone ---- */
.portal-view-hidden { display: none; }

.upload-wrap { margin-top: var(--space-9); }
.upload-zone {
  border: 2px dashed var(--line); border-radius: var(--radius-lg);
  background: var(--panel);
  padding: var(--space-16) var(--space-9);
  text-align: center; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-4);
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: var(--surface-hover); }
.upload-icon {
  width: 64px; height: 64px; border-radius: var(--radius-pill);
  background: var(--panel-soft); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--accent);
}
.upload-icon svg { width: 30px; height: 30px; }
.upload-title { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.upload-sub { color: var(--muted); font-size: var(--text-md); margin: 0; max-width: 46ch; }
.upload-btn {
  margin-top: var(--space-3);
  height: 48px; padding: 0 var(--space-9);
  border: 0; border-radius: var(--radius-md);
  background: var(--accent); color: var(--accent-fg);
  font-weight: 700; font-size: var(--text-md); cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--space-3);
}
.upload-btn svg { width: 18px; height: 18px; }
.upload-formats { font-size: var(--text-xs); color: var(--muted); margin: var(--space-3) 0 0; }

/* uploading list */
.upload-list {
  display: flex; flex-direction: column; gap: var(--space-3);
  margin-top: var(--space-6);
  margin-bottom: var(--space-8);
}
.upload-item {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--panel); font-size: var(--text-md);
  animation: rowIn 0.25s ease-out both;
}
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.upload-item .fi { width: 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--panel-soft); color: var(--muted); flex-shrink: 0; }
.upload-item .fi svg { width: 18px; height: 18px; }
.upload-item .fn { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .fs { font-size: var(--text-xs); color: var(--muted); display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.upload-item .fs.ok { color: var(--status-success); }
.upload-item .fs svg { width: 15px; height: 15px; }
.upload-item .fs .spin,
.upload-item .fs svg.spin,
#entrepreneur-portal-root .spin,
#entrepreneur-portal-root svg.spin {
  display: inline-block;
  flex-shrink: 0;
  transform-origin: 50% 50%;
  animation: portal-spin 0.75s linear infinite;
  will-change: transform;
}
@keyframes portal-spin { to { transform: rotate(360deg); } }

/* ---- Levels explainer ---- */
.levels-wrap { margin-top: var(--space-12); }
.levels-grid {
  margin-top: var(--space-9);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5);
}
.section-label { font-size: var(--text-md); font-weight: 700; margin: 0 0 var(--space-5); }
.lvl-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--panel); padding: var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-3);
  position: relative;
}
.lvl-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.lvl-card-head { display: flex; align-items: center; gap: var(--space-4); }
.lvl-dot { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 1px 3px rgba(255,255,255,0.4), inset 0 -3px 6px rgba(0,0,0,0.25); }
.lvl-dot[data-level="bronze"] { background: radial-gradient(circle at 38% 30%, var(--metal-bronze-soft), var(--metal-bronze) 60%, var(--metal-bronze-deep)); }
.lvl-dot[data-level="argent"] { background: radial-gradient(circle at 38% 30%, var(--metal-silver-soft), var(--metal-silver) 60%, var(--metal-silver-deep)); }
.lvl-dot[data-level="or"]     { background: radial-gradient(circle at 38% 30%, var(--metal-gold-soft), var(--metal-gold) 60%, var(--metal-gold-deep)); }
.lvl-name { font-weight: 700; font-size: var(--text-xl); }
.lvl-range { font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.lvl-desc { font-size: var(--text-sm); color: var(--muted); margin: 0; line-height: var(--leading-snug); }
.lvl-badge-now {
  position: absolute; top: var(--space-5); right: var(--space-5);
  font-size: var(--text-2xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent-muted); border-radius: var(--radius-pill);
  padding: 2px 8px;
}

/* ============ Historique ============ */
.page-head { margin-bottom: var(--space-8); }
.page-head h2 { font-size: var(--text-3xl); font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: var(--leading-tight); }
.page-head p { color: var(--muted); margin: var(--space-2) 0 0; font-size: var(--text-md); }

.hist-stats { display: flex; gap: var(--space-5); margin-bottom: var(--space-8); flex-wrap: wrap; }
.stat {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--panel); padding: var(--space-5) var(--space-7); flex: 1; min-width: 140px;
}
.stat .n { font-size: var(--text-3xl); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1; }
.stat .l { color: var(--muted); font-size: var(--text-sm); margin-top: var(--space-3); }

.hist-list { display: flex; flex-direction: column; gap: var(--space-4); }
.hist-card {
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel);
  padding: var(--space-5) var(--space-6);
  display: grid; grid-template-columns: 40px 1fr auto auto; gap: var(--space-6); align-items: center;
}
.hist-ico { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--panel-soft); display: grid; place-items: center; color: var(--muted); }
.hist-ico svg { width: 20px; height: 20px; }
.hist-main { min-width: 0; }
.hist-cat { font-weight: 600; font-size: var(--text-md); }
.hist-meta { color: var(--muted); font-size: var(--text-sm); margin-top: 2px; display: flex; gap: var(--space-4); flex-wrap: wrap; }
.hist-meta span { display: inline-flex; align-items: center; gap: 4px; }
.hist-meta svg { width: 13px; height: 13px; }
.hist-price { font-weight: 700; font-variant-numeric: tabular-nums; font-size: var(--text-lg); letter-spacing: -0.01em; white-space: nowrap; }

.status-badge {
  font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 10px; border-radius: var(--radius-pill); border: 1px solid var(--line);
  white-space: nowrap;
}
.status-badge.verified { color: var(--accent); border-color: var(--accent-muted); }
.status-badge.needs_review, .status-badge.pending { color: var(--badge-pending-fg); border-color: var(--badge-pending-border); }
.status-badge.rejected { color: var(--badge-rejected-fg); border-color: var(--badge-rejected-border); }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--overlay);
  display: grid; place-items: center; padding: var(--space-7);
  animation: fade 0.15s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(560px, 100%); max-height: 90vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  animation: modalIn 0.18s cubic-bezier(0.2,0.7,0.3,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
  padding: var(--space-7) var(--space-8); border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: var(--text-xl); font-weight: 700; }
.modal-close {
  width: 36px; height: 36px; min-width: 36px; padding: 0;
  border-radius: var(--radius-md); border: 1px solid var(--line);
  background: var(--panel-soft); color: var(--muted); cursor: pointer;
  display: grid; place-items: center; line-height: 0;
}
.modal-close:hover { border-color: var(--accent); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; display: block; }
.modal-body { padding: var(--space-8); display: flex; flex-direction: column; gap: var(--space-7); }
.modal-note {
  display: flex; gap: var(--space-3); font-size: var(--text-sm); color: var(--muted);
  background: var(--panel-soft); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
}
.modal-note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.field { display: flex; flex-direction: column; gap: var(--space-3); }
.field > label { font-size: var(--text-sm); font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.field input {
  width: 100%; height: 44px; padding: 0 var(--space-5);
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); font: inherit;
}
.field input::placeholder { color: var(--muted); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.checks { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.check {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); cursor: pointer; font-size: var(--text-md); user-select: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.check:hover { border-color: var(--accent); }
.check.on { border-color: var(--accent); background: var(--surface-hover); }
.check .box {
  width: 20px; height: 20px; border-radius: var(--radius-xs);
  border: 1.5px solid var(--line); display: grid; place-items: center; flex-shrink: 0;
  background: var(--panel);
}
.check.on .box { background: var(--accent); border-color: var(--accent); }
.check .box svg { width: 13px; height: 13px; color: var(--accent-fg); opacity: 0; }
.check.on .box svg { opacity: 1; }

.modal-foot {
  display: flex; justify-content: flex-end; gap: var(--space-4);
  padding: var(--space-7) var(--space-8); border-top: 1px solid var(--line);
}
.btn {
  height: 44px; padding: 0 var(--space-8); border-radius: var(--radius-md);
  font-weight: 700; font-size: var(--text-md); cursor: pointer; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: var(--space-3);
}
.btn-ghost { background: var(--panel-soft); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-fg); }

/* ============ Toast ============ */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: var(--space-9); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: var(--space-4);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-pill);
  box-shadow: var(--shadow-card); padding: var(--space-4) var(--space-7);
  font-size: var(--text-md); font-weight: 500; color: var(--text);
  animation: toastIn 0.25s cubic-bezier(0.2,0.7,0.3,1) both;
  max-width: calc(100vw - 32px);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.toast .tdot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast .tdot svg { width: 16px; height: 16px; }
.toast.success .tdot { background: color-mix(in srgb, var(--status-success) 18%, transparent); color: var(--status-success); }
.toast.levelup .tdot[data-level="bronze"] { background: var(--metal-bronze); color: #fff; }
.toast.levelup .tdot[data-level="argent"] { background: var(--metal-silver-deep); color: #fff; }
.toast.levelup .tdot[data-level="or"]     { background: var(--metal-gold); color: #fff; }
.toast b { font-weight: 700; }

/* ============ Responsive ============ */
@media (max-width: 760px) {
  .topbar { padding: 0 18px; gap: var(--space-4); height: 64px; }
  .topbar-brand img { height: 64px; width: auto; }
  .topbar-brand .navtab { display: none; }
  .menu-item-home { display: flex; }
  .topbar-nav { display: none; }
  .acct-name { display: none; }
  .acct-chip { padding: 0 var(--space-2); height: 40px; }

  .mobile-tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3);
    position: sticky; top: 64px; z-index: 30;
    padding: var(--space-4) var(--space-7);
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .mobile-tabs .navtab {
    height: 44px; justify-content: center; border: 1px solid var(--line);
    border-radius: var(--radius-md); background: var(--panel);
  }
  .mobile-tabs .navtab.active { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
  .mobile-tabs .navtab.active::after { display: none; }

  .main { padding: var(--space-8) var(--space-7) var(--space-12); }

  .level-hero { grid-template-columns: 1fr; gap: var(--space-7); padding: var(--space-7); text-align: center; }
  .level-body { text-align: center; }
  .level-benefit { text-align: left; }
  .progress-meta { font-size: var(--text-xs); }

  .upload-zone { padding: var(--space-12) var(--space-6); }
  .upload-title { font-size: var(--text-xl); }

  .levels-grid { grid-template-columns: 1fr; }

  .hist-card { grid-template-columns: 1fr auto; grid-template-areas: "ico status" "main main" "price price"; gap: var(--space-3); }
  .hist-ico { grid-area: ico; }
  .hist-main { grid-area: main; }
  .hist-price { grid-area: price; font-size: var(--text-xl); }
  .hist-card .status-badge { grid-area: status; justify-self: end; }

  .field-row { grid-template-columns: 1fr; }
  .checks { grid-template-columns: 1fr; }
  .modal-overlay { padding: 0; place-items: end stretch; }
  .modal { width: 100%; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  #entrepreneur-portal-root .spin,
  #entrepreneur-portal-root svg.spin {
    animation: portal-spin 0.75s linear infinite !important;
  }
}

/* Auth shell (scoped — does not affect admin) */
.portal-auth-view .auth-card,
#pending-access-view .auth-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: var(--space-9);
  max-width: 480px;
  margin: var(--space-12) auto;
}
.portal-auth-view input,
.portal-auth-view button.primary-btn,
.portal-auth-view button.secondary-btn {
  font-family: inherit;
}
.retry-reasons { font-size: var(--text-sm); color: var(--muted); }
.retry-reasons ul { margin: var(--space-3) 0 0; padding-left: 1.2rem; }
.retry-error { color: var(--danger); font-size: var(--text-sm); margin: 0; }
.field textarea {
  width: 100%; min-height: 120px; padding: var(--space-4);
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); font: inherit; resize: vertical;
}
.hist-failure-details { margin-top: var(--space-3); font-size: var(--text-sm); color: var(--muted); }
.hist-failure-details ul { margin: var(--space-2) 0 0; padding-left: 1.1rem; }
.hist-retry-btn { margin-top: var(--space-3); height: 36px; font-size: var(--text-sm); }
.upload-zone.busy { opacity: 0.7; pointer-events: none; }
#entrepreneur-portal-root:empty { display: none; }
.portal-layout--react .portal-header { display: none; }
.portal-layout--react { max-width: none; padding: 0; }
