:root {
  --sp-bg: #eaf3f8;
  --sp-bg-2: #f7fbfe;
  --sp-surface: #ffffff;
  --sp-ink: #273746;
  --sp-muted: #61788a;
  --sp-line: #bfd7e6;
  --sp-accent: #3498db;
  --sp-accent-2: #2980b9;
  --sp-accent-soft: #dceefb;
  --sp-warn: #9a4b1d;
  --sp-warn-soft: #fff4ec;
  --sp-danger: #a33a2f;
  --sp-ok: #1e6b45;
  --sp-radius: 18px;
  --sp-shadow: 0 10px 30px rgba(36, 113, 163, 0.08);
  --sp-font: "Manrope", system-ui, sans-serif;
  --sp-display: "Source Serif 4", Georgia, serif;
  --sp-sidebar: 260px;
  --sp-safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.sp-body {
  font-family: var(--sp-font);
  color: var(--sp-ink);
  background:
    radial-gradient(ellipse 80% 50% at 0% 0%, #dceefb 0%, transparent 55%),
    linear-gradient(180deg, #f0f8fd 0%, var(--sp-bg) 40%, #e4f0f7 100%);
  line-height: 1.45;
}
a { color: var(--sp-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; }

.sp-skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: #fff;
  padding: 8px 12px;
  z-index: 100;
}
.sp-skip:focus { left: 8px; top: 8px; }
.sp-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.sp-app-banner {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--sp-accent-2);
  color: #f4faf7;
}
.sp-app-banner[hidden] { display: none !important; }
.sp-app-banner__copy { display: flex; flex-direction: column; gap: 2px; }
.sp-app-banner__copy span { opacity: 0.85; font-size: 0.88rem; }
.sp-app-banner__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sp-banner-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.sp-shell {
  display: grid;
  grid-template-columns: var(--sp-sidebar) minmax(0, 1fr);
  min-height: 100vh;
}
.sp-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 20px 16px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--sp-line);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sp-brand { display: flex; gap: 10px; align-items: center; }
.sp-brand__name {
  font-family: var(--sp-display);
  font-size: 1.25rem;
  font-weight: 700;
}
.sp-brand__sub { color: var(--sp-muted); font-size: 0.78rem; }
.sp-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sp-nav__link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--sp-ink);
  font-weight: 600;
}
.sp-nav__link:hover { background: var(--sp-accent-soft); text-decoration: none; }
.sp-nav__link.is-active {
  background: var(--sp-accent);
  color: #fff;
}
.sp-nav__link.is-active .sp-badge { background: #fff; color: var(--sp-accent); }
.sp-sidebar__foot { display: flex; flex-direction: column; gap: 8px; }
.sp-user { font-weight: 700; font-size: 0.92rem; }

.sp-content { min-width: 0; padding: 24px 28px 96px; }
.sp-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.sp-kicker {
  margin: 0 0 4px;
  color: var(--sp-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sp-page-title {
  margin: 0;
  font-family: var(--sp-display);
  font-size: clamp(1.55rem, 2vw, 2rem);
  line-height: 1.15;
}
.sp-topbar__notify {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-line);
  display: grid;
  place-items: center;
  color: var(--sp-accent-2);
  text-decoration: none;
}
.sp-topbar__notify:hover {
  background: var(--sp-accent-soft);
  text-decoration: none;
}
.sp-topbar__icon { display: block; }
.sp-topbar__notify .sp-badge {
  position: absolute;
  top: -4px;
  right: -4px;
}
.sp-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e4572e;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.sp-main { display: flex; flex-direction: column; gap: 18px; }
.sp-card {
  background: var(--sp-surface);
  border: 1px solid var(--sp-line);
  border-radius: var(--sp-radius);
  padding: 18px;
  box-shadow: var(--sp-shadow);
}
.sp-card--narrow { max-width: 480px; }
.sp-card--cta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #2471a3 0%, #3498db 100%);
  color: #f4faf7;
  border: 0;
}
.sp-card--cta .sp-muted { color: rgba(244,250,247,0.82); }
.sp-card--soft { background: #f3f9fd; }
.sp-section { display: flex; flex-direction: column; gap: 10px; }
.sp-section__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.sp-section__title {
  margin: 0;
  font-size: 1.05rem;
}
.sp-muted { color: var(--sp-muted); }
.sp-hero-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.sp-hero-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sp-hero-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sp-kpi {
  background: var(--sp-surface);
  border: 1px solid var(--sp-line);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.sp-kpi--warn { background: #fff4ec; border-color: #f0c7a8; }
.sp-kpi--ok { background: var(--sp-accent-soft); border-color: #9dcbea; }
.sp-kpi__label { color: var(--sp-muted); font-size: 0.78rem; font-weight: 700; }
.sp-kpi__value {
  font-size: 1.45rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.sp-kpi__meta { color: var(--sp-muted); font-size: 0.78rem; }

.sp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sp-list__item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-line);
}
.sp-list__item.is-unread { border-color: #9dcbea; background: #f3f9fd; }
.sp-list__item--stack { flex-direction: column; align-items: stretch; }
.sp-list__row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.sp-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e8f1f7;
  color: var(--sp-ink);
  font-size: 0.75rem;
  font-weight: 700;
}
.sp-chip.is-active, .sp-chip--ok { background: var(--sp-accent-soft); color: var(--sp-ok); }
.sp-chip--bad { background: #fdecea; color: var(--sp-danger); }
.sp-empty {
  padding: 28px 18px;
  text-align: center;
  border: 1px dashed var(--sp-line);
  border-radius: var(--sp-radius);
  background: rgba(255,255,255,0.55);
}
.sp-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.sp-action {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: 16px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-line);
  color: inherit;
}
.sp-action:hover { border-color: var(--sp-accent); text-decoration: none; }
.sp-action span { color: var(--sp-muted); font-size: 0.85rem; }

.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--sp-line);
  background: var(--sp-surface);
  color: var(--sp-ink);
  font-weight: 700;
  cursor: pointer;
}
.sp-btn:hover { text-decoration: none; border-color: var(--sp-accent); }
.sp-btn--primary {
  background: var(--sp-accent);
  border-color: var(--sp-accent);
  color: #fff;
}
.sp-btn--ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.35);
  color: inherit;
}
.sp-app-banner .sp-btn--ghost,
.sp-card--cta .sp-btn--ghost {
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}
.sp-btn--danger {
  background: #fdecea;
  border-color: #e7b1aa;
  color: var(--sp-danger);
}
.sp-btn--block { width: 100%; }

