:root {
  --accent: #08c9f4;
  --accent-rgb: 8, 201, 244;
  --ink: #111318;
  --muted: #6b7280;
  --line: rgba(17, 19, 24, .08);
  --paper: #f5f5f7;
  --paper-strong: #ffffff;
  --bg: #ffffff;
  --good: #16a34a;
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 18px 40px rgba(0, 0, 0, .06);
  --radius: 26px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #fff;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: #fff;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px clamp(14px, 2.4vw, 30px) 92px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -18px calc(clamp(14px, 2.4vw, 30px) * -1) 18px;
  padding: 18px clamp(14px, 2.4vw, 30px) 10px;
  background: rgba(255, 255, 255, .90);
  border-bottom: 0;
  backdrop-filter: blur(18px) saturate(150%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), #28d8ff 48%, #61f0d5);
  box-shadow: 0 10px 28px rgba(var(--accent-rgb), .30);
  flex: 0 0 auto;
}

.brand-title {
  display: grid;
  line-height: 1.05;
}

.brand-title strong {
  font-size: 18px;
  font-weight: 760;
}

.brand-title span {
  color: var(--muted);
  font-size: 12px;
}

.glass,
.panel,
.card {
  background: var(--paper);
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.panel {
  border-radius: var(--radius);
  padding: clamp(14px, 2vw, 22px);
}

.card {
  border-radius: var(--radius);
  padding: 14px;
}

.quiet {
  color: var(--muted);
}

.today-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
  gap: 14px;
  margin-bottom: 14px;
}

.today-card {
  min-height: 236px;
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: stretch;
  background: #f5f5f7;
}

.day-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  min-height: 188px;
  border-radius: 24px;
  color: #061014;
  background:
    linear-gradient(145deg, rgba(var(--accent-rgb), .98), rgba(111, 241, 216, .86)),
    #fff;
  box-shadow: none;
}

.day-card strong {
  font-size: clamp(58px, 8vw, 86px);
  line-height: .82;
  font-weight: 860;
}

.day-card span {
  font-size: 14px;
  font-weight: 740;
  text-align: center;
}

.today-copy {
  display: grid;
  align-content: center;
  gap: 12px;
  min-width: 0;
}

.today-copy h1,
.view-head h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 76px);
  line-height: .92;
  font-weight: 860;
}

.today-copy p {
  max-width: 56ch;
  margin: 0;
  color: #4b5563;
  font-size: 17px;
  line-height: 1.45;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(var(--accent-rgb), .14);
}

.stats-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stats-row div {
  min-width: 112px;
  padding: 10px 12px;
  border-radius: 18px;
  background: #fff;
  border: 0;
}

.stats-row strong {
  display: block;
  font-size: 25px;
  line-height: 1;
}

.stats-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.next-card {
  min-height: 230px;
  display: grid;
  align-content: space-between;
  gap: 14px;
  background: #1d1d1f;
  color: #fff;
  border-color: rgba(255, 255, 255, .12);
}

.next-card .quiet {
  color: rgba(255, 255, 255, .62);
}

.next-thing {
  display: grid;
  gap: 8px;
}

.next-thing strong {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
}

.next-thing span,
.next-thing small {
  color: rgba(255, 255, 255, .72);
  font-size: 15px;
}

.date-panel,
.content-stack,
.mini-upcoming {
  margin-bottom: 14px;
}

.content-stack {
  display: grid;
  gap: 14px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .66fr);
  gap: 14px;
  align-items: start;
}

.toolbar.compact {
  align-items: start;
  margin-bottom: 4px;
}

.toolbar.compact h2 {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1;
}

.toolbar.compact p {
  margin: 0;
}

.view-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.view-head p {
  margin: 6px 0 0;
}

.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(320px, .76fr);
  gap: 16px;
  align-items: start;
}

.hero-line {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 14px;
}

.hero-line h1,
.section-title {
  margin: 0;
  font-size: clamp(28px, 5vw, 58px);
  line-height: .96;
  font-weight: 820;
  letter-spacing: 0;
}

.section-title {
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #f5f5f7;
}

.segmented button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: #3f4652;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.segmented button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 5px 16px rgba(17, 19, 24, .08);
}

.button,
.ghost,
.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 680;
}

.button {
  color: #061014;
  background: var(--accent);
  box-shadow: none;
}

.ghost {
  color: var(--ink);
  background: #fff;
  border: 0;
}

.danger {
  color: #fff;
  background: var(--danger);
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  background: #f5f5f7;
  border: 0;
  cursor: pointer;
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 42px;
  border-radius: 18px;
  border: 0;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .14);
}

