/* ════════════════════════════════════════════════════════════════════
   /account/ — Personal account & progress dashboard
   ════════════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Space Grotesk', system-ui, sans-serif; }
body { min-height: 100vh; }

.acc-main {
  max-width: 980px;
  margin: 24px auto 80px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.acc-page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 8px 0 4px;
  letter-spacing: -.01em;
}
.acc-page-sub { color: var(--dim); font-size: .92rem; margin: 0 0 8px; }

/* ── Section card ──────────────────────────────────────── */
.acc-section {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: var(--r, 14px);
  padding: 22px 22px;
}
.acc-section h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 16px;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.acc-section h2 .acc-h-ico { font-size: 1.1rem; }
.acc-section h2 .acc-h-sub {
  font-weight: 500;
  font-size: .78rem;
  color: var(--dim);
  margin-left: auto;
}

/* ════════════════════════════════════════════════════════
   Hero KPI strip (Visual A)
   ════════════════════════════════════════════════════════ */
.acc-hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.acc-kpi {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.acc-kpi .acc-kpi-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--text);
}
.acc-kpi .acc-kpi-num .acc-kpi-freeze {
  font-size: .62em;
  margin-left: 3px;
  vertical-align: middle;
}
.acc-kpi .acc-kpi-num .acc-kpi-freeze[hidden] { display: none; }
.acc-kpi .acc-kpi-lbl {
  font-size: .76rem;
  color: var(--dim);
  margin-top: 4px;
  font-weight: 500;
}
.acc-kpi .acc-kpi-sub {
  font-size: .7rem;
  color: var(--teal,#20B9B9);
  margin-top: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.acc-kpi .acc-kpi-ico {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 1.1rem;
  opacity: .6;
}
.acc-kpi.acc-kpi-streak  .acc-kpi-num { color: #E07856; }
.acc-kpi.acc-kpi-learned .acc-kpi-num { color: var(--accent, #7C5CBF); }
.acc-kpi.acc-kpi-mast    .acc-kpi-num { color: var(--teal, #20B9B9); }
.acc-kpi.acc-kpi-today   .acc-kpi-num { color: var(--yellow, #F5A623); }

@media (max-width: 600px) {
  .acc-hero { grid-template-columns: repeat(2, 1fr); }
  .acc-kpi { padding: 14px 12px; }
  .acc-kpi .acc-kpi-num { font-size: 1.45rem; }
}

/* ════════════════════════════════════════════════════════
   Heatmap (Visual B)
   ════════════════════════════════════════════════════════ */
.acc-heatmap-wrap {
  overflow-x: auto;
  padding: 4px 2px;
  display: flex;
  justify-content: center;
}
.acc-heatmap {
  display: block;
  flex-shrink: 0;
}
.acc-heatmap-empty {
  text-align: center;
  padding: 20px 12px;
  color: var(--dim);
  font-size: .9rem;
}
.acc-heatmap-empty a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.acc-heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 10px;
  font-size: .72rem;
  color: var(--dim);
}
.acc-heatmap-legend .acc-hm-sw {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

/* ════════════════════════════════════════════════════════
   Vocabulary Galaxy (Visual C — concentric topic sectors)
   ════════════════════════════════════════════════════════ */
.acc-galaxy-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 720px) {
  .acc-galaxy-grid { grid-template-columns: 1fr; gap: 18px; }
}

.acc-galaxy-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
}
.acc-galaxy-wrap {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
}
.acc-galaxy-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}
.acc-galaxy-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}
.acc-galaxy-center .acc-g-total {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
}
.acc-galaxy-center .acc-g-tlbl {
  font-size: .68rem;
  color: var(--dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Segment hover/click effect */
.acc-galaxy-seg {
  transition: opacity .15s, filter .15s;
  cursor: pointer;
}
/* Entry animation — opacity-only fade-in (avoid SVG transform-origin pitfalls).
   The animation-delay is set inline per-sector by account.js to stagger
   clockwise from 12 o'clock. animation-fill-mode: backwards keeps sectors
   invisible during their delay. */
@keyframes accGalaxyIn {
  from { opacity: 0; }
  to   { opacity: var(--ring-opacity, 1); }
}
.acc-galaxy-seg {
  animation: accGalaxyIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}
/* Center number entry (uses transform on HTML element — safe) */
@keyframes accGalaxyCenterIn {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}
.acc-galaxy-center {
  animation: accGalaxyCenterIn 0.5s 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}
@media (prefers-reduced-motion: reduce) {
  .acc-galaxy-seg,
  .acc-galaxy-center {
    animation: none !important;
  }
}
.acc-galaxy-wrap.has-hover .acc-galaxy-seg:not(.acc-hl) {
  opacity: .25;
}
.acc-galaxy-seg.acc-hl {
  filter: brightness(1.15) drop-shadow(0 0 6px currentColor);
}

/* Side panel */
.acc-galaxy-panel {
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 16px;
  font-size: .88rem;
  min-height: 220px;
}
.acc-galaxy-panel h3 {
  margin: 0 0 4px;
  font-size: .92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.acc-galaxy-panel h3 .acc-g-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.acc-galaxy-panel .acc-g-sub {
  font-size: .76rem;
  color: var(--dim);
  margin: 0 0 12px;
}
.acc-galaxy-panel .acc-g-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 10px 0;
  font-size: .8rem;
}
.acc-galaxy-panel .acc-g-stat-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  color: var(--text);
  font-size: .98rem;
  margin-right: 4px;
}
.acc-galaxy-panel .acc-g-stat-lbl {
  color: var(--dim);
  font-size: .72rem;
}
.acc-galaxy-panel .acc-g-insight {
  margin-top: 12px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(124,92,191,.1), rgba(32,185,185,.08));
  border: 1px solid rgba(124,92,191,.25);
  border-radius: 8px;
  font-size: .82rem;
  line-height: 1.4;
  color: var(--text);
}
.acc-galaxy-panel .acc-g-insight::before {
  content: '💡 ';
}
.acc-galaxy-panel .acc-g-samples {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.acc-galaxy-panel .acc-g-sample {
  font-size: .76rem;
  padding: 2px 8px;
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.acc-galaxy-panel .acc-g-hint {
  margin-top: 10px;
  font-size: .72rem;
  color: var(--dim);
  font-style: italic;
}

/* Explanation accordion */
.acc-galaxy-help {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.acc-galaxy-help summary {
  cursor: pointer;
  font-size: .82rem;
  color: var(--dim);
  font-weight: 500;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.acc-galaxy-help summary::-webkit-details-marker { display: none; }
.acc-galaxy-help summary::before {
  content: '▸';
  transition: transform .15s;
  display: inline-block;
}
.acc-galaxy-help[open] summary::before { transform: rotate(90deg); }
.acc-galaxy-help summary:hover { color: var(--text); }
.acc-galaxy-help-body {
  padding: 10px 0 0 16px;
  font-size: .85rem;
  line-height: 1.55;
  color: var(--text2, var(--dim));
}
.acc-galaxy-help-body p { margin: 0 0 8px; }
.acc-galaxy-help-body ul { margin: 0 0 8px; padding-left: 18px; }
.acc-galaxy-help-body li { margin-bottom: 4px; }
.acc-help-ring {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 4px;
  background: #7C5CBF;
}
.acc-help-ring.acc-ring-core { background: #7C5CBF; opacity: 1; }
.acc-help-ring.acc-ring-mid  { background: #7C5CBF; opacity: .6; }
.acc-help-ring.acc-ring-out  {
  background: transparent;
  border: 2px solid #7C5CBF;
  opacity: .5;
}

/* ════════════════════════════════════════════════════════
   CEFR ladder (Visual D)
   ════════════════════════════════════════════════════════ */
.acc-cefr-list { display: flex; flex-direction: column; gap: 10px; }
.acc-cefr-row {
  display: grid;
  grid-template-columns: 56px 1fr 130px;
  gap: 12px;
  align-items: center;
}
.acc-cefr-label {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: -.01em;
  padding: 6px 10px;
  border-radius: 8px;
  text-align: center;
  white-space: nowrap;
}
.acc-cefr-label.lvl-a1 { background: rgba(34,197,94,.18);  color: #22c55e; }
.acc-cefr-label.lvl-a2 { background: rgba(34,197,94,.14);  color: #16a34a; }
.acc-cefr-label.lvl-b1 { background: rgba(245,166,35,.18); color: #F5A623; }
.acc-cefr-label.lvl-b2 { background: rgba(232,114,42,.18); color: #E8722A; }
.acc-cefr-label.lvl-c1 { background: rgba(232,93,93,.18);  color: #E85D5D; }
.acc-cefr-label.lvl-c2 { background: rgba(184,56,56,.18);  color: #B83838; }
.acc-cefr-label.lvl-x  { background: var(--surf2);          color: var(--dim); font-weight: 600; }

.acc-cefr-bar {
  height: 18px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  display: flex;
  position: relative;
}
.acc-cefr-bar-empty {
  color: var(--dim);
  font-size: .72rem;
  align-self: center;
  padding-left: 10px;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
}
.acc-cefr-seg {
  height: 100%;
  transition: width .4s ease;
  cursor: default;
}
.acc-cefr-seg.mastered { background: #20B9B9; }
.acc-cefr-seg.learning { background: #7C5CBF; opacity: .85; }
.acc-cefr-seg.new      { background: #3a4870; }
.acc-cefr-stats {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .8rem;
  color: var(--dim);
  text-align: right;
  white-space: nowrap;
}
.acc-cefr-stats b { color: var(--text); }
.acc-cefr-legend {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 12px;
  font-size: .76rem;
  color: var(--dim);
}
.acc-cefr-legend .sw {
  width: 10px; height: 10px; border-radius: 3px; display: inline-block;
  vertical-align: middle; margin-right: 4px;
}
.acc-cefr-empty {
  text-align: center;
  padding: 20px 12px;
  color: var(--dim);
  font-size: .9rem;
}
@media (max-width: 600px) {
  .acc-cefr-row { grid-template-columns: 44px 1fr 90px; gap: 8px; }
  .acc-cefr-label { font-size: .85rem; padding: 5px 6px; }
  .acc-cefr-stats { font-size: .72rem; }
}

/* ════════════════════════════════════════════════════════
   Most-missed words (Visual I)
   ════════════════════════════════════════════════════════ */
.acc-missed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.acc-missed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .88rem;
}
.acc-missed-word {
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acc-missed-pos {
  color: var(--dim);
  font-size: .75rem;
  font-style: italic;
  margin-left: 6px;
}
.acc-missed-stats {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .78rem;
  color: var(--coral, #E07856);
  margin-right: 8px;
}
.acc-missed-cta {
  text-align: right;
  margin-top: 12px;
}

/* ════════════════════════════════════════════════════════
   Identity (Section 1)
   ════════════════════════════════════════════════════════ */
.acc-identity-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.acc-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.acc-avatar.tier-free    { background: linear-gradient(135deg,#7880a0,#5a6080); }
.acc-avatar.tier-pro     { background: linear-gradient(135deg,#F5A623,#E08C0F); color: #412402; }
.acc-avatar.tier-teacher { background: linear-gradient(135deg,#20B9B9,#0D7D6A); }
.acc-avatar.tier-admin   { background: linear-gradient(135deg,#E85D5D,#B83838); }

.acc-id-info { flex: 1; min-width: 0; }
.acc-id-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.acc-id-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  padding: 2px 6px;
  margin: 0 -6px;
  border-radius: 6px;
  cursor: text;
  border: 1px dashed transparent;
  min-width: 60px;
}
.acc-id-name:hover { border-color: var(--border2); background: var(--surf2); }
.acc-id-name:focus { outline: none; border-color: var(--accent); background: var(--surf2); }
.acc-id-name-save {
  font-size: .72rem;
  color: var(--teal);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  font-family: inherit;
  font-weight: 600;
  display: none;
}
.acc-id-name-save.visible { display: inline-block; }

.acc-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
}
.acc-role-badge.tier-free    { background: rgba(120,128,160,.18); color: #c5c9d8; }
.acc-role-badge.tier-pro     { background: rgba(245,166,35,.18);  color: #F5A623; }
.acc-role-badge.tier-teacher { background: rgba(32,185,185,.18);  color: #20B9B9; }
.acc-role-badge.tier-admin   { background: rgba(232,93,93,.18);   color: #E85D5D; }

.acc-id-email {
  color: var(--dim);
  font-size: .9rem;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.acc-id-email > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
  flex: 1 1 auto;
}
.acc-id-email .acc-link-mini {
  color: var(--accent);
  font-size: .78rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
}
.acc-id-email .acc-link-mini:hover { text-decoration: underline; }

.acc-id-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: .85rem;
}
.acc-id-meta div { color: var(--dim); }
.acc-id-meta b { color: var(--text); font-weight: 600; font-family: 'JetBrains Mono', ui-monospace, monospace; }

.acc-id-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ════════════════════════════════════════════════════════
   Buttons
   ════════════════════════════════════════════════════════ */
.acc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surf2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, transform .1s, background .15s;
}
.acc-btn:hover { border-color: var(--accent); }
.acc-btn-primary {
  background: var(--grad, linear-gradient(135deg,#7C5CBF,#5B3FA0));
  color: #fff;
  border-color: transparent;
}
.acc-btn-primary:hover { transform: translateY(-1px); border-color: transparent; }
.acc-btn-danger {
  color: var(--coral, #E07856);
  border-color: rgba(224,120,86,.4);
}
.acc-btn-danger:hover { background: rgba(224,120,86,.12); border-color: var(--coral, #E07856); }

/* ════════════════════════════════════════════════════════
   Toast
   ════════════════════════════════════════════════════════ */
#accToast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: var(--surf);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  font-size: .88rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 99998;
  max-width: 90vw;
}
#accToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#accToast.err { border-color: var(--red, #ef4444); color: var(--red, #ef4444); }
#accToast.ok  { border-color: var(--teal, #20B9B9); color: var(--teal, #20B9B9); }

/* ════════════════════════════════════════════════════════
   Modal
   ════════════════════════════════════════════════════════ */
.acc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}
.acc-modal-backdrop.open { display: flex; }
.acc-modal {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}
.acc-modal h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 6px;
}
.acc-modal p.acc-modal-sub { color: var(--dim); font-size: .85rem; margin: 0 0 16px; }
.acc-modal label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--dim);
  margin: 12px 0 6px;
}
.acc-modal input {
  width: 100%;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px; /* iOS zoom suppression */
}
.acc-modal input:focus { outline: none; border-color: var(--accent); }
.acc-modal-err { color: var(--red,#ef4444); font-size: .8rem; margin-top: 8px; min-height: 1em; }
.acc-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ════════════════════════════════════════════════════════
   Loading skeleton
   ════════════════════════════════════════════════════════ */
.acc-skel {
  background: linear-gradient(90deg, var(--surf2) 0%, var(--surf3) 50%, var(--surf2) 100%);
  background-size: 200% 100%;
  animation: accSkel 1.4s ease-in-out infinite;
  border-radius: 6px;
  color: transparent;
}
@keyframes accSkel {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ════════════════════════════════════════════════════════
   Subscription card (Section 2)
   ════════════════════════════════════════════════════════ */
.acc-sub-card {
  position: relative;
  padding: 22px;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}
/* Free card uses a subtle purple gradient — hints at "upgrade lives one
   click away" without screaming. Pro / Teacher / Admin keep their tier-
   colored gradients. */
.acc-sub-card.tier-free    { background: linear-gradient(135deg, rgba(124,92,191,.18), rgba(32,185,185,.10)); border: 1px solid rgba(124,92,191,.45); }
.acc-sub-card.tier-pro     { background: linear-gradient(135deg, rgba(245,166,35,.18), rgba(124,92,191,.12)); border: 1px solid #F5A623; }
.acc-sub-card.tier-teacher { background: linear-gradient(135deg, rgba(32,185,185,.18), rgba(13,125,106,.12)); border: 1px solid #20B9B9; }
.acc-sub-card.tier-admin   { background: linear-gradient(135deg, rgba(232,93,93,.18), rgba(184,56,56,.12)); border: 1px solid #E85D5D; }

.acc-sub-tier-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.acc-sub-tier-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
}
.acc-sub-tier-name.tier-pro     { color: #F5A623; }
.acc-sub-tier-name.tier-teacher { color: #20B9B9; }
.acc-sub-tier-name.tier-admin   { color: #E85D5D; }
/* Free tier name uses brand accent — readable on the purple-tinted bg AND
   visually invites the "upgrade" path without hiding the current state. */
.acc-sub-tier-name.tier-free    { color: var(--accent, #9470D4); }

.acc-sub-expiry {
  font-size: .88rem;
  color: var(--dim);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.acc-sub-expiry b {
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
}
.acc-sub-expiry .acc-days-left {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  background: var(--surf2);
  color: var(--text);
}
.acc-sub-expiry .acc-days-left.urgent { background: rgba(245,166,35,.2); color: #F5A623; }
.acc-sub-expiry .acc-days-left.danger { background: rgba(232,93,93,.2);  color: #E85D5D; }

.acc-sub-note {
  margin-top: 10px;
  font-size: .82rem;
  color: var(--dim);
  font-style: italic;
}

.acc-sub-actions { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 600px) {
  .acc-sub-card { grid-template-columns: 1fr; }
  .acc-sub-actions { flex-direction: row; flex-wrap: wrap; }
}

/* ════════════════════════════════════════════════════════
   AI quota chart (Section 3)
   ════════════════════════════════════════════════════════ */
.acc-quota-summary {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.acc-quota-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}
.acc-quota-of { color: var(--dim); font-size: .92rem; }
.acc-quota-progress {
  flex: 1;
  min-width: 140px;
  height: 10px;
  background: var(--surf2);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.acc-quota-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal,#20B9B9), var(--accent,#7C5CBF));
  border-radius: 5px;
  transition: width .4s ease;
}
.acc-quota-progress-fill.urgent { background: linear-gradient(90deg, #F5A623, #E07856); }
.acc-quota-progress-fill.danger { background: linear-gradient(90deg, #E85D5D, #B83838); }

.acc-quota-chart-wrap {
  position: relative;
  margin-top: 10px;
}
.acc-quota-chart {
  width: 100%;
  height: 140px;
  display: block;
}
.acc-quota-empty {
  text-align: center;
  padding: 20px 12px;
  color: var(--dim);
  font-size: .9rem;
}

/* ════════════════════════════════════════════════════════
   Billing table (Section 4)
   ════════════════════════════════════════════════════════ */
.acc-billing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.acc-billing-table th, .acc-billing-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.acc-billing-table th {
  color: var(--dim);
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.acc-billing-table td.acc-bt-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .82rem;
}
.acc-billing-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}
.acc-billing-status.pending   { background: rgba(245,158,11,.18); color: var(--yellow,#F5A623); }
.acc-billing-status.approved  { background: rgba(34,197,94,.18);  color: var(--green,#22c55e); }
.acc-billing-status.rejected  { background: rgba(239,68,68,.18);  color: var(--red,#ef4444); }
.acc-billing-status.cancelled { background: rgba(120,128,160,.18); color: var(--dim); }
.acc-billing-status.refunded  { background: rgba(59,130,246,.18); color: #3b82f6; }
.acc-billing-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--dim);
  font-size: .9rem;
}
.acc-billing-empty a { color: var(--accent); text-decoration: none; font-weight: 600; }

@media (max-width: 600px) {
  .acc-billing-table { font-size: .8rem; }
  .acc-billing-table th, .acc-billing-table td { padding: 8px 4px; }
  .acc-billing-table .acc-bt-hide-mobile { display: none; }
}

/* ════════════════════════════════════════════════════════
   Preferences (Section 5)
   ════════════════════════════════════════════════════════ */
.acc-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.acc-pref-row:last-child { border-bottom: none; }
.acc-pref-label {
  font-weight: 600;
  font-size: .9rem;
}
.acc-pref-desc {
  font-size: .76rem;
  color: var(--dim);
  margin-top: 2px;
}
.acc-pref-control {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.acc-pref-control input[type="number"] {
  width: 80px;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 16px;
  text-align: center;
}
.acc-theme-segment {
  display: inline-flex;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.acc-theme-segment button {
  background: transparent;
  border: none;
  padding: 6px 12px;
  font-family: inherit;
  font-size: .82rem;
  color: var(--dim);
  cursor: pointer;
  border-radius: 6px;
  font-weight: 500;
}
.acc-theme-segment button.active {
  background: var(--surf);
  color: var(--text);
  font-weight: 600;
}
/* Light mode: white-on-lavender active state was too faint — lift it with an
   accent ring + shadow so the selected option reads clearly. (Dark mode is fine.) */
[data-theme="light"] .acc-theme-segment button.active {
  background: #FFFFFF;
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(91,63,160,.22), inset 0 0 0 1.5px var(--accent);
}
.acc-pref-coming {
  display: inline-block;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: .7rem;
  color: var(--dim);
  font-weight: 500;
}
/* iOS-style toggle switch (email opt-in/out). Track + thumb slide on :checked. */
.acc-switch { position: relative; display: inline-flex; cursor: pointer; }
.acc-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.acc-switch-track {
  width: 44px; height: 26px; border-radius: 999px;
  background: var(--surf2); border: 1px solid var(--border);
  display: inline-flex; align-items: center; padding: 2px;
  transition: background .18s ease, border-color .18s ease;
}
.acc-switch-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--dim);
  transition: transform .18s ease, background .18s ease;
}
.acc-switch input:checked + .acc-switch-track {
  background: var(--teal, #20B9B9); border-color: var(--teal, #20B9B9);
}
.acc-switch input:checked + .acc-switch-track .acc-switch-thumb {
  transform: translateX(18px); background: #fff;
}
.acc-switch input:disabled + .acc-switch-track { opacity: .5; cursor: not-allowed; }
.acc-switch input:focus-visible + .acc-switch-track {
  outline: 2px solid var(--teal, #20B9B9); outline-offset: 2px;
}
.acc-pref-teacher-target {
  margin-top: 6px;
  font-size: .78rem;
  color: var(--teal, #20B9B9);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.acc-pref-teacher-target b {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
}
.acc-pref-goal-warn {
  margin-top: 4px;
  font-size: .76rem;
  color: #F5A623;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ════════════════════════════════════════════════════════
   Danger zone (Section 6)
   ════════════════════════════════════════════════════════ */
.acc-danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.acc-danger-row:last-child { border-bottom: none; }
.acc-danger-info { flex: 1; min-width: 0; }
.acc-danger-info b { display: block; font-size: .9rem; margin-bottom: 2px; }
.acc-danger-info span { font-size: .78rem; color: var(--dim); }

/* ════════════════════════════════════════════════════════
   Teacher placeholder (v2 stub)
   ════════════════════════════════════════════════════════ */
.acc-teacher-stub {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(32,185,185,.08), rgba(124,92,191,.08));
  border: 1px dashed var(--border2, #2A3E6A);
  border-radius: 12px;
}
.acc-teacher-stub .acc-ts-ico { font-size: 2rem; }
.acc-teacher-stub .acc-ts-text { flex: 1; }
.acc-teacher-stub h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 700; }
.acc-teacher-stub p { margin: 0; font-size: .85rem; color: var(--dim); }

/* ════════════════════════════════════════════════════════
   Mobile
   ════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .acc-main { padding: 0 14px; gap: 14px; margin-top: 16px; }
  .acc-section { padding: 18px 16px; }
  .acc-page-title { font-size: 1.35rem; }
  .acc-avatar { width: 56px; height: 56px; font-size: 1.6rem; }
  .acc-id-name { font-size: 1.1rem; }
  .acc-id-meta { gap: 10px 18px; }
  .acc-modal { padding: 20px; }
}

/* ── Pronunciation card (Phase 4A) ───────────────────────── */
.acc-pron-heatmap { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.acc-pron-empty { color: var(--dim); font-size: .88rem; padding: 8px 0; }
.acc-pron-row { display: grid; grid-template-columns: 48px 1fr 42px 64px auto; align-items: center; gap: 10px; }
.acc-pron-ph { font-family: 'JetBrains Mono', monospace; font-size: .92rem; font-weight: 600; color: var(--text); }
.acc-pron-bar { height: 9px; border-radius: 999px; background: var(--surf2); overflow: hidden; }
.acc-pron-fill { display: block; height: 100%; border-radius: 999px; }
.acc-pron-fill.ok { background: #22c55e; }
.acc-pron-fill.mid { background: #f59e0b; }
.acc-pron-fill.bad { background: #ef4444; }
.acc-pron-val { font-size: .82rem; font-weight: 700; color: var(--text); text-align: right; }
.acc-pron-cnt { font-size: .76rem; color: var(--dim); }
.acc-pron-tr { font-size: .76rem; font-weight: 600; white-space: nowrap; }
.acc-pron-tr.up { color: #22c55e; }
.acc-pron-tr.down { color: #ef4444; }
.acc-pron-tr.flat { color: var(--dim); }
.acc-select {
  background: var(--surf2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-family: inherit; font-size: .85rem; cursor: pointer; outline: none;
}
.acc-select:focus { border-color: var(--accent); }
@media (max-width: 560px) {
  .acc-pron-row { grid-template-columns: 40px 1fr 38px auto; }
  .acc-pron-cnt { display: none; }
}
