/* App demo layer. Tokens come from ../styles.css ("Jobsite"). */
.app-body { min-height: 100vh; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.demo-banner {
  position: sticky; top: 0; z-index: 30;
  background: var(--ink); color: var(--bg);
  font: 600 .8rem/1.3 var(--font-body); letter-spacing: .02em;
  padding: 7px var(--gutter); text-align: center;
  border-bottom: 3px solid var(--accent);
}
@media (prefers-color-scheme: dark) { .demo-banner { background: #0E1012; color: var(--ink); } }

.app-header { border-bottom: 1px solid var(--rule); background: var(--bg); }
.app-header-in { max-width: 1120px; margin: 0 auto; padding: 10px var(--gutter); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.app-header .brand { font-size: 1.05rem; }
.who { display: flex; flex-direction: column; line-height: 1.2; margin-left: auto; text-align: right; min-width: 0; }
.role-chip { font: 700 .8rem/1.2 var(--font-body); letter-spacing: .06em; text-transform: uppercase; }
.who .meta { font-size: .78rem; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .86rem; }
.btn-block { width: 100%; }
@media (max-width: 420px) {
  .brand-text { display: none; }
}

.app-shell { max-width: 1120px; margin: 0 auto; display: block; }
.app-view { max-width: 720px; margin: 0 auto; padding: 24px var(--gutter) 40px; outline: none; }
.has-tabs .app-view { padding-bottom: 104px; }
@media (min-width: 900px) {
  .app-shell { display: grid; grid-template-columns: 200px 1fr; gap: 32px; padding: 0 var(--gutter); }
  .app-shell .app-view { margin: 0; padding: 32px 0 56px; }
  .has-tabs .app-view { padding-bottom: 56px; }
}
@media (min-width: 900px) {
  body:not(.has-tabs) .app-shell { display: block; }
  body:not(.has-tabs) .app-shell .app-view { margin: 0 auto; padding: 40px var(--gutter) 56px; }
}

/* Tabs: bottom bar on phones, left rail on desktop */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border-top: 1px solid var(--rule-strong);
  padding: 4px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
  color: var(--steel); text-decoration: none; font-size: .72rem; font-weight: 600; border-top: 2px solid transparent;
}
.tabs a .ico { width: 22px; height: 22px; }
.tabs a[aria-current="page"] { color: var(--ink); border-top-color: var(--accent); }
@media (min-width: 900px) {
  .tabs { position: sticky; top: 52px; align-self: start; display: flex; flex-direction: column; gap: 2px; border: 0; background: none; padding: 32px 0 0; }
  .tabs a { flex-direction: row; gap: 10px; font-size: .95rem; padding: 10px 12px; border-top: 0; border-left: 3px solid transparent; }
  .tabs a:hover { background: var(--panel); color: var(--ink); }
  .tabs a[aria-current="page"] { border-left-color: var(--accent); background: var(--panel); }
}

/* Content */
.app-view h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); margin: 4px 0 8px; outline: none; }
.app-view h2 { font-size: 1.15rem; margin: 0; }
.sub { color: var(--steel); margin-bottom: 18px; }
.loc { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--steel); margin: 0 0 4px; }
.meta { display: block; color: var(--steel); font-size: .86rem; line-height: 1.45; }
.opt { font-weight: 400; color: var(--steel); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; margin-bottom: 12px; padding: 4px 0; }
.back .ico { width: 18px; height: 18px; }
.back:hover span { text-decoration: underline; }
.grow { flex: 1; min-width: 0; display: block; }
.grow b { display: block; }
.num { font-variant-numeric: tabular-nums; }

.note { font-size: .9rem; color: var(--ink); background: var(--panel); border-left: 3px solid var(--rule-strong); padding: 10px 12px; margin: 0 0 16px; border-radius: 0 var(--radius) var(--radius) 0; display: block; }
.note .ico { width: 18px; height: 18px; margin-right: 2px; vertical-align: -4px; }
.note.warn { background: var(--no-bg); border-left-color: var(--no); }
.note.okbox { background: var(--ok-bg); border-left-color: var(--ok); }
.err { color: var(--no); font-weight: 600; font-size: .92rem; margin: 0 0 12px; }
.empty { color: var(--steel); border: 1px dashed var(--rule-strong); padding: 16px; border-radius: var(--radius); font-size: .92rem; }

.role-pick { display: grid; gap: 10px; margin-bottom: 18px; }
.pick {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--rule-strong); border-radius: var(--radius);
  padding: 16px; font: inherit;
}
.pick:hover { border-color: var(--ink); }
.pick .ico { color: var(--steel); }
.pick-body { flex: 1; min-width: 0; }
.pick-body b { display: block; font-family: var(--font-head); font-size: 1.2rem; }
.pick-body span { display: block; font-size: .88rem; color: var(--steel); }

