:root {
  --paper: #f5f7f3;
  --white: #ffffff;
  --green-950: #073c2e;
  --green-900: #0b4937;
  --green-700: #176149;
  --green-500: #4f9873;
  --green-200: #bad6c6;
  --green-100: #dfece4;
  --green-050: #edf4ef;
  --ink: #10231c;
  --muted: #66766f;
  --rule: #cbd6d0;
  --amber: #e5a23b;
  --red: #b54a3d;
  --font: "Onest", "Avenir Next", sans-serif;
  --mono: "IBM Plex Mono", monospace;
  --shadow: 0 22px 70px rgba(7, 60, 46, 0.14);
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); font-family: var(--font); font-size: 16px; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2.35rem, 12vw, 5.1rem); font-weight: 600; line-height: .94; letter-spacing: -.072em; }
h2 { letter-spacing: -.045em; }
input, textarea, select { width: 100%; border: 1px solid var(--rule); border-radius: 0; outline: none; background: var(--white); color: var(--ink); }
input, select { height: 52px; padding: 0 14px; }
textarea { padding: 14px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--green-700); box-shadow: inset 0 0 0 1px var(--green-700); }

.screen { min-height: 100svh; }
.brand { border: 0; padding: 0; background: transparent; color: var(--green-950); font-size: 1.5rem; font-weight: 700; letter-spacing: -.065em; text-decoration: none; cursor: pointer; }
.brand span { color: #69aa83; }
.brand.inverse { color: var(--white); }
.mono-label, .eyebrow, .mono-value { font-family: var(--mono); font-size: .68rem; letter-spacing: .095em; text-transform: uppercase; }
.eyebrow { margin-bottom: 11px; color: var(--green-700); }
.primary-button, .secondary-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; border-radius: 0; padding: 0 18px; font-weight: 650; cursor: pointer; }
.primary-button { border: 1px solid var(--green-950); background: var(--green-950); color: var(--white); }
.secondary-button { border: 1px solid var(--green-950); background: transparent; color: var(--green-950); }
.primary-button:hover { background: var(--green-700); }
.primary-button:disabled, .secondary-button:disabled { opacity: .36; cursor: default; }
.full { width: 100%; }
.icon-button { width: 44px; height: 44px; display: grid; flex: 0 0 auto; place-items: center; border: 1px solid var(--rule); border-radius: 0; background: transparent; cursor: pointer; }
.avatar-button { width: 42px; height: 42px; border: 1px solid var(--green-950); border-radius: 0; background: transparent; font-family: var(--mono); font-size: .7rem; cursor: pointer; }
.portrait { width: 50px; height: 50px; display: grid; flex: 0 0 auto; place-items: center; color: var(--green-950); font-family: var(--mono); font-size: .7rem; }
.portrait.large { width: 62px; height: 62px; }
.portrait.xlarge { width: 112px; height: 112px; font-size: 1.15rem; }
.portrait.mint { background: #b9d9ca; }

/* Public access */
.auth-layout { min-height: 100svh; display: grid; background: var(--white); }
.auth-brand-panel { min-height: 290px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 27px 22px 24px; background: var(--green-950); color: var(--white); }
.auth-statement { position: relative; z-index: 1; padding-top: 48px; }
.auth-statement .mono-label { display: block; margin-bottom: 15px; color: #9ac2ad; }
.auth-statement h1 { max-width: 9ch; font-size: clamp(2.65rem, 13vw, 5.5rem); }
.signal-grid { position: absolute; right: -12px; bottom: -25px; width: 145px; height: 210px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; opacity: .45; transform: rotate(-10deg); }
.signal-grid i { align-self: end; height: calc(18px + var(--n) * 19px); background: #78b291; }
.auth-form-panel { display: grid; align-items: center; padding: 34px 22px 50px; }
.auth-card { width: min(100%, 430px); margin: 0 auto; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--rule); }
.auth-tabs button { min-height: 47px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.auth-tabs button.active { border-color: var(--green-950); color: var(--ink); }
.auth-heading { padding: 39px 0 26px; }
.auth-heading h2 { max-width: 12ch; margin: 0; font-size: 2rem; line-height: 1.02; }
.form-stack { display: grid; gap: 17px; }
.form-stack label, .source-form label { display: grid; gap: 8px; color: var(--muted); font-size: .76rem; font-weight: 600; }
.role-field { margin: 0; border: 0; padding: 0; }
.role-field legend { margin-bottom: 8px; color: var(--muted); font-size: .76rem; font-weight: 600; }
.choice-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice-pair button { min-height: 50px; border: 1px solid var(--rule); background: var(--white); cursor: pointer; }
.choice-pair button.selected { border-color: var(--green-950); background: var(--green-050); }
.form-error { min-height: 18px; margin: -7px 0; color: var(--red); font-size: .75rem; }
.auth-notice { margin-bottom: 20px; border-left: 3px solid var(--green-500); padding: 12px 14px; background: var(--green-050); color: var(--green-950); font-size: .76rem; line-height: 1.5; }
.auth-notice.error { border-color: var(--red); background: #fff4f2; color: #6d2b24; }
.verification-copy { margin: 14px 0 26px; color: var(--muted); overflow-wrap: anywhere; }
.text-button { min-height: 44px; border: 0; background: transparent; color: var(--green-700); cursor: pointer; }
.loading-screen { min-height: 100svh; display: grid; place-items: center; background: var(--white); color: var(--green-950); }
/* Application shell */
.app-shell { min-height: 100svh; }
.desktop-rail { display: none; }
.main-surface { width: min(100%, 680px); margin: 0 auto; padding: 0 20px calc(94px + env(safe-area-inset-bottom)); }
.main-surface.wide { width: min(100%, 1180px); }
.mobile-header { height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mobile-title { min-width: 0; overflow: hidden; color: var(--muted); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.mobile-nav { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; height: calc(70px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 18px env(safe-area-inset-bottom); border-top: 1px solid var(--rule); background: rgba(245, 247, 243, .96); backdrop-filter: blur(14px); }
.admin-shell .mobile-nav { grid-template-columns: repeat(4, 1fr); }
.mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; background: transparent; color: #73827b; font-size: .62rem; cursor: pointer; }
.mobile-nav button.active { color: var(--green-950); }
.welcome-block, .page-heading, .studio-heading { padding: 28px 0 24px; }
.welcome-block h1 { max-width: 11ch; }
.page-heading h1, .studio-heading h1 { max-width: 10ch; }
.page-heading.dashboard-heading { display: grid; gap: 24px; }
.instructor-section { padding-top: 38px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section-heading h2 { margin: 0; font-size: 1.15rem; }
.section-heading button, .section-heading > span { border: 0; background: transparent; color: var(--green-700); font-size: .77rem; cursor: pointer; }

/* Discovery and course */
.directory-grid { display: grid; gap: 12px; }
.directory-card { min-height: 295px; display: flex; flex-direction: column; align-items: stretch; border: 1px solid var(--rule); padding: 18px; background: var(--white); text-align: left; cursor: pointer; }
.directory-top, .directory-bottom { display: flex; align-items: flex-start; justify-content: space-between; }
.directory-card .mono-value { display: flex; flex-direction: column; align-items: flex-end; color: var(--green-950); font-size: .75rem; }
.directory-card .mono-value small { color: var(--muted); font-size: .52rem; }
.directory-card h2 { margin: 31px 0 8px; font-size: 1.35rem; }
.directory-card > p { margin-bottom: 18px; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.directory-bottom { align-items: center; margin-top: auto; padding-top: 24px; }
.directory-bottom strong { font-size: 1.1rem; }
.directory-bottom small { color: var(--muted); font-size: .65rem; font-weight: 400; }
.profile-hero { display: grid; gap: 25px; padding: 32px 0 36px; }
.profile-hero h1 { max-width: 10ch; }
.profile-hero > div > p:last-child { max-width: 46ch; margin: 18px 0 0; color: var(--muted); line-height: 1.65; }
.course-offer { display: grid; gap: 28px; padding: 23px; background: var(--green-950); color: var(--white); }
.course-offer .eyebrow { color: #9fc4b2; }
.offer-main h2 { max-width: 15ch; margin-bottom: 20px; font-size: 1.7rem; }
.offer-price { display: grid; gap: 4px; }
.offer-price > strong { font-size: 2rem; }
.offer-price > span { margin-bottom: 16px; color: #a9c8b8; font-size: .72rem; }
.metric-grid { display: grid; gap: 10px; }
.profile-page { padding: 30px 0; }
.settings-list { margin-top: 28px; border-top: 1px solid var(--rule); }
.settings-list > div, .settings-list > button { width: 100%; min-height: 68px; display: flex; align-items: center; justify-content: space-between; border: 0; border-bottom: 1px solid var(--rule); background: transparent; text-align: left; }
.settings-list span { color: var(--muted); font-size: .75rem; }

/* Instructor studio */
.dashboard-heading .primary-button { justify-self: start; }
.paypal-state { font-family: var(--mono); font-size: .7rem; color: var(--green-700); }
.manage-section { margin-top: 30px; }
.manage-list { margin-top: 13px; border-top: 1px solid var(--rule); }
.manage-list > button { width: 100%; min-height: 87px; display: grid; grid-template-columns: 3px minmax(0, 1fr) auto 26px; align-items: center; gap: 14px; border: 0; border-bottom: 1px solid var(--rule); background: transparent; text-align: left; cursor: pointer; }
.manage-list > button > span:nth-child(2) { display: flex; flex-direction: column; }
.manage-list strong { font-size: .9rem; }
.manage-list small { color: var(--muted); font-size: .67rem; }
.manage-list em { font-family: var(--mono); color: var(--green-700); font-size: .55rem; font-style: normal; text-transform: uppercase; }
.status-line { width: 3px; height: 42px; background: var(--amber); }
.status-line.published { background: var(--green-500); }
.status { border: 1px solid var(--rule); padding: 5px 7px; font-family: var(--mono); font-size: .53rem; text-transform: uppercase; }
.status.published, .status.good { border-color: var(--green-200); background: var(--green-050); color: var(--green-700); }
.source-panel { border: 1px solid var(--rule); background: var(--white); }
.source-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--rule); }
.source-tabs button { min-height: 62px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-right: 1px solid var(--rule); background: transparent; color: var(--muted); font-size: .68rem; cursor: pointer; }
.source-tabs button:last-child { border-right: 0; }
.source-tabs button.active { background: var(--green-950); color: var(--white); }
.source-form { display: grid; gap: 22px; padding: 22px; }
.upload-zone { min-height: 210px; align-content: center; justify-items: center; border: 1px dashed var(--green-500); padding: 20px; background: var(--green-050); cursor: pointer; }
.upload-zone input { width: 1px; height: 1px; opacity: 0; }
.upload-zone span { color: var(--muted); }
.form-row { display: grid; gap: 16px; }
.generation-overlay { position: fixed; z-index: 40; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(7, 60, 46, .96); color: var(--white); }
.generation-mark { width: 74px; height: 74px; display: grid; place-items: center; margin-bottom: 22px; border: 1px solid #84b39c; }
.generation-overlay > span { margin-top: 8px; color: #a8c8b8; font-size: .76rem; }
.generation-overlay i { width: 170px; height: 2px; margin-top: 28px; overflow: hidden; background: #326a56; }
.generation-overlay i::after { content: ""; display: block; width: 45%; height: 100%; background: var(--white); animation: load 1.2s infinite alternate ease-in-out; }
@keyframes load { to { transform: translateX(120%); } }
.editor-header { display: grid; gap: 20px; padding: 25px 0; border-bottom: 1px solid var(--rule); }
.title-input { height: auto; border: 0; padding: 0; background: transparent; font-size: 1.65rem; font-weight: 600; letter-spacing: -.045em; }
.title-input:focus { box-shadow: none; border-bottom: 1px solid var(--green-950); }
.editor-header > div:last-child { display: flex; gap: 8px; }
.editor-layout { display: grid; }
.scene-strip { display: flex; overflow-x: auto; margin: 0 -20px; padding: 20px; gap: 8px; border-bottom: 1px solid var(--rule); }
.scene-strip > p { display: none; }
.scene-strip button { min-width: 190px; display: grid; grid-template-columns: 27px 1fr; grid-template-rows: auto auto; gap: 3px 8px; border: 1px solid var(--rule); padding: 12px; background: var(--white); text-align: left; }
.scene-strip button.active { border-color: var(--green-950); }
.scene-strip span { grid-row: 1/3; font-family: var(--mono); font-size: .6rem; }
.scene-strip strong { font-size: .73rem; }
.scene-strip small { color: var(--muted); font-size: .58rem; }
.editor-canvas { display: grid; gap: 35px; padding: 25px 0; }
.transcript-editor label { display: grid; gap: 6px; margin-top: 13px; }
.transcript-editor label > span { color: var(--green-700); font-family: var(--mono); font-size: .58rem; letter-spacing: .08em; }
.transcript-editor textarea { min-height: 67px; }
.skill-chip { display: grid; grid-template-columns: 78px 1fr 30px; align-items: center; gap: 10px; margin-top: 8px; border: 1px solid var(--rule); padding: 11px; background: var(--white); }
.skill-chip > span, .activity-kind { font-family: var(--mono); color: var(--green-700); font-size: .54rem; letter-spacing: .07em; }
.skill-chip > strong { font-size: .8rem; }
.skill-chip button { border: 0; background: transparent; }
.activity-editor article { display: grid; gap: 7px; margin-top: 8px; border: 1px solid var(--rule); padding: 16px; background: var(--white); }
.activity-editor article strong { font-size: .85rem; }
.activity-editor article small { color: var(--muted); }

/* Admin and data */
.metric-grid { grid-template-columns: repeat(2, 1fr); }
.metric-grid article { min-height: 125px; display: flex; flex-direction: column; border: 1px solid var(--rule); padding: 15px; background: var(--white); }
.metric-grid article > span { color: var(--muted); font-family: var(--mono); font-size: .53rem; letter-spacing: .08em; }
.metric-grid article > strong { margin: 14px 0 5px; font-size: 1.7rem; letter-spacing: -.05em; }
.metric-grid article > small { margin-top: auto; color: var(--muted); font-size: .6rem; line-height: 1.4; }
.payout-card { border: 1px solid var(--rule); padding: 19px; background: var(--white); }
.data-table { border-top: 1px solid var(--rule); }
.table-head, .data-table > button { display: grid; grid-template-columns: minmax(0, 1fr) 86px; gap: 10px; align-items: center; }
.table-head { min-height: 40px; color: var(--muted); font-family: var(--mono); font-size: .53rem; letter-spacing: .06em; text-transform: uppercase; }
.table-head span:nth-child(2), .table-head span:nth-child(4), .data-table > button > span:nth-child(2), .data-table > button > span:nth-child(4) { display: none; }
.data-table > button { width: 100%; min-height: 72px; border: 0; border-bottom: 1px solid var(--rule); background: transparent; text-align: left; }
.data-table > button > span:first-child { display: flex; align-items: center; gap: 9px; }
.data-table strong { font-size: .76rem; }
.data-table > button > span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .67rem; }
.instructor-shell .data-table .table-head, .instructor-shell .data-table > button { grid-template-columns: minmax(0, 1.5fr) .7fr .7fr; }
.instructor-shell .data-table .table-head span:nth-child(2), .instructor-shell .data-table > button > span:nth-child(2) { display: flex; }
.mini-avatar { width: 31px; height: 31px; display: grid; flex: 0 0 auto; place-items: center; background: var(--green-100); color: var(--green-950); font-family: var(--mono); font-size: .55rem; font-style: normal; }
.status-dot { width: 6px; height: 6px; background: var(--amber); }
.status-dot.active, .status-dot.published { background: var(--green-500); }

/* Modal and feedback */
.modal-backdrop { position: fixed; z-index: 80; inset: 0; display: grid; align-items: end; padding: 12px; background: rgba(5, 29, 22, .62); }
.modal { width: min(100%, 520px); position: relative; margin: 0 auto; padding: 28px 21px 23px; background: var(--white); box-shadow: var(--shadow); }
.modal-close { position: absolute; top: 14px; right: 14px; width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid var(--rule); background: transparent; }
.modal h2 { max-width: 12ch; margin-bottom: 27px; font-size: 1.9rem; }
.generation-error { margin-top: 18px; border-left: 4px solid var(--red); padding: 16px 18px; background: #fff4f2; }
.generation-error strong { display: block; margin-bottom: 7px; }
.generation-error p { margin: 0; color: #6d2b24; line-height: 1.55; }
.generation-error .primary-button { margin-top: 16px; }
.source-summary { max-width: 820px; margin: 0 0 24px; color: var(--muted); line-height: 1.6; }
.toast { position: fixed; z-index: 100; right: 16px; bottom: 88px; left: 16px; min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 9px; background: var(--green-950); color: var(--white); box-shadow: var(--shadow); font-size: .78rem; }

@media (min-width: 700px) {
  .auth-brand-panel { min-height: 360px; padding: 40px; }
  .auth-form-panel { padding: 55px; }
  .directory-grid { grid-template-columns: repeat(2, 1fr); }
  .course-offer { grid-template-columns: minmax(0, 1fr) 235px; align-items: end; padding: 35px; }
  .form-row { grid-template-columns: 180px 1fr; align-items: end; }
  .form-row .primary-button { justify-self: end; }
  .table-head, .data-table > button { grid-template-columns: minmax(0, 1.5fr) .7fr .7fr .7fr; }
  .table-head span:nth-child(2), .table-head span:nth-child(4), .data-table > button > span:nth-child(2), .data-table > button > span:nth-child(4) { display: flex; }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
  .modal-backdrop { align-items: center; }
}

@media (min-width: 900px) {
  .auth-layout { grid-template-columns: minmax(430px, 1.05fr) minmax(430px, .95fr); }
  .auth-brand-panel { min-height: 100svh; padding: 42px 48px; }
  .auth-statement { margin-block: auto 70px; }
  .auth-statement h1 { font-size: clamp(4rem, 6.8vw, 6.8rem); }
  .auth-form-panel { min-height: 100svh; }
  .signal-grid { width: 210px; height: 320px; }
  .app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
  .desktop-rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 36px 27px 28px; border-right: 1px solid var(--rule); background: var(--white); }
  .desktop-rail nav { display: flex; flex-direction: column; gap: 5px; margin-top: 72px; }
  .rail-link { min-height: 46px; display: flex; align-items: center; gap: 12px; border: 0; border-left: 2px solid transparent; padding: 0 10px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
  .rail-link.active { border-left-color: var(--green-950); color: var(--green-950); }
  .desktop-rail .avatar-button { margin-top: auto; }
  .mobile-header, .mobile-nav { display: none; }
  .main-surface { width: min(100%, 1080px); padding: 72px 64px 100px; }
  .main-surface.wide { width: min(100%, 1320px); }
  .welcome-block, .page-heading, .studio-heading { padding-top: 16px; }
  .page-heading.dashboard-heading { display: flex; align-items: end; justify-content: space-between; }
  .directory-grid { grid-template-columns: repeat(4, 1fr); }
  .profile-hero { grid-template-columns: 140px 1fr; align-items: end; }
  .editor-header { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .editor-layout { grid-template-columns: 245px minmax(0, 1fr); }
  .scene-strip { display: block; overflow: visible; margin: 0; padding: 26px 22px 26px 0; border-right: 1px solid var(--rule); border-bottom: 0; }
  .scene-strip > p { display: block; }
  .scene-strip button { width: 100%; min-width: 0; margin-bottom: 8px; }
  .editor-canvas { padding: 28px 0 28px 35px; }
  .toast { right: 25px; bottom: 25px; left: auto; min-width: 290px; padding: 0 20px; }
}

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