/* =========================================================
   ÁTOMOS — Design System v2
   Tema pastel claro por defecto + modo oscuro opcional
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,600;1,9..144,400&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── TEMA CLARO (defecto) ─────────────────────────────── */
:root {
  --bg:           #f5f2ff;
  --bg-2:         #ede8fb;
  --surface:      #ffffff;
  --surface-2:    #f0ecff;
  --surface-3:    #e4ddf9;
  --accent:       #7C3AED;
  --accent-2:     #6d28d9;
  --accent-light: #ede9fe;
  --accent-glow:  rgba(124,58,237,.18);
  --green:        #059669;
  --green-bg:     #d1fae5;
  --amber:        #d97706;
  --amber-bg:     #fef3c7;
  --rose:         #db2777;
  --rose-bg:      #fce7f3;
  --sky:          #0284c7;
  --text:         #1e1b4b;
  --text-2:       #4c4586;
  --text-muted:   #9490b8;
  --border:       rgba(124,58,237,.12);
  --border-solid: #ddd6fe;
  --shadow:       0 4px 24px rgba(124,58,237,.10);
  --shadow-sm:    0 2px 8px  rgba(124,58,237,.07);
  --radius:       16px;
  --radius-sm:    10px;
  --radius-xs:    6px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --bottom-nav-h: 72px;
  --header-h:     60px;
}

/* ── TEMA OSCURO ─────────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #0f0e17;
  --bg-2:         #16152a;
  --surface:      #1e1d35;
  --surface-2:    #2a2845;
  --surface-3:    #353360;
  --accent:       #7C3AED;
  --accent-2:     #9F67FA;
  --accent-light: rgba(124,58,237,.2);
  --accent-glow:  rgba(124,58,237,.35);
  --green:        #10B981;
  --green-bg:     rgba(16,185,129,.12);
  --amber:        #F59E0B;
  --amber-bg:     rgba(245,158,11,.12);
  --rose:         #EC4899;
  --rose-bg:      rgba(236,72,153,.12);
  --sky:          #0EA5E9;
  --text:         #f0eeff;
  --text-2:       #b8b0d8;
  --text-muted:   #6e6a8a;
  --border:       rgba(255,255,255,.08);
  --border-solid: rgba(255,255,255,.1);
  --shadow:       0 4px 24px rgba(0,0,0,.4);
  --shadow-sm:    0 2px 8px  rgba(0,0,0,.3);
}

/* ── RESET ────────────────────────────────────────────── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{font-size:16px;-webkit-text-size-adjust:100%}
body{
  font-family:var(--font-body);background:var(--bg);color:var(--text);
  min-height:100vh;line-height:1.6;-webkit-font-smoothing:antialiased;
  transition:background .3s,color .3s;
}
a{color:inherit;text-decoration:none}
button{cursor:pointer;font-family:inherit;border:none;background:none}
ul{list-style:none}
input,select,textarea{font-family:inherit;font-size:inherit;color:inherit}

/* ── APP SHELL ────────────────────────────────────────── */
.app-shell{display:flex;flex-direction:column;min-height:100vh;max-width:480px;margin:0 auto;position:relative}

/* Header */
.app-header{
  position:sticky;top:0;z-index:100;
  background:rgba(245,242,255,.92);
  border-bottom:1px solid var(--border-solid);
  height:var(--header-h);
  backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);
  transition:background .3s,border-color .3s;
}
[data-theme="dark"] .app-header{background:rgba(15,14,23,.92)}
.app-header__inner{display:flex;align-items:center;justify-content:space-between;height:100%;padding:0 1.25rem}
.app-logo{display:flex;align-items:center;gap:.6rem}
.app-logo__dot{
  width:10px;height:10px;background:var(--accent);border-radius:50%;
  box-shadow:0 0 10px var(--accent-glow);
  animation:pulse 2.5s ease-in-out infinite;
}
@keyframes pulse{0%,100%{box-shadow:0 0 8px var(--accent-glow)}50%{box-shadow:0 0 18px var(--accent-glow)}}
.app-logo__text{font-family:var(--font-display);font-size:1.25rem;font-weight:600;letter-spacing:-.02em;font-style:italic;color:var(--accent)}
.app-header__right{display:flex;align-items:center;gap:.6rem}

/* Theme toggle */
.theme-toggle{
  width:34px;height:34px;
  background:var(--surface-2);border:1px solid var(--border-solid);
  border-radius:var(--radius-xs);
  display:flex;align-items:center;justify-content:center;
  color:var(--text-muted);transition:all .2s;cursor:pointer;font-size:1rem;
}
.theme-toggle:hover{color:var(--accent);background:var(--accent-light);border-color:var(--accent)}
.theme-toggle .icon-sun{display:none}
.theme-toggle .icon-moon{display:block}
[data-theme="dark"] .theme-toggle .icon-sun{display:block}
[data-theme="dark"] .theme-toggle .icon-moon{display:none}

