/* DGCS Studio · application shell and account pages
   Built on Design System v1.0 (vendor/dgcs/dgcs-theme.css + components bundle.css). Every colour, radius, shadow and
   type size below comes from the design system's tokens; this file only adds page layout.
   Layout: a slim sticky app header, then either a two-column auth layout (form + course-sign panel) or a settings layout. */

:root {
  --shell-h: 60px;
  --page-max: 1180px;
  --auth-form-max: 420px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  /* the sign illustration uses the course-sign palette (same greens as the editor's default Classic layout) */
  --sign-green: #1F3B2D;
  --sign-green-2: #2E5A41;
  --sign-gold: #F2C230;
  --sign-turf: #5E8F4E;
  --sign-turf-2: #7FA86A;
  --sign-text: #F6F4EC;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100%; margin: 0; background: var(--bg-app); color: var(--text-primary);
  font-family: var(--font-sans); font-size: 14px; line-height: 20px;
  display: flex; flex-direction: column;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--surface-panel); }
a { color: var(--text-link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 12px; border-radius: var(--radius-md); background: var(--surface-overlay); box-shadow: var(--shadow-md); color: var(--text-primary); }
.skip-link:focus { top: calc(8px + env(safe-area-inset-top, 0px)); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
.muted { color: var(--text-secondary); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------------- App header ---------------- */
.app-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; flex: none;
  background: var(--surface-panel); border-bottom: 1px solid var(--border-subtle);
}
.app-header__inner {
  height: var(--shell-h); max-width: var(--page-max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter-r);
  display: flex; align-items: center; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text-primary); text-decoration: none; flex: none; }
.brand__mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-charcoal); display: grid; place-items: center; }
.brand__mark svg { width: 20px; height: 20px; }
.brand__word { font-size: 16px; line-height: 20px; letter-spacing: -0.01em; }
.brand__word b { font-weight: 700; }
.brand__word span { font-weight: 500; color: var(--text-secondary); }
.app-nav { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; }
.app-nav a {
  padding: 8px 12px; border-radius: var(--radius-full); color: var(--text-secondary); text-decoration: none; white-space: nowrap;
  font-size: 14px; font-weight: 500;
}
.app-nav a:hover { background: var(--action-ghost-hover); color: var(--text-primary); }
.app-nav a[aria-current="page"] { background: var(--action-selected); color: var(--action-selected-text); }
.app-header__actions { display: flex; align-items: center; gap: 8px; flex: none; }
.app-header__actions .dg-btn { text-decoration: none; }
.menu-toggle { display: none; }

/* account menu */
.acct { position: relative; }
.acct__btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px; border-radius: var(--radius-full);
  border: 1px solid var(--border-default); background: var(--surface-raised); color: var(--text-primary); font: inherit; font-weight: 500; cursor: pointer;
}
.acct__btn:hover { background: var(--surface-hover); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-blue-subtle); color: var(--text-link); font-size: 12px; font-weight: 700; letter-spacing: 0.02em; flex: none; }
.acct__menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; padding: var(--menu-padding, 6px); border-radius: var(--radius-menu, 12px);
  background: var(--surface-overlay); border: 1px solid var(--border-default); box-shadow: var(--shadow-menu); z-index: 70;
}
.acct__menu[hidden] { display: none; }
.acct__who { padding: 10px 10px 8px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 4px; }
.acct__who b { display: block; font-weight: 600; }
.acct__who span { color: var(--text-secondary); font-size: 12px; }
.acct__menu a, .acct__menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-menu-item, 8px);
  background: transparent; color: var(--text-primary); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.acct__menu a:hover, .acct__menu button:hover { background: var(--surface-hover); }
.acct__menu svg { width: 16px; height: 16px; color: var(--text-secondary); flex: none; }
.acct__sep { height: 1px; margin: 4px 0; background: var(--border-subtle); }

