/* Notalis — sistema visual
   Papel de caderno quente · tinta azul de caneta · marcador amarelo para o que importa.
   Só tema claro (de propósito).
   Só fontes do sistema (sem CDNs — a CSP também não deixaria). */

:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --surface: #fffefb;
  --surface-2: #f4f1ea;
  --surface-3: #ebe7dd;
  --border: #e7e2d7;
  --border-2: #d7d0c1;
  --text: #1c1a17;
  --muted: #69645a;
  --faint: #9a9488;
  --accent: #2346c8;          /* azul caneta */
  --accent-hover: #1b39a8;
  --accent-2: #5b7cf0;
  --accent-soft: #dde4fb;
  --accent-softer: #eef1fc;
  --on-accent: #ffffff;
  --marker: #ffd43b;          /* marcador fluorescente */
  --marker-soft: #fff1b8;
  --green: #1f7a45;
  --green-soft: #e2f2e7;
  --amber: #925600;
  --amber-soft: #fcefd3;
  --red: #c2341e;
  --red-soft: #fbe6e1;
  --rule: rgba(35, 70, 200, .07);   /* linhas do caderno */
  --margin-line: rgba(194, 52, 30, .22);
  --line: 28px;                      /* altura da pauta (o texto da conversa assenta nela) */
  --note-yellow: #fff2a8;            /* post-its */
  --note-blue: #dfe7ff;
  --note-pink: #ffe0e6;
  --note-green: #dcf2e1;
  --note-peach: #ffe6c9;
  --note-tile: rgba(255, 255, 255, .6);
  --tape: rgba(255, 255, 255, .55);

  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", monospace;

  --radius: 16px;
  --radius-m: 12px;
  --radius-s: 9px;
  --radius-pill: 999px;
  --shadow-s: 0 1px 2px rgba(40, 33, 20, .06);
  --shadow: 0 1px 2px rgba(40, 33, 20, .05), 0 6px 20px rgba(40, 33, 20, .06);
  --shadow-lg: 0 2px 6px rgba(40, 33, 20, .08), 0 18px 48px rgba(40, 33, 20, .14);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --topbar-h: 58px;
  font-size: 15px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* o atributo hidden ganha sempre ao display das classes */
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
::selection { background: var(--marker-soft); color: var(--text); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-s); }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3.5px; }
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--accent); color: var(--on-accent);
  padding: 8px 14px; border-radius: var(--radius-s); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 10px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- shell ---------- */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
#main { flex: 1; overflow-y: auto; padding: 14px 16px 16px; display: flex; flex-direction: column; min-height: 0; }
#main:focus { box-shadow: none; }
#main.is-auth { padding: 0; }

.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 14px 0 18px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--border); backdrop-filter: saturate(1.2) blur(8px); z-index: 5;
}
.topbar[hidden] { display: none; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-serif); font-size: 21px; font-weight: 700; letter-spacing: -.2px;
  color: var(--text); text-decoration: none; border-radius: 10px; }
a.brand:hover { opacity: .85; }
a.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.logo-mark { display: block; flex: none; }
.tb-title {
  color: var(--muted); font-size: 13.5px; padding-left: 14px; border-left: 1px solid var(--border-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tb-sep { width: 1px; height: 22px; background: var(--border-2); margin: 0 6px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13.5px;
}
img.avatar { object-fit: cover; background: var(--surface-3); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: var(--radius-pill);
  border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.user-chip:hover { background: var(--surface-2); }
.owner-tag { display: inline-flex; align-items: center; gap: 4px; }
.owner-tag .avatar { font-weight: 700; }

/* ---------- coluna da conversa: seletor Assistente | Turmas, na mesma barra ---------- */
.mode-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-3); flex: none; }
.mode-seg button {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: none; border-radius: 999px;
  background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; position: relative;
}
.mode-seg button .ic { width: 15px; height: 15px; }
.mode-seg button:hover { color: var(--text); }
.mode-seg button.on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(40, 33, 20, .12); }
.mode-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mode-badge { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff;
  font-size: 10.5px; display: inline-flex; align-items: center; justify-content: center; }
