/* Level 20 · área de acompanhamento */

:root {
  --ink: #131a2b;
  --ink-2: #394257;
  --muted: #646b7e;
  --navy-950: #0a1530;
  --navy-900: #10203f;
  --navy: #1f3a6b;
  --navy-700: #2b4a83;
  --sky: #a9c6ea;
  --sky-300: #c7dbf3;
  --sky-100: #e7eff9;
  --paper: #f5f2ec;
  --card: #fffefb;
  --sand: #f1ece3;
  --sand-2: #e4dac7;
  --line: #e2ded5;
  --rule: #c9ced8;
  --amber: #8a5a14;
  --amber-bg: #f7ead2;
  --red: #a42b22;
  --green: #2f6b4f;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --side-w: 248px;
  --radius: 20px;
  --shadow: 0 1px 0 rgba(16, 32, 63, .04), 0 18px 40px -30px rgba(16, 32, 63, .35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 500 15.5px/1.55 var(--sans); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--navy-700); outline-offset: 2px; border-radius: 6px; }

/* Estrutura */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px; padding: 22px 16px 20px;
  background: var(--navy-950); color: var(--paper);
  background-image: linear-gradient(rgba(169, 198, 234, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(169, 198, 234, .05) 1px, transparent 1px);
  background-size: 28px 28px;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px; text-decoration: none; color: var(--paper); }
.side-emblem { width: 42px; height: 42px; color: var(--sky-100); }
.brand-word { display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 5px; line-height: 1; }
.brand-word > span { font-weight: 600; font-size: 20px; letter-spacing: -.02em; }
.brand-word b { font-weight: 800; font-size: 20px; letter-spacing: -.03em; }
.brand-word small { grid-column: 1 / -1; justify-self: end; font-size: 9.5px; font-weight: 600; letter-spacing: .28em; margin: 4px -.28em 0 0; opacity: .8; }
.side-nav { display: grid; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; text-decoration: none;
  font-weight: 600; color: rgba(247, 244, 238, .72); transition: background-color .2s, color .2s;
}
.side-nav a svg { width: 20px; height: 20px; flex: none; }
.side-nav a:hover { background: rgba(169, 198, 234, .08); color: var(--paper); }
.side-nav a.is-active { background: rgba(169, 198, 234, .14); color: #fff; box-shadow: inset 2px 0 0 var(--sky); }
.side-badge { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: #e8b04c; box-shadow: 0 0 0 4px rgba(232, 176, 76, .18); }
.side-foot { margin-top: auto; display: grid; gap: 12px; padding: 0 8px; font-size: 12.5px; color: rgba(231, 239, 249, .5); }
.side-foot a { display: inline-flex; align-items: center; gap: 8px; color: rgba(231, 239, 249, .75); text-decoration: none; font-weight: 600; }
.side-foot a:hover { color: var(--sky); }
.side-foot svg { width: 16px; height: 16px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; min-height: 60px; padding: 10px clamp(18px, 3.4vw, 44px);
  background: rgba(245, 242, 236, .86); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--muted); }
.crumbs a { text-decoration: none; font-weight: 600; white-space: nowrap; }
.crumbs a:hover { color: var(--navy); }
.crumbs span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 700; }
.crumbs i { width: 4px; height: 4px; border-radius: 50%; background: var(--rule); flex: none; }
.savestate { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--green); background: rgba(47, 107, 79, .08); flex: none; transition: color .2s, background-color .2s; }
.savestate i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.savestate[data-state="pending"] { color: var(--muted); background: rgba(100, 107, 126, .08); }
.savestate[data-state="pending"] i { animation: pulse 1s ease-in-out infinite; }
.savestate[data-state="err"] { color: var(--red); background: rgba(164, 43, 34, .08); }
@keyframes pulse { 50% { opacity: .25; } }

.view { padding: clamp(22px, 3.4vw, 44px) clamp(18px, 3.4vw, 44px) 80px; max-width: 1320px; width: 100%; outline: none; }
.view.is-enter > * { animation: rise .55s var(--ease) both; }
[hidden] { display: none !important; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* Cabeçalhos */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { font-family: var(--serif); font-size: clamp(2rem, 3.6vw, 2.9rem); font-weight: 380; letter-spacing: -.025em; line-height: 1.05; font-variation-settings: "opsz" 144; }
.page-sub { margin-top: 8px; color: var(--muted); font-size: 15px; }
.page-sub b { color: var(--ink-2); }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--navy); margin-bottom: 10px; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px; cursor: pointer;
  font: 700 14.5px/1 var(--sans); text-decoration: none; white-space: nowrap; border: 1.5px solid transparent;
  transition: background-color .2s, border-color .2s, color .2s, transform .2s var(--ease), box-shadow .3s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); box-shadow: 0 10px 22px -12px rgba(31, 58, 107, .7); }
.btn-line { background: var(--card); border-color: var(--line); color: var(--navy); }
.btn-line:hover { border-color: var(--navy); }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover { background: rgba(31, 58, 107, .06); }
.btn-danger { background: transparent; color: var(--red); border-color: rgba(164, 43, 34, .25); }
.btn-danger:hover { background: rgba(164, 43, 34, .06); border-color: var(--red); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13.5px; }
.btn-icon { width: 42px; padding: 0; }
.btn-sm.btn-icon { width: 34px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* Cartões */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-h h2 { font-size: 11.5px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--navy); }
.card-h a, .card-h .link { font-size: 13.5px; font-weight: 700; color: var(--navy-700); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; }
.card-h a:hover, .card-h .link:hover { text-decoration: underline; text-underline-offset: 3px; }
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.muted { color: var(--muted); }
.empty { padding: 18px 0 6px; color: var(--muted); font-size: 14.5px; }