.avatar-btn{
  width:34px;height:34px;background:var(--accent);border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-size:.82rem;font-weight:700;color:#fff;
  box-shadow:0 0 0 3px var(--accent-glow);transition:transform .2s;
}
.avatar-btn:hover{transform:scale(1.08)}

/* Main */
.app-main{flex:1;overflow-y:auto;padding:1.25rem 1.25rem calc(var(--bottom-nav-h) + 1.5rem)}

/* Bottom Nav */
.bottom-nav{
  position:fixed;bottom:0;left:50%;transform:translateX(-50%);
  width:100%;max-width:480px;height:var(--bottom-nav-h);
  background:var(--surface);border-top:1px solid var(--border-solid);
  display:flex;align-items:center;justify-content:space-around;
  padding:0 .5rem env(safe-area-inset-bottom,0);z-index:200;
  backdrop-filter:blur(12px);transition:background .3s,border-color .3s;
}
.bottom-nav__item{
  display:flex;flex-direction:column;align-items:center;gap:.25rem;
  padding:.5rem .75rem;border-radius:var(--radius-sm);
  color:var(--text-muted);transition:color .2s;min-width:48px;position:relative;
}
.bottom-nav__item svg{width:22px;height:22px}
.bottom-nav__item span{font-size:.62rem;font-weight:500}
.bottom-nav__item.active{color:var(--accent)}
.bottom-nav__item.active::after{
  content:'';position:absolute;bottom:-1px;left:50%;transform:translateX(-50%);
  width:20px;height:2px;background:var(--accent);border-radius:1px;
}
.bottom-nav__item:hover{color:var(--accent)}
.bottom-nav__item--add{
  width:52px;height:52px;background:var(--accent);border-radius:50%;color:#fff;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 4px 16px var(--accent-glow);
  padding:0;min-width:unset;transition:transform .2s,box-shadow .2s;
}
.bottom-nav__item--add:hover{transform:scale(1.1) rotate(45deg);box-shadow:0 6px 24px var(--accent-glow)}
.bottom-nav__item--add svg{width:26px;height:26px}

/* ── FLASH ────────────────────────────────────────────── */
.flash{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.8rem 1.25rem;font-size:.875rem;font-weight:500}
.flash--success{background:var(--green-bg);color:var(--green);border-bottom:1px solid rgba(5,150,105,.2)}
.flash--error{background:var(--rose-bg);color:var(--rose);border-bottom:1px solid rgba(219,39,119,.2)}
.flash button{background:none;border:none;cursor:pointer;color:inherit;font-size:1rem;opacity:.6}
.flash button:hover{opacity:1}

