/* Estudário web — mesmas cores e fonte do app Android (EstudarioColors / Nunito). */
:root {
  --bg: #FAF9F5; --paper: #FFFFFF; --soft: #F4F3EE; --soft-2: #EEEDE7; --ink: #1B1B18; --muted: #5C5A52;
  --line: #E2E1DB; --line-strong: #C9C6BB;
  --primary: #4F46E5; --on-primary: #FFFFFF; --primary-soft: #E6E3FF; --on-primary-soft: #1B1464;
  --green: #0B7A56; --green-soft: #CFF3E1; --on-green-soft: #00341F;
  --amber: #8A5300; --amber-soft: #FFE3B8; --on-amber-soft: #2B1700;
  --red: #BA1A1A; --red-soft: #FFDAD6; --on-red-soft: #410002;
  --shadow-sm: 0 1px 2px rgba(27, 20, 100, .06), 0 1px 1px rgba(27, 20, 100, .04);
  --shadow: 0 12px 32px rgba(27, 20, 100, .10);
  --radius: 16px; --radius-sm: 10px; --radius-lg: 24px;
  --sidebar: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131311; --paper: #1B1B18; --soft: #1F1F1C; --soft-2: #2A2A26; --ink: #E6E3DC; --muted: #B4B1A6;
    --line: #2E2E2A; --line-strong: #48473F;
    --primary: #C5C0FF; --on-primary: #25206D; --primary-soft: #3B3591; --on-primary-soft: #E4E1FF;
    --green: #7EE0B8; --green-soft: #005138; --on-green-soft: #A6F2D3;
    --amber: #FFB870; --amber-soft: #653D00; --on-amber-soft: #FFDDB3;
    --red: #FFB4AB; --red-soft: #93000A; --on-red-soft: #FFDAD6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 12px 32px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131311; --paper: #1B1B18; --soft: #1F1F1C; --soft-2: #2A2A26; --ink: #E6E3DC; --muted: #B4B1A6;
  --line: #2E2E2A; --line-strong: #48473F;
  --primary: #C5C0FF; --on-primary: #25206D; --primary-soft: #3B3591; --on-primary-soft: #E4E1FF;
  --green: #7EE0B8; --green-soft: #005138; --on-green-soft: #A6F2D3;
  --amber: #FFB870; --amber-soft: #653D00; --on-amber-soft: #FFDDB3;
  --red: #FFB4AB; --red-soft: #93000A; --on-red-soft: #FFDAD6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 400 15px/1.5 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; border-radius: 8px; }

/* ---------- casca ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px; border-right: 1px solid var(--line); background: var(--paper); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 900; font-size: 20px; color: var(--ink); text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 9px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted);
  text-decoration: none; font-weight: 700; border: 0; background: transparent; cursor: pointer; width: 100%; text-align: left; }
.nav-item:hover { background: var(--soft); color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--on-primary-soft); }
.nav-item .ico { width: 22px; height: 22px; flex: none; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 8px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 14px 32px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.topbar .title { font-weight: 800; font-size: 15px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 8px 32px 64px; display: flex; flex-direction: column; gap: 24px; }
.bottomnav { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 12px 16px; }
  .content { padding: 4px 16px 96px; gap: 18px; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: var(--paper);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottomnav .nav-item { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; width: auto; flex: 1; align-items: center; text-align: center; }
  h1 { font-size: 24px; }
}

/* ---------- blocos ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.card.flat { box-shadow: none; }
.card.soft { background: var(--soft); border-color: transparent; box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid.cols-2, .grid.cols-3, .grid.main-side { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 800; }
.hero { background: linear-gradient(135deg, #4F46E5, #7C5CFF); color: #fff; border: 0; border-radius: var(--radius-lg); padding: 26px 28px; box-shadow: var(--shadow); }
.hero .muted { color: rgba(255, 255, 255, .82); }
:root[data-theme="dark"] .hero { background: linear-gradient(135deg, #2E2799, #4B33C2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background: linear-gradient(135deg, #2E2799, #4B33C2); } }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .value { font-size: 28px; font-weight: 900; letter-spacing: -.02em; }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 700; }

/* ---------- botões e chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px;
  border: 1px solid transparent; font-weight: 800; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.tonal { background: var(--primary-soft); color: var(--on-primary-soft); }
.btn.outline { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn.outline:hover, .btn.ghost:hover { background: var(--soft); }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.icon-btn { width: 36px; height: 36px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--soft-2); color: var(--muted); white-space: nowrap; }
.chip.primary { background: var(--primary-soft); color: var(--on-primary-soft); }
.chip.green { background: var(--green-soft); color: var(--on-green-soft); }
.chip.amber { background: var(--amber-soft); color: var(--on-amber-soft); }
.chip.red { background: var(--red-soft); color: var(--on-red-soft); }
.segmented { display: inline-flex; background: var(--soft-2); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; border-radius: 999px; padding: 6px 14px; font-weight: 800; color: var(--muted); cursor: pointer; }
.segmented button.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- progresso ---------- */
.bar { height: 8px; border-radius: 999px; background: var(--soft-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.bar.green > span { background: var(--green); }
.hero .bar { background: rgba(255, 255, 255, .25); }
.hero .bar > span { background: #fff; }

/* ---------- tarefas ---------- */
.task { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.task.done { background: var(--soft); }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-mark { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; font-weight: 900; font-size: 13px; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { color: var(--muted); font-size: 13px; }
.check { width: 28px; height: 28px; border-radius: 999px; border: 2px solid var(--line-strong); background: transparent; cursor: pointer; flex: none; display: inline-flex; align-items: center; justify-content: center; color: transparent; }
.check:hover { border-color: var(--green); }
.check.on { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------- semana ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 180px; }
.day.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.day.off { background: var(--soft); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; }
.day-name { font-weight: 800; font-size: 13px; color: var(--muted); text-transform: capitalize; }
.day-num { font-weight: 900; font-size: 20px; }
.mini-task { border-radius: 10px; padding: 8px 10px; font-size: 12.5px; line-height: 1.3; border-left: 4px solid var(--primary); background: var(--soft); cursor: pointer; }
.mini-task.done { opacity: .55; text-decoration: line-through; }
.mini-task b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
@media (max-width: 1100px) { .week { grid-template-columns: 1fr; } .day { min-height: 0; } }

/* ---------- edital ---------- */
.subject { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.subject-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; border: 0; width: 100%; background: transparent; text-align: left; }
.subject-head:hover { background: var(--soft); }
.subject-body { border-top: 1px solid var(--line); padding: 6px 8px; }
.topic-row { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 10px; cursor: pointer; }
.topic-row:hover { background: var(--soft); }
.topic-row.child { padding-left: 34px; }
.dot { width: 10px; height: 10px; border-radius: 999px; flex: none; background: var(--line-strong); }
.dot.EM_ESTUDO { background: var(--amber); }
.dot.ESTUDADO, .dot.REVISANDO { background: var(--primary); }
.dot.DOMINADO { background: var(--green); }

/* ---------- leitura ---------- */
.reader { max-width: 760px; margin: 0 auto; font-size: 17px; line-height: 1.7; }
.reader h1, .reader h2, .reader h3 { margin: 1.4em 0 .5em; }
.reader p { margin: 0 0 1em; }
.reader ul, .reader ol { margin: 0 0 1em; padding-left: 1.4em; }
.reader blockquote { margin: 0 0 1em; padding: 10px 16px; border-left: 4px solid var(--primary); background: var(--soft); border-radius: 0 10px 10px 0; }
.reader code { background: var(--soft-2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.reader table { border-collapse: collapse; margin: 0 0 1em; width: 100%; font-size: 15px; }
.reader th, .reader td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }

/* ---------- questões ---------- */
.option { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--paper); cursor: pointer; font-size: 15.5px; line-height: 1.5; }
.option:hover { border-color: var(--primary); }
.option .key { width: 30px; height: 30px; border-radius: 999px; background: var(--soft-2); display: flex; align-items: center; justify-content: center; font-weight: 900; flex: none; }
.option.right { border-color: var(--green); background: var(--green-soft); color: var(--on-green-soft); }
.option.right .key { background: var(--green); color: #fff; }
.option.wrong { border-color: var(--red); background: var(--red-soft); color: var(--on-red-soft); }
.option.wrong .key { background: var(--red); color: #fff; }
.option[disabled] { cursor: default; }
.statement { font-size: 17px; line-height: 1.65; white-space: pre-wrap; }

/* ---------- formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 800; font-size: 13px; color: var(--muted); }
.input { height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--paper); padding: 0 14px; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
textarea.input { height: auto; min-height: 90px; padding: 10px 14px; resize: vertical; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: linear-gradient(150deg, #4F46E5, #7C5CFF); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h1 { font-size: 40px; max-width: 520px; }
.auth-art ul { padding: 0; margin: 24px 0 0; list-style: none; display: flex; flex-direction: column; gap: 12px; font-size: 17px; }
.auth-art li::before { content: "✓"; display: inline-block; width: 26px; font-weight: 900; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { padding: 32px 20px; } .auth-art h1 { font-size: 28px; } .auth-art ul { display: none; } }

/* ---------- avisos ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--amber-soft); color: var(--on-amber-soft); font-weight: 700; }
.banner.info { background: var(--primary-soft); color: var(--on-primary-soft); }
.banner.error { background: var(--red-soft); color: var(--on-red-soft); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.save-state { font-size: 13px; color: var(--muted); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.save-state .led { width: 8px; height: 8px; border-radius: 999px; background: var(--green); }
.save-state.pending .led { background: var(--amber); }
.save-state.offline .led { background: var(--red); }
.avatar { width: 34px; height: 34px; border-radius: 999px; background: var(--primary-soft); color: var(--on-primary-soft); display: inline-flex; align-items: center; justify-content: center; font-weight: 900; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--paper); border-radius: var(--radius-lg); padding: 24px; width: 100%; max-width: 460px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.spinner { width: 28px; height: 28px; border-radius: 999px; border: 3px solid var(--soft-2); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; color: var(--muted); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--paper); padding: 8px 12px; border-radius: 8px; }
.ms { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 22px; line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; font-variation-settings: "FILL" 0, "wght" 500; user-select: none; }
.ms.fill { font-variation-settings: "FILL" 1, "wght" 500; }
.nav-item.active .ms { font-variation-settings: "FILL" 1, "wght" 600; }
.grid > * { min-width: 0; }
.week-dots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week-dots .wd { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week-dots .circle { width: 100%; max-width: 32px; aspect-ratio: 1; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.week-dots .circle .ms { font-size: 18px; }
@media (min-width: 901px) and (max-width: 1180px) { .grid.main-side { grid-template-columns: 1fr; } }
.banner { flex-wrap: wrap; }
@media (max-width: 900px) { .banner { font-size: 13.5px; padding: 10px 12px; } .stat .value { font-size: 22px; } }
