/* ============================================================
   StudyFlow v3 — identidade própria
   Regra de cor: neutros + cor da disciplina + estado
   (verde = ok, âmbar = atenção, vermelho = problema).
   Um acento discreto só para ações principais.
   Tipografia: Inter 400 / 500 para texto, 600 para títulos.
   ============================================================ */

:root, [data-theme="dark"] {
  --bg: #0e0e10;  --bg2: #151517;  --bg3: #1d1d20;
  --border: #2a2a2e;
  --text: #f2f2f3;
  --text2: #a3a3ab;          /* 7.6:1 sobre --bg */
  --text3: #80808a;          /* 4.9:1 sobre --bg: ainda legível, só mais discreto */
  --accent: #4a6a96;  --accent-hover: #5a7cab;  --accent-text: #93add2;
  --accent-soft: rgba(74, 106, 150, .16);
  --danger: #ff6b7a;  --success: #3ccf91;  --warning: #ffb04a;
  --ok: #3ccf91;  --warn: #ffb04a;  --bad: #ff6b7a;
  --shadow: 0 6px 20px rgba(0, 0, 0, .35);
  --font-head: 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --tabbar-h: 58px;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f6f5;  --bg2: #ffffff;  --bg3: #eeeeec;
  --border: #dedcd9;
  --text: #1c1b1a;
  --text2: #5c5651;          /* 6.4:1 */
  --text3: #787169;          /* 4.6:1 */
  --accent: #3d5a80;  --accent-hover: #2f4767;  --accent-text: #3d5a80;
  --accent-soft: rgba(61, 90, 128, .1);
  --ok: #15803d;  --warn: #b45309;  --bad: #c62828;
  --danger: #c62828;  --success: #15803d;  --warning: #b45309;
  --shadow: 0 4px 14px rgba(0, 0, 0, .08);
  color-scheme: light;
}

body { font-family: var(--font-body); font-weight: 400; letter-spacing: -.003em; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .page-title, .section-header h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: -.01em; }
b, strong { font-weight: 600; }
.ic { width: 1em; height: 1em; vertical-align: -.125em; stroke-width: 1.75; }
[data-lucide] { stroke-width: 1.75; }
.spin { animation: sfspin .9s linear infinite; }
@keyframes sfspin { to { transform: rotate(360deg); } }

/* ── sem brilho, sem sombra colorida ── */
.stat-card:hover, .sf-subj-card:hover, .btn-primary:hover { box-shadow: none; }
.btn-primary { background: var(--accent); color: #fff; border: 0; box-shadow: none; }
.btn-primary:hover { background: var(--accent-hover); }

/* ── Marca ── */
.sf-logo { width: 40px; height: 40px; color: var(--text); flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 14px; font-weight: 600; font-size: 16px; }
.brand .sf-logo { width: 28px; height: 28px; }
.splash-screen { flex-direction: column; gap: 14px; }
.splash-screen .sf-logo { width: 56px; height: 56px; animation: sfbreath 1.6s ease-in-out infinite; }
.splash-screen h2 { font-weight: 500; font-size: 15px; color: var(--text2); letter-spacing: .02em; }
@keyframes sfbreath { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.auth-header { text-align: center; }
.auth-header .sf-logo { width: 52px; height: 52px; margin: 0 auto 14px; display: block; }
.auth-header h1 { font-weight: 600; font-size: 24px; background: none; -webkit-text-fill-color: currentColor; color: var(--text); }
.auth-header p { color: var(--text2); font-size: 14px; }

/* ── Topo do dia ── */
.dashboard-hero { background: none; border: 0; padding: 4px 0 0; box-shadow: none; }
.greeting-kicker { font-size: 13px; font-weight: 500; color: var(--text2); text-transform: none; letter-spacing: 0; }
.greeting-title { font-size: 24px; font-weight: 600; color: var(--text); background: none; -webkit-text-fill-color: currentColor; }

/* ── Status de conexão ── */
.sf-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 10px 0 0; font-size: 12.5px; color: var(--text2); }
.sf-st { display: inline-flex; align-items: center; gap: 6px; }
.sf-st-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--text3); flex-shrink: 0; }
.dot-ok { background: var(--ok); } .dot-bad { background: var(--bad); } .dot-warn { background: var(--warn); } .dot-off { background: var(--text3); }