/* ── AUTH ─────────────────────────────────────────────── */
.auth-page{background:var(--bg)}
.auth-wrapper{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:1.5rem;position:relative;overflow:hidden}
.auth-deco{position:absolute;inset:0;pointer-events:none}
.auth-deco__circle{position:absolute;border-radius:50%;filter:blur(70px)}
.auth-deco__circle--1{width:450px;height:450px;background:#c4b5fd;top:-160px;right:-120px;opacity:.45}
.auth-deco__circle--2{width:320px;height:320px;background:#bae6fd;bottom:-100px;left:-80px;opacity:.35}
.auth-deco__circle--3{width:220px;height:220px;background:#fde68a;top:55%;left:55%;opacity:.25}
[data-theme="dark"] .auth-deco__circle--1{opacity:.22}
[data-theme="dark"] .auth-deco__circle--2{opacity:.12}
[data-theme="dark"] .auth-deco__circle--3{opacity:.08}

.auth-card{
  position:relative;width:100%;max-width:420px;
  background:var(--surface);border:1px solid var(--border-solid);
  border-radius:24px;padding:2.5rem 2rem;
  box-shadow:var(--shadow),0 0 60px rgba(124,58,237,.08);
}
.auth-logo{text-align:center;margin-bottom:2rem}
.auth-logo__mark{
  width:60px;height:60px;background:var(--accent);border-radius:18px;
  display:flex;align-items:center;justify-content:center;
  margin:0 auto .875rem;box-shadow:0 8px 32px var(--accent-glow);
}
.auth-logo__dot{width:22px;height:22px;background:#fff;border-radius:50%}
.auth-logo__name{font-family:var(--font-display);font-size:2.2rem;font-weight:400;font-style:italic;color:var(--accent)}
.auth-logo__tagline{color:var(--text-muted);font-size:.875rem;margin-top:.3rem}
.auth-logo__tagline em{color:var(--text-2);font-style:italic;font-family:var(--font-display)}
.auth-error{
  display:flex;align-items:center;gap:.6rem;
  background:var(--rose-bg);border:1px solid rgba(219,39,119,.25);
  color:var(--rose);border-radius:var(--radius-sm);
  padding:.75rem 1rem;margin-bottom:1.25rem;font-size:.875rem;
}
.auth-error svg{width:18px;height:18px;flex-shrink:0}
.auth-form{display:flex;flex-direction:column;gap:1rem}
.remember-me{display:flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--text-2);cursor:pointer}
.auth-laws{display:flex;flex-wrap:wrap;gap:.4rem;justify-content:center;margin-top:1.75rem;padding-top:1.5rem;border-top:1px solid var(--border-solid)}
.auth-laws span{font-size:.68rem;color:var(--text-muted);background:var(--surface-2);padding:.25rem .65rem;border-radius:99px;border:1px solid var(--border-solid)}

/* ── FORM ELEMENTS ────────────────────────────────────── */
.field{display:flex;flex-direction:column;gap:.4rem}
.field label{font-size:.75rem;font-weight:600;color:var(--text-2);text-transform:uppercase;letter-spacing:.06em}
.field input,.field select,.field textarea{
  background:var(--surface-2);border:1.5px solid var(--border-solid);
  border-radius:var(--radius-sm);padding:.75rem 1rem;color:var(--text);
  transition:border-color .2s,box-shadow .2s;outline:none;width:100%;
}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-glow)}
.field input::placeholder,.field textarea::placeholder{color:var(--text-muted)}
.field__hint{font-size:.76rem;color:var(--text-muted)}
.required{color:var(--rose)}
.select-wrapper{position:relative}
.select-wrapper select{width:100%;appearance:none;padding-right:2.5rem;cursor:pointer}
.select-wrapper::after{content:'▾';position:absolute;right:1rem;top:50%;transform:translateY(-50%);color:var(--text-muted);pointer-events:none}

/* ── BUTTONS ──────────────────────────────────────────── */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;padding:.75rem 1.5rem;border-radius:var(--radius-sm);font-size:.9rem;font-weight:600;transition:all .2s;cursor:pointer;border:2px solid transparent;white-space:nowrap}
.btn svg{width:16px;height:16px}
.btn--primary{background:var(--accent);color:#fff;box-shadow:0 4px 14px var(--accent-glow)}
.btn--primary:hover{background:var(--accent-2);transform:translateY(-1px);box-shadow:0 6px 20px var(--accent-glow)}
.btn--primary:active{transform:translateY(0)}
.btn--outline{background:transparent;border-color:var(--border-solid);color:var(--text-2)}
.btn--outline:hover{border-color:var(--accent);color:var(--accent);background:var(--accent-light)}
.btn--ghost{background:transparent;color:var(--text-muted)}
.btn--ghost:hover{color:var(--text);background:var(--surface-2)}
.btn--full{width:100%}
.btn--sm{padding:.45rem .9rem;font-size:.8rem;border-radius:var(--radius-xs)}
.btn--lg{padding:.9rem 1.5rem;font-size:1rem}

/* ── ICON BUTTONS ─────────────────────────────────────── */
.icon-btn{display:flex;align-items:center;justify-content:center;width:36px;height:36px;background:var(--surface-2);border-radius:var(--radius-xs);color:var(--text-muted);transition:all .2s;border:1px solid var(--border-solid)}
.icon-btn svg{width:16px;height:16px}
.icon-btn:hover{color:var(--accent);background:var(--accent-light);border-color:var(--accent)}
.icon-btn--danger:hover{color:var(--rose);background:var(--rose-bg);border-color:var(--rose)}

/* ── PAGE / SECTION HEADERS ───────────────────────────── */
.page-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:1.25rem}
.page-header__title{font-family:var(--font-display);font-size:1.6rem;font-weight:400;font-style:italic;color:var(--text)}
.section-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:.875rem}
.section-header__title{font-size:.75rem;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.08em}
.section-header__action{font-size:.8rem;color:var(--accent);font-weight:600}
.section-header__action:hover{color:var(--accent-2)}
.back-btn{display:flex;align-items:center;justify-content:center;width:36px;height:36px;background:var(--surface-2);border-radius:var(--radius-xs);color:var(--text-2);border:1px solid var(--border-solid);margin-right:.75rem;transition:all .2s;flex-shrink:0}
.back-btn:hover{color:var(--accent);background:var(--accent-light);border-color:var(--accent)}
.back-btn svg{width:18px;height:18px}
.form-header{display:flex;align-items:center;margin-bottom:1.5rem}
.form-header h2{font-family:var(--font-display);font-size:1.4rem;font-weight:400;font-style:italic}