.mode-badge[hidden] { display: none; }
.chat-mode { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-mode[hidden] { display: none !important; }
.chat-mode .chat-top { gap: 10px; }
@media (max-width: 1080px) {
  .chat-mode .chat-top { flex-wrap: nowrap; }
  .sess-btn { min-width: 0; flex: 0 1 auto; }
  .sess-btn span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-mode .chat-top .mode-toggle { margin-left: auto; flex: none; }
}
@media (max-width: 900px) {
  .mode-seg button span:not(.mode-badge) { display: none; }   /* tablet ao alto: o seletor fica só com ícones */
  .mode-seg button { padding: 6px 10px; }
  .sess-btn span { max-width: 120px; }
}
.mode-toggle { white-space: nowrap; }
.tchat-people { display: inline-flex; align-items: center; gap: 8px; border: none; background: none; padding: 3px 8px;
  border-radius: 999px; cursor: pointer; color: var(--muted); font: inherit; font-size: 12.5px; }
.tchat-people:hover { background: var(--surface-2); color: var(--text); }
.tchat-stack { display: inline-flex; }
.tchat-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.tchat-stack .avatar + .avatar { margin-left: -7px; }
.tchat-menu-wrap { position: relative; margin-left: auto; }
.tchat-menu { right: 0; left: auto; top: calc(100% + 6px); min-width: 250px; }
.tchat-menu[hidden] { display: none; }
.tchat-menu .item { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: none;
  text-align: left; font: inherit; color: var(--text); cursor: pointer; }
.tchat-menu .item:hover { background: var(--surface-2); }
.turma-select { width: auto; max-width: 260px; padding-top: 6px; padding-bottom: 6px; font-weight: 600; }
.tchat-note:empty { display: none; }
.tchat-empty { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 20px 8px; padding: 10px 12px;
  border: 1px dashed var(--border-2); border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.tchat-empty .ic { width: 18px; height: 18px; color: var(--accent); flex: none; }
.tchat-empty span { flex: 1 1 200px; }
.tchat-older { display: block; margin: 0 auto 12px; }
.tmsg { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 12px; max-width: 86%; }
.tmsg.mine { margin-left: auto; flex-direction: row-reverse; }
.tmsg-col { display: flex; flex-direction: column; min-width: 0; position: relative; }
.tmsg.mine .tmsg-col { align-items: flex-end; }
.tmsg-head { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--faint); margin: 0 4px 3px; }
.tmsg-head b { color: var(--text); font-size: 12.5px; }
.tmsg-bubble { padding: 9px 13px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border);
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; border-bottom-left-radius: 5px; }
.tmsg.mine .tmsg-bubble { background: var(--accent); color: var(--on-accent, #fff); border-color: var(--accent);
  border-bottom-left-radius: 16px; border-bottom-right-radius: 5px; }
.tmsg.deleted .tmsg-bubble { font-style: italic; opacity: .6; background: none; color: var(--muted); border-style: dashed; }
.tmsg-del { position: absolute; top: -4px; right: -30px; border: none; background: none; color: var(--faint); cursor: pointer;
  opacity: 0; padding: 4px; border-radius: 8px; }
.tmsg.mine .tmsg-del { right: auto; left: -30px; }
.tmsg:hover .tmsg-del, .tmsg-del:focus-visible { opacity: 1; }
.tmsg-del:hover { color: var(--red); background: var(--surface-2); }
.tmsg-del .ic { width: 15px; height: 15px; }

/* ---------- anexos nas conversas ---------- */
.attach-btn { flex: none; width: 36px; height: 36px; margin-bottom: 4px; border: none; background: none; border-radius: 10px;
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.attach-btn:hover { background: var(--surface-2); color: var(--accent); }
.attach-btn .ic { width: 19px; height: 19px; }
.chat-input-box { padding-left: 6px; }
.attach-tray { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 6px; }
.attach-tray[hidden] { display: none; }
.attach-chip { display: flex; align-items: center; gap: 8px; max-width: 240px; padding: 5px 6px 5px 5px;
  border: 1px solid var(--border-2); border-radius: 12px; background: var(--surface); }
.attach-chip img { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; flex: none; }
.attach-meta { display: flex; flex-direction: column; min-width: 0; }
.attach-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-size { font-size: 11.5px; color: var(--faint); }
.attach-x { flex: none; border: none; background: none; color: var(--faint); cursor: pointer; border-radius: 8px; padding: 3px; }
.attach-x:hover { background: var(--surface-2); color: var(--red); }
.attach-x .ic { width: 14px; height: 14px; }
.att-ext { flex: none; width: 38px; height: 38px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 800; letter-spacing: .3px; color: #fff; background: var(--muted); }
.att-pdf { background: #c0392b; } .att-docx { background: #2b5797; } .att-pptx { background: #c4512a; }
.att-xlsx { background: #217346; } .att-txt, .att-md { background: #6b6b6b; }
.msg-attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.msg.user .msg-attachments, .tmsg.mine .msg-attachments { align-items: flex-end; }
.att-grid { display: grid; gap: 4px; max-width: 320px; }
.att-grid.n2, .att-grid.n3, .att-grid.n4 { grid-template-columns: 1fr 1fr; }
.att-thumb { padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2);
  cursor: zoom-in; display: block; }
.att-thumb img { display: block; width: 100%; max-height: 240px; object-fit: cover; }
.att-grid.n2 .att-thumb img, .att-grid.n3 .att-thumb img, .att-grid.n4 .att-thumb img { height: 130px; }
.att-file { display: flex; align-items: center; gap: 10px; max-width: 320px; padding: 7px 10px 7px 7px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; }
.att-file:hover { border-color: var(--accent); }
.att-file-meta { display: flex; flex-direction: column; min-width: 0; }
.att-file-meta b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file-meta span { font-size: 11.5px; color: var(--muted); }
.drop-on { outline: 2px dashed var(--accent); outline-offset: -8px; }

/* ---------- turmas ---------- */
.src-filter { flex: 1 1 auto; min-width: 0; width: auto; padding-top: 5px; padding-bottom: 5px; font-size: 12.5px; }
.turma-code-input::placeholder { text-transform: none; }
.turma-pick { border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px 4px; margin: 0 0 14px; }
.turma-pick legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.turma-opt { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 4px 0; cursor: pointer; }
.turma-opt input { accent-color: var(--accent); }
.turma-list, .member-list { display: flex; flex-direction: column; gap: 8px; }
.turma-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.turma-item:hover { border-color: var(--border-2); background: var(--surface-2); }
.turma-item .turma-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.turma-item .ic:last-child { transform: rotate(-90deg); color: var(--faint); }
.turma-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); display: inline-flex;
  align-items: center; justify-content: center; flex: none; }
.turma-sub, .member-sub { color: var(--muted); font-size: 12.5px; }
.member-bio { color: var(--text); font-size: 13px; margin-top: 2px; white-space: pre-line; }
.member { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); flex-wrap: wrap; }
.member-main { flex: 1 1 200px; min-width: 0; }
.member-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.turma-head h3 { flex-wrap: wrap; }
.invite { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px;
  border: 1px dashed var(--border-2); border-radius: 12px; background: var(--surface-2); }
.invite > div { flex: 1 1 140px; }
.invite-code { font-size: 18px; font-weight: 700; letter-spacing: 1px; color: var(--accent); }
.turma-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.scope-fld { max-width: 420px; }

/* ---------- topo em ecrãs estreitos (admin/equipa têm mais botões) ---------- */
@media (max-width: 520px) {
  .mode-seg button span:not(.mode-badge) { display: none; }     /* só ícones: tudo numa linha */
  .mode-seg button { padding: 6px 10px; }
  .tchat-count { display: none; }
  .turma-select { max-width: none; flex: 1 1 auto; min-width: 0; }
  .chat-mode .chat-top { flex-wrap: nowrap; gap: 6px; padding-left: 10px; padding-right: 8px; }
  .mode-toggle { white-space: nowrap; padding-left: 9px; padding-right: 9px; }
  .sess-btn { min-width: 0; }
  .sess-btn span { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tchat-people { padding: 2px 4px; }
  .topbar .brand span { display: none; }
  .topbar .iconbtn, .topbar .tb-btn { width: 40px; height: 40px; }
  .tb-actions { gap: 2px; }
  .user-chip { padding: 2px; }
}
@media (max-width: 360px) {
  .topbar .iconbtn, .topbar .tb-btn { width: 36px; height: 36px; }
  .topbar .iconbtn .ic { width: 16px; height: 16px; }
  .topbar .avatar { width: 26px !important; height: 26px !important; }
}

/* ---------- telemóvel: tabelas em cartões, painéis inteiros ---------- */
@media (max-width: 600px) {
  .panel-overlay .slide-panel { width: 100vw; border-left: none; }
  .table-wrap { overflow: visible; margin: 0; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr:first-child:has(th) { display: none; }
  .table tr { border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px;
    background: var(--surface); }
  .table td { border: none; padding: 4px 0; display: flex; gap: 10px; align-items: baseline; text-align: left !important;
    white-space: normal !important; overflow-wrap: anywhere; min-width: 0; }
  .table td > * { min-width: 0; overflow-wrap: anywhere; }
  .table td[data-label]::before { content: attr(data-label); flex: 0 0 38%; color: var(--faint); font-size: 11.5px;
    font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
  .table td:empty, .table td[data-label=""]::before { display: none; }
  .table td:last-child:not(:empty) { flex-wrap: wrap; justify-content: flex-start; padding-top: 8px; }
  .table td:last-child::before { content: none; }
}

/* ---------- suporte ---------- */
.ticket-list { display: flex; flex-direction: column; gap: 8px; }
.ticket-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.ticket-item:hover { background: var(--surface-2); }
.ticket-item.active { border-color: var(--accent); box-shadow: var(--ring); }
.ticket-item.unread { border-left: 4px solid var(--accent); }
.ticket-item.unread b { font-weight: 800; }
.ticket-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ticket-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.ticket-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.thread { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.msg-item { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.msg-item.from-staff { background: #f2f5ff; border-color: #d9e1fb; }
.msg-item.internal { background: #fff8d6; border-color: #f0dc8a; border-style: dashed; }
.msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.msg-when { margin-left: auto; color: var(--faint); font-size: 12px; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; }
.msg-atts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.msg-att { padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.msg-att img { display: block; width: 120px; height: 80px; object-fit: cover; }
.att-full { max-width: 100%; max-height: 70vh; display: block; border-radius: 8px; }
.composer textarea { margin-bottom: 8px; }
.composer.internal { background: #fff8d6; }
.composer-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.composer-files { color: var(--muted); font-size: 12.5px; flex: 1 1 120px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.composer-extra { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.desk-after { width: auto; padding-top: 5px; padding-bottom: 5px; font-size: 13px; }
.desk { max-width: 1280px; margin: 0 auto; }
.desk-top { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; }
.desk-top h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-family: var(--serif, Georgia, serif); }
.desk-cols { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.desk-left { display: flex; flex-direction: column; gap: 10px; }
.desk-list { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 290px); overflow: auto; padding: 2px; }
.desk-filters { display: flex; flex-direction: column; gap: 8px; }
.desk-counts { display: flex; gap: 6px; flex-wrap: wrap; }
.desk-count { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; color: var(--muted); }
.desk-count b { color: var(--text); }
.desk-requester { display: flex; gap: 10px; align-items: center; }
.desk-context { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.desk-context code { display: block; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.badge.prio-alta { background: #ffe7cc; color: #8a4b00; }
.badge.prio-urgente { background: #ffd6d6; color: #9b1c1c; }
.badge.prio-baixa { background: var(--surface-3); color: var(--muted); }
.desk-ticket { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 14px; align-items: start; }
.desk-aside { position: sticky; top: 8px; max-height: calc(100vh - 90px); overflow: auto; }
.student-card h3 { margin-bottom: 10px; }
.student-who { display: flex; gap: 12px; align-items: center; }
.student-id { min-width: 0; }
.student-id b { font-size: 15px; }
.student-email { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.small-ic { width: 26px; height: 26px; }
.small-ic .ic { width: 14px; height: 14px; }
.student-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.student-bio { font-size: 13px; margin: 10px 0 0; white-space: pre-line; color: var(--text); }
.student-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 12px 0 0; font-size: 13px; }
.student-facts dt { color: var(--muted); }
.student-facts dd { margin: 0; overflow-wrap: anywhere; }
.student-facts dd.warn { color: var(--red, #b42318); font-weight: 700; }
.student-sub { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }
.student-list { display: flex; flex-direction: column; gap: 6px; }
.student-row { border: 1px solid var(--border); border-radius: 10px; padding: 6px 9px; font-size: 13px; background: var(--surface); }
.link-row { text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; }
.link-row:hover { background: var(--surface-2); }
.student-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.student-activity { margin-top: 14px; font-size: 13px; }
.student-activity summary { cursor: pointer; font-weight: 600; margin-bottom: 6px; }
@media (max-width: 1250px) {
  .desk-ticket { grid-template-columns: 1fr; }
  .desk-aside { position: static; max-height: none; order: -1; }
}
@media (max-width: 900px) {
  .desk-cols { grid-template-columns: 1fr; }
  .desk-list { max-height: 45vh; }
}

/* ---------- perfil (Definições) ---------- */
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.profile-head .pf-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 2px var(--surface); }
.swatch[aria-checked="true"] { border-color: var(--text); }
.swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pf-preview { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px dashed var(--border-2);
  border-radius: 12px; background: var(--surface-2); margin: 4px 0 14px; }
.pf-preview .pf-name { font-weight: 700; }
.pf-preview .pf-sub { color: var(--muted); font-size: 12.5px; }
.pf-count { float: right; color: var(--faint); font-weight: 400; }
.user-chip .uname { font-size: 13.5px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn {
  position: relative; background: none; border: none; border-radius: 10px; width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none;
  transition: background .12s, color .12s;
}
.iconbtn:hover { background: var(--surface-3); color: var(--text); }
.iconbtn .ic { width: 19px; height: 19px; }
/* botões do topo: ícone + texto, bem visíveis */
.tb-btn {
  position: relative; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px 0 11px;
  border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; flex: none; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.tb-btn .ic { width: 17px; height: 17px; color: var(--accent); }
.tb-btn:hover { background: var(--surface-2); border-color: var(--faint); }
.tb-btn:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
.tb-btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.tb-btn.on .ic { color: inherit; }
.tb-btn .tb-badge { top: -5px; right: -5px; }
@media (max-width: 1180px) { .tb-title { display: none; } }
@media (max-width: 1000px) {
  .tb-btn { width: 36px; padding: 0; justify-content: center; }
  .tb-label { display: none; }
}
.tb-badge {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 5px;
  background: var(--red); color: #fff; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- botões e formulários ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 8px 15px; font-weight: 600; font-size: 13.5px; line-height: 1.3;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn .ic { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-s); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn.small { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: none; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-softer); }
.btn.block { width: 100%; padding: 11px 16px; font-size: 14.5px; }

.input, .select, textarea.input {
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text);
  border-radius: var(--radius-m); padding: 9px 13px; width: 100%; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:hover, .select:hover { border-color: var(--faint); }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); box-shadow: var(--ring); }
label.fld { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
label.fld > :first-child { display: block; margin-bottom: 5px; font-weight: 600; color: var(--text); font-size: 13px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 140px; }
input[type=checkbox] { accent-color: var(--accent); }

/* ---------- badges / estados ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.badge .ic { width: 12px; height: 12px; }
.badge.pendente { background: var(--amber-soft); color: var(--amber); }
.badge.processar { background: var(--accent-softer); color: var(--accent); }
.badge.pronto { background: var(--green-soft); color: var(--green); }
.badge.erro, .badge.sem_ocr { background: var(--red-soft); color: var(--red); }
.badge.partilhado { background: var(--accent-softer); color: var(--accent); }
.badge.privado { background: var(--surface-3); color: var(--muted); }
.badge.tipo { background: var(--surface-3); color: var(--muted); }
.badge.sec { background: var(--red-soft); color: var(--red); }
.badge.trend-up { background: var(--green-soft); color: var(--green); }
.badge.trend-down { background: var(--red-soft); color: var(--red); }
.badge.trend-zero { background: var(--surface-3); color: var(--muted); }

.spinner {
  width: 15px; height: 15px; border: 2px solid var(--border-2); border-top-color: var(--accent);
  border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: -3px; flex: none;
}
.spinner.light { border-color: color-mix(in srgb, var(--on-accent) 35%, transparent); border-top-color: var(--on-accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { color: var(--muted); text-align: center; padding: 34px 16px; font-size: 13.5px; line-height: 1.6; }
.empty .big { font-size: 30px; margin-bottom: 8px; }
.empty .empty-ico {
  width: 46px; height: 46px; border-radius: 14px; margin: 0 auto 12px; background: var(--surface-2);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--faint);
}
.empty .empty-ico .ic { width: 22px; height: 22px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 0 18px; overflow-x: auto; }
.tabs button {
  background: none; border: none; color: var(--muted); padding: 9px 13px; font-weight: 600; font-size: 13.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- cartões e tabelas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow-s); }
.card h3 { margin: 0 0 12px; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; color: var(--faint); font-weight: 600; padding: 7px 10px; border-bottom: 1px solid var(--border-2);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }

.dropzone {
  border: 2px dashed var(--border-2); border-radius: var(--radius); padding: 30px 22px; cursor: pointer;
  text-align: center; color: var(--muted); transition: border-color .15s, background .15s; font-size: 13.5px;
}
.dropzone:hover { border-color: var(--faint); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-softer); }

/* ---------- home: 3 painéis ---------- */
.seg.home-tabs { display: none; }
.home-grid {
  flex: 1; min-height: 0; display: grid; grid-template-columns: 318px minmax(0, 1fr) 286px; gap: 14px;
}
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden; box-shadow: var(--shadow);
}
.panel-head { padding: 15px 16px 10px; display: flex; align-items: center; gap: 9px; flex: none; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; letter-spacing: -.1px; }
.panel-head h2 .ic { color: var(--accent); }
.panel-head .count {
  background: var(--surface-3); color: var(--muted); border-radius: var(--radius-pill);
  padding: 0 8px; font-size: 11.5px; font-weight: 700; line-height: 1.7;
}
.panel-body { flex: 1; overflow-y: auto; padding: 2px 10px 12px; min-height: 0; }

/* ---------- fontes ---------- */
.fontes-actions { display: flex; gap: 8px; padding: 0 12px 10px; flex: none; }
.fontes-actions .btn { flex: 1; }
/* árvore: categoria (cadeira) → tipo → documentos */
.src-cat { margin-bottom: 6px; }
.src-cat-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-radius: var(--radius-m); }
.src-cat-head:hover { background: var(--surface-2); }
.src-cat-cb { width: 15px; height: 15px; flex: none; }
.src-cat-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: none; background: none;
  padding: 5px 2px; text-align: left; font-family: var(--font-serif); font-weight: 700; font-size: 14.5px; color: var(--text);
}
.src-cat-toggle .ic { width: 15px; height: 15px; color: var(--faint); transition: transform .15s; flex: none; }
.src-cat.closed .src-cat-toggle .ic { transform: rotate(-90deg); }
.src-cat-name { flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.src-cat-toggle .count {
  font-family: var(--font-sans); background: var(--surface-3); color: var(--muted); border-radius: var(--radius-pill);
  padding: 0 7px; font-size: 11px; font-weight: 700; line-height: 1.7;
}
.src-cat-body { margin-left: 17px; padding-left: 8px; border-left: 1px dashed var(--border-2); }
.src-cat.closed .src-cat-body { display: none; }
.src-type {
  display: flex; align-items: center; gap: 6px; padding: 8px 8px 1px; font-size: 11.5px; font-weight: 600;
  color: var(--faint);
}
.src-type-n { display: none; }
.src-type .ic { width: 13px; height: 13px; }
.src-type-n { margin-left: auto; font-variant-numeric: tabular-nums; }
.src-tools { display: none; gap: 2px; flex: none; }
.src-item:hover .src-tools, .src-item:focus-within .src-tools { display: flex; }
@media (hover: none) { .src-tools { display: flex; } }   /* ecrãs táteis: sem hover, ficam visíveis */
.src-tools .src-del { opacity: 1; }
.src-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: var(--radius-m);
  transition: background .1s;
}
.src-item:hover { background: var(--surface-2); }
.src-item input[type=checkbox] { margin-top: 9px; width: 15px; height: 15px; flex: none; }
.src-ico {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--accent-softer); color: var(--accent);
}
.src-ico .ic { width: 16px; height: 16px; }
.src-ico.t-exame { background: var(--amber-soft); color: var(--amber); }
.src-ico.t-notas { background: var(--green-soft); color: var(--green); }
.src-main { flex: 1; min-width: 0; }
.src-title {
  font-weight: 600; font-size: 13.5px; cursor: pointer; overflow: hidden; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word;
}
.src-title:hover { color: var(--accent); }
.src-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: 3px; }
.src-del {
  opacity: 0; background: none; border: none; color: var(--faint); border-radius: 7px; padding: 4px;
  display: inline-flex; transition: opacity .1s;
}
.src-del .ic { width: 15px; height: 15px; }
.src-item:hover .src-del, .src-del:focus-visible { opacity: 1; }
.src-del:hover { color: var(--red); background: var(--red-soft); }

/* ---------- chat ---------- */
.chat-top { display: flex; align-items: center; gap: 8px; padding: 12px 16px 8px; flex: none; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.sess-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px;
  font-weight: 600; font-size: 13px; color: var(--text); max-width: 340px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sess-btn:hover { background: var(--surface-3); }
.sess-btn .ic { width: 15px; height: 15px; color: var(--muted); }
.sess-menu {
  position: absolute; z-index: 30; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 260px; max-height: 340px; overflow-y: auto;
}
.sess-menu .item { padding: 8px 12px; border-radius: 9px; cursor: pointer; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-menu .item:hover { background: var(--surface-2); }
.sess-menu .item.active { background: var(--accent-softer); color: var(--accent); font-weight: 600; }
.sess-item { display: flex; align-items: center; gap: 6px; }
.sess-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-del { border: none; background: none; color: var(--faint); border-radius: 6px; padding: 3px; display: inline-flex; flex: none; }
.sess-del .ic { width: 15px; height: 15px; }
.sess-del:hover { color: var(--red); background: var(--red-soft); }
.mode-toggle {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--border-2); color: var(--muted); border-radius: var(--radius-pill);
  padding: 5px 12px; font-size: 12px; font-weight: 600;
}
.mode-toggle::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.mode-toggle:hover { color: var(--text); }
.mode-toggle.on { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.mode-toggle.on::before { background: var(--amber); }

.chat-msgs { flex: 1; overflow-y: auto; padding: 18px 24px 6px; min-height: 0; scroll-behavior: smooth; }
.chat-empty { max-width: 520px; margin: 7vh auto 0; text-align: center; padding: 0 10px; }
.chat-empty .logo-mark { margin: 0 auto 16px; }
.chat-empty h2 { font-family: var(--font-serif); font-size: 27px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.3px; }
.chat-empty p { color: var(--muted); margin: 0; font-size: 14px; }
.chat-empty .hl { background: linear-gradient(transparent 58%, var(--marker-soft) 58%); padding: 0 2px; }

.msg { max-width: 84%; margin-bottom: 18px; animation: rise .2s ease-out; }
@keyframes rise { from { transform: translateY(4px); opacity: 0; } }
.msg .bubble { padding: 11px 15px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; line-height: 1.6; }
.msg.user { margin-left: auto; }
.msg.user .bubble { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 5px; }
.msg.assistant { max-width: 92%; }
.msg.assistant .bubble { background: none; padding: 2px 2px; white-space: normal; }
.msg.assistant .name { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.msg.assistant .name .logo-mark { width: 20px; height: 20px; }
.msg .bubble pre {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px;
  overflow-x: auto; white-space: pre; font-size: 13px; font-family: var(--font-mono);
}
.msg .bubble code { background: var(--surface-3); padding: 1px 5px; border-radius: 5px; font-size: .88em; font-family: var(--font-mono); }
.msg .bubble pre code { padding: 0; background: none; }
.msg .bubble h3, .msg .bubble h4 { margin: 12px 0 4px; font-family: var(--font-serif); }
.msg .bubble ul { padding-left: 20px; margin: 6px 0; }
.msg .bubble strong { background: linear-gradient(transparent 62%, var(--marker-soft) 62%); }

/* citações: marcador numerado */
.cite {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 4px; border-radius: 6px; border: none; vertical-align: 1px; margin: 0 1px;
  background: var(--marker-soft); color: var(--text); font-size: 11px; font-weight: 700; line-height: 1;
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--marker) 70%, transparent);
}
.cite:hover { background: var(--marker); color: #1c1a17; }
.msg .src-row { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.src-chip {
  display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 3px 10px 3px 4px; font-size: 12px; color: var(--muted); max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.src-chip:hover { border-color: var(--border-2); color: var(--text); background: var(--surface-2); }
.src-chip .n {
  min-width: 18px; height: 18px; border-radius: 6px; background: var(--marker-soft); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700;
}

.suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 24px 2px; justify-content: center; }
.suggest:empty { display: none; }
.suggest button {
  display: inline-flex; align-items: center; gap: 7px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 13px; font-size: 13px; color: var(--text); font-weight: 500; box-shadow: var(--shadow-s);
  max-width: 100%;
}
.suggest button .ic { width: 15px; height: 15px; color: var(--accent); }
.suggest button:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-softer); }

.chat-input { display: flex; gap: 8px; padding: 10px 20px 16px; flex: none; align-items: flex-end; }
.chat-input-box {
  flex: 1; display: flex; align-items: flex-end; gap: 6px; background: var(--surface);
  border: 1px solid var(--border-2); border-radius: 16px; padding: 5px 5px 5px 16px; box-shadow: var(--shadow-s);
  transition: border-color .12s, box-shadow .12s;
}
.chat-input-box:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.chat-input textarea {
  flex: 1; border: none; background: none; resize: none; height: 44px; max-height: 180px; outline: none; padding: 10px 0;
  line-height: 1.5;
}
.chat-input textarea:focus-visible { box-shadow: none; }
.send-btn {
  width: 38px; height: 38px; border-radius: 11px; border: none; background: var(--accent); color: var(--on-accent);
  flex: none; display: inline-flex; align-items: center; justify-content: center; transition: background .12s;
}
.send-btn:hover { background: var(--accent-hover); }
.send-btn:disabled { background: var(--surface-3); color: var(--faint); cursor: default; }
.chat-disclaimer { text-align: center; font-size: 11.5px; color: var(--faint); padding: 0 20px 10px; margin-top: -8px; }

/* ---------- estúdio ---------- */
/* cada ferramenta é um post-it colado na página, com fita-cola e uma ligeira inclinação */
.studio-panel .panel-body { padding: 10px 16px 14px; }
.studio-card {
  --note: var(--note-yellow); --tilt: -1deg;
  position: relative; display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  margin: 0 0 11px; padding: 11px 12px 10px; border: none;
  background: var(--note);
  border-radius: 2px 2px 14px 2px;
  box-shadow: 0 1px 1px rgba(40, 33, 20, .06), 0 8px 14px -8px rgba(40, 33, 20, .3);
  transform: rotate(var(--tilt));
  transition: transform .18s cubic-bezier(.2, .7, .2, 1), box-shadow .18s;
}
.studio-card::before {             /* fita-cola */
  content: ""; position: absolute; top: -7px; left: 50%; width: 46px; height: 15px;
  transform: translateX(-50%) rotate(calc(var(--tilt) * -3));
  background: var(--tape); border: 1px solid rgba(40, 33, 20, .07);
  box-shadow: 0 1px 1px rgba(40, 33, 20, .05);
}
.studio-card:hover, .studio-card:focus-visible {
  transform: rotate(0deg) translateY(-2px);
  box-shadow: 0 1px 1px rgba(40, 33, 20, .06), 0 14px 22px -10px rgba(40, 33, 20, .35);
}
.studio-card.n-blue { --note: var(--note-blue); --tilt: .5deg; }
.studio-card.n-pink { --note: var(--note-pink); --tilt: -.4deg; }
.studio-card.n-green { --note: var(--note-green); --tilt: .6deg; }
.studio-card.n-peach { --note: var(--note-peach); --tilt: -.5deg; }
.studio-card .ico {
  width: 28px; height: 28px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--note-tile); color: var(--amber);
}
.studio-card.n-blue .ico { color: var(--accent); }
.studio-card.n-pink .ico { color: var(--red); }
.studio-card.n-green .ico { color: var(--green); }
.studio-card b { display: block; font-size: 13.5px; margin-bottom: 1px; font-family: var(--font-serif); }
.studio-card span.d { color: var(--muted); font-size: 11.5px; line-height: 1.4; display: block; }

/* ---------- a conversa é uma folha de caderno ---------- */
.panel-head h2 { font-family: var(--font-serif); font-size: 17px; font-weight: 700; }
.chat-panel { position: relative; }
.chat-msgs {
  /* margem vermelha + pauta; "local" faz as linhas andarem com o texto ao fazer scroll */
  background-image:
    linear-gradient(90deg, transparent 63px, var(--margin-line) 63px 65px, transparent 65px),
    repeating-linear-gradient(transparent 0 calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px) var(--line));
  background-attachment: local;
  padding: var(--line) 30px var(--line) 86px;
}
.chat-panel::before {              /* furos de argola, ao longo da margem */
  content: ""; position: absolute; left: 22px; top: 70px; bottom: 118px; width: 16px; z-index: 1; pointer-events: none;
  background: radial-gradient(circle at 8px 8px, var(--bg) 5.5px, var(--border-2) 6px, transparent 7px) 0 6px / 16px 56px repeat-y;
}
/* o texto assenta nas linhas: tudo em múltiplos da pauta */
.msg { margin-bottom: var(--line); }
.msg.assistant .name { line-height: var(--line); margin-bottom: 0; }
.msg.assistant .bubble { padding: 0; line-height: var(--line); font-size: 15px; }
.msg.assistant .bubble h3, .msg.assistant .bubble h4 { margin: 0; line-height: var(--line); }
.msg.assistant .bubble ul { margin: 0; }
/* as perguntas ficam "escritas a caneta azul" */
.msg.user { width: fit-content; }
.msg.user .bubble {
  text-align: left;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-hover);
  font-family: var(--font-serif); font-style: italic; font-size: 16px;
  line-height: calc(var(--line) - 2px); padding: 0 14px;
  border-radius: 12px 12px 4px 12px;
}
.msg .src-row { margin-top: 0; min-height: var(--line); align-items: center; }
.chat-empty { margin-top: calc(var(--line) * 2); }
.chat-empty .page-date {
  display: inline-block; font-family: var(--font-serif); font-style: italic; color: var(--accent);
  font-size: 15px; line-height: var(--line); margin-bottom: var(--line);
  padding: 0 4px; background: linear-gradient(transparent 60%, var(--marker-soft) 60%);
}
.chat-empty .logo-mark { display: none; }
.chat-empty h2 { line-height: calc(var(--line) * 1.5); margin-bottom: 0; }
.chat-empty p { line-height: var(--line); }
.chat-disclaimer { font-style: italic; }

/* fontes: as marcadas levam um traço de marcador fluorescente */
.src-item:has(input:checked) {
  background: linear-gradient(90deg, var(--marker) 0 3px, color-mix(in srgb, var(--marker-soft) 16%, transparent) 3px);
  border-radius: 4px var(--radius-m) var(--radius-m) 4px;
}
.src-item:has(input:checked):hover { background: linear-gradient(90deg, var(--marker) 0 3px, color-mix(in srgb, var(--marker-soft) 40%, transparent) 3px); }
.studio-hint {
  display: flex; gap: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; padding: 10px 6px 0;
  border-top: 1px dashed var(--border-2); margin-top: 6px;
}
.studio-hint .ic { width: 15px; height: 15px; margin-top: 1px; color: var(--faint); }

/* ---------- frequências ---------- */
.freq-row { display: grid; grid-template-columns: 170px 1fr 100px 85px 80px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.freq-row.head { color: var(--faint); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.bar { background: var(--surface-3); border-radius: 6px; height: 12px; overflow: hidden; }
.bar .fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 6px; }
.freq-topic { font-weight: 600; }

/* ---------- estado das cópias (admin) ---------- */
.backup-banner { display: grid; gap: 3px; font-size: 13px; padding: 10px 14px; margin: 0 0 14px; border-radius: var(--radius-s);
  background: var(--green-soft); border: 1px solid color-mix(in srgb, var(--green) 25%, transparent); color: var(--text); }
.backup-banner b { display: inline-flex; align-items: center; gap: 6px; color: var(--green); }
.backup-banner.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.backup-banner.warn b { color: var(--amber); }
.backup-banner.alert { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.backup-banner.alert b { color: var(--red); }
.backup-banner code { font-size: 12px; }

/* ---------- interruptor das definições ---------- */
.switch-row { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface-2); }
.switch-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }

/* ---------- exportar exame modelo ---------- */
.export-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 10px;
  background: var(--accent-softer); border: 1px solid var(--accent-soft); border-radius: var(--radius-s); }
.export-lbl { font-size: 13px; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 5px; }
.export-sol { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; margin-left: auto; cursor: pointer; }

/* ---------- flashcards ---------- */
.flashcard { perspective: 1200px; max-width: 540px; margin: 16px auto; cursor: pointer; }
.fc-inner { position: relative; width: 100%; min-height: 240px; transition: transform .5s cubic-bezier(.2, .7, .2, 1); transform-style: preserve-3d; }
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 18px;
  background-color: var(--surface);
  background-image: repeating-linear-gradient(transparent 0 27px, var(--rule) 27px 28px);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; padding: 28px; text-align: center;
  font-size: 17px; font-family: var(--font-serif); box-shadow: var(--shadow);
}
.fc-face.back { transform: rotateY(180deg); background-color: var(--surface-2); }
.fc-hint { text-align: center; color: var(--muted); font-size: 12px; }
.grade-row { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* cores por tema: --fc tinta, --fc-soft fundo, --fc-hl marcador do termo-chave */
.fc-plain { --fc: var(--accent); --fc-soft: var(--surface-2); --fc-hl: var(--marker-soft); }
.fc-c0 { --fc: #2346c8; --fc-soft: #dfe7ff; --fc-hl: #b9c8ff; }   /* azul */
.fc-c1 { --fc: #1f7a45; --fc-soft: #dcf2e1; --fc-hl: #ade0bb; }   /* verde */
.fc-c2 { --fc: #b0285a; --fc-soft: #ffe0e6; --fc-hl: #ffb9c9; }   /* rosa */
.fc-c3 { --fc: #9c4700; --fc-soft: #ffe6c9; --fc-hl: #ffc98c; }   /* laranja */
.fc-c4 { --fc: #6a3fb5; --fc-soft: #ece3fb; --fc-hl: #d3bff5; }   /* roxo */
.fc-c5 { --fc: #0d6b6f; --fc-soft: #d6f0ef; --fc-hl: #a3dcd8; }   /* azul-petróleo */
.fc-c6 { --fc: #765800; --fc-soft: #fff2a8; --fc-hl: #ffdd55; }   /* amarelo */
.flashcard .fc-face {
  flex-direction: column; justify-content: space-between; gap: 10px; padding: 16px 22px 14px;
  border: 1px solid color-mix(in srgb, var(--fc) 22%, var(--border)); border-top: 7px solid var(--fc);
}
.flashcard .fc-face.front { background-color: color-mix(in srgb, var(--fc-soft) 35%, var(--surface)); }
.flashcard .fc-face.back { background-color: var(--fc-soft); background-image: none; }
.fc-head { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-family: var(--font-sans); font-size: 12px; }
.fc-topic { font-weight: 700; color: var(--fc); background: var(--surface); border: 1px solid color-mix(in srgb, var(--fc) 30%, transparent);
  padding: 2px 10px; border-radius: var(--radius-pill); max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-text { flex: 1; display: flex; align-items: center; justify-content: center; overflow-wrap: anywhere; }
.fc-text p { margin: 0; }
.fc-face.back .fc-text { color: color-mix(in srgb, var(--fc) 30%, var(--text)); }
.fc-side { font-family: var(--font-sans); font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: color-mix(in srgb, var(--fc) 70%, var(--muted)); }
mark.fc-key { color: inherit; font-weight: 700; padding: 0 3px; border-radius: 3px;
  background: linear-gradient(transparent 45%, var(--fc-hl) 45%); }
.fc-state { font-weight: 600; padding: 2px 9px; border-radius: var(--radius-pill); white-space: nowrap;
  border: 1px solid color-mix(in srgb, currentColor 35%, transparent); }
.st-novo { background: var(--accent-soft); color: var(--accent); }
.st-aprender { background: var(--amber-soft); color: var(--amber); }
.st-dificil { background: var(--red-soft); color: var(--red); }
.st-consolidado { background: var(--green-soft); color: var(--green); }
.fc-legend { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 2px 0 4px; }
.fc-chip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--fc-soft); color: var(--fc); border: 1px solid color-mix(in srgb, var(--fc) 25%, transparent); }
/* classificação com as cores do semáforo: vermelho falhei → azul fácil */
.btn.grade { min-width: 96px; font-weight: 600; }
.btn.g-again { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.btn.g-hard { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.btn.g-good { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.btn.g-easy { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.grade:hover { filter: brightness(.96); }
@media (max-width: 600px) {
  .btn.grade { min-width: 0; flex: 1 1 40%; }
  .flashcard .fc-face { font-size: 16px; padding: 14px 16px 12px; }
}

/* ---------- plano ---------- */
.week { border-left: 3px solid var(--accent); padding-left: 14px; margin-bottom: 18px; }
.week h4 { margin: 0 0 5px; font-size: 14px; }
.week .meta { color: var(--muted); font-size: 12.5px; margin-bottom: 7px; }
.task { display: flex; gap: 9px; align-items: start; padding: 4px 0; font-size: 13.5px; }
.task input[type=checkbox] { margin-top: 4px; }
.task.done span { text-decoration: line-through; color: var(--muted); }
.prog-wrap { background: var(--surface-3); height: 8px; border-radius: 6px; overflow: hidden; margin: 6px 0 14px; }
.prog-wrap .fill { height: 100%; background: var(--green); border-radius: 6px; }

/* ---------- painel slide-over ---------- */
#panel-root:not(:empty) { position: fixed; inset: 0; z-index: 40; }
.panel-overlay { position: absolute; inset: 0; background: rgba(20, 18, 14, .34); animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } }
.slide-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(680px, 96vw);
  background: var(--bg); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slidein .24s cubic-bezier(.2, .7, .2, 1);
}
@keyframes slidein { from { transform: translateX(32px); opacity: 0; } }
.slide-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 22px; flex: none;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.slide-head h2 { margin: 0; font-size: 16.5px; flex: 1; font-family: var(--font-serif); letter-spacing: -.1px; }
.panel-body-pad { flex: 1; overflow-y: auto; padding: 20px 22px; min-height: 0; }

/* ---------- modal ---------- */
#modal-root:not(:empty) {
  position: fixed; inset: 0; background: rgba(20, 18, 14, .42); display: flex;
  align-items: center; justify-content: center; z-index: 50; padding: 24px; animation: fade .15s ease-out;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  max-width: 760px; width: 100%; max-height: 86vh; overflow-y: auto; padding: 24px 28px; box-shadow: var(--shadow-lg);
  animation: pop .2s cubic-bezier(.2, .7, .2, 1);
}
.modal h3 { margin-top: 0; font-family: var(--font-serif); font-size: 19px; }
.modal pre {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px;
  white-space: pre-wrap; font-size: 13.5px; font-family: var(--font-sans); line-height: 1.6;
}
.reader-meta { color: var(--muted); font-size: 12px; margin: -6px 0 12px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 10px 16px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; max-width: 380px; font-size: 13.5px;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

/* ---------- títulos de vista (dentro de painéis) ---------- */
h1.vtitle { font-size: 20px; margin: 0 0 4px; font-family: var(--font-serif); letter-spacing: -.2px; }
.vsub { color: var(--muted); margin: 0 0 18px; font-size: 13px; }

/* ---------- autenticação ---------- */
.auth { flex: 1; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100%; }
.auth-hero {
  position: relative; display: flex; flex-direction: column; padding: 44px 56px 36px 88px; overflow: hidden;
  background-color: var(--surface);
  background-image:
    linear-gradient(90deg, transparent 62px, var(--margin-line) 62px 64px, transparent 64px),
    repeating-linear-gradient(transparent 0 31px, var(--rule) 31px 32px);
  border-right: 1px solid var(--border);
}
.auth-brand { display: flex; align-items: center; gap: 11px; font-family: var(--font-serif); font-size: 24px; font-weight: 700; }
.auth-title {
  font-family: var(--font-serif); font-weight: 700; font-size: clamp(30px, 3.3vw, 44px); line-height: 1.12;
  letter-spacing: -.6px; margin: auto 0 26px; max-width: 560px; padding-top: 48px;
}
.auth-title .hl { color: var(--accent); background: linear-gradient(transparent 60%, var(--marker-soft) 60%); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.auth-points { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 16px; max-width: 500px; }
.auth-points li { display: flex; gap: 14px; align-items: flex-start; }
.auth-points li > .ic {
  width: 38px; height: 38px; padding: 9px; border-radius: 11px; flex: none;
  background: var(--surface); border: 1px solid var(--border); color: var(--accent); box-shadow: var(--shadow-s);
}
.auth-points b { display: block; font-size: 14.5px; }
.auth-points span { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.auth-foot {
  display: flex; align-items: flex-start; gap: 9px; color: var(--amber); font-size: 13px; line-height: 1.5;
  margin: 32px 0 0; max-width: 500px; padding: 10px 13px; border-radius: var(--radius-m); background: var(--amber-soft);
}
.auth-foot .ic { width: 17px; height: 17px; margin-top: 1px; color: currentColor; }
.notice { margin: 0 0 14px; }
.notice b { font-weight: 700; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 64px 28px 40px; overflow-y: auto; }
.auth-card { width: 100%; max-width: 410px; }
.auth-head h2 { font-family: var(--font-serif); font-size: 28px; margin: 20px 0 4px; letter-spacing: -.4px; }
.auth-head p { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.seg {
  display: inline-flex; background: var(--surface-3); border-radius: 11px; padding: 3px; gap: 2px;
}
.seg button {
  border: none; background: none; padding: 6px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted);
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-s); }

.auth-form { display: flex; flex-direction: column; }
.afield { margin-bottom: 14px; min-width: 0; }
.afield > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.ainput {
  display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius-m); padding: 0 6px 0 12px; transition: border-color .12s, box-shadow .12s;
}
.ainput:hover { border-color: var(--faint); }
.ainput:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.ainput > .ic { width: 17px; height: 17px; color: var(--faint); }
.ainput:focus-within > .ic { color: var(--accent); }
.ainput input { flex: 1; min-width: 0; border: none; background: none; outline: none; padding: 10px 4px; font-size: 14.5px; }
.ainput input:focus-visible { box-shadow: none; }
.ainput input::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
.ainput .eye {
  border: none; background: none; color: var(--faint); width: 34px; height: 34px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.ainput .eye:hover { color: var(--text); background: var(--surface-3); }
.ahint { font-size: 12px; color: var(--faint); margin-top: 5px; min-height: 0; }
.ahint:empty { display: none; }
.ahint[data-kind="err"] { color: var(--red); }
.ahint[data-kind="ok"] { color: var(--green); }
.afield.invalid .ainput { border-color: var(--red); }
.afield.invalid .ainput:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 22%, transparent); }
.afield.invalid .ainput > .ic { color: var(--red); }

.caps { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--amber); margin-top: 6px; }
.caps .ic { width: 14px; height: 14px; }
.caps[hidden] { display: none; }

.meter { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 4px; align-items: center; margin-top: 8px; }
.meter i { height: 4px; border-radius: 3px; background: var(--surface-3); transition: background .2s; }
.meter span { font-size: 11.5px; font-weight: 600; color: var(--muted); min-width: 60px; text-align: right; }
.meter[data-score="0"] i:nth-child(-n+1) { background: var(--red); }
.meter[data-score="1"] i:nth-child(-n+2) { background: var(--amber); }
.meter[data-score="2"] i:nth-child(-n+3) { background: var(--accent-2); }
.meter[data-score="3"] i:nth-child(-n+4) { background: var(--green); }

.pw-rules { list-style: none; padding: 0; margin: -6px 0 14px; display: grid; gap: 3px; }
.pw-rules li { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--faint); }
.pw-rules li .ic { width: 13px; height: 13px; }
.pw-rules li.ok { color: var(--green); }

.auth-note {
  display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: var(--muted); line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-m); padding: 10px 12px; margin: 2px 0 14px;
}
.auth-note .ic { width: 16px; height: 16px; margin-top: 1px; color: var(--faint); }
.auth-note.warn { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.auth-note.warn .ic, .auth-note.err .ic { color: currentColor; }
.auth-note.err { background: var(--red-soft); border-color: transparent; color: var(--red); }
.auth-alert { display: none; }
.auth-alert.show {
  display: flex; gap: 9px; align-items: flex-start; border-radius: var(--radius-m); padding: 10px 12px; margin-bottom: 14px;
  font-size: 13px; font-weight: 500; animation: pop .15s ease-out;
}
.auth-alert .ic { width: 17px; height: 17px; margin-top: 1px; }
.auth-alert.err { background: var(--red-soft); color: var(--red); }
.auth-alert.warn { background: var(--amber-soft); color: var(--amber); }
.auth-alert.info { background: var(--accent-softer); color: var(--accent); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* aviso de arquivo (primeiro carregamento) */
.archive-notice { max-width: 520px; margin: 0 auto; }
.archive-notice .notice-ico {
  width: 48px; height: 48px; border-radius: 14px; background: var(--marker-soft); color: var(--amber);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.archive-notice .notice-ico .ic { width: 24px; height: 24px; }
.archive-notice p { font-size: 14px; line-height: 1.6; margin: 0 0 10px; }
.archive-notice .notice-small { font-size: 12.5px; color: var(--muted); }
.notice-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

.auth-done { text-align: center; padding: 20px 0; animation: pop .2s ease-out; }
.auth-done .done-ico {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 16px; background: var(--green-soft); color: var(--green);
  display: flex; align-items: center; justify-content: center;
}
.auth-done .done-ico .ic { width: 28px; height: 28px; }
.auth-done .done-ico.bad { background: var(--red-soft); color: var(--red); }
.link-btn {
  align-self: center; margin-top: 12px; border: none; background: none; color: var(--accent);
  font-size: 13px; font-weight: 600; padding: 4px 8px; border-radius: 8px; text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px;
}
.link-btn:hover { background: var(--accent-softer); }
.auth.auth-single { grid-template-columns: 1fr; }
.auth-single .auth-brand { margin-bottom: 8px; }
.auth-done h2 { font-family: var(--font-serif); font-size: 26px; margin: 0 0 8px; }
.auth-done p { color: var(--muted); font-size: 14px; margin: 0 0 22px; }

/* ---------- observabilidade (admin) ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.kpi {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 1px;
}
.kpi b { font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -.5px; line-height: 1.2; }
.kpi span { color: var(--muted); font-size: 11.5px; }
.kpi.alert b { color: var(--red); }
.kpi.warn b { color: var(--amber); }
.day-grid { display: flex; gap: 6px; align-items: flex-end; }
.day-col { flex: 1; display: flex; flex-direction: column; gap: 4px; align-items: center; min-width: 0; }
.day-col span { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.day-col .bar { width: 100%; background: var(--surface-3); }
.doc-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 16px; }
.type-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 32px; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.type-row b { text-align: right; font-variant-numeric: tabular-nums; }
.doc-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.doc-filters input { grid-column: 1 / -1; }
@media (max-width: 700px) {
  .doc-filters { grid-template-columns: 1fr; }
}
.feed-item {
  display: flex; gap: 8px; align-items: center; padding: 8px 4px;
  border-bottom: 1px solid var(--border); font-size: 13px; flex-wrap: wrap;
}
.feed-item:last-child { border-bottom: none; }
.feed-user { font-weight: 700; }
.feed-detail { color: var(--muted); flex: 1; min-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.feed-time { color: var(--faint); font-size: 11.5px; margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- responsivo ---------- */
@media (max-width: 1080px) {
  .seg.home-tabs {
    display: inline-flex; align-self: flex-start; margin-bottom: 10px; flex: none;
  }
  .home-tabs [data-view="fontes"] { display: none; }
  .home-grid { grid-template-columns: 270px minmax(0, 1fr); }
  .home-grid[data-view="studio"] .chat-panel { display: none; }
  .home-grid:not([data-view="studio"]) .studio-panel { display: none; }
}
@media (max-width: 760px) {
  #main { padding: 10px; }
  .topbar { padding: 0 8px 0 12px; gap: 8px; }
  .tb-title, .user-chip .uname, .tb-sep { display: none; }
  .seg.home-tabs { align-self: stretch; }
  .seg.home-tabs button { flex: 1; }
  .home-tabs [data-view="fontes"] { display: block; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-grid .panel { display: none; }
  .home-grid[data-view="fontes"] .fontes-panel,
  .home-grid[data-view="studio"] .studio-panel,
  .home-grid:not([data-view="fontes"]):not([data-view="studio"]) .chat-panel { display: flex; }
  .chat-msgs {
    padding: var(--line) 14px var(--line) 44px;
    background-image:
      linear-gradient(90deg, transparent 29px, var(--margin-line) 29px 31px, transparent 31px),
      repeating-linear-gradient(transparent 0 calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px) var(--line));
  }
  .chat-panel::before { display: none; }
  .chat-input { padding: 8px 10px 12px; }
  .msg, .msg.assistant { max-width: 100%; }
  .chat-empty h2 { font-size: 23px; }
  .freq-row { grid-template-columns: 1fr 70px; }
  .freq-row > :nth-child(n+3) { display: none; }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-hero { padding: 26px 22px 22px 22px; background-image: repeating-linear-gradient(transparent 0 31px, var(--rule) 31px 32px); border-right: none; border-bottom: 1px solid var(--border); }
  .auth-title { font-size: 26px; margin: 22px 0 0; padding-top: 0; }
  .auth-points { display: none; }
  .auth-foot { margin-top: 18px; font-size: 12.5px; }
  .auth-panel { padding: 26px 20px 40px; align-items: flex-start; }
}