/* theme switch (light / dark / system) */
.theme-sw { display: inline-flex; padding: 2px; border-radius: var(--radius-full); background: var(--bg-subtle); border: 1px solid var(--border-subtle); }
.theme-sw button { width: 30px; height: 28px; display: grid; place-items: center; border: 0; border-radius: var(--radius-full); background: transparent; color: var(--text-secondary); cursor: pointer; }
.theme-sw button[aria-pressed="true"] { background: var(--surface-raised); color: var(--text-primary); box-shadow: var(--shadow-xs); }
.theme-sw svg { width: 15px; height: 15px; }

/* mobile menu sheet */
.mobile-sheet { display: none; }
@media (max-width: 860px) {
  .app-nav, .app-header__actions .hide-sm { display: none; }
  .menu-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; margin-left: 0; border-radius: var(--radius-full); border: 1px solid var(--border-default); background: var(--surface-raised); color: var(--text-primary); cursor: pointer; }
  .menu-toggle svg { width: 18px; height: 18px; }
  .app-header__actions { gap: 6px; margin-left: auto; }
  .app-header__inner { gap: 12px; }
  .mobile-sheet {
    display: block; position: fixed; inset: calc(var(--shell-h) + env(safe-area-inset-top, 0px)) 0 0 0; z-index: 45; overflow-y: auto;
    background: var(--surface-panel); padding: 12px var(--gutter-r) max(24px, env(safe-area-inset-bottom, 0px)) var(--gutter);
  }
  .mobile-sheet[hidden] { display: none; }
  .mobile-sheet nav { display: flex; flex-direction: column; gap: 2px; }
  .mobile-sheet nav a { padding: 14px 12px; border-radius: var(--radius-lg); color: var(--text-primary); text-decoration: none; font-size: 16px; font-weight: 500; }
  .mobile-sheet nav a[aria-current="page"] { background: var(--action-selected); color: var(--action-selected-text); }
  .mobile-sheet .sheet-actions { display: grid; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-subtle); }
  .mobile-sheet .sheet-actions .dg-btn { width: 100%; text-decoration: none; }
  .mobile-sheet .sheet-theme { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; color: var(--text-secondary); }
}