/* Indicadores */
.kpi { position: relative; overflow: hidden; }
.kpi-l { font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.kpi-v { font-family: var(--serif); font-size: 2.6rem; font-weight: 340; line-height: 1; margin-top: 14px; letter-spacing: -.03em; color: var(--navy); font-variant-numeric: lining-nums; }
.kpi-v small { font-family: var(--sans); font-size: 14px; font-weight: 700; letter-spacing: 0; color: var(--muted); margin-left: 6px; }
.kpi-s { margin-top: 8px; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-dark { background: var(--navy-950); border-color: var(--navy-950); color: var(--paper); }
.kpi-dark .kpi-l { color: rgba(231, 239, 249, .6); }
.kpi-dark .kpi-v { color: var(--sky); }
.kpi-dark .kpi-s { color: rgba(231, 239, 249, .7); white-space: normal; }
.kpi-dark::after {
  content: ""; position: absolute; right: -30px; bottom: -40px; width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(169, 198, 234, .22), transparent 65%);
}

/* Listas */
.rows { display: grid; }
.row {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 11px 10px; margin: 0 -10px;
  border-radius: 14px; text-decoration: none; transition: background-color .2s;
}
.row + .row::before { content: ""; position: absolute; left: 10px; right: 10px; top: 0; height: 1px; background: var(--line); transition: opacity .2s; }
a.row:hover { background: var(--sky-100); }
a.row:hover::before, a.row:hover + .row::before { opacity: 0; }
.row-main { display: grid; gap: 1px; min-width: 0; }
.row-t { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-s { display: block; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.datebox {
  width: 62px; height: 54px; border-radius: 12px; background: var(--sand); display: grid; place-content: center; text-align: center; line-height: 1; flex: none;
}
.datebox b { font-family: var(--serif); font-size: 21px; font-weight: 450; color: var(--navy); }
.datebox span { font-size: 8.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.datebox.is-today { background: var(--navy); }
.datebox.is-today b { color: #fff; }
.datebox.is-today span { color: var(--sky); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip-plan { background: var(--sky-100); color: var(--navy); }
.chip-done { background: var(--navy); color: #fff; }
.chip-late { background: var(--amber-bg); color: var(--amber); }
.chip-ex { background: var(--sand); color: var(--muted); }
.chip svg { width: 13px; height: 13px; }

.avatar {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none;
  font-family: var(--serif); font-size: 17px; font-weight: 500; color: var(--sky); background: var(--navy-950);
  background-image: linear-gradient(rgba(169, 198, 234, .12) 1px, transparent 1px), linear-gradient(90deg, rgba(169, 198, 234, .12) 1px, transparent 1px);
  background-size: 8px 8px;
}
.avatar-lg { width: 64px; height: 64px; border-radius: 20px; font-size: 25px; }

/* Barra de nível 0–20 */
.lvl { display: grid; gap: 7px; }
.lvl-track { position: relative; height: 10px; border-radius: 999px; background: var(--sand); }
.lvl-track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1.5px; background: rgba(31, 58, 107, .22); }
.lvl-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: linear-gradient(90deg, var(--sky), var(--navy-700)); width: var(--w); animation: grow 1.2s var(--ease) both; }
@keyframes grow { from { width: 0; } }
.lvl-start { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--card); border: 2px solid var(--navy); }
.lvl-goal { position: absolute; top: -6px; bottom: -6px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--navy-950); }
.lvl-goal::after { content: ""; position: absolute; left: 3px; top: 0; border: 5px solid transparent; border-left: 7px solid var(--navy-950); border-top-width: 4px; border-bottom-width: 4px; }
.lvl-txt { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); }
.lvl-txt b { color: var(--ink); }

/* Alunos */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--muted); }
.search input { width: 100%; height: 42px; padding: 0 14px 0 42px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); font: 600 14.5px var(--sans); color: var(--ink); }
.search input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 4px rgba(169, 198, 234, .45); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { height: 36px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); font-size: 13.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; transition: all .2s; }
.pill:hover { border-color: var(--navy); }
.pill.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }
.toggle { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; margin-left: auto; }
.toggle input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--rule); position: relative; cursor: pointer; transition: background-color .2s; margin: 0; }
.toggle input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.toggle input:checked { background: var(--navy); }
.toggle input:checked::after { transform: translateX(16px); }

.students { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.stu {
  display: grid; gap: 18px; padding: 22px; text-decoration: none; transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .2s;
}
.stu:hover { transform: translateY(-3px); border-color: var(--sky-300); box-shadow: 0 1px 0 rgba(16, 32, 63, .04), 0 28px 50px -30px rgba(16, 32, 63, .45); }
.stu-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.stu-name { font-family: var(--serif); font-size: 21px; font-weight: 450; letter-spacing: -.01em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stu-meta { font-size: 13.5px; color: var(--muted); }
.stu-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); padding-top: 14px; border-top: 1px solid var(--line); }
.stu-foot b { color: var(--ink-2); }
.stu-foot span { white-space: nowrap; }
.stu.is-archived { opacity: .62; }

/* Aluno */
.profile { display: flex; align-items: center; gap: 18px; min-width: 0; }
.profile h1 { font-family: var(--serif); font-size: clamp(1.9rem, 3.4vw, 2.7rem); font-weight: 380; letter-spacing: -.025em; line-height: 1.05; }
.tabs { display: flex; gap: 4px; margin: -6px 0 26px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { position: relative; padding: 12px 14px; font-weight: 700; font-size: 14.5px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--navy); }
.tabs a.is-on { color: var(--navy); }
.tabs a.is-on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2.5px; border-radius: 2px; background: var(--navy); }
.tabs a small { font-size: 12px; color: var(--muted); margin-left: 4px; }