.sp-form { display: flex; flex-direction: column; gap: 12px; }
.sp-form-inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.sp-form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sp-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; color: var(--sp-muted); font-weight: 600; }
.sp-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--sp-line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--sp-ink);
}
.sp-input:focus {
  outline: 2px solid color-mix(in srgb, var(--sp-accent) 35%, transparent);
  border-color: var(--sp-accent);
}

.sp-flash { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sp-flash__item {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--sp-accent-soft);
  color: var(--sp-ok);
}
.sp-flash__item--error, .sp-flash__item--error { background: #fdecea; color: var(--sp-danger); }

.sp-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.sp-auth__panel {
  width: min(100%, 420px);
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--sp-line);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: var(--sp-shadow);
}
.sp-auth__logo { display: block; margin-bottom: 12px; }
.sp-auth__lead, .sp-auth__hint { color: var(--sp-muted); }
.sp-auth h1 {
  margin: 0 0 8px;
  font-family: var(--sp-display);
  font-size: 2rem;
}

.sp-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.sp-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-line);
  color: inherit;
  min-height: 120px;
}
.sp-tile:hover { border-color: var(--sp-accent); text-decoration: none; }
.sp-tile__num {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--sp-accent-soft);
  color: var(--sp-accent-2);
  font-weight: 800;
}
.sp-ticket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}
.sp-ticket {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 14px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-line);
  color: inherit;
  font-weight: 800;
}
.sp-ticket.is-done { background: var(--sp-accent-soft); border-color: #9dcbea; }
.sp-ticket:hover { text-decoration: none; border-color: var(--sp-accent); }

.sp-prose { line-height: 1.6; }
.sp-prose h2, .sp-prose h3 { font-family: var(--sp-display); }
.sp-question__text { font-size: 1.15rem; margin: 0 0 14px; }
.sp-question__image {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 14px;
  background: #f3f7fa;
}
.sp-options { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sp-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--sp-line);
  background: #fff;
  cursor: pointer;
}
.sp-option input { margin-top: 4px; }
.sp-option__letter {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--sp-accent-soft);
  font-weight: 800;
  flex: 0 0 auto;
}
.sp-option.is-correct { background: #e8f5ee; border-color: #34845e; }
.sp-option.is-wrong { background: #fdecea; border-color: #b84a3a; }
.sp-explain {
  padding: 12px;
  border-radius: 12px;
  background: #f5f8f6;
  margin-bottom: 14px;
}
.sp-progress {
  height: 6px;
  border-radius: 999px;
  background: #d7e7f1;
  overflow: hidden;
}
.sp-progress > span {
  display: block;
  height: 100%;
  background: var(--sp-accent);
}
.sp-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--sp-accent-2);
}
.sp-result--ok { border-color: #9dcbea; background: #f2f8fc; }
.sp-result--fail { border-color: #e7b1aa; background: #fff7f6; }
.sp-finish-form { margin-top: 8px; }

.sp-video { width: 100%; border-radius: 12px; background: #000; margin: 10px 0; }
.sp-video-card { display: flex; flex-direction: column; gap: 10px; }
.sp-video-card__head { display: flex; justify-content: space-between; gap: 10px; }

.sp-dl {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin: 0;
}
.sp-dl dt { color: var(--sp-muted); font-size: 0.78rem; font-weight: 700; margin-bottom: 2px; }
.sp-dl dd { margin: 0; font-weight: 700; }

.sp-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.sp-chips { display: flex; gap: 6px; flex-wrap: wrap; }

.sp-tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--sp-line);
  padding: 6px 6px calc(6px + var(--sp-safe-bottom));
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
}
.sp-tabbar__link {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--sp-muted);
  padding: 8px 2px;
  border-radius: 10px;
}
.sp-tabbar__link.is-active { color: var(--sp-accent); background: var(--sp-accent-soft); }
.sp-tabbar__link:hover { text-decoration: none; }