/* ── EMPTY STATE ──────────────────────────────────────── */
.empty-state{text-align:center;padding:3rem 1rem;display:flex;flex-direction:column;align-items:center;gap:.75rem}
.empty-state__icon{font-size:3rem}
.empty-state__title{font-family:var(--font-display);font-size:1.3rem;font-weight:400;font-style:italic;color:var(--text)}
.empty-state__desc{color:var(--text-muted);font-size:.875rem;max-width:260px}

/* ── DASHBOARD ────────────────────────────────────────── */
.dashboard{display:flex;flex-direction:column;gap:.25rem}
.greeting{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:1.25rem;gap:1rem}
.greeting__day{font-size:.75rem;color:var(--text-muted);text-transform:capitalize;margin-bottom:.25rem}
.greeting__title{font-family:var(--font-display);font-size:1.5rem;font-weight:300;line-height:1.2}
.greeting__title em{color:var(--accent);font-style:italic}
.greeting__identity{font-size:.78rem;color:var(--text-muted);margin-top:.35rem;font-style:italic;max-width:200px}
.greeting__stats{display:flex;gap:.5rem;flex-shrink:0}

.stat-pill{display:flex;flex-direction:column;align-items:center;background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius-sm);padding:.5rem .75rem;min-width:52px;box-shadow:var(--shadow-sm)}
.stat-pill__value{font-size:1rem;font-weight:700;font-family:var(--font-display);color:var(--accent)}
.stat-pill__label{font-size:.58rem;color:var(--text-muted)}
.stat-pill--fire .stat-pill__value{color:var(--amber)}

/* Day Progress Ring */
.day-progress{display:flex;flex-direction:column;align-items:center;margin-bottom:1.5rem;gap:.5rem}
.day-progress__ring{position:relative;display:flex;align-items:center;justify-content:center}
.day-progress__center{position:absolute;display:flex;flex-direction:column;align-items:center;pointer-events:none}
.day-progress__pct{font-size:1.5rem;font-weight:700;font-family:var(--font-display);color:var(--accent)}
.day-progress__sub{font-size:.6rem;color:var(--text-muted)}
.day-progress__msg{font-size:.85rem;color:var(--text-2)}
.day-progress__msg--done{color:var(--green);font-weight:600}
.progress-arc{transition:stroke-dashoffset .6s cubic-bezier(.4,0,.2,1)}

/* Habits List */
.habits-today{margin-bottom:1.5rem}
.habit-list{display:flex;flex-direction:column;gap:.7rem}
.habit-card{background:var(--surface);border:1.5px solid var(--border-solid);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow-sm);transition:border-color .3s,box-shadow .3s,transform .15s}
.habit-card:active{transform:scale(.99)}
.habit-card--done{border-color:rgba(5,150,105,.4);background:linear-gradient(135deg,var(--surface),var(--green-bg))}
[data-theme="dark"] .habit-card--done{border-color:rgba(16,185,129,.3);background:linear-gradient(135deg,var(--surface),rgba(16,185,129,.04))}
.habit-card__hold-area{display:flex;align-items:center;gap:.875rem;padding:1rem 1rem .7rem;cursor:pointer;user-select:none;-webkit-user-select:none;touch-action:none}
.habit-card__icon{width:44px;height:44px;border-radius:var(--radius-sm);display:flex;align-items:center;justify-content:center;font-size:1.35rem;flex-shrink:0}
.habit-card__info{flex:1;min-width:0}
.habit-card__name{display:block;font-size:.92rem;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text)}
.habit-card__when{display:block;font-size:.72rem;color:var(--text-muted);margin-top:.1rem}
.habit-card__meta{margin-top:.3rem}
.streak-badge{font-size:.68rem;font-weight:600;color:var(--amber);background:var(--amber-bg);padding:.15rem .5rem;border-radius:99px;border:1px solid rgba(217,119,6,.2)}
[data-theme="dark"] .streak-badge{border-color:rgba(245,158,11,.2)}

