/* Jefferson Lima Surf School - visual system v3 */
:root {
  --jl-navy: #062846;
  --jl-navy-2: #0a3d67;
  --jl-blue: #078bd0;
  --jl-ocean: #006db8;
  --jl-teal: #08a99e;
  --jl-aqua: #3fd5d0;
  --jl-mist: #eef9fc;
  --jl-cloud: #f8fcfe;
  --jl-white: #ffffff;
  --jl-copy: #587286;
  --jl-line: #d9e9ef;
  --jl-green: #079c72;
  --jl-red: #df4051;
  --jl-orange: #ef932f;
  --jl-radius: 8px;
  --jl-shadow: 0 12px 32px rgba(5, 45, 76, 0.08);
  --jl-shadow-strong: 0 22px 55px rgba(5, 45, 76, 0.16);
  --ink: var(--jl-navy);
  --ink-soft: var(--jl-copy);
  --brand: var(--jl-teal);
  --brand-dark: #057b74;
  --brand-blue: var(--jl-blue);
  --surface: var(--jl-white);
  --surface-soft: var(--jl-cloud);
  --surface-aqua: #e8f8f7;
  --border: var(--jl-line);
  --radius: var(--jl-radius);
  --shadow-soft: var(--jl-shadow);
}

html { background: var(--jl-cloud); }

html.login-active,
body.login-active {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body.login-active {
  position: fixed;
  inset: 0;
  background: #dff6fc;
}

body.login-active::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #dff6fc url("/assets/login-surf-desktop.webp") center / cover no-repeat;
  pointer-events: none;
}

body.login-active #app {
  position: fixed;
  z-index: 1;
  top: var(--login-viewport-top, 0px);
  left: var(--login-viewport-left, 0px);
  width: var(--login-viewport-width, 100vw);
  height: var(--login-viewport-height, 100dvh);
  overflow: hidden;
}

body.login-active #toast {
  position: fixed;
  z-index: 100;
  right: auto;
  bottom: calc(var(--login-covered-bottom, 0px) + max(12px, env(safe-area-inset-bottom)));
  left: 50%;
  width: min(calc(100vw - 24px), 420px);
  max-width: none;
  transform: translateX(-50%);
}

body,
body .app-shell {
  background: var(--jl-cloud);
  color: var(--jl-navy);
  font-family: Inter, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea { letter-spacing: 0; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(7, 139, 208, 0.24);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.ui-icon,
.ui-icon svg,
svg.lucide {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  flex: 0 0 auto;
  vertical-align: -0.17em;
}

/* Login */
.login-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  padding: max(22px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: transparent;
}

.login-shell::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: rgba(247, 252, 254, 0.08);
  pointer-events: none;
}

.login-content {
  display: grid;
  width: min(100%, 440px);
  gap: 18px;
  justify-items: center;
  animation: login-content-in 520ms cubic-bezier(.2,.8,.2,1) both;
}

.login-branding {
  display: grid;
  justify-items: center;
  color: var(--jl-navy);
  text-align: center;
  text-shadow: 0 2px 14px rgba(255,255,255,.9);
}

.login-logo {
  width: 112px;
  height: 112px;
  border: 0;
  border-radius: 50%;
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(4, 54, 88, 0.16);
}

.login-wordmark { margin-top: 8px; }
.login-wordmark h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.25rem);
  font-weight: 950;
  line-height: .9;
  text-transform: uppercase;
}
.login-wordmark strong {
  display: block;
  margin-top: 8px;
  color: #08a9c1;
  font-family: "Segoe Print", "Bradley Hand", cursive;
  font-size: clamp(1.55rem, 6vw, 2.4rem);
  font-style: italic;
  line-height: 1;
  text-transform: uppercase;
}
.login-branding > p {
  display: grid;
  grid-template-columns: 54px auto 54px;
  align-items: center;
  gap: 12px;
  margin: 12px 0 0;
  color: #557996;
  font-size: .9rem;
  font-weight: 650;
}
.login-branding > p span { height: 1px; background: var(--jl-aqua); }

.login-panel {
  width: 100%;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: var(--jl-radius);
  background: rgba(255,255,255,.56);
  box-shadow: var(--jl-shadow-strong);
  padding: 22px;
  backdrop-filter: blur(16px) saturate(1.15);
}