.date-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(74px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  scrollbar-width: none;
}

.date-rail::-webkit-scrollbar {
  display: none;
}

.date-chip {
  display: grid;
  gap: 6px;
  min-height: 76px;
  padding: 10px;
  border-radius: 20px;
  background: #fff;
  border: 0;
  cursor: pointer;
  text-align: left;
  transition: background .16s ease, box-shadow .16s ease;
}

.date-chip:hover {
  box-shadow: inset 0 0 0 2px rgba(var(--accent-rgb), .18);
}

.date-chip strong {
  font-size: 22px;
  line-height: 1;
}

.date-chip span {
  color: var(--muted);
  font-size: 12px;
}

.date-chip.active {
  color: #061014;
  background: var(--accent);
  border-color: transparent;
}

.date-chip.has-event {
  box-shadow: inset 0 -3px 0 rgba(var(--accent-rgb), .72);
}

.event-card {
  display: grid;
  gap: 12px;
  border-radius: 22px;
  padding: 16px;
  background: #fff;
  border: 0;
}

.event-card:hover {
  transform: none;
}

.event-card-rich {
  position: relative;
  overflow: hidden;
  border-left: 0;
}

.event-card-rich::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--item-accent, var(--accent)) 12%, transparent), transparent 44%);
}

.event-card-rich > * {
  position: relative;
  z-index: 1;
}

.event-card + .event-card {
  margin-top: 10px;
}

.event-card h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.12;
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: #424245;
  background: #f5f5f7;
  font-size: 13px;
  font-weight: 650;
}

.image-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 36%);
  gap: 8px;
  overflow-x: auto;
}

.image-strip img,
.hero-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 20px;
  border: 0;
  background: #e5e7eb;
}

.schedule-list {
  display: grid;
  gap: 8px;
}

.lesson {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border-radius: 20px;
  background: #fff;
  border: 0;
  transition: box-shadow .16s ease, background .16s ease;
}

.lesson:hover {
  box-shadow: inset 0 0 0 2px rgba(var(--accent-rgb), .14);
}

.lesson-time {
  color: #111827;
  font-weight: 760;
}

.lesson h3 {
  margin: 0 0 3px;
  font-size: 16px;
}

.week-day {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 28px;
  background: #f5f5f7;
}

.week-day.is-today {
  background: color-mix(in srgb, var(--accent) 14%, #f5f5f7);
}

.week-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.week-day-head div {
  display: grid;
  gap: 3px;
}

.week-day-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.week-day-head h3 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1;
}

.week-day-head strong {
  min-width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  font-size: 18px;
}

.week-lessons {
  display: grid;
  gap: 8px;
}

.week-lesson {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 22px;
  background: #fff;
  box-shadow: inset 4px 0 0 var(--item-accent, var(--accent));
}

.week-lesson time {
  display: grid;
  gap: 2px;
  color: var(--ink);
  font-weight: 780;
  line-height: 1;
}

.week-lesson time span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.week-lesson div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.week-lesson strong {
  line-height: 1.15;
}

.week-lesson small {
  color: var(--muted);
  line-height: 1.25;
}

.week-empty {
  min-height: 52px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: var(--muted);
  background: #fff;
  font-weight: 700;
}

.empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 0;
  border-radius: 22px;
  background: #fff;
}

.nice-empty {
  gap: 8px;
  padding: 18px;
}

.nice-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.nice-empty span {
  max-width: 34ch;
}

