/* app-moshawer — student view styles. Brand: teal #0c5a61, orange #c26d12, cream.
   Class names follow docs/f8ak-spec.md §2.5 so the port stays recognizable. */
:root {
  --surface-2: #ece6d8;
  --brand-deep: #083f44;
  --brand-soft: #dcebe7;
  --good-soft: #dff0e4;
  --bad-soft: #f8e3e0;
  --warn: #9a6206;
  --warn-soft: #f6ecd4;
  --shadow: 0 10px 30px rgba(29, 38, 34, .08);
}
#view .field label { display: block; font-weight: 700; font-size: 13.5px; margin: 0 0 5px; color: var(--muted); }

/* ---------- intro header ---------- */
.intro {
  background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 100%); color: #fff;
  border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}
.intro .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.intro .brand-mark {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: rgba(255, 255, 255, .16); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; line-height: 1;
}
.intro .brand-title { font-size: 20px; margin: 0; line-height: 1.4; }
.intro .brand-title .hl { color: #eda93f; }
.brand-ig { color: #bfe3de; font-size: 13.5px; text-decoration: none; direction: ltr; display: inline-block; }
.brand-ig:hover { text-decoration: underline; }
.intro p { color: #dcebe7; margin: 0 0 14px; }
.intro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.intro-grid .field label { color: #9fc6c0; }
.who-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.who-name, .who-track { font-weight: 800; font-size: 16px; }
#view > footer {
  text-align: center; color: var(--muted); font-size: 13.5px;
  padding: 18px 8px 8px;
}

/* ---------- tabs: segmented control, equal widths, full labels ---------- */
.tabs {
  display: flex; gap: 4px; margin-bottom: 16px; padding: 4px;
  background: var(--surface-2); border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 3px rgba(12, 90, 97, .06);
}
.tab-btn {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: 56px; padding: 6px 2px; border-radius: 12px;
  border: 0; background: transparent;
  color: var(--muted); font-weight: 700; font-size: 12px; line-height: 1.4; white-space: nowrap;
}
.tab-btn .tab-ic { color: var(--muted); display: inline-flex; }
.tab-btn .tab-ic svg { width: 20px; height: 20px; }
.tab-btn.active, .tab-btn[aria-selected="true"] {
  background: var(--card); color: var(--brand);
  box-shadow: var(--shadow-sm);
}
.tab-btn.active .tab-ic, .tab-btn[aria-selected="true"] .tab-ic { color: var(--brand); }

/* ---------- section heads ---------- */
.section-head { margin: 4px 0 12px; }
.section-head h2 { font-size: 18px; color: var(--brand); margin: 0; }
.section-head span { color: var(--muted); font-size: 13.5px; }
.section-head .rule { height: 1px; background: var(--line); margin-top: 8px; }

/* ---------- plan ---------- */
.plan-profile-note {
  background: var(--brand-soft); border: 1px solid #bcd8d2;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px;
}
.note-link { background: none; border: 0; color: var(--brand); font-weight: 800; padding: 0; text-decoration: underline; }
.week-summary { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.week-summary .row1 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.week-summary .row1 b { font-size: 16px; }
.week-summary .row1 .muted { flex: 1; min-width: 200px; }
.week-summary .pct { font-size: 22px; font-weight: 800; color: var(--brand); }
.week-bar { display: flex; height: 12px; background: #eee5d2; border-radius: 6px; overflow: hidden; margin: 10px 0; }
.week-bar i { display: block; height: 100%; }
.seg-done { background: var(--green); }
.seg-part { background: var(--accent); }
.seg-missed { background: var(--red); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13.5px; }
.alloc-box { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.alloc-title { font-weight: 800; color: var(--brand); margin-bottom: 4px; }
.alloc-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 10px; }
.alloc-list { display: grid; gap: 8px; }
.alloc-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.a-name { font-weight: 700; min-width: 110px; }
.a-coef { color: var(--muted); }
.a-bar { flex: 1; min-width: 80px; height: 8px; background: #eee5d2; border-radius: 5px; overflow: hidden; }
.a-bar i { display: block; height: 100%; background: var(--brand); }
.a-wagon { font-weight: 700; white-space: nowrap; }
.a-boost { color: var(--accent); font-weight: 700; }
.day-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.day-card.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.day-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.day-head h3 { font-size: 16px; color: var(--brand); margin: 0; }
.today-badge { background: var(--brand); color: #fff; border-radius: 20px; padding: 1px 10px; font-size: 12px; font-weight: 700; }
.day-sum { color: var(--muted); font-size: 13.5px; }
.task { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.task:first-of-type { border-top: 0; }
.task-info b { font-size: 15px; }
.task-topic { color: var(--ink); }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.mini-chip {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12.5px; font-weight: 700;
  background: var(--surface-2); color: var(--ink); line-height: 1.9;
}
.mini-chip.time { background: var(--brand-soft); color: var(--brand); }
.mini-chip.coef { background: var(--accent-soft); color: var(--accent); }
.mini-chip.wagon { background: #e9e2cf; color: var(--muted); }
.mini-chip.peak { background: var(--accent); color: #fff; }
.mini-chip.hard { background: var(--bad-soft); color: var(--bad); }
.mini-chip.review { background: var(--warn-soft); color: var(--warn); }
.status-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.st-btn {
  flex: 1; min-width: 90px; min-height: 44px; padding: 8px 6px; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: 13.5px; color: var(--ink);
}
.st-btn.s3.on { background: var(--green); border-color: var(--green); color: #fff; }
.st-btn.s2.on { background: var(--warn); border-color: var(--warn); color: #fff; }
.st-btn.s1.on { background: var(--red); border-color: var(--red); color: #fff; }
.task-test { margin: 10px 0 6px; background: var(--surface-2); border-radius: 10px; padding: 12px; }
.tt-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.tt-title { font-weight: 800; }
.tt-count { font-size: 13.5px; color: var(--muted); }
.tt-start { margin-bottom: 8px; }
.tt-btns { display: flex; gap: 8px; }
.tt-btn { flex: 1; min-height: 44px; padding: 7px 6px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: 13.5px; }
.tt-btn.done.on { background: var(--green); border-color: var(--green); color: #fff; }
.tt-btn.not.on { background: var(--red); border-color: var(--red); color: #fff; }
.tt-result { margin-top: 8px; font-size: 13.5px; font-weight: 700; color: var(--brand); }

/* ---------- test catalog / sales ---------- */
.test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 14px; }
.test-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); }
.test-card h3 { font-size: 16px; color: var(--brand); margin: 8px 0 4px; }
.test-card .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.test-card .ic svg { width: 22px; height: 22px; }
.test-card .meta { color: var(--muted); font-size: 13.5px; margin-bottom: 6px; }
.test-card p { color: var(--ink); font-size: 14px; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent); line-height: 1.9; }
.tag.spec { background: var(--brand-soft); color: var(--brand); }
.grand {
  border: 2px dashed var(--accent); border-radius: var(--radius-lg);
  background: var(--card); padding: 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.grand.exam { margin-top: 14px; border-style: solid; border-color: var(--brand); }
.grand.exam h3 { color: var(--brand); }
.grand.exam.monthly { border-color: var(--accent); }
.grand.exam.monthly h3 { color: var(--accent); }
.grand .grow { flex: 1; min-width: 220px; }
.grand h3 { color: var(--accent); margin: 0 0 4px; }
.grand p { margin: 0; }
.exam-booklet { font-size: 13.5px; margin-top: 4px; }
.exam-notice { color: var(--accent); font-size: 13px; margin-top: 8px !important; font-weight: 700; }
/* Subject → chapter → lesson test tree */
.tree-subject { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.tree-subject summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--brand); }
.tree-chapters { padding-top: 6px; }
.tree-chapter { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; margin-top: 6px; }
.tree-chapter summary { cursor: pointer; font-size: 13.5px; }
.tree-chapter .btn { margin-top: 8px; }
.tree-lessons { margin-top: 6px; display: grid; gap: 6px; }
.tree-lesson { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; background: var(--bg); border-radius: var(--radius); padding: 6px 10px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.tag.warn { background: #fdeeda; color: #9a6700; }
.qbooklet {
  font-size: 13px; font-weight: 800; color: var(--brand);
  background: var(--brand-soft); border-radius: 20px; padding: 2px 10px;
}
.sales-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sales-card .price { font-size: 24px; font-weight: 800; color: var(--brand); margin: 6px 0 10px; }
.sales-card .price small { font-size: 13px; color: var(--muted); font-weight: 400; }
.sales-feats { list-style: none; margin: 0 0 12px; padding: 0; }
.sales-feats li { padding-right: 22px; position: relative; font-size: 14px; }
.sales-feats li::before { content: "✓"; position: absolute; right: 0; color: var(--green); font-weight: 800; }
.send-note { color: var(--muted); font-size: 13.5px; }
.send-note.ok { color: var(--green); }
.send-note.fail { color: var(--red); }

/* ---------- reports ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.panel h3 { color: var(--brand); }
.rep-day { border-top: 1px solid var(--line); padding: 10px 0; }
.rep-day:first-child { border-top: 0; }
.dname { font-weight: 800; margin-bottom: 6px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip-row .chip.done { background: var(--green-soft); color: var(--green); }
.chip-row .chip.part { background: var(--orange-soft); color: var(--accent); }
.chip-row .chip.missed { background: var(--red-soft); color: var(--red); }
.rep-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.copy-note { color: var(--green); font-size: 13.5px; font-weight: 700; }
.empty-note { color: var(--muted); }
.test-rep { border-top: 1px solid var(--line); padding: 10px 0; }
.test-rep:first-of-type { border-top: 0; }
.tr-head { display: flex; justify-content: space-between; gap: 10px; font-weight: 800; }
.tr-pct { color: var(--brand); }
.tr-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---------- counsel ---------- */
.counsel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.counsel-grid .sub { color: var(--muted); font-size: 13.5px; }
.calc-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.calc-row label { font-size: 13.5px; font-weight: 700; display: block; }
.calc-row input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; outline: none; margin-top: 4px;
}
.calc-row input:focus { border-color: var(--brand); }
.calc-out { background: var(--surface-2); border-radius: 10px; padding: 12px; margin-top: 12px; font-size: 14.5px; }
.tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.tips li { display: grid; grid-template-columns: 28px 1fr; gap: 4px 8px; }
.tips .n {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
  grid-row: span 2;
}
.tips b { display: block; }
.tips span:last-child { color: var(--muted); font-size: 13.5px; }

/* ---------- profile ---------- */
.prof-row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 9px 0; }
.prof-row:last-child { border-bottom: 0; }
.prof-row .k { color: var(--muted); font-weight: 700; flex: none; }
.prof-row .v { font-weight: 700; text-align: left; }

/* ---------- questionnaire ---------- */
.prof-card { max-width: 640px; margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.prof-card h2 { color: var(--brand); font-size: 22px; font-weight: 900; margin: 0 0 8px; }
.prof-steps { display: flex; gap: 6px; margin: 14px 0; }
.prof-steps i { flex: 1; height: 6px; border-radius: 4px; background: var(--surface-2); display: block; }
.prof-steps i.on { background: var(--brand); }
.prof-q { font-weight: 800; font-size: 16.5px; margin: 0 0 4px; }
.prof-qsub { color: var(--muted); font-size: 13.5px; }
.prof-opts { display: grid; gap: 10px; margin: 12px 0; }
.prof-opt {
  text-align: right; padding: 12px 14px; min-height: 48px; border-radius: 12px;
  border: 1.5px solid var(--line); background: #fff; font-size: 15px; font-weight: 700; color: var(--ink);
}
.prof-opt[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.prof-opt small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 2px; }
.prof-nav { display: flex; justify-content: space-between; gap: 10px; }
.prof-nav .btn { flex: 1; }

/* ---------- quiz ---------- */
.quiz-top {
  position: sticky; top: 10px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px;
}
.tname { font-weight: 800; color: var(--brand); }
.timer { font-weight: 800; font-size: 18px; }
.timer.low { color: var(--red); }
.progress { height: 10px; background: #eee5d2; border-radius: 6px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); transition: width .2s; }
.progress-txt { color: var(--muted); font-size: 13px; margin: 6px 0 12px; }
.qcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); }
.qnum { font-weight: 800; color: var(--brand); }
.qsrc { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.qtext { font-size: 16px; font-weight: 700; margin: 10px 0 14px; }
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 10px; text-align: right;
  padding: 11px 12px; min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; font-size: 15px; color: var(--ink);
}
.opt .letter {
  flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.opt .mark { margin-inline-start: auto; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.opt.correct { border-color: var(--green); background: var(--green-soft); }
.opt.correct .mark { color: var(--green); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt.wrong .mark { color: var(--red); }
.opt:disabled { cursor: default; }
.feedback { border-radius: 10px; padding: 12px; margin-top: 14px; font-size: 14px; }
.feedback.ok { background: var(--green-soft); color: var(--green); }
.feedback.no { background: var(--red-soft); color: var(--red); }
.fb-title { font-weight: 800; display: block; margin-bottom: 4px; }
.fb-ref { margin-top: 6px; font-size: 13px; opacity: .9; }
.quiz-nav { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.quiz-nav .spacer { flex: 1; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.pal {
  width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--card); font-weight: 700; color: var(--ink);
}
.pal.ok { background: var(--green); border-color: var(--green); color: #fff; }
.pal.no { background: var(--red); border-color: var(--red); color: #fff; }
.pal.current { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 10px; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }
.sw.good { background: var(--green); }
.sw.bad { background: var(--red); }
.sw.plain { background: var(--card); border: 1px solid var(--line); }

/* ---------- result ---------- */
.result-hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 16px; text-align: center; }
.ring-wrap { position: relative; width: 168px; height: 168px; margin: 0 auto 10px; }
.ring-wrap svg { display: block; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center .pct { font-size: 30px; font-weight: 800; color: var(--brand); }
.ring-center .lbl { font-size: 12.5px; color: var(--muted); }
.result-hero h2 { color: var(--brand); }
.result-hero .who { color: var(--muted); font-size: 13.5px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 12px 6px; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.ok b { color: var(--green); }
.stat.no b { color: var(--red); }
.stat.skip b { color: var(--warn); }
.advice { background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; text-align: right; font-size: 14.5px; margin-bottom: 10px; }
.saved-note { color: var(--muted); font-size: 13.5px; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
#review-list { margin-top: 14px; text-align: right; }
#review-list h2 { color: var(--brand); font-size: 17px; }
.review-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.rq { font-weight: 800; margin-bottom: 10px; }
.badge { display: inline-block; padding: 1px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 700; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.no { background: var(--red-soft); color: var(--red); }
.badge.skip { background: var(--warn-soft); color: var(--warn); }
.ropt { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 6px; font-size: 14.5px; }
.ropt .letter { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.ropt .mark { margin-inline-start: auto; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.ropt.correct { border-color: var(--green); background: var(--green-soft); }
.ropt.correct .mark { color: var(--green); }
.ropt.wrong { border-color: var(--red); background: var(--red-soft); }
.ropt.wrong .mark { color: var(--red); }
.explain { color: var(--muted); font-size: 13.5px; margin-top: 8px; }

/* ---------- finish modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 18, 20, .55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal-back[hidden] { display: none; }
.modal { background: var(--card); border-radius: var(--radius); padding: 20px; max-width: 420px; width: 100%; }
.modal h3 { color: var(--brand); }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .counsel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .intro-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .intro { padding: 16px; }
  .intro .brand-title { font-size: 19px; }
  .calc-row { grid-template-columns: 1fr; }
  .quiz-nav { flex-wrap: wrap; }
  .quiz-nav .btn { flex: 1; }
}

/* ---------- AI chat: floating bubble + panel (2026-11-27) ---------- */
.ai-fab {
  position: fixed; left: 16px; bottom: 16px; z-index: 50;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--brand); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(8, 63, 68, .35);
}
.ai-fab svg { width: 26px; height: 26px; }
.ai-fab:hover { background: var(--brand-deep); }
.ai-panel {
  position: fixed; left: 16px; bottom: 84px; z-index: 50;
  width: min(380px, calc(100vw - 32px));
  max-height: min(72vh, 640px);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(29, 38, 34, .18);
  display: flex; flex-direction: column; overflow: hidden;
}
.ai-panel[hidden] { display: none; }
.ai-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; background: var(--brand); color: #fff; flex: none;
}
.ai-panel-head h2 { font-size: 16px; margin: 0; color: #fff; }
.ai-panel-close {
  background: rgba(255, 255, 255, .16); border: 0; color: #fff;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.ai-panel-body { padding: 14px; overflow-y: auto; }
.ai-panel-body .ai-log { max-height: 38vh; }
.ai-note { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.ai-log { display: flex; flex-direction: column; gap: 10px; max-height: 52vh; overflow-y: auto; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 12px; }
.ai-empty { color: var(--muted); font-size: 14.5px; margin: 0; }
.ai-msg { max-width: 85%; padding: 10px 12px; border-radius: 12px; font-size: 15px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.ai-msg.user { align-self: flex-start; background: var(--brand-soft); border: 1px solid var(--brand); }
.ai-msg.bot { align-self: flex-end; background: var(--surface-2); border: 1px solid var(--line); }
.ai-groups { display: flex; flex-direction: column; gap: 14px; }
.ai-group-title { font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-chip { padding: 9px 14px; border: 1px solid var(--brand); background: var(--brand-soft); color: inherit; border-radius: 999px; font: inherit; font-size: 14px; line-height: 1.6; cursor: pointer; }
.ai-chip:hover:not(:disabled) { background: var(--brand); color: #fff; }
.ai-chip:disabled { opacity: .5; cursor: default; }

/* ---------- AI chat: free-text input + typing indicator ---------- */
.ai-input-row { display: flex; gap: 8px; margin-top: 12px; }
.ai-input {
  flex: 1; min-width: 0; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 15px; background: var(--card); color: inherit;
}
.ai-input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.ai-input:disabled { opacity: .5; }
.ai-send {
  flex: none; padding: 10px 16px; border: 0; border-radius: 12px;
  background: var(--brand); color: #fff; font: inherit; font-size: 15px; cursor: pointer;
}
.ai-send:hover:not(:disabled) { background: var(--brand-deep); }
.ai-send:disabled { opacity: .5; cursor: default; }
.ai-typing {
  align-self: flex-end; display: flex; align-items: center; gap: 10px;
  max-width: 85%; padding: 12px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 17px; font-weight: 700; line-height: 1.6;
}
.ai-dots { display: inline-flex; gap: 5px; align-items: center; }
.ai-dots i {
  width: 9px; height: 9px; border-radius: 50%; background: var(--brand);
  animation: ai-bounce 1.2s infinite;
}
.ai-dots i:nth-child(2) { animation-delay: .2s; }
.ai-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes ai-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ---------- redesign 2026-11-27 (style #4: mobile Learning Roadmap) ---------- */
/* mode switch: کنکور / امتحان نهایی — equal-height cards, text-dominant, colored icon chips */
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; align-items: stretch; }
.mode-btn {
  display: flex; align-items: center; gap: 12px; text-align: right;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 12px 14px; min-height: 76px; color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.mode-btn:hover { box-shadow: var(--shadow-md); }
.mode-btn.active {
  background: linear-gradient(135deg, var(--brand) 0%, #12808a 100%);
  border-color: var(--brand); color: #fff; box-shadow: var(--shadow-md);
}
.mode-ic {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
}
.mode-finals .mode-ic { background: var(--accent-soft); color: var(--accent); }
.mode-btn.active .mode-ic { background: rgba(255, 255, 255, .18); color: #fff; }
.mode-ic svg { width: 22px; height: 22px; }
.mode-txt { min-width: 0; }
.mode-txt b { display: block; font-size: 15px; line-height: 1.5; }
.mode-txt small { display: block; font-size: 12px; opacity: .75; line-height: 1.6; }

/* (tabs are styled as a segmented control in the ---------- tabs ---------- section above) */

/* goal hero */
.goal-hero {
  background: linear-gradient(135deg, #0c5a61 0%, #12808a 60%, #1a9a8c 100%);
  color: #fff; border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}
.goal-hero-top { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.goal-kicker { font-size: 12.5px; color: #bfe3de; font-weight: 700; }
.goal-hero h2 { font-size: 20px; margin: 2px 0 4px; color: #fff; }
.goal-hero p { color: #dcebe7; font-size: 13.5px; margin: 0; }
.goal-count { flex: none; text-align: center; background: rgba(255, 255, 255, .14); border-radius: 12px; padding: 8px 12px; }
.goal-days { display: block; font-size: 28px; font-weight: 800; line-height: 1.1; }
.goal-days-lbl { font-size: 12px; color: #dcebe7; }
.goal-prog { margin-top: 12px; }
.goal-prog-row { display: flex; justify-content: space-between; font-size: 13px; }
.goal-prog-row b { font-size: 16px; }
.goal-bar { background: rgba(255, 255, 255, .25); margin-top: 6px; }
.goal-bar > i { background: #eda93f; }
.goal-continue { margin-top: 12px; width: 100%; }

/* level cards */
.level-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; align-items: stretch; }
.level-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 12px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: var(--shadow-sm);
}
.level-ic { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.level-ic svg { width: 20px; height: 20px; }
.lv-0 .level-ic { background: #dff0e4; color: #1e7d46; }
.lv-1 .level-ic { background: #dceeed; color: #0e7490; }
.lv-2 .level-ic { background: #f6e3cd; color: #c26d12; }
.level-card b { font-size: 14px; }
.level-grade { font-size: 12px; color: var(--muted); }
.level-count { font-size: 12px; font-weight: 700; color: var(--brand); }

/* roadmap spine */
.roadmap { display: grid; gap: 8px; }
.rm-node-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: right;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; min-height: 56px; color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.rm-node-btn:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.rm-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #cfc8b4; }
.rm-node.done .rm-dot { background: var(--green); }
.rm-node.part .rm-dot { background: var(--accent); }
.rm-node-txt { flex: 1; min-width: 0; }
.rm-node-txt b { display: block; font-size: 14.5px; line-height: 1.5; }
.rm-node-txt small { display: block; color: var(--muted); font-size: 12px; line-height: 1.6; }
.rm-pct { font-weight: 800; color: var(--brand); font-size: 14px; white-space: nowrap; }
.rm-chev { display: inline-flex; color: var(--muted); flex: none; }
.rm-chev svg { width: 18px; height: 18px; transition: transform .2s; }
.rm-chev.open svg { transform: rotate(180deg); }
.rm-children { margin: 6px 12px 2px 0; padding-right: 12px; border-right: 2px solid var(--line); display: grid; gap: 8px; }
.rm-wagon-ic { flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--brand-soft); display: flex; align-items: center; justify-content: center; }
.rm-wagon-ic svg { width: 20px; height: 20px; }
.wagon-tasks { gap: 0; }
.wagon-tasks .task { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.wagon-tasks .task:first-of-type { border-top: 1px solid var(--line); }
.mini-chip.day { background: #e8e2f2; color: #5b4a8a; }

/* ---------- right-side drawer ---------- */
.drawer-overlay { position: fixed; inset: 0; background: rgba(10, 18, 20, .45); z-index: 55; }
.drawer-overlay[hidden] { display: none; }
.side-drawer {
  position: fixed; top: 0; right: 0; z-index: 60; height: 100vh; height: 100dvh;
  width: min(340px, 88vw); background: var(--cream);
  border-radius: 18px 0 0 18px;
  box-shadow: -12px 0 32px rgba(10, 18, 20, .22);
  transform: translateX(105%); transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.side-drawer.open { transform: translateX(0); }
.side-drawer[hidden] { display: none; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--brand); color: #fff; flex: none;
}
.drawer-head h2 { margin: 0; font-size: 17px; color: #fff; }
.drawer-close {
  background: rgba(255, 255, 255, .16); border: 0; color: #fff;
  width: 32px; height: 32px; border-radius: 50%; font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.drawer-body { overflow-y: auto; padding: 14px; display: grid; gap: 12px; align-content: start; }
.drawer-profile {
  display: flex; align-items: center; gap: 12px; text-align: right; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 12px 14px; min-height: 64px; color: var(--ink); box-shadow: var(--shadow-sm);
}
.drawer-avatar {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 22px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.drawer-profile-txt { flex: 1; min-width: 0; }
.drawer-profile-txt b { display: block; font-size: 15.5px; }
.drawer-profile-txt small { display: block; color: var(--muted); font-size: 12.5px; }
.drawer-nav { display: grid; gap: 8px; }
.drawer-nav-item, .drawer-item, .drawer-sound {
  display: flex; align-items: center; gap: 12px; text-align: right; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; min-height: 56px; color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.drawer-nav-item.active { border-color: var(--brand); background: var(--brand-soft); }
.dn-ic { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.drawer-nav-item.active .dn-ic { background: var(--brand); color: #fff; }
.dn-ic svg { width: 20px; height: 20px; }
.dn-txt { flex: 1; min-width: 0; }
.dn-txt b { display: block; font-size: 14.5px; }
.dn-txt small { display: block; color: var(--muted); font-size: 12px; }
.drawer-note { background: #dceeed; color: var(--brand); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin: 0; }
.drawer-section h3 { font-size: 15.5px; color: var(--brand); margin: 4px 0 10px; }
.sales-grid { display: grid; gap: 12px; }
.drawer-contact .contact-call {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  background: var(--brand-soft); border: 1px solid #bcd8d2; border-radius: 12px;
  padding: 12px 14px; min-height: 56px; color: var(--ink);
}
.contact-call b { font-size: 17px; }
.drawer-sound { background: var(--card); }

/* ---------- finals tab ---------- */
.finals-sub { font-size: 16px; color: var(--brand); margin: 18px 0 10px; }
.finals-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.finals-card-head h3 { margin: 0; }
.finals-ready-row { display: flex; justify-content: space-between; font-size: 13.5px; }
.finals-ready-row b { color: var(--brand); font-size: 15px; }
.finals-ready .bar { margin: 6px 0; }
.finals-chapters { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.finals-lessons { margin-top: 8px; }
.finals-lesson-list { margin: 8px 0 0; padding-right: 18px; font-size: 14px; }
.finals-lesson-list > li { margin-bottom: 8px; }
.finals-lesson-list ul { padding-right: 16px; margin: 4px 0 0; color: var(--muted); }
.desc-q { border-top: 1px solid var(--line); padding: 10px 0; }
.desc-q:first-of-type { border-top: 0; }
.desc-q p { font-weight: 700; margin: 0 0 4px; }

/* ---------- polish: transitions ---------- */
.btn, .tab-btn, .st-btn, .tt-btn, .prof-opt, .opt, .pal { transition: background .15s, border-color .15s, opacity .15s; }
.btn:active { transform: scale(.985); }
