:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #070707;
  --surface-2: #101010;
  --surface-3: #171717;
  --line: #242424;
  --line-red: #3b101b;
  --red: #e20f3f;
  --red-2: #a9082b;
  --wine: #14060b;
  --green: #38d17a;
  --yellow: #f4c542;
  --text: #f7f2eb;
  --muted: #a7a7a7;
  --soft: #d6d6d6;
  --danger: #ff6b6b;
  --radius: 22px;
  --shadow: 0 24px 80px rgba(0, 0, 0, .55), 0 0 36px rgba(226, 15, 63, .08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% -10%, rgba(226, 15, 63, .26), transparent 32rem),
    radial-gradient(circle at 12% 8%, rgba(226, 15, 63, .13), transparent 24rem),
    linear-gradient(180deg, #040404 0%, #000 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .62; cursor: not-allowed; }

.app-root {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 14px;
}

.phone-shell {
  position: relative;
  width: min(100%, 456px);
  min-height: calc(100vh - 28px);
  background: linear-gradient(180deg, rgba(10,10,10,.98), rgba(0,0,0,.98));
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 34px;
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
}
.phone-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(226,15,63,.14), transparent 19rem);
  z-index: -1;
}
.compact-shell { min-height: auto; padding: 28px 20px; align-self: center; }
.auth-only { align-items: center; }

.app-scroll {
  height: calc(100vh - 28px);
  min-height: 680px;
  overflow-y: auto;
  padding: 18px 16px calc(106px + var(--safe-bottom));
  scrollbar-width: thin;
}
.auth-scroll { padding: 22px 18px 32px; min-height: calc(100vh - 28px); }

.logo-frame {
  width: 104px;
  min-height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: 20px;
  background: #000;
  border: 1px solid rgba(226, 15, 63, .24);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 0 30px rgba(226,15,63,.11);
}
.logo-frame img { width: 100%; max-height: 54px; object-fit: contain; display: block; }
.logo-frame.small { width: 60px; min-height: 48px; border-radius: 16px; padding: 8px; }