/* ---------------- Auth layout ---------------- */
.auth {
  flex: 1 0 auto; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100vh - var(--shell-h));
}
.auth__main { display: flex; justify-content: center; align-items: flex-start; padding-block: clamp(32px, 7vh, 88px) 48px; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.auth__card { width: 100%; max-width: var(--auth-form-max); display: flex; flex-direction: column; gap: 24px; }
.auth__head { display: flex; flex-direction: column; gap: 8px; }
.auth__eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.auth__title { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.015em; }
.auth__lede { color: var(--text-secondary); font-size: 15px; line-height: 22px; }
.auth form { display: flex; flex-direction: column; gap: 16px; }
.auth__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth__foot { color: var(--text-secondary); text-align: center; }
.auth__divider { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 12px; }
.auth__divider::before, .auth__divider::after { content: ""; flex: 1; height: 1px; background: var(--border-subtle); }
.auth .dg-btn--block { width: 100%; }
.auth__aside {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 28px;
  padding-block: 48px; padding-left: 40px; padding-right: 40px;
  background: var(--brand-charcoal); color: #E8ECF3; border-left: 1px solid var(--border-subtle);
}
.auth__aside::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 80% at 20% 0%, rgba(57,123,250,0.22), transparent 60%), radial-gradient(90% 70% at 100% 100%, rgba(94,143,78,0.25), transparent 60%); pointer-events: none; }
.auth__quote { position: relative; max-width: 360px; text-align: center; display: flex; flex-direction: column; gap: 8px; }
.auth__quote b { font-size: 18px; line-height: 24px; font-weight: 600; color: #FFFFFF; }
.auth__quote span { color: #AEB6C4; font-size: 14px; }
@media (max-width: 960px) {
  .auth { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth__aside { display: none; }
}

/* the tee sign illustration (pure CSS, real sign proportions 12 × 16 in) */
.sign {
  position: relative; width: min(300px, 70%); aspect-ratio: 3 / 4; max-width: 100%; border-radius: 10px; overflow: hidden;
  background: var(--sign-green); box-shadow: 0 30px 60px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.06);
  display: grid; grid-template-rows: auto 1fr auto; transform: rotate(-3deg);
}
.sign__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; color: var(--sign-text); }
.sign__name { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.85; }
.sign__hole { font-size: 30px; line-height: 30px; font-weight: 800; letter-spacing: -0.02em; }
.sign__hole small { display: block; font-size: 9px; letter-spacing: 0.2em; font-weight: 700; opacity: 0.75; }
.sign__map { position: relative; margin: 0 12px; border-radius: 4px; overflow: hidden;
  background: radial-gradient(40% 30% at 30% 70%, var(--sign-turf-2), transparent 70%), radial-gradient(35% 25% at 70% 30%, var(--sign-turf-2), transparent 70%), var(--sign-turf); }
.sign__fair { position: absolute; left: 38%; top: 6%; width: 26%; height: 88%; border-radius: 50% 50% 40% 40%; background: #8DBB72; transform: rotate(8deg); opacity: 0.9; }
.sign__tree { position: absolute; width: 18%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #4F8A3C, #22472A 70%); box-shadow: 3px 4px 0 rgba(0,0,0,0.18); }
.sign__flight { position: absolute; left: 50%; top: 14%; width: 2px; height: 70%; background: repeating-linear-gradient(to bottom, #FFFFFF 0 6px, transparent 6px 11px); transform: rotate(6deg); transform-origin: top; opacity: 0.9; }
.sign__tee { position: absolute; left: 44%; bottom: 8%; width: 14%; height: 9%; background: #C9C4B8; border-bottom: 3px solid #2F6BE6; }
.sign__basket { position: absolute; left: 51%; top: 9%; width: 13%; aspect-ratio: 1; border-radius: 50%; background: #F2C230; box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 5px rgba(0,0,0,0.25); }
.sign__foot { display: grid; grid-template-columns: 1fr 1px 1fr; align-items: center; margin: 12px; border: 2px solid var(--sign-gold); border-radius: 8px; color: var(--sign-text); }
.sign__foot i { height: 70%; background: var(--sign-gold); }
.sign__stat { padding: 8px 4px; text-align: center; font-variant-numeric: tabular-nums; }
.sign__stat b { display: block; font-size: 22px; line-height: 24px; font-weight: 800; }
.sign__stat span { font-size: 8px; letter-spacing: 0.18em; font-weight: 700; opacity: 0.8; }

/* ---------------- Inline messages (built on the toast styles of the design system) ---------------- */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-lg); border: 1px solid; font-size: 14px; line-height: 20px; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice b { font-weight: 600; }
.notice p + p { margin-top: 2px; }
.notice--error { background: var(--error-bg); border-color: var(--error-border); color: var(--error-text); }
.notice--success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.notice--info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.notice--warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
.notice .dg-btn { margin-top: 8px; }
.notice[hidden] { display: none; }

/* password field: the reveal button sits inside the design-system field */
.pw-wrap { position: relative; }
.pw-wrap .dg-field__input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: var(--radius-full); background: transparent; color: var(--text-secondary); cursor: pointer;
}
.pw-toggle:hover { background: var(--action-ghost-hover); color: var(--text-primary); }
.pw-toggle svg { width: 18px; height: 18px; }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.pw-meter i { height: 4px; border-radius: 2px; background: var(--border-default); }
.pw-meter[data-score="1"] i:nth-child(-n+1) { background: var(--error-solid); }
.pw-meter[data-score="2"] i:nth-child(-n+2) { background: var(--warning-solid, #D97706); }
.pw-meter[data-score="3"] i:nth-child(-n+3) { background: var(--success-solid, #1F9D55); }
.pw-meter[data-score="4"] i { background: var(--success-solid, #1F9D55); }
.pw-rules { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; font-size: 12px; line-height: 16px; color: var(--text-muted); }
.pw-rules li { display: flex; gap: 6px; align-items: center; }
.pw-rules li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); flex: none; }
.pw-rules li.ok { color: var(--success-text); }
.pw-rules li.ok::before { background: var(--success-solid, #1F9D55); }
@media (max-width: 420px) { .pw-rules { grid-template-columns: minmax(0, 1fr); } }

/* success / status panels that replace a form */
.state-panel { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.state-panel__icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; }
.state-panel__icon svg { width: 24px; height: 24px; }
.state-panel__icon.is-success { background: var(--success-bg); color: var(--success-text); }
.state-panel__icon.is-info { background: var(--info-bg); color: var(--info-text); }
.state-panel__icon.is-error { background: var(--error-bg); color: var(--error-text); }
.state-panel__icon.is-warning { background: var(--warning-bg); color: var(--warning-text); }
.state-panel .dg-btn { text-decoration: none; }
.mail-chip { display: inline; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 1px 6px; border-radius: var(--radius-full); background: var(--bg-subtle); border: 1px solid var(--border-subtle); font-family: var(--font-mono); font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }

/* ---------------- Settings layout ---------------- */
.page { flex: 1 0 auto; width: 100%; min-width: 0; max-width: var(--page-max); margin: 0 auto; padding-block: 32px 64px; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.page__head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 28px; }
.page__crumb { font-size: 13px; color: var(--text-secondary); }
.page__crumb a { color: inherit; }
.page__title { font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.015em; }
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: start; }
.settings__nav { position: sticky; top: calc(var(--shell-h) + 24px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; gap: 2px; }
.settings__nav a { padding: 8px 12px; border-radius: var(--radius-md); color: var(--text-secondary); text-decoration: none; font-weight: 500; }
.settings__nav a:hover { background: var(--action-ghost-hover); color: var(--text-primary); }
.settings__nav a[aria-current="true"] { background: var(--action-selected); color: var(--action-selected-text); }
.settings__body { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.panel { background: var(--surface-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius-card, 16px); padding: var(--card-padding-lg, 24px); display: flex; flex-direction: column; gap: 20px; scroll-margin-top: calc(var(--shell-h) + 24px); }
.panel__head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.panel__head h2 { font-size: 17px; line-height: 24px; font-weight: 600; }
.panel__head p { color: var(--text-secondary); margin-top: 2px; max-width: 60ch; }
.panel form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-actions .saved { color: var(--success-text); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.form-actions .saved svg { width: 16px; height: 16px; }
.panel--danger { border-color: var(--error-border); }
.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--text-secondary); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; line-height: 18px; }
.badge.is-success { background: var(--success-bg); color: var(--success-text); }
.badge.is-warning { background: var(--warning-bg); color: var(--warning-text); }
@media (max-width: 860px) {
  .settings { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .settings__nav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .settings__nav a { white-space: nowrap; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
}

/* ---------------- Dialog (built in the page: browsers' confirm() is not used) ---------------- */
.dialog-scrim { position: fixed; inset: 0; z-index: 90; background: var(--overlay-scrim, rgba(10,14,20,0.55)); display: grid; place-items: center; padding: 16px; }
.dialog-scrim[hidden] { display: none; }
.dialog { width: 100%; max-width: 460px; background: var(--surface-overlay); border: 1px solid var(--border-default); border-radius: var(--radius-dialog, 20px); box-shadow: var(--shadow-dialog); padding: var(--dialog-padding, 24px); display: flex; flex-direction: column; gap: 16px; }
.dialog__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dialog__head h2 { font-size: 18px; line-height: 24px; font-weight: 600; }
.dialog__x { width: 32px; height: 32px; border: 0; border-radius: var(--radius-full); background: transparent; color: var(--text-secondary); display: grid; place-items: center; cursor: pointer; flex: none; }
.dialog__x:hover { background: var(--action-ghost-hover); }
.dialog__x svg { width: 18px; height: 18px; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ---------------- Footer ---------------- */
.app-footer { flex: none; border-top: 1px solid var(--border-subtle); background: var(--surface-panel); }
.app-footer__inner { max-width: var(--page-max); margin: 0 auto; padding-block: 18px max(18px, env(safe-area-inset-bottom, 0px)); padding-left: var(--gutter); padding-right: var(--gutter-r); display: flex; gap: 16px; flex-wrap: wrap; align-items: center; justify-content: space-between; color: var(--text-muted); font-size: 13px; }
.app-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.app-footer a { color: var(--text-secondary); text-decoration: none; }
.app-footer a:hover { color: var(--text-primary); text-decoration: underline; }

/* ---------------- Review-only demo state panel (removed for production) ---------------- */
.demo { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 80; }
.demo__btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--radius-full); border: 1px dashed var(--brand-violet); background: var(--surface-overlay); color: var(--text-primary); font: inherit; font-weight: 600; font-size: 13px; box-shadow: var(--shadow-md); cursor: pointer; }
.demo__btn i { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-violet); }
.demo__panel { position: absolute; right: 0; bottom: calc(100% + 8px); width: min(300px, calc(100vw - 32px)); padding: 12px; border-radius: var(--radius-lg); background: var(--surface-overlay); border: 1px solid var(--border-default); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 6px; }
.demo__panel[hidden] { display: none; }
.demo__panel p { font-size: 12px; line-height: 16px; color: var(--text-secondary); margin-bottom: 4px; }
.demo__panel button { text-align: left; padding: 7px 10px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); background: var(--surface-raised); color: var(--text-primary); font: inherit; font-size: 13px; cursor: pointer; }
.demo__panel button:hover { background: var(--surface-hover); }
.demo__panel button[aria-pressed="true"] { border-color: var(--brand-violet); background: var(--brand-violet-subtle); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------------- Toasts ---------------- */
.toasts { position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 85; width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toasts .dg-toast { pointer-events: auto; }
.dg-toast__close { width: 28px; height: 28px; }
.dg-toast__close svg { width: 16px; height: 16px; }
@media (max-width: 560px) { .toasts { bottom: max(64px, env(safe-area-inset-bottom, 0px)); } }

/* ================= My Courses ================= */
.courses__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.courses__head .page__title { margin: 0; }
.courses__head p { color: var(--text-secondary); margin-top: 4px; }
.courses__head .dg-btn { text-decoration: none; }
@media (min-width: 861px) { .courses__head .create-sm { display: none; } }
.courses__bar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.courses__filters { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; border-bottom: 1px solid var(--border-subtle); }
.courses__filters .dg-tabs__list { border-bottom: 0; margin-bottom: -1px; }
.courses .dg-tabs__tab { font-size: 14px; }
.courses .dg-tabs__tab.is-selected { color: var(--text-primary); }
.courses .dg-tabs__tab.is-selected::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; border-radius: 2px; background: var(--action-indicator); }
.courses .dg-tabs__badge { font-size: 12px; line-height: 18px; }
.courses .dg-tabs__tab.is-selected .dg-tabs__badge { background: var(--action-selected); color: var(--action-selected-text); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.courses__tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.courses__tools .dg-search { flex: 1 1 260px; max-width: 420px; }
.dg-field__icon { display: inline-flex; color: var(--text-muted); flex: none; }
.dg-field__icon svg { width: 16px; height: 16px; }
.dg-field__clear { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: var(--radius-full); background: transparent; color: var(--text-secondary); cursor: pointer; flex: none; }
.dg-field__clear[hidden] { display: none; }
.sort-field { position: relative; padding-right: 32px !important; flex: 0 0 auto; }
.sort-field select { appearance: none; -webkit-appearance: none; background: transparent; border: 0; cursor: pointer; padding-right: 4px; color: var(--text-primary); font: inherit; }
.sort-field select option { color: initial; }
.sort-field__chev { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-secondary); pointer-events: none; }
.sort-wrap { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; }
.results-line:empty { display: none; }
.results-line { font-size: 13px; color: var(--text-secondary); min-height: 18px; }

/* status legend */
.legend { border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--surface-panel); }
.legend > summary { cursor: pointer; padding: 10px 14px; font-size: 13px; font-weight: 500; color: var(--text-secondary); list-style: none; display: flex; align-items: center; gap: 8px; }
.legend > summary::-webkit-details-marker { display: none; }
.legend > summary svg { width: 14px; height: 14px; transition: transform 140ms; }
.legend[open] > summary svg { transform: rotate(90deg); }
.legend__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 4px 14px 14px; }
.legend__grid div { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.legend__grid p { font-size: 13px; line-height: 18px; color: var(--text-secondary); }
@media (max-width: 860px) { .legend__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .legend__grid { grid-template-columns: minmax(0, 1fr); } }

/* status badge */
.sbadge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; border: 1px solid transparent; }
.sbadge svg { width: 13px; height: 13px; flex: none; }
.sbadge--draft { background: var(--surface-raised); color: var(--text-secondary); border-color: var(--border-default); }
.sbadge--proof_sent { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }
.sbadge--approved { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.sbadge--ordered { background: var(--brand-violet-subtle); color: var(--brand-violet); border-color: color-mix(in srgb, var(--brand-violet) 30%, transparent); }
.status-dot--draft { background: var(--text-muted); }
.status-dot--proof_sent { background: var(--warning-solid); }
.status-dot--approved { background: var(--success-solid); }
.status-dot--ordered { background: var(--brand-violet); }

/* grid and cards */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.course-grid.is-refreshing .ccard { opacity: 0.55; transition: opacity 120ms; }
.ccard { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--surface-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius-card); overflow: hidden; transition: border-color 120ms, box-shadow 120ms; }
.ccard:hover { border-color: var(--border-default); box-shadow: var(--shadow-card-hover); }
.ccard:focus-within { border-color: var(--border-strong); }
.ccard.is-new { animation: ccard-new 1.6s ease-out; }
@keyframes ccard-new { 0% { box-shadow: 0 0 0 3px var(--focus-ring); } 100% { box-shadow: 0 0 0 0 transparent; } }
.ccard.is-leaving { opacity: 0; transform: scale(0.97); transition: opacity 180ms, transform 180ms; }
.ccard__thumb { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--bg-canvas-surround); border-bottom: 1px solid var(--border-subtle); overflow: hidden; }
.ccard__thumb img { position: absolute; left: 10%; top: 17%; width: 80%; height: 76%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.22)); transition: transform 180ms ease-out; }
.ccard__thumb img.is-land { left: 8%; top: 18%; width: 84%; height: 72%; }
.ccard:hover .ccard__thumb img { transform: translateY(-2px); }
.ccard__thumb .sbadge { position: absolute; left: 10px; top: 10px; box-shadow: var(--shadow-xs); }
.ccard__noprev { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; text-align: center; color: var(--text-muted); font-size: 12px; line-height: 16px; }
.ccard__noprev svg { width: 28px; height: 28px; }
.ccard__body { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 4px; min-width: 0; }
.ccard__name { font-size: 15px; line-height: 20px; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.ccard__name a { color: var(--text-primary); text-decoration: none; }
.ccard__name a:hover { text-decoration: underline; }
.ccard__name a::after { content: ""; position: absolute; inset: 0; z-index: 0; }  /* the whole card opens the course */
.ccard__meta { font-size: 13px; line-height: 18px; color: var(--text-secondary); }
.ccard__detail { font-size: 12px; line-height: 16px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 6px; align-items: flex-start; }
.ccard__detail svg { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.ccard__actions { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 12px 14px; margin-top: auto; }
.ccard__actions .dg-btn { text-decoration: none; }
.ccard__busy { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; background: color-mix(in srgb, var(--surface-panel) 70%, transparent); font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.ccard__busy span { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: var(--radius-full); background: var(--surface-overlay); box-shadow: var(--shadow-sm); }
.ccard__busy .dg-spinner { position: static; margin: 0; width: 14px; height: 14px; }
.more-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--radius-full); border: 1px solid transparent; background: transparent; color: var(--text-secondary); cursor: pointer; }
.more-btn:hover, .more-btn[aria-expanded="true"] { background: var(--action-ghost-hover); color: var(--text-primary); }
.more-btn svg { width: 18px; height: 18px; }
@media (pointer: coarse) { .more-btn { width: 44px; height: 44px; } }

/* skeleton */
.skel { pointer-events: none; }
.skel .ccard__thumb { background: var(--bg-subtle); }
.skel i { display: block; height: 12px; border-radius: 6px; background: var(--bg-subtle); }
.skel .ccard__thumb::after, .skel i::after { content: ""; }
.skel { animation: skel 1.4s ease-in-out infinite; }
@keyframes skel { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } .ccard.is-new { animation: none; } }

/* floating course menu */
.cmenu { position: fixed; z-index: 75; min-width: 220px; padding: 6px; border-radius: var(--radius-menu, 12px); background: var(--surface-overlay); border: 1px solid var(--border-default); box-shadow: var(--shadow-menu); }
.cmenu[hidden] { display: none; }
.cmenu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-menu-item, 8px); background: transparent; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
.cmenu button:hover:not([aria-disabled="true"]), .cmenu button:focus-visible { background: var(--surface-hover); outline: none; }
.cmenu button svg { width: 16px; height: 16px; color: var(--text-secondary); flex: none; }
.cmenu button.is-danger { color: var(--error-text); }
.cmenu button.is-danger svg { color: var(--error-text); }
.cmenu button[aria-disabled="true"] { color: var(--text-disabled); cursor: not-allowed; }
.cmenu button[aria-disabled="true"] svg { color: var(--text-disabled); }
.cmenu small { display: block; padding: 0 10px 6px 36px; font-size: 12px; line-height: 16px; color: var(--text-muted); max-width: 240px; }
.cmenu hr { border: 0; height: 1px; background: var(--border-subtle); margin: 4px 0; }

/* empty / error / no results */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 56px 16px 64px; border: 1px dashed var(--border-default); border-radius: var(--radius-card); background: var(--surface-panel); }
.empty-state h2 { font-size: 20px; line-height: 26px; font-weight: 600; }
.empty-state p { color: var(--text-secondary); max-width: 46ch; }
.empty-state .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.empty-state .actions .dg-btn { text-decoration: none; }
.empty-art { width: 132px; height: 112px; margin-bottom: 4px; }
.empty-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 180px)); gap: 12px; margin-top: 12px; text-align: left; }
.empty-steps div { padding: 12px; border-radius: var(--radius-lg); background: var(--bg-subtle); font-size: 13px; line-height: 18px; color: var(--text-secondary); }
.empty-steps b { display: block; color: var(--text-primary); font-weight: 600; margin-bottom: 2px; }
@media (max-width: 640px) { .empty-steps { grid-template-columns: minmax(0, 1fr); width: 100%; } .empty-state { padding: 40px 16px 48px; } }
.state-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; }
.state-icon svg { width: 24px; height: 24px; }
.more-row { display: flex; justify-content: center; margin-top: 20px; }
@media (max-width: 640px) {
  .courses__head .dg-btn { width: 100%; }
  .courses__tools .dg-search { max-width: none; flex-basis: 100%; }
  .course-grid { grid-template-columns: minmax(0, 1fr); }
}

/* the whole height of a field is tappable, not only the line of text */
.dg-field > .dg-field__input, .pw-wrap > .dg-field__input { align-self: stretch; min-height: 0; }
.state-icon.is-error { background: var(--error-bg); color: var(--error-text); }
.state-icon.is-info { background: var(--info-bg); color: var(--info-text); }
.state-icon.is-warning { background: var(--warning-bg); color: var(--warning-text); }
.state-icon.sbadge--draft { background: var(--bg-subtle); color: var(--text-secondary); }
.state-icon[class*="sbadge--"] { border: 0; padding: 0; }