.login-form { display: grid; gap: 13px; }
.login-field {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border: 1px solid rgba(195, 221, 231, .9);
  border-radius: var(--jl-radius);
  background: rgba(255,255,255,.91);
  box-shadow: 0 8px 22px rgba(4,54,88,.09);
  color: var(--jl-teal);
  padding: 0 16px;
}
.login-field:focus-within {
  border-color: rgba(195, 221, 231, .9);
  box-shadow: 0 8px 22px rgba(4,54,88,.09);
}
.login-field > .ui-icon { font-size: 1.35rem; }
.login-field input {
  min-height: 56px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--jl-navy);
  padding: 0;
}
.login-field input:focus,
.login-field input:focus-visible {
  outline: 0;
  outline-offset: 0;
  box-shadow: none;
}
.login-field input::placeholder { color: #6e8298; opacity: 1; }
.login-password-toggle {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #5c7190;
  padding: 0;
}
.login-submit {
  position: relative;
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 13px;
  overflow: hidden;
  border: 0;
  border-radius: var(--jl-radius);
  background: linear-gradient(100deg, #09b9b2 0%, #078dce 60%, #0666be 100%);
  box-shadow: 0 12px 24px rgba(0,109,184,.22);
  color: white;
  font-size: 1.04rem;
  font-weight: 850;
}
.login-submit::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -40%;
  width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.48), transparent);
  transform: skewX(-18deg);
  transition: transform 480ms ease;
}
.login-submit:hover::after { transform: translateX(500%) skewX(-18deg); }
.login-button-wave { font-size: 1.35rem; }
.login-panel .text-link {
  display: block;
  margin: 17px auto 0;
  color: #087fb6;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-feedback {
  display: none;
  margin: 0 0 12px;
  border: 1px solid rgba(223, 64, 81, .28);
  border-radius: 6px;
  background: rgba(255, 241, 243, .94);
  color: #a82231;
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.3;
  padding: 9px 11px;
}
.login-feedback.show:not([hidden]) { display: block; }