/* Hold ring */
.habit-card__check{width:44px;height:44px;position:relative;flex-shrink:0;display:flex;align-items:center;justify-content:center}
.hold-ring{position:absolute;inset:0;color:var(--habit-color,var(--accent))}
.hold-ring svg{width:100%;height:100%}
.hold-ring__arc{stroke:currentColor;stroke-dasharray:113;stroke-dashoffset:113;transition:none}
.check-icon{width:28px;height:28px;border-radius:50%;border:2px solid var(--border-solid);display:flex;align-items:center;justify-content:center;transition:all .3s cubic-bezier(.34,1.56,.64,1);color:transparent;background:var(--surface-2)}
.check-icon svg{width:14px;height:14px}
.habit-card__check--done .check-icon{background:var(--habit-color,var(--accent));border-color:var(--habit-color,var(--accent));color:#fff;box-shadow:0 0 12px var(--habit-color,var(--accent));transform:scale(1.1)}
.habit-card__actions{display:flex;gap:.4rem;padding:0 1rem .7rem}
.habit-action-btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;background:var(--surface-2);border-radius:var(--radius-xs);color:var(--text-muted);border:1px solid var(--border-solid);transition:all .2s}
.habit-action-btn svg{width:13px;height:13px}
.habit-action-btn:hover{color:var(--accent);background:var(--accent-light);border-color:var(--accent)}

/* Lesson preview */
.lesson-preview{margin-bottom:1rem}
.lesson-card-preview{background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius);padding:1.25rem;position:relative;overflow:hidden;box-shadow:var(--shadow-sm)}
.lesson-card-preview::before{content:'';position:absolute;top:0;left:0;right:0;height:3px;background:linear-gradient(90deg,var(--accent),var(--sky))}
.lesson-card-preview--done::before{background:linear-gradient(90deg,var(--green),var(--sky))}
.lesson-card-preview__law{font-size:.68rem;color:var(--accent);font-weight:700;text-transform:uppercase;letter-spacing:.09em;margin-bottom:.4rem}
.lesson-card-preview__title{font-family:var(--font-display);font-size:1.05rem;font-weight:400;margin-bottom:.5rem;color:var(--text)}
.lesson-card-preview__text{font-size:.83rem;color:var(--text-2);line-height:1.65;margin-bottom:.875rem}
.lesson-card-preview__link{display:inline-flex;align-items:center;gap:.4rem;font-size:.8rem;font-weight:600;color:var(--accent)}
.lesson-card-preview__link svg{width:14px;height:14px}

/* Completion Toast */
.completion-toast{position:fixed;bottom:calc(var(--bottom-nav-h) + 1rem);left:50%;transform:translateX(-50%) translateY(80px);background:var(--surface);border:1px solid rgba(5,150,105,.4);border-radius:var(--radius);padding:.875rem 1.25rem;display:flex;align-items:center;gap:.75rem;box-shadow:var(--shadow);z-index:1000;width:calc(100% - 2.5rem);max-width:420px;transition:transform .4s cubic-bezier(.34,1.56,.64,1),opacity .4s;opacity:0;pointer-events:none}
.completion-toast.show{transform:translateX(-50%) translateY(0);opacity:1}
.completion-toast__emoji{font-size:1.5rem}
.completion-toast__text{display:flex;flex-direction:column}
.completion-toast__text strong{font-size:.875rem;color:var(--green)}
.completion-toast__text span{font-size:.78rem;color:var(--text-2)}

