/* =============================================
   MyEnglish — Design System (from MyBudget)
   ============================================= */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
h1,h2,h3,h4,h5,h6,p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }

/* ---- Design Tokens ---- */
body {
  --brand-green: #22A64B;
  --brand-green-600: #1A8F3E;
  --brand-green-400: #4BC26E;
  --brand-green-200: #A8E6B6;
  --brand-violet: #6E4BE6;
  --brand-violet-600: #5A36D1;
  --brand-violet-400: #8F71EF;
  --brand-violet-200: #D4C7F7;
  --brand-magenta: #9C1F5F;
  --brand-magenta-600: #801550;
  --brand-magenta-400: #B84A85;
  --brand-magenta-200: #E4B7CF;
  --brand-teal: #0E7F5C;
  --brand-teal-600: #096348;
  --brand-teal-400: #34A381;
  --brand-teal-200: #AEDDCB;
  --color-warning: #E0A82E;
  --color-danger: #D94A4A;

  --gradient-hero: radial-gradient(120% 80% at 85% 30%, rgba(34,166,75,0.55) 0%, rgba(34,166,75,0) 55%), linear-gradient(135deg, #031A14 0%, #0B1F18 45%, #0E3322 100%);

  --font-display: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-mono-brand: 'IBM Plex Mono', ui-monospace, monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.5rem;

  --tracking-eyebrow: 0.12em;
  --tracking-wide: 0.04em;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-full: 999px;

  --shadow-sm: 0 1px 2px rgba(11,31,24,0.06);
  --shadow-md: 0 4px 16px rgba(11,31,24,0.08);
  --shadow-lg: 0 12px 32px rgba(11,31,24,0.12);

  /* Light theme */
  --fg-1: #0B1F18;
  --fg-2: #3F4440;
  --fg-3: #636862;
  --fg-muted: #8B9086;
  --bg-1: #F5F6F3;
  --bg-2: #fff;
  --bg-3: #ECEEE8;
  --border-1: rgba(11,31,24,0.08);
  --border-2: rgba(11,31,24,0.16);
  --border-strong: rgba(11,31,24,0.28);
  --accent: #22A64B;
  --accent-600: #1A8F3E;
  --accent-400: #4BC26E;
}

body[data-theme="dark"] {
  --fg-1: #F5F6F3;
  --fg-2: rgba(245,246,243,0.76);
  --fg-3: rgba(245,246,243,0.56);
  --fg-muted: rgba(245,246,243,0.40);
  --bg-1: #0B1F18;
  --bg-2: #14171A;
  --bg-3: #1E2328;
  --border-1: rgba(255,255,255,0.09);
  --border-2: rgba(255,255,255,0.16);
  --border-strong: rgba(255,255,255,0.30);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.35);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.45);
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.55);
}

/* ---- Base ---- */
body {
  min-height: 100vh;
  background: var(--bg-1);
  color: var(--fg-1);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

input::placeholder { color: var(--fg-muted); }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; }

@keyframes finFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---- Navigation ---- */
.fin-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 64px;
  background: color-mix(in srgb, var(--bg-1) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
}

.fin-nav__logo {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.fin-nav__logo-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fin-nav__logo-icon svg { width: 17px; height: 17px; stroke: #fff; }

.fin-nav__logo-name {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--fg-1);
}

.fin-nav__logo-dim { color: var(--fg-muted); }

.fin-nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 18px;
}

.fin-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg-2);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.fin-nav__link:hover { color: var(--fg-1); background: var(--bg-3); }

.fin-nav__link svg { width: 17px; height: 17px; flex-shrink: 0; }

.fin-nav__link--active { font-weight: 700; color: var(--fg-1); }

.fin-nav__link--active::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.fin-nav__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Icon buttons ---- */
.fin-icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  color: var(--fg-2);
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.fin-icon-btn:hover { background: var(--bg-3); border-color: var(--border-2); }
.fin-icon-btn svg { width: 18px; height: 18px; }

/* Smaller icon btn */
.fin-icon-btn--sm {
  width: 34px;
  height: 34px;
}
.fin-icon-btn--sm svg { width: 15px; height: 15px; }

.fin-icon-btn--danger { color: var(--color-danger); }

