/* door2.pt — back-office (área do aluno / professora). Flat paper surfaces; glass only over ink. */
*, *::before, *::after { box-sizing: border-box; }
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
em { font-style: italic; color: var(--cobalt); }
.muted { color: var(--ink-muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Login ---------- */
.login { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(280px, 42%) 1fr; }
.login-art { position: relative; background: #f6f3ec; border-right: 1px solid var(--hairline); overflow: hidden; }
.login-art .gx-bloom { position: absolute; inset: 0; }
.login-main { position: relative; display: grid; place-items: center; padding: var(--space-7) var(--space-4); }
.login-main > .d2-ink { position: absolute; inset: 0; }
.login-card { position: relative; width: 100%; max-width: 420px; display: grid; gap: var(--space-5); }
.login-card h1 { font-size: clamp(40px, 6vw, 56px); }
.login-top { display: flex; justify-content: space-between; align-items: center; }
@media (max-width: 820px) { .login { grid-template-columns: 1fr; grid-template-rows: 240px auto; } .login-art { border-right: 0; border-bottom: 1px solid var(--hairline); } .login-art .gx-rods { width: 170px; } }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--space-6); padding: var(--space-6) var(--space-4); background: var(--surface-200); border-right: 1px solid var(--hairline); }
.side-brand { padding: 0 var(--space-3); text-decoration: none; }
.side-nav { display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: var(--space-3); height: 42px; padding: 0 var(--space-3); border-radius: var(--radius-pill); color: var(--ink-muted); text-decoration: none; font: 500 15px/1 var(--font-sans); }
.side-nav a:hover { color: var(--ink); background: var(--surface-300); }
.side-nav a.is-active { color: var(--on-cobalt); background: var(--cobalt); }
.side-nav .badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-pill); display: grid; place-items: center; font: 500 11px/1 var(--font-mono); background: var(--cobalt-wash); color: var(--cobalt-deep); }
.side-nav .badge[hidden] { display: none; }
.side-nav a.is-active .badge { background: var(--on-cobalt); color: var(--cobalt); }
.side-foot { margin-top: auto; display: grid; gap: var(--space-3); padding: var(--space-4) var(--space-3) 0; border-top: 1px solid var(--hairline); }
.who { display: grid; gap: 2px; }
.who strong { font: 600 14px/1.3 var(--font-sans); }
.side-tools { display: flex; align-items: center; gap: var(--space-2); }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: transparent; color: var(--ink); cursor: pointer; padding: 0; text-decoration: none; }
.icon-btn:hover { background: var(--surface-300); }
.main { min-width: 0; padding: var(--space-7) var(--space-7) var(--space-9); }
.page { max-width: 1040px; margin: 0 auto; display: grid; gap: var(--space-7); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); }
.page-head h1 { margin-top: var(--space-3); }
.page-head .d2-kicker { min-width: 240px; }

/* mobile: top bar + bottom tabs */
.topbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px var(--space-2) calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--hairline); }
  .side-brand, .side-foot { display: none; }
  .side-nav { display: flex; width: 100%; justify-content: space-around; }
  .side-nav a { flex-direction: column; justify-content: center; gap: 4px; height: 52px; padding: 0 6px; font-size: 11px; border-radius: var(--radius-sm); flex: 1; min-width: 0; }
  .side-nav a span.lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .side-nav .badge { position: absolute; margin: -30px 0 0 26px; min-width: 18px; height: 18px; font-size: 10px; }
  .side-nav a { position: relative; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface-200); border-bottom: 1px solid var(--hairline); position: sticky; top: 0; z-index: 30; }
  .main { padding: var(--space-6) var(--space-4) 120px; }
}
@media (max-width: 420px) { .side-nav a span.lbl { display: none; } }

/* ---------- Building blocks ---------- */
.panel { background: var(--surface-200); border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: var(--space-5); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--space-5); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-5); }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); }
.stat { padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); background: var(--surface-200); border: 1px solid var(--hairline); display: grid; gap: var(--space-2); }
.stat b { font: 400 44px/1 var(--font-display); letter-spacing: -.02em; }
.stat .label { color: var(--ink-muted); }
.empty { padding: var(--space-7) var(--space-5); text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); color: var(--ink-muted); display: grid; gap: var(--space-3); justify-items: center; }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.d2-btn .i { width: 18px; height: 18px; }
.d2-btn--danger { background: transparent; color: var(--neon-ink); border-color: var(--neon-ink); }
.d2-btn--danger:hover { background: var(--surface-300); }