/* ── HABIT MGMT ───────────────────────────────────────── */
.habit-mgmt-list{display:flex;flex-direction:column;gap:.7rem}
.habit-mgmt-card{background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius);padding:1rem;display:flex;align-items:center;justify-content:space-between;gap:1rem;box-shadow:var(--shadow-sm)}
.habit-mgmt-card__left{display:flex;align-items:center;gap:.875rem;flex:1;min-width:0}
.habit-mgmt-card__icon{width:44px;height:44px;border-radius:var(--radius-sm);display:flex;align-items:center;justify-content:center;font-size:1.3rem;flex-shrink:0}
.habit-mgmt-card__info{flex:1;min-width:0}
.habit-mgmt-card__name{display:block;font-size:.92rem;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.habit-mgmt-card__cat{display:block;font-size:.7rem;color:var(--text-muted);text-transform:capitalize}
.habit-mgmt-card__stats{display:flex;gap:.75rem;margin-top:.3rem;font-size:.7rem;color:var(--text-muted);flex-wrap:wrap}
.habit-mgmt-card__actions{display:flex;gap:.4rem;flex-shrink:0}

/* ── HABIT FORM ───────────────────────────────────────── */
.habit-form-page{padding-bottom:2rem}
.habit-form{display:flex;flex-direction:column;gap:1.25rem}
.form-section{background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius);padding:1.25rem;display:flex;flex-direction:column;gap:1rem;box-shadow:var(--shadow-sm)}
.form-section__icon{font-size:1.5rem}
.form-section__title{font-family:var(--font-display);font-size:1.1rem;font-weight:400;color:var(--text)}
.form-section__desc{font-size:.8rem;color:var(--text-muted);line-height:1.65;margin-top:-.25rem}
.icon-picker{display:flex;flex-wrap:wrap;gap:.4rem}
.icon-btn-pick{width:42px;height:42px;font-size:1.25rem;background:var(--surface-2);border-radius:var(--radius-xs);border:2px solid transparent;transition:all .15s;cursor:pointer}
.icon-btn-pick.active{border-color:var(--accent);background:var(--accent-light);transform:scale(1.1)}
.icon-btn-pick:hover:not(.active){border-color:var(--border-solid);transform:scale(1.05)}
.color-picker{display:flex;flex-wrap:wrap;gap:.5rem}
.color-swatch{width:30px;height:30px;border-radius:50%;border:3px solid transparent;cursor:pointer;outline:none;transition:transform .15s,border-color .15s}
.color-swatch.active{transform:scale(1.3);border-color:rgba(0,0,0,.3)}
[data-theme="dark"] .color-swatch.active{border-color:rgba(255,255,255,.7)}
.color-swatch:hover:not(.active){transform:scale(1.15)}
.freq-selector{display:flex;gap:.5rem}
.freq-option{flex:1;display:flex;align-items:center;justify-content:center}
.freq-option input{display:none}
.freq-option span{display:flex;align-items:center;justify-content:center;width:100%;padding:.65rem;background:var(--surface-2);border:2px solid var(--border-solid);border-radius:var(--radius-xs);font-size:.85rem;font-weight:500;cursor:pointer;transition:all .2s;color:var(--text-2)}
.freq-option input:checked+span{border-color:var(--accent);background:var(--accent-light);color:var(--accent)}
.difficulty-slider{display:flex;flex-direction:column;gap:.45rem}
.difficulty-slider input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:5px;background:var(--surface-3);border-radius:3px;border:none;padding:0;outline:none}
.difficulty-slider input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:22px;height:22px;background:var(--accent);border-radius:50%;cursor:pointer;box-shadow:0 0 8px var(--accent-glow);border:2px solid #fff}
.difficulty-labels{display:flex;justify-content:space-between;font-size:.68rem;color:var(--text-muted)}
.difficulty-hint{font-size:.78rem;color:var(--text-2);font-style:italic;min-height:1.2em}
.reminder-item{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}
.reminder-item .reminder-time{flex:1;padding:.6rem .875rem;background:var(--surface-2);border:1.5px solid var(--border-solid);border-radius:var(--radius-xs);color:var(--text)}
.reminders-list{display:flex;flex-direction:column;gap:.5rem;margin-bottom:.75rem}
.reminder-existing{display:flex;align-items:center;justify-content:space-between;background:var(--surface-2);border:1px solid var(--border-solid);border-radius:var(--radius-xs);padding:.6rem .875rem;font-size:.875rem}
.form-actions{display:flex;flex-direction:column;gap:.5rem;margin-top:.5rem}