.level-card { display: grid; grid-template-columns: 1fr; justify-items: center; align-content: start; gap: 6px; background: var(--navy-950); color: var(--paper); border-color: var(--navy-950);
  background-image: radial-gradient(400px 260px at 0% 0%, rgba(43, 74, 131, .7), transparent 70%), linear-gradient(rgba(169, 198, 234, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(169, 198, 234, .05) 1px, transparent 1px);
  background-size: auto, 24px 24px, 24px 24px; }
.level-card .card-h h2 { color: var(--sky); }
.gauge { width: 150px; height: 150px; position: relative; }
.gauge svg { width: 100%; height: 100%; }
.gauge-txt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1; }
.gauge-txt b { font-family: var(--serif); font-size: 40px; font-weight: 320; letter-spacing: -.03em; font-variant-numeric: lining-nums; }
.gauge-txt span { font-size: 10.5px; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; color: rgba(231, 239, 249, .6); margin-top: 6px; }
.g-track { fill: none; stroke: rgba(169, 198, 234, .16); stroke-width: 10; stroke-linecap: round; }
.g-fill { fill: none; stroke: var(--sky); stroke-width: 10; stroke-linecap: round; stroke-dasharray: var(--len); stroke-dashoffset: var(--off); animation: gfill 1.4s var(--ease) both; filter: drop-shadow(0 0 6px rgba(169, 198, 234, .5)); }
@keyframes gfill { from { stroke-dashoffset: var(--len); } }
.g-goal { stroke: #fff; stroke-width: 3; stroke-linecap: round; }
.level-t { justify-self: start; font-size: 11.5px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--sky); }
.level-facts { width: 100%; display: grid; grid-template-columns: 1fr 1fr; margin-top: 4px; }
.level-facts div { display: grid; gap: 2px; padding: 12px 0 2px; border-top: 1px solid rgba(231, 239, 249, .12); }
.level-facts div:nth-child(even) { padding-left: 16px; border-left: 1px solid rgba(231, 239, 249, .12); }
.level-facts span { font-size: 10.5px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: rgba(231, 239, 249, .55); }
.level-facts b { font-family: var(--serif); font-weight: 380; font-size: 24px; line-height: 1.1; color: #fff; }
.level-facts small { font-size: 12.5px; color: rgba(231, 239, 249, .6); }
.level-facts .up { color: var(--sky); }

.chart { width: 100%; height: auto; overflow: visible; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-axis { font: 700 10.5px var(--sans); fill: var(--muted); }
.c-ten { stroke: rgba(31, 58, 107, .28); stroke-dasharray: 3 4; }
.c-goal { stroke: var(--navy-700); stroke-width: 1.5; stroke-dasharray: 6 5; }
.c-goal-t { font: 800 10.5px var(--sans); fill: var(--navy-700); letter-spacing: .06em; }
.c-area { fill: url(#c-grad); animation: fadein 1s .5s both; }
@keyframes fadein { from { opacity: 0; } }
.c-line { fill: none; stroke: var(--c, var(--navy)); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.4s .15s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.c-pt { fill: var(--card); stroke: var(--c, var(--navy)); stroke-width: 2.2; }
.c-pt-start { fill: var(--sand); stroke: var(--muted); }
.c-lbl { font: 800 11.5px var(--sans); fill: var(--navy); text-anchor: middle; }
.c-bar1 { fill: var(--navy); }
.c-bar2 { fill: var(--sky); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; white-space: nowrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.notebox { background: var(--sand); border-radius: 14px; padding: 14px 16px; }
.notebox h3 { font-size: 10.5px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--navy); margin-bottom: 6px; }
.notebox p { white-space: pre-wrap; color: var(--ink-2); font-size: 14.5px; }
.notebox + .notebox { margin-top: 10px; }
.two-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two-notes .notebox + .notebox { margin-top: 0; }
.next-card { border-left: 4px solid var(--sky); }

.prog { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 32px; }
.prog-item { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 12px 10px; margin: 0 -10px; border-radius: 14px; text-decoration: none; transition: background-color .2s; }
.prog-item:hover { background: var(--sky-100); }
.prog-name { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; margin-bottom: 8px; white-space: nowrap; }
.prog-name span:first-child { overflow: hidden; text-overflow: ellipsis; }
.prog-name .muted { font-weight: 600; font-size: 13px; }
.month { font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); padding: 18px 0 6px; }
.month:first-child { padding-top: 0; }
.page-sub .chip { vertical-align: middle; height: 24px; }

/* Folha (ficha e plano) */
.sheet { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px 26px; background: var(--navy); color: #fff;
  background-image: linear-gradient(rgba(169, 198, 234, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(169, 198, 234, .07) 1px, transparent 1px); background-size: 22px 22px;
}
.sheet-head h2 { font-size: 22px; font-weight: 800; letter-spacing: .01em; text-transform: uppercase; }
.sheet-head p { font-size: 11.5px; letter-spacing: .2em; opacity: .85; margin-top: 3px; }
.sheet-head .btn-line { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .25); color: #fff; }
.sheet-head .btn-line:hover { background: rgba(255, 255, 255, .18); border-color: #fff; }
.sheet-body { padding: 8px 26px 30px; }
.sec { margin-top: 26px; }
.sec-t {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 12.5px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--navy);
  padding-bottom: 8px; border-bottom: 1.5px solid var(--navy); margin-bottom: 16px;
}
.sec-t small { font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--muted); }
.sec-hint { font-style: italic; font-size: 13.5px; color: var(--muted); margin: -8px 0 8px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 32px; }
.fgrid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fld { display: grid; gap: 4px; min-width: 0; }
.fld-l { font-size: 10.5px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.in {
  width: 100%; min-width: 0; font: 600 16px/1.5 var(--sans); color: var(--ink); background: transparent; border: 0; border-bottom: 1.5px solid var(--rule);
  padding: 6px 2px 7px; border-radius: 0; transition: border-color .2s, background-color .2s; -webkit-appearance: none; appearance: none;
}
.in:hover { border-bottom-color: var(--navy-700); }
.in:focus { outline: none; border-bottom-color: var(--navy); background: linear-gradient(transparent 60%, rgba(169, 198, 234, .22) 60%); }
.in::placeholder { color: #a7adba; font-weight: 500; }
.in[aria-invalid="true"] { border-bottom-color: var(--red); background: rgba(164, 43, 34, .05); }
select.in { cursor: pointer; padding-right: 26px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%231f3a6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 2px center; background-size: 16px; }
.ta {
  resize: none; overflow: hidden; min-height: 3.4em; line-height: 30px; padding: 0 2px; border-bottom: 0; font-weight: 500;
  background: repeating-linear-gradient(transparent 0 29px, var(--rule) 29px 30px);
}
.ta:focus { background: repeating-linear-gradient(transparent 0 29px, var(--navy) 29px 30px); }
.ta:hover { border-bottom: 0; }
.cell { resize: none; overflow: hidden; line-height: 1.45; font-weight: 500; font-size: 15px; padding: 7px 2px; }
.diag { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; padding: 18px 20px 14px; background: var(--sand); border-radius: 6px; }
.diag .ta { background: repeating-linear-gradient(transparent 0 29px, var(--sand-2) 29px 30px); }
.diag .ta:focus { background: repeating-linear-gradient(transparent 0 29px, var(--navy) 29px 30px); }
.num-in { max-width: 120px; font-family: var(--serif); font-size: 22px; font-weight: 400; }

/* Tabelas da folha */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { background: var(--navy); color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; text-align: left; padding: 9px 12px; }
.tbl td { padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl td .in { border-bottom-color: transparent; }
.tbl td .in:hover { border-bottom-color: var(--rule); }
.tbl td .in:focus { border-bottom-color: var(--navy); }
.tbl .c-min { width: 96px; background: var(--sand); }
.tbl .c-min .in { font-weight: 800; color: var(--navy); text-align: center; }
.tbl .c-step { width: 30%; font-weight: 700; color: var(--ink-2); font-size: 14.5px; }
.tbl .c-date { width: 160px; }
.tbl .c-nota { width: 110px; }
.tbl .c-nota .in { font-family: var(--serif); font-size: 19px; font-weight: 450; text-align: center; color: var(--navy); }
.tbl .c-del { width: 46px; text-align: right; }
.tbl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.total { font-size: 13.5px; font-weight: 700; color: var(--muted); }
.total.is-off { color: var(--amber); }
.icon-del { width: 32px; height: 32px; border-radius: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; }
.icon-del:hover { background: rgba(164, 43, 34, .08); color: var(--red); }
.icon-del svg { width: 17px; height: 17px; }

/* Checklist do material */
.checks { display: grid; gap: 10px; }
.check { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.check input[type="checkbox"] {
  appearance: none; width: 22px; height: 22px; margin: 0; flex: none; border: 1.8px solid var(--navy); border-radius: 6px; cursor: pointer; display: grid; place-items: center; transition: background-color .15s;
}
.check input[type="checkbox"]::after { content: ""; width: 12px; height: 12px; background: #fff; transform: scale(0); transition: transform .2s var(--ease);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round' d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round' d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.check input[type="checkbox"]:checked { background: var(--navy); }
.check input[type="checkbox"]:checked::after { transform: scale(1); }
.check .in { width: auto; flex: 1 1 160px; max-width: 320px; padding-top: 2px; padding-bottom: 3px; }

/* Avaliação 1–5 */
.rating { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
.rate { display: grid; gap: 8px; }
.rate-dots { display: flex; gap: 6px; }
.rate-dots button {
  width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-weight: 800; color: var(--muted); cursor: pointer; transition: all .2s;
}
.rate-dots button:hover { border-color: var(--navy); color: var(--navy); }
.rate-dots button.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }
.rate-dots button.is-sel { box-shadow: 0 0 0 4px rgba(169, 198, 234, .6); }

.done-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 26px; padding: 16px 18px; border-radius: 16px; background: var(--sky-100);
}
.done-bar p { font-weight: 700; color: var(--navy); }
.done-bar p small { display: block; font-weight: 500; color: var(--muted); font-size: 13.5px; }
.done-bar.is-done { background: rgba(47, 107, 79, .08); }
.done-bar.is-done p { color: var(--green); }
.done-bar.is-late { background: var(--amber-bg); }
.done-bar.is-late p { color: var(--amber); }

.pager { display: flex; gap: 8px; }

/* Boas-vindas */
.welcome { position: relative; overflow: hidden; padding: clamp(28px, 5vw, 56px); background: var(--navy-950); color: var(--paper); border-color: var(--navy-950);
  background-image: radial-gradient(600px 400px at 100% 0%, rgba(43, 74, 131, .7), transparent 70%), linear-gradient(rgba(169, 198, 234, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(169, 198, 234, .05) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px; }
.welcome h1 { font-family: var(--serif); font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 340; letter-spacing: -.03em; line-height: 1.05; max-width: 14em; }
.welcome h1 em { color: var(--sky); }
.welcome p { margin-top: 16px; color: rgba(247, 244, 238, .75); max-width: 36em; font-size: 16.5px; }
.welcome .head-actions { margin-top: 28px; }
.welcome .btn-line { background: transparent; border-color: rgba(231, 239, 249, .3); color: var(--paper); }
.welcome .btn-line:hover { border-color: var(--sky); color: var(--sky); }
.welcome .btn-primary { background: var(--sky); color: var(--navy-950); }
.welcome .btn-primary:hover { background: #bcd4f1; }
.welcome-emblem { position: absolute; right: -40px; bottom: -60px; width: 300px; height: 300px; color: rgba(231, 239, 249, .9); opacity: .16; pointer-events: none; }
.steps-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }
.steps-mini .card b { font-family: var(--serif); font-size: 15px; color: var(--navy-700); }
.steps-mini .card h3 { font-family: var(--serif); font-size: 20px; font-weight: 450; margin: 8px 0 6px; }
.steps-mini .card p { color: var(--muted); font-size: 14.5px; }

/* Dados */
.data-card h2 { font-family: var(--serif); font-size: 22px; font-weight: 450; letter-spacing: -.01em; margin-bottom: 6px; }
.data-card p { color: var(--muted); font-size: 14.5px; }
.data-card .head-actions { margin-top: 18px; }
.data-card.is-danger { border-color: rgba(164, 43, 34, .2); }
.stat-line { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; font-size: 14px; color: var(--ink-2); }
.stat-line b { font-family: var(--serif); font-weight: 450; font-size: 18px; color: var(--navy); margin-right: 4px; }
.warn { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--amber-bg); color: var(--amber); font-size: 14px; font-weight: 600; margin-top: 14px; }

/* Diálogo */
.dlg { width: min(460px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 24px; background: var(--card); color: var(--ink); box-shadow: 0 40px 90px -30px rgba(10, 21, 48, .6); }
.dlg::backdrop { background: rgba(10, 21, 48, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dlg[open] { animation: pop .35s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.dlg form { padding: 26px; }
.dlg h2 { font-family: var(--serif); font-size: 25px; font-weight: 420; letter-spacing: -.015em; }
.dlg-text { margin-top: 8px; color: var(--muted); }
.dlg-body { display: grid; gap: 18px; margin-top: 20px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.dlg .seg { display: flex; flex-wrap: wrap; gap: 6px; }
.dlg .seg label { position: relative; }
.dlg .seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.dlg .seg span { display: inline-flex; align-items: center; height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; color: var(--ink-2); transition: all .2s; }
.dlg .seg input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.dlg .seg input:focus-visible + span { box-shadow: 0 0 0 4px rgba(169, 198, 234, .6); }
.dlg-err { color: var(--red); font-size: 14px; font-weight: 600; min-height: 1em; }

/* Avisos */
.toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60; display: grid; gap: 8px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 18px; border-radius: 16px; background: var(--navy-950); color: var(--paper);
  box-shadow: 0 20px 40px -18px rgba(10, 21, 48, .7); font-weight: 600; font-size: 14.5px; animation: pop .35s var(--ease);
}
.toast svg { width: 18px; height: 18px; color: var(--sky); flex: none; }
.toast.is-error svg { color: #f2a59e; }
.toast button { border: 0; background: rgba(169, 198, 234, .16); color: var(--sky); font-weight: 800; height: 32px; padding: 0 12px; border-radius: 10px; cursor: pointer; }
.toast button:hover { background: rgba(169, 198, 234, .28); }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: all .3s; }

/* Barra inferior (telemóvel) */
.tabbar { display: none; }

@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .view { padding: 20px 16px calc(110px + env(safe-area-inset-bottom)); }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .fgrid-4 { grid-template-columns: 1fr 1fr; }
  .steps-mini { grid-template-columns: 1fr; }
  .prog { grid-template-columns: 1fr; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(6, 1fr);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(10, 21, 48, .96); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  }
  .tabbar a { display: grid; justify-items: center; gap: 3px; padding: 7px 0; border-radius: 12px; text-decoration: none; font-size: 10.5px; font-weight: 700; color: rgba(231, 239, 249, .6); }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar a.is-active { color: var(--sky); background: rgba(169, 198, 234, .1); }
  .toasts { bottom: calc(86px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .g-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 16px 16px 18px; }
  .kpi-v { font-size: 2.1rem; }
  .fgrid { grid-template-columns: 1fr; gap: 16px; }
  .fgrid-4 { grid-template-columns: 1fr 1fr; }
  .diag, .two-notes { grid-template-columns: 1fr; }
  .sheet-head, .sheet-body { padding-left: 16px; padding-right: 16px; }
  .sheet-head h2 { font-size: 18px; }
  .page-head { align-items: flex-start; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: auto; }
  .tbl thead { display: none; }
  .tbl tr { position: relative; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .tbl td { border: 0; padding: 2px 0; }
  .tbl .c-min, .tbl .c-step, .tbl .c-date, .tbl .c-nota { width: auto; background: none; }
  .tbl .c-min .in { text-align: left; }
  .tbl .c-del { position: absolute; right: 0; top: 8px; }
  .tbl-struct tr { display: grid; grid-template-columns: 70px 1fr; gap: 0 10px; }
  .tbl-struct .c-min { grid-row: span 2; background: var(--sand); border-radius: 8px; display: grid; align-items: center; }
  .tbl-struct .c-min .in { text-align: center; }
  .tbl-aval tr { display: grid; grid-template-columns: 1fr 90px; gap: 0 12px; padding-right: 40px; }
  .tbl-aval .c-nota { grid-row: 1 / span 3; grid-column: 2; align-self: center; }
  .toggle { margin-left: 0; }
  .check { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 12px; row-gap: 4px; }
  .check .in { grid-column: 2; max-width: none; }
}

/* Impressão: replica as folhas originais */
.print-root { display: none; }
@page { size: A4; margin: 14mm 14mm 16mm; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
@media print {
  body { background: #fff; font-size: 10.5pt; }
  .app, .tabbar, .toasts, .dlg { display: none !important; }
  .print-root { display: block; }
  .pdoc { color: #1f3a6b; font-family: var(--sans); page-break-after: always; }
  .pdoc:last-child { page-break-after: auto; }
  .pdoc-head { background: #1f3a6b !important; color: #fff; padding: 12px 16px 11px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pdoc-head h1 { font-size: 17pt; font-weight: 800; letter-spacing: .01em; }
  .pdoc-head p { font-size: 7.5pt; letter-spacing: .24em; margin-top: 2px; }
  .psec { font-size: 8.5pt; font-weight: 800; letter-spacing: .26em; padding-bottom: 4px; border-bottom: 1.2px solid #1f3a6b; margin: 18px 0 10px; }
  .pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 26px; }
  .pgrid-4 { grid-template-columns: repeat(4, 1fr); }
  .pf { display: grid; gap: 2px; }
  .pf span { font-size: 6.5pt; font-weight: 700; letter-spacing: .22em; color: #6b7286; text-transform: uppercase; }
  .pf b { min-height: 18px; border-bottom: .8px solid #b9bfca; font-weight: 600; font-size: 10pt; color: #131a2b; padding: 1px 0 2px; }
  .phint { font-style: italic; font-size: 7.5pt; color: #6b7286; margin: -4px 0 4px; }
  .ptext { white-space: pre-wrap; font-size: 10pt; color: #131a2b; line-height: 22px; min-height: 66px; background: repeating-linear-gradient(transparent 0 21px, #c9ced8 21px 22px); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ptext-2 { min-height: 44px; }
  .pbox { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; background: #f1ece3 !important; padding: 10px 12px; min-height: 110px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pbox h3 { font-size: 6.5pt; font-weight: 800; letter-spacing: .22em; margin-bottom: 4px; }
  .pbox p { white-space: pre-wrap; font-size: 10pt; color: #131a2b; }
  .ptable { width: 100%; border-collapse: collapse; }
  .ptable th { background: #1f3a6b !important; color: #fff; font-size: 6.5pt; font-weight: 800; letter-spacing: .22em; text-align: left; padding: 6px 8px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ptable td { border-bottom: .8px solid #c9ced8; padding: 6px 8px; height: 24px; font-size: 9.5pt; color: #131a2b; vertical-align: top; white-space: pre-wrap; }
  .ptable td.pmin { background: #f1ece3 !important; font-weight: 800; color: #1f3a6b; width: 86px; white-space: nowrap; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ptable td.pstep { width: 32%; }
  .pchecks { display: grid; gap: 4px; font-size: 9.5pt; color: #131a2b; }
  .pchecks span::before { content: "\2610"; margin-right: 8px; color: #1f3a6b; }
  .pchecks span.on::before { content: "\2611"; }
  .prating { display: flex; gap: 30px; font-size: 9.5pt; color: #131a2b; margin-top: 8px; }
  .plinks { margin-top: 6px; font-size: 9pt; color: #131a2b; }
  .plinks p::before { content: "\2192  "; color: #1f3a6b; }
  .scan { display: none !important; }
  .prating b { color: #1f3a6b; }
}

/* ===== Disciplinas, estados e componentes novos ===== */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 8px; vertical-align: 1px; flex: none; }
.dot-todo { --c: transparent; border: 1.5px dashed var(--navy-700); width: 10px; height: 10px; }
.chip-todo { background: transparent; color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--navy); border-style: dashed; }
.chip-todo { box-shadow: none; border: 1.5px dashed rgba(31, 58, 107, .55); }
.chip-disc { background: color-mix(in srgb, var(--c) 12%, white); color: var(--c); }
.link { border: 0; background: none; color: var(--navy-700); font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.kpi-link { text-decoration: none; transition: border-color .2s, transform .3s var(--ease); }
.kpi-link:hover { border-color: var(--sky-300); transform: translateY(-2px); }
.kpi-euro { font-size: 2.1rem; }
.disc-pills { margin: -8px 0 18px; }
.pill .dot { margin-right: 7px; }
.pill.is-on .dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.row-actions { display: flex; align-items: center; gap: 6px; }
.icon-edit:hover { background: var(--sky-100); color: var(--navy); }
.span-2-f { grid-column: span 2; }

/* Níveis por disciplina */
.stu-lvls { display: grid; gap: 12px; }
.lvl-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--c, #2b4a83) 40%, white), var(--c, #2b4a83)); }
.lvl-sm { gap: 5px; }
.lvl-sm .lvl-track { height: 7px; }
.lvl-sm .lvl-txt { font-size: 12px; }
.lvl-disc { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--c); }

/* Disciplinas na ficha */
.picks { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 6px; }
.pick { position: relative; cursor: pointer; }
.pick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.pick span { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; color: var(--ink-2); background: var(--card); transition: all .2s; }
.pick span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); opacity: .35; transition: opacity .2s; }
.pick input:checked + span { border-color: var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 9%, white); }
.pick input:checked + span::before { opacity: 1; }
.pick input:focus-visible + span { box-shadow: 0 0 0 4px rgba(169, 198, 234, .6); }
.tbl-metas { max-width: 560px; }
.tbl-metas .c-step { width: auto; }
.tbl .c-disc { width: 150px; }

/* Plano preparado */
.plan-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 26px; background: repeating-linear-gradient(135deg, rgba(31, 58, 107, .035) 0 10px, transparent 10px 20px), var(--sky-100); border-bottom: 1px solid var(--line); }
.plan-bar p { font-weight: 800; color: var(--navy); display: flex; flex-direction: column; }
.plan-bar p small { font-weight: 500; color: var(--muted); font-size: 13.5px; }
.plan-bar.is-ready { background: rgba(47, 107, 79, .07); }
.plan-bar.is-ready p { color: var(--green); flex-direction: row; align-items: center; gap: 8px; }
.plan-bar svg { width: 18px; height: 18px; }

/* Links e materiais */
.res-box { margin-top: 22px; padding: 16px 18px; border-radius: 14px; background: var(--paper); border: 1px dashed var(--rule); }
.res-box > .fld-l { display: block; margin-bottom: 10px; }
.res-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.res { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.res-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c, #2b4a83) 12%, white); color: var(--c, var(--navy)); }
.res-ic svg { width: 18px; height: 18px; }
.res-main { display: grid; min-width: 0; }
.res-main b { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-main small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Pagamento */
.pay-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.pay-row .fld { flex: 0 1 260px; }
.euro-in { font-family: var(--serif); font-size: 20px; }
.paytoggle { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 999px; border: 1.5px dashed rgba(138, 90, 20, .5); background: var(--amber-bg); color: var(--amber); font-weight: 800; font-size: 14px; cursor: pointer; transition: all .2s; white-space: nowrap; }
.paytoggle svg { width: 17px; height: 17px; }
.paytoggle.is-paid { border: 1.5px solid transparent; background: rgba(47, 107, 79, .1); color: var(--green); }
.paytoggle:hover { filter: brightness(.97); }
.paytoggle-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.month-nav { align-items: center; }
.month-name { font-family: var(--serif); font-size: 20px; font-weight: 420; min-width: 170px; text-align: center; }
.pay-card .card-h { align-items: flex-start; }
.pay-who { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.pay-who span { display: grid; min-width: 0; }
.pay-who b { font-family: var(--serif); font-weight: 450; font-size: 19px; }
.pay-who small { color: var(--muted); font-size: 13px; }
.pay-sum { display: grid; justify-items: end; gap: 6px; }
.pay-sum b { font-family: var(--serif); font-size: 24px; font-weight: 400; color: var(--navy); }
.pay-lines { display: grid; }
.pay-line { display: grid; grid-template-columns: 96px minmax(0, 1fr) 100px 90px auto; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.pay-line > span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.pay-line > span:nth-child(3) { color: var(--muted); }
.pay-val { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }

/* Portefólio */
.mat-card .card-h h2 { display: flex; align-items: center; }
.mat-ano + .mat-ano { margin-top: 8px; }
.mat-materia { margin: 6px 0 14px; }
.mat-mt { font-family: var(--serif); font-size: 17px; font-weight: 450; margin: 0 0 8px; color: var(--ink); }
.mat-card + .mat-card { margin-top: 18px; }
.in-file { padding: 10px 0; font-size: 14px; border-bottom-style: dashed; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 46vh; overflow: auto; }
.pick-list label { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; }
.pick-list label:has(input:checked) { border-color: var(--navy); background: var(--sky-100); }
.pick-list input { width: 18px; height: 18px; accent-color: var(--navy); }
.dlg.dlg-wide { width: min(620px, calc(100vw - 32px)); }
.dlg .fgrid { gap: 16px 20px; }

/* Calendário */
.cal-card { padding: 20px 22px 14px; }
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav h2 { font-family: var(--serif); font-size: 21px; font-weight: 420; margin-left: 10px; letter-spacing: -.01em; }
.cal-legend { gap: 6px 14px; }
.cal-legend svg { width: 13px; height: 13px; margin-right: 6px; color: var(--navy); }
.cal { --tcol: 50px; }
.cal-head, .cal-allrow { display: grid; grid-template-columns: var(--tcol) repeat(var(--cols), minmax(0, 1fr)); }
.cal-dh { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 8px 0 10px; border-left: 1px solid transparent; }
.cal-dh span { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.cal-dh b { font-family: var(--serif); font-size: 21px; font-weight: 420; color: var(--ink); width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 50%; }
.cal-dh.is-today span { color: var(--navy); }
.cal-dh.is-today b { background: var(--navy); color: #fff; }
.cal-allrow { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-all-l { font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); align-self: center; text-align: right; padding-right: 9px; }
.cal-all { display: grid; gap: 4px; align-content: start; padding: 6px 4px; min-height: 38px; border-left: 1px solid var(--line); }
.ev-test { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 3px 8px; border-radius: 8px; background: color-mix(in srgb, var(--c) 12%, white); color: var(--c); font-size: 11.5px; font-weight: 800; text-decoration: none; }
.ev-test span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-test svg { width: 12px; height: 12px; flex: none; }
.ev-nohour { background: var(--paper); border: 1px dashed color-mix(in srgb, var(--c) 50%, white); }
.cal-scroll { max-height: 540px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.cal-body { position: relative; display: grid; grid-template-columns: var(--tcol) minmax(0, 1fr); margin-top: 0; }
.cal-times { position: relative; }
.cal-time { position: absolute; right: 9px; transform: translateY(-50%); font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-time:first-child { transform: none; }
.cal-body { padding-top: 0; }
.cal-cols { position: relative; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px calc(var(--ppm-h, 54px))); }
.cal-col { position: relative; border-left: 1px solid var(--line); cursor: copy; min-width: 0; }
.cal-col:last-child { border-right: 1px solid var(--line); }
.cal-col.is-today { background: linear-gradient(180deg, rgba(231, 239, 249, .65), rgba(231, 239, 249, .25)); }
.cal-col:hover { background-color: rgba(231, 239, 249, .35); }
.ev {
  position: absolute; z-index: 1; display: flex; flex-direction: column; gap: 1px; padding: 5px 8px 5px 11px; border-radius: 10px; overflow: hidden; text-decoration: none;
  background: color-mix(in srgb, var(--c) 11%, white); border: 1px solid color-mix(in srgb, var(--c) 28%, white); color: var(--ink); cursor: pointer;
  transition: box-shadow .2s, transform .2s;
}
.ev::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.ev:hover { box-shadow: 0 10px 22px -12px rgba(16, 32, 63, .5); z-index: 3; transform: translateY(-1px); }
.ev-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.ev-top b { font-size: 11px; font-weight: 800; color: var(--c); font-variant-numeric: tabular-nums; }
.ev-ic { width: 13px; height: 13px; color: var(--green); }
.ev-name { font-size: 12.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-sub { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-xs { flex-direction: row; align-items: center; gap: 6px; padding-top: 2px; padding-bottom: 2px; }
.ev.is-porplanear { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 7%, white) 0 6px, white 6px 12px); border-style: dashed; }
.ev.is-realizada { opacity: .78; }
.ev.is-atraso { border-color: rgba(138, 90, 20, .6); background: var(--amber-bg); }
.cal-now { position: absolute; left: -1px; right: 0; height: 2px; background: #c2412d; z-index: 4; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #c2412d; }
.cal-hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.wk { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-bottom: 6px; }
.wk-day { display: grid; justify-items: center; gap: 3px; padding: 6px 0 5px; border: 0; background: none; border-radius: 14px; cursor: pointer; }
.wk-wd { font-size: 9.5px; font-weight: 700; color: var(--muted); }
.wk-num { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: var(--ink); }
.wk-dots { display: flex; gap: 3px; height: 5px; }
.wk-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--sky); }
.wk-day.is-today .wk-num { box-shadow: inset 0 0 0 1.5px var(--navy-700); color: var(--navy); }
.wk-day.is-sel .wk-num { background: var(--navy); color: #fff; box-shadow: 0 8px 16px -8px rgba(31, 58, 107, .8); }
.cal-dayhead { font-family: var(--serif); font-size: 22px; font-weight: 450; margin: 8px 0 10px; }
.cal-dayhead span { color: var(--muted); font-weight: 380; }

/* Digitalização */
.scan { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-rows: auto 1fr auto; background: var(--paper); animation: rise .3s var(--ease); }
.scan-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--navy-950); color: var(--paper); }
.scan-top h2 { font-family: var(--serif); font-weight: 420; font-size: 20px; }
.scan-top .btn-ghost { color: var(--sky); justify-self: start; }
.scan-count { justify-self: end; font-size: 13.5px; font-weight: 700; color: rgba(231, 239, 249, .7); }
.scan-body { overflow: auto; padding: 22px clamp(16px, 4vw, 40px); }
.scan-empty { max-width: 460px; margin: 8vh auto 0; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 16px; }
.scan-empty svg { width: 64px; height: 64px; color: var(--navy); opacity: .7; }
.scan-empty b { color: var(--ink); }
.scan-pages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
.scan-pages li { display: grid; gap: 8px; }
.scan-pages figure { margin: 0; display: grid; gap: 6px; }
.scan-thumb { aspect-ratio: 1 / 1.25; display: grid; place-items: center; background: #fff; border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; padding: 6px; }
.scan-thumb img { max-width: 100%; max-height: 100%; transition: transform .3s var(--ease); filter: grayscale(1) contrast(1.35) brightness(1.06); }
.scan-pages.is-plain .scan-thumb img { filter: none; }
.scan-pages figcaption { font-size: 12.5px; font-weight: 800; color: var(--muted); text-align: center; letter-spacing: .06em; text-transform: uppercase; }
.scan-tools { display: flex; justify-content: center; gap: 4px; }
.scan-tools button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--navy); display: grid; place-items: center; cursor: pointer; }
.scan-tools button:hover { border-color: var(--navy); }
.scan-tools button[disabled] { opacity: .35; cursor: default; }
.scan-tools svg { width: 16px; height: 16px; }
.scan-busy { text-align: center; color: var(--muted); font-weight: 700; margin-top: 18px; }
.scan-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.scan-bar .toggle { margin: 0 auto 0 6px; }
.scan-bar label.btn { cursor: pointer; }

@media (max-width: 880px) {
  .cal-card { padding: 16px 14px 12px; }
  .cal { --tcol: 42px; }
  .cal-legend { display: none; }
  .pay-line { grid-template-columns: 80px minmax(0, 1fr) auto; grid-template-areas: "d n t" "d v t"; row-gap: 0; }
  .pay-line > span:nth-child(1) { grid-area: d; }
  .pay-line > span:nth-child(2) { grid-area: n; }
  .pay-line > span:nth-child(3) { display: none; }
  .pay-line > .pay-val { grid-area: v; text-align: left; font-size: 13px; }
  .pay-line > .paytoggle { grid-area: t; }
  .span-2-f { grid-column: auto; }
}
@media (max-width: 640px) {
  .res { grid-template-columns: auto minmax(0, 1fr) auto; }
  .res > .btn { grid-column: 2; justify-self: start; }
  .res > .icon-del { grid-row: 1; grid-column: 3; }
  .res > .icon-del + .icon-del { grid-row: 2; }
  .scan-bar .btn { flex: 1 1 auto; }
  .scan-bar .toggle { order: -1; width: 100%; margin: 0; }
  .month-name { min-width: 0; font-size: 17px; }
  .tbl-aval tr { grid-template-columns: 1fr 1fr 90px; }
  .tbl-aval .c-nota { grid-row: 1 / span 2; grid-column: 3; }
}
