/* =========================================================
   Leprechauns — estilos
   Tema único escuro: verde-floresta + dourado.
   ========================================================= */
:root {
  --bg: #0a1310;
  --bg-2: #0d1813;
  --surface: #111e18;
  --surface-2: #16271f;
  --surface-3: #1b3027;
  --border: #1f352a;
  --border-2: #2b4639;
  --text: #e9f0eb;
  --muted: #93a89c;
  --faint: #62786c;

  --green: #3fae7a;
  --green-2: #2b8a5d;
  --green-soft: rgba(63, 174, 122, .14);
  --gold: #d9b04f;
  --gold-soft: rgba(217, 176, 79, .15);
  --red: #e2735f;
  --red-soft: rgba(226, 115, 95, .14);
  --orange: #e09a4a;
  --orange-soft: rgba(224, 154, 74, .14);

  /* níveis de domínio 0–4 */
  --m0: #4b5d54;
  --m1: #d9664f;
  --m2: #e09a4a;
  --m3: #5cbf8a;
  --m4: #d9b04f;

  --radius: 14px;
  --radius-sm: 10px;
  --side: 236px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.sidebar { display: none; }
.main {
  padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
  max-width: 1180px;
  margin: 0 auto;
  outline: none;
}

.bottom-nav {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(13, 24, 19, .94);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--faint); font-size: 11px; font-weight: 500; padding: 6px 0; text-decoration: none;
}
.bottom-nav a.active { color: var(--text); }
.bottom-nav a.active svg { stroke: var(--green); }
.bottom-nav a.plus span.bubble {
  width: 46px; height: 46px; border-radius: 50%; margin-top: -18px;
  display: grid; place-items: center;
  background: var(--green); color: #06110c;
  box-shadow: 0 6px 18px rgba(63, 174, 122, .35);
}
.bottom-nav a.plus svg { stroke: #06110c; width: 22px; height: 22px; stroke-width: 2.4; }

body.onboarding .bottom-nav, body.onboarding .sidebar { display: none !important; }
body.onboarding .main { padding-left: 16px; }

@media (min-width: 900px) {
  .bottom-nav { display: none; }
  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; inset: 0 auto 0 0; width: var(--side);
    background: var(--bg-2); border-right: 1px solid var(--border);
    padding: 22px 14px;
  }
  .main { margin-left: var(--side); padding: 32px 36px 48px; max-width: calc(1180px + var(--side)); }
  body.onboarding .main { margin-left: 0; }
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: -.01em;
  padding: 0 8px 22px; text-decoration: none !important;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--muted); font-weight: 500; text-decoration: none;
}
.side-nav a:hover { background: var(--surface); color: var(--text); }
.side-nav a.active { background: var(--surface-2); color: var(--text); }
.side-nav a.active svg { stroke: var(--green); }
.side-nav .count {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: var(--orange-soft); color: var(--orange);
  padding: 1px 7px; border-radius: 99px;
}
.side-foot { margin-top: auto; padding: 12px 10px 0; font-size: 12px; color: var(--faint); border-top: 1px solid var(--border); }
.side-foot strong { color: var(--muted); font-weight: 600; }

/* ---------- Cabeçalho de página ---------- */
.page-h {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-h h1 { font-size: 24px; font-weight: 700; }
.page-h p { color: var(--muted); margin-top: 4px; }
@media (min-width: 900px) { .page-h h1 { font-size: 28px; } }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text);
  font: 600 14px/1 var(--font); cursor: pointer; text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--green); border-color: var(--green); color: #06110c; }
.btn.primary:hover { background: #4cbd88; }
.btn.primary svg { stroke: #06110c; stroke-width: 2.2; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--red); border-color: rgba(226, 115, 95, .35); background: transparent; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; height: 46px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center;
  border-radius: 8px; border: 0; background: transparent; color: var(--faint); cursor: pointer;
}
.icon-btn:hover { background: var(--red-soft); color: var(--red); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- Cards e grids ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  min-width: 0;
}
.card h2 { font-size: 15px; font-weight: 650; }
.card .sub { color: var(--faint); font-size: 13px; margin-top: 2px; }
.card > h2 + *:not(.sub), .card > .sub + * { margin-top: 16px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
.stack { display: grid; gap: 14px; }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.grid-reg { display: grid; gap: 14px; }
@media (min-width: 1000px) { .grid-reg { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; } }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-width: 0; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--faint); }
.stat.warn .v { color: var(--orange); }
.stat .up { color: var(--green); font-weight: 600; }
.stat .down { color: var(--red); font-weight: 600; }
@media (min-width: 900px) { .stat { padding: 18px; } .stat .v { font-size: 30px; } }

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--gold-soft); border: 1px solid rgba(217, 176, 79, .3);
  color: var(--text); font-size: 14px; margin-bottom: 14px;
}
.banner p { flex: 1 1 220px; }