/* ---- Main layout ---- */
.fin-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.fin-section { animation: finFade 320ms ease-out; }

/* ---- Page header (month nav + action) ---- */
.fin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.fin-month-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.fin-month-nav h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-2xl);
  min-width: 200px;
  text-align: center;
}

/* ---- Buttons ---- */
.fin-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: none;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.fin-btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.fin-btn--primary:hover { background: var(--accent-600); }

.fin-btn--primary svg { width: 16px; height: 16px; }

.fin-btn--ghost {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--fg-1);
}

.fin-btn--ghost:hover { background: var(--bg-3); }

.fin-btn--link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-600);
  font-weight: 700;
  font-size: var(--fs-sm);
}

.fin-btn--link:hover { color: var(--accent); }

/* ---- Cards grid ---- */
.fin-cards-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.fin-cards-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

@media (max-width: 1024px) {
  .fin-cards-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .fin-cards-4, .fin-cards-2 { grid-template-columns: 1fr; }
  .fin-nav__links { display: none; }
  .fin-main { padding: 20px 16px 60px; }
}

/* ---- Card ---- */
.fin-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.fin-card--hero {
  background: var(--gradient-hero);
  border: none;
  color: #F5F6F3;
  box-shadow: var(--shadow-md);
}

.fin-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-lg);
  margin-bottom: 20px;
}

/* ---- Summary card internals ---- */
.fin-card-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--fg-3);
}

.fin-card--hero .fin-card-label { color: var(--brand-green-200); }

.fin-card-amount {
  font-family: var(--font-mono-brand);
  font-size: var(--fs-2xl);
  margin-top: 10px;
  letter-spacing: -0.01em;
}

.fin-card--hero .fin-card-amount { color: #F5F6F3; }

.fin-card-sub {
  font-size: var(--fs-sm);
  color: var(--fg-3);
  margin-top: 6px;
}

.fin-card--hero .fin-card-sub { color: rgba(245,246,243,0.66); }

/* ---- Progress bar ---- */
.fin-progress {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--bg-3);
  overflow: hidden;
  margin-top: 14px;
}

.fin-progress__bar {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 400ms ease;
}

.fin-progress__bar--green { background: var(--brand-green); }
.fin-progress__bar--orange { background: var(--color-warning); }
.fin-progress__bar--red { background: var(--color-danger); }

.fin-progress-sub {
  font-size: var(--fs-xs);
  color: var(--fg-3);
  margin-top: 8px;
}

/* ---- Grid layouts ---- */
.fin-grid-donut {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 18px;
  margin-bottom: 18px;
}

.fin-grid-insights {
  display: grid;
  grid-template-columns: 0.9fr 1.4fr;
  gap: 18px;
}

@media (max-width: 900px) {
  .fin-grid-donut, .fin-grid-insights { grid-template-columns: 1fr; }
}

/* ---- Section header ---- */
.fin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.fin-section-header h3 { margin-bottom: 0; }

/* ---- Article/card wrapper ---- */
.fin-article {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 8px 24px;
  box-shadow: var(--shadow-sm);
}

/* ---- Input / form styles ---- */
.fin-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  color: var(--fg-1);
  font-size: var(--fs-base);
  outline: none;
  transition: border-color 0.15s;
}

.fin-input:focus { border-color: var(--border-strong); }

.fin-input--mono { font-family: var(--font-mono-brand); }

.fin-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  color: var(--fg-1);
  font-size: var(--fs-base);
  outline: none;
  appearance: auto;
}

.fin-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 700;
  margin-bottom: 7px;
  color: var(--fg-1);
}

/* ---- Empty state ---- */
.fin-empty {
  text-align: center;
  color: var(--fg-muted);
  padding: 40px 0;
  font-size: var(--fs-sm);
}

/* ---- Alerts ---- */
.fin-alert {
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  margin-bottom: 16px;
}

.fin-alert--error { background: rgba(217,74,74,0.12); color: var(--color-danger); }
.fin-alert--success { background: rgba(34,166,75,0.12); color: var(--brand-green-600); }

/* ---- Login ---- */
.fin-login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

@media (max-width: 768px) {
  .fin-login { grid-template-columns: 1fr; }
  .fin-login__hero { display: none; }
}

