/* Calendário de Escalas v2 — vidro translúcido, mobile-first, sem rolagem lateral */
:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --text: #14171f; --muted: #5d667a;
  --bg: #eaeef8;
  --glass: rgba(255,255,255,.58); --glass-strong: rgba(255,255,255,.82);
  --stroke: rgba(255,255,255,.75); --hair: rgba(20,28,60,.09);
  --cell: rgba(255,255,255,.62); --field: rgba(255,255,255,.7);
  --shadow: 0 10px 34px rgba(36,48,100,.13);
  --accent: #0a7aff; --danger: #ff3b30; --evt: #ff9500; --fer: #ff2d55;
  --vermelha: #ff3b30; --azul: #0a7aff; --verde: #30b854; --amarela: #ffcc00;
  --A: #a3243b; --B: #1f3d94; --C: #207340;
  --r: 26px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --text: #f3f5fb; --muted: #9aa3b8;
    --bg: #070a12;
    --glass: rgba(34,39,56,.52); --glass-strong: rgba(30,34,50,.84);
    --stroke: rgba(255,255,255,.14); --hair: rgba(255,255,255,.09);
    --cell: rgba(255,255,255,.07); --field: rgba(255,255,255,.08);
    --shadow: 0 12px 40px rgba(0,0,0,.45);
    --accent: #3d95ff; --vermelha: #ff5147; --azul: #3d95ff; --verde: #38c95e; --amarela: #ffd60a;
    --A: #c73a55; --B: #4a6fe0; --C: #34a35e;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; overflow-x: clip; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg);
  min-height: 100dvh; line-height: 1.35;
  padding: max(14px, env(safe-area-inset-top)) 12px calc(168px + env(safe-area-inset-bottom));
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }

/* Fundo em malha, parado (poupa bateria) */
.bg { position: fixed; inset: 0; z-index: -1; background:
  radial-gradient(60vmax 60vmax at 8% -5%, color-mix(in srgb, var(--azul) 38%, transparent), transparent 60%),
  radial-gradient(55vmax 55vmax at 105% 12%, color-mix(in srgb, var(--vermelha) 26%, transparent), transparent 60%),
  radial-gradient(60vmax 60vmax at 90% 105%, color-mix(in srgb, var(--verde) 28%, transparent), transparent 60%),
  radial-gradient(50vmax 50vmax at -5% 95%, color-mix(in srgb, var(--amarela) 26%, transparent), transparent 60%),
  var(--bg); }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(26px) saturate(1.8); backdrop-filter: blur(26px) saturate(1.8);
  border: 1px solid var(--stroke); box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.35);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: var(--glass-strong); } }

.app { width: 100%; max-width: 980px; margin: 0 auto; }

/* ===== Banner 2027 ===== */
.banner {
  position: sticky; top: 8px; z-index: 20; margin: 0 auto 12px; max-width: 980px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px;
  padding: 10px 16px; border-radius: 18px; font-weight: 600; font-size: .9rem; color: #3a2a00;
  background: color-mix(in srgb, var(--amarela) 82%, white); box-shadow: var(--shadow);
}
.banner .pill { background: rgba(255,255,255,.7); }

/* ===== Pílulas ===== */
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--stroke); font-weight: 600; font-size: .86rem;
  background: var(--glass); color: var(--text);
  -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 2px 10px rgba(30,40,90,.08); max-width: 100%;
}
.pill:active { transform: scale(.97); }
.pill.big { min-height: 44px; padding: 0 22px; font-size: .95rem; }
.pill[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: transparent; }
.pill.user { padding-right: 6px; gap: 10px; cursor: default; min-width: 0; }
.pill.user #nome-usuario-logado { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 46vw; color: var(--muted); font-weight: 500; }
.link { border: 0; background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); font-weight: 700; border-radius: 999px; min-height: 26px; padding: 0 12px; }
.ic { width: 17px; height: 17px; flex: none; }
.top-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 12px; min-height: 36px; }
.top-actions.carregando { visibility: hidden; }
@media (max-width: 639px) { .pill.user { order: -1; flex-basis: 100%; justify-content: center; } }

