:root {
  --bg-page: #f0e8dc;
  --bg-surface: #fffdf7;
  --bg-soft: #f8f1e7;
  --brand-red: #c91f26;
  --brand-red-dark: #a91820;
  --ease-out-soft: cubic-bezier(0.16, 1, 0.3, 1);
  --ink: #242321;
  --muted: #746f68;
  --line: #e2d4c4;
  --rose: #f7dfe0;
  --success: #627b52;
  --success-bg: #edf3e7;
  --warning: #85520c;
  --warning-bg: #f8dfb8;
  --shadow: 0 2px 8px rgba(36, 35, 33, 0.05), 0 16px 38px rgba(36, 35, 33, 0.1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(201, 31, 38, 0.08), transparent 28%),
    linear-gradient(180deg, #f7f0e7 0%, var(--bg-page) 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.admin-shell {
  margin: 0 auto;
  max-width: 1240px;
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 18px 32px;
}

.admin-header {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.admin-brand {
  min-width: 0;
}

.mobile-menu-button {
  align-items: center;
  background: rgba(255, 253, 247, 0.94);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(36, 35, 33, 0.08);
  color: var(--brand-red);
  display: none;
  flex: 0 0 auto;
  height: 48px;
  justify-content: center;
  padding: 0;
  position: relative;
  width: 48px;
}

.mobile-menu-button span {
  background: currentColor;
  border-radius: 999px;
  display: block;
  height: 2px;
  position: absolute;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
  width: 20px;
}

.mobile-menu-button span:nth-child(1) {
  transform: translateY(-7px);
}

.mobile-menu-button span:nth-child(3) {
  transform: translateY(7px);
}

.sidebar-open .mobile-menu-button span:nth-child(1) {
  transform: rotate(45deg);
}

.sidebar-open .mobile-menu-button span:nth-child(2) {
  opacity: 0;
}

.sidebar-open .mobile-menu-button span:nth-child(3) {
  transform: rotate(-45deg);
}

.brand-logo {
  display: block;
  max-width: 194px;
  width: min(42vw, 194px);
}

.header-subtitle {
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
  margin: 4px 0 0;
}

.status-pill {
  background: rgba(255, 253, 247, 0.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
  padding: 9px 12px;
  white-space: nowrap;
}

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

.admin-nav {
  align-content: start;
  background: rgba(255, 253, 247, 0.74);
  border: 1px solid rgba(226, 212, 196, 0.82);
  border-radius: 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
  isolation: isolate;
  overflow: hidden;
  padding: 10px;
  position: sticky;
  top: 18px;
}

.admin-nav::before {
  background: var(--brand-red);
  border-radius: 20px;
  content: "";
  height: var(--nav-active-height, 58px);
  left: 10px;
  position: absolute;
  right: 10px;
  top: 0;
  transform: translateY(var(--nav-active-top, 10px));
  transition:
    transform 0.34s var(--ease-out-soft),
    height 0.34s var(--ease-out-soft);
  z-index: 0;
}

.nav-indicator-static .admin-nav::before {
  transition: none;
}

.nav-scrim {
  background: rgba(36, 35, 33, 0.28);
  border: 0;
  display: none;
  inset: 0;
  opacity: 0;
  padding: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 0.2s ease;
  z-index: 42;
}

.nav-tab {
  background: transparent;
  border: 0;
  border-radius: 20px;
  color: var(--muted);
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 11px 12px;
  position: relative;
  text-align: left;
  transition:
    color 0.18s ease,
    transform 0.12s ease;
  z-index: 1;
}

.nav-tab:active {
  transform: scale(0.985);
}

.nav-tab span {
  color: inherit;
  font-size: 15px;
  font-weight: 820;
}

.nav-tab small {
  color: inherit;
  font-size: 12px;
  line-height: 1.22;
  opacity: 0.88;
}

.nav-tab.active {
  color: #fff;
}

.workspace {
  min-width: 0;
}

.workspace-enter {
  animation: workspace-in 0.22s var(--ease-out-soft);
}

.access-screen {
  margin: 0 auto;
  max-width: 720px;
}

.access-panel {
  display: grid;
  gap: 14px;
  margin-top: 32px;
}

.auth-note,
.auth-error {
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.35;
  margin: 0;
  padding: 12px 14px;
}

.auth-note {
  background: rgba(255, 253, 247, 0.78);
  border: 1px solid var(--line);
  color: var(--muted);
}

.auth-error {
  background: rgba(201, 31, 38, 0.08);
  border: 1px solid rgba(201, 31, 38, 0.22);
  color: var(--brand-red);
  font-weight: 760;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.telegram-login-card {
  background: rgba(248, 241, 231, 0.8);
  border: 1px solid var(--line);
  border-radius: 22px;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.telegram-login-widget {
  align-items: center;
  background: var(--bg-surface);
  border: 1px dashed rgba(201, 31, 38, 0.28);
  border-radius: 18px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  min-height: 58px;
  overflow: hidden;
  text-align: center;
}

.telegram-login-widget iframe {
  display: block;
}

.telegram-login-widget span,
.auth-helper {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
}

.token-fallback {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 12px 14px;
}

.token-fallback summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 780;
}

.token-fallback .field {
  margin-top: 12px;
}

.token-fallback .auth-actions {
  margin-top: 10px;
}

.page-head {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 4px 0 18px;
}

.kicker {
  color: var(--brand-red);
  font-size: 11px;
  font-weight: 860;
  letter-spacing: 1.5px;
  line-height: 1.25;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.title {
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 860;
  line-height: 0.98;
  margin: 0;
}

.lead {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.42;
  margin: 10px 0 0;
  max-width: 690px;
}

.panel {
  background: rgba(255, 253, 247, 0.96);
  border: 1px solid rgba(226, 212, 196, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 18px;
}

.section-head,
.card-top {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.section-title,
.item-title {
  font-size: 20px;
  font-weight: 850;
  line-height: 1.12;
  margin: 0;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.38;
  margin: 7px 0 0;
}

.metric-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric-card {
  align-items: start;
  background: rgba(255, 253, 247, 0.95);
  border: 1px solid rgba(226, 212, 196, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  grid-template-columns: 48px 1fr;
  min-height: 128px;
  padding: 16px;
}

.metric-card > div {
  min-width: 0;
}

.metric-icon {
  align-items: center;
  background: var(--rose);
  border-radius: 16px;
  color: var(--brand-red);
  display: inline-flex;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.metric-icon svg {
  height: 25px;
  width: 25px;
}

.metric-card strong {
  display: block;
  font-size: 30px;
  font-weight: 880;
  line-height: 1;
}

.metric-card span {
  display: block;
  font-size: 14px;
  font-weight: 780;
  margin-top: 5px;
}

.metric-card small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.25;
  margin-top: 5px;
}

.dashboard-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.analytics-panels {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.analytics-status-panel {
  grid-column: 1 / -1;
}

.count-list {
  display: grid;
  gap: 10px;
}

.count-row {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
}

.count-row span {
  color: var(--muted);
  font-weight: 760;
}

.count-row strong {
  color: var(--brand-red);
  font-size: 22px;
}

.broadcast-grid,
.event-editor-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.broadcast-history-panel {
  grid-column: 1 / -1;
}

.stack,
.request-list,
.timeline-list,
.student-list,
.broadcast-history,
.event-list {
  display: grid;
  gap: 12px;
}

.broadcast-history-item {
  align-items: start;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 8px;
  padding: 14px 16px;
}

.broadcast-history-item div {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.broadcast-history-item strong {
  color: var(--text);
  font-size: 15px;
}

.broadcast-history-item span,
.broadcast-history-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
}

.request-mini {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 10px;
  grid-template-columns: 10px 1fr;
  padding: 12px;
}

.request-mini strong {
  display: block;
  font-size: 15px;
}

.request-mini small {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.dot {
  background: var(--brand-red);
  border-radius: 999px;
  height: 10px;
  width: 10px;
}

.dot-waiting_user {
  background: var(--success);
}

.dot-in_progress {
  background: #d58a20;
}

.timeline-slot {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 108px 1fr auto;
  padding: 12px 0;
}

.timeline-slot:last-child {
  border-bottom: 0;
}

.timeline-slot time {
  color: var(--brand-red);
  font-weight: 820;
}

.timeline-slot strong,
.timeline-slot span {
  display: block;
}

.timeline-slot span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.note-chip,
.badge {
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-style: normal;
  font-weight: 820;
  padding: 7px 10px;
  white-space: nowrap;
}

.badge-new,
.badge-action {
  background: var(--brand-red);
  color: #fff;
}

.badge-in_progress,
.note-payment {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-waiting_user,
.badge-planned,
.note-teacher {
  background: var(--success-bg);
  color: var(--success);
}

.badge-closed,
.badge-cancelled,
.note-internal {
  background: #e8e0d7;
  color: var(--muted);
}

.note-contract {
  background: #efe5ff;
  color: #6e3eb7;
}

.note-urgent {
  background: var(--brand-red);
  color: #fff;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.filter-chip {
  background: rgba(255, 253, 247, 0.88);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
  min-height: 42px;
  padding: 9px 13px;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.12s ease;
}

.filter-chip:active {
  transform: scale(0.98);
}

.filter-chip.active {
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: #fff;
}

.request-card {
  display: grid;
  gap: 12px;
}

.message-box {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  font-family: inherit;
  line-height: 1.42;
  margin: 0;
  padding: 13px;
  white-space: pre-wrap;
}

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

.btn {
  align-items: center;
  border: 1px solid var(--brand-red);
  border-radius: 15px;
  display: inline-flex;
  font-weight: 820;
  justify-content: center;
  min-height: 46px;
  padding: 10px 15px;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.12s ease,
    box-shadow 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--brand-red);
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--brand-red);
}

.btn.compact {
  min-height: 40px;
  padding: 8px 12px;
}

.calendar-panel {
  background: rgba(255, 253, 247, 0.7);
  border: 1px solid rgba(226, 212, 196, 0.9);
  border-radius: 26px;
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 14px;
}

.calendar-toolbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 2px 2px 12px;
}

.calendar-controls {
  align-items: flex-end;
  display: grid;
  gap: 10px;
  justify-items: end;
}

.calendar-nav,
.calendar-view-switch {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.calendar-nav strong {
  color: var(--muted);
  font-size: 14px;
  min-width: 72px;
  text-align: center;
}

.icon-btn {
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-red);
  display: inline-flex;
  font-size: 22px;
  font-weight: 860;
  height: 38px;
  justify-content: center;
  line-height: 1;
  width: 38px;
}

.calendar-view-switch {
  background: rgba(255, 253, 247, 0.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}

.calendar-view-switch button {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 820;
  min-height: 34px;
  padding: 7px 12px;
}

.calendar-view-switch button.active {
  background: var(--brand-red);
  color: #fff;
}

.calendar-scroll {
  overflow: visible;
}

.calendar-board {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-board.view-day {
  grid-template-columns: minmax(0, 1fr);
}

.calendar-day {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 136px;
  overflow: hidden;
}

.calendar-day.has-events {
  border-color: rgba(201, 31, 38, 0.45);
}

.calendar-day.selected {
  box-shadow: 0 0 0 2px rgba(201, 31, 38, 0.2);
}

.calendar-day-head {
  align-items: center;
  background: var(--bg-soft);
  border: 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  display: grid;
  gap: 2px;
  grid-template-columns: 1fr auto;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.calendar-day-head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 820;
  text-transform: uppercase;
}

.calendar-day-head strong {
  color: var(--brand-red);
  font-size: 23px;
  font-weight: 900;
  grid-row: span 2;
  line-height: 0.9;
}

.calendar-day-head em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 740;
}

.calendar-day-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px;
}

.calendar-empty {
  flex: 1;
  min-height: 52px;
}

.calendar-event {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: 12px;
  color: inherit;
  display: grid;
  gap: 3px;
  padding: 7px 8px;
  text-align: left;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s var(--ease-out-soft);
  width: 100%;
}

.calendar-event:active {
  transform: scale(0.98);
}

.calendar-event.event-lesson {
  background: #fff7f6;
  border-color: rgba(201, 31, 38, 0.32);
  border-left-color: var(--brand-red);
}

.calendar-event.selected {
  box-shadow: 0 0 0 2px rgba(201, 31, 38, 0.25);
  transform: translateY(-2px);
}

.calendar-event h3 {
  font-size: 12px;
  font-weight: 860;
  line-height: 1.12;
  margin: 0;
}

.calendar-event p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.18;
  margin: 0;
}

.event-time {
  color: var(--brand-red);
  font-size: 10px;
  font-weight: 860;
}

.calendar-detail-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

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

.day-row {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: inherit;
  display: grid;
  gap: 10px;
  grid-template-columns: 112px 1fr 1.2fr;
  padding: 12px;
  text-align: left;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}

.day-row:active {
  transform: scale(0.99);
}

.day-row time {
  color: var(--brand-red);
  font-weight: 840;
}

.day-row strong,
.day-row span {
  min-width: 0;
}

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

.modal-backdrop {
  align-items: center;
  animation: modal-backdrop-in 0.2s ease;
  background: rgba(36, 35, 33, 0.34);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 35;
}

.modal-panel {
  animation: modal-panel-in 0.28s var(--ease-out-soft);
  background: var(--bg-surface);
  border: 1px solid rgba(226, 212, 196, 0.95);
  border-radius: 30px;
  box-shadow: 0 24px 70px rgba(36, 35, 33, 0.28);
  display: grid;
  gap: 16px;
  max-height: calc(100dvh - 48px);
  max-width: 720px;
  overflow: auto;
  padding: 24px;
  position: relative;
  width: min(720px, 100%);
}

.modal-close {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-red);
  display: inline-flex;
  font-size: 28px;
  font-weight: 740;
  height: 42px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 18px;
  top: 18px;
  width: 42px;
}

.modal-head {
  padding-right: 54px;
}

.modal-title {
  font-size: clamp(30px, 4vw, 46px);
}

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

.detail-item {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 6px;
  padding: 13px;
}

.detail-item-wide {
  grid-column: 1 / -1;
}

.detail-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.detail-item strong {
  font-size: 16px;
  line-height: 1.28;
}

.modal-divider {
  background: var(--line);
  height: 1px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.slot-note {
  border-radius: 16px;
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
}

.slot-note strong {
  font-size: 13px;
}

.slot-note span {
  font-size: 13px;
  line-height: 1.35;
}

.booking-list {
  display: grid;
  gap: 10px;
}

.booking-status-row {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(160px, 1fr) auto;
  padding: 12px;
}

.booking-status-row strong,
.booking-status-row span {
  display: block;
}

.booking-status-row span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin-top: 3px;
}

.booking-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.student-list {
  gap: 8px;
}

.list-head,
.student-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 1.35fr 1fr 0.8fr 1.1fr 1fr auto;
}

.list-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  padding: 0 14px 2px;
}

.student-row {
  padding: 14px;
}

.student-main {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 48px 1fr;
  min-width: 0;
}

.student-avatar {
  align-items: center;
  background: var(--rose);
  border-radius: 16px;
  color: var(--brand-red);
  display: inline-flex;
  font-size: 22px;
  font-weight: 880;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.student-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.student-cell strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.teacher-list {
  display: grid;
  gap: 10px;
}

.teacher-row {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 1fr) 220px auto;
  padding: 16px;
}

.membership-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.slot-student-add {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 12px;
}

.student-modal .booking-status-row {
  grid-template-columns: minmax(0, 1fr);
}

.event-list {
  gap: 8px;
}

.event-row {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  color: inherit;
  display: grid;
  gap: 4px;
  padding: 13px;
  text-align: left;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}

.event-row:active {
  transform: scale(0.99);
}

.event-row.active {
  background: #fff7f6;
  border-color: rgba(201, 31, 38, 0.44);
  box-shadow: 0 0 0 2px rgba(201, 31, 38, 0.1);
}

.event-row strong {
  font-size: 16px;
  line-height: 1.18;
}

.event-row span,
.event-row em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  line-height: 1.25;
}

.textarea,
.input {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  outline: 0;
  padding: 11px 13px;
  width: 100%;
}

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

.compact-textarea {
  min-height: 104px;
}

.input {
  min-height: 48px;
}

.broadcast-preview {
  min-height: 300px;
}

.textarea:focus,
.input:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(201, 31, 38, 0.1);
}

.field {
  display: grid;
  gap: 6px;
}

.label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

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

.compact-form {
  margin-top: 14px;
}

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

.checkbox-field {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-weight: 780;
  gap: 10px;
}

.checkbox-field input {
  accent-color: var(--brand-red);
  height: 20px;
  width: 20px;
}

.event-admin-card {
  display: grid;
  gap: 12px;
}

.status-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-flow span {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 820;
  padding: 9px 12px;
}

.empty,
.empty-inline {
  color: var(--muted);
  padding: 28px 18px;
  text-align: center;
}

.toast {
  background: rgba(36, 35, 33, 0.92);
  border-radius: 999px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  color: #fff;
  left: 50%;
  max-width: min(520px, calc(100vw - 32px));
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  position: fixed;
  text-align: center;
  transform: translate(-50%, 16px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 40;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes workspace-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-backdrop-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modal-panel-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .sidebar-open .mobile-menu-button {
    background: var(--bg-surface);
    left: 14px;
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    z-index: 50;
  }

  .admin-nav {
    background: var(--bg-surface);
    border-color: rgba(226, 212, 196, 0.95);
    border-radius: 0 28px 28px 0;
    bottom: 0;
    display: grid;
    gap: 6px;
    left: 0;
    max-width: min(300px, 86vw);
    opacity: 1;
    overflow-y: auto;
    padding: calc(max(14px, env(safe-area-inset-top)) + 58px) 10px max(14px, env(safe-area-inset-bottom));
    position: fixed;
    top: 0;
    transform: translateX(calc(-100% - 12px));
    transition: transform 0.36s var(--ease-out-soft);
    will-change: transform;
    width: min(300px, 86vw);
    z-index: 46;
  }

  .nav-tab {
    border-radius: 16px;
    min-height: 48px;
    padding: 8px 12px;
    width: 100%;
  }

  .nav-tab span {
    font-size: 14px;
  }

  .nav-tab small {
    font-size: 11px;
    line-height: 1.18;
  }

  .admin-nav::before {
    border-radius: 16px;
  }

  .nav-scrim {
    display: block;
  }

  .sidebar-open .admin-nav {
    transform: translateX(0);
  }

  .sidebar-open .nav-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .broadcast-grid,
  .event-editor-grid {
    grid-template-columns: 1fr;
  }

  .student-row {
    align-items: flex-start;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-board {
    gap: 7px;
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .admin-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .page-head,
  .section-head,
  .card-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-header {
    align-items: flex-start;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    justify-content: start;
  }

  .access-screen .mobile-menu-button {
    display: none;
  }

  .status-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .metric-grid,
  .dashboard-grid,
  .analytics-panels,
  .broadcast-grid,
  .event-editor-grid,
  .teacher-row,
  .student-row,
  .slot-student-add,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .list-head {
    display: none;
  }

  .calendar-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-controls {
    align-items: stretch;
    justify-items: stretch;
    width: 100%;
  }

  .calendar-nav,
  .calendar-view-switch {
    justify-content: space-between;
    width: 100%;
  }

  .calendar-panel {
    border-radius: 22px;
    margin-left: 0;
    margin-right: 0;
    padding: 10px;
  }

  .calendar-board {
    gap: 7px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-board.view-day {
    grid-template-columns: 1fr;
  }

  .day-row {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: 126px;
  }

  .calendar-day-head {
    padding: 7px 9px;
  }

  .calendar-day-head strong {
    font-size: 22px;
  }

  .calendar-event h3 {
    font-size: 11px;
  }

  .calendar-event p,
  .event-time {
    font-size: 9px;
  }

  .timeline-slot {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .actions .btn,
  .page-head .btn,
  .modal-actions .btn {
    width: 100%;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 12px;
  }

  .modal-panel {
    border-radius: 26px;
    max-height: calc(100dvh - 24px);
    padding: 20px;
  }

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

  .modal-head {
    padding-right: 48px;
  }
}

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