
:root{
  --blue:#8c9dad;
  --blue-dark:#738696;
  --blue-deep:#5f6f7d;
  --green:#dfe3e0;
  --green-soft:#e8e8e8;
  --vanilla:#f4efe7;
  --ivory:#f4efe7;
  --brown:#2b2b2b;
  --ink:#2b2b2b;
  --muted:#70747a;
  --line:#d8d5cf;
  --white:#ffffff;
  --blue-pale:#e6ebef;
  --cloud:#e8e8e8;
  --shadow:0 10px 30px rgba(43,43,43,.09);
  --shadow-soft:0 5px 18px rgba(43,43,43,.06);
}

*{box-sizing:border-box}
html,body{margin:0;min-height:100%;font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;color:var(--ink);background:var(--ivory);font-optical-sizing:auto;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
body{font-size:14px;letter-spacing:-.01em}
strong,h1,h2,h3,h4,.stat-value,.profile-card-main h2{letter-spacing:-.025em}
button,input,textarea{letter-spacing:-.01em}
button,input,textarea{font:inherit}
button{cursor:pointer}

.app{min-height:100vh;display:flex;background:var(--ivory)}

/* ---------- Desktop sidebar ---------- */
.sidebar{width:240px;position:fixed;z-index:20;left:0;top:0;bottom:0;background:var(--green-soft);color:var(--ink);padding:24px 14px 18px;display:flex;flex-direction:column;box-shadow:8px 0 25px rgba(36,79,131,.10);transition:width .22s ease,transform .22s ease}
.app.sidebar-collapsed .sidebar{width:0;padding-left:0;padding-right:0;overflow:hidden;box-shadow:none}
.brand{display:flex;align-items:center;gap:10px;padding:2px 9px 28px;min-width:205px}
.brand-logo{width:38px;height:38px;object-fit:contain;border-radius:9px;background:rgba(251,252,238,.12)}
.brand-logo-fallback{width:38px;height:38px;border-radius:10px;background:var(--blue);color:var(--white);display:flex;align-items:center;justify-content:center;font-weight:800;font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif}
.brand-title{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-weight:700;font-size:17px;color:var(--ink);letter-spacing:-.3px}
.brand-sub{font-size:10px;color:rgba(43,43,43,.62);margin-top:3px}
.nav{display:flex;flex-direction:column;gap:5px}
.nav button{border:0;background:transparent;text-align:left;padding:11px 12px;border-radius:10px;color:rgba(43,43,43,.72);font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:12px;font-weight:600;transition:.15s}
.nav button:hover{background:rgba(43,43,43,.06);color:var(--ink)}
.nav button.active{background:var(--blue);color:var(--white);font-weight:700;box-shadow:0 4px 12px rgba(0,0,0,.08)}
.sidebar-footer{margin-top:auto;border-top:1px solid rgba(43,43,43,.12);padding:15px 8px 0;color:rgba(43,43,43,.58);font-size:9px;line-height:1.7}
.account-mini{border:1px solid rgba(251,252,238,.22);background:rgba(255,255,255,.55);border-radius:11px;padding:10px;margin:0 0 12px;font-size:10px;color:rgba(43,43,43,.62);display:flex;align-items:center;gap:9px}
.account-mini-copy{min-width:0}
.account-mini strong{display:block;color:var(--ink);margin-bottom:3px;font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:11px}
.signout{border:0;background:transparent;color:var(--blue-dark);padding:0;font-size:10px;font-weight:600}

.main{margin-left:240px;width:calc(100% - 240px);min-height:100vh;transition:margin-left .22s ease,width .22s ease}
.app.sidebar-collapsed .main{margin-left:0;width:100%}
.sidebar-toggle{position:fixed;z-index:30;left:221px;top:24px;width:36px;height:36px;border:1px solid var(--blue);background:var(--ivory);color:var(--blue);border-radius:50%;display:flex;align-items:center;justify-content:center;box-shadow:0 3px 10px rgba(57,113,184,.16);transition:left .22s ease,transform .15s ease}
.sidebar-toggle:hover{background:var(--blue);color:var(--white);transform:scale(1.04)}
.app.sidebar-collapsed .sidebar-toggle{left:18px}
.toggle-icon{font-size:19px;line-height:1;font-weight:700}

.mobile-header,.mobile-nav{display:none}

/* ---------- Shared typography ---------- */
.page{width:min(900px,calc(100% - 70px));margin:0 auto;padding:58px 0 90px}
.eyebrow{color:var(--blue);font-size:12px;margin-bottom:10px;font-weight:700;letter-spacing:.2px}
.page h1,.profile h1{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:31px;line-height:1.2;margin:0 0 9px;letter-spacing:-.8px;color:var(--brown);font-weight:700}
.subtitle{font-size:13px;color:var(--muted);margin:0;line-height:1.7}
.section-title{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:17px;margin:0 0 14px;color:var(--brown);font-weight:700}
.dz{font-size:11px;color:#858a7c;margin-bottom:10px}
.roman{font-size:14px;color:#7e8576;font-style:italic}

/* ---------- Dashboard ---------- */
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:34px}
.stat{border:1px solid var(--line);border-radius:13px;background:var(--white);padding:20px;box-shadow:var(--shadow-soft)}
.stat:first-child{background:var(--blue);color:var(--white);border-color:var(--blue)}
.stat:nth-child(2){background:var(--blue-pale)}
.stat:nth-child(3){background:var(--vanilla)}
.stat-label{text-transform:uppercase;font-size:9px;letter-spacing:1.1px;color:#858a7c;font-weight:700}
.stat:first-child .stat-label,.stat:first-child .stat-note{color:rgba(255,255,255,.78)}
.stat-value{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:27px;font-weight:700;margin:9px 0 5px;color:var(--brown)}
.stat:first-child .stat-value{color:var(--white)}
.stat-note{font-size:11px;color:#7f8477}
.divider{border:0;border-top:1px solid var(--line);margin:34px 0}

.module-row{border:1px solid var(--line);border-radius:12px;padding:14px;margin:9px 0;background:var(--white);transition:.15s;cursor:pointer;box-shadow:0 2px 10px rgba(36,79,131,.03)}
.module-row:hover{border-color:var(--blue);box-shadow:var(--shadow-soft);transform:translateY(-1px)}
.module-row.done-row{background:var(--green-soft);border-color:#bdcf83}
.module-row-head{display:flex;align-items:center;gap:10px}
.module-icon{font-size:18px;width:24px;text-align:center}
.module-name{font-size:13px;flex:1;font-weight:600}
.module-count{font-size:10px;color:#858a7c}
.progress{height:5px;background:#e4e6da;border-radius:5px;margin:10px 78px 0 34px;overflow:hidden}
.progress>span{height:100%;display:block;background:var(--blue);border-radius:5px}
.done-badge{font-size:9px;background:var(--green);color:var(--brown);padding:4px 8px;border-radius:10px;font-weight:800}
.checkmark{color:var(--blue);font-weight:900;margin-right:5px}

/* ---------- Modules ---------- */
.tabs{display:flex;gap:8px;flex-wrap:wrap;margin-top:28px;margin-bottom:20px}
.tab{border:1px solid var(--line);background:var(--white);color:var(--muted);padding:9px 14px;border-radius:22px;font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:11px;font-weight:600;transition:.15s}
.tab:hover{border-color:var(--blue);color:var(--blue)}
.tab.active{background:var(--blue);border-color:var(--blue);color:var(--white);font-weight:700;box-shadow:0 4px 12px rgba(57,113,184,.20)}
.category-note{background:var(--blue-pale);border:1px solid #c9d1d8;border-radius:12px;padding:14px 16px;font-size:12px;color:var(--brown);margin-bottom:18px;line-height:1.6}
.group-title{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:15px;margin:22px 0 10px;color:var(--brown);font-weight:700}
.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:15px}
.module-card{position:relative;border:1.5px solid var(--ink);border-radius:13px;overflow:hidden;background:var(--white);box-shadow:var(--shadow-soft);cursor:pointer;transition:.15s}
.module-card:hover{transform:translateY(-3px);box-shadow:var(--shadow);border-color:var(--ink)}
.card-icon{height:112px;display:flex;align-items:center;justify-content:center;font-size:36px;background:var(--blue-pale)}
.module-card .card-icon{background:var(--blue-pale)}
.card-body{padding:15px 16px 16px}
.card-body h3{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:14px;margin:0 0 7px;font-weight:700;color:var(--brown)}
.card-body p{font-size:11px;line-height:1.6;color:#777c70;min-height:54px;margin:0}
.card-progress{height:4px;background:#e4e6da;border-radius:5px;margin:11px 0 8px}
.card-progress span{display:block;height:100%;background:var(--blue);border-radius:5px}
.card-foot{display:flex;justify-content:space-between;align-items:center;color:#858a7c;font-size:10px;gap:8px}
.pill{background:var(--vanilla);border-radius:10px;padding:4px 9px;color:var(--brown);font-weight:600}
.done-ribbon{position:absolute;right:8px;top:8px;background:var(--blue);color:var(--white);padding:5px 8px;border-radius:12px;font-size:9px;font-weight:800}
.is-done .card-icon{background:var(--green-soft)}
.collection-module-card{cursor:default}
.collection-module-card .card-body p{min-height:42px}
.word-chips{display:flex;gap:6px;flex-wrap:wrap;margin:12px 0}
.word-chip{background:#f0f3e6;border:1px solid #e1e6d2;border-radius:15px;padding:5px 8px;font-size:9px;color:var(--brown)}
.word-chip strong{font-weight:700}

/* ---------- Lesson ---------- */
.lesson-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:28px}
.back{border:1px solid var(--line);background:var(--white);border-radius:9px;padding:9px 13px;color:var(--brown);font-size:11px;font-weight:600}
.back:hover{border-color:var(--blue);color:var(--blue)}
.lesson-meta{display:flex;justify-content:space-between;gap:12px;color:#858a7c;font-size:11px;margin:12px 0 7px}
.lesson-progress{height:6px;background:#e4e6da;border-radius:6px;overflow:hidden}
.lesson-progress span{display:block;height:100%;background:var(--blue)}
.lesson-box{margin-top:28px;background:linear-gradient(135deg,var(--blue-pale),var(--vanilla));border:1px solid var(--line);border-radius:14px;min-height:260px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:32px}
.lesson-box .dz-large{font-size:34px;color:var(--brown);margin-bottom:14px;font-weight:600}
.meaning{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:20px;margin-top:19px;font-weight:700}
.lesson-actions{display:flex;justify-content:center;gap:9px;margin-top:23px;flex-wrap:wrap}
.lesson-actions button{border:1px solid var(--blue);background:var(--blue);color:var(--white);border-radius:9px;padding:10px 16px;font-size:11px;font-weight:700}
.lesson-actions button.secondary{background:var(--white);color:var(--blue)}
.lesson-actions button:disabled{background:#edf0e9;color:#b0b5a8;border-color:#dfe2d7}
.vocab{margin-top:30px;border-top:1px solid var(--line);padding-top:30px}
.vocab-row{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px;padding:12px 15px;border:1px solid var(--line);border-bottom:0;background:var(--white);font-size:11px}
.vocab-row:first-of-type{border-radius:9px 9px 0 0}
.vocab-row:last-of-type{border-bottom:1px solid var(--line);border-radius:0 0 9px 9px}
.completed-vocab{background:#f2f7e6}
.vocab-check{color:var(--blue);font-weight:800}

/* ---------- Notes ---------- */
.notes-layout{display:grid;grid-template-columns:230px 1fr;min-height:100vh;background:var(--ivory)}
.notes-list{border-right:1px solid var(--line);padding:22px 11px;background:#f2f5e8}
.notes-heading{display:flex;justify-content:space-between;align-items:center;padding:0 8px 16px;font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:13px}
.add-note{border:1px solid var(--blue);background:var(--blue);color:var(--white);width:29px;height:29px;border-radius:50%;font-size:18px;line-height:1}
.note-item{padding:11px 9px;border-radius:8px;margin-bottom:4px;cursor:pointer}
.note-item.active{background:var(--blue-pale);border:1px solid #cadbed}
.note-item strong{display:block;font-size:11px}
.note-item small{font-size:9px;color:#999e8e}
.note-editor{padding:22px 44px;background:var(--ivory)}
.editor-head{display:flex;gap:15px;align-items:center;border-bottom:1px solid var(--line);padding-bottom:13px}
.note-title-input{flex:1;border:0;outline:0;background:transparent;font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:20px;font-weight:700;color:var(--brown);padding:2px 0}
.save{background:var(--blue);color:var(--white);border:0;border-radius:9px;padding:9px 16px;font-size:11px;font-weight:700}
.note-editor textarea{width:100%;min-height:570px;border:0;outline:0;resize:vertical;padding:25px 0;font-size:13px;line-height:1.9;color:#555;background:transparent}

/* ---------- Profile ---------- */
.profile{width:min(850px,calc(100% - 70px));margin:0 auto;padding:62px 0 90px}
.profile-header{display:flex;align-items:center;gap:17px}
.profile-avatar-wrap{position:relative;display:flex;flex-direction:column;align-items:center;gap:6px}
.avatar{width:60px;height:60px;border-radius:50%;background:var(--blue);display:flex;align-items:center;justify-content:center;color:var(--white);font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:22px;font-weight:700;object-fit:cover;border:3px solid var(--ivory);box-shadow:0 0 0 2px var(--blue)}
.avatar.profile-avatar{width:78px;height:78px;font-size:28px}
.avatar-upload{font-size:9px;color:var(--blue);font-weight:700;cursor:pointer}
.avatar-upload input{display:none}
.profile-header h1{font-size:29px;margin:0;color:var(--brown)}
.profile-header p{font-size:11px;color:#858a7c;margin:5px 0 0}
.profile-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:35px}
.profile-stat{padding:20px;background:var(--blue-pale);border:1px solid var(--line);border-radius:11px}
.profile-stat:nth-child(2){background:var(--vanilla)}
.profile-stat:nth-child(3){background:var(--green-soft)}
.profile-stat label{font-size:9px;letter-spacing:1px;color:#858a7c;font-weight:700}
.profile-stat strong{display:block;font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:25px;margin-top:10px;color:var(--brown)}
.profile-section{border-top:1px solid var(--line);margin-top:30px;padding-top:30px}
.achievements{display:flex;flex-wrap:wrap;gap:16px 22px;align-items:flex-start}
.achievement{width:112px;border:0;border-radius:0;padding:0;text-align:center;background:transparent}
.achievement.done{background:transparent}
.achievement.locked{opacity:.42}
.achievement .badge{width:68px;height:68px;margin:0 auto 9px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--cloud);border:1.5px solid var(--ink);color:var(--ink);font-size:25px;box-shadow:0 4px 0 rgba(43,43,43,.08)}
.achievement:nth-child(2) .badge{background:var(--blue-pale);border-color:var(--blue-dark)}
.achievement:nth-child(3) .badge{background:var(--vanilla);border-color:#b8a96e}
.achievement:nth-child(4) .badge{background:#e4e0e7;border-color:#8b8192}
.achievement h4{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:11px;margin:0 0 4px;font-weight:700}
.achievement p{font-size:9px;color:#858a7c;margin:0;line-height:1.45}
.goal-note{font-size:10px;color:var(--muted);font-style:italic;margin:-5px 0 13px;line-height:1.6}
.goals{display:flex;flex-direction:column;gap:8px}
.goal{display:flex;align-items:center;border:1px solid var(--line);border-radius:9px;padding:11px 12px;font-size:11px;background:var(--white);transition:.15s}
.goal:hover{border-color:#a9bfdb}
.goal input{appearance:none;width:18px;height:18px;border:1px solid #bfc6b5;border-radius:5px;margin:0 11px 0 0;position:relative;flex:none;background:var(--white);cursor:pointer}
.goal input:checked{background:var(--blue);border-color:var(--blue)}
.goal input:checked:after{content:'✓';position:absolute;color:white;font-size:12px;left:3px;top:0px;font-weight:800}
.goal input:disabled{cursor:default;opacity:.9}
.goal.done span{text-decoration:line-through;color:#92978a}
.goal-remove{margin-left:auto;color:#aeb3a5;border:0;background:none;font-size:17px;padding:2px 4px}
.goal-remove:hover{color:var(--blue)}
.goal-add{display:flex;gap:8px;margin-top:9px}
.goal-add input{flex:1;border:1px solid var(--line);border-radius:9px;padding:10px 11px;outline:0;font-size:11px;background:var(--white)}
.goal-add input:focus{border-color:var(--blue)}
.goal-add button{border:0;background:var(--blue);color:var(--white);border-radius:9px;padding:10px 16px;font-size:11px;font-weight:700}
.mini-avatar{width:34px;height:34px;font-size:13px;flex:none}
.mobile-avatar{width:36px;height:36px;font-size:13px}
.profile-logout{display:none;}

/* ---------- Quizzes ---------- */
.quiz-list{display:grid;grid-template-columns:repeat(2,1fr);gap:14px}
.quiz-card{border:1px solid var(--line);background:var(--white);border-radius:12px;padding:18px;cursor:pointer;box-shadow:var(--shadow-soft);transition:.15s}
.quiz-card:hover{border-color:var(--blue);box-shadow:var(--shadow);transform:translateY(-2px)}
.quiz-card .quiz-icon{font-size:27px}
.quiz-card h3{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:14px;margin:9px 0 5px;font-weight:700}
.quiz-card p{font-size:10px;color:var(--muted);margin:0}
.quiz-card .quiz-status{margin-top:13px;font-size:10px;color:var(--blue);font-weight:700}
.quiz-shell{background:var(--white);border:1px solid var(--line);border-radius:13px;padding:25px;box-shadow:var(--shadow-soft)}
.quiz-q{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:19px;font-weight:700;margin:0 0 18px}
.quiz-options{display:flex;flex-direction:column;gap:9px}
.quiz-option{border:1px solid var(--line);background:var(--ivory);padding:12px 14px;border-radius:9px;text-align:left;font-size:11px;color:var(--brown);transition:.15s}
.quiz-option:hover{border-color:var(--blue);background:var(--blue-pale)}
.quiz-option.correct{background:var(--green-soft);border-color:#b8ca7e}
.quiz-option.wrong{background:#f9e8e1;border-color:#e0b8a6}
.quiz-result{text-align:center;padding:27px;background:#f3f7e7;border-radius:10px}
.quiz-result strong{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:31px;color:var(--blue);display:block}
.quiz-result p{font-size:12px;color:var(--muted)}

/* ---------- Auth ---------- */
.auth-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:30px;background:var(--ivory)}
.auth-card{width:min(430px,100%);background:var(--white);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);padding:34px}
.auth-brand{text-align:center;margin-bottom:23px}
.auth-brand img{width:min(300px,88%);height:auto;max-height:155px;object-fit:contain;margin:0 auto 10px;display:block}
.auth-logo{width:min(300px,88%);height:auto}
.auth-heading{text-align:center;margin:0 0 18px}
.auth-heading h1{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;margin:0 0 7px;font-size:24px;color:var(--brown);font-weight:700}
.auth-heading p{margin:0;color:var(--muted);font-size:11px;line-height:1.6}
.auth-brand-fallback{width:70px;height:70px;border-radius:50%;background:var(--blue);color:var(--white);display:inline-flex;align-items:center;justify-content:center;font-size:28px;font-weight:800}
.auth-brand h1{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;margin:7px 0 4px;color:var(--blue);font-size:26px}
.auth-brand p{margin:0;color:var(--muted);font-size:11px}
.auth-tabs{display:flex;background:#edf0e7;border-radius:9px;padding:3px;margin-bottom:20px}
.auth-tabs button{flex:1;border:0;background:transparent;padding:9px;border-radius:7px;font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:11px;color:var(--muted);font-weight:600}
.auth-tabs button.active{background:var(--blue);color:var(--white);font-weight:700}
.form-group{margin-bottom:13px}
.form-group label{display:block;font-size:10px;font-weight:700;margin-bottom:6px;color:var(--brown)}
.form-group input{width:100%;padding:11px;border:1px solid var(--line);border-radius:8px;outline:0;background:var(--ivory);font-size:12px}
.form-group input:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(57,113,184,.10)}
.auth-submit{width:100%;border:0;background:var(--blue);color:var(--white);border-radius:9px;padding:12px;font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:12px;font-weight:700;margin-top:5px}
.auth-submit:hover{background:var(--blue-dark)}
.auth-message{min-height:18px;margin:9px 0 0;color:#9a5c4c;font-size:10px;text-align:center;line-height:1.5}
.auth-note{font-size:9px;color:#989d90;line-height:1.6;text-align:center;margin:17px 0 0}
.field-hint{margin-top:5px;color:var(--muted);font-size:9px;line-height:1.4}
.toast{position:fixed;z-index:100;right:22px;bottom:22px;background:var(--blue);color:var(--white);padding:10px 14px;border-radius:9px;font-size:11px;box-shadow:var(--shadow)}

/* ---------- Tablet ---------- */
@media(max-width:950px){
  .cards{grid-template-columns:repeat(2,1fr)}
  .page,.profile{width:calc(100% - 48px)}
}

/* ---------- Phone ---------- */
@media(max-width:650px){
  body{font-size:13px;padding-bottom:74px}
  .app{display:block;min-height:100vh}
  .sidebar,.sidebar-toggle{display:none}
  .main{margin:0!important;width:100%!important;min-height:100vh}

  .mobile-header{position:sticky;top:0;z-index:40;height:64px;display:flex;align-items:center;justify-content:space-between;padding:8px 16px;background:var(--ivory);box-shadow:0 5px 18px rgba(36,79,131,.16)}
  .mobile-brand{display:flex;align-items:center;gap:8px;color:var(--ink);font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-weight:700;font-size:15px}
  .mobile-brand .brand-logo{width:46px;height:42px;background:transparent}
  .mobile-brand .brand-logo-fallback{width:38px;height:38px}
  .mobile-header .mobile-avatar{background:var(--blue);color:var(--white);border-color:var(--blue);box-shadow:0 0 0 1px var(--vanilla)}

  .mobile-nav{position:fixed;z-index:50;left:0;right:0;bottom:0;height:68px;display:grid;grid-template-columns:repeat(5,1fr);background:rgba(255,255,255,.98);border-top:1px solid var(--line);box-shadow:0 -7px 22px rgba(36,79,131,.10);padding:6px 4px 7px}
  .mobile-nav button{border:0;background:transparent;color:#7c8274;border-radius:9px;font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:20px;line-height:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px}
  .mobile-nav button small{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:8px;line-height:1;font-weight:600}
  .mobile-nav button.active{background:var(--blue-pale);color:var(--blue-dark)}

  .page,.profile{width:100%;padding:28px 17px 32px;margin:0}
  .page h1,.profile h1{font-size:25px;letter-spacing:-.6px}
  .subtitle{font-size:11px;line-height:1.65}
  .eyebrow{font-size:11px}
  .section-title{font-size:16px}

  .stats,.profile-stats{grid-template-columns:1fr;gap:10px;margin-top:24px}
  .stat,.profile-stat{padding:16px}
  .stat-value,.profile-stat strong{font-size:23px}
  .divider{margin:27px 0}

  .module-row{padding:13px 11px}
  .module-name{font-size:11px}
  .progress{margin-right:55px}

  .tabs{gap:7px;flex-wrap:nowrap;overflow-x:auto;padding-bottom:4px;margin-top:22px;margin-bottom:16px;scrollbar-width:none}
  .tabs::-webkit-scrollbar{display:none}
  .tab{white-space:nowrap;padding:8px 12px;font-size:10px;flex:none}
  .category-note{font-size:10px;padding:12px 13px}
  .cards,.quiz-list,.collection{grid-template-columns:1fr;gap:12px}
  .card-icon{height:92px}
  .card-body{padding:14px}
  .card-body p{min-height:0}

  .lesson-top{margin-bottom:22px}
  .lesson-meta{font-size:9px}
  .lesson-box{min-height:235px;padding:24px 16px;margin-top:22px}
  .lesson-box .dz-large{font-size:28px}
  .meaning{font-size:17px}
  .lesson-actions{display:grid;grid-template-columns:1fr 1.25fr;width:100%}
  .lesson-actions button{width:100%;padding:11px 8px}
  .vocab{padding-top:24px;margin-top:25px}
  .vocab-row{grid-template-columns:1.1fr .8fr 1fr;font-size:9px;padding:10px 9px}
  .roman{font-size:10px}

  .notes-layout{display:flex;flex-direction:column;min-height:auto}
  .notes-list{border-right:0;border-bottom:1px solid var(--line);padding:13px 10px;max-height:190px;overflow:auto}
  .notes-heading{padding-bottom:10px}
  .note-editor{padding:16px 17px;min-height:520px}
  .editor-head{gap:8px}
  .note-title-input{font-size:17px;min-width:0}
  .note-editor textarea{min-height:420px;font-size:12px}

  .profile-header{align-items:flex-start;gap:14px}
  .avatar.profile-avatar{width:70px;height:70px}
  .profile-header h1{font-size:23px}
  .profile-header p{font-size:9px;line-height:1.5}
  .achievements{display:grid;grid-template-columns:repeat(2,112px);gap:16px 20px}
  .achievement{padding:14px 6px}
  .goal{font-size:10px;padding:10px}
  .goal-add{display:grid;grid-template-columns:1fr auto}
  .goal-add button{padding-left:14px;padding-right:14px}

  .quiz-shell{padding:18px}
  .quiz-q{font-size:17px}
  .quiz-option{font-size:10px;padding:12px}

  .auth-wrap{padding:16px;align-items:center}
  .auth-card{padding:24px 19px;border-radius:14px}
  .auth-brand img{width:min(260px,92%);max-height:130px}
  .auth-heading h1{font-size:21px}
  .auth-heading p{font-size:10px}
  .form-group input{padding:11px;font-size:12px}
  .auth-submit{padding:12px}
  .toast{left:16px;right:16px;bottom:80px;text-align:center}
}

/* ---------- KuzuSpeak icon system ---------- */
.brand{align-items:center}
.brand-ks-logo{width:62px;height:54px;display:block;object-fit:contain;object-position:center;flex:0 0 auto}
.mobile-brand .brand-ks-logo{width:43px;height:39px;object-fit:contain;flex:0 0 auto}
.module-svg{width:42px;height:42px;color:var(--blue);display:block}
.module-icon .module-svg{width:24px;height:24px}
.quiz-icon .module-svg{width:30px;height:30px}
.lesson-heading-icon{display:inline-flex;vertical-align:-7px;margin-right:10px;color:var(--blue)}
.lesson-heading-icon .module-svg{width:34px;height:34px}
.card-icon{color:var(--blue)}

/* Dashboard uses the cool blue module surface throughout. */
.stat:nth-child(2){background:var(--green-soft);border-color:#d1dfaa}
.module-row,.module-row.done-row{background:var(--blue-pale);border-color:#c9d1d8}
.module-row:hover{background:#dde4e9}
.dashboard-category{margin-bottom:24px}
.dashboard-category-title{display:flex;align-items:center;justify-content:space-between;margin:20px 0 8px}
.dashboard-category-title span{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:14px;font-weight:700;color:var(--brown)}
.dashboard-category-title button{border:0;background:transparent;color:var(--blue);font-size:10px;font-weight:700;padding:4px 0}
.collection-row{cursor:pointer}
.collection-row-note{font-size:10px;color:#7b8290;margin:8px 0 0 34px}

/* Keep collection tabs visually parallel with Beginner cards. */
.collection-module-card .card-icon{color:var(--blue)}
.collection-module-card .card-progress span{width:100%}


/* ---------- Simple profile card / mobile-first reference treatment ---------- */
.profile{max-width:760px;padding-top:34px}
.profile-intro{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-bottom:18px}
.profile-greeting{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-style:italic;font-size:34px;line-height:1.05;font-weight:500;letter-spacing:-1px;color:var(--ink);margin:0}
.profile-date{font-size:11px;color:var(--muted);margin:8px 0 0}
.profile-card{border:1.6px solid var(--ink);border-radius:18px;background:var(--white);padding:20px;display:grid;grid-template-columns:150px 1fr;gap:22px;align-items:center}
.profile-card-avatar{width:138px;height:138px;border:1.5px solid var(--ink);border-radius:12px;display:flex;align-items:center;justify-content:center;background:var(--blue-pale);overflow:hidden}
.profile-card-avatar .avatar{width:110px;height:110px;border:0;box-shadow:none}
.profile-card-main h2{font-family:Georgia,'Times New Roman',serif;font-size:34px;font-style:italic;font-weight:500;margin:0 0 6px;color:var(--ink)}
.profile-card-role{font-family:"SF Pro Display","SF Pro Text",-apple-system,BlinkMacSystemFont,Inter,Roboto,"Segoe UI",ui-sans-serif,system-ui,sans-serif;font-size:11px;font-weight:700;color:var(--blue-dark);margin-bottom:14px}
.profile-card-divider{border-top:1px dashed #b9b6b1;margin:0 0 13px}
.profile-facts{display:grid;grid-template-columns:1fr 1fr;gap:10px 22px}
.profile-fact label{display:block;font-size:8px;text-transform:uppercase;letter-spacing:1px;color:var(--muted);font-weight:700}
.profile-fact strong{display:block;font-size:11px;margin-top:3px;color:var(--ink);font-weight:600;overflow-wrap:anywhere}
.profile-card-actions{margin-top:12px;display:flex;gap:8px;align-items:center}
.profile-card-actions .avatar-upload{border:1px solid var(--blue);border-radius:8px;padding:7px 10px;background:var(--blue-pale);color:var(--blue-dark);font-size:9px}
.profile-stat-strip{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:18px}
.profile-stat-strip .profile-stat{background:var(--white);border:1px solid var(--line);border-radius:12px;padding:14px}
.profile-stat-strip .profile-stat:nth-child(2){background:var(--blue-pale)}
.profile-stat-strip .profile-stat:nth-child(3){background:var(--green-soft)}
.profile-section.simple-section{border-top:0;margin-top:20px;padding-top:0}
.simple-section .section-title{margin-bottom:10px}
@media(max-width:650px){
  .profile{padding:22px 17px 34px}
  .profile-intro{display:block;margin-bottom:16px}
  .profile-greeting{font-size:30px}
  .profile-card{grid-template-columns:1fr;padding:15px;gap:15px;border-radius:16px}
  .profile-card-avatar{width:100%;height:170px}
  .profile-card-avatar .avatar{width:116px;height:116px}
  .profile-card-main h2{font-size:28px}
  .profile-facts{gap:10px 14px}
  .profile-stat-strip{grid-template-columns:1fr 1fr 1fr;gap:7px}
  .profile-stat-strip .profile-stat{padding:12px 9px}
  .profile-stat-strip .profile-stat label{font-size:7px;letter-spacing:.7px}
  .profile-stat-strip .profile-stat strong{font-size:19px}
}

.note-delete{border:1px solid #c7c2bc;background:transparent;color:var(--ink);border-radius:9px;padding:9px 13px;font-size:11px;font-weight:650}.note-delete:hover{background:#f1eeee;border-color:var(--ink)}
.username-button{border:1px solid var(--ink);border-radius:8px;padding:7px 10px;background:var(--white);color:var(--ink);font-size:9px;font-weight:650}.username-button:hover{background:var(--cloud)}
.profile-card-actions{flex-wrap:wrap}

/* Final brand + typography polish */
.brand-ks-logo{background:transparent !important;}
.mobile-brand .brand-ks-logo{background:transparent !important;}
body,.app,button,input,textarea,select{font-synthesis:none;}

/* ---------- Dashboard density + calm information hierarchy ---------- */
.dashboard-page{width:min(1080px,calc(100% - 70px))}
.dashboard-intro{display:flex;align-items:flex-end;justify-content:space-between;gap:24px}
.dashboard-date{font-size:11px;color:var(--muted);padding-bottom:6px;white-space:nowrap}
.dashboard-stats{grid-template-columns:repeat(4,1fr);margin-top:28px}
.dashboard-stats .stat{min-height:112px;padding:18px}
.dashboard-stats .stat:first-child{background:var(--blue);border-color:var(--blue)}
.dashboard-stats .stat:nth-child(2),.dashboard-stats .stat:nth-child(3),.dashboard-stats .stat:nth-child(4){background:var(--white)}
.dashboard-stats .stat:nth-child(3){border-color:#d8d5cf}
.dashboard-stats .stat-streak{background:var(--blue-pale)!important;border-color:#c9d1d8!important}
.continue-card{margin-top:18px;border:1px solid var(--line);border-radius:15px;background:var(--white);padding:20px 22px;display:flex;align-items:center;justify-content:space-between;gap:22px;box-shadow:var(--shadow-soft)}
.continue-copy{min-width:0;flex:1}
.continue-copy .eyebrow{margin-bottom:5px;font-size:9px;text-transform:uppercase;letter-spacing:1.1px}
.continue-copy h2{margin:0 0 4px;font-size:18px;font-weight:700;letter-spacing:-.4px}
.continue-copy p{margin:0 0 12px;font-size:11px;color:var(--muted)}
.continue-progress{height:6px;background:var(--cloud);border-radius:999px;overflow:hidden;max-width:620px}
.continue-progress span{display:block;height:100%;background:var(--blue);border-radius:999px}
.continue-copy small{display:block;margin-top:7px;font-size:9px;color:var(--muted)}
.continue-button{border:1px solid var(--ink);background:var(--ink);color:var(--white);border-radius:9px;padding:10px 15px;font-size:10px;font-weight:700;white-space:nowrap}
.continue-button:hover{background:var(--blue-deep);border-color:var(--blue-deep)}
.dashboard-grid{display:grid;grid-template-columns:minmax(0,1fr) 280px;gap:22px;margin-top:30px;align-items:start}
.dashboard-main-column{min-width:0}
.dashboard-section-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:2px}
.dashboard-section-head .section-title{margin:0}
.dashboard-section-head button,.side-card-head button{border:0;background:transparent;color:var(--blue-dark);font-size:9px;font-weight:700;padding:3px 0}
.compact-category{margin-bottom:23px}
.compact-category .dashboard-category-title{margin:15px 0 8px}
.compact-category .dashboard-category-title span{font-size:12px}
.compact-category .dashboard-category-title button{font-size:9px}
.module-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.module-tile{display:flex;align-items:center;gap:11px;min-height:70px;border:1px solid #c9d1d8;border-radius:11px;background:var(--blue-pale);padding:11px 12px;cursor:pointer;transition:.15s;box-shadow:0 3px 10px rgba(43,43,43,.035)}
.module-tile:hover{transform:translateY(-1px);border-color:var(--ink);background:#e1e7eb}
.module-tile.done{background:#eef0ed}
.module-tile-icon{width:34px;height:34px;flex:0 0 34px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:rgba(255,255,255,.55);color:var(--blue-dark)}
.module-tile-icon .module-svg{width:20px;height:20px}
.module-tile-copy{min-width:0;flex:1}
.module-tile-name{font-size:10px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:8px}
.module-tile-name .checkmark{color:var(--blue-dark);margin-right:3px}
.module-tile .progress{height:4px;margin:0}
.module-tile-foot{display:flex;justify-content:space-between;margin-top:5px;color:var(--muted);font-size:8px}
.dashboard-side-column{display:flex;flex-direction:column;gap:11px}
.side-card{border:1px solid var(--line);border-radius:13px;background:var(--white);padding:15px;box-shadow:var(--shadow-soft)}
.side-card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.side-card-head h3{margin:0;font-size:12px;font-weight:700;letter-spacing:-.2px}
.side-card-head>span{font-size:9px;color:var(--blue-dark);font-weight:700}
.weekly-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:5px}
.weekly-stats>div{padding:9px 5px;border-radius:9px;background:var(--blue-pale);text-align:center}
.weekly-stats strong{display:block;font-size:17px;line-height:1.1}
.weekly-stats span{display:block;margin-top:4px;font-size:7px;color:var(--muted);text-transform:uppercase;letter-spacing:.5px}
.week-note{font-size:9px;line-height:1.55;color:var(--muted);margin-top:10px}
.goal-small-copy{font-size:9px;color:var(--muted);margin:0 0 9px}
.goal-dots{display:flex;gap:6px}
.goal-dots span{width:15px;height:15px;border-radius:50%;border:1px solid #c8ccd0;background:var(--white)}
.goal-dots span.filled{background:var(--blue);border-color:var(--blue)}
.mini-badges{display:grid;grid-template-columns:repeat(4,1fr);gap:5px}
.mini-badge{text-align:center;min-width:0}
.mini-badge span{width:38px;height:38px;margin:0 auto 5px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--cloud);border:1px solid #d4d6d5;color:#9a9fa4;font-size:15px}
.mini-badge.unlocked span{background:var(--blue-pale);border-color:#bfcbd4;color:var(--blue-deep)}
.mini-badge small{display:block;font-size:6.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mini-goal{display:flex;gap:7px;align-items:flex-start;font-size:9px;line-height:1.45;padding:7px 0;border-top:1px solid #eeeae4;color:var(--ink)}
.mini-goal:first-of-type{border-top:0}
.mini-goal.complete{color:var(--muted);text-decoration:line-through}
.mini-goal-check{color:var(--blue-dark);font-weight:700;flex:0 0 auto}

/* ---------- Rich Notes ---------- */
.rich-note-editor{min-width:0}
.editor-toolbar{display:flex;align-items:center;gap:4px;flex-wrap:wrap;border-bottom:1px solid var(--line);padding:9px 0}
.editor-toolbar button{border:1px solid transparent;background:transparent;color:var(--ink);border-radius:6px;min-width:29px;height:28px;padding:4px 7px;font-size:11px;font-weight:600}
.editor-toolbar button:hover{background:var(--cloud);border-color:var(--line)}
.editor-toolbar select{height:28px;border:1px solid var(--line);background:var(--white);color:var(--ink);border-radius:6px;padding:2px 7px;font-size:9px;outline:none}
.toolbar-divider{width:1px;height:20px;background:var(--line);margin:0 3px}
.note-richtext{width:100%;min-height:570px;padding:24px 0 8px;font-size:13px;line-height:1.8;color:#4d5256;outline:none;overflow-wrap:anywhere}
.note-richtext:empty:before{content:'Start writing…';color:#a5a7a8;pointer-events:none}
.note-richtext h1,.note-richtext h2,.note-richtext h3,.note-richtext h4{color:var(--ink);line-height:1.25;margin:18px 0 8px}
.note-richtext h2{font-size:22px}.note-richtext h3{font-size:17px}.note-richtext h4{font-size:14px}
.note-richtext p{margin:0 0 10px}
.note-richtext ul,.note-richtext ol{padding-left:25px;margin:8px 0 12px}
.note-richtext blockquote{border-left:3px solid var(--blue);margin:12px 0;padding:7px 14px;color:var(--muted);background:var(--blue-pale);border-radius:0 8px 8px 0}
.note-richtext a{color:var(--blue-deep);text-decoration:underline}
.note-richtext img{display:block;max-width:100%;height:auto;border-radius:10px;border:1px solid var(--line);margin:14px 0;box-shadow:var(--shadow-soft)}
.editor-hint{font-size:8px;color:#9a9da0;padding-top:8px}

@media(max-width:900px){
  .dashboard-page{width:calc(100% - 34px)}
  .dashboard-grid{grid-template-columns:1fr}
  .dashboard-side-column{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:650px){
  .dashboard-page{width:100%}
  .dashboard-intro{display:block}
  .dashboard-date{padding:0;margin-top:7px}
  .dashboard-stats{grid-template-columns:1fr 1fr;gap:8px;margin-top:20px}
  .dashboard-stats .stat{min-height:94px;padding:14px}
  .dashboard-stats .stat-value{font-size:22px}
  .continue-card{display:block;padding:16px;margin-top:12px}
  .continue-button{margin-top:13px;width:100%}
  .dashboard-grid{margin-top:23px;gap:18px}
  .module-grid{grid-template-columns:1fr}
  .dashboard-side-column{grid-template-columns:1fr}
  .mini-badges{grid-template-columns:repeat(4,1fr)}
  .rich-notes-layout .editor-toolbar{gap:3px}
  .editor-toolbar select{max-width:92px}
  .note-richtext{min-height:420px;font-size:12px;padding-top:18px}
}

/* ---------- Final dashboard hierarchy polish ---------- */
.dashboard-page .eyebrow{font-size:11px;margin-bottom:7px;letter-spacing:.35px}
.dashboard-page h1{font-size:29px;line-height:1.16;letter-spacing:-.9px}
.dashboard-page .subtitle{font-size:12px;line-height:1.55}
.dashboard-page .section-title{font-size:16px;letter-spacing:-.35px}
.dashboard-stats .stat-label{font-size:8px}
.dashboard-stats .stat-value{font-size:25px;margin:8px 0 4px}
.dashboard-stats .stat-note{font-size:10px}
.dashboard-section-head button{font-size:9px}
.compact-category .dashboard-category-title span{font-size:12px}
.module-tile{background:var(--white);border-color:var(--line)}
.module-tile.done{background:var(--white)}
.module-tile:hover{background:#fafafa;border-color:var(--ink)}
.module-tile-name{font-size:11px;margin-bottom:7px}
.module-tile-foot{font-size:9px}
.dashboard-side-column{border-left:1px solid var(--line);padding-left:22px}
.side-card-head h3{font-size:13px}
.side-card-head>span,.side-card-head button{font-size:9px}
.weekly-stats strong{font-size:16px}
.weekly-stats span{font-size:7px}
.week-note,.goal-small-copy,.mini-goal{font-size:9px}
.dashboard-goal-add-link{border:0;background:transparent;color:var(--blue-dark);font-size:9px;font-weight:700;padding:3px 0;cursor:pointer}
.dashboard-goal-row{display:flex;align-items:flex-start;gap:9px;font-size:10px;line-height:1.45;cursor:pointer}
.dashboard-goal-row input{appearance:none;width:17px;height:17px;border:1px solid #bfc6b5;border-radius:5px;margin:0;position:relative;flex:none;background:var(--white);cursor:pointer}
.dashboard-goal-row input:checked{background:var(--blue);border-color:var(--blue)}
.dashboard-goal-row input:checked:after{content:'✓';position:absolute;color:white;font-size:11px;left:3px;top:0;font-weight:800}
.dashboard-goal-status{font-size:8px;color:var(--muted);margin:8px 0 0 26px}
.dashboard-empty-goal{font-size:10px;line-height:1.5;color:var(--muted)}
.dashboard-empty-goal strong{display:block;color:var(--ink);font-size:10px;font-weight:700;text-transform:lowercase}
.dashboard-empty-goal>span{display:block;margin-top:2px}
.dashboard-goal-add{display:flex;gap:6px;margin-top:10px}
.dashboard-goal-add input{min-width:0;flex:1;border:1px solid var(--line);border-radius:8px;padding:8px 9px;background:var(--white);color:var(--ink);outline:none;font-size:9px}
.dashboard-goal-add input:focus{border-color:var(--blue)}
.dashboard-goal-add button{border:0;background:var(--ink);color:var(--white);border-radius:8px;padding:8px 11px;font-size:9px;font-weight:700;cursor:pointer}
@media(max-width:900px){.dashboard-side-column{border-left:0;padding-left:0}}
@media(max-width:650px){.dashboard-page h1{font-size:27px}.dashboard-page .subtitle{font-size:11px}.dashboard-stats .stat-value{font-size:22px}}

/* ---------- Dashboard sizing refinement ---------- */
@media (min-width: 901px){
  .dashboard-grid{
    grid-template-columns:minmax(0,1fr) 310px;
    gap:28px;
  }
  .dashboard-side-column{
    padding-left:26px;
    gap:14px;
  }
  .side-card{
    padding:18px;
    border-radius:14px;
  }
  .side-card-head{
    margin-bottom:14px;
  }
  .side-card-head h3{
    font-size:14px;
  }
  .weekly-stats{
    gap:7px;
  }
  .weekly-stats>div{
    padding:11px 6px;
    border-radius:10px;
  }
  .weekly-stats strong{
    font-size:19px;
  }
  .weekly-stats span{
    font-size:7.5px;
  }
  .week-note,.goal-small-copy,.mini-goal{
    font-size:9.5px;
  }
  .mini-badges{
    gap:7px;
  }
  .mini-badge span{
    width:42px;
    height:42px;
    font-size:16px;
  }
  .mini-badge small{
    font-size:7px;
  }
  .today-goal-card .dashboard-goal-row{
    font-size:10.5px;
  }
  .dashboard-goal-status{
    font-size:8.5px;
  }

  /* Keep dashboard module progress visually calmer and less dominant. */
  .module-tile .progress{
    width:72%;
    max-width:72%;
  }
  .module-tile-foot{
    width:72%;
  }
}

@media (min-width: 1200px){
  .dashboard-grid{
    grid-template-columns:minmax(0,1fr) 320px;
  }
  .dashboard-side-column{
    padding-left:28px;
  }
}

/* ---------- Final phone layout polish ---------- */
@media (max-width: 650px){
  html{overflow-x:hidden}
  body{overflow-x:hidden}
  .mobile-header{
    height:62px;
    padding:7px 15px;
    box-shadow:0 3px 14px rgba(43,43,43,.08);
  }
  .mobile-brand{gap:7px;font-size:14px}
  .mobile-brand .brand-ks-logo{width:42px;height:38px}
  .mobile-nav{
    height:66px;
    padding:5px 5px 6px;
    box-shadow:0 -4px 16px rgba(43,43,43,.08);
  }
  .mobile-nav button{font-size:19px;gap:3px}
  .mobile-nav button small{font-size:8px}

  .profile-logout{display:block;width:100%;margin-top:12px;border:1px solid var(--line);background:var(--white);color:var(--ink);border-radius:10px;padding:11px 14px;font-size:10px;font-weight:700;}

  .page,.profile{padding-left:16px;padding-right:16px}
  .page h1{font-size:26px;line-height:1.15;letter-spacing:-.7px}
  .subtitle{font-size:11px;line-height:1.6}
  .eyebrow{font-size:10px;margin-bottom:7px}
  .section-title{font-size:16px}

  /* Dashboard */
  .dashboard-page{padding-top:24px;padding-bottom:28px}
  .dashboard-intro{gap:0}
  .dashboard-date{font-size:9px;margin-top:8px;color:var(--muted)}
  .dashboard-stats{
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-top:20px;
  }
  .dashboard-stats .stat{
    min-height:88px;
    padding:13px 12px;
    border-radius:12px;
  }
  .dashboard-stats .stat-label{font-size:7px;letter-spacing:.9px}
  .dashboard-stats .stat-value{font-size:21px;margin:7px 0 3px}
  .dashboard-stats .stat-note{font-size:9px}

  .continue-card{
    margin-top:12px;
    padding:15px;
    border-radius:13px;
    gap:0;
  }
  .continue-copy .eyebrow{font-size:8px}
  .continue-title{font-size:16px}
  .continue-subtitle{font-size:10px}
  .continue-progress{max-width:none;height:5px}
  .continue-copy small{font-size:8px}
  .continue-button{margin-top:12px;padding:10px 13px;font-size:9px}

  .dashboard-grid{
    margin-top:22px;
    gap:20px;
  }
  .dashboard-section-head{margin-bottom:0}
  .dashboard-section-head .section-title{font-size:15px}
  .dashboard-section-head button{font-size:8px}
  .dashboard-category{margin-bottom:20px}
  .compact-category .dashboard-category-title{margin:13px 0 7px}
  .compact-category .dashboard-category-title span{font-size:11px}
  .compact-category .dashboard-category-title button{font-size:8px}

  .module-grid{grid-template-columns:1fr;gap:8px}
  .module-tile{
    min-height:66px;
    padding:10px 11px;
    gap:10px;
    border-radius:10px;
  }
  .module-tile-icon{width:32px;height:32px;flex-basis:32px}
  .module-tile-icon .module-svg{width:18px;height:18px}
  .module-tile-name{font-size:10px;margin-bottom:6px}
  .module-tile .progress{height:4px;width:76%;max-width:76%}
  .module-tile-foot{width:76%;font-size:8px;margin-top:4px}

  .dashboard-side-column{
    display:flex;
    flex-direction:column;
    gap:10px;
    border-left:0;
    border-top:1px solid var(--line);
    padding:18px 0 0;
  }
  .side-card{
    width:100%;
    padding:15px;
    border-radius:13px;
  }
  .side-card-head{margin-bottom:11px}
  .side-card-head h3{font-size:13px}
  .side-card-head>span,.side-card-head button{font-size:8px}
  .weekly-stats{gap:6px}
  .weekly-stats>div{padding:10px 5px;border-radius:9px}
  .weekly-stats strong{font-size:18px}
  .weekly-stats span{font-size:7px}
  .week-note,.goal-small-copy,.mini-goal{font-size:9px}
  .dashboard-goal-row{font-size:10px}
  .dashboard-goal-status{font-size:8px}
  .dashboard-goal-add input{font-size:9px;padding:8px}
  .dashboard-goal-add button{font-size:9px;padding:8px 10px}
  .mini-badges{gap:6px}
  .mini-badge span{width:42px;height:42px;font-size:16px}
  .mini-badge small{font-size:7px}

  /* Modules */
  .tabs{margin-top:20px;margin-bottom:15px;gap:6px}
  .tab{padding:8px 11px;font-size:9px}
  .category-note{font-size:10px;line-height:1.55;padding:11px 12px;margin-bottom:15px}
  .cards{grid-template-columns:1fr;gap:11px}
  .module-card{border-radius:12px}
  .card-icon{height:96px}
  .card-body{padding:13px 14px 14px}
  .card-body h3{font-size:14px}
  .card-body p{font-size:10px;line-height:1.55}
  .card-progress{margin-top:10px}
  .card-foot{font-size:9px}

  /* Lessons */
  .lesson-top{margin-bottom:18px;gap:10px}
  .lesson-top h1{font-size:23px}
  .back{padding:8px 10px;font-size:9px}
  .lesson-box{min-height:220px;padding:22px 14px;margin-top:18px;border-radius:13px}
  .lesson-box .dz-large{font-size:27px}
  .meaning{font-size:16px}
  .lesson-actions{gap:7px}
  .lesson-actions button{padding:10px 7px;font-size:10px}
  .vocab{padding-top:20px;margin-top:22px}
  .vocab-row{grid-template-columns:1fr .8fr 1fr;font-size:9px;padding:9px 8px}

  /* Quizzes */
  .quiz-list{grid-template-columns:1fr;gap:10px}
  .quiz-card{padding:15px;border-radius:12px}
  .quiz-card h3{font-size:14px}
  .quiz-card p,.quiz-card .quiz-status{font-size:9px}
  .quiz-shell{padding:16px;border-radius:12px}
  .quiz-q{font-size:17px;line-height:1.35}
  .quiz-option{font-size:10px;padding:11px 12px}

  /* Notes */
  .notes-layout{display:flex;flex-direction:column;min-height:calc(100vh - 62px)}
  .notes-list{
    border-right:0;
    border-bottom:1px solid var(--line);
    padding:11px 10px;
    max-height:155px;
  }
  .notes-heading{padding:0 5px 9px;font-size:13px}
  .note-item{padding:9px 10px;border-radius:9px}
  .note-item strong{font-size:10px}
  .note-item small{font-size:8px}
  .note-editor{padding:14px 15px 26px;min-height:0}
  .editor-head{gap:7px;align-items:center}
  .note-title-input{font-size:17px;line-height:1.2}
  .editor-head .save,.editor-head .note-delete{padding:8px 10px;font-size:9px}
  .editor-toolbar{padding:8px 0;gap:3px;overflow-x:auto;flex-wrap:nowrap;scrollbar-width:none}
  .editor-toolbar::-webkit-scrollbar{display:none}
  .editor-toolbar button{min-width:28px;height:28px;padding:4px 6px}
  .editor-toolbar select{flex:0 0 auto;max-width:88px}
  .note-richtext{min-height:430px;padding:18px 0 8px;font-size:12px;line-height:1.75}
  .note-richtext h2{font-size:20px}
  .note-richtext h3{font-size:16px}
  .note-richtext img{max-width:100%;border-radius:8px}

  /* Profile — preserve the existing ID card treatment, just make it fit the phone. */
  .profile{padding-top:22px;padding-bottom:34px}
  .profile-intro{margin-bottom:15px}
  .profile-greeting{font-size:29px;letter-spacing:-.8px}
  .profile-date{font-size:9px;margin-top:6px}
  .profile-card{grid-template-columns:1fr;padding:14px;gap:14px;border-radius:15px}
  .profile-card-avatar{width:100%;height:165px;border-radius:11px}
  .profile-card-avatar .avatar{width:112px;height:112px}
  .profile-card-main h2{font-size:27px}
  .profile-card-role{font-size:9px;margin-bottom:12px}
  .profile-facts{gap:9px 13px}
  .profile-fact label{font-size:7px}
  .profile-fact strong{font-size:10px}
  .profile-card-actions{gap:7px;margin-top:11px}
  .profile-card-actions .avatar-upload,.username-button{font-size:8px;padding:7px 9px}
  .profile-stat-strip{gap:6px;margin-top:14px}
  .profile-stat-strip .profile-stat{padding:11px 8px}
  .profile-stat-strip .profile-stat label{font-size:6.5px}
  .profile-stat-strip .profile-stat strong{font-size:18px}
  .simple-section .section-title{font-size:15px}
  .achievements{grid-template-columns:repeat(2,1fr);gap:15px 10px}
  .achievement{width:auto}
  .achievement .badge{width:62px;height:62px;font-size:23px}
  .achievement h4{font-size:10px}
  .achievement p{font-size:8px}
  .goal{font-size:10px;padding:10px}
  .goal-add{gap:7px}
  .goal-add input{font-size:10px}

  /* Auth */
  .auth-wrap{padding:15px}
  .auth-card{padding:23px 18px;border-radius:14px}
  .auth-brand img{width:min(250px,92%);max-height:120px}
  .auth-heading h1{font-size:21px}
  .auth-heading p{font-size:10px}
}

@media (max-width:380px){
  .mobile-brand{font-size:13px}
  .mobile-brand .brand-ks-logo{width:38px;height:35px}
  .dashboard-page{padding-left:13px;padding-right:13px}
  .dashboard-stats .stat{padding:12px 10px}
  .dashboard-stats .stat-value{font-size:20px}
  .module-tile{padding:9px 10px}
  .module-tile .progress,.module-tile-foot{width:72%;max-width:72%}
  .profile-stat-strip .profile-stat{padding:10px 6px}
  .profile-stat-strip .profile-stat strong{font-size:17px}
}

/* Note toolbar alignment controls: distinct left and centered glyphs. */
.align-glyph{display:flex;flex-direction:column;gap:3px;width:17px;height:13px;justify-content:center;margin:auto}
.align-glyph i{display:block;height:2px;background:currentColor;border-radius:2px}
.align-left i:nth-child(1){width:15px;margin-right:auto}.align-left i:nth-child(2){width:10px;margin-right:auto}.align-left i:nth-child(3){width:13px;margin-right:auto}
.align-center i:nth-child(1){width:12px;margin:0 auto}.align-center i:nth-child(2){width:17px;margin:0 auto}.align-center i:nth-child(3){width:9px;margin:0 auto}
.note-richtext img{max-width:100%;height:auto}
