/* =============================================================================
   GeoSchool Studio — dashboard layer
   Builds on the public design tokens (app.css is always loaded first).
   ========================================================================== */

.studiobody {
  background: #f4f2ea;
  padding-bottom: 0;
  font-size: 15px;
}
.studiobody::before { display: none; }

/* --------------------------------- auth ---------------------------------- */
.authpage { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(60% 60% at 20% 0%, #e9f1e6, transparent 70%), #fffdf6; padding: 20px; }
.authwrap { width: min(940px, 100%); display: grid; grid-template-columns: 1fr; gap: 22px; align-items: stretch; }
.authcard {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--sh-lg); padding: 26px 22px; display: grid; gap: 12px; align-content: start;
}
.authtitle { font-size: clamp(1.3rem, 4vw, 1.7rem); margin-top: 8px; }
.authsub { color: var(--muted); font-size: 0.9rem; }
.authfoot { font-size: 0.82rem; color: var(--muted); margin-top: 6px; }
.authcard form { display: grid; gap: 14px; margin-top: 6px; }
.authcard .field__label { font-size: 0.84rem; }
.authart { display: none; border-radius: var(--r-xl); overflow: hidden; background: var(--forest); min-height: 380px; position: relative; }
.authart .scene { width: 100%; height: 100%; position: absolute; inset: 0; }
@media (min-width: 860px) {
  .authwrap { grid-template-columns: 1.05fr 0.95fr; }
  .authart { display: block; }
  .authcard { padding: 34px 32px; }
}

/* --------------------------------- app frame ----------------------------- */
.app { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.app__main { min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 140; width: min(286px, 86vw);
  background: linear-gradient(180deg, #123f31, #0d3125); color: rgba(255, 253, 246, 0.84);
  display: flex; flex-direction: column; transform: translateX(-102%);
  transition: transform 0.24s var(--ease); box-shadow: var(--sh-lg);
}
.sidebar.is-open { transform: none; }
.sidebar__brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 10px; border-bottom: 1px solid rgba(255, 253, 246, 0.12); }
.sidebar__brand .brand__name { color: #fff; font-size: 0.98rem; }
.sidebar__brand .brand__name em { color: var(--gold); }
.sidebar__brand .brand__sub { color: rgba(255, 253, 246, 0.55); }
.sidebar__close { background: rgba(255, 253, 246, 0.1); border-color: rgba(255, 253, 246, 0.2); color: #fff; }
.snav { padding: 10px 8px; overflow-y: auto; flex: 1; display: grid; gap: 12px; align-content: start; }
.snav__label { font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 253, 246, 0.45); margin: 0 0 4px 10px; }
.snav__item {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 10px;
  color: rgba(255, 253, 246, 0.84); font-size: 0.86rem; font-weight: 600; min-height: 40px;
}
.snav__item .ic { color: rgba(247, 191, 101, 0.8); }
.snav__item:hover { background: rgba(255, 253, 246, 0.08); color: #fff; }
.snav__item.is-active { background: rgba(247, 191, 101, 0.16); color: #fff; box-shadow: inset 2px 0 0 var(--gold); }
.snav__item b { margin-left: auto; background: var(--gold); color: #4a3313; border-radius: 999px; font-size: 0.66rem; padding: 1px 7px; }
.sidebar__foot { padding: 10px; border-top: 1px solid rgba(255, 253, 246, 0.12); display: grid; gap: 2px; }
.sidebar__link { display: flex; align-items: center; gap: 8px; color: rgba(255, 253, 246, 0.72); font-size: 0.8rem; padding: 8px 10px; border-radius: 8px; min-height: 38px; }
.sidebar__link:hover { background: rgba(255, 253, 246, 0.08); color: #fff; }

.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; min-height: 60px;
  background: rgba(255, 253, 246, 0.94); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { min-width: 0; }
.topbar__eyebrow { display: block; font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.topbar__page { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar__search { display: none; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.topbar__search .ic { color: var(--muted); }
.topbar__search input { border: 0; background: transparent; font-size: 0.84rem; width: 150px; outline: none; }
.topbar__bell { position: relative; }
.topbar__bell b {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; border-radius: 999px;
  background: #b4472f; color: #fff; font-size: 0.62rem; display: grid; place-items: center; padding: 0 4px;
}
.topbar__user { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--forest), var(--nature-dark)); color: #fff; font-weight: 800; font-size: 0.76rem;
}
.topbar__meta { display: none; flex-direction: column; line-height: 1.15; }
.topbar__meta strong { font-size: 0.8rem; }
.topbar__meta small { font-size: 0.68rem; color: var(--muted); }

.view { padding: 14px; min-width: 0; flex: 1; }
.view__loading { display: grid; place-items: center; gap: 8px; padding: 40px 0; color: var(--muted); }

@media (min-width: 1024px) {
  .app { grid-template-columns: 260px minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100vh; transform: none; width: auto; }
  .sidebar__close, .topbar__burger { display: none; }
  .topbar__search { display: flex; }
  .topbar__meta { display: flex; }
  .view { padding: 22px 24px 40px; }
  .sbnav { display: none; }
}

/* mobile bottom bar */
.sbnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 253, 246, 0.96); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sbnav__item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px; font-size: 0.64rem; font-weight: 700; color: var(--muted); min-height: 52px; justify-content: center; }
.sbnav__ico { display: grid; place-items: center; width: 40px; height: 26px; border-radius: 999px; }
.sbnav__item.is-active { color: var(--forest); }
.sbnav__item.is-active .sbnav__ico { background: var(--forest); color: var(--warm); }
@media (min-width: 1024px) { .sbnav { display: none; } }
.studiobody { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 1024px) { .studiobody { padding-bottom: 0; } }

/* drawer (all modules on mobile) */
.sdrawer { position: fixed; inset: 0; z-index: 150; background: rgba(14, 51, 39, 0.45); display: flex; align-items: flex-end; }
.sdrawer[hidden] { display: none; }
.sdrawer__panel {
  width: 100%; max-height: 88vh; overflow-y: auto; background: var(--warm);
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 14px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 12px;
}
.sdrawer__head { display: flex; align-items: center; justify-content: space-between; }
.sdrawer__grid { display: grid; gap: 14px; }
.sdrawer__grid .morelink { padding: 10px 12px; }

/* --------------------------------- primitives ---------------------------- */
.gridcards { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .gridcards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .gridcards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.statcard {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px;
  display: grid; gap: 4px; min-width: 0; box-shadow: var(--sh-xs);
}
.statcard__ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--tint); color: var(--forest); margin-bottom: 4px; }
.statcard b { font-family: var(--font-display); font-size: 1.6rem; line-height: 1; color: var(--forest); }
.statcard span { font-size: 0.74rem; color: var(--muted); }
.statcard small { font-size: 0.68rem; color: var(--muted-2); }

.panelbox { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-xs); padding: 14px; min-width: 0; }
.panelbox h2 { font-size: 1.02rem; margin-bottom: 8px; }
.panelbox h3 { font-size: 0.92rem; margin-bottom: 6px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar__spacer { flex: 1 1 auto; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  font-size: 0.78rem; font-weight: 600; cursor: pointer; min-height: 38px; text-decoration: none;
}
.chip:hover { border-color: var(--nature); color: var(--forest); }
.chip.is-active { background: var(--forest); border-color: var(--forest); color: #fff; }

.statuschip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap;
  background: #eef1ea; color: #4a5a50; border: 1px solid transparent;
}
.statuschip--draft { background: #f0f0ea; color: #5c6b60; }
.statuschip--scheduled { background: #e8f5f8; color: #2f6b7a; }
.statuschip--active { background: #fdf1da; color: #7a5216; }
.statuschip--completed { background: #e9f3e6; color: #3c6b46; }
.statuschip--archived { background: #ecebe6; color: #77726a; }
.statuschip--submitted { background: #e8f5f8; color: #2f6b7a; }
.statuschip--under_review { background: #fff3d9; color: #7a5216; }
.statuschip--revision_requested { background: #fdece5; color: #8a4b1f; }
.statuschip--approved { background: #e9f3e6; color: #3c6b46; }
.statuschip--published { background: #dff0d8; color: #2f5a35; }
.statuschip--not_started { background: #f1f1ec; color: #77726a; }
.statuschip--private, .statuschip--internal { background: #f1eff8; color: #544a72; }
.statuschip--public { background: #e6f1e8; color: #2f5a35; }
.statuschip--complete { background: #e9f3e6; color: #3c6b46; }
.statuschip--pending { background: #fdf1da; color: #7a5216; }
.statuschip--partial { background: #e8f5f8; color: #2f6b7a; }

.tablewrap { width: 100%; overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.86rem; min-width: 520px; }
table.tbl th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 10px 12px; background: #fbfaf3; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: #fcfbf5; }
table.tbl .num { text-align: right; white-space: nowrap; }

.cardlist { display: grid; gap: 10px; }
.listrow {
  display: flex; gap: 10px; align-items: center; padding: 12px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0;
}
.listrow__main { min-width: 0; flex: 1; }
.listrow__title { font-weight: 700; font-size: 0.9rem; overflow-wrap: anywhere; }
.listrow__sub { font-size: 0.76rem; color: var(--muted); }

.kv { display: grid; gap: 8px; }
.kv__row { display: grid; grid-template-columns: 120px 1fr; gap: 10px; font-size: 0.85rem; }
.kv__row dt { color: var(--muted); }
.kv__row dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .kv__row { grid-template-columns: 1fr; gap: 2px; } }

/* forms */
.formgrid { display: grid; gap: 12px; }
@media (min-width: 700px) { .formgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .formgrid .full { grid-column: 1 / -1; } }
.sfield { display: grid; gap: 5px; min-width: 0; }
.sfield > span { font-size: 0.78rem; font-weight: 700; color: var(--ink); }
.sfield small { font-size: 0.72rem; color: var(--muted); }
.sfield input, .sfield textarea, .sfield select {
  width: 100%; min-width: 0; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: #fff; font-family: var(--font-body);
  font-size: 16px; color: var(--ink); line-height: 1.45;
}
.sfield textarea { min-height: 84px; resize: vertical; }
.sfield input:focus, .sfield textarea:focus, .sfield select:focus { outline: none; border-color: var(--nature-dark); box-shadow: 0 0 0 4px rgba(112,173,117,.18); }
.sfield.is-invalid input, .sfield.is-invalid textarea, .sfield.is-invalid select { border-color: #c0503a; }
.checkbox { display: flex; gap: 8px; align-items: flex-start; font-size: 0.84rem; }
.checkbox input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--forest); }
.formactions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: end center; }
.modal[hidden] { display: none; }
.modal__scrim { position: absolute; inset: 0; background: rgba(14, 51, 39, 0.5); backdrop-filter: blur(2px); }
.modal__card {
  position: relative; width: 100%; max-height: 92vh; background: #fff;
  border-radius: var(--r-xl) var(--r-xl) 0 0; display: flex; flex-direction: column;
  box-shadow: var(--sh-lg);
}
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.modal__head h2 { font-size: 1rem; }
.modal__body { padding: 14px; overflow-y: auto; min-height: 0; }
.modal__foot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; background: #fcfbf5; }
.modal__foot .btn { flex: 1 1 auto; }
@media (min-width: 760px) {
  .modal { place-items: center; }
  .modal__card { width: min(760px, 94vw); max-height: 88vh; border-radius: var(--r-xl); }
  .modal__foot .btn { flex: 0 0 auto; }
}
.modal__foot:empty { display: none; }

/* mission board */
.board { display: grid; gap: 12px; }
.board__head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.board__progress { height: 14px; border-radius: 8px; background: #e7e9e2; overflow: hidden; }
.board__progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--nature), var(--forest)); transition: width 0.5s var(--ease); }
.board__grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .board__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.board__cell { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.board__cell b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--forest); line-height: 1; }
.board__cell span { font-size: 0.74rem; color: var(--muted); }
.boardrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.stale { font-size: 0.74rem; color: #8a4b1f; background: #fdf3ea; border: 1px dashed #e8c39a; border-radius: 10px; padding: 8px 10px; }

/* intake */
.intake { display: grid; gap: 10px; }
.intake__section { border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; overflow: hidden; }
.intake__head { display: flex; align-items: center; gap: 8px; padding: 11px 12px; background: #fbfaf3; border-bottom: 1px solid var(--line); }
.intake__head strong { font-size: 0.86rem; }
.intake__head .statuschip { margin-left: auto; }
.intake__items { display: grid; }
.intake__item { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 0.84rem; }
.intake__item:last-child { border-bottom: 0; }
.intake__item .grow { flex: 1; min-width: 0; }
.intake__item small { display: block; color: var(--muted); font-size: 0.74rem; }

/* upload */
.upload { display: grid; gap: 8px; }
.upload__drop {
  border: 2px dashed var(--line-strong); border-radius: var(--r-md); padding: 16px;
  text-align: center; color: var(--muted); font-size: 0.84rem; background: #fcfbf5;
}
.upload__drop.is-over { border-color: var(--nature); background: var(--tint); }
.upload__bar { height: 8px; border-radius: 4px; background: #e7e9e2; overflow: hidden; }
.upload__bar i { display: block; height: 100%; width: 0; background: var(--nature); transition: width 0.2s linear; }
.thumbs { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.thumb { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.thumb img { width: 100%; height: 96px; object-fit: cover; display: block; background: var(--tint); }
.thumb__body { padding: 8px; display: grid; gap: 2px; }
.thumb__body strong { font-size: 0.76rem; overflow-wrap: anywhere; }
.thumb__body small { font-size: 0.68rem; color: var(--muted); }

/* misc */
.sectiontitle { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; }
.sectiontitle h2 { font-size: 1rem; }
.hint { font-size: 0.78rem; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; letter-spacing: 0.08em; }
.codebox { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #f6f6ef; border: 1px dashed var(--line-strong); border-radius: 12px; padding: 10px 12px; }
.codebox b { font-family: ui-monospace, monospace; font-size: 1.05rem; letter-spacing: 0.14em; }
.tabbar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.tabbar::-webkit-scrollbar { height: 4px; }
.tab { flex: 0 0 auto; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); min-height: 38px; display: inline-flex; align-items: center; }
.tab.is-active { background: var(--forest); color: #fff; border-color: var(--forest); }
.sparkle { position: relative; }
.sparkle::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(247,191,101,.35); }
@media print {
  .sidebar, .topbar, .sbnav, .sdrawer, .modal { display: none !important; }
  .studiobody { background: #fff; }
  .view { padding: 0; }
}

/* =============================================================================
   Registration dashboard + check-in scanner
   ========================================================================== */

.scanner { display: grid; gap: 10px; }
.scanner__stage {
  position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r-lg);
  overflow: hidden; background: #0b2a20; display: grid; place-items: center;
}
.scanner__stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner__frame {
  position: absolute; inset: 12% 16%; border: 3px solid rgba(247, 191, 101, 0.9);
  border-radius: 18px; box-shadow: 0 0 0 9999px rgba(11, 42, 32, 0.35); pointer-events: none;
}
.scanner__hint {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  background: rgba(11, 42, 32, 0.7); color: #fff; font-size: 0.74rem; padding: 5px 12px; border-radius: 999px; white-space: nowrap;
}
.scanstate { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #fbfaf3; }
.scanstate--ok { background: #eaf6e7; border-color: rgba(78, 143, 94, 0.5); }
.scanstate--warn { background: #fdf5e6; border-color: rgba(233, 165, 66, 0.55); }
.scanstate--err { background: #fdeee9; border-color: rgba(180, 71, 47, 0.45); }
.scanstate__ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(23, 76, 59, 0.1); color: var(--forest); flex: 0 0 auto; }
.scanstate--ok .scanstate__ico { background: rgba(78, 143, 94, 0.2); }
.scanstate--warn .scanstate__ico { background: rgba(233, 165, 66, 0.25); }
.scanstate--err .scanstate__ico { background: rgba(180, 71, 47, 0.16); color: #8a3a25; }
.scanstate strong { font-size: 0.9rem; display: block; }
.scanstate p { font-size: 0.8rem; color: var(--muted); margin: 2px 0 0; }
.scanner__manual { border-top: 1px dashed var(--line); padding-top: 10px; }
.stage__qrbox { display: grid; place-items: center; margin: 6px 0; }
.stage__qrbox img { background: #fff; padding: 8px; border-radius: 12px; width: min(30vw, 320px); height: auto; }
.stage__inner--qr { align-items: center; text-align: center; }
@media (max-width: 700px) { .scanner__frame { inset: 16% 12%; } }