/* ── STATS ────────────────────────────────────────────── */
.stats-page{padding-bottom:2rem}
.stats-hero{text-align:center;padding:1.5rem 1rem}
.stats-hero__icon{width:68px;height:68px;border-radius:var(--radius);display:flex;align-items:center;justify-content:center;font-size:2rem;margin:0 auto .875rem}
.stats-hero__name{font-family:var(--font-display);font-size:1.4rem;font-weight:400;font-style:italic;color:var(--text)}
.stats-hero__identity{font-size:.8rem;color:var(--text-muted);margin-top:.4rem;font-style:italic}
.metrics-grid{display:grid;grid-template-columns:1fr 1fr;gap:.75rem;margin-bottom:1.5rem}
.metric-card{background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius);padding:1.1rem;display:flex;flex-direction:column;align-items:center;gap:.3rem;text-align:center;box-shadow:var(--shadow-sm)}
.metric-card__value{font-size:2rem;font-weight:700;font-family:var(--font-display);line-height:1;color:var(--accent)}
.metric-card__label{font-size:.72rem;color:var(--text-muted)}
.metric-card__ring{position:relative;display:flex;align-items:center;justify-content:center}
.metric-card__ring-val{position:absolute;font-size:.85rem;font-weight:700;font-family:var(--font-display);color:var(--accent)}
.calendar-section{margin-bottom:1.5rem}
.calendar-section__title{font-size:.78rem;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.07em;margin-bottom:.875rem}
.heatmap-grid{display:grid;grid-template-columns:repeat(10,1fr);gap:.3rem}
.heatmap-cell{aspect-ratio:1;background:var(--surface-2);border:1px solid var(--border-solid);border-radius:4px;display:flex;align-items:center;justify-content:center;font-size:.52rem;color:var(--text-muted);cursor:default;transition:transform .15s}
.heatmap-cell:hover{transform:scale(1.2)}
.heatmap-cell--done{color:#fff!important;border-color:transparent!important}
.heatmap-legend{display:flex;gap:1rem;margin-top:.75rem}
.heatmap-legend__item{display:flex;align-items:center;gap:.4rem;font-size:.72rem;color:var(--text-muted)}
.chart-section{background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius);padding:1.25rem;margin-bottom:1.25rem;box-shadow:var(--shadow-sm)}
.chart-section__title{font-size:.78rem;font-weight:700;color:var(--text-muted);margin-bottom:.875rem;text-transform:uppercase;letter-spacing:.06em}
.difficulty-section{background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius);padding:1.25rem;margin-bottom:1.25rem;box-shadow:var(--shadow-sm)}
.difficulty-section__title{font-size:.85rem;font-weight:600;margin-bottom:.875rem;color:var(--text)}
.difficulty-advice{display:flex;gap:.875rem;align-items:flex-start;padding:1rem;border-radius:var(--radius-sm)}
.difficulty-advice--up{background:var(--green-bg);border:1px solid rgba(5,150,105,.25)}
.difficulty-advice--down{background:var(--rose-bg);border:1px solid rgba(219,39,119,.25)}
.difficulty-advice--ok{background:var(--accent-light);border:1px solid rgba(124,58,237,.2)}
.difficulty-advice__icon{font-size:1.4rem;flex-shrink:0}
.difficulty-advice strong{display:block;font-size:.875rem;margin-bottom:.25rem;color:var(--text)}
.difficulty-advice p{font-size:.8rem;color:var(--text-2)}
.stats-actions{margin-top:.5rem}

/* ── PROGRESO ─────────────────────────────────────────── */
.progreso-page{display:flex;flex-direction:column}
.progreso-stats{display:flex;gap:.6rem;margin-bottom:1.5rem}
.progreso-stat{flex:1;background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius);padding:1rem;text-align:center;box-shadow:var(--shadow-sm)}
.progreso-stat__val{display:block;font-size:1.6rem;font-weight:700;font-family:var(--font-display);color:var(--accent)}
.progreso-stat__lbl{display:block;font-size:.65rem;color:var(--text-muted);margin-top:.2rem}
.chart-card{background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius);padding:1.25rem;margin-bottom:1.5rem;box-shadow:var(--shadow-sm)}
.chart-card__title{font-size:.75rem;font-weight:700;color:var(--text-muted);margin-bottom:.875rem;text-transform:uppercase;letter-spacing:.07em}
.breakdown-section{margin-bottom:1.5rem}
.breakdown-section__title{font-size:.75rem;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.07em;margin-bottom:.875rem}
.breakdown-item{display:flex;align-items:center;gap:.875rem;background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius);padding:.875rem;margin-bottom:.6rem;box-shadow:var(--shadow-sm)}
.breakdown-item__icon{width:40px;height:40px;border-radius:var(--radius-xs);display:flex;align-items:center;justify-content:center;font-size:1.2rem;flex-shrink:0}
.breakdown-item__info{flex:1;min-width:0}
.breakdown-item__top{display:flex;align-items:center;justify-content:space-between;margin-bottom:.3rem}
.breakdown-item__name{font-size:.875rem;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:160px;color:var(--text)}
.breakdown-item__streak{font-size:.7rem;color:var(--amber);flex-shrink:0}
.breakdown-item__bar-wrap{height:4px;background:var(--surface-2);border-radius:2px;margin-bottom:.3rem;overflow:hidden}
.breakdown-item__bar{height:100%;border-radius:2px;transition:width .8s cubic-bezier(.4,0,.2,1)}
.breakdown-item__count{font-size:.7rem;color:var(--text-muted)}
.laws-card{background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius);padding:1.25rem;box-shadow:var(--shadow-sm)}
.laws-card__title{font-size:.75rem;font-weight:700;color:var(--text-muted);margin-bottom:1rem;text-transform:uppercase;letter-spacing:.07em}
.laws-grid{display:grid;grid-template-columns:1fr 1fr;gap:.6rem}
.law-item{background:var(--surface-2);border:1px solid var(--border-solid);border-radius:var(--radius-sm);padding:.875rem;display:flex;flex-direction:column;gap:.2rem}
.law-item__num{font-size:1.2rem;font-weight:700;font-family:var(--font-display);color:var(--accent)}
.law-item__name{font-size:.78rem;font-weight:600;color:var(--text)}
.law-item__desc{font-size:.68rem;color:var(--text-muted)}