.form-stack { display: grid; gap: 14px; margin-bottom: 16px; }
.app-view .field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.app-view .field input, .app-view .field select, .app-view .field textarea, .composer input {
  width: 100%; min-height: 46px; padding: 10px 12px; font: 400 1rem var(--font-body); color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--rule-strong); border-radius: var(--radius);
}
.app-view .field textarea { min-height: 100px; resize: vertical; }
.app-view .field input:focus, .app-view .field select:focus, .app-view .field textarea:focus, .composer input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
.search { margin-bottom: 12px; }

.vault { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 4px 14px 12px; margin: 0 0 14px; min-width: 0; }
.vault legend { font: 700 .8rem var(--font-body); letter-spacing: .08em; text-transform: uppercase; padding: 0 6px; color: var(--steel); }
.doc-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.doc-row > .ico { color: var(--steel); margin-top: 2px; }
.doc-row.check { cursor: pointer; }
.doc-row.check input { width: 20px; height: 20px; margin: 2px 2px 0; accent-color: var(--accent-fill); flex: 0 0 auto; }
.doc-row label { display: block; margin-bottom: 2px; }
.req-flag { font-size: .74rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--steel); margin-left: 6px; }
.req-flag.is-req { color: var(--accent-text); }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.file-input { font: .86rem var(--font-body); color: var(--steel); max-width: 100%; }
.file-input::file-selector-button { font: 600 .86rem var(--font-body); background: var(--ink); color: var(--bg); border: 0; border-radius: var(--radius); padding: 8px 12px; margin-right: 10px; cursor: pointer; }
.vault-note { margin-top: 10px; }

