/* UpSey styles. Tokens first, then base, components, pages. */
:root {
  --ink: #0B2F4A; --blue: #0B4F9C; --blue-dark: #083b75; --sun: #F6B800; --reef: #0F7B5F; --hibiscus: #D62F3C;
  --foam: #F3F8FB; --white: #fff; --mist: #D9E5EC; --slate: #4A5F73; --sun-soft: #FFF3CC; --reef-soft: #E3F4EE; --hib-soft: #FCE8EA; --blue-soft: #E4EEF9;
  --font-display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --radius: 10px; --radius-sm: 6px; --gutter: clamp(16px, 4vw, 32px); --max: 1120px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--foam); color: var(--ink); font: 400 16px/1.55 var(--font-body); min-height: 100vh; display: flex; flex-direction: column; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; margin: 0 0 .5em; letter-spacing: -.01em; font-weight: 700; }
h1 { font-size: clamp(30px, 5vw, 44px); } h2 { font-size: clamp(24px, 3.4vw, 30px); } h3 { font-size: 20px; } h4 { font-size: 17px; }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--blue-dark); }
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible, #app:focus { outline: none; box-shadow: none; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; box-shadow: 0 0 0 5px var(--ink); border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 10px 14px; z-index: 100; border-radius: 6px; }
.skip:focus { left: 8px; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
main { flex: 1; }
.muted { color: var(--slate); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.site-header { background: var(--white); border-bottom: 1px solid var(--mist); position: sticky; top: 0; z-index: 30; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font: 800 26px/1 var(--font-display); letter-spacing: -.02em; }
.brand svg { width: 34px; height: 34px; flex: none; }
.nav { display: flex; gap: 4px; margin-left: 12px; flex: 1; }
.nav a, .nav button { color: var(--ink); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; background: none; border: 0; font: inherit; cursor: pointer; }
.nav a:hover, .nav button:hover { background: var(--blue-soft); }
.nav a[aria-current="page"] { background: var(--blue-soft); font-weight: 700; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.btn.menu-btn { display: none; }
@media (max-width: 860px) {
  .btn.menu-btn { display: inline-flex; margin-left: auto; }
  .nav, .header-actions { display: none; }
  .site-header.open .wrap { flex-wrap: wrap; padding-bottom: 12px; }
  .site-header.open .nav, .site-header.open .header-actions { display: flex; flex-direction: column; align-items: stretch; width: 100%; margin: 0; }
  .site-header.open .header-actions { flex-direction: row; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 8px; border: 2px solid var(--blue); background: var(--blue); color: #fff; font: 700 16px/1.2 var(--font-body); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.btn.secondary { background: var(--white); color: var(--blue); }
.btn.secondary:hover { background: var(--blue-soft); color: var(--blue-dark); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--blue); }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.danger { background: var(--hibiscus); border-color: var(--hibiscus); }
.btn.danger:hover { background: #b6202c; border-color: #b6202c; }
.btn.sun { background: var(--sun); border-color: var(--sun); color: var(--ink); }
.btn.sun:hover { background: #e0a600; border-color: #e0a600; color: var(--ink); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .legend { font-weight: 700; font-size: 15px; }
.field .hint { color: var(--slate); font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 2px solid #b9cad6; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
textarea { min-height: 110px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--slate); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 3px solid var(--sun); outline-offset: 1px; box-shadow: none; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--hibiscus); }
.field .error { color: #a3202b; font-size: 14px; font-weight: 600; }
.field > label.check, label.check { font-weight: 400; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--blue); }
.grid-2 { display: grid; gap: 0 16px; grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; gap: 0 16px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.seg { display: inline-flex; border: 2px solid var(--blue); border-radius: 8px; overflow: hidden; }
.seg button { background: #fff; border: 0; padding: 8px 14px; font: 600 15px var(--font-body); color: var(--blue); cursor: pointer; min-height: 40px; }
.seg button[aria-pressed="true"] { background: var(--blue); color: #fff; }

/* ---------- surfaces ---------- */
.panel { background: var(--white); border: 1px solid var(--mist); border-radius: var(--radius); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel h2, .panel h3 { margin-bottom: 12px; }
.notice { border-left: 5px solid var(--blue); background: var(--blue-soft); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 0 0 16px; }
.notice.warn { border-color: var(--sun); background: var(--sun-soft); }
.notice.bad { border-color: var(--hibiscus); background: var(--hib-soft); }
.notice.good { border-color: var(--reef); background: var(--reef-soft); }
.notice > :last-child { margin-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--blue-soft); color: var(--blue-dark); white-space: nowrap; }
.badge.good { background: var(--reef-soft); color: #0a5d47; } .badge.warn { background: var(--sun-soft); color: #7a5600; }
.badge.bad { background: var(--hib-soft); color: #a3202b; } .badge.plain { background: #e8eef3; color: var(--slate); }
.empty { text-align: left; padding: 28px; border: 2px dashed #b9cad6; border-radius: var(--radius); background: rgba(255,255,255,.6); }
.empty h3 { margin-bottom: 6px; }
.spinner { width: 28px; height: 28px; border: 4px solid var(--mist); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #e6eef3 25%, #f2f7fa 50%, #e6eef3 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; height: 86px; margin-bottom: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; background: var(--white); border-bottom: 1px solid var(--mist); }
.hero .wrap { position: relative; padding-top: clamp(36px, 7vw, 84px); padding-bottom: clamp(36px, 6vw, 72px); }
.hero h1 { font-size: clamp(40px, 7.2vw, 76px); font-weight: 800; letter-spacing: -.035em; max-width: 12ch; margin-bottom: 18px; }
.hero p.lead { font-size: clamp(18px, 2.2vw, 21px); color: var(--slate); max-width: 46ch; }
.fan { position: absolute; right: -50px; bottom: -30px; width: min(54vw, 560px); height: auto; pointer-events: none; z-index: 0; }
.fan line { stroke-linecap: round; transform-origin: 40px 460px; animation: sweep 1.1s cubic-bezier(.2,.8,.2,1) both; }
.fan line:nth-child(2) { animation-delay: .08s; } .fan line:nth-child(3) { animation-delay: .16s; } .fan line:nth-child(4) { animation-delay: .24s; }
@keyframes sweep { from { transform: rotate(32deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
.hero .content { position: relative; z-index: 1; }
@media (max-width: 720px) { .fan { opacity: .35; width: 110vw; right: -20vw; } }
.search-bar { display: flex; gap: 8px; margin-top: 28px; max-width: 640px; background: #fff; padding: 8px; border: 2px solid var(--ink); border-radius: 14px; box-shadow: 6px 6px 0 var(--sun); }
.search-bar .btn { white-space: nowrap; flex: none; }
.search-bar input { border: 0; min-height: 48px; font-size: 18px; }
.search-bar input:focus { outline: none; }
.search-bar:focus-within { outline: 3px solid var(--blue); outline-offset: 3px; }
@media (max-width: 520px) { .search-bar { flex-direction: column; box-shadow: 4px 4px 0 var(--sun); } }

/* ---------- sections ---------- */
.section { padding-top: clamp(32px, 5vw, 56px); padding-bottom: clamp(32px, 5vw, 56px); }
.section.tint { background: var(--white); border-top: 1px solid var(--mist); border-bottom: 1px solid var(--mist); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.page-head { padding: clamp(24px, 4vw, 44px) 0 12px; }
.page-head p { color: var(--slate); font-size: 18px; margin-bottom: 0; }
.crumbs { font-size: 14px; margin-bottom: 8px; }

/* ---------- course rows ---------- */
.course-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.course { display: grid; grid-template-columns: 76px 1fr auto; gap: 18px; align-items: center; background: var(--white); border: 1px solid var(--mist); border-radius: var(--radius); padding: 14px 18px 14px 14px; position: relative; transition: border-color .15s, box-shadow .15s; }
.course:hover { border-color: var(--cat, var(--blue)); box-shadow: 0 3px 0 var(--cat, var(--blue)); }
.course:focus-within { border-color: var(--cat, var(--blue)); }
.date-block { background: var(--cat, var(--blue)); color: #fff; border-radius: 8px; text-align: center; padding: 8px 4px 9px; line-height: 1; font-family: var(--font-display); }
.date-block .d { display: block; font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.date-block .m { display: block; font-size: 15px; font-weight: 600; margin-top: 3px; }
.date-block .y { display: block; font-size: 12px; opacity: .85; margin-top: 2px; font-weight: 500; }
.course h3 { margin: 0 0 4px; font-size: 20px; }
.course h3 a { color: var(--ink); text-decoration: none; }
.course h3 a::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); }
.course h3 a:hover { text-decoration: underline; text-decoration-color: var(--cat, var(--blue)); text-decoration-thickness: 3px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--slate); font-size: 14.5px; align-items: center; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.meta svg { width: 15px; height: 15px; flex: none; }
.price { text-align: right; font-family: var(--font-display); font-weight: 700; font-size: 20px; white-space: nowrap; }
.price small { display: block; font: 500 13px var(--font-body); color: var(--slate); }
.price.free { color: var(--reef); }
@media (max-width: 640px) {
  .course { grid-template-columns: 60px 1fr; gap: 12px; padding: 12px; }
  .date-block .d { font-size: 26px; }
  .price { grid-column: 2; text-align: left; display: flex; gap: 10px; align-items: baseline; }
}
.seats-low { color: #a3202b; font-weight: 700; }

/* ---------- filters ---------- */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; background: var(--white); padding: 16px; border: 1px solid var(--mist); border-radius: var(--radius); margin-bottom: 20px; align-items: end; }
.filters .field { margin: 0; }
.filters label { font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--white); border: 1px solid var(--mist); border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; }
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--cat); display: inline-block; }
.chip:hover { border-color: var(--cat); background: #fff; }
.chip small { color: var(--slate); font-weight: 500; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 24px; }

/* ---------- course detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }
.detail .banner { border-radius: var(--radius); background: var(--cat); color: #fff; padding: 24px; margin-bottom: 20px; }
.detail .banner h1 { margin: 0 0 8px; }
.detail .banner .meta { color: rgba(255,255,255,.92); font-size: 16px; }
.detail h2 { margin-top: 28px; }
.facts { display: grid; gap: 10px; margin: 0 0 16px; }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.facts dt { color: var(--slate); font-weight: 600; } .facts dd { margin: 0; font-weight: 500; }
.sticky { position: sticky; top: 84px; }
.prose p, .prose ul { max-width: 68ch; }
.prose ul { padding-left: 22px; }
.ref-box { font: 700 28px/1 var(--font-display); letter-spacing: .06em; background: var(--sun-soft); border: 2px dashed var(--sun); padding: 14px 18px; border-radius: 10px; display: inline-block; }

/* ---------- facilitator cards ---------- */
.fac-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.fac { background: var(--white); border: 1px solid var(--mist); border-left: 6px solid var(--blue); border-radius: var(--radius); padding: 16px 18px; position: relative; }
.fac:hover { border-color: var(--blue); }
.fac h3 { margin-bottom: 4px; } .fac h3 a { color: var(--ink); text-decoration: none; } .fac h3 a::after { content: ''; position: absolute; inset: 0; }
.avatar { width: 56px; height: 56px; border-radius: 14px; background: var(--ink); color: #fff; display: grid; place-items: center; font: 800 22px var(--font-display); flex: none; }

/* ---------- steps and pricing ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; background: var(--white); border: 1px solid var(--mist); border-radius: var(--radius); padding: 18px; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--sun); color: var(--ink); font: 800 18px var(--font-display); margin-bottom: 10px; }
@media (max-width: 800px) { .steps { grid-template-columns: 1fr; } }
.price-card { background: var(--ink); color: #fff; border-radius: 16px; padding: 28px; max-width: 460px; }
.price-card .big { font: 800 56px/1 var(--font-display); letter-spacing: -.03em; }
.price-card ul { padding-left: 20px; margin: 16px 0; } .price-card li { margin-bottom: 6px; }
.band { background: var(--ink); color: #fff; }
.band a { color: var(--sun); } .band .btn.sun { color: var(--ink); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--mist); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--mist); vertical-align: top; }
th { background: #eef4f8; font-weight: 700; font-size: 14px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .row { gap: 6px; }

/* ---------- dashboard shell ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 28px; padding-top: 24px; padding-bottom: 48px; align-items: start; }
.side { position: sticky; top: 84px; background: var(--white); border: 1px solid var(--mist); border-radius: var(--radius); padding: 10px; }
.side .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--mist); margin-bottom: 8px; }
.side .who strong { display: block; font-family: var(--font-display); font-size: 17px; overflow-wrap: anywhere; }
.side a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
.side a svg { width: 18px; height: 18px; flex: none; }
.side a:hover { background: var(--blue-soft); }
.side a[aria-current="page"] { background: var(--ink); color: #fff; }
.side .count { margin-left: auto; background: var(--sun); color: var(--ink); border-radius: 999px; font-size: 12px; font-weight: 800; padding: 1px 8px; }
.shell.admin .side { background: var(--ink); border-color: var(--ink); }
.shell.admin .side a { color: #e8f1f7; } .shell.admin .side a:hover { background: rgba(255,255,255,.1); }
.shell.admin .side a[aria-current="page"] { background: var(--sun); color: var(--ink); }
.shell.admin .side .who { border-color: rgba(255,255,255,.2); color: #fff; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; gap: 16px; }
  .side { position: static; display: flex; overflow-x: auto; padding: 6px; gap: 4px; }
  .side .who { display: none; } .side a { white-space: nowrap; }
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--mist); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font: 800 32px/1.1 var(--font-display); }
.stat span { color: var(--slate); font-size: 14px; }
.stat.alert { border-color: var(--sun); background: var(--sun-soft); }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--mist); margin-bottom: 20px; overflow-x: auto; }
.tabs button, .tabs a { background: none; border: 0; padding: 10px 16px; font: 700 15px var(--font-body); color: var(--slate); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; text-decoration: none; white-space: nowrap; }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--ink); border-bottom-color: var(--sun); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 8px; }
.bars div { flex: 1; background: var(--blue); border-radius: 4px 4px 0 0; min-height: 3px; position: relative; }
.bars div:last-child { background: var(--sun); }
.bars-x { display: flex; gap: 6px; font-size: 11px; color: var(--slate); } .bars-x span { flex: 1; text-align: center; }
.progress { height: 10px; background: var(--mist); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--reef); }

/* ---------- dialog and toast ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(11,47,74,.35); color: var(--ink); }
dialog::backdrop { background: rgba(11,47,74,.55); }
dialog form.body { padding: 24px; }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 90; width: min(480px, calc(100vw - 24px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: pop .2s ease-out; border-left: 6px solid var(--sun); }
.toast.bad { border-color: var(--hibiscus); } .toast.good { border-color: #4cd1a5; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: #cfe0ec; padding: 36px 0 28px; margin-top: 40px; }
.site-footer a { color: #fff; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
.site-footer h4 { color: #fff; font-size: 15px; } .site-footer ul { list-style: none; padding: 0; margin: 0; } .site-footer li { margin-bottom: 6px; }
.site-footer .brand { color: #fff; }
@media (max-width: 720px) { .site-footer .cols { grid-template-columns: 1fr 1fr; } }
.demo-bar { background: var(--sun); color: var(--ink); text-align: center; padding: 6px var(--gutter); font-weight: 600; font-size: 14px; }
.demo-bar button { background: none; border: 0; text-decoration: underline; font: inherit; cursor: pointer; color: inherit; }
.auth-card { max-width: 460px; margin: 40px auto; }
.kbd { font-family: ui-monospace, monospace; background: #eef4f8; padding: 1px 6px; border-radius: 4px; }
.qr { max-width: 200px; background: #fff; padding: 8px; border: 1px solid var(--mist); border-radius: 8px; }
@media print { .site-header, .site-footer, .side, .btn, .demo-bar { display: none !important; } body { background: #fff; } }
