:root {
  --ink: #191c17;
  --ink-soft: #272c23;
  --paper: #f3f2ec;
  --surface: #fffef9;
  --lime: #d8ff63;
  --lime-dark: #9fc933;
  --coral: #f37959;
  --sage: #dce9d6;
  --muted: #6b7065;
  --line: #d8d9cf;
  --danger: #b83d31;
  --display: "Bodoni 72", Didot, "Times New Roman", serif;
  --body: "Avenir Next", "Century Gothic", "Trebuchet MS", sans-serif;
  --shadow: 0 20px 60px rgba(25, 28, 23, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
button, a, input, select, textarea, summary { outline-offset: 4px; }
:focus-visible { outline: 3px solid var(--coral); }
.hidden { display: none !important; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 1000; background: var(--lime); color: var(--ink); padding: .8rem 1rem; border-radius: 8px; }
.skip-link:focus { top: 1rem; }

.brand { display: flex; align-items: center; gap: .85rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; }
.brand-light { color: #fff; }
.brand-mark { width: 38px; height: 38px; border: 2px solid currentColor; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; }
.brand-mark i { width: 13px; height: 13px; background: var(--lime); border-radius: 50%; display: block; }
.eyebrow { margin: 0 0 1rem; font-size: .69rem; line-height: 1.3; letter-spacing: .18em; font-weight: 800; color: var(--lime); }
.eyebrow.dark { color: var(--muted); }

.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr); }
.auth-story { position: relative; overflow: hidden; padding: clamp(2rem, 5vw, 5rem); background: var(--ink); color: white; display: flex; flex-direction: column; justify-content: space-between; isolation: isolate; }
.auth-story::before { content: ""; position: absolute; width: 520px; height: 520px; border: 1px solid rgba(216,255,99,.18); border-radius: 50%; right: -160px; top: 12%; box-shadow: 0 0 0 80px rgba(216,255,99,.025), 0 0 0 160px rgba(216,255,99,.018); z-index: -1; }
.story-copy { margin: auto 0; padding: 4rem 0; max-width: 680px; }
.story-copy h1 { font-family: var(--display); font-weight: 400; font-size: clamp(3.7rem, 7.1vw, 7.5rem); letter-spacing: -.065em; line-height: .87; margin: 0 0 2rem; }
.story-copy h1 em { color: var(--lime); font-weight: 400; }
.story-copy > p:last-child { max-width: 450px; color: #c4c8bd; font-size: 1.04rem; line-height: 1.75; }
.sample-ticket { background: var(--lime); color: var(--ink); padding: 1.4rem; max-width: 580px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.25rem; transform: rotate(-1.5deg); box-shadow: 18px 18px 0 rgba(255,255,255,.055); }
.ticket-date { border-right: 1px solid rgba(25,28,23,.25); padding-right: 1.2rem; text-align: center; }
.ticket-date strong { display: block; font-family: var(--display); font-size: 2.7rem; line-height: .85; font-weight: 400; }
.ticket-date span, .sample-ticket small { font-size: .58rem; font-weight: 800; letter-spacing: .14em; }
.sample-ticket p { margin: .45rem 0 0; font-size: .82rem; line-height: 1.5; }
.ticket-dot { width: 11px; height: 11px; background: var(--ink); border-radius: 50%; }
.local-note { font-size: .72rem; color: #9da394; display: flex; align-items: center; gap: .55rem; margin: 3rem 0 0; }
.local-note span { width: 7px; height: 7px; background: var(--lime); border-radius: 50%; box-shadow: 0 0 0 4px rgba(216,255,99,.12); }

.auth-panel { display: grid; place-items: center; padding: 2rem; background: var(--paper); }
.auth-card { width: min(100%, 450px); animation: enter .55s ease-out both; }
.auth-card h2 { font-family: var(--display); font-size: clamp(2.4rem, 4vw, 3.4rem); font-weight: 400; letter-spacing: -.045em; line-height: 1; margin: 0 0 .9rem; }
.auth-intro { color: var(--muted); line-height: 1.6; margin: 0 0 2rem; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 5px; background: #e5e5dc; border-radius: 13px; margin-bottom: 2rem; }
.segmented button { border: 0; background: transparent; padding: .8rem; border-radius: 9px; color: var(--muted); font-weight: 700; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 3px 12px rgba(25,28,23,.07); }
.auth-form { display: grid; gap: 1rem; }
.field { display: grid; gap: .45rem; }
.field label { font-size: .73rem; font-weight: 700; color: var(--ink-soft); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: .88rem 1rem; transition: border-color .2s, box-shadow .2s; }
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--lime-dark); box-shadow: 0 0 0 4px rgba(159,201,51,.15); outline: none; }
.field small { color: var(--muted); font-size: .7rem; }
.field label small { font-weight: 500; }
.button { border: 0; min-height: 46px; border-radius: 10px; padding: .8rem 1.15rem; display: inline-flex; align-items: center; justify-content: center; gap: .8rem; font-weight: 750; font-size: .82rem; transition: transform .18s, background .18s, box-shadow .18s; }
.button:hover:not(:disabled) { transform: translateY(-2px); }
.button-dark { background: var(--ink); color: white; }
.button-dark:hover:not(:disabled) { background: #30372b; box-shadow: 0 8px 20px rgba(25,28,23,.16); }
.button-dark span { color: var(--lime); font-size: 1.1rem; }
.button-lime { background: var(--lime); color: var(--ink); }
.button-light { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.button-danger { background: #fff0eb; color: var(--danger); border: 1px solid #f2c8bc; }
.button-full { width: 100%; margin-top: .6rem; }
.button-small { min-height: 35px; padding: .5rem .8rem; font-size: .73rem; }
.demo-access { margin-top: 1.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.demo-access summary { cursor: pointer; font-weight: 700; margin-bottom: .7rem; }
.demo-access button { width: 100%; display: flex; justify-content: space-between; gap: 1rem; border: 0; background: transparent; padding: .5rem 0; color: var(--ink); }
.demo-access code { font-size: .68rem; }
.demo-access p { line-height: 1.6; }

.workspace { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--ink); color: white; padding: 2rem 1.35rem 1.4rem; display: flex; flex-direction: column; z-index: 10; }
.sidebar .brand { padding: 0 .5rem 2rem; }
.user-summary { padding: 1rem; border: 1px solid #373d32; border-radius: 12px; margin-bottom: 1.4rem; background: rgba(255,255,255,.025); }
.user-summary strong { display: block; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; }
.user-summary span { display: block; color: #a8ae9f; font-size: .66rem; margin-top: .25rem; }
.sidebar-nav { display: grid; gap: .28rem; overflow-y: auto; }
.sidebar-nav button { position: relative; text-align: left; border: 0; border-radius: 9px; padding: .8rem .85rem; background: transparent; color: #aeb4a6; font-size: .77rem; font-weight: 650; transition: color .2s, background .2s; }
.sidebar-nav button:hover { color: white; background: #272c23; }
.sidebar-nav button.active { color: var(--ink); background: var(--lime); }
.sidebar-footer { margin-top: auto; padding: 1.2rem .5rem 0; display: grid; gap: .6rem; border-top: 1px solid #343a30; }
.text-button { border: 0; background: transparent; color: #aeb4a6; padding: .35rem 0; text-align: left; font-size: .7rem; display: flex; justify-content: space-between; }
.text-button:hover { color: var(--lime); }
.text-button.muted { color: var(--muted); }

.main-content { min-width: 0; padding: 0 clamp(1.2rem, 3.2vw, 3.5rem) 4rem; }
.main-header { min-height: 138px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.main-header .eyebrow { margin-bottom: .4rem; }
.main-header h2 { font-family: var(--display); font-size: clamp(2rem, 3vw, 3.1rem); font-weight: 400; letter-spacing: -.04em; margin: 0; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.header-right time { color: var(--muted); font-size: .73rem; text-transform: capitalize; }
.avatar { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 50%; background: var(--ink); color: var(--lime); font-family: var(--display); font-size: 1.1rem; }
.icon-button { display: none; border: 1px solid var(--line); background: var(--surface); width: 40px; height: 40px; border-radius: 50%; }
.view-container { max-width: 1380px; margin: 0 auto; animation: enter .35s ease-out both; }

.hero { position: relative; overflow: hidden; background: var(--ink); color: white; border-radius: 20px; padding: clamp(1.5rem, 3vw, 2.6rem); display: grid; grid-template-columns: 1.4fr .8fr; gap: 2rem; align-items: end; margin-bottom: 1.5rem; }
.hero::after { content: ""; position: absolute; width: 260px; height: 260px; border: 55px solid rgba(216,255,99,.08); border-radius: 50%; right: -90px; top: -130px; pointer-events: none; }
.hero .eyebrow { margin-bottom: .7rem; }
.hero h3 { font-family: var(--display); font-size: clamp(2rem, 4vw, 4rem); line-height: .98; letter-spacing: -.045em; font-weight: 400; margin: 0 0 1rem; max-width: 680px; }
.hero p { color: #b8bdb1; font-size: .85rem; line-height: 1.6; margin: 0; }
.hero-metric { position: relative; z-index: 1; background: var(--lime); color: var(--ink); padding: 1.2rem; border-radius: 13px; transform: rotate(1deg); }
.hero-metric strong { font-family: var(--display); font-size: 3rem; font-weight: 400; display: block; line-height: 1; }
.hero-metric span { font-size: .66rem; font-weight: 800; letter-spacing: .08em; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 1.25rem; }
.stat-card span { display: block; color: var(--muted); font-size: .68rem; margin-bottom: .65rem; }
.stat-card strong { font-family: var(--display); font-size: 2.5rem; font-weight: 400; line-height: 1; }
.stat-card.accent { background: var(--sage); border-color: transparent; }

.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin: 2rem 0 1rem; }
.section-heading h3 { font-family: var(--display); font-size: 1.65rem; font-weight: 400; letter-spacing: -.025em; margin: 0; }
.section-heading p { margin: .3rem 0 0; color: var(--muted); font-size: .76rem; }
.class-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.class-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 17px; padding: 1.3rem; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 1.1rem; transition: transform .2s, box-shadow .2s, border-color .2s; }
.class-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #bec2b5; }
.date-tile { min-height: 90px; background: var(--paper); border-radius: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-transform: uppercase; }
.date-tile strong { font-family: var(--display); font-size: 2.4rem; line-height: .9; font-weight: 400; }
.date-tile span { font-size: .61rem; font-weight: 800; letter-spacing: .12em; margin-top: .35rem; }
.class-main { min-width: 0; }
.class-topline { display: flex; align-items: start; justify-content: space-between; gap: .7rem; }
.class-card h4 { margin: .1rem 0 .45rem; font-size: .98rem; letter-spacing: -.02em; }
.class-meta { color: var(--muted); font-size: .7rem; line-height: 1.6; margin: 0; }
.capacity-line { display: block; appearance: none; -webkit-appearance: none; width: 100%; height: 4px; border: 0; background: #e9e9e0; border-radius: 5px; overflow: hidden; margin: .85rem 0 .65rem; grid-column: 1 / -1; }
.capacity-line::-webkit-progress-bar { background: #e9e9e0; }
.capacity-line::-webkit-progress-value { background: var(--lime-dark); border-radius: 5px; }
.capacity-line::-moz-progress-bar { background: var(--lime-dark); border-radius: 5px; }
.class-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.pill { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; border-radius: 30px; padding: .34rem .6rem; background: var(--paper); color: var(--muted); font-size: .61rem; font-weight: 750; }
.pill.success { background: #e2efd7; color: #3f622b; }
.pill.warning { background: #fff0d4; color: #825d13; }
.pill.dark { background: var(--ink); color: var(--lime); }
.pill.danger { background: #ffebe6; color: var(--danger); }

.data-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.data-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(140px, 1fr) auto; gap: 1rem; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid #e8e8e0; }
.data-row:last-child { border-bottom: 0; }
.data-row h4 { font-size: .84rem; margin: 0 0 .25rem; }
.data-row p { color: var(--muted); font-size: .7rem; margin: 0; line-height: 1.5; }
.data-row.cancelled h4 { text-decoration: line-through; color: var(--muted); }
.notice { border-radius: 12px; padding: .8rem 1rem; margin: 0 0 1rem; font-size: .78rem; font-weight: 650; }
.notice.danger { background: #ffebe6; color: var(--danger); }
.row-actions { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.style-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.style-card { padding: 1.4rem; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.style-card h4 { font-family: var(--display); font-size: 1.6rem; font-weight: 400; margin: 0 0 .8rem; }
.style-card p { color: var(--muted); font-size: .75rem; margin: .25rem 0; }

.empty-state { text-align: center; background: var(--surface); border: 1px dashed #bfc3b7; border-radius: 18px; padding: 4rem 1.5rem; }
.empty-state .empty-symbol { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--lime); margin: 0 auto 1rem; font-family: var(--display); font-size: 1.8rem; }
.empty-state h3 { font-family: var(--display); font-size: 1.8rem; font-weight: 400; margin: 0 0 .5rem; }
.empty-state p { color: var(--muted); font-size: .8rem; line-height: 1.6; max-width: 420px; margin: 0 auto; }
.loading { display: grid; gap: 1rem; }
.skeleton { height: 150px; border-radius: 16px; background: linear-gradient(90deg, #e6e6dd 25%, #f7f7f1 50%, #e6e6dd 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }

.poll-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.poll-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem; }
.poll-card h3 { font-family: var(--display); font-weight: 400; font-size: 1.6rem; margin: .7rem 0 1rem; }
.poll-options { display: grid; gap: .55rem; }
.poll-option { width: 100%; display: flex; justify-content: space-between; align-items: center; text-align: left; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font-size: .77rem; }
.poll-option:hover:not(:disabled) { border-color: var(--lime-dark); background: #f6ffe2; }
.poll-option.voted { border-color: var(--lime-dark); background: #f0ffd0; }
.poll-footer { margin-top: 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: var(--muted); font-size: .68rem; }
.note-form { display: grid; gap: .8rem; margin-bottom: 1.2rem; }
.notes-list { display: grid; gap: .7rem; }
.note { border-left: 3px solid var(--lime-dark); background: var(--surface); padding: 1rem 1.2rem; box-shadow: 0 4px 20px rgba(25,28,23,.04); }
.note p { white-space: pre-wrap; font-size: .82rem; line-height: 1.65; margin: 0 0 .5rem; }
.note time { color: var(--muted); font-size: .65rem; }

.app-dialog { width: min(92vw, 600px); max-height: 88vh; border: 0; border-radius: 20px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.28); }
.app-dialog::backdrop { background: rgba(17,20,15,.72); backdrop-filter: blur(5px); }
.dialog-inner { padding: 1.6rem; }
.dialog-header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: 1.4rem; }
.dialog-header h3 { font-family: var(--display); font-weight: 400; font-size: 2rem; letter-spacing: -.03em; margin: 0; }
.dialog-close { border: 1px solid var(--line); background: transparent; width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto; }
.dialog-form { display: grid; gap: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: .6rem; }
.invite-code-reveal { background: var(--ink); color: var(--lime); padding: 1.4rem; border-radius: 12px; text-align: center; margin: 1rem 0; }
.invite-code-reveal code { font-size: clamp(1rem, 4vw, 1.5rem); font-weight: 800; letter-spacing: .04em; user-select: all; }
.participant-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.participant-row p { margin: 0; font-size: .77rem; }
.participant-row small { color: var(--muted); display: block; margin-top: .2rem; }
.participant-row select { border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: .55rem; font-size: .7rem; }

.toast { position: fixed; z-index: 200; left: 50%; bottom: 1.5rem; transform: translate(-50%, 30px); width: max-content; max-width: min(90vw, 520px); padding: .9rem 1.2rem; border-radius: 11px; background: var(--ink); color: white; box-shadow: 0 15px 50px rgba(0,0,0,.2); font-size: .78rem; line-height: 1.45; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-left: 4px solid var(--coral); }
.toast.success { border-left: 4px solid var(--lime); }

@keyframes enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .style-grid { grid-template-columns: repeat(2, 1fr); }
  .class-grid, .poll-grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-metric { max-width: 240px; }
}

@media (max-width: 800px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-story { min-height: auto; padding: 2rem 1.5rem; }
  .story-copy { padding: 3rem 0 2rem; }
  .story-copy h1 { font-size: clamp(3.3rem, 15vw, 5rem); }
  .sample-ticket { display: none; }
  .local-note { margin-top: 1rem; }
  .auth-panel { padding: 2.5rem 1.3rem; }
  .workspace { display: block; }
  .sidebar { position: static; height: auto; padding: 1rem; display: grid; grid-template-columns: 1fr auto; gap: 1rem; }
  .sidebar .brand { padding: 0; }
  .sidebar .brand span:last-child { display: none; }
  .user-summary { margin: 0; padding: .6rem .8rem; text-align: right; }
  .sidebar-nav { grid-column: 1 / -1; display: flex; overflow-x: auto; padding-bottom: .2rem; }
  .sidebar-nav button { flex: 0 0 auto; white-space: nowrap; }
  .sidebar-footer { display: none; }
  .main-content { padding: 0 1rem 3rem; }
  .main-header { min-height: 110px; margin-bottom: 1.3rem; }
  .header-right time { display: none; }
  #header-avatar { display: none; }
  .icon-button { display: block; }
  .class-grid { grid-template-columns: 1fr; }
  .data-row { grid-template-columns: 1fr; gap: .7rem; }
  .row-actions { justify-content: flex-start; }
}

@media (max-width: 480px) {
  .story-copy > p:last-child { font-size: .85rem; }
  .auth-card h2 { font-size: 2.5rem; }
  .main-header h2 { font-size: 1.8rem; }
  .header-right { gap: .4rem; }
  .hero { padding: 1.4rem; }
  .hero h3 { font-size: 2.35rem; }
  .stats-grid { gap: .6rem; }
  .stat-card { padding: 1rem; }
  .class-card { grid-template-columns: 62px minmax(0, 1fr); padding: 1rem; gap: .8rem; }
  .date-tile { min-height: 75px; }
  .class-topline { display: block; }
  .class-topline .pill { margin-top: .4rem; }
  .class-actions { align-items: flex-start; flex-direction: column; }
  .class-actions .button { width: 100%; }
  .style-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .participant-row { grid-template-columns: 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}

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