.login-footer { display: grid; width: 100%; gap: 12px; justify-items: center; }
.login-developer,
.login-link-dock {
  border: 1px solid rgba(255,255,255,.84);
  border-radius: var(--jl-radius);
  background: rgba(255,255,255,.82);
  box-shadow: 0 10px 24px rgba(4,54,88,.1);
  backdrop-filter: blur(12px);
}
.login-developer {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  color: var(--jl-navy);
  padding: 10px 18px;
  text-decoration: none;
}
.login-developer > .ui-icon { color: var(--jl-blue); font-size: 1.25rem; }
.login-developer strong { color: #e83f4d; }
.login-link-dock { display: grid; grid-template-columns: repeat(3, 1fr); width: min(250px,100%); }
.login-link-dock a {
  display: grid;
  min-height: 52px;
  place-items: center;
  border-left: 1px solid var(--jl-line);
  color: var(--jl-blue);
  font-size: 1.35rem;
}
.login-link-dock a:first-child { border-left: 0; }
.login-link-dock a:nth-child(2) { color: #dd3373; }

@keyframes login-content-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* Login-to-home wave transition */
body.is-transitioning { overflow: hidden; }
.login-transition {
  position: fixed;
  z-index: 10000;
  inset: 0;
  overflow: hidden;
  background: #fff;
  pointer-events: all;
}
.transition-wave {
  position: absolute;
  left: -8%;
  width: 116%;
  transform: translateY(115%);
  will-change: transform;
}
.transition-wave::before {
  content: "";
  position: absolute;
  top: -10vh;
  left: -6%;
  width: 112%;
  height: 22vh;
  border-radius: 48% 52% 0 0 / 80% 80% 0 0;
  background: inherit;
  transform: rotate(-2deg);
}
.wave-light { bottom: 0; height: 38%; background: #aee6ff; }
.wave-medium { bottom: 0; height: 68%; background: #4fc3f7; }
.wave-deep { bottom: 0; height: 105%; background: #0d6fb8; }
.login-transition.animate .wave-light { animation: wave-rise 250ms ease-out both; }
.login-transition.animate .wave-medium { animation: wave-rise 250ms 250ms ease-out both; }
.login-transition.animate .wave-deep { animation: wave-rise 300ms 500ms ease-out both; }
.login-transition > img {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: min(30vw, 150px);
  height: auto;
  opacity: 0;
  transform: translate(-50%,-50%) scale(.78);
}
.login-transition.animate > img { animation: transition-logo 500ms 400ms ease-in-out both; }
.login-transition.animate { animation: transition-out 100ms 900ms linear both; }
.login-transition.reduced { transition: opacity 140ms ease; }
.login-transition.reduced.animate { opacity: 0; }
@keyframes wave-rise { to { transform: translateY(0); } }
@keyframes transition-logo {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.78); }
  35%, 62% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(.86); }
}
@keyframes transition-out { to { opacity: 0; } }

/* App shell and navigation */
.app-shell { min-height: 100vh; min-height: 100dvh; }
.topbar {
  min-height: 76px;
  border-bottom: 1px solid rgba(217,233,239,.92);
  background: rgba(255,255,255,.92);
  box-shadow: none;
  backdrop-filter: blur(18px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: var(--jl-navy);
  padding: 0;
  text-align: left;
}
.brand img { width: 48px; height: 48px; border-radius: 50%; object-fit: contain; }
.brand strong { font-size: 1.02rem; font-weight: 900; }
.brand span { color: var(--jl-teal); font-weight: 650; }
.topbar-user .icon-action { width: 42px; min-width: 42px; padding: 0; }
.layout { width: min(1320px,100%); gap: 20px; padding: 20px 24px 52px; }

.tabs {
  position: static;
  display: grid;
  grid-template-columns: repeat(6,minmax(0,1fr));
  gap: 6px;
  overflow: visible;
  border: 1px solid var(--jl-line);
  border-radius: var(--jl-radius);
  background: #fff;
  box-shadow: 0 8px 22px rgba(5,45,76,.05);
  padding: 6px;
}
.tabs button {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  color: var(--jl-copy);
  font-size: .86rem;
  padding: 8px 9px;
}
.tabs button::before { display: none; }
.tabs button.active { background: #e8f8f7; color: var(--jl-navy); box-shadow: inset 0 -2px 0 var(--jl-teal); }
.tabs button span:last-child { overflow: visible; text-overflow: clip; }
.nav-icon { font-size: 1.05rem; }

.app-page { gap: 18px; animation: page-enter 260ms ease-out both; }
@keyframes page-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-heading { align-items: center; }
.page-heading h1 { color: var(--jl-navy); font-size: clamp(1.5rem,2.6vw,2rem); font-weight: 900; }
.page-heading p { color: var(--jl-copy); }

.card,
.section-card,
.slot-card,
.lesson-card,
.mobile-agenda-card,
.tide-panel,
.table-panel,
.calendar,
.stat-card,
.next-lesson-card {
  border-color: var(--jl-line);
  border-radius: var(--jl-radius);
  background: #fff;
  box-shadow: var(--jl-shadow);
}
.section-card,
.card { padding: clamp(16px,2vw,22px); }
.section-title h2,
.section-head h2,
.card h2 { color: var(--jl-navy); font-weight: 900; }

.primary-action,
.secondary-action,
.danger-action,
.ghost-action,
.icon-action {
  min-height: 42px;
  border-radius: 6px;
  font-weight: 800;
}
.primary-action { background: linear-gradient(100deg,#08b2a8,#078bd0); color: #fff; }
.primary-action:hover { background: linear-gradient(100deg,#079b92,#0579ba); }
.secondary-action { border: 1px solid #9dded8; background: #edf9f8; color: #057b74; }
.ghost-action,.icon-action { border: 1px solid var(--jl-line); background: #fff; color: var(--jl-navy); }
.danger-action { border: 1px solid #f1b6bd; background: #fff5f6; color: var(--jl-red); }

.mobile-page-intro { display: none; }
.welcome-banner {
  min-height: 220px;
  border: 0;
  border-radius: var(--jl-radius);
  background: #e9f8fc url("/assets/dashboard-wave.webp") center / cover no-repeat;
  box-shadow: var(--jl-shadow);
  color: var(--jl-navy);
  padding: clamp(24px,4vw,44px);
}
.welcome-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,rgba(255,255,255,.94) 0%,rgba(255,255,255,.82) 38%,rgba(255,255,255,.12) 72%);
  pointer-events: none;
}
.welcome-banner > div { z-index: 2; }
.welcome-banner h1 { color: var(--jl-navy); font-size: clamp(1.8rem,4vw,2.8rem); font-weight: 950; }
.welcome-banner p { max-width: 520px; color: #3e6078; }
.welcome-banner .primary-action { margin-top: 9px; }
.banner-wave {
  position: absolute;
  z-index: 2;
  right: 24px;
  bottom: 18px;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  color: var(--jl-blue);
  font-size: 1.8rem;
  box-shadow: 0 8px 20px rgba(5,45,76,.12);
}

.student-summary-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.next-lesson-card { grid-column: 1 / -1; min-height: 108px; }
.stat-card { min-height: 114px; }
.stat-card .stat-icon,
.next-lesson-card .stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: var(--jl-blue);
  font-size: 1.28rem;
}
.stat-card strong { color: var(--jl-navy); font-size: 1.75rem; }
.quick-actions > div:last-child { grid-template-columns: repeat(4,minmax(0,1fr)); }
.quick-actions button {
  display: grid;
  min-height: 86px;
  place-items: center;
  align-content: center;
  gap: 7px;
  color: var(--jl-navy);
}
.quick-actions button > .ui-icon { color: var(--jl-blue); font-size: 1.4rem; }

/* Agenda and lesson cards */
.teacher-selector { grid-template-columns: repeat(3,minmax(180px,1fr)); }
.teacher-option { border-color: var(--jl-line); border-radius: var(--jl-radius); }
.teacher-option.active { border-color: var(--jl-teal); background: #eefaf8; box-shadow: inset 0 0 0 1px var(--jl-teal); }
.step-number { background: #e8f8f7; color: #057b74; }
.day-tabs { scrollbar-width: none; }
.day-tabs::-webkit-scrollbar { display: none; }
.day-tabs button { border-radius: 6px; }
.day-tabs button.active { border-color: var(--jl-teal); background: #e8f8f7; box-shadow: inset 0 -3px 0 var(--jl-teal); }
.schedule-row { border-color: var(--jl-line); border-radius: var(--jl-radius); box-shadow: 0 5px 16px rgba(5,45,76,.045); }
.schedule-row-main > strong { color: var(--jl-navy); }
.status-pill { border-radius: 999px; }
.status-free { background: #e6f8f2; color: #087b5e; }
.status-confirmed { background: #e5f5fb; color: #0876a5; }
.status-unavailable,.status-used { background: #eef3f6; color: #637787; }
.status-red,.status-cancelled { background: #fff0f2; color: #bf3040; }
.lesson-summary-card { box-shadow: 0 8px 22px rgba(5,45,76,.06); }
.lesson-date-block strong { color: var(--jl-navy); }
.lesson-detail-hero { background: url("/assets/dashboard-wave.webp") center / cover no-repeat; }
.lesson-detail-hero > div:last-child { padding: 10px; border-radius: var(--jl-radius); background: rgba(255,255,255,.88); }
.segmented-control { border-color: var(--jl-line); background: #edf6f8; }
.segmented-control button.active { color: #057b74; }

/* Teacher and admin */
.teacher-slot-card { border-left: 4px solid var(--jl-teal); }
.teacher-slot-card:has(.status-red),
.teacher-slot-card:has(.status-unavailable) { border-left-color: var(--jl-red); }
.teacher-week-grid { padding: 2px 2px 10px; }
.week-day-column { border-color: var(--jl-line); border-radius: var(--jl-radius); }
.modern-stats { grid-template-columns: repeat(4,minmax(0,1fr)); }
.admin-welcome { min-height: 190px; }
.registry-grid,.two-col { gap: 16px; }
.registry-intro-grid { grid-template-columns: minmax(0,1.55fr) minmax(260px,.7fr); align-items: start; }
.registry-overview { position: sticky; top: 16px; }
.registry-overview .ticket-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
.section-title .ui-icon { color: var(--jl-blue); font-size: 1.3rem; }
.fixed-schedule-page + .two-col { margin-top: 18px; }
.compact-form,.form-grid { gap: 13px; }
input,select,textarea {
  min-height: 46px;
  border-color: #cfe2e9;
  border-radius: 6px;
  background: #fff;
  color: var(--jl-navy);
}
input:focus,select:focus,textarea:focus { border-color: var(--jl-teal); box-shadow: 0 0 0 3px rgba(8,169,158,.12); }
.list-row { border-color: var(--jl-line); }
.editable-row > div:first-child { display: grid; gap: 3px; min-width: 0; }
.student-directory-filters { border-radius: var(--jl-radius); background: #f5fafc; }
.student-directory .list-row { min-height: 72px; }
.ticket-summary > div { border-color: var(--jl-line); border-radius: var(--jl-radius); background: #f8fcfe; }

/* Profile and tide */
.profile-hero { background: linear-gradient(135deg,#fff,#eef9fc); }
.profile-support-card a > span:first-child,
.profile-support-card button > span:first-child { background: #e9f7fa; color: var(--jl-blue); }
.profile-menu-grid button {
  grid-template-columns: auto minmax(0,1fr);
  justify-items: start;
  align-content: center;
  text-align: left;
  border-color: var(--jl-line);
  border-radius: var(--jl-radius);
}
.profile-menu-grid button > .ui-icon { grid-row: 1 / 3; align-self: center; color: var(--jl-blue); font-size: 1.35rem; }
.profile-menu-grid button > strong,
.profile-menu-grid button > small { grid-column: 2; }
.profile-setting-card { padding: 0; overflow: hidden; }
.profile-setting-card summary {
  display: grid;
  grid-template-columns: 36px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  color: var(--jl-navy);
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
}
.profile-setting-card summary::-webkit-details-marker { display: none; }
.profile-setting-card summary > span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #e9f7fa; color: var(--jl-blue); }
.profile-setting-card summary > div { display: grid; gap: 2px; }
.profile-setting-card summary small { color: var(--jl-copy); font-size: .75rem; }
.profile-setting-card summary .menu-chevron { color: var(--jl-copy); transition: transform 180ms ease; }
.profile-setting-card[open] summary .menu-chevron { transform: rotate(90deg); }
.profile-setting-content { border-top: 1px solid var(--jl-line); padding: 16px; }
.tide-panel { overflow: hidden; }
.tide-summary { background: linear-gradient(135deg,#fff,#eef9fc); }
.tide-canvas { animation: tide-chart-in 850ms ease-out both; }
@keyframes tide-chart-in { from { opacity: 0; transform: scaleX(.92); transform-origin: left; } to { opacity: 1; transform: scaleX(1); } }
.tide-event { border-radius: var(--jl-radius); }

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--jl-copy);
  padding: 18px 20px 28px;
}
.site-footer span,.site-footer a { display: inline-flex; align-items: center; gap: 6px; }
.site-footer a { color: #087cae; }
.site-footer .developer-link { color: #e13c49; }

.modal { background: rgba(5,32,53,.58); backdrop-filter: blur(7px); }
.modal-panel,.wide-modal { border-radius: var(--jl-radius); border: 1px solid var(--jl-line); box-shadow: 0 24px 70px rgba(4,35,58,.25); }

/* Mobile */
@media (max-width: 760px) {
  body.login-active::before {
    background-image: url("/assets/login-surf-mobile.webp");
    background-position: center bottom;
  }

  body.app-active {
    height: 100dvh;
    overflow: hidden;
  }
  body.app-active .app-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
  body.app-active .app-shell .layout {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 24px;
    scroll-padding-bottom: 24px;
  }
  .login-shell {
    align-items: center;
    overflow: hidden;
    padding: max(18px,env(safe-area-inset-top)) 18px max(18px,env(safe-area-inset-bottom));
  }
  .login-content { width: min(100%,420px); margin: auto; gap: 14px; }
  .login-logo { width: 92px; height: 92px; }
  .login-wordmark { margin-top: 5px; }
  .login-wordmark h1 { font-size: clamp(1.75rem,8.5vw,2.35rem); }
  .login-wordmark strong { margin-top: 5px; font-size: clamp(1.35rem,7vw,1.85rem); }
  .login-branding > p { margin-top: 8px; font-size: .78rem; }
  .login-panel { padding: 15px; }
  .login-field,.login-submit { min-height: 52px; }
  .login-field input { min-height: 50px; }
  .login-developer { min-height: 46px; font-size: .82rem; }
  .login-link-dock a { min-height: 46px; }

  body.login-keyboard-open .login-shell {
    align-items: start;
    padding: max(6px, env(safe-area-inset-top)) 14px 6px;
  }
  body.login-keyboard-open .login-content { gap: 7px; margin: 0 auto; }
  body.login-keyboard-open .login-branding > p,
  body.login-keyboard-open .login-footer { display: none; }
  body.login-keyboard-open .login-logo { width: 48px; height: 48px; }
  body.login-keyboard-open .login-wordmark { margin-top: 2px; }
  body.login-keyboard-open .login-wordmark h1 { font-size: 1.34rem; line-height: 1; }
  body.login-keyboard-open .login-wordmark strong { margin-top: 2px; font-size: 1.05rem; }
  body.login-keyboard-open .login-panel { padding: 9px; }
  body.login-keyboard-open .login-form { gap: 7px; }
  body.login-keyboard-open .login-field,
  body.login-keyboard-open .login-submit { min-height: 44px; }
  body.login-keyboard-open .login-field input { min-height: 42px; }
  body.login-keyboard-open .login-panel .text-link { margin-top: 8px; font-size: .82rem; }
  body.login-keyboard-open .login-feedback { margin-bottom: 7px; padding: 6px 9px; font-size: .76rem; }
  body.login-keyboard-compact .login-logo { display: none; }
  body.login-keyboard-compact .login-branding { padding-top: 2px; }

  .topbar { display: none; }
  .layout { gap: 14px; padding: 14px 10px calc(88px + env(safe-area-inset-bottom)); }
  .mode-mobile .tabs { display: none; }
  .app-page { gap: 14px; }
  .mobile-page-intro {
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 2px 2px 4px;
  }
  .mobile-page-intro h1 { margin: 0; color: var(--jl-navy); font-size: 1.12rem; font-weight: 900; }
  .mobile-page-intro p { margin: 2px 0 0; color: var(--jl-copy); font-size: .78rem; }
  .mobile-page-intro .icon-action { width: 40px; min-width: 40px; padding: 0; }
  .page-heading { align-items: start; }
  .page-heading h1 { font-size: 1.35rem; }
  .page-heading p { margin-top: 4px; font-size: .84rem; }
  .welcome-banner { min-height: 206px; padding: 19px; background-position: 58% center; }
  .welcome-banner::after { background: linear-gradient(90deg,rgba(255,255,255,.92),rgba(255,255,255,.65) 55%,rgba(255,255,255,.06)); }
  .welcome-banner > div { max-width: 72%; }
  .welcome-banner h1 { font-size: 1.48rem; }
  .welcome-banner p { font-size: .85rem; }
  .welcome-banner .primary-action { min-height: 38px; padding: 8px 12px; }
  .banner-wave { right: 13px; bottom: 13px; width: 45px; height: 45px; font-size: 1.3rem; }

  .student-summary-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
  .student-summary-grid .stat-card:last-child { grid-column: auto; }
  .next-lesson-card { grid-column: 1 / -1; min-height: 96px; padding: 12px; }
  .stat-card { display: grid; min-height: 100px; justify-items: start; align-content: start; gap: 7px; padding: 10px; }
  .stat-card .stat-icon { width: 34px; height: 34px; font-size: .95rem; }
  .stat-card span:not(.stat-icon) { font-size: .66rem; line-height: 1.15; }
  .stat-card strong { font-size: 1.38rem; }
  .stat-card small { display: none; }
  .quick-actions { padding: 13px; }
  .quick-actions > div:last-child { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; }
  .quick-actions button { min-height: 66px; gap: 5px; border: 0; background: #f2f9fb; font-size: .68rem; padding: 7px 3px; }
  .quick-actions button > .ui-icon { font-size: 1.2rem; }
  .quick-actions button span:last-child { white-space: normal; overflow-wrap: normal; word-break: normal; line-height: 1.15; text-align: center; }

  .section-card,.card { padding: 13px; }
  .section-title { margin-bottom: 12px; }
  .teacher-selector { grid-template-columns: 1fr; }
  .teacher-option { min-height: 62px; }
  .agenda-teacher-step,.agenda-time-step { padding: 13px; }
  .day-tabs { margin: 0 -13px 12px; padding: 0 13px; }
  .day-tabs button { flex-basis: 86px; }
  .schedule-row { grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; min-height: 62px; padding: 9px; }
  .schedule-row-main { display: grid; gap: 4px; }
  .schedule-row-main > strong { font-size: 1rem; }
  .schedule-row-action { grid-column: auto; }
  .schedule-row-action button { width: auto; min-width: 78px; }
  .lesson-summary-card { grid-template-columns: auto minmax(0,1fr) auto; padding: 12px; }
  .lesson-summary-card > button { grid-column: auto; }
  .lesson-detail-hero { min-height: 155px; }
  .teacher-slot-card { grid-template-columns: 58px minmax(0,1fr) auto; gap: 8px; padding: 12px; }
  .teacher-slot-card > .status-pill { justify-self: end; }
  .teacher-slot-card .action-row { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); }

  .modern-stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .modern-stats .stat-card { min-height: 104px; }
  .teacher-dashboard .modern-stats .stat-card:last-child { grid-column: 1 / -1; }
  .registry-grid,.two-col,.profile-layout,.registry-intro-grid { grid-template-columns: 1fr; }
  .registry-overview { position: static; }
  .profile-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .profile-menu-grid { grid-template-columns: 1fr; }
  .profile-menu-grid button { min-height: 62px; grid-template-columns: auto minmax(0,1fr); justify-items: start; text-align: left; }

  .mobile-bottom-nav {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 2px;
    border: 1px solid var(--jl-line);
    border-radius: var(--jl-radius);
    background: rgba(255,255,255,.96);
    box-shadow: 0 16px 40px rgba(5,45,76,.18);
    padding: 5px;
    backdrop-filter: blur(15px);
  }
  .mobile-bottom-nav button {
    display: grid;
    min-height: 51px;
    place-items: center;
    align-content: center;
    gap: 3px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #60788a;
    font-size: .64rem;
    padding: 4px 2px;
  }
  .mobile-bottom-nav .nav-icon { font-size: 1.2rem; }
  .mobile-bottom-nav button.active { background: #dff5f3; color: #057b74; box-shadow: none; }
  .site-footer { display: none; }
  .modal { padding: calc(8px + env(safe-area-inset-top)) 8px calc(82px + env(safe-area-inset-bottom)); }
  .modal-panel,.wide-modal { width: 100%; max-height: calc(100dvh - 98px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding: 15px; }
}

@media (max-width: 760px) and (max-height: 700px) {
  body.login-active:not(.login-keyboard-open) .login-shell {
    padding: max(8px, env(safe-area-inset-top)) 14px max(8px, env(safe-area-inset-bottom));
  }
  body.login-active:not(.login-keyboard-open) .login-content { gap: 7px; }
  body.login-active:not(.login-keyboard-open) .login-logo { width: 58px; height: 58px; }
  body.login-active:not(.login-keyboard-open) .login-wordmark { margin-top: 2px; }
  body.login-active:not(.login-keyboard-open) .login-wordmark h1 { font-size: 1.45rem; }
  body.login-active:not(.login-keyboard-open) .login-wordmark strong { margin-top: 2px; font-size: 1.08rem; }
  body.login-active:not(.login-keyboard-open) .login-branding > p { margin-top: 4px; font-size: .7rem; }
  body.login-active:not(.login-keyboard-open) .login-panel { padding: 9px; }
  body.login-active:not(.login-keyboard-open) .login-form { gap: 7px; }
  body.login-active:not(.login-keyboard-open) .login-field,
  body.login-active:not(.login-keyboard-open) .login-submit { min-height: 44px; }
  body.login-active:not(.login-keyboard-open) .login-field input { min-height: 42px; }
  body.login-active:not(.login-keyboard-open) .login-panel .text-link { margin-top: 8px; font-size: .8rem; }
  body.login-active:not(.login-keyboard-open) .login-footer { gap: 6px; }
  body.login-active:not(.login-keyboard-open) .login-developer,
  body.login-active:not(.login-keyboard-open) .login-link-dock a { min-height: 40px; }
}

@media (min-width: 761px) {
  .student-dashboard,.teacher-dashboard,.admin-dashboard { grid-template-columns: repeat(12,minmax(0,1fr)); }
  .student-dashboard > *, .teacher-dashboard > *, .admin-dashboard > * { grid-column: 1 / -1; }
  .student-dashboard .student-summary-grid { grid-column: 1 / 9; }
  .student-dashboard .quick-actions { grid-column: 9 / -1; grid-row: 2; }
  .student-dashboard .quick-actions > div:last-child { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .student-agenda-page { grid-template-columns: minmax(270px,.72fr) minmax(0,1.5fr); align-items: start; }
  .student-agenda-page > .page-heading { grid-column: 1 / -1; }
  .agenda-teacher-step { position: sticky; top: 18px; }
  .teacher-agenda-page .compact-segments { max-width: 340px; }
  .teacher-agenda-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .sea-page { max-width: 1100px; margin-inline: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