/* ===== Cabeçalho do mês ===== */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px; border-radius: var(--r); margin-bottom: 14px; }
.titles { text-align: center; min-width: 0; flex: 1; }
.titles h1 { margin: 0; font-size: clamp(1.45rem, 6.2vw, 2.3rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.titles p { margin: 4px 0 0; font-size: .82rem; font-weight: 600; color: var(--muted); }
.nav { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--hair); background: var(--cell); display: grid; place-items: center; }
.nav svg { width: 22px; height: 22px; }
.nav:active { transform: scale(.92); }

/* ===== Grade ===== */
.weekdays, .grade.dias { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekdays { margin: 0 2px 6px; font-size: clamp(.62rem, 2.4vw, .8rem); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: center; }
.grade { container: cal / inline-size; }
@media (min-width: 640px) { .weekdays, .grade.dias { gap: 8px; } }

.cell {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  min-width: 0; aspect-ratio: 1 / 1.24; padding: clamp(3px, 1.2cqw, 11px);
  border-radius: clamp(9px, 2.6cqw, 20px); border: 1px solid var(--hair);
  background: var(--cell); color: var(--text); text-align: left; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.cell:active { transform: scale(.95); }
@media (hover: hover) { .cell:hover { box-shadow: 0 6px 18px rgba(30,40,90,.16); transform: translateY(-1px); } }
.cell.vazio { visibility: hidden; pointer-events: none; }
.cell:focus-visible, .btn:focus-visible, .pill:focus-visible, .nav:focus-visible, .dock button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.num { font-size: clamp(11px, 3.7cqw, 26px); font-weight: 750; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.hoje { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.hoje .num { display: grid; place-items: center; min-width: 1.55em; height: 1.55em; margin: -.22em 0 0 -.22em; border-radius: 999px; background: var(--accent); color: #fff; }
.marks { position: absolute; top: clamp(3px, 1.2cqw, 10px); right: clamp(3px, 1.2cqw, 10px); display: flex; gap: clamp(2px, .5cqw, 4px); z-index: 1; }
.marks i { width: clamp(5px, 1.5cqw, 9px); height: clamp(5px, 1.5cqw, 9px); border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(255,255,255,.85); }
.m-evt { background: var(--evt); } .m-fer { background: var(--fer); }

/* Cores das turmas */
.c-vermelha { --c: var(--vermelha); } .c-azul { --c: var(--azul); } .c-verde { --c: var(--verde); }
.c-amarela { --c: var(--amarela); --on: #3a2c00; }
.c-A { --c: var(--A); } .c-B { --c: var(--B); } .c-C { --c: var(--C); }
.g { width: 100%; height: 100%; display: block; }

/* Geral 4 turmas: 4 quadradinhos (manhã, tarde, noite, folga) */
.chips4 { display: grid; grid-template-columns: 1fr 1fr; gap: 7%; width: 100%; padding: 0 2%; }
.chip { aspect-ratio: 1; border-radius: 30%; background: var(--c); color: var(--on, #fff); display: grid; place-items: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 1px 2px rgba(0,0,0,.18); }
.chip .g { width: 66%; height: 66%; }
.chip.folga { background: var(--c); }

/* Geral ABC */
.abc3 { display: grid; gap: clamp(1px, .5cqw, 4px); width: 100%; }
.abcrow { display: flex; align-items: center; justify-content: space-between; border-radius: clamp(3px, .9cqw, 7px); padding: 0 7%; height: clamp(9px, 3.3cqw, 24px); background: color-mix(in srgb, var(--c) 20%, transparent); }
.abcrow b { font-size: clamp(8px, 2.5cqw, 17px); font-weight: 800; color: var(--c); line-height: 1; }
.abcrow .g { width: clamp(8px, 2.5cqw, 17px); height: clamp(8px, 2.5cqw, 17px); color: var(--muted); }
.folga-total { display: grid; place-items: end start; color: var(--muted); }
.folga-total .g { width: clamp(14px, 5cqw, 34px); height: clamp(14px, 5cqw, 34px); }

/* Visão individual */
.cell.trab { background: linear-gradient(155deg, color-mix(in srgb, var(--c) 86%, white), var(--c)); color: var(--on, #fff); border-color: transparent; }
.cell.trab .hoje, .cell.trab.hoje { box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px rgba(255,255,255,.7); }
.cell.trab.hoje .num { background: #fff; color: var(--accent); }
.rodape { display: flex; align-items: flex-end; justify-content: space-between; gap: 2px; width: 100%; }
.lbl { font-size: clamp(7.5px, 2.3cqw, 14px); font-weight: 700; line-height: 1.1; letter-spacing: .01em; opacity: .95; overflow: hidden; text-overflow: ellipsis; }
.rodape .g { width: clamp(11px, 4.2cqw, 30px); height: clamp(11px, 4.2cqw, 30px); flex: none; }
.cell.livre { color: var(--text); }
.cell.livre .rodape { color: var(--muted); }

/* ===== Modo folgas ===== */
.grade.folgas { display: grid; gap: 14px; }
.folga-group { padding: 12px; border-radius: 22px; border: 1px dashed color-mix(in srgb, var(--muted) 45%, transparent); background: color-mix(in srgb, var(--cell) 70%, transparent); }
.folga-title { display: inline-flex; align-items: center; gap: 6px; margin: -26px 0 10px; padding: 6px 14px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; font-size: .84rem; }
.folga-title .g { width: 16px; height: 16px; }
.folga-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.folga-cards .cell { aspect-ratio: 1 / 1.1; padding: 8px; }
.folga-cards .num { font-size: 1.5rem; }
.folga-cards .dow { font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.folga-cards .lbl { font-size: .72rem; }
.folga-cards .rodape .g { width: 26px; height: 26px; }
.vazio-msg { margin: 28px 0; text-align: center; font-weight: 700; color: var(--muted); }

.acao { display: flex; justify-content: center; margin: 18px 0 4px; }
.legenda { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.legenda li { font-size: .78rem; font-weight: 600; padding: 4px 11px; border-radius: 999px; background: var(--cell); border: 1px solid var(--hair); display: flex; gap: 6px; align-items: center; }
.legenda li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--fer); }
.credits { margin-top: 22px; text-align: center; font-size: .78rem; color: var(--muted); display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.credits strong { color: var(--text); }
.credits a { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--cell); border: 1px solid var(--hair); color: var(--text); }
.credits svg { width: 14px; height: 14px; }

/* ===== Dock de visões ===== */
.dock {
  position: fixed; z-index: 30; left: 12px; right: 12px; max-width: 520px; margin: 0 auto;
  bottom: calc(12px + env(safe-area-inset-bottom)); padding: 8px; border-radius: 28px;
  display: grid; gap: 6px;
}
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 14px; background: color-mix(in srgb, var(--muted) 16%, transparent); }
.seg button { border: 0; background: transparent; border-radius: 11px; min-height: 32px; font-size: .8rem; font-weight: 700; color: var(--muted); transition: background .2s, color .2s; }
.seg button[aria-pressed="true"] { background: var(--glass-strong); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.opts { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
.opts button { display: grid; justify-items: center; gap: 4px; border: 0; background: transparent; padding: 6px 2px; border-radius: 16px; min-width: 0; }
.opts button span { font-size: .66rem; font-weight: 650; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opts button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.opts button[aria-pressed="true"] span { color: var(--text); }
.sw { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: .9rem; color: #fff; background: var(--c); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 2px 6px rgba(0,0,0,.22); }
.sw.c-amarela { color: #3a2c00; }
.sw.geral { background: conic-gradient(var(--vermelha) 0 25%, var(--azul) 0 50%, var(--verde) 0 75%, var(--amarela) 0); }
.opts button[aria-pressed="true"] .sw { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

/* ===== Diálogos / sheets ===== */
dialog { border: 0; padding: 0; background: transparent; color: var(--text); width: 100%; max-width: 100%; max-height: 100dvh; margin: auto auto 0; overflow: visible; }
dialog::backdrop { background: rgba(6,9,20,.38); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
dialog[open] { animation: subir .3s cubic-bezier(.2,.9,.3,1); }
dialog[open]::backdrop { animation: aparecer .25s ease; }
@keyframes subir { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: relative; width: 100%; max-width: 460px; margin: 0 auto; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); border-radius: 30px 30px 0 0;
  background: var(--glass-strong); border: 1px solid var(--stroke); border-bottom: 0;
  -webkit-backdrop-filter: blur(40px) saturate(1.8); backdrop-filter: blur(40px) saturate(1.8); box-shadow: 0 -10px 50px rgba(0,0,0,.25);
}
@media (min-width: 640px) { dialog { margin: auto; } .sheet { border-radius: 30px; border-bottom: 1px solid var(--stroke); padding-bottom: 22px; } }
.sheet h2 { margin: 0 34px 14px 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.sheet h2.evt { color: var(--evt); }
.sheet h3 { margin: 22px 0 10px; font-size: 1rem; color: var(--evt); }
.sheet .sub { margin: -8px 0 16px; color: var(--muted); }
.fechar { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 50%; border: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--muted) 22%, transparent); color: var(--muted); }
.fechar svg { width: 16px; height: 16px; }
.dica { margin: 0 0 14px; color: var(--muted); font-size: .9rem; }
.campo { display: grid; gap: 6px; margin-bottom: 14px; }
.campo > span { font-size: .8rem; font-weight: 700; color: var(--muted); }
.campo em { font-weight: 500; font-style: normal; }
input { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--hair); background: var(--field); font-size: 16px; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn { width: 100%; min-height: 50px; border: 0; border-radius: 16px; background: var(--accent); color: #fff; font-weight: 700; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.sec { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--text); }
.btn.perigo { background: var(--danger); }
.par { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; margin-bottom: 18px; border-radius: 14px; background: color-mix(in srgb, var(--muted) 16%, transparent); }
.tabs button { border: 0; background: transparent; min-height: 36px; border-radius: 11px; font-weight: 700; color: var(--muted); }
.tabs button.on { background: var(--glass-strong); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.ou { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: .8rem; }
.ou::before, .ou::after { content: ""; height: 1px; background: var(--hair); }
#google-btn { display: flex; justify-content: center; min-height: 44px; }
.msg { margin-top: 14px; padding: 0; font-weight: 600; font-size: .9rem; text-align: center; }
.msg.erro, .msg.sucesso { padding: 11px 14px; border-radius: 14px; }
.msg.erro { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.msg.sucesso { background: color-mix(in srgb, var(--verde) 20%, transparent); color: color-mix(in srgb, var(--verde) 70%, var(--text)); }
.detalhes { margin: 0 0 18px; display: grid; gap: 1px; border-radius: 16px; overflow: hidden; background: var(--hair); }
.detalhes div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 14px; background: var(--field); }
.detalhes dt { color: var(--muted); font-weight: 600; } .detalhes dd { margin: 0; font-weight: 700; text-align: right; }
.confirma { margin: 4px 0 18px; font-size: 1.05rem; font-weight: 650; text-align: center; }
.sheet.pequena { max-width: 380px; }
.convites { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.convites li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--field); }
.convites span { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.convites button { border: 0; border-radius: 10px; min-height: 34px; padding: 0 14px; background: var(--verde); color: #fff; font-weight: 700; flex: none; }

/* ===== Toasts ===== */
.toasts { position: fixed; z-index: 100; left: 12px; right: 12px; top: max(12px, env(safe-area-inset-top)); display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast { max-width: 440px; padding: 12px 18px; border-radius: 18px; font-weight: 650; font-size: .9rem; text-align: center; background: var(--glass-strong); border: 1px solid var(--stroke); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(24px) saturate(1.8); backdrop-filter: blur(24px) saturate(1.8); animation: descer .3s cubic-bezier(.2,.9,.3,1); }
.toast.erro { color: var(--danger); }
@keyframes descer { from { transform: translateY(-16px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 640px) {
  body { padding-left: 24px; padding-right: 24px; padding-top: 24px; }
  .app { max-width: 900px; }
  .hero { padding: 20px 22px; }
  .cell { aspect-ratio: 1 / 1.08; }
  .chips4 { max-width: 78px; margin-inline: auto; }
  .lbl { font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