/* Hero card on the dashboard: glass over ink */
.next { border-radius: var(--radius-lg); overflow: hidden; padding: var(--space-6); display: grid; gap: var(--space-6); min-height: 300px; align-content: space-between; border: 1px solid var(--hairline); }
@media (max-width: 560px) { .next { padding: var(--space-5); } }
.next-when { font: 400 clamp(40px, 6vw, 64px)/1 var(--font-display); letter-spacing: -.02em; }
.next .d2-glass { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); }

/* Rhythm dots (after the halftone grid) */
.rhythm svg { display: block; width: 100%; height: auto; }
.rhythm circle { fill: var(--cobalt); }
.rhythm-legend { display: flex; justify-content: space-between; margin-top: var(--space-3); }

/* Lessons list */
.list { display: grid; gap: var(--space-3); }
.item { display: grid; grid-template-columns: 72px 1fr auto; gap: var(--space-5); align-items: center; padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); background: var(--surface-200); border: 1px solid var(--hairline); }
.item.is-past { opacity: .72; }
.item.is-cancelled .item-title { text-decoration: line-through; }
.item-date { display: grid; justify-items: center; gap: 2px; padding: var(--space-2) 0; border-right: 1px solid var(--hairline); padding-right: var(--space-4); }
.item-date b { font: 400 40px/1 var(--font-display); }
.item-date span { color: var(--ink-muted); }
.item-body { display: grid; gap: var(--space-1); min-width: 0; }
.item-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; color: var(--ink-muted); }
.item-title { font: 600 18px/1.3 var(--font-sans); }
@media (max-width: 680px) { .item { grid-template-columns: 56px 1fr; } .item .row-actions { grid-column: 1 / -1; } .item-date b { font-size: 32px; } }

/* Module cards */
.module { display: grid; gap: var(--space-3); align-content: start; padding: var(--space-5); border-radius: var(--radius-md); background: var(--surface-200); border: 1px solid var(--hairline); }
.module h3 { font: 600 19px/1.3 var(--font-sans); }
.file { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-sm); background: var(--surface-300); min-width: 0; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.file a { color: var(--cobalt); }
.file-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file > .i { color: var(--cobalt); }

/* Homework */
.hw { display: grid; gap: var(--space-4); padding: var(--space-5); border-radius: var(--radius-md); background: var(--surface-200); border: 1px solid var(--hairline); }
.hw-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); align-items: flex-start; }
.hw-title { font: 600 18px/1.3 var(--font-sans); }
.hw-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); }
.feedback { padding: var(--space-4) var(--space-5); border-radius: var(--radius-sm); background: var(--cobalt-wash); color: var(--ink); white-space: pre-wrap; }
.feedback .label { display: block; color: var(--cobalt-deep); margin-bottom: var(--space-2); }
.grade { font: 400 36px/1 var(--font-display); color: var(--cobalt); }
.tabs { display: inline-flex; gap: 2px; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-300); }
.tabs button { height: 34px; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink-muted); font: 500 14px/1 var(--font-sans); cursor: pointer; }
.tabs button.is-active { background: var(--surface-200); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; }

/* Students table */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font: 500 11px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); padding: 0 var(--space-3) var(--space-3); border-bottom: 1px solid var(--hairline); }
.table td { padding: var(--space-4) var(--space-3); border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.table tr.is-off td { opacity: .55; }
.table-wrap { overflow-x: auto; }
@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: var(--space-4) 0; border-bottom: 1px solid var(--hairline); }
  .table td { border: 0; padding: var(--space-1) 0; }
}

/* Forms */
.form { display: grid; gap: var(--space-4); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.field { display: grid; gap: var(--space-2); }
.field > .label { color: var(--ink-muted); }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-100); color: var(--ink); font: var(--text-body); }
.field input[type=file] { padding: 8px; }
.field textarea { resize: vertical; min-height: 96px; }
.field .hint { color: var(--ink-muted); }
.req { color: var(--neon-ink); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-2); max-height: 200px; overflow: auto; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--surface-300); }
.checks label { display: flex; gap: var(--space-2); align-items: center; font: var(--text-body-sm); }
.checks input { width: 18px; height: 18px; accent-color: var(--cobalt); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: flex-end; margin-top: var(--space-2); }
.form-error { color: var(--neon-ink); min-height: 1.3em; }
.secret { font: 500 20px/1.2 var(--font-mono); letter-spacing: .06em; padding: var(--space-4); border-radius: var(--radius-sm); background: var(--cobalt-wash); color: var(--cobalt-deep); text-align: center; user-select: all; }

