/* Obra em Corte Studio: the signed-in app, on top of base.css (the guide's tokens and components).
   Calm pages: white cards on a light sky, big touch targets, one yellow pill per screen. The ground shows only at
   the edges: the topbar's grass and topsoil, and the borehole log that follows a video through the render. */

:root {
  --soil-deep: #a34c21;
  --app-bg: var(--sky-pale);
  --card-line: rgba(35, 23, 15, 0.12);
  --muted: #6c5b4f;
  --tap: 48px;
}

body.app { background: var(--app-bg); min-height: 100vh; }
[hidden] { display: none !important; }

/* ---------- topbar (the members area's) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px var(--gutter);
  background: var(--sky); border-bottom: 5px solid var(--grass); box-shadow: 0 5px 0 var(--topsoil);
}
.topbar__brand { font-size: var(--step-1); text-decoration: none; white-space: nowrap; }
.brand__studio { font-size: 0.7em; color: #fff; -webkit-text-stroke: 0; text-shadow: none; font-weight: 800; letter-spacing: 0.02em; }
.topbar__right { display: flex; align-items: center; gap: 8px; }
.topbar__nav { display: none; gap: 16px; }
.topbar__nav a { color: #fff; font-weight: 800; text-decoration: none; }
.topbar__nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 3px; }
.credit-pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; border-radius: 999px;
  background: #fff; color: var(--ink); font-weight: 900; text-decoration: none; border: 2px solid var(--ink); font-size: 0.95rem;
  white-space: nowrap;
}
.credit-pill small { font-weight: 800; color: var(--muted); }
.menu-btn { min-width: var(--tap); min-height: 40px; border-radius: 10px; border: 2px solid rgba(255,255,255,.7); background: transparent;
            color: #fff; font: inherit; font-weight: 900; cursor: pointer; }
.drawer { position: fixed; inset: 0; z-index: 40; background: rgba(35, 23, 15, 0.45); }
.drawer__panel { position: absolute; top: 0; right: 0; width: min(300px, 86vw); height: 100%; background: #fff; padding: 18px;
                 display: flex; flex-direction: column; gap: 6px; box-shadow: -6px 0 0 var(--topsoil); }
.drawer__panel a, .drawer__panel button.linkish { display: flex; align-items: center; min-height: var(--tap); font-weight: 800; color: var(--ink);
                         text-decoration: none; border-bottom: 1px solid var(--card-line); font-size: var(--step-0); }
@media (min-width: 820px) {
  .topbar__nav { display: flex; }
  .menu-btn { display: none; }
}

/* ---------- page frame ---------- */
.page { width: min(100% - 2 * var(--gutter), 960px); margin: 22px auto 120px; }
.page--narrow { width: min(100% - 2 * var(--gutter), 640px); }
.page__head { margin-bottom: 16px; }
.page__head h1 { font-size: clamp(1.7rem, 6vw, 2.3rem); margin: 0 0 4px; }
.page__head p { color: var(--ink-soft); margin: 0; }
.card { background: #fff; border: 2px solid var(--card-line); border-radius: var(--radius-panel); padding: clamp(16px, 4vw, 24px); }
.card + .card, .stack > * + * { margin-top: 14px; }
.card h2 { font-size: var(--step-2); margin-bottom: 0.4em; }
.card h3 { margin-bottom: 0.3em; }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row--between { justify-content: space-between; }
.btn--wide { width: 100%; }
.btn--quiet { background: #fff; border: 2px solid var(--ink); box-shadow: none; }
.btn--quiet:hover { background: var(--sky-pale); }
.btn--danger { background: #fff; color: var(--danger); border: 2px solid var(--danger); box-shadow: none; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--sky-deep); font-weight: 800; cursor: pointer;
           text-decoration: underline; text-underline-offset: 0.18em; min-height: 40px; }
.note { margin: 12px 0; }

/* ---------- forms ---------- */
.field { display: block; margin: 0 0 14px; }
.field > span, .label { display: block; font-weight: 800; margin-bottom: 6px; }
.field small, .hint { display: block; color: var(--muted); font-size: var(--step--1); margin-top: 4px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], textarea, select {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; font-size: 1.05rem; color: var(--ink);
  border: 2px solid rgba(35, 23, 15, 0.55); border-radius: 10px; background: #fff;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
.check { display: flex; gap: 12px; align-items: flex-start; min-height: var(--tap); padding: 6px 0; font-weight: 700; cursor: pointer; }
.check input { width: 24px; height: 24px; margin-top: 1px; flex: none; accent-color: var(--grass-deep); }
.err { color: var(--danger); font-weight: 800; margin: 8px 0; }
.ok-text { color: var(--ok); font-weight: 800; margin: 8px 0; }
.counter { float: right; font-weight: 700; color: var(--muted); font-size: var(--step--1); }
.counter.is-over { color: var(--danger); }

/* choice cards (radio-like) */
.choices { display: grid; gap: 10px; }
.choice {
  position: relative; display: block; width: 100%; text-align: left; background: #fff; color: var(--ink);
  border: 2px solid var(--card-line); border-radius: 14px; padding: 14px 16px; min-height: 64px; font: inherit; cursor: pointer;
}
.choice:hover { border-color: rgba(35, 23, 15, 0.45); }
.choice[aria-pressed="true"], .choice[aria-checked="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--caption); }
.choice strong { display: block; font-size: var(--step-1); font-weight: 900; }
.choice span { display: block; color: var(--ink-soft); }
.choice[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.lock { display: inline-block; margin-top: 6px; font-size: var(--step--1); font-weight: 800; color: var(--soil); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px;
  border: 2px solid var(--card-line); background: #fff; color: var(--ink); font: inherit; font-weight: 800; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip--static { cursor: default; min-height: 30px; padding: 2px 10px; font-size: var(--step--1); }
.chip--anchor { background: #e8f5e1; border-color: #9ccc86; }
.chip--missing { background: #fbe1de; border-color: var(--danger); color: var(--danger); }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--card-line); cursor: pointer; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.swatch-custom { position: relative; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px var(--card-line); }
.swatch-custom input { position: absolute; inset: -8px; width: 56px; height: 56px; border: 0; padding: 0; cursor: pointer; }

/* status chips */
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 900; font-size: var(--step--1); border: 2px solid var(--ink); }
.status--queued { background: var(--sky-pale); }
.status--running { background: var(--caption); }
.status--done { background: #d7f0cc; }
.status--failed { background: #fbe1de; color: var(--danger); border-color: var(--danger); }
.status--canceled { background: #eee; }

/* ---------- grids of covers (gallery, my videos) ---------- */
.covers { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .covers { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .covers { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile {
  display: flex; flex-direction: column; width: 100%; height: 100%; background: #fff; border: 3px solid var(--ink);
  border-radius: var(--radius-sign); overflow: hidden; color: var(--ink); text-decoration: none; text-align: left;
  box-shadow: 0 4px 0 rgba(35, 23, 15, 0.3); font: inherit; padding: 0; cursor: pointer;
}
.tile:hover { color: var(--ink); }
.tile:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(35, 23, 15, 0.3); }
.tile__frame { position: relative; display: block; aspect-ratio: 9 / 13; background: var(--rock); overflow: hidden; }
.tile__frame img { width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.tile__views { position: absolute; left: 8px; bottom: 6px; font-size: clamp(1.2rem, 5vw, 1.6rem); }
.tile__views.caption-type { color: var(--caption); }
.tile__body { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px 10px; flex: 1; }
.tile__title { font-weight: 900; line-height: 1.2; }
.tile__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--step--1); color: var(--ink-soft); font-weight: 700; }
.cat { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--gravel-light); font-weight: 800; }

/* ---------- the wizard ---------- */
.steps-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 0 0 6px; }
.steps-bar span { height: 8px; border-radius: 4px; background: rgba(35, 23, 15, 0.14); }
.steps-bar span.is-done:nth-child(1), .steps-bar span.is-on:nth-child(1) { background: var(--sky-deep); }
.steps-bar span.is-done:nth-child(2), .steps-bar span.is-on:nth-child(2) { background: var(--grass); }
.steps-bar span.is-done:nth-child(3), .steps-bar span.is-on:nth-child(3) { background: var(--topsoil); }
.steps-bar span.is-done:nth-child(4), .steps-bar span.is-on:nth-child(4) { background: var(--soil); }
.steps-bar span.is-done:nth-child(5), .steps-bar span.is-on:nth-child(5) { background: var(--rock); }
.step-label { font-weight: 900; color: var(--soil); margin: 0 0 12px; }
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; gap: 10px; align-items: center;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 3px solid var(--ink);
}
.actionbar .btn { flex: 1; }
.actionbar .btn--quiet { flex: 0 0 auto; }
.actionbar__note { flex: 1 1 100%; margin: 0; font-size: var(--step--1); font-weight: 800; color: var(--danger); }
@media (min-width: 820px) {
  .actionbar { position: sticky; bottom: 0; border: 2px solid var(--card-line); border-radius: 14px; margin-top: 18px; flex-wrap: nowrap; }
  .actionbar .btn { flex: 0 0 auto; margin-left: auto; }
  .actionbar__note { flex: 1; }
}

.segment { border: 2px solid var(--card-line); border-radius: 14px; padding: 12px; background: #fff; }
.segment + .segment { margin-top: 12px; }
.segment__head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.segment__n { font-weight: 900; color: var(--soil); }
.segment textarea { min-height: 84px; }
.segment__anchors { margin-top: 8px; }
.segment__anchors .label { font-size: var(--step--1); color: var(--muted); font-weight: 800; margin: 0 0 4px; }
.hintline { display: flex; gap: 8px; align-items: baseline; margin-top: 8px; font-weight: 800; font-size: var(--step--1); }
.hintline--ok { color: var(--ok); }
.hintline--short, .hintline--long { color: var(--soil-deep); }
.hintline--edge { color: var(--muted); }
.hintline details { font-weight: 700; color: var(--ink-soft); }

.voice { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.play { width: var(--tap); height: var(--tap); border-radius: 50%; border: 2px solid var(--ink); background: var(--caption); font-size: 1.1rem;
        font-weight: 900; cursor: pointer; color: var(--ink); }
.play[aria-pressed="true"] { background: var(--ink); color: #fff; }
.styles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .styles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.style-card { padding: 0; overflow: hidden; border-radius: 12px; }
.style-card canvas { display: block; width: 100%; aspect-ratio: 9 / 16; background: var(--rock); }
.style-card span { display: block; text-align: center; font-weight: 900; padding: 6px 4px; }
.looks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .looks { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.look-card { padding: 0; overflow: hidden; border-radius: 12px; }
.look-card img { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: center 70%; }
.look-card span { display: block; text-align: center; font-weight: 900; padding: 6px 4px; }

.preview-916 { position: relative; width: min(100%, 300px); aspect-ratio: 9 / 16; margin: 0 auto; border-radius: 18px; overflow: hidden;
               background: var(--rock); border: 6px solid var(--ink); }
.preview-916 canvas { width: 100%; height: 100%; display: block; }

.summary { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.summary dt { font-weight: 800; color: var(--muted); }
.summary dd { margin: 0; font-weight: 800; }
.price { font-size: var(--step-3); font-weight: 900; line-height: 1.1; margin: 6px 0; }

/* the sheet (template details, packs) */
dialog.sheet { border: 0; padding: 0; width: min(100%, 560px); max-height: 92vh; border-radius: 18px 18px 0 0; margin: auto auto 0;
               background: #fff; color: var(--ink); }
dialog.sheet::backdrop { background: rgba(35, 23, 15, 0.5); }
@media (min-width: 640px) { dialog.sheet { border-radius: 18px; margin: auto; } }
.sheet__body { padding: 18px; overflow-y: auto; max-height: calc(92vh - 76px); }
.sheet__foot { display: flex; gap: 10px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 2px solid var(--card-line); }
.sheet__foot .btn { flex: 1; }
.sheet__cover { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: start; }
.sheet__cover img { border-radius: 10px; border: 3px solid var(--ink); }
.narration { background: var(--sky-pale); border-radius: 12px; padding: 12px 14px; max-height: 38vh; overflow-y: auto; }
.narration p { margin: 0 0 0.6em; }
.close-x { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff;
           font-size: 1.4rem; font-weight: 900; cursor: pointer; }

/* ---------- the borehole log: a video through the render ---------- */
.bore { list-style: none; margin: 8px 0 0; padding: 0 0 0 24px; border-left: 10px solid var(--gravel-light); position: relative; }
.bore li { position: relative; padding: 2px 0 18px 8px; color: var(--muted); }
.bore li::before { content: ""; position: absolute; left: -37px; top: 4px; width: 20px; height: 20px; border-radius: 50%;
                   background: #fff; border: 3px solid var(--gravel); }
.bore__name { display: block; font-weight: 900; font-size: var(--step-1); line-height: 1.2; }
.bore__detail { display: block; font-size: var(--step--1); font-weight: 700; }
.bore li.is-done { color: var(--ink); }
.bore li.is-done::before { background: var(--layer, var(--grass)); border-color: var(--ink); }
.bore li.is-on { color: var(--ink); }
.bore li.is-on::before { background: var(--caption); border-color: var(--ink); animation: dig 1.2s ease-in-out infinite; }
.bore li:nth-child(1) { --layer: var(--sky); }
.bore li:nth-child(2) { --layer: var(--grass); }
.bore li:nth-child(3) { --layer: var(--topsoil); }
.bore li:nth-child(4) { --layer: var(--soil); }
.bore li:nth-child(5) { --layer: var(--soil-light); }
.bore li:nth-child(6) { --layer: var(--water-deep); }
@keyframes dig { 50% { transform: scale(1.25); } }
.meter { height: 10px; border-radius: 5px; background: var(--gravel-light); overflow: hidden; margin-top: 6px; max-width: 260px; }
.meter span { display: block; height: 100%; background: var(--soil); width: 0; transition: width 0.4s ease; }

.player { width: min(100%, 360px); margin: 0 auto; border-radius: 16px; overflow: hidden; border: 6px solid var(--ink); background: #000; }
.player video { width: 100%; aspect-ratio: 9 / 16; display: block; }
.copybox { border: 2px solid var(--card-line); border-radius: 12px; padding: 12px; }
.copybox + .copybox { margin-top: 10px; }
.copybox__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.copybox__text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.copy { min-height: 40px; padding: 4px 14px; border-radius: 999px; border: 2px solid var(--ink); background: var(--caption);
        font: inherit; font-weight: 900; cursor: pointer; }

/* ---------- toasts ---------- */
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
         background: var(--ink); color: #fff; font-weight: 800; padding: 10px 16px; border-radius: 12px; max-width: calc(100% - 32px);
         box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); }
.toast--error { background: var(--danger); }

/* ---------- tables (admin, history) ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--card-line); }
.list li:last-child { border-bottom: 0; }
.delta { font-weight: 900; white-space: nowrap; }
.delta--plus { color: var(--ok); }
.delta--minus { color: var(--danger); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: #fff; border: 2px solid var(--card-line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: var(--step-3); line-height: 1.1; }
.stat span { color: var(--muted); font-weight: 800; font-size: var(--step--1); }

/* ---------- login + small pages on the ground ---------- */
body.ground-page { min-height: 100vh;
  background: linear-gradient(var(--sky) 0 34%, var(--grass) 34% 37%, var(--topsoil) 37% 40%, var(--soil) 40%); }
.login { width: min(100% - 2 * var(--gutter), 460px); margin: 0 auto; padding: 40px 0 64px; }
.login .brand { display: block; width: fit-content; margin: 0 auto 26px; text-decoration: none; font-size: var(--step-2); }
.login__panel { padding: clamp(20px, 5vw, 30px); }
.login__title { font-size: var(--step-3); }
.devlink { word-break: break-all; background: var(--sky-pale); border-radius: 10px; padding: 10px 12px; font-weight: 700; }

.empty { text-align: center; padding: 26px 16px; }
.empty h2 { font-size: var(--step-2); }
.skeleton { background: linear-gradient(90deg, #eef4fb 25%, #f7fafd 50%, #eef4fb 75%); background-size: 200% 100%;
            animation: shimmer 1.4s infinite; border-radius: 10px; min-height: 120px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* coming-soon templates in the gallery */
.tile--soon { cursor: default; box-shadow: none; border-style: dashed; }
.tile--soon .tile__frame img { filter: grayscale(0.55) brightness(0.85); }
.tile--soon:active { transform: none; }
.tile__soon { position: absolute; top: 8px; right: 8px; background: var(--caption); color: var(--ink); font-weight: 900;
              font-size: var(--step--1); padding: 2px 10px; border-radius: 999px; border: 2px solid var(--ink); }

/* the brand form and its end-card preview (video.py end_card_sprite, roughly) */
.brandgrid { display: grid; gap: 18px; }
@media (min-width: 720px) { .brandgrid { grid-template-columns: 1.2fr 0.8fr; align-items: start; } }
.logo-preview { width: 56px; height: 56px; border-radius: 50%; object-fit: contain; background: #fff; border: 2px solid var(--card-line); }
.endcard { position: relative; width: min(100%, 260px); aspect-ratio: 9 / 16; margin: 0 auto; border-radius: 16px; overflow: hidden;
           background: var(--rock); border: 5px solid var(--ink); display: grid; place-items: center; }
.endcard__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(5px) brightness(0.55); transform: scale(1.06); }
.endcard__card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
                 background: rgba(8, 12, 26, 0.84); color: #fff; border-radius: 14px; padding: 14px 12px; width: 84%; margin-top: -18%; }
.endcard__logo { width: 64px; height: 64px; border-radius: 50%; background: #fff; display: grid; place-items: center; overflow: hidden; margin-bottom: 4px; }
.endcard__logo img { width: 78%; height: 78%; object-fit: contain; }
.endcard__name { font-weight: 900; font-size: 1.15rem; line-height: 1.1; }
.endcard__cta { font-weight: 900; font-size: 0.95rem; }
.endcard__contact { font-weight: 900; font-size: 0.85rem; }
.endcard__handle { font-weight: 800; font-size: 0.8rem; color: #d2dceb; }
.endcard__badge { position: absolute; left: 10px; top: 24px; background: rgba(10, 14, 28, 0.75); color: #fff; font-weight: 900;
                  font-size: 0.7rem; padding: 4px 10px; border-radius: 999px; }

.chips--scroll { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 2px 2px 8px; margin: 0 -2px;
                 scrollbar-width: none; }
.chips--scroll::-webkit-scrollbar { display: none; }
.chips--scroll .chip { flex: none; }
@media (min-width: 900px) { .chips--scroll { flex-wrap: wrap; overflow: visible; } }
.card > .row, .card > .btn + .row { margin-top: 12px; }
.segment textarea { overflow: hidden; }
.login__legal { text-align: center; margin-top: 14px; color: #fff; }
.login__legal a { color: #fff; }