@media (max-width: 980px) {
  .sp-shell { grid-template-columns: 1fr; }
  .sp-sidebar { display: none; }
  .sp-content { padding: 16px 14px 110px; }
  .sp-tabbar { display: grid; }
  .sp-hero-grid,
  .sp-hero-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-actions-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .sp-hero-grid,
  .sp-hero-grid--2,
  .sp-hero-grid--3 { grid-template-columns: 1fr; }
  .sp-page-title { font-size: 1.45rem; }
  .sp-list__item { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

:focus-visible {
  outline: 3px solid var(--sp-accent);
  outline-offset: 2px;
}

.sp-maintenance {
  background: #7a2e24;
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-weight: 600;
}

.sp-cal-nav {
  display: flex;
  gap: 12px;
  align-items: center;
}
.sp-cal {
  background: var(--sp-surface);
  border: 1px solid var(--sp-line);
  border-radius: var(--sp-radius);
  padding: 12px;
}
.sp-cal__head,
.sp-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.sp-cal__head span {
  text-align: center;
  font-size: 0.75rem;
  color: var(--sp-muted);
  padding: 4px 0;
}
.sp-cal__cell {
  min-height: 44px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  background: var(--sp-bg-2);
}
.sp-cal__cell.is-out { opacity: 0.35; }
.sp-cal__cell.is-active {
  background: var(--sp-accent-soft);
  color: var(--sp-accent-2);
  font-weight: 700;
}
.sp-cal__cell i {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--sp-accent);
}
.sp-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.sp-details summary {
  list-style: none;
  cursor: pointer;
}
.sp-details summary::-webkit-details-marker { display: none; }
.sp-reschedule {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--sp-line);
  border-radius: 12px;
  background: var(--sp-bg-2);
  min-width: min(100%, 280px);
}

/* Cache-friendly static identity; browsers still revalidate via WhiteNoise hashed names in prod */