.hero-empty {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  margin-bottom: 14px;
}
.hero-empty img { width: 52px; height: 52px; }
.hero-empty div { flex: 1 1 240px; }
.hero-empty h2 { font-size: 17px; margin-bottom: 4px; }
.hero-empty p { color: var(--muted); }

.empty { color: var(--faint); font-size: 14px; padding: 6px 0; }
.empty a { font-weight: 600; }

/* ---------- Gráficos ---------- */
.vbars { display: flex; align-items: flex-end; gap: 6px; height: 170px; }
.vbar { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; }
.vbar .b { width: 100%; max-width: 38px; border-radius: 6px 6px 3px 3px; background: var(--surface-3); transition: height .4s ease; }
.vbar.cur .b { background: var(--green); }
.vbar .v { font-size: 11px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.vbar .l { font-size: 10.5px; color: var(--faint); margin-top: 6px; white-space: nowrap; }
@media (max-width: 520px) { .vbar:not(.cur) .v { visibility: hidden; } .vbar:nth-child(odd):not(.cur) .l { visibility: hidden; } }

.hbars { display: grid; gap: 11px; }
.hbar { display: grid; grid-template-columns: minmax(84px, 120px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar .n { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; }
.hbar .val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }
.hbar.dual .track { height: 7px; }
.hbar.dual .tracks { display: grid; gap: 4px; }

.dist { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.dist span { height: 100%; }
.legend { display: grid; gap: 8px; margin-top: 14px; }
.legend div { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.legend b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Listas ---------- */
.list { display: grid; }
.list .row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--border);
  min-width: 0;
}
.list .row:first-child { border-top: 0; padding-top: 0; }
.row .main-t { flex: 1; min-width: 0; }
.row .main-t strong { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .main-t span { display: block; font-size: 12.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .side-t { text-align: right; font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .side-t b { display: block; color: var(--text); font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.datebox {
  flex: none; width: 46px; text-align: center; border-radius: 10px;
  background: var(--surface-2); padding: 5px 0; line-height: 1.1;
}
.datebox b { display: block; font-size: 17px; }
.datebox span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Tags, badges ---------- */
.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
  border-radius: 6px; font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.tag.g-escola { background: rgba(91, 155, 213, .15); color: #8fbbe6; }
.tag.g-seriado { background: var(--gold-soft); color: var(--gold); }
.tag.g-enem { background: var(--green-soft); color: #74cfa1; }
.tag.t-prova { background: rgba(91, 155, 213, .15); color: #8fbbe6; }
.tag.t-simulado { background: rgba(199, 125, 186, .16); color: #d9a3cf; }
.tag.t-seriado { background: var(--gold-soft); color: var(--gold); }
.tag.t-enem { background: var(--green-soft); color: #74cfa1; }
.tag.t-revisao { background: var(--orange-soft); color: var(--orange); }

.mb {
  flex: none; width: 24px; height: 24px; border-radius: 7px;
  display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #06110c;
}
.m0 { background: var(--m0); color: var(--text); }
.m1 { background: var(--m1); }
.m2 { background: var(--m2); }
.m3 { background: var(--m3); }
.m4 { background: var(--m4); }

.status { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.s-nao { color: var(--faint); }
.s-andamento { color: var(--orange); }
.s-estudado { color: var(--m3); }
.s-concluido { color: var(--gold); }
.s-revisar { color: var(--red); }

/* ---------- Formulários ---------- */
.form { display: grid; gap: 14px; }
.form h2 { margin-bottom: 2px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
label .opt { color: var(--faint); font-weight: 400; }
input, select, textarea {
  width: 100%; font: 400 15px/1.4 var(--font); color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 10px;
  padding: 10px 12px; min-height: 44px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 64px; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2393a89c' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="date"] { color-scheme: dark; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--green); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .row3 { grid-template-columns: repeat(3, 1fr); } }
.hint { font-size: 12.5px; color: var(--faint); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-size: 13px; font-weight: 500; color: var(--muted); padding: 0; margin-bottom: 8px; }

.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: inline-flex; align-items: center; gap: 7px; grid-auto-flow: column;
  padding: 7px 11px; border-radius: 9px; border: 1px solid var(--border-2);
  background: var(--bg-2); color: var(--text); font-size: 13.5px; cursor: pointer;
}
.check:has(input:checked) { border-color: var(--green); background: var(--green-soft); }

.mpick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mpick label {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 9px 2px 8px; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--bg-2); cursor: pointer; font-size: 11px; color: var(--muted); line-height: 1.15;
}
.mpick input { position: absolute; opacity: 0; pointer-events: none; }
.mpick label:has(input:checked) { border-color: var(--text); background: var(--surface-3); color: var(--text); }
.mpick label:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--green-soft); }
.mdesc { font-size: 12.5px; color: var(--faint); margin-top: 8px; min-height: 18px; }

.timer {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
}
.timer label { flex: 1 1 140px; }
.timer .clock {
  font: 600 15px var(--font); font-variant-numeric: tabular-nums; color: var(--gold);
  height: 44px; display: inline-flex; align-items: center;
}
.timer .btn { height: 44px; }
.timer .btn.on { border-color: var(--gold); color: var(--gold); }

/* ---------- Filtros ---------- */
.filters { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.filters .search { grid-column: 1 / -1; }
@media (min-width: 900px) { .filters { grid-template-columns: 1.4fr 1fr 1fr 1fr; } .filters .search { grid-column: auto; } }

/* ---------- Conteúdos ---------- */
.subject-block { padding: 0; overflow: hidden; }
.subject-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.subject-head h2 { font-size: 15px; }
.subject-head .area { font-size: 12px; color: var(--faint); }
.subject-head .prog { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.subject-head .prog .track { width: 70px; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.subject-head .prog .fill { height: 100%; background: var(--green); }

details.topic { border-top: 1px solid var(--border); }
details.topic:first-of-type { border-top: 0; }
details.topic > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 11px; padding: 11px 16px;
}
details.topic > summary::-webkit-details-marker { display: none; }
details.topic > summary:hover { background: var(--bg-2); }
details.topic[open] > summary { background: var(--surface-2); }
details.topic.child > summary { padding-left: 42px; }
details.topic.child .t-name { color: var(--muted); }
.t-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-meta { display: flex; align-items: center; gap: 6px; flex: none; }
.t-meta .tag { display: none; }
@media (min-width: 700px) { .t-meta .tag { display: inline-flex; } }
.topic-edit { padding: 14px 16px 18px; background: var(--surface-2); display: grid; gap: 14px; border-top: 1px solid var(--border); }
.topic-edit .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-edit .actions .btn.danger { margin-left: auto; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--faint); }
.facts b { color: var(--muted); font-weight: 600; }

details.panel { margin-bottom: 14px; }
details.panel > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  font-weight: 650; font-size: 15px;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary .chev { margin-left: auto; transition: transform .2s; color: var(--faint); }
details.panel[open] > summary .chev { transform: rotate(180deg); }
details.panel[open] > summary { margin-bottom: 16px; }

/* ---------- Nós dois ---------- */
.duo-head { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 14px; align-items: center; }
.who { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.who .dot { width: 10px; height: 10px; }
.cmp { display: grid; gap: 4px; }
.cmp-row { display: grid; grid-template-columns: 1fr 64px 64px; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.cmp-row:first-child { border-top: 0; }
.cmp-row .lbl { color: var(--muted); }
.cmp-row .a, .cmp-row .b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.cmp-row .lead { color: var(--text); }
.cmp-row .lead::after { content: " ★"; color: var(--gold); font-size: 11px; }
.cmp-split { grid-column: 1 / -1; display: flex; height: 5px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.cmp-split span:first-child { background: var(--green); }
.cmp-split span:last-child { background: var(--gold); }
.group-total { display: flex; gap: 22px; flex-wrap: wrap; }
.group-total div { min-width: 110px; }
.group-total b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.group-total span { font-size: 12.5px; color: var(--faint); }

/* ---------- Mais (mobile) ---------- */
.menu-list a {
  display: flex; align-items: center; gap: 14px; padding: 15px 4px;
  border-top: 1px solid var(--border); color: var(--text); font-weight: 500; text-decoration: none;
}
.menu-list a:first-child { border-top: 0; }
.menu-list a small { display: block; color: var(--faint); font-weight: 400; font-size: 12.5px; }
.menu-list a svg:last-child { margin-left: auto; color: var(--faint); }

/* ---------- Boas-vindas ---------- */
.welcome { min-height: calc(100vh - 60px); display: grid; place-items: center; }
.welcome-card { width: 100%; max-width: 420px; text-align: center; }
.welcome-card img { width: 72px; height: 72px; }
.welcome-card h1 { font-size: 30px; margin: 14px 0 8px; }
.welcome-card > p { color: var(--muted); margin-bottom: 26px; }
.welcome-card form { text-align: left; }
.welcome-card .fine { font-size: 12.5px; color: var(--faint); margin-top: 18px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-2);
  padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .4); max-width: calc(100vw - 32px);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(63, 174, 122, .5); }
.toast.err { border-color: rgba(226, 115, 95, .6); }
@media (min-width: 900px) { .toast { bottom: 28px; left: calc(50% + var(--side) / 2); } }

.section-t { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 22px 0 10px; }
.section-t:first-child { margin-top: 0; }
