/* Layout: app shell — sidebar fixa + topbar + área de conteúdo em grid de cards. Tema escuro (design system INTERA). */
:root {
  color-scheme: dark;
  --bg: #0b0c18;
  --surface: #141629;
  --surface-2: #1b1e36;
  --surface-3: #232744;
  --line: #2a2e50;
  --line-soft: #1f2340;
  --fg: #e9eaf7;
  --fg-2: #b4b7d6;
  --muted: #7d81a8;
  --primary: #3f43ca;
  --primary-hi: #6a6ef0;
  --secondary: #6705b8;
  --secondary-hi: #9a4be0;
  --grad: linear-gradient(135deg, #3f43ca 0%, #6705b8 100%);
  --good: #34c77b;
  --warn: #e3b341;
  --bad: #ef5d5d;
  --info: #5aa8f0;
  --c1: #7c80f2; --c2: #1fa893; --c3: #c27f17; --c4: #d5568f;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
a { color: var(--primary-hi); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary-hi); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.fg2 { color: var(--fg-2); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.8; flex: none; }
.i-sm svg.lucide, svg.lucide.i-sm { width: 15px; height: 15px; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.login-art {
  position: relative; overflow: hidden; padding: 48px;
  background: radial-gradient(1200px 600px at -10% -10%, rgba(103,5,184,.55), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, rgba(63,67,202,.6), transparent 60%), #0e0f22;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.login-art .grid-dots {
  position: absolute; inset: 0; opacity: .18; pointer-events: none;
  background-image: radial-gradient(#9da0ff 1px, transparent 1px); background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000, transparent 85%);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 18px; position: relative; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 6px 24px rgba(63,67,202,.45); }
.brand-mark svg { width: 20px; height: 20px; }
.login-hero { position: relative; max-width: 520px; display: grid; gap: 18px; }
.login-hero h1 { font-size: clamp(28px, 3.4vw, 42px); line-height: 1.12; font-weight: 800; letter-spacing: -.03em; }
.login-hero h1 em { font-style: normal; background: linear-gradient(90deg, #9fa2ff, #c78bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero p { color: var(--fg-2); font-size: 15px; max-width: 46ch; }
.login-preview { position: relative; display: grid; gap: 10px; max-width: 420px; }
.bubble { padding: 10px 14px; border-radius: 14px; font-size: 13px; max-width: 85%; }
.bubble.me { justify-self: end; background: var(--primary); border-bottom-right-radius: 4px; }
.bubble.ai { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); border-bottom-left-radius: 4px; }
.login-stats { position: relative; display: flex; gap: 28px; flex-wrap: wrap; }
.login-stats b { display: block; font-size: 22px; }
.login-form-wrap { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 420px; display: grid; gap: 20px; }
.role-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.role-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; cursor: pointer;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); text-align: left; font-size: 12.5px; font-weight: 600;
  transition: border-color .15s, background .15s;
}
.role-chip:hover { border-color: var(--primary-hi); }
.role-chip.on { border-color: var(--primary-hi); background: rgba(63,67,202,.18); }
.role-chip svg.lucide { color: var(--primary-hi); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--fg-2); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2);
  border: 1px solid var(--line); outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--primary-hi); }
textarea.input { resize: vertical; min-height: 90px; }
.input-icon { position: relative; }
.input-icon svg.lucide { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.input-icon .input { padding-left: 36px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--primary-hi); width: 16px; height: 16px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line); cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: var(--fg-2); transition: .2s; }
.switch input:checked + span { background: var(--primary); border-color: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); background: #fff; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  padding: 9px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2);
  font-weight: 600; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 4px 18px rgba(63,67,202,.35); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--fg); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn.icon { padding: 8px; }
.btn svg.lucide { width: 16px; height: 16px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface);
  border-right: 1px solid var(--line-soft); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px;
}
.sidebar .brand { padding: 2px 8px; }
.school-pill { margin: 0 4px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-soft); display: grid; gap: 2px; }
.nav-group { display: grid; gap: 2px; }
.nav-group .eyebrow { padding: 0 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--fg-2);
  cursor: pointer; font-size: 13.5px; font-weight: 500; border: 0; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--fg); }