.fin-login__hero {
  background: var(--gradient-hero);
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #F5F6F3;
  position: relative;
  overflow: hidden;
}

.fin-login__hero-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fin-login__hero-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--brand-green);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fin-login__hero-logo-icon svg { width: 19px; height: 19px; stroke: #0B1F18; }

.fin-login__hero-name { font-size: 1.15rem; letter-spacing: -0.01em; }
.fin-login__hero-dim { color: rgba(245,246,243,0.5); }

.fin-login__hero-body { max-width: 420px; }

.fin-login__hero-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--brand-green-200);
  margin-bottom: 18px;
}

.fin-login__hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 3rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: 18px;
}

.fin-login__hero-tagline {
  font-size: var(--fs-md);
  line-height: 1.55;
  color: rgba(245,246,243,0.78);
}

.fin-login__hero-footer {
  font-size: var(--fs-sm);
  color: rgba(245,246,243,0.5);
}

.fin-login__form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.fin-login__form-inner { width: 100%; max-width: 360px; }

.fin-login__form h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-2xl);
  margin-bottom: 6px;
}

.fin-login__form p {
  color: var(--fg-3);
  margin-bottom: 32px;
}

.fin-login__submit {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: var(--fs-base);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s;
}

.fin-login__submit:hover { background: var(--accent-600); }

/* ---- Misc ---- */
.fin-card-article {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.fin-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--fg-3);
}

.fin-cat-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.fin-cat-table th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-3); padding: 0 0 8px; border-bottom: 1px solid var(--border-1); }
.fin-cat-table td { padding: 10px 0; border-bottom: 1px solid var(--border-1); }
.fin-cat-table tr:last-child td { border-bottom: none; }

/* =============================================
   MyEnglish — app components
   ============================================= */

.me-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-2xl);
  margin-top: 4px;
}

.me-muted { color: var(--fg-3); font-size: var(--fs-sm); }

[hidden] { display: none !important; }

/* Mobile: keep nav links visible as compact icons (MyBudget hides them) */
@media (max-width: 640px) {
  .fin-nav { padding: 0 16px; gap: 12px; }
  .fin-nav__links { display: flex; gap: 4px; }
  .fin-nav__link { font-size: 0; padding: 8px; }
  .fin-nav__link svg { margin: 0; }
  .me-title { font-size: var(--fs-xl); }
}

/* ---- Home ---- */
.me-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .me-home { grid-template-columns: 1fr; } }

.me-side { display: grid; gap: 18px; }
.me-side .fin-card h3 { margin-bottom: 12px; }

.me-surprise {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border: none;
  border-radius: var(--r-md);
  background: var(--gradient-hero);
  color: #F5F6F3;
  text-align: left;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s;
}
.me-surprise:hover { transform: translateY(-1px); }
.me-surprise svg { width: 28px; height: 28px; flex-shrink: 0; color: var(--brand-green-400); }
.me-surprise strong { display: block; font-size: var(--fs-md); }
.me-surprise span span { font-size: var(--fs-sm); opacity: 0.75; }

.me-group-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--fg-3);
  margin: 28px 0 12px;
}

.me-scenarios {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.me-scenario {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  color: var(--fg-1);
  text-align: left;
  transition: border-color 0.15s, transform 0.15s;
}
.me-scenario:hover { border-color: var(--accent); transform: translateY(-1px); }
.me-scenario strong { font-size: var(--fs-base); }
.me-scenario span { font-size: var(--fs-sm); color: var(--fg-3); }

.me-list { display: grid; gap: 10px; font-size: var(--fs-sm); }
.me-list li { display: flex; justify-content: space-between; gap: 12px; }
.me-list--stacked li { flex-direction: column; gap: 2px; }
.me-side .fin-progress { margin-top: 14px; }

.me-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--r-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-3);
  color: var(--fg-2);
}
.me-tag--pattern { background: color-mix(in srgb, var(--brand-magenta) 14%, transparent); color: var(--brand-magenta-400); }
.me-tag--phrase { background: color-mix(in srgb, var(--brand-violet) 14%, transparent); color: var(--brand-violet-400); }