.plan-pick { border: 0; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.plan-opt { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1.5px solid var(--rule-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.plan-opt:has(input:checked) { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.plan-opt input { width: 18px; height: 18px; accent-color: var(--accent-fill); }
.plan-price { font: 700 1.2rem var(--font-head); white-space: nowrap; }

.summary { margin: 0 0 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.summary div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
.summary div:last-child { border-bottom: 0; }
.summary dt { color: var(--steel); font-size: .9rem; flex: 0 0 auto; }
.summary dd { margin: 0; font-weight: 600; text-align: right; font-size: .95rem; }
.summary dd .ico { width: 16px; height: 16px; vertical-align: -3px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0 8px; }
.stat { background: var(--surface); border: 1px solid var(--rule); border-top: 3px solid var(--ink); padding: 12px 14px; border-radius: var(--radius); }
.stat b { display: block; font: 700 1.9rem/1 var(--font-head); margin-bottom: 4px; }
.stat span { font-size: .82rem; color: var(--steel); }

.section-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 24px 0 10px; }
.section-h a { font-size: .9rem; font-weight: 600; }

.list { list-style: none; margin: 0 0 12px; padding: 0; }
.item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit;
  padding: 14px; margin-bottom: 8px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none;
}
a.item:hover { border-color: var(--ink); color: var(--ink); }
.item.static { cursor: default; }
.locked-item { cursor: pointer; background: var(--panel); border-style: dashed; color: var(--steel); }
.locked-item b { color: var(--ink); }
.locked-item:hover { border-color: var(--steel); }

.card { display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card b { display: block; margin-bottom: 2px; }
.card.locked { display: flex; gap: 12px; align-items: flex-start; border-style: dashed; background: var(--panel); }
.card.locked .ico { color: var(--steel); }
.card.unlocked { border-left: 3px solid var(--ok); }
.excl { margin: 10px 0 0; font-size: .88rem; font-weight: 600; }
.excl .ico { width: 18px; height: 18px; vertical-align: -4px; }
.perm { margin: 8px 0 0; }
.perm dt { font-weight: 600; margin-top: 8px; }
.perm dd { margin: 2px 0 0; color: var(--steel); font-size: .92rem; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.seg { display: flex; flex-wrap: wrap; border: 1.5px solid var(--ink); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.seg button { flex: 1 1 auto; background: var(--surface); color: var(--ink); border: 0; border-right: 1px solid var(--rule-strong); padding: 9px 10px; font: 600 .88rem var(--font-body); cursor: pointer; min-height: 40px; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.profile-head h1 { margin: 0; font-size: clamp(1.5rem, 5vw, 2rem); }
.mono { flex: 0 0 auto; width: 56px; height: 56px; display: grid; place-items: center; background: var(--ink); color: var(--bg); font: 700 1.2rem var(--font-head); border-radius: 2px; border-bottom: 3px solid var(--accent); }

.stack-btns { display: grid; gap: 10px; margin-top: 8px; }
.app-view .btn-block + .btn-block, .app-view .btn-block + .meta { margin-top: 10px; }
.app-view .btn-block { margin-bottom: 4px; }

.meter { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; font-size: .92rem; }
.bar { height: 6px; background: var(--panel); margin: 8px 0 4px; }
.bar span { display: block; height: 100%; background: var(--ink); }

.msgs { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.msgs li { max-width: 85%; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); }
.msgs li.out { justify-self: end; background: var(--panel); }
.msgs li.sys { max-width: none; border-style: dashed; }
.msgs time { margin-top: 4px; font-size: .75rem; }
.composer { display: flex; gap: 8px; }
.composer input { flex: 1; min-width: 0; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 88px; z-index: 40;
  width: min(92vw, 460px); background: var(--ink); color: var(--bg); padding: 12px 14px;
  border-radius: var(--radius); border-left: 4px solid var(--accent); font-size: .92rem;
}
@media (min-width: 900px) { .toast { bottom: 24px; } }
@media (prefers-color-scheme: dark) { .toast { background: #0E1012; color: var(--ink); border: 1px solid var(--rule-strong); border-left: 4px solid var(--accent); } }

.dlg { border: 1px solid var(--rule-strong); border-top: 4px solid var(--ink); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 22px; max-width: min(92vw, 420px); }
.dlg::backdrop { background: rgba(20, 22, 24, .55); }
.dlg h2 { font-size: 1.4rem; }

/* ---------- Motion (app.js adds classes; everything is in the DOM immediately) ---------- */
@keyframes gca-view { from { opacity: 0; transform: translateY(8px); } }
@keyframes gca-row { from { opacity: 0; transform: translateY(10px); } }
@keyframes gca-draw { from { stroke-dashoffset: 1.05; } }
@keyframes gca-toast-in { from { opacity: 0; transform: translate(-50%, 14px); } }
@keyframes gca-toast-out { to { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes gca-swap { from { opacity: 0; transform: translateX(-4px); } }

.app-view.enter { animation: gca-view .22s cubic-bezier(.2, .7, .2, 1); }
.app-view.enter > .item, .app-view.enter > .card,
.app-view.enter :is(.list > li, #gcRes > .item, .pick, .plan-opt, .stat, .msgs > li, .doc-row) {
  animation: gca-row .26s cubic-bezier(.2, .7, .2, 1) backwards;
  animation-delay: calc(60ms + var(--i, 0) * 40ms);
}

/* stroke-draw for status icons (paths carry pathLength="1") */
.ico.draw :is(path, rect, circle) { stroke-dasharray: 1; animation: gca-draw .5s cubic-bezier(.2, .7, .2, 1) backwards .12s; }
.ico.draw :is(path, rect, circle) + :is(path, rect, circle) { animation-delay: .32s; }

/* toasts slide in and out */
.toast { display: flex; gap: 10px; align-items: flex-start; }
.toast > .ico { width: 20px; height: 20px; margin-top: 1px; color: var(--accent); }
.toast-ok > .ico { color: #8FC79B; }
.toast.in { animation: gca-toast-in .24s cubic-bezier(.2, .7, .2, 1); }
.toast.out { animation: gca-toast-out .2s ease forwards; }

/* the 2-hour exclusive window depletes in real time */
.xbar { height: 3px; background: var(--rule); margin: 10px 0 2px; overflow: hidden; }
.xbar span { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transition-property: transform; transition-timing-function: linear; }
.note.warn + .xbar { margin: -8px 0 16px; }

/* license vault status: checking -> received / missing */
.lic-state { display: flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 600; margin-top: 6px; }
.lic-state:empty { display: none; }
.lic-state .ico { width: 18px; height: 18px; }
.lic-state span { animation: gca-swap .22s cubic-bezier(.2, .7, .2, 1); }
.lic-state.is-ok { color: var(--ok); }
.lic-state.is-no { color: var(--no); }
.lic-state.is-wait { color: var(--steel); }

/* active tab indicator slides between tabs */
.tabs.has-ind a[aria-current="page"] { border-top-color: transparent; }
.tab-ind { position: absolute; left: 0; top: -1px; height: 2px; background: var(--accent); pointer-events: none; will-change: transform; }
.tab-ind.move { transition: transform .26s cubic-bezier(.2, .7, .2, 1); }
@media (min-width: 900px) {
  .tabs { position: sticky; }
  .tabs.has-ind a[aria-current="page"] { border-left-color: transparent; }
  .tab-ind { top: 0; width: 3px; height: auto; }
}

/* buttons and rows: press feedback, hover shift */
.pick, .item, .plan-opt { transition: border-color .15s ease, transform .12s ease, background-color .15s ease; }
.pick:active, a.item:active, .plan-opt:active { transform: scale(.995); }