/* Modal */
.modal { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--hairline); border-radius: var(--radius-lg); background: var(--surface-200); color: var(--ink); box-shadow: var(--shadow-float); }
.modal::backdrop { background: rgba(12, 15, 26, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal-inner { padding: var(--space-6); display: grid; gap: var(--space-5); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); }
.modal-head h2 { font: 400 36px/1.05 var(--font-display); letter-spacing: -.015em; }

/* Toast */
.toast { position: fixed; z-index: 60; left: 50%; bottom: var(--space-6); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: var(--space-3) var(--space-5); border-radius: var(--radius-pill); background: var(--ink); color: var(--surface-100); font: 500 14px/1.3 var(--font-sans); transition: opacity .2s ease, transform .2s ease; max-width: calc(100vw - 32px); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 900px) { .toast { bottom: 96px; } }

/* ---------- Classroom ---------- */
.room { display: grid; grid-template-columns: 1fr 300px; gap: var(--space-5); align-items: start; }
.room-stage { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #0c0f1a; aspect-ratio: 16 / 10; min-height: 420px; }
.room-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.room-wait { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #efece4; padding: var(--space-6); }
.room-wait .gx-dots circle { fill: #8aa2ff; }
.room-side { display: grid; gap: var(--space-4); }
@media (max-width: 1100px) { .room { grid-template-columns: 1fr; } .room-stage { aspect-ratio: auto; height: 70vh; min-height: 360px; } }
.room-full .main { padding: var(--space-4); }

/* ---------- Ink blooms behind frosted glass ---------- */
body { background: var(--surface-100); }
#app { position: relative; z-index: 1; }
.app-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.app-bg .gx-bloom { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
[data-theme="dark"] .app-bg .gx-bloom { filter: invert(1) hue-rotate(180deg); mix-blend-mode: screen; opacity: .7; }
/* the login has its own art */
#app:has(.login) ~ .app-bg, body:has(.login) .app-bg { display: none; }
.app-bg ~ #app, #app { background: transparent; }

.side, .topbar, .panel, .stat, .item, .module, .hw, .empty, .modal, .table-wrap {
  background: color-mix(in srgb, var(--surface-200) 58%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  border-color: var(--glass-stroke);
  box-shadow: inset 1px 1px 0 color-mix(in srgb, var(--glass-specular) 70%, transparent), 0 10px 32px rgba(14,31,102,.07);
}
@media (min-width: 901px) { .side { border-right: 1px solid var(--glass-stroke); } }
.empty { border-style: dashed; border-color: var(--line-strong); }
.file { background: color-mix(in srgb, var(--surface-300) 70%, transparent); }
.modal { background: color-mix(in srgb, var(--surface-200) 86%, transparent); }
.next { border-color: var(--glass-stroke); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .side, .topbar, .panel, .stat, .item, .module, .hw, .empty, .modal, .table-wrap { background: var(--surface-200); }
}

/* phones: the top bar keeps its own height; extra space goes to the page */
@media (max-width: 900px) {
  .shell { grid-template-rows: auto 1fr; align-content: start; }
  .topbar { border-bottom: 1px solid var(--glass-stroke); }
}

/* Light / Dark switch */
.theme-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--surface-300) 80%, transparent); border: 1px solid var(--hairline); }
.theme-switch button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink-muted); font: 500 13px/1 var(--font-sans); cursor: pointer; }
.theme-switch button .i { width: 16px; height: 16px; }
.theme-switch button.is-active { background: var(--surface-200); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.theme-switch.is-compact button { width: 34px; padding: 0; justify-content: center; }
.side-foot .theme-switch { justify-self: start; }
.login-top .side-tools { display: flex; align-items: center; gap: var(--space-2); }
.switch-row { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--cobalt); }
.switch-row input:disabled + span { color: var(--ink-muted); }

/* Headings match the public site: Schibsted Grotesk 800, the highlighted word in cobalt (upright) */
.page-head h1.display-title, .login-card h1.display-title, .modal-head h2, .next-when {
  font-family: var(--font-sans); font-weight: 800; letter-spacing: -.04em; line-height: 1.02; }
.page-head h1.display-title { font-size: clamp(34px, 4.4vw, 52px); }
.login-card h1.display-title { font-size: clamp(36px, 5vw, 50px); }
.modal-head h2 { font-size: 28px; }
.next-when { font-size: clamp(34px, 5vw, 54px); }
.page-head h1 em, .login-card h1 em, .modal-head h2 em, .next-when em { font-style: normal; color: var(--cobalt); }
.stat b, .grade, .item-date b { font-family: var(--font-sans); font-weight: 800; letter-spacing: -.04em; }
.stat b { font-size: 40px; }
.grade { font-size: 28px; }
.item-date b { font-size: 34px; }
