:root {
  color-scheme: light;
  --ink: #172326;
  --muted: #536569;
  --line: #d8e0de;
  --paper: #f7faf8;
  --white: #ffffff;
  --teal: #0f6f78;
  --teal-dark: #094c54;
  --coral: #e56b50;
  --sun: #f4b860;
  --good: #236445;
  --shadow: 0 18px 45px rgba(16, 35, 38, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 10px 14px;
  color: var(--white);
  background: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 14px max(22px, calc((100vw - 1240px) / 2));
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand img {
  width: 188px;
  height: auto;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 800;
}

.profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.profile-badge span,
.profile-badge strong,
.profile-badge small {
  display: block;
}

.profile-badge strong {
  max-width: 190px;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-badge small {
  color: var(--muted);
  font-size: 0.74rem;
}

.profile-sign-out {
  padding: 4px 0;
  color: var(--teal-dark);
  background: transparent;
  border: 0;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.app-nav a {
  text-decoration: none;
}

.app-nav a:hover,
.app-nav a:focus-visible {
  color: var(--teal-dark);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  width: min(1240px, calc(100% - 44px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 77px);
  place-items: center;
  padding: 32px 20px;
}

.auth-card {
  width: min(100%, 520px);
  padding: 26px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 2.2rem;
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.auth-form label {
  margin-bottom: 0;
}

.auth-code-form {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.recaptcha-container {
  min-height: 0;
  margin-top: 14px;
}

.auth-status {
  margin: 16px 0 0;
  color: var(--teal-dark);
  font-weight: 850;
}

.auth-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.workspace {
  min-width: 0;
}

.workspace-copy {
  max-width: 820px;
  margin-bottom: 22px;
}

.entry-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  padding: 6px;
  background: #e8f3f0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.entry-tab {
  flex: 1 1 180px;
  min-height: 44px;
  padding: 0 14px;
  color: var(--teal-dark);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 900;
  cursor: pointer;
}

.entry-tab:hover,
.entry-tab:focus-visible {
  background: #d7ebe5;
}

.entry-tab.is-active {
  color: var(--white);
  background: var(--teal);
}

.entry-tab-copy {
  margin: 0 0 18px;
  color: var(--muted);
  font-weight: 750;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.trust-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  color: var(--teal-dark);
  background: #e8f3f0;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 850;
}

.section-kicker {
  margin: 0 0 10px;
  color: var(--coral);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 14px;
  font-size: 3rem;
  line-height: 1.03;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.22rem;
  line-height: 1.18;
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
  line-height: 1.2;
}

.workspace-copy p,
.panel-heading p,
.pipeline-step p,
.order-summary p,
small {
  color: var(--muted);
}

.order-form {
  display: grid;
  gap: 18px;
}

.form-panel,
.order-summary {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(16, 35, 38, 0.06);
}

.form-panel {
  padding: 22px;
}

.panel-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 42px;
  height: 32px;
  color: var(--teal-dark);
  background: #dff0ec;
  border-radius: 8px;
  font-weight: 900;
}

.compact-pill {
  width: auto;
  min-width: 42px;
  margin-bottom: 10px;
  padding: 0 12px;
}

.route-pill {
  width: auto;
  padding: 0 12px;
}

.route-panel {
  background: linear-gradient(180deg, #ffffff 0%, #f5fbfa 100%);
}

.access-panel,
.admin-panel {
  margin-bottom: 18px;
}

.workspace-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  background: #e8f3f0;
  border-color: #b9d8d2;
}

.workspace-context p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.access-panel {
  background: #fffaf2;
  border-color: #ecd6ad;
}

.access-panel.is-pending {
  background: #f5fbfa;
  border-color: #b9d8d2;
}

.access-request-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) auto;
  gap: 12px;
  align-items: end;
}

.access-request-form label,
.access-request-form span {
  display: block;
}

.access-status {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.approval-waiting {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  color: var(--teal-dark);
  background: #e8f3f0;
  border: 1px solid #b9d8d2;
  border-radius: 8px;
}

.approval-waiting strong,
.approval-waiting p {
  display: block;
}

.approval-waiting strong {
  font-size: 1.05rem;
}

.approval-waiting p {
  margin: 4px 0 12px;
  color: var(--muted);
}

.approval-waiting-spinner {
  width: 24px;
  height: 24px;
  margin-top: 2px;
  border: 3px solid #b9d8d2;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: approval-spin 1s linear infinite;
}

@keyframes approval-spin {
  to {
    transform: rotate(360deg);
  }
}

.admin-panel {
  background: #f5fbfa;
  border-color: #b9d8d2;
}

.admin-panel-head,
.admin-request,
.admin-request-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-panel-head {
  justify-content: space-between;
}

.admin-request-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.admin-request {
  justify-content: space-between;
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-request strong,
.admin-request span,
.admin-request small {
  display: block;
}

.admin-request span,
.admin-request small {
  color: var(--muted);
}

.admin-request-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.request-state {
  color: var(--teal-dark) !important;
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.compact-button {
  min-height: 40px;
  padding: 0 14px;
}

.text-button {
  padding: 4px;
  color: var(--teal-dark);
  background: transparent;
  border: 0;
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.choice-card {
  position: relative;
  display: flex;
  gap: 12px;
  min-height: 96px;
  margin: 0;
  padding: 14px;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.choice-card:has(input:checked) {
  border-color: rgba(15, 111, 120, 0.54);
  background: #edf8f5;
  box-shadow: 0 10px 20px rgba(15, 111, 120, 0.08);
}

.choice-card input {
  width: 18px;
  min-width: 18px;
  min-height: 18px;
  margin-top: 4px;
}

.choice-card strong,
.choice-card small {
  display: block;
}

.choice-card small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.upload-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 170px;
  padding: 22px;
  text-align: center;
  background: #f1f7f5;
  border: 2px dashed #b7c8c4;
  border-radius: 8px;
  cursor: pointer;
}

.upload-zone:focus-within,
.upload-zone:hover {
  border-color: var(--teal);
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  color: var(--white);
  background: var(--teal);
  border-radius: 50%;
  font-size: 1.6rem;
  font-weight: 700;
}

.upload-main {
  display: block;
  font-weight: 900;
}

.upload-sub {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
}

.upload-note {
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
}

.consent-line {
  margin: 10px 0 0;
}

.photo-preview {
  margin: 16px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.photo-preview.is-empty {
  display: none;
}

.photo-preview img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #edf4f2;
}

.photo-preview figcaption {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  background: var(--white);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--ink);
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfdfc;
  border: 1px solid #c7d3d0;
  border-radius: 8px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(15, 111, 120, 0.14);
}

.checkbox-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.checkbox-line input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 3px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  font-weight: 900;
  text-decoration: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button.is-disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.48;
}

.button.is-busy {
  gap: 10px;
}

.button.is-busy::before,
.preview-placeholder.is-loading::before,
.model-stage.is-loading::before {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: spin 0.8s linear infinite;
}

.model-stage.is-loading::before {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  color: var(--teal);
  animation-name: spin-centered;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes spin-centered {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.button-primary {
  color: var(--white);
  background: var(--teal);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--teal-dark);
}

.button-primary:disabled:hover,
.button-primary:disabled:focus-visible {
  background: var(--teal);
}

.button-secondary {
  color: var(--teal-dark);
  background: #e8f3f0;
}

.button-secondary:hover,
.button-secondary:focus-visible {
  background: #d7ebe5;
}

.button-whatsapp {
  width: 100%;
  color: var(--white);
  background: var(--good);
}

.button-whatsapp:hover,
.button-whatsapp:focus-visible {
  background: #184b33;
}

.stage-controls {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.stage-action {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  background: #f7fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stage-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--white);
  background: var(--teal);
  border-radius: 50%;
  font-weight: 900;
}

.stage-action h3 {
  margin-bottom: 4px;
}

.stage-action p {
  color: var(--muted);
}

.stage-action .button + .button {
  margin-left: 8px;
}

.stage-status {
  margin: 10px 0 0;
  font-size: 0.92rem;
  font-weight: 800;
}

.button-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.concept-preview {
  display: grid;
  gap: 0;
  margin: 0;
  overflow: hidden;
  background: #f1f7f5;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.concept-preview img {
  display: block;
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  background: #edf4f2;
}

.concept-preview.is-empty img,
.concept-preview.is-empty figcaption {
  display: none;
}

.preview-placeholder {
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.preview-placeholder.is-loading {
  gap: 14px;
  color: var(--teal);
}

.preview-placeholder strong,
.preview-placeholder span {
  display: block;
}

.preview-placeholder strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.concept-preview:not(.is-empty) .preview-placeholder {
  display: none;
}

.concept-preview figcaption {
  padding: 11px 14px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  background: var(--white);
}

.saved-previews {
  overflow: hidden;
  background: #f7fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.saved-model-picker {
  background: linear-gradient(180deg, #ffffff 0%, #f1f8f6 100%);
  border-color: rgba(15, 111, 120, 0.28);
  box-shadow: 0 16px 34px rgba(15, 111, 120, 0.1);
}

.saved-model-picker .model-preview-head {
  background: #ffffff;
}

.saved-model-picker .saved-preview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-panel.saved-previews {
  padding: 0;
}

.details-panel {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

body[data-entry-mode="model"] .details-panel {
  background: #fbfdfc;
  box-shadow: none;
}

body[data-entry-mode="model"] .details-panel .step-pill {
  color: var(--muted);
  background: #edf4f2;
}

.saved-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.saved-preview-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.saved-preview-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #edf4f2;
  border-radius: 6px;
}

.saved-preview-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.saved-preview-card .card-actions {
  display: grid;
  gap: 8px;
}

.saved-model-grid .saved-preview-card img {
  aspect-ratio: 4 / 3;
}

.model-preview {
  overflow: hidden;
  background: #f1f7f5;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.model-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.model-preview-head p {
  margin: 0;
  color: var(--muted);
}

.model-stage {
  position: relative;
  min-height: 390px;
}

model-viewer {
  display: block;
  width: 100%;
  height: 460px;
  background: radial-gradient(circle at 50% 20%, #ffffff 0, #eef5f3 56%, #e2ece9 100%);
}

.model-preview.is-empty model-viewer {
  display: none;
}

.model-preview:not(.is-empty) .preview-placeholder {
  display: none;
}

.model-dialog {
  width: min(1040px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.model-dialog::backdrop {
  background: rgba(16, 35, 38, 0.54);
}

.model-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.model-dialog-head h2 {
  margin: 0;
}

.model-dialog model-viewer {
  height: min(78vh, 760px);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.pipeline-step {
  min-height: 170px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-dot {
  display: inline-flex;
  width: 12px;
  height: 12px;
  margin-bottom: 18px;
  background: #bac8c6;
  border-radius: 50%;
}

.pipeline-step.is-running {
  border-color: rgba(15, 111, 120, 0.5);
  background: #f3faf8;
}

.pipeline-step.is-running .status-dot {
  background: var(--sun);
}

.pipeline-step.is-complete {
  border-color: rgba(35, 100, 69, 0.45);
}

.pipeline-step.is-complete .status-dot {
  background: var(--good);
}

.order-summary {
  position: sticky;
  top: 100px;
  align-self: start;
  min-width: 0;
  padding: 22px;
}

.summary-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.summary-row {
  display: grid;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.summary-row dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
}

.summary-row dd {
  min-width: 0;
  margin: 0;
  font-weight: 800;
  line-height: 1.32;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.summary-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.payload-preview {
  max-height: 340px;
  margin: 18px 0 0;
  overflow: auto;
  padding: 14px;
  color: #dff0ec;
  background: #172326;
  border-radius: 8px;
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.payload-preview:empty {
  display: none;
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .order-summary {
    position: static;
  }

  .pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand img {
    width: 158px;
  }

  .app-nav {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .profile-badge {
    width: 100%;
    justify-content: space-between;
    padding: 10px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .app-shell {
    width: min(100% - 28px, 1240px);
    padding-top: 24px;
  }

  h1 {
    font-size: 2.1rem;
  }

  .field-grid,
  .pipeline,
  .choice-grid,
  .access-request-form {
    grid-template-columns: 1fr;
  }

  .form-panel,
  .order-summary {
    padding: 18px;
  }

  .stage-action {
    grid-template-columns: 1fr;
  }

  .stage-action .button + .button {
    margin-top: 8px;
    margin-left: 0;
  }

  .model-preview-head,
  .model-dialog-head,
  .admin-panel-head,
  .admin-request,
  .workspace-context {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-request-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button-cluster {
    justify-content: stretch;
  }

  .saved-preview-grid {
    grid-template-columns: 1fr;
  }

  .saved-model-picker .saved-preview-grid {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }
}