.mini-upcoming {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.mini-card {
  min-height: 132px;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 13px;
  border-radius: 22px;
  text-align: left;
  background: #fff;
  border: 0;
  color: inherit;
  cursor: pointer;
}

.mini-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mini-card strong {
  font-size: 17px;
  line-height: 1.12;
}

.mini-card small {
  color: var(--muted);
  line-height: 1.25;
}

.empty-day {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.empty-day h2 {
  margin: 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: .98;
  font-weight: 820;
}

.empty-day p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.shrug-figure {
  position: relative;
  width: 116px;
  height: 112px;
  margin-bottom: 6px;
}

.shrug-head,
.shrug-body,
.shrug-arm {
  position: absolute;
  display: block;
  background: #d2d2d7;
}

.shrug-head {
  top: 0;
  left: 38px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.shrug-body {
  left: 28px;
  bottom: 0;
  width: 60px;
  height: 58px;
  border-radius: 28px 28px 18px 18px;
}

.shrug-arm {
  top: 54px;
  width: 48px;
  height: 14px;
  border-radius: 999px;
}

.shrug-arm.left {
  left: 0;
  transform: rotate(-22deg);
}

.shrug-arm.right {
  right: 0;
  transform: rotate(22deg);
}

.maintenance-view {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
}

.maintenance-card {
  width: min(620px, 100%);
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
  padding: clamp(28px, 7vw, 72px);
  border-radius: 34px;
  background: #f5f5f7;
}

.maintenance-card .brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.maintenance-card h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 72px);
  line-height: .94;
  font-weight: 840;
}

.maintenance-card p {
  max-width: 38ch;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.settings-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 22px;
  background: #fff;
}

.settings-card div {
  display: grid;
  gap: 4px;
}

.settings-card strong {
  line-height: 1.1;
}

.settings-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.switch {
  position: relative;
  width: 54px;
  height: 32px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d2d2d7;
  cursor: pointer;
  transition: background .18s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
  transition: transform .18s ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(22px);
}

.bottom-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-tabs {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: end;
  justify-content: center;
  padding: 16px;
  background: rgba(12, 16, 22, .36);
  backdrop-filter: blur(10px);
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(680px, 100%);
  max-height: min(82vh, 820px);
  overflow: auto;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .18);
  padding: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.full {
  grid-column: 1 / -1;
}

.admin-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 10px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 13px;
  border-radius: 18px;
  background: rgba(29, 29, 31, .94);
  color: #fff;
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .today-dashboard,
  .content-grid,
  .grid-main,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .today-card {
    min-height: 0;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .today-card #installBtn {
    grid-column: 1 / -1;
  }

  .day-card {
    min-height: 124px;
    border-radius: 22px;
  }

  .day-card strong {
    font-size: 54px;
  }

  .today-copy h1,
  .view-head h1 {
    font-size: 36px;
  }

  .today-copy p {
    font-size: 14px;
    line-height: 1.35;
  }

  .stats-row {
    gap: 6px;
  }

  .stats-row div {
    min-width: 92px;
    padding: 9px 10px;
  }

  .next-card {
    display: none;
  }

  .date-panel,
  .content-stack > .panel,
  #todayView > .panel {
    padding: 12px;
    border-radius: 24px;
  }

  .mini-upcoming {
    grid-template-columns: 1fr;
  }

  .hero-line {
    display: grid;
    align-items: start;
  }

  .topbar {
    align-items: center;
  }

  .brand-title strong {
    font-size: 16px;
  }

  .segmented {
    width: auto;
    grid-auto-flow: column;
  }

  .segmented button {
    padding: 0 8px;
    font-size: 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    max-height: 88vh;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px 10px 92px;
  }

  .topbar {
    margin: -10px -10px 10px;
    padding: 12px 14px 6px;
  }

  .brand-title strong {
    font-size: 15px;
  }

  .brand-title span {
    display: none;
  }

  .topbar .segmented {
    display: none;
  }

  .mobile-tabs {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 5px;
    border-radius: 999px;
    background: rgba(245, 245, 247, .86);
    border: 0;
    box-shadow: 0 18px 46px rgba(0, 0, 0, .14);
    backdrop-filter: blur(22px) saturate(150%);
  }

  .mobile-tabs button {
    min-height: 44px;
    border-radius: 999px;
    color: #4b5563;
    background: transparent;
    font-weight: 760;
  }

  .mobile-tabs button.active {
    color: #061014;
    background: var(--accent);
  }

  .date-rail {
    grid-auto-columns: 68px;
    gap: 7px;
    padding-bottom: 6px;
  }

  .date-chip {
    min-height: 68px;
    padding: 9px;
    border-radius: 18px;
  }

  .date-chip strong {
    font-size: 20px;
  }

  .event-card,
  .lesson,
  .mini-card {
    border-radius: 20px;
  }

  .lesson {
    grid-template-columns: 62px minmax(0, 1fr);
    padding: 11px;
  }

  .mini-upcoming {
    gap: 8px;
  }

  .view-head {
    grid-template-columns: 1fr auto;
  }

  .view-head > .ghost {
    grid-column: 1 / -1;
    width: fit-content;
  }

  .week-day {
    padding: 12px;
    border-radius: 24px;
  }

  .week-day-head h3 {
    font-size: 24px;
  }

  .week-day-head strong {
    min-width: 38px;
    height: 38px;
  }

  .week-lesson {
    grid-template-columns: 58px minmax(0, 1fr);
    padding: 11px;
    border-radius: 20px;
  }

  .week-lesson small {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .bottom-actions {
    margin-bottom: 8px;
  }
}