.brand-lockup { text-align: center; padding: 18px 8px 20px; }
.brand-lockup h1 { margin: 14px 0 6px; font-size: clamp(2rem, 8vw, 3.1rem); line-height: .94; letter-spacing: -.07em; }
.brand-lockup .subtitle { margin: 0 auto; max-width: 270px; color: var(--soft); font-size: .96rem; line-height: 1.55; }
.eyebrow { margin: 0 0 8px; color: var(--red); text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; font-weight: 800; }
.muted { color: var(--muted); }
.center { text-align: center; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
  margin-bottom: 14px;
}
.auth-tabs button {
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  min-height: 42px;
  font-weight: 800;
}
.auth-tabs button.active { color: #fff; background: var(--red); }

.form-card, .dark-card, .stat-card, .location-card, .student-card, .calendar-card {
  background: linear-gradient(180deg, rgba(20,20,20,.98), rgba(10,10,10,.98));
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  padding: 16px;
}
.form-card { display: grid; gap: 13px; }
label { display: grid; gap: 7px; color: #d8d8d8; font-size: .82rem; font-weight: 750; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid #2b2b2b;
  outline: none;
  background: #080808;
  color: #fff;
  padding: 0 14px;
}
textarea { padding: 12px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(226,15,63,.78); box-shadow: 0 0 0 3px rgba(226,15,63,.12); }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-help { margin: 0; min-height: 18px; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.form-help.error { color: var(--danger); }
.form-help.success { color: var(--green); }

.primary-button, .secondary-button, .danger-button, .ghost-button {
  min-height: 48px;
  border-radius: 999px;
  border: 0;
  padding: 0 18px;
  font-weight: 900;
  letter-spacing: -.01em;
}
.primary-button { color: #fff; background: linear-gradient(180deg, #f3184c, #b90830); box-shadow: 0 16px 34px rgba(226,15,63,.22); }
.secondary-button { color: #fff; background: #171717; border: 1px solid #2b2b2b; }
.danger-button { color: #fff; background: #60111f; border: 1px solid rgba(255, 107, 107, .24); }
.ghost-button { color: #ddd; background: transparent; border: 1px solid #2a2a2a; }
.ghost-link { display: inline-block; color: var(--muted); text-align: center; padding: 12px; text-decoration: none; }
.link-button { border: 0; padding: 0; color: var(--red); background: transparent; font-weight: 800; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
}
.app-header h2 { margin: 0; font-size: 1.22rem; line-height: 1.1; }
.header-sub { margin: 3px 0 0; color: var(--muted); font-size: .78rem; }
.header-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button {
  width: 44px; height: 44px; border-radius: 16px;
  border: 1px solid #292929; background: #101010; color: #fff;
}

.status-pill, .belt-pill, .class-pill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 0 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 850; border: 1px solid transparent;
}
.status-pill.ok { color: #bbffd7; border-color: rgba(56,209,122,.24); background: rgba(56,209,122,.10); }
.status-pill.warn { color: #ffe0a6; border-color: rgba(244,197,66,.22); background: rgba(244,197,66,.08); }
.status-pill.danger { color: #ffc2c2; border-color: rgba(255,107,107,.2); background: rgba(255,107,107,.08); }
.status-pill.neutral { color: #d5d5d5; border-color: #303030; background: #151515; }
.belt-pill { background: #fff; color: #111; border-color: rgba(255,255,255,.25); }
.class-pill { background: rgba(226,15,63,.09); color: #ffd7df; border-color: rgba(226,15,63,.22); }

.hero-card {
  position: relative; overflow: hidden;
  background: radial-gradient(circle at 100% 0, rgba(226,15,63,.28), transparent 210px), linear-gradient(160deg, #19060c, #070707 52%);
  border: 1px solid var(--line-red);
  border-radius: 28px;
  padding: 20px;
  margin-bottom: 14px;
}
.hero-card h1 { margin: 0 0 8px; font-size: 1.9rem; letter-spacing: -.06em; line-height: 1; }
.hero-card p { margin: 0; color: var(--soft); line-height: 1.55; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.stat-card { padding: 14px; }
.stat-card strong { display: block; margin: 8px 0 2px; font-size: 1.55rem; letter-spacing: -.06em; }
.stat-card span { color: var(--muted); font-size: .78rem; }
.stat-card.red { background: linear-gradient(160deg, #1d0610, #0a0a0a); border-color: rgba(226,15,63,.22); }
.progress-wrap { margin-top: 12px; }
.progress-label { display:flex; justify-content:space-between; color: var(--muted); font-size:.82rem; margin-bottom:7px; }
.progress-bar { height: 11px; background: #181818; border-radius: 999px; overflow:hidden; border:1px solid #272727; }
.progress-bar div { height:100%; background: linear-gradient(90deg, var(--red), #ff5076); border-radius:999px; }

.section-title { display:flex; align-items:center; justify-content:space-between; gap:10px; margin: 18px 0 10px; }
.section-title h3 { margin:0; font-size:1rem; }
.section-title span { color: var(--muted); font-size:.78rem; }

.calendar-card { padding: 14px; }
.calendar-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.calendar-header button { width:36px; height:36px; border-radius:12px; border:1px solid #2a2a2a; background:#101010; color:#fff; }
.calendar-grid { display:grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.calendar-dayname { color:#777; font-size:.68rem; text-align:center; font-weight:800; }
.calendar-day {
  aspect-ratio: 1;
  border: 1px solid #252525;
  background: #0c0c0c;
  color: #dedede;
  border-radius: 13px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:.78rem;
  font-weight:850;
  position: relative;
}
.calendar-day.is-empty { visibility:hidden; }
.calendar-day.present { border-color: rgba(56,209,122,.55); color:#c9ffdf; background: rgba(56,209,122,.12); }
.calendar-day.absent { border-color: rgba(226,15,63,.6); color:#ffd1da; background: rgba(226,15,63,.13); }
.calendar-day.off { color:#6f6f6f; background:#080808; }
.calendar-day.today { outline: 2px solid rgba(255,255,255,.25); }

.record-list { display:grid; gap: 10px; }
.attendance-item { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px; background:#0f0f0f; border:1px solid #242424; border-radius:18px; }
.attendance-item strong { display:block; font-size:.91rem; }
.attendance-item span { color:var(--muted); font-size:.75rem; }

.location-card { border-color: rgba(226,15,63,.16); }
.location-metric { display:grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.location-metric div { background:#0b0b0b; border:1px solid #242424; border-radius:16px; padding:12px; }
.location-metric strong { display:block; font-size:1.05rem; }
.location-metric span { color:var(--muted); font-size:.76rem; }

.filter-chips { display:flex; gap:8px; overflow-x:auto; padding-bottom:6px; margin-bottom: 12px; }
.filter-chips button { flex: 0 0 auto; min-height: 36px; padding: 0 12px; border-radius:999px; background:#101010; border:1px solid #282828; color:#ddd; font-weight:800; font-size:.78rem; }
.filter-chips button.active { color:#fff; background:var(--red); border-color:var(--red); }
.search-input { margin-bottom: 10px; }
.student-list { display:grid; gap: 10px; }
.student-card { display:flex; align-items:center; gap:12px; padding: 13px; }
.avatar { width:46px; height:46px; border-radius:17px; display:grid; place-items:center; color:#fff; background:linear-gradient(160deg, #e20f3f, #440817); font-weight:900; }
.student-main { flex:1; min-width:0; }
.student-main strong { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.student-main span { display:block; color:var(--muted); font-size:.76rem; margin-top:3px; }
.student-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
.student-actions button { min-height:40px; padding:0 12px; border-radius:999px; font-size:.78rem; }

.bottom-nav {
  position:absolute;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-bottom));
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  border-radius: 24px;
  background: rgba(10,10,10,.94);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 -18px 45px rgba(0,0,0,.45);
  backdrop-filter: blur(16px);
}
.bottom-nav button {
  border: 0;
  min-height: 58px;
  border-radius: 18px;
  color: var(--muted);
  background: transparent;
  display:grid;
  place-items:center;
  gap:2px;
  font-size:.68rem;
  font-weight:850;
}
.bottom-nav button b { font-size:1.15rem; line-height:1; }
.bottom-nav button.active { color:#fff; background:linear-gradient(180deg, rgba(226,15,63,.9), rgba(150,8,38,.9)); }

.empty-state { text-align:center; padding: 24px 18px; color: var(--muted); background:#0d0d0d; border:1px dashed #303030; border-radius:22px; }
.toast-stack { position: fixed; z-index: 50; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(420px, calc(100% - 24px)); display:grid; gap:8px; }
.toast { padding: 13px 14px; border-radius: 16px; color:#fff; background:#151515; border:1px solid #2c2c2c; box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.toast.success { border-color: rgba(56,209,122,.25); }
.toast.error { border-color: rgba(255,107,107,.3); }
.offline-bar { position:fixed; top:0; left:0; right:0; z-index:40; background:#42101a; color:#fff; padding:10px; text-align:center; font-size:.83rem; }
.install-button { position:fixed; right:16px; bottom:16px; z-index:30; min-height:44px; border:0; border-radius:999px; padding:0 16px; background:var(--red); color:#fff; font-weight:900; box-shadow:0 18px 36px rgba(0,0,0,.38); }

.debug-box { margin-top: 12px; padding: 12px; border-radius: 16px; background:#080808; border:1px solid #252525; color:#999; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size:.72rem; overflow:auto; }
.two-actions { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:12px; }

@media (max-width: 390px) {
  .app-root { padding: 0; }
  .phone-shell { min-height: 100vh; border-radius: 0; border:0; width:100%; }
  .app-scroll { height: 100vh; min-height: 100vh; padding-left: 14px; padding-right:14px; }
  .form-grid { grid-template-columns: 1fr; }
  .brand-lockup h1 { font-size: 2.15rem; }
  .stat-grid { gap:8px; }
  .bottom-nav { left:8px; right:8px; bottom: calc(8px + var(--safe-bottom)); }
}

/* Ajustes finais - identidade e produto final */
.auth-shell {
  background: radial-gradient(circle at 50% 0%, rgba(226,15,63,.18), transparent 18rem), linear-gradient(180deg, #12060b, #010101 46%);
}
.final-brand { padding-top: 26px; }
.final-brand h1 {
  font-size: clamp(2.45rem, 11vw, 4.05rem);
  letter-spacing: -.075em;
  line-height: .92;
  margin-top: 16px;
}
.final-brand .subtitle { max-width: 310px; font-size: .98rem; color: #f3f0ea; }
.auth-card-final {
  background: linear-gradient(180deg, rgba(18,18,18,.98), rgba(9,9,9,.98));
  border-color: rgba(255,255,255,.09);
  box-shadow: 0 16px 44px rgba(0,0,0,.45);
}
.belt-selector {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.belt-selector legend {
  grid-column: 1 / -1;
  color: #d8d8d8;
  font-size: .82rem;
  font-weight: 800;
  margin-bottom: 2px;
}
.belt-option {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid #2b2b2b;
  background: #0a0a0a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}
.belt-option span {
  width: 18px;
  height: 7px;
  border-radius: 999px;
  background: var(--belt);
  border: 1px solid rgba(255,255,255,.28);
}
.belt-option.active {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(226,15,63,.12), 0 12px 28px rgba(226,15,63,.14);
}
.welcome-panel, .admin-hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 100% 0, rgba(226,15,63,.26), transparent 220px), linear-gradient(160deg, #18060c, #080808 58%);
  border: 1px solid rgba(226,15,63,.20);
  border-radius: 28px;
  padding: 20px;
  margin-bottom: 14px;
}
.welcome-panel h1, .admin-hero h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  line-height: .98;
  letter-spacing: -.06em;
}
.welcome-panel p, .admin-hero p { margin: 0; color: var(--soft); line-height: 1.5; }
.red-summary-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: linear-gradient(160deg, #3a0613, #110208);
  border: 1px solid rgba(226,15,63,.28);
  border-radius: 24px;
  overflow: hidden;
  margin: 12px 0;
}
.red-summary-card div { padding: 16px 12px; text-align: center; background: rgba(0,0,0,.18); }
.red-summary-card span, .red-summary-card small { display: block; color: #b9a2aa; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; }
.red-summary-card strong { display: block; color: #fff; font-size: 1.85rem; line-height: 1; margin: 7px 0 5px; }
.pin-card, .next-class-card, .cancel-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0d0d0d;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  padding: 14px;
  margin: 12px 0;
}
.pin-card.inside { border-color: rgba(56,209,122,.28); background: rgba(56,209,122,.055); }
.pin-card.outside { border-color: rgba(244,197,66,.24); background: rgba(244,197,66,.045); }
.pin-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); box-shadow: 0 0 20px rgba(226,15,63,.7); flex: 0 0 auto; }
.pin-card.inside .pin-dot { background: var(--green); box-shadow: 0 0 18px rgba(56,209,122,.7); }
.pin-card.outside .pin-dot { background: var(--yellow); box-shadow: 0 0 18px rgba(244,197,66,.65); }
.pin-card div:nth-child(2), .next-class-card { flex: 1; }
.pin-card strong, .next-class-card strong, .cancel-card strong { display: block; color: #fff; }
.pin-card span, .next-class-card span, .next-class-card small, .cancel-card span { display: block; color: var(--muted); font-size: .78rem; margin-top: 3px; }
.next-class-card { display: block; }
.next-class-card.cancelled { border-color: rgba(255,107,107,.28); background: rgba(255,107,107,.055); }
.compact-stats { grid-template-columns: 1fr 1fr; }
.admin-tools {
  background: linear-gradient(180deg, rgba(20,20,20,.96), rgba(8,8,8,.96));
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 22px;
  padding: 14px;
  margin-bottom: 12px;
}
.filter-chips { flex-wrap: wrap; overflow: visible; padding-bottom: 0; }
.student-list.enhanced { gap: 12px; }
.enhanced-card {
  width: 100%;
  border: 1px solid rgba(255,255,255,.07);
  background: radial-gradient(circle at 0 0, rgba(226,15,63,.18), transparent 120px), linear-gradient(180deg, #151515, #0b0b0b);
  color: #fff;
  text-align: left;
  transition: transform .18s ease, border-color .18s ease;
}
.enhanced-card:hover { transform: translateY(-1px); border-color: rgba(226,15,63,.28); }
.avatar { background: linear-gradient(160deg, var(--avatar-color, #e20f3f), #22030b); color: #fff; border: 1px solid rgba(255,255,255,.08); }
.student-side { text-align: right; display: grid; justify-items: end; gap: 2px; }
.student-side strong { font-size: 1.15rem; line-height: 1; }
.student-side small { color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; }
.status-dot { font-style: normal; font-size: .68rem; border-radius: 999px; padding: 4px 8px; margin-top: 4px; border: 1px solid #303030; color: #ddd; }
.status-dot.active { border-color: rgba(56,209,122,.28); color: #c9ffdd; background: rgba(56,209,122,.08); }
.status-dot.pending { border-color: rgba(244,197,66,.24); color: #ffe0a6; background: rgba(244,197,66,.08); }
.status-dot.inactive { border-color: rgba(255,107,107,.22); color: #ffc2c2; background: rgba(255,107,107,.08); }
.class-cancel-actions { display: grid; grid-template-columns: 1fr 1fr; }
.class-cancel-actions button:first-child { grid-column: 1 / -1; }
@media (min-width: 980px) {
  .app-root { align-items: center; padding: 24px; }
  .staff-shell { width: min(100%, 760px); }
  .staff-shell .app-scroll { min-height: 760px; }
  .student-list.enhanced { grid-template-columns: 1fr 1fr; }
  .staff-shell .calendar-grid { gap: 9px; }
}
@media (max-width: 390px) {
  .belt-selector { grid-template-columns: repeat(2, 1fr); }
  .red-summary-card strong { font-size: 1.55rem; }
  .class-cancel-actions { grid-template-columns: 1fr; }
}

/* v3 — acabamento final mais próximo do mockup original */
.app-root {
  align-items: stretch;
  padding: 0;
}
.auth-layout {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}
.auth-panel {
  width: min(100%, 430px);
  background: radial-gradient(circle at 50% 0%, rgba(226,15,63,.20), transparent 17rem), linear-gradient(180deg, #12060b, #010101 48%);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 28px;
  padding: 24px 18px;
  box-shadow: var(--shadow);
}
.auth-layout-register .auth-panel { width: min(100%, 500px); }
.auth-brand-strip { text-align: center; padding: 0 6px 18px; }
.auth-brand-strip h1 {
  margin: 12px 0 6px;
  font-size: clamp(1.9rem, 8vw, 2.9rem);
  letter-spacing: -.07em;
  line-height: .95;
}
.auth-brand-strip .subtitle {
  margin: 0 auto;
  max-width: 290px;
  color: #f1eee8;
  font-size: .9rem;
  line-height: 1.45;
}
.auth-brand-strip .logo-frame { width: 84px; min-height: 54px; border-radius: 16px; padding: 9px; }
.auth-brand-strip .eyebrow { margin-top: 10px; margin-bottom: 0; }
.form-kicker {
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-weight: 900;
}
.class-selector {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.class-selector legend {
  grid-column: 1 / -1;
  color: #d8d8d8;
  font-size: .82rem;
  font-weight: 800;
  margin-bottom: 2px;
}
.class-option {
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid #2b2b2b;
  background: #0a0a0a;
  color: #fff;
  font-size: .78rem;
  font-weight: 900;
}
.class-option.active {
  border-color: var(--red);
  background: rgba(226,15,63,.08);
  box-shadow: 0 0 0 3px rgba(226,15,63,.10);
}
.app-shell {
  position: relative;
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(10,10,10,.98), rgba(0,0,0,.98));
  overflow: hidden;
  isolation: isolate;
}
.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(226,15,63,.16), transparent 20rem);
  z-index: -1;
}
.app-shell .app-scroll {
  height: 100vh;
  min-height: 100vh;
  padding: 18px 16px calc(104px + var(--safe-bottom));
}
.empty-state strong { display:block; color:#f7f2eb; margin-bottom:6px; }
.empty-state span { display:block; color:var(--muted); }
.student-main small { display:block; margin-top:4px; color:#777; font-size:.69rem; }
.install-button {
  right: 14px;
  bottom: calc(96px + var(--safe-bottom));
  z-index: 29;
  min-height: 42px;
  font-size: .86rem;
}
.install-button::after {
  content: "×";
  margin-left: 10px;
  opacity: .65;
}
@media (max-width: 720px) {
  .auth-layout { padding: 0; place-items: stretch; }
  .auth-panel {
    width: 100%;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    padding: 26px 18px calc(28px + var(--safe-bottom));
  }
  .auth-layout-register .auth-panel { width: 100%; }
  .app-shell { width: 100%; border-radius: 0; border: 0; }
}
@media (min-width: 980px) {
  .app-root {
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
  }
  .auth-panel { width: min(100%, 460px); }
  .auth-layout-register .auth-panel { width: min(100%, 720px); }
  .auth-layout-register .register-card-final {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .auth-layout-register .register-card-final > label:first-of-type,
  .auth-layout-register .register-card-final > label:nth-of-type(3),
  .auth-layout-register .register-card-final > label:nth-of-type(4),
  .auth-layout-register .form-kicker,
  .auth-layout-register .belt-selector,
  .auth-layout-register .class-selector,
  .auth-layout-register .primary-button,
  .auth-layout-register .form-help {
    grid-column: 1 / -1;
  }
  .app-shell {
    width: min(100%, 1180px);
    min-height: min(860px, calc(100vh - 48px));
    border-radius: 28px;
    border: 1px solid rgba(255,255,255,.07);
    box-shadow: var(--shadow);
  }
  .app-shell .app-scroll {
    height: min(860px, calc(100vh - 48px));
    min-height: auto;
    padding: 24px 26px 112px;
  }
  .student-shell { width: min(100%, 900px); }
  .staff-shell { width: min(100%, 1180px); }
  .staff-shell #screen {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
  }
  .staff-shell #screen > .admin-tools,
  .staff-shell #screen > .student-list,
  .staff-shell #screen > .calendar-card,
  .staff-shell #screen > .record-list {
    grid-column: 1 / -1;
  }
  .student-list.enhanced { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bottom-nav { left: 26px; right: 26px; bottom: calc(18px + var(--safe-bottom)); max-width: 560px; margin: 0 auto; }
  .install-button { bottom: 24px; right: 24px; }
}
@media (max-width: 390px) {
  .class-selector { grid-template-columns: 1fr; }
  .auth-brand-strip h1 { font-size: 2.15rem; }
}

/* v4 — Respire Jiu-Jitsu | Six Blades */
:root { --safe-bottom: env(safe-area-inset-bottom, 0px); }
html, body { min-height: 100%; }
body { overflow-x: hidden; }
.app-root { min-height: 100dvh; }
.app-shell {
  min-height: 100dvh;
  width: 100%;
  max-width: none;
}
.app-shell .app-scroll {
  height: 100dvh;
  min-height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(118px + var(--safe-bottom));
}
.bottom-nav {
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 12px));
  right: max(12px, env(safe-area-inset-right, 12px));
  bottom: calc(10px + var(--safe-bottom));
  grid-template-columns: repeat(var(--nav-count, 5), minmax(74px, 1fr));
  overflow-x: auto;
  overscroll-behavior-x: contain;
  z-index: 60;
}
.staff-shell .bottom-nav { grid-template-columns: repeat(8, minmax(76px, 1fr)); }
.student-shell .bottom-nav { grid-template-columns: repeat(5, minmax(74px, 1fr)); }
.bottom-nav button { min-width: 72px; }
.install-button {
  bottom: calc(104px + var(--safe-bottom));
  z-index: 55;
}
.toast-stack { bottom: calc(110px + var(--safe-bottom)); z-index: 90; }
.brand-duo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.brand-duo .logo-frame.respire { width: 76px; min-height: 76px; border-radius: 50%; padding: 6px; background:#050505; }
.brand-duo .logo-frame.six { width: 116px; min-height: 58px; }
.brand-duo.small { gap: 7px; justify-content: flex-start; }
.brand-duo.small .logo-frame.respire { width: 48px; min-height: 48px; padding: 4px; }
.brand-duo.small .logo-frame.six { width: 72px; min-height: 46px; padding: 7px; }
.brand-divider { width: 1px; height: 38px; background: rgba(255,255,255,.16); }
.brand-duo.small .brand-divider { height: 30px; }
.app-header .brand-duo.small .logo-frame.six { display: none; }
@media (min-width: 420px) { .app-header .brand-duo.small .logo-frame.six { display: inline-flex; } }
.app-header h2 { max-width: 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-grid { display:grid; gap: 12px; }
.event-card {
  overflow:hidden;
  background: linear-gradient(180deg, rgba(18,18,18,.98), rgba(8,8,8,.98));
  border:1px solid rgba(226,15,63,.18);
  border-radius:24px;
}
.event-card img { width:100%; height:160px; object-fit:cover; display:block; }
.event-card > div { padding:16px; }
.event-card h3 { margin:10px 0 6px; font-size:1.08rem; }
.event-card p { margin:0 0 10px; color:var(--soft); line-height:1.45; }
.event-card small { color:var(--muted); }
.event-card footer { padding: 0 16px 16px; display:flex; align-items:center; justify-content:space-between; gap:10px; color:var(--muted); }
.event-fallback { min-height:130px; display:grid; place-items:center; font-size:2.7rem; font-weight:950; letter-spacing:.12em; color:rgba(255,255,255,.12); background: radial-gradient(circle at 50% 0, rgba(226,15,63,.24), transparent 180px), #080808; }
.ranking-list { display:grid; gap:10px; }
.ranking-row, .mini-row {
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px;
  background:#0d0d0d;
  border:1px solid rgba(255,255,255,.07);
  border-radius:18px;
}
.ranking-row b { width:28px; height:28px; border-radius:10px; display:grid; place-items:center; background:rgba(226,15,63,.15); color:#fff; }
.ranking-row div, .mini-row div { flex:1; min-width:0; }
.ranking-row strong, .mini-row strong { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ranking-row span:not(.avatar), .mini-row span:not(.avatar) { display:block; color:var(--muted); font-size:.75rem; margin-top:2px; }
.ranking-row em { font-style:normal; font-weight:950; font-size:1.2rem; color:#fff; }
.small-avatar { width:34px; height:34px; border-radius:12px; font-size:.78rem; }
.action-panel { display:grid; gap:14px; }
.action-group { display:grid; gap:8px; padding:12px; border:1px solid rgba(255,255,255,.06); border-radius:18px; background:#0b0b0b; }
.action-group > strong { font-size:.78rem; text-transform:uppercase; letter-spacing:.13em; color:var(--muted); }
.admin-form { margin-bottom: 14px; }
@media (min-width: 980px) {
  .app-root { padding: 24px; align-items:center; }
  .app-shell {
    width: min(100%, 1220px);
    min-height: min(900px, calc(100dvh - 48px));
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,.07);
  }
  .app-shell .app-scroll {
    height: min(900px, calc(100dvh - 48px));
    min-height: auto;
    padding: 24px 28px 118px;
  }
  .staff-shell #screen {
    display:grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
  .staff-shell #screen > .admin-hero,
  .staff-shell #screen > .admin-tools,
  .staff-shell #screen > .student-list,
  .staff-shell #screen > .event-grid,
  .staff-shell #screen > .ranking-card,
  .staff-shell #screen > .record-list,
  .staff-shell #screen > .calendar-card,
  .staff-shell #screen > .form-card.admin-form { grid-column: 1 / -1; }
  .event-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bottom-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(920px, calc(100% - 48px));
    bottom: 22px;
  }
  .install-button { bottom: 24px; }
}
@supports not (min-height: 100dvh) {
  .app-root, .app-shell { min-height: 100vh; }
  .app-shell .app-scroll { height: 100vh; min-height: 100vh; }
}

/* V5 - eventos, paginação, upload e UX de histórico */
.filter-panel {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: center;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 22px;
  background: rgba(15,15,15,.88);
}
.filter-panel input,
.filter-panel select {
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: #050505;
  color: var(--text);
  padding: 0 14px;
  font-weight: 800;
}
.inline-check {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--soft);
  font-weight: 800;
}
.inline-check input { min-height: auto; width: 18px; height: 18px; accent-color: var(--red); }
.event-stats { margin-bottom: 12px; }
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 14px 0;
  color: var(--muted);
  font-weight: 800;
}
.pagination button:disabled { opacity: .45; pointer-events: none; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(8px);
}
.modal-card {
  width: min(760px, 100%);
  max-height: min(88dvh, 820px);
  overflow: auto;
  border-radius: 26px;
  border: 1px solid rgba(226,15,63,.25);
  background: linear-gradient(145deg, rgba(20,20,20,.98), rgba(6,6,6,.98));
  box-shadow: 0 30px 90px rgba(0,0,0,.55), 0 0 50px rgba(226,15,63,.12);
  padding: 18px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.modal-header h2 { margin: 4px 0 0; font-size: 1.4rem; }
.upload-zone {
  position: relative;
  min-height: 148px;
  border: 1px dashed rgba(255,255,255,.22);
  border-radius: 20px;
  background: radial-gradient(circle at top, rgba(226,15,63,.14), rgba(8,8,8,.92));
  display: grid;
  place-items: center;
  text-align: center;
  gap: 6px;
  color: var(--soft);
  overflow: hidden;
  cursor: pointer;
}
.upload-zone.dragging { border-color: var(--red); box-shadow: 0 0 30px rgba(226,15,63,.18); }
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-zone img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  display: block;
}
.upload-zone .ghost-button { position: absolute; right: 12px; bottom: 12px; z-index: 2; }
.event-card.past-event { opacity: .58; filter: grayscale(.35); }
.event-card .event-audience { display:block; margin-top: 5px; }
.calendar-day { border: 0; font-family: inherit; cursor: pointer; }
.calendar-day.selected { border-color: var(--red); box-shadow: 0 0 0 2px rgba(226,15,63,.35); }
.calendar-day.cancelled { color:#bbb; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); }
.calendar-legend {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  margin-top:12px;
  color:var(--muted);
  font-size:.78rem;
  font-weight:800;
}
.calendar-legend i { display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:5px; }
.ok-dot { background:#22c55e; }
.danger-dot { background:var(--red); }
.neutral-dot { background:#777; }
.ranking-row.top-rank {
  background: linear-gradient(90deg, rgba(226,15,63,.16), rgba(20,20,20,.92));
  border-color: rgba(226,15,63,.22);
}
.ranking-row.top-rank b { font-size: 1.25rem; }
.student-ranking-card { margin: 12px 0; }
.event-modal select,
.event-modal input,
.event-modal textarea { width: 100%; }
@media (min-width: 920px) {
  .event-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .modal-card { padding: 24px; }
}
@media (max-width: 560px) {
  .filter-panel { grid-template-columns: 1fr; }
  .pagination { justify-content: space-between; }
  .modal-backdrop { padding: 8px; align-items: end; }
  .modal-card { border-radius: 26px 26px 0 0; max-height: 92dvh; }
}