/* ── O que mudou ── */
.sf-changes { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg2); }
.sf-changes-head { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; }
.sf-change { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px; }
.sf-change span:first-child { color: var(--text2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Dicas de nota/falta ── */
.sp-hint, .g-hint { font-size: 12.5px; line-height: 1.45; color: var(--text2); margin-top: 8px; }
.g-hint { margin-top: 4px; font-size: 11.5px; white-space: nowrap; }
.sp-hint.g-h-need-n2, .sp-hint.g-h-need-n3 { color: var(--warn); }
.sp-hint.g-h-ok { color: var(--ok); } .sp-hint.g-h-fail { color: var(--bad); }
.sp-link-row { display: flex; gap: 8px; margin-top: 10px; } .sp-link-row select { flex: 1; min-width: 0; }
.g-table sup { font-size: 9px; color: var(--text2); margin-left: 1px; }

/* ── Telas vazias: um estilo só ── */
.sf-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 24px; color: var(--text2); }
.sf-empty > i, .sf-empty > svg { width: 44px; height: 44px; padding: 11px; border: 1px solid var(--border); border-radius: 50%; color: var(--text2); }
.sf-empty h3 { color: var(--text); font-size: 16px; margin: 4px 0 0; }
.sf-empty p { max-width: 340px; font-size: 13.5px; line-height: 1.5; margin: 0 0 6px; }
.db-empty-small, .feed-empty { color: var(--text2); font-size: 13.5px; padding: 16px; border: 1px dashed var(--border); border-radius: var(--radius-sm); text-align: left; }

/* ── Carregamento: esqueleto ── */
.sf-skel { height: 74px; border-radius: 12px; margin-bottom: 10px; background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%); background-size: 200% 100%; animation: sfsk 1.4s ease-in-out infinite; }
@keyframes sfsk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Movimento discreto ── */
.page.active { animation: sfin .18s ease-out; }
@keyframes sfin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.stat-card, .sf-subj-card, .nav-item, .subject-item, .btn-primary { transition: background-color .15s, border-color .15s, color .15s, transform .15s; }
.sf-subj-card:hover { transform: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ── Menu lateral ── */
.nav-more > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; color: var(--text2); font-size: 14px; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary:hover { background: var(--bg3); color: var(--text); }
.nav-more[open] > summary { color: var(--text); }
.nav-more .nav-item { padding-left: 38px; }
.section-title { text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--text2); font-weight: 500; }
.icon-btn-small i, .icon-btn-small svg { width: 16px; height: 16px; }

/* ── Aviso de instalação: faixa grande + fundo escurecido ── */
.install-overlay { position: fixed; inset: 0; z-index: 10000; display: none; background: rgba(0, 0, 0, .65); }
.install-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10001; display: none; flex-direction: column; justify-content: space-between; gap: 16px; box-sizing: border-box; min-height: 34vh; min-height: 34dvh; padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--bg2); border-top: 1px solid var(--border); border-radius: 8px 8px 0 0; color: var(--text); animation: none; box-shadow: none; }
.install-banner-top { display: flex; align-items: center; gap: 16px; }
.install-banner-icon { width: 72px; height: 72px; flex: 0 0 auto; border-radius: 10px; }
.install-banner-topics { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; line-height: 1.35; color: var(--text3); opacity: .85; }
.install-banner-text { align-self: flex-end; text-align: right; font-size: 14px; font-weight: 500; color: var(--text); }
.install-banner-divider { width: 100%; height: 0; margin: 0; border: 0; border-top: 1px solid var(--border); }
.install-banner-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.install-btn-primary { background: var(--accent); color: #fff; border: 0; border-radius: 8px; font: inherit; font-weight: 600; padding: 12px 18px; cursor: pointer; box-shadow: none; transition: none; flex: 0 0 auto; }
.install-btn-primary:hover, .install-btn-primary:active, .install-btn-primary:focus { background: var(--accent); color: #fff; box-shadow: none; transform: none; }
.install-btn-secondary { background: none; border: 0; color: var(--text2); opacity: .7; font: inherit; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; padding: 6px 8px; cursor: pointer; }
.install-btn-secondary:hover { opacity: 1; }
.install-btn-dismiss { background: none; border: 0; color: var(--text2); padding: 6px; cursor: pointer; display: inline-flex; }
.install-btn-dismiss i, .install-btn-dismiss svg { width: 16px; height: 16px; }
body.install-lock { overflow: hidden; }
@media (min-width: 769px) { .install-banner { left: 50%; right: auto; width: 520px; max-width: 100%; transform: translateX(-50%); } }

/* ── Barra de abas (celular) ── */
.tabbar, .more-sheet { display: none; }
@media (max-width: 768px) {
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--bg2); border-top: 1px solid var(--border); }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: 0; color: var(--text2); font: inherit; font-size: 10.5px; font-weight: 500; cursor: pointer; }
  .tabbar button i, .tabbar button svg { width: 21px; height: 21px; }
  .tabbar button.active { color: var(--text); }
  .main-content { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px); }
  .fab { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px); }
  .more-sheet { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .18s; }
  .more-sheet.open { opacity: 1; pointer-events: auto; }
  .more-sheet-body { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 8px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--bg2); border-radius: 18px 18px 0 0; border-top: 1px solid var(--border); transform: translateY(100%); transition: transform .2s ease-out; }
  .more-sheet.open .more-sheet-body { transform: none; }
  .more-sheet-body button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; background: none; border: 0; color: var(--text); font: inherit; font-size: 15px; text-align: left; border-radius: 10px; }
  .more-sheet-body button:active { background: var(--bg3); }
  .more-sheet-body i, .more-sheet-body svg { width: 20px; height: 20px; color: var(--text2); }
}