/* ---- Session ---- */
.me-session { max-width: 760px; margin: 0 auto; padding-bottom: 140px; }

.me-turns { display: flex; flex-direction: column; gap: 12px; }

.me-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  line-height: 1.55;
  animation: finFade 240ms ease-out;
}
.me-bubble--tutor {
  align-self: flex-start;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}
.me-bubble--user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-2));
  border-bottom-right-radius: 4px;
}

.me-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.me-chip {
  font-size: var(--fs-xs);
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--bg-3);
  color: var(--fg-2);
}
.me-chip--fix { background: color-mix(in srgb, var(--color-warning) 22%, transparent); color: var(--fg-1); font-weight: 500; }

.me-notes { margin-top: 8px; font-size: var(--fs-sm); }
.me-notes summary { cursor: pointer; color: var(--fg-2); }
.me-notes ul { display: grid; gap: 6px; margin-top: 8px; }
.me-notes li span { display: block; }
.me-uncertain { opacity: 0.6; }
.me-better { margin-top: 8px; color: var(--accent-600); }

.me-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg-1) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-1);
}
.me-dock #replay-btn { position: absolute; right: 24px; bottom: calc(34px + env(safe-area-inset-bottom)); }

.me-status { font-size: var(--fs-sm); color: var(--fg-3); text-align: center; min-height: 1.5em; }
.me-status[data-state="recording"] { color: var(--color-danger); font-weight: 500; }
.me-status[data-state="busy"] { color: var(--accent-600); }
.me-status[data-state="error"] { color: var(--color-danger); }

.me-mic {
  width: 76px;
  height: 76px;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-md);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s, background 0.15s;
}
.me-mic svg { width: 32px; height: 32px; pointer-events: none; }
.me-mic:active { transform: scale(0.96); }
.me-mic.is-recording { background: var(--color-danger); animation: mePulse 1.2s ease-in-out infinite; }
.me-mic.is-busy { background: var(--fg-muted); pointer-events: none; }
.me-mic--small { width: 44px; height: 44px; box-shadow: var(--shadow-sm); }
.me-mic--small svg { width: 20px; height: 20px; }

@keyframes mePulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-danger) 45%, transparent); }
  50% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--color-danger) 0%, transparent); }
}

.me-error { margin: 4px 0; }

.me-loading { display: none; text-align: center; color: var(--fg-3); padding: 24px; }
.me-loading.htmx-request { display: block; }

/* ---- Recap ---- */
.me-recap { margin-top: 28px; }
.me-recap__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.me-recap h2 { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-xl); }

.me-redo { margin: 16px 0 24px; padding: 18px; border-radius: var(--r-md); background: var(--bg-3); }
.me-redo h3 { font-size: var(--fs-md); margin-bottom: 2px; }
.me-redo__item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-1);
}
.me-redo__item:last-child { border-bottom: none; }
.me-redo__text { display: grid; gap: 2px; }
.me-redo__text s { color: var(--fg-3); font-size: var(--fs-sm); }
.me-redo__result { grid-column: 1 / -1; font-size: var(--fs-sm); }
.me-redo__result:empty { display: none; }
.me-ok { color: var(--accent-600); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.me-retry { font-weight: 500; }

.me-markdown { line-height: 1.6; }
.me-markdown h2 { font-size: var(--fs-md); font-weight: 700; margin: 22px 0 8px; }
.me-markdown p, .me-markdown ul, .me-markdown ol, .me-markdown table { margin: 0 0 12px; }
.me-markdown ul { list-style: disc; padding-left: 20px; }
.me-markdown ol { list-style: decimal; padding-left: 20px; }
.me-markdown li { margin-bottom: 4px; }
.me-markdown table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); display: block; overflow-x: auto; }
.me-markdown th { text-align: left; color: var(--fg-3); font-weight: 700; border-bottom: 1px solid var(--border-2); padding: 6px 10px 6px 0; }
.me-markdown td { border-bottom: 1px solid var(--border-1); padding: 8px 10px 8px 0; vertical-align: top; }

/* ---- History ---- */
.me-history li a {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border-1);
}
.me-history li:last-child a { border-bottom: none; }
.me-history li a:hover { background: var(--bg-3); }
.me-history strong { display: block; }
@media (max-width: 640px) {
  .me-history li a { grid-template-columns: 1fr auto; }
  .me-history li a > .me-muted { display: none; }
}