.nav-item.on { background: rgba(63,67,202,.2); color: #fff; }
.nav-item.on svg.lucide { color: var(--primary-hi); }
.nav-item .count { margin-left: auto; font-size: 11px; background: var(--secondary); color: #fff; padding: 1px 7px; border-radius: 99px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px;
  background: rgba(11,12,24,.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft);
}
.topbar .search { flex: 1; max-width: 420px; }
.topbar .spacer { flex: 1; }
.role-switch { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.role-switch select { background: var(--surface-2); border: 0; border-radius: 99px; padding: 6px 10px; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.demo-tag { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #d9b8ff; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; background: var(--grad); flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 72px; height: 72px; font-size: 22px; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid var(--bg); }
.content { padding: 24px 28px 48px; display: grid; gap: 20px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.menu-btn { display: none; }

/* ---------- Cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 18px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.card.flat { background: transparent; border-style: dashed; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head .t { display: flex; align-items: center; gap: 8px; }
.card-head .t svg.lucide { color: var(--primary-hi); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.span2 { grid-column: span 2; }
.stack { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hero-card {
  border-radius: var(--r-lg); padding: 22px; position: relative; overflow: hidden;
  background: radial-gradient(600px 240px at 100% 0%, rgba(154,75,224,.35), transparent 60%), linear-gradient(135deg, #24288f, #3d0b78);
  border: 1px solid rgba(255,255,255,.08); display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.hero-card h1 { font-size: 22px; }
.hero-card p { color: #d5d6f5; max-width: 60ch; }

/* KPI */
.kpi { display: grid; gap: 6px; }
.kpi .v { font-size: 26px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(63,67,202,.18); color: var(--primary-hi); }
.delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

/* Badges / pills */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--fg-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: none; }
.badge.dot::before { display: block; }
.badge.good { background: rgba(52,199,123,.14); color: #6fdda3; }
.badge.warn { background: rgba(227,179,65,.14); color: #f0cb72; }
.badge.bad { background: rgba(239,93,93,.15); color: #ff8f8f; }
.badge.info { background: rgba(90,168,240,.14); color: #8fc4f5; }
.badge.brand { background: rgba(106,110,240,.18); color: #a9abff; }
.badge.purple { background: rgba(154,75,224,.18); color: #cfa2f5; }
.tag { display: inline-flex; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line-soft); color: var(--fg-2); }

/* Progress */
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--grad); }
.bar.good > i { background: var(--good); }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }
.bar.thin { height: 5px; }

/* Lists */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--fg-2); }
.list-item.click { cursor: pointer; border-radius: 8px; padding-inline: 8px; }
.list-item.click:hover { background: var(--surface-2); }
.subj-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.stripe { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: rgba(255,255,255,.02); }
table.t td.r, table.t th.r { text-align: right; }

/* Tabs / segmented */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.tab { padding: 9px 14px; border: 0; background: none; color: var(--muted); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--fg); }
.tab.on { color: var(--fg); border-color: var(--primary-hi); }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-soft); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface-3); color: var(--fg); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters select.input, .filters .input { width: auto; padding: 7px 10px; font-size: 13px; }

/* Charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-l { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis-l { stroke: var(--line); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--fg-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tip {
  position: fixed; z-index: 100; pointer-events: none; padding: 8px 10px; border-radius: 8px; font-size: 12px;
  background: #0a0b17; border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.4); display: grid; gap: 2px; max-width: 240px;
}
.heat { display: grid; gap: 3px; font-size: 12px; }
.heat .cell { border-radius: 5px; padding: 8px 4px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; cursor: default; color: #fff; transition: transform .1s; }
.heat .cell:hover { transform: scale(1.06); outline: 1px solid rgba(255,255,255,.4); }
.heat .rh { color: var(--fg-2); padding: 8px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat .ch { color: var(--muted); font-size: 11px; text-align: center; padding: 4px 2px; white-space: nowrap; }
.heat-scale { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.heat-scale i { width: 22px; height: 10px; border-radius: 3px; display: inline-block; }

/* Chat */
.chat { display: grid; grid-template-columns: 260px minmax(0, 1fr); height: calc(100vh - 140px); min-height: 520px; border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.chat-side { border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; min-height: 0; }
.chat-side .head { padding: 14px; border-bottom: 1px solid var(--line-soft); display: grid; gap: 10px; }
.conv-list { overflow-y: auto; padding: 8px; display: grid; gap: 2px; align-content: start; }
.conv { padding: 10px; border-radius: 10px; cursor: pointer; display: grid; gap: 3px; border: 0; background: none; text-align: left; width: 100%; }
.conv:hover { background: var(--surface-2); }
.conv.on { background: rgba(63,67,202,.18); }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-top { padding: 12px 18px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.msgs { flex: 1; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 78%; display: grid; gap: 6px; }
.msg .b { padding: 11px 14px; border-radius: 14px; line-height: 1.55; }
.msg.me { align-self: flex-end; }
.msg.me .b { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai .b { background: var(--surface-2); border: 1px solid var(--line-soft); border-bottom-left-radius: 4px; }
.msg.ai .who { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.msg .b ol, .msg .b ul { margin: 6px 0 0; padding-left: 18px; }
.msg .b code, .formula { font-family: var(--mono); background: rgba(255,255,255,.06); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
.insight { display: flex; gap: 8px; align-items: flex-start; padding: 9px 11px; border-radius: 10px; font-size: 12.5px; background: rgba(154,75,224,.12); border: 1px solid rgba(154,75,224,.3); color: #e2c8fa; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 18px 10px; }
.chip { padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { border-color: var(--primary-hi); }
.chip.on { border-color: var(--primary-hi); background: rgba(63,67,202,.2); }
.composer { display: flex; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line-soft); align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; }
.typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); margin-right: 3px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Flashcards */
.flash-stage { perspective: 1200px; }
.flash { position: relative; height: 280px; cursor: pointer; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.flash.flip { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 20px; padding: 28px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 12px; border: 1px solid var(--line); }
.flash .front { background: linear-gradient(160deg, #1f2250, #1a1c3a); }
.flash .back { background: linear-gradient(160deg, #2e0d57, #1d1240); transform: rotateY(180deg); }
.flash .q { font-size: 21px; font-weight: 650; max-width: 32ch; }

/* Quiz */
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left; width: 100%; }
.opt:hover { border-color: var(--primary-hi); }
.opt .l { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); font-weight: 700; font-size: 12px; flex: none; }
.opt.sel { border-color: var(--primary-hi); background: rgba(63,67,202,.15); }
.opt.ok { border-color: var(--good); background: rgba(52,199,123,.1); }
.opt.ko { border-color: var(--bad); background: rgba(239,93,93,.1); }

/* Timeline */
.tl { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 70px 28px minmax(0,1fr); gap: 10px; }
.tl-item .when { font-size: 12px; color: var(--muted); padding-top: 8px; text-align: right; }
.tl-item .node { display: flex; flex-direction: column; align-items: center; }
.tl-item .node b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); margin-top: 3px; }
.tl-item .node b svg.lucide { width: 14px; height: 14px; }
.tl-item .node i { flex: 1; width: 2px; background: var(--line-soft); margin: 4px 0; }
.tl-item .body { padding: 6px 0 18px; display: grid; gap: 4px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 4px; }
.cal .dow { font-size: 11px; color: var(--muted); text-align: center; padding: 6px 0; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.cal .day { min-height: 96px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-soft); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .day.out { opacity: .35; }
.cal .day.today { border-color: var(--primary-hi); box-shadow: inset 0 0 0 1px var(--primary-hi); }
.cal .day .n { font-size: 12px; font-weight: 600; color: var(--fg-2); }
.ev { font-size: 11px; padding: 2px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.ev.prova { background: rgba(239,93,93,.2); color: #ffb0b0; }
.ev.simulado { background: rgba(194,127,23,.25); color: #f3c77c; }
.ev.revisao { background: rgba(31,168,147,.22); color: #7fe0cf; }
.ev.evento { background: rgba(124,128,242,.22); color: #c0c2ff; }
.ev.reuniao { background: rgba(213,86,143,.22); color: #f5a9cb; }
.ev.prazo { background: rgba(90,168,240,.2); color: #a8d2f8; }

/* Upload */
.drop { border: 2px dashed var(--line); border-radius: var(--r-lg); padding: 32px; display: grid; place-items: center; gap: 10px; text-align: center; background: rgba(63,67,202,.05); cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--primary-hi); background: rgba(63,67,202,.12); }
.drop .ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: rgba(63,67,202,.2); color: var(--primary-hi); }

/* Library */
.mat { display: grid; gap: 10px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line-soft); cursor: pointer; transition: border-color .15s, transform .15s; }
.mat:hover { border-color: var(--primary-hi); transform: translateY(-2px); }
.mat .thumb { height: 104px; border-radius: 10px; display: grid; place-items: center; position: relative; overflow: hidden; }
.mat .thumb svg.lucide { width: 34px; height: 34px; color: rgba(255,255,255,.9); }
.mat .thumb .fmt { position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: rgba(0,0,0,.35); color: #fff; }

/* Files */
.folder { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line-soft); cursor: pointer; }
.folder:hover { border-color: var(--primary-hi); }
.folder .ic { color: #c9a0f5; }

/* Plan blocks */
.plan-day { border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--surface-2); padding: 14px; display: grid; gap: 10px; }
.plan-day [contenteditable] { outline: none; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
.plan-day [contenteditable]:hover { background: rgba(255,255,255,.04); }
.plan-day [contenteditable]:focus { background: rgba(63,67,202,.15); }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 99px; background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.step b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 11px; }
.step.on { color: var(--fg); }
.step.on b { background: var(--grad); color: #fff; }

/* Trilhas */
.trail { display: grid; gap: 0; }
.trail-step { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 12px; }
.trail-step .dot { display: flex; flex-direction: column; align-items: center; }
.trail-step .dot b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); background: var(--surface); font-size: 12px; }
.trail-step .dot b svg.lucide { width: 15px; height: 15px; }
.trail-step.done .dot b { background: var(--good); border-color: var(--good); color: #062b17; }
.trail-step.now .dot b { border-color: var(--primary-hi); box-shadow: 0 0 0 4px rgba(106,110,240,.2); color: var(--primary-hi); }
.trail-step .dot i { flex: 1; width: 2px; background: var(--line); margin: 3px 0; min-height: 14px; }
.trail-step.done .dot i { background: var(--good); }
.trail-step .body { padding: 4px 0 16px; display: grid; gap: 6px; }

/* Toast / Modal / Drawer */
.toast-wrap { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); right: 20px; z-index: 200; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; background: #1c1f3c; border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,.45); font-size: 13px; animation: tin .25s ease-out; }
.toast svg.lucide { color: var(--good); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }
.overlay { position: fixed; inset: 0; z-index: 150; background: rgba(5,6,15,.6); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; display: grid; gap: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.drawer-overlay { place-items: stretch end; padding: 0; }
.drawer { width: min(440px, 100%); height: 100%; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); padding: 22px; display: grid; gap: 16px; align-content: start; animation: din .25s ease-out; }
@keyframes din { from { transform: translateX(30px); opacity: 0; } }

.empty { padding: 28px; text-align: center; color: var(--muted); }
.ai-spark { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: linear-gradient(90deg, rgba(63,67,202,.3), rgba(103,5,184,.3)); color: #d6c4ff; border: 1px solid rgba(154,75,224,.35); }
.ai-spark svg.lucide { width: 13px; height: 13px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.divider { height: 1px; background: var(--line-soft); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1, .g-1-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 120; width: 270px; transform: translateX(-100%); transition: transform .25s; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  .shell.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .topbar .search { display: none; }
  .content { padding: 18px 16px 40px; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 16px; }
  .login-preview, .login-stats { display: none; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-side { display: none; }
  .msgs { min-height: 420px; }
}
@media (max-width: 640px) {
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .v { font-size: 21px; }
  .span2 { grid-column: auto; }
  .role-switch .demo-tag { display: none; }
  .msg { max-width: 92%; }
  .cal .day { min-height: 64px; padding: 4px; }
  .cal .ev { font-size: 0; height: 6px; padding: 0; }
  .tl-item { grid-template-columns: 0 28px minmax(0,1fr); }
  .tl-item .when { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