/* ── Toast e cartões: planos ── */
.toast { background: var(--bg3); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow); }
.sp-hero { background: var(--bg2) !important; border: 1px solid var(--border); border-left: 3px solid var(--sc); }
.g-badge { font-weight: 500; }


/* ============================================================
   Feed e perfil — estilo rede social (.fb-*)
   ============================================================ */
.fb-wrap { max-width: 680px; margin: 0 auto; }
.fb-feed-posts { display: flex; flex-direction: column; gap: 12px; }
.fb-feed-foot { padding: 14px 0 24px; text-align: center; }
.fb-feed-sentinel { height: 1px; }
.fb-feed-end { color: var(--text3); font-size: 13px; padding: 8px; }
.fb-load-more { background: var(--bg3); border: 1px solid var(--border); color: var(--text); padding: 9px 18px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.fb-load-more:disabled { opacity: .6; cursor: default; }
.fb-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 16px; color: var(--text2); text-align: center; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; }
.fb-empty i, .fb-empty svg { width: 34px; height: 34px; color: var(--text3); }
.fb-empty p { margin: 0; font-size: 14px; max-width: 340px; }
.fb-ptr { text-align: center; font-size: 12px; color: var(--text2); padding: 6px; }

/* Avatar */
.fb-avatar { position: relative; flex: 0 0 auto; border-radius: 50%; overflow: hidden; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; user-select: none; }
.fb-avatar > span { font-size: 0.4em; line-height: 1; letter-spacing: .02em; }
.fb-avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fb-avatar-sm { width: 32px; height: 32px; font-size: 32px; }
.fb-avatar-md { width: 42px; height: 42px; font-size: 42px; }
.fb-avatar-lg { width: 120px; height: 120px; font-size: 120px; }
.fb-avatar > span { font-size: 15px; }
.fb-avatar-sm > span { font-size: 12px; }
.fb-avatar-lg > span { font-size: 40px; }
.fb-clickable { cursor: pointer; }