/* ---- Focus ---- */
.me-tag--natural { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-600); }
.me-tag--repeat, .me-tag--fix, .me-tag--cued, .me-tag--free { background: var(--bg-3); color: var(--fg-2); }

.me-focus-start { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

.me-focus-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border-radius: var(--r-md);
  background: var(--gradient-hero);
  color: #F5F6F3;
  box-shadow: var(--shadow-md);
}
.me-focus-cta > svg { width: 28px; height: 28px; flex-shrink: 0; color: var(--brand-green-400); }
.me-focus-cta__text { flex: 1; display: grid; gap: 2px; }
.me-focus-cta__text strong { font-size: var(--fs-md); }
.me-focus-cta__text span { font-size: var(--fs-sm); opacity: 0.75; }
@media (max-width: 640px) {
  .me-focus-cta { flex-wrap: wrap; }
  .me-focus-cta .fin-btn { width: 100%; justify-content: center; }
}

.me-focus-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
@media (max-width: 640px) { .me-focus-list { grid-template-columns: 1fr; } }

.me-focus-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  font-size: var(--fs-sm);
  min-width: 0;
}
.me-focus-item.is-due { border-color: color-mix(in srgb, var(--accent) 50%, var(--border-1)); }
.me-focus-item__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.me-focus-item__head .me-muted { margin-left: auto; }
.me-focus-item__title { font-size: var(--fs-base); }
.me-focus-item__swap { font-size: var(--fs-base); overflow-wrap: anywhere; }
.me-focus-item__swap s { color: var(--fg-3); }
.me-focus-item__swap strong { color: var(--accent-600); font-weight: 500; }
.me-focus-item__rule { color: var(--fg-2); }
.me-focus-item .me-notes li a { margin-left: 6px; }
.me-focus-item__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 6px; }
.me-focus-item__actions { display: flex; align-items: center; gap: 6px; }
.me-focus-item__actions form { margin: 0; }

.me-ladder { display: flex; gap: 4px; }
.me-ladder span { width: 16px; height: 6px; border-radius: var(--r-full); background: var(--bg-3); }
.me-ladder span.is-on { background: var(--accent); }

.me-focus-natural summary { cursor: pointer; }
.me-focus-natural .me-focus-item { opacity: 0.8; }

.me-method { margin-top: 32px; font-size: var(--fs-sm); line-height: 1.6; }
.me-method summary { cursor: pointer; }
.me-method ul { display: grid; gap: 8px; margin-top: 12px; list-style: disc; padding-left: 20px; color: var(--fg-2); }

/* ---- Drill ---- */
.me-drill {
  display: grid;
  gap: 14px;
  padding: 22px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  animation: finFade 240ms ease-out;
}
.me-drill__meta { display: flex; justify-content: space-between; align-items: center; }
.me-drill__prompt { font-size: var(--fs-lg); line-height: 1.45; }
.me-drill__model { font-size: var(--fs-lg); line-height: 1.45; font-weight: 500; color: var(--accent-600); }
.me-drill__hint {
  justify-self: start;
  font-size: var(--fs-sm);
  color: var(--fg-2);
  background: var(--bg-3);
  padding: 6px 12px;
  border-radius: var(--r-md);
}
.me-drill__feedback { padding-top: 14px; border-top: 1px solid var(--border-1); }
.me-drill__feedback:empty { display: none; }
.me-drill-result { display: grid; gap: 8px; justify-items: start; }
.me-drill__skip { display: flex; justify-content: flex-end; }

.me-rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.me-rate button {
  display: grid;
  gap: 2px;
  padding: 10px 8px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  background: var(--bg-3);
  color: var(--fg-1);
  text-align: center;
  transition: border-color 0.15s;
}
.me-rate button:hover { border-color: var(--accent); }
.me-rate button span { font-size: var(--fs-xs); color: var(--fg-3); }
.me-rate button:disabled { opacity: 0.5; }

.me-drill-summary h2 { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-xl); margin-bottom: 14px; }
.me-drill-summary .me-list { margin-bottom: 20px; }