/* ── LECCIONES ────────────────────────────────────────── */
.lecciones-page{padding-bottom:2rem}
.lecciones-progress{font-size:.78rem;color:var(--text-muted);background:var(--surface);padding:.3rem .75rem;border-radius:99px;border:1px solid var(--border-solid)}
.lecciones-progress-bar{height:3px;background:var(--surface-2);border-radius:2px;margin-bottom:1.5rem;overflow:hidden}
.lecciones-progress-bar__fill{height:100%;background:linear-gradient(90deg,var(--accent),var(--sky));border-radius:2px;transition:width .6s ease}
.ley-section{margin-bottom:1.75rem}
.ley-header{display:flex;align-items:center;gap:.75rem;margin-bottom:.875rem;padding:.75rem 1rem;background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius-sm);border-left:3px solid var(--ley-color,var(--accent));box-shadow:var(--shadow-sm)}
.ley-header__num{font-size:1.4rem}
.ley-header__law{font-size:.65rem;font-weight:700;color:var(--ley-color,var(--accent));text-transform:uppercase;letter-spacing:.1em}
.ley-header__title{font-family:var(--font-display);font-size:1.05rem;font-weight:400;color:var(--text)}
.lesson-cards{display:flex;flex-direction:column;gap:.7rem}
.lesson-card{background:var(--surface);border:1px solid var(--border-solid);border-radius:var(--radius);padding:1.25rem;transition:border-color .3s;box-shadow:var(--shadow-sm)}
.lesson-card--done{border-color:rgba(5,150,105,.4);background:linear-gradient(135deg,var(--surface),var(--green-bg))}
[data-theme="dark"] .lesson-card--done{border-color:rgba(16,185,129,.25);background:linear-gradient(135deg,var(--surface),rgba(16,185,129,.04))}
.lesson-card__top{display:flex;align-items:center;justify-content:space-between;margin-bottom:.6rem}
.lesson-card__dot{width:8px;height:8px;border-radius:50%}
.lesson-card__read{font-size:.68rem;color:var(--green);font-weight:700;opacity:0;transition:opacity .3s}
.lesson-card__read.visible{opacity:1}
.lesson-card__title{font-family:var(--font-display);font-size:1rem;font-weight:400;margin-bottom:.5rem;color:var(--text)}
.lesson-card__preview{font-size:.82rem;color:var(--text-2);line-height:1.65;margin-bottom:.875rem}
.lesson-card__full{padding-top:.875rem;border-top:1px solid var(--border-solid)}
.lesson-card__content{font-size:.875rem;color:var(--text-2);line-height:1.85;margin-bottom:1rem;white-space:pre-line}
.lesson-card__toggle{display:flex;align-items:center;gap:.4rem;font-size:.8rem;font-weight:600;color:var(--accent);padding:0;transition:color .2s}
.lesson-card__toggle:hover{color:var(--accent-2)}
.lesson-card__toggle svg{width:16px;height:16px;transition:transform .3s}

/* ── PERFIL ───────────────────────────────────────────── */
.perfil-page{padding-bottom:2rem}
.perfil-hero{text-align:center;padding:1.5rem 1rem 1.75rem}
.perfil-avatar{width:80px;height:80px;background:linear-gradient(135deg,var(--accent),var(--sky));border-radius:50%;display:flex;align-items:center;justify-content:center;margin:0 auto 1rem;box-shadow:0 0 0 4px var(--accent-glow),0 8px 24px rgba(124,58,237,.15)}
.perfil-avatar__initials{font-size:2rem;font-weight:700;color:#fff}
.perfil-hero__name{font-family:var(--font-display);font-size:1.5rem;font-weight:400;font-style:italic;color:var(--text)}
.perfil-hero__email{font-size:.82rem;color:var(--text-muted);margin-top:.25rem}
.perfil-hero__identity{font-size:.82rem;color:var(--accent);font-style:italic;margin-top:.5rem}
.perfil-hero__since{font-size:.72rem;color:var(--text-muted);margin-top:.4rem;text-transform:capitalize}
.perfil-form{display:flex;flex-direction:column;gap:1.25rem}
.perfil-danger{margin-top:1.5rem}

/* ── RESPONSIVE ───────────────────────────────────────── */
@media(min-width:480px){
  .app-shell{box-shadow:0 0 80px rgba(124,58,237,.1),0 0 0 1px var(--border-solid)}
  body{background:var(--bg-2)}
}
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none!important;transition-duration:.01ms!important}
}