/* Compositor ("No que você está pensando?") */
.fb-composer { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 8px; margin-bottom: 12px; }
.fb-composer-top { display: flex; align-items: center; gap: 10px; }
.fb-composer-input { flex: 1; text-align: left; background: var(--bg3); border: 1px solid transparent; color: var(--text2); border-radius: 999px; padding: 11px 16px; font: inherit; font-size: 14.5px; cursor: pointer; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-composer-input:hover { background: var(--border); }
.fb-composer-actions { display: flex; gap: 4px; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); }
.fb-composer-actions button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: none; border: 0; color: var(--text2); padding: 8px 6px; border-radius: 8px; font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.fb-composer-actions button:hover { background: var(--bg3); color: var(--text); }
.fb-composer-actions i, .fb-composer-actions svg { width: 20px; height: 20px; }
.fb-composer-actions .c-img i, .fb-composer-actions .c-img svg { color: #3ccf91; }
.fb-composer-actions .c-doubt i, .fb-composer-actions .c-doubt svg { color: #f39c12; }
.fb-composer-actions .c-mat i, .fb-composer-actions .c-mat svg { color: #4a9eff; }

/* Cartão de publicação */
.fb-post { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; overflow: visible; }
.fb-post.fb-highlight { box-shadow: 0 0 0 2px var(--accent); }
.fb-post-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 6px; }
.fb-post-meta { flex: 1; min-width: 0; }
.fb-post-author { background: none; border: 0; padding: 0; color: var(--text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-align: left; }
.fb-post-author:hover { text-decoration: underline; }
.fb-post-line2 { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 12.5px; color: var(--text2); margin-top: 1px; }
.fb-type { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.fb-type i, .fb-type svg, .fb-vis { width: 13px; height: 13px; }
.fb-dot { color: var(--text3); }
.fb-post-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 14px 6px; }
.fb-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text2); background: var(--bg3); border-radius: 999px; padding: 3px 9px; }
.fb-tag i, .fb-tag svg { width: 12px; height: 12px; }
.fb-post-text { padding: 4px 14px 10px; font-size: 15px; line-height: 1.5; color: var(--text); white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.fb-post-text--big { font-size: 22px; line-height: 1.35; padding-top: 10px; padding-bottom: 16px; }
.fb-post-text.fb-clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.fb-post-text a { color: var(--accent-text); text-decoration: none; }
.fb-post-text a:hover { text-decoration: underline; }
.fb-mention { color: var(--accent-text); font-weight: 500; }
.fb-see-more { background: none; border: 0; color: var(--text2); font: inherit; font-size: 14px; font-weight: 600; padding: 0 14px 10px; cursor: pointer; }
.fb-see-more:hover { text-decoration: underline; }
.fb-post-image { background: var(--bg3); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.fb-post-image img { display: block; width: 100%; max-height: 560px; object-fit: contain; cursor: zoom-in; }

/* Contadores e ações */
.fb-post-stats { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; font-size: 13.5px; color: var(--text2); }
.fb-post-stats:empty { display: none; }
.fb-stat-likes { display: inline-flex; align-items: center; gap: 6px; }
.fb-like-bubble { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.fb-like-bubble i, .fb-like-bubble svg { width: 11px; height: 11px; }
.fb-stat-comments { background: none; border: 0; color: var(--text2); font: inherit; font-size: 13.5px; cursor: pointer; padding: 0; }
.fb-stat-comments:hover { text-decoration: underline; }
.fb-post-actions { display: flex; gap: 2px; margin: 0 10px; padding: 4px 0; border-top: 1px solid var(--border); }
.fb-act { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: none; border: 0; color: var(--text2); padding: 9px 6px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.fb-act:hover { background: var(--bg3); }
.fb-act i, .fb-act svg { width: 18px; height: 18px; }
.fb-act.liked { color: var(--accent-text); }
.fb-act.liked svg { fill: currentColor; }

/* Menu ⋯ */
.fb-menu-wrap { position: relative; }
.fb-icon-btn { background: none; border: 0; color: var(--text2); width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.fb-icon-btn:hover { background: var(--bg3); color: var(--text); }
.fb-icon-btn i, .fb-icon-btn svg { width: 18px; height: 18px; }
.fb-menu { display: none; position: absolute; right: 0; top: 36px; z-index: 30; min-width: 210px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 6px; box-shadow: var(--shadow); }
.fb-menu.open { display: block; }
.fb-menu-item { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--text); padding: 9px 10px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.fb-menu-item:hover { background: var(--bg3); }
.fb-menu-item i, .fb-menu-item svg { width: 17px; height: 17px; }
.fb-menu-danger { color: var(--danger); }

/* Comentários */
.fb-comments { display: none; padding: 4px 14px 14px; }
.fb-comments.open { display: block; }
.fb-comments-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.fb-comment { display: flex; gap: 8px; align-items: flex-start; }
.fb-comment-main { min-width: 0; flex: 1; }
.fb-comment-bubble { position: relative; display: inline-block; max-width: 100%; background: var(--bg3); border-radius: 16px; padding: 8px 12px; }
.fb-comment-best .fb-comment-bubble { box-shadow: inset 0 0 0 1px var(--success); }
.fb-comment-author { font-size: 13px; font-weight: 600; color: var(--text); }
.fb-best-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; font-size: 10.5px; font-weight: 600; color: var(--success); }
.fb-best-badge i, .fb-best-badge svg { width: 11px; height: 11px; }
.fb-comment-text { font-size: 14px; line-height: 1.4; color: var(--text); white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.fb-comment-text a { color: var(--accent-text); }
.fb-comment-likes { position: absolute; right: -8px; bottom: -9px; display: inline-flex; align-items: center; gap: 3px; background: var(--bg2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 6px; font-size: 11px; color: var(--text2); }
.fb-comment-likes i, .fb-comment-likes svg { width: 10px; height: 10px; color: var(--accent-text); }
.fb-comment-actions { display: flex; gap: 12px; align-items: center; padding: 3px 10px 0; font-size: 12px; }
.fb-comment-actions button { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; font-weight: 600; color: var(--text2); cursor: pointer; }
.fb-comment-actions button:hover { text-decoration: underline; }
.fb-comment-actions button.liked { color: var(--accent-text); }
.fb-comment-time { color: var(--text3); }
.fb-comment-compose { display: flex; gap: 8px; align-items: flex-end; }
.fb-compose-box { flex: 1; display: flex; align-items: flex-end; gap: 4px; background: var(--bg3); border-radius: 18px; padding: 4px 6px 4px 12px; min-width: 0; }
.fb-compose-box textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; line-height: 1.4; padding: 6px 0; max-height: 140px; }
.fb-send { background: none; border: 0; color: var(--accent-text); width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.fb-send:hover { background: var(--border); }
.fb-send i, .fb-send svg { width: 18px; height: 18px; }

/* Esqueleto de carregamento */
.fb-skel { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.fb-skel-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.fb-skel-circle { width: 42px; height: 42px; border-radius: 50%; }
.fb-skel-line { height: 11px; border-radius: 6px; margin-bottom: 8px; }
.fb-skel-block { height: 120px; border-radius: 8px; margin-top: 10px; }
.fb-skel-circle, .fb-skel-line, .fb-skel-block { background: linear-gradient(90deg, var(--bg3), var(--bg2), var(--bg3)); background-size: 200% 100%; animation: sfsk 1.4s linear infinite; }

/* Lightbox */
.fb-lightbox { position: fixed; inset: 0; z-index: 9500; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.88); padding: 20px; }
.fb-lightbox.open { display: flex; }
.fb-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.fb-lb-close { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }

/* Modal "Criar publicação" */
.fb-create { display: flex; flex-direction: column; gap: 12px; }
.fb-create-head { display: flex; align-items: center; gap: 10px; }
.fb-create-name { font-weight: 600; font-size: 15px; }
.fb-create-vis { background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 12.5px; }
.fb-create-text { width: 100%; resize: vertical; min-height: 110px; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 17px; line-height: 1.45; }
.fb-create-preview { position: relative; }
.fb-create-preview:empty { display: none; }
.fb-create-preview img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; }
.fb-preview-x { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; }
.fb-create-types { display: flex; flex-wrap: wrap; gap: 6px; }
.post-type-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--bg3); border: 1.5px solid var(--border); color: var(--text2); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.post-type-btn i, .post-type-btn svg { width: 14px; height: 14px; color: var(--tc); }
.post-type-btn.selected { border-color: var(--tc); color: var(--text); background: var(--bg2); }
.fb-create-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text2); }
.fb-create-bar { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px 6px 14px; font-size: 14px; font-weight: 500; }
.fb-create-bar .fb-icon-btn { color: #3ccf91; }
.fb-create-submit { width: 100%; padding: 11px; border-radius: 10px; font-weight: 600; }
.fb-create-submit:disabled { opacity: .6; }

/* Perfil */
.fb-profile-back { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--text2); font: inherit; font-size: 13.5px; padding: 4px 0 10px; cursor: pointer; }
.fb-profile-back:hover { color: var(--text); }
.fb-profile-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.fb-profile-cover { height: 110px; background: linear-gradient(135deg, var(--accent), var(--bg3)); }
.fb-profile-body { padding: 0 18px 16px; }
.fb-profile-top { display: flex; align-items: flex-end; gap: 16px; margin-top: -48px; flex-wrap: wrap; }
.fb-profile-top .fb-avatar { width: 96px; height: 96px; border: 4px solid var(--bg2); }
.fb-profile-top .fb-avatar > span { font-size: 32px; }
.fb-profile-id { flex: 1; min-width: 160px; padding-bottom: 4px; }
.fb-profile-name { margin: 0; font-size: 21px; font-weight: 600; color: var(--text); }
.fb-profile-sub { margin-top: 3px; font-size: 13px; color: var(--text2); }
.fb-profile-bio { margin: 10px 0 0; font-size: 14px; color: var(--text); line-height: 1.45; }
.fb-profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.fb-profile-stat { text-align: center; }
.fb-profile-stat b { display: block; font-size: 18px; font-weight: 600; color: var(--text); }
.fb-profile-stat span { font-size: 11.5px; color: var(--text2); }
.fb-profile-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; background: var(--accent); color: #fff; }
.fb-profile-btn.secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.fb-profile-btn i, .fb-profile-btn svg { width: 16px; height: 16px; }
.fb-section-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 6px 2px 10px; }
.fb-sidebar-profile { cursor: pointer; }

@media (max-width: 768px) {
  .fb-post-text--big { font-size: 19px; }
  .fb-composer-actions button span { display: none; }
  .fb-profile-stats { grid-template-columns: repeat(4, 1fr); }
}

/* ── Início no PC: abas e conteúdo centralizados na mesma coluna ── */
@media (min-width: 769px) {
  #page-social .social-tabs { max-width: 680px; margin-left: auto; margin-right: auto; justify-content: center; }
  #page-social .social-tab-pane:not([data-tab="turmas"]) { max-width: 680px; margin-left: auto; margin-right: auto; }
}

/* ============================================================
   Dashboard — topo: Atualizar, janela de notificações e calendário
   Cor padrão pedida: azul #1d2ab8 (tags, hoje, prazos no calendário).
   ============================================================ */
:root { --sf-blue: #1d2ab8; }

/* Hero: só o botão Atualizar (PC). No celular some: atualiza-se arrastando a página. */
.dashboard-hero { padding: 0; }
.sf-status { justify-content: flex-end; margin: 0 0 10px; }
@media (max-width: 768px) { .dashboard-hero { display: none; } }

/* Janela de notificações (Classroom) */
.dn-modal, .dc-modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.dc-modal { margin-top: 14px; }
.dn-list { max-height: min(440px, 62vh); overflow-y: auto; overscroll-behavior: contain; }
.dn-item { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.dn-item + .dn-item { border-top: 1px solid var(--border); }
.dn-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dn-title { margin: 0; min-width: 0; font-size: 13px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text); }
.dn-tag { flex-shrink: 0; padding: 3px 9px; border-radius: 999px; background: var(--sf-blue); color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; transition: opacity .2s, transform .2s; }
.dn-tag.is-gone { opacity: 0; transform: scale(.85); }
.dn-body { font-size: 13.5px; line-height: 1.5; color: var(--text); }
.dn-ctitle { margin: 0 0 4px; font-weight: 600; }
.dn-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.dn-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dn-link { display: inline-flex; max-width: 100%; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg3); color: var(--text2); font-size: 12px; text-decoration: none; }
.dn-link:hover { color: var(--text); }
.dn-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dn-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dn-date { font-size: 12px; color: var(--text2); }
.dn-empty { padding: 18px 16px; font-size: 13.5px; color: var(--text2); }

/* Calendário do mês */
.dc-modal { padding: 14px; }
.dc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dc-month { margin: 0; font-size: 15px; }
.dc-nav { display: flex; align-items: center; gap: 4px; }
.dc-navbtn, .dc-today { background: none; border: 0; color: var(--text2); font: inherit; cursor: pointer; border-radius: 8px; }
.dc-navbtn { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; }
.dc-today { padding: 5px 10px; font-size: 12.5px; }
.dc-navbtn:hover, .dc-today:hover { background: var(--bg3); color: var(--text); }
.dc-dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; font-size: 12px; font-weight: 500; color: var(--text2); padding-bottom: 6px; }
.dc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.dc-cell { min-width: 0; min-height: 92px; padding: 6px; display: flex; flex-direction: column; align-items: stretch; gap: 3px; text-align: left; background: none; border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--text); font: inherit; cursor: pointer; overflow: hidden; }
.dc-cell:hover { background: var(--bg3); }
.dc-cell.is-sel { box-shadow: inset 0 0 0 2px var(--sf-blue); }
.dc-num { align-self: flex-end; min-width: 24px; height: 24px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; font-size: 12.5px; }
.dc-cell.is-out .dc-num { color: var(--text3); }
.dc-cell.is-today .dc-num { background: var(--sf-blue); color: #fff; font-weight: 600; }
.dc-chip { display: block; padding: 2px 6px; border-radius: 5px; background: var(--sf-blue); color: #fff; font-size: 11px; font-weight: 500; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-chip.is-done { opacity: .45; text-decoration: line-through; }
.dc-more { font-size: 11px; color: var(--text2); padding-left: 2px; }
.dc-detail { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.dc-detail-head { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.dc-detail-row { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; padding: 5px 0; font-size: 13px; }
.dc-detail-title { flex: 1 1 0; min-width: 40%; overflow-wrap: anywhere; }
.dc-detail-row.is-done .dc-detail-title { text-decoration: line-through; opacity: .6; }
.dc-detail-time, .dc-detail-subj, .dc-detail-empty { color: var(--text2); font-size: 12px; }
@media (max-width: 600px) {
  .dc-modal { padding: 10px; }
  .dc-cell { min-height: 58px; padding: 4px 2px; gap: 2px; align-items: center; }
  .dc-num { align-self: center; }
  .dc-chip { align-self: stretch; height: 5px; padding: 0; border-radius: 3px; font-size: 0; }   /* só uma barra; o texto aparece ao tocar no dia */
  .dc-more { font-size: 10px; }
  .dc-detail-subj { flex-basis: 100%; }
}

/* Puxar para atualizar (celular) */
.sf-ptr { position: fixed; top: 56px; left: 50%; z-index: 80; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg2); border: 1px solid var(--border); color: var(--text2); opacity: 0; transform: translate(-50%, -40px); pointer-events: none; box-shadow: var(--shadow); }
.sf-ptr.is-ready { color: var(--text); }
.sf-ptr.is-loading svg { animation: sfspin .9s linear infinite; }
@media (min-width: 769px) { .sf-ptr { display: none; } }

/* ============================================================
   Dashboard — visual único, sem cor (padrão do hero)
   Tudo escopado a #page-dashboard: outras páginas não mudam.
   Janela = fundo --bg2, borda --border, raio --radius. Sem ícones.
   ============================================================ */
#page-dashboard .text-btn { color: var(--text2); font-weight: 500; }
#page-dashboard .text-btn:hover { background: var(--bg3); color: var(--text); }
#page-dashboard .section-block { margin-top: 14px; }
#page-dashboard .dn-modal, #page-dashboard .dc-modal, #page-dashboard .dov-modal { margin-top: 14px; }
#page-dashboard .dov-modal { margin-top: 0; }
@media (min-width: 769px) {
  #page-dashboard .dov-modal + .dn-modal { margin-top: 28px; }   /* destaque do 1º modal */
}
#page-dashboard .dn-due { margin: 0; color: var(--text2); font-size: 13px; line-height: 1.3; text-align: right; }
#page-dashboard .dn-due b { color: var(--text); font-weight: 600; }
#page-dashboard .dn-due-date { font-weight: 400; white-space: nowrap; }
/* canto superior direito: tag em cima, entrega logo abaixo; no celular ocupa só o espaço que sobra ao lado do título */
#page-dashboard .dn-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; text-align: right; }
#page-dashboard .dn-side:empty { display: none; }
#page-dashboard .dn-side:has(.dn-due) { flex: 1 1 0; min-width: 40%; }
#page-dashboard .dn-title { flex: 0 1 auto; }
@media (max-width: 768px) {
  #page-dashboard .dn-due { font-size: clamp(10.5px, 3.3vw, 13px); }
}

/* Resumo do dia: próxima aula + números num modal só */
.dov-modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.dov-modal .db-focus-block { margin: 0; }
.dov-modal .db-focus-card { position: relative; background: none; border: 0; border-radius: 0; padding: 14px 16px; gap: 4px; }
.dov-modal .db-focus-block:empty { display: none; }
.dov-modal .db-focus-badge, .dov-modal .db-focus-badge.live, .dov-modal .db-focus-badge.ended, .dov-modal .db-focus-badge.next { padding: 0; background: none; color: var(--text2); font-weight: 500; letter-spacing: .06em; }
.dov-modal .db-focus-badge.next { color: #fff; font-weight: 700; letter-spacing: .1em; background: rgba(255,255,255,.12); padding: 3px 9px; border-radius: 6px; }
.dov-modal .db-focus-time { position: absolute; top: 14px; right: 16px; color: var(--text); font-weight: 500; font-size: 12px; text-align: right; }
.dov-modal .db-focus-fill { background: var(--text); }
.dov-modal .stats-grid { gap: 0; margin: 0; border-top: 1px solid var(--border); }
.dov-modal .db-focus-block:empty + .stats-grid { border-top: 0; }
.dov-modal .stat-card { background: none; border: 0; border-radius: 0; padding: 14px 16px; gap: 0; align-items: stretch; }
.dov-modal .stat-card + .stat-card { border-left: 1px solid var(--border); }
.dov-modal .stat-card:hover { background: var(--bg3); }
.dov-modal .stat-meta { height: 100%; align-items: stretch; text-align: center; gap: 0; }
.dov-modal .stat-label { text-transform: none; font-size: 12px; margin: 0; }
.dov-modal .stat-value { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 6px 0; }

/* Minhas disciplinas: sem ícone, sem cor */
#page-dashboard .sf-subj-card { border-top: 1px solid var(--border); }
#page-dashboard .sf-subj-card:hover { border-color: var(--text3); }
#page-dashboard .sf-subj-top .sf-tile { display: none; }
#page-dashboard .sf-subj-top:not(:has(.sf-badge)) { display: none; }
#page-dashboard .sf-badge { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
#page-dashboard .sf-subj-meta b { color: var(--text) !important; }

/* Aulas de hoje */
#page-dashboard .cls-card { border-color: var(--border); border-radius: var(--radius); box-shadow: none; transform: none; margin-bottom: 0; }
#page-dashboard .cls-card-bar { display: none; }
#page-dashboard .cls-card-body { padding: 14px 16px; }
#page-dashboard .cls-meta svg { display: none; }
#page-dashboard .cls-live-chip, #page-dashboard .cls-live-chip--ended { background: none; border: 0; padding: 0; color: var(--text2); font-weight: 500; animation: none; }
#page-dashboard .cls-progress-fill { background: var(--text) !important; }
#page-dashboard .empty-state { background: var(--bg2); border: 1px solid var(--border); min-height: 0; padding: 18px 16px; }
#page-dashboard .empty-state svg { display: none; }
#page-dashboard .empty-state button { background: none; border: 0; color: var(--text2); font: inherit; text-decoration: underline; cursor: pointer; }

/* Flashcards para revisar */
#page-dashboard .db-flashcards-due { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
#page-dashboard .db-fc-count { color: var(--text); }
#page-dashboard .db-fc-chip { background: var(--bg3) !important; color: var(--text2) !important; border: 1px solid var(--border); font-weight: 500; }
#page-dashboard .db-fc-ok { padding: 0; }
#page-dashboard .db-fc-ok svg { display: none; }
#page-dashboard .db-flashcards-due .db-empty-small { border: 0; padding: 0; }

/* ============================================================
   Celular (≤768px): Dashboard em página fixa, sem rolagem da página.
   Calendário, publicações, disciplinas e flashcards ficam num modal
   único com abas (arrastar ou tocar). O PC não é afetado.
   ============================================================ */
.dtabs { display: none; }

@media (max-width: 768px) {
  /* Rolagem do app: barras finas e quase transparentes */
  * { scrollbar-width: thin; scrollbar-color: rgba(128, 128, 138, .22) transparent; }
  *::-webkit-scrollbar { width: 3px; height: 3px; }
  *::-webkit-scrollbar-track { background: transparent; }
  *::-webkit-scrollbar-thumb { background: rgba(128, 128, 138, .22); border-radius: 3px; }
  *::-webkit-scrollbar-button { display: none; }

  /* Página fixa: ocupa exatamente o espaço entre o topo e a barra de abas */
  #page-dashboard.active {
    display: flex; flex-direction: column; overflow: hidden;
    height: calc(100vh - 14px - var(--topbar-h) - 14px - var(--tabbar-h) - env(safe-area-inset-bottom, 0px) - 12px);
    height: calc(100dvh - 14px - var(--topbar-h) - 14px - var(--tabbar-h) - env(safe-area-inset-bottom, 0px) - 12px);
  }
  #page-dashboard .page-content { flex: 1 1 auto; min-height: 0; height: 100%; display: flex; flex-direction: column; gap: 10px; }
  #page-dashboard .page-content > * { flex: 0 0 auto; margin-top: 0 !important; margin-bottom: 0; }
  #page-dashboard .dov-modal .db-focus-card { padding: 10px 14px; }
  #page-dashboard .dov-modal .stat-card { padding: 10px 14px; }
  #page-dashboard .dov-modal .db-focus-time { top: 10px; right: 14px; }

  /* Aulas de hoje: removida no celular; o modal com abas ocupa o espaço dela */
  #page-dashboard #dash-today { display: none; }

  /* Modal único com abas */
  .dtabs { display: flex; flex-direction: column; flex: 1 1 0 !important; min-height: 200px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
  .dtabs-bar { display: flex; flex: 0 0 auto; border-bottom: 1px solid var(--border); }
  .dtabs-tab { flex: 1 1 0; min-width: 0; padding: 11px 4px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--text2); font: inherit; font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
  .dtabs-tab.is-active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
  .dtabs-track { display: flex; flex: 1 1 0; min-height: 0; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
  .dtabs-track::-webkit-scrollbar { display: none; }
  .dtabs-pane { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; }

  /* Os blocos dentro das abas perdem moldura própria (a moldura é do modal único) */
  .dtabs .dn-modal, .dtabs .dc-modal { background: none; border: 0; border-radius: 0; margin: 0 !important; }
  .dtabs .dn-list { max-height: none; overflow: visible; }
  .dtabs .dc-modal { padding: 10px; }
  .dtabs .section-block { margin: 0 !important; padding: 12px; }
  .dtabs .db-flashcards-due { background: none; border: 0; padding: 0; }
}

/* ============================================================
   Entrada no app (splash → login): mesmo visual do Dashboard.
   Cor padrão #1d2ab8 (--sf-blue) e variações mais clara / mais escura.
   ============================================================ */
:root, [data-theme="dark"] {
  --sf-blue-light: #3a4bd8;       /* hover / foco */
  --sf-blue-dark: #151f8c;        /* pressionado */
  --sf-blue-text: #8f9bf2;        /* links e textos sobre fundo escuro */
  --sf-blue-soft: rgba(29, 42, 184, .22);
}
[data-theme="light"] {
  --sf-blue-light: #2a38c9;
  --sf-blue-dark: #151f8c;
  --sf-blue-text: #1d2ab8;
  --sf-blue-soft: rgba(29, 42, 184, .10);
}

/* Logomarca (imagem) */
.brand .sf-logo { border-radius: 8px; }
.splash-screen .sf-logo { width: 72px; height: 72px; border-radius: 20px; object-fit: cover; box-shadow: 0 0 0 1px var(--border), 0 10px 32px var(--sf-blue-soft); }
.splash-screen h2 { color: var(--text); }

/* Login */
#auth-screen .auth-container { background: var(--bg2); border: 1px solid var(--border); box-shadow: none; }
#auth-screen .auth-header h1 { margin-bottom: 26px; color: var(--text); }
#auth-screen .auth-tabs { background: var(--bg3); border: 1px solid var(--border); }
#auth-screen .auth-tabs button:hover:not(.active) { color: var(--text); }
#auth-screen .auth-tabs button.active { background: var(--sf-blue); color: #fff; }
#auth-screen .form-input:focus { border-color: var(--sf-blue-light); box-shadow: 0 0 0 3px var(--sf-blue-soft); }
#auth-screen .reg-username-wrap:focus-within { border-color: var(--sf-blue-light); box-shadow: 0 0 0 3px var(--sf-blue-soft); }
#auth-screen .reg-username-at { color: var(--sf-blue-text); background: var(--sf-blue-soft); }
#auth-screen .btn-primary { background: var(--sf-blue); color: #fff; }
#auth-screen .btn-primary:hover { background: var(--sf-blue-light); transform: none; }
#auth-screen .btn-primary:active { background: var(--sf-blue-dark); }
#auth-screen .auth-forgot-link { color: var(--sf-blue-text); }
#auth-screen .forgot-box { background: var(--bg3); border-color: var(--border); }
