:root {
  --bg: #eff7f9;
  --bg-strong: #d9eef4;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-soft: #f7fbfc;
  --surface-strong: #ffffff;
  --text: #0f3440;
  --muted: #58717a;
  --line: #d3e5eb;
  --line-strong: #b1d6df;
  --brand: #0f7f95;
  --brand-strong: #065f73;
  --brand-soft: rgba(15, 127, 149, 0.08);
  --accent: #f59b23;
  --accent-strong: #dc7f0b;
  --ok: #e6f6ee;
  --shadow: 0 24px 70px rgba(12, 70, 84, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Aptos", "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(165, 214, 227, 0.46), transparent 34%),
    radial-gradient(circle at top right, rgba(245, 155, 35, 0.18), transparent 22%),
    linear-gradient(180deg, #fbfeff 0%, var(--bg) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.page-shell {
  max-width: 1520px;
  margin: 0 auto;
  padding: 28px 22px 72px;
}

.hero,
.panel {
  background: var(--surface);
  border: 1px solid rgba(177, 214, 223, 0.7);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 20px;
  margin-bottom: 26px;
  padding: 34px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -35% auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 155, 35, 0.22), transparent 62%);
  pointer-events: none;
}

.hero-brand,
.panel-head--stack,
.section-body,
.group,
.sheet-tabs,
.form-stack {
  display: grid;
  gap: 10px;
}

.hero-brand {
  justify-items: start;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-mark {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  color: var(--brand-strong);
  background: rgba(165, 214, 227, 0.24);
  border: 1px solid rgba(15, 127, 149, 0.12);
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
}

.hero-copy {
  display: grid;
  gap: 12px;
  max-width: 84ch;
}

h1 {
  font-size: clamp(2.3rem, 4.6vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 1.85rem);
}

h3 {
  font-size: 1.08rem;
}

.lede,
.panel-copy,
.group-copy,
.muted-note,
.field-label {
  color: var(--muted);
  line-height: 1.55;
  align-items: center;
  vertical-align: middle;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-pills span,
.chip,
.sheet-tab {
  border-radius: 999px;
}

.hero-pills span {
  padding: 10px 14px;
  color: var(--brand-strong);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(177, 214, 223, 0.9);
  font-weight: 600;
}

.flash-message {
  padding: 16px 18px;
  color: #21563d;
  background: var(--ok);
  border: 1px solid rgba(72, 156, 108, 0.2);
  border-radius: var(--radius-md);
  font-weight: 600;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(250px, 280px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel {
  padding: 24px;
}

.sheet-nav {
  position: sticky;
  top: 18px;
}

.sheet-tabs {
  gap: 12px;
}

.sheet-tab {
  display: block;
  width: 100%;
  padding: 14px 16px;
  color: var(--text);
  text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 248, 250, 0.96));
  border: 1px solid var(--line);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.sheet-tab:hover {
  transform: translateX(3px);
  border-color: rgba(15, 127, 149, 0.28);
  box-shadow: 0 10px 24px rgba(12, 70, 84, 0.08);
}

.sheet-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  border-color: transparent;
  box-shadow: 0 14px 28px rgba(6, 95, 115, 0.22);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.sheet-panel {
  min-height: 72vh;
}

.submit-panel {
  margin-top: 24px;
}

.submit-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.submit-copy {
  display: grid;
  gap: 8px;
  max-width: 68ch;
}

.section-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.upload-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px 22px;
  background: linear-gradient(180deg, rgba(247, 251, 252, 0.98), rgba(255, 255, 255, 1));
  border: 1px solid rgba(211, 229, 235, 0.92);
  border-radius: var(--radius-lg);
}

.upload-copy {
  display: grid;
  gap: 8px;
}

.upload-dropzone {
  display: grid;
  gap: 6px;
  align-items: start;
  padding: 18px 20px;
  background: #fff;
  border: 1px dashed rgba(15, 127, 149, 0.36);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.upload-dropzone:hover,
.upload-dropzone:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(15, 127, 149, 0.1);
  transform: translateY(-1px);
}

.upload-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.upload-dropzone-title {
  color: var(--brand-strong);
  font-weight: 700;
}

.upload-dropzone-copy,
.upload-feedback,
.field-error {
  color: var(--muted);
  line-height: 1.45;
}

.upload-feedback {
  padding: 12px 14px;
  background: rgba(165, 214, 227, 0.14);
  border: 1px solid rgba(15, 127, 149, 0.16);
  border-radius: 14px;
}

.upload-feedback.is-error {
  color: #8a2e2e;
  background: rgba(179, 59, 59, 0.08);
  border-color: rgba(179, 59, 59, 0.16);
}

.section-body {
  padding: 8px;
}

.group {
  gap: 16px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(247, 251, 252, 0.98), rgba(255, 255, 255, 1));
  border: 1px solid rgba(211, 229, 235, 0.92);
  border-radius: var(--radius-lg);
}

.group-title {
  color: var(--brand-strong);
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
  grid-column: span 4;
  align-content: start;
  align-items: center;
}

.field.is-hidden {
  display: none;
}

.field--checkbox,
.field--date,
.field--number {
  grid-column: span 3;
  align-items: center;
}

.fields-grid > .field--new-row {
  grid-column: 1 / span 4;
}

.fields-grid > .field--new-row.field--checkbox,
.fields-grid > .field--new-row.field--date,
.fields-grid > .field--new-row.field--number {
  grid-column: 1 / span 3;
}

.fields-grid > .field--new-row.field--textarea,
.fields-grid > .field--new-row.field--checkbox-group,
.fields-grid > .field--new-row.field--readonly {
  grid-column: 1 / -1;
}

.field--textarea,
.field--checkbox-group,
.field--readonly {
  grid-column: 1 / -1;
}

.field-label {
  display: flex;
  align-items: flex-end;
  min-height: 2.8rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.field-label.field-label--required::after {
  content: " *";
  color: #b54708;
}

.field :is(input, select, textarea),
.static-value {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 13px 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.field :is(input, select, textarea):focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(15, 127, 149, 0.12);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field--toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 0;
  padding: 13px 15px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.field--toggle .field-label {
  color: var(--text);
  font-weight: 600;
  line-height: 1.45;
  min-height: 0;
  align-items: center;
}

.field :is(input[type="checkbox"], .chip input) {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--brand);
}

.static-wrap {
  display: grid;
}

.static-value {
  display: flex;
  align-items: flex-start;
  white-space: normal;
  background: var(--surface-soft);
  line-height: 1.45;
}

.checkbox-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.chip {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 100%;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.chip span {
  line-height: 1.45;
}

.repeater,
.repeater-rows {
  display: grid;
  gap: 14px;
}

.repeater-row {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(165, 214, 227, 0.08), rgba(255, 255, 255, 0));
  border: 1px dashed rgba(15, 127, 149, 0.26);
  border-radius: var(--radius-md);
}

.row-head,
.group-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.data-table {
  width: 100%;
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th,
.data-table td {
  padding: 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  position: sticky;
  top: 0;
  color: var(--brand-strong);
  background: rgba(165, 214, 227, 0.16);
  font-size: 0.94rem;
}

.data-table td .field,
.data-table td .field--toggle {
  min-width: 180px;
  grid-column: auto;
}

.data-table td .field {
  align-content: start;
}

.data-table td .field-label {
  min-height: 2.4rem;
}

.data-table td .static-value {
  min-width: 220px;
}

.field.is-invalid :is(input, select, textarea),
.field.is-invalid .static-value,
.field.is-invalid.field--toggle,
.field.is-invalid .chip {
  border-color: rgba(179, 59, 59, 0.7);
  box-shadow: 0 0 0 4px rgba(179, 59, 59, 0.08);
}

.field-error {
  font-size: 0.88rem;
}

.primary,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 20px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, opacity 140ms ease;
}

.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 14px 34px rgba(245, 155, 35, 0.28);
}

.secondary {
  color: var(--brand-strong);
  background: #fff;
  border: 1px solid rgba(15, 127, 149, 0.18);
}

.primary:hover,
.secondary:hover {
  transform: translateY(-1px);
}

.primary:disabled,
.secondary:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.status {
  padding: 15px 16px;
  color: var(--brand-strong);
  background: rgba(165, 214, 227, 0.18);
  border: 1px solid rgba(15, 127, 149, 0.16);
  border-radius: var(--radius-md);
}

.status.is-error {
  color: #8a2e2e;
  background: rgba(179, 59, 59, 0.08);
  border-color: rgba(179, 59, 59, 0.16);
}

@media (max-width: 1040px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .sheet-nav {
    position: static;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding-inline: 14px;
  }

  .hero,
  .panel {
    padding: 18px;
  }

  .panel-heading-row,
  .panel-head,
  .submit-panel-row {
    flex-direction: column;
  }

  .primary,
  .secondary {
    width: 100%;
  }

  .fields-grid {
    grid-template-columns: 1fr;
    align-items: center;
  }

  .field,
  .field--checkbox,
  .field--date,
  .field--number,
  .field--textarea,
  .field--checkbox-group,
  .field--readonly {
    grid-column: 1 / -1;
  }

  .fields-grid > .field--new-row {
    grid-column-start: 1;
  }

  .checkbox-wrap {
    grid-template-columns: 1fr;
  }
}


/* ─ Google sign-in gate (added for Cloud Run staging deployment) ─ */
/* The HTML `hidden` attribute lives in the UA stylesheet as plain
   `display: none` (no !important). Without this guard our flex/block
   rules below would override it and show the element unconditionally. */
.auth-gate[hidden], .page-shell[hidden] { display: none !important; }

.auth-gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  padding: 24px;
  z-index: 100;
}
.auth-gate-card {
  max-width: 380px;
  width: 100%;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}
.auth-gate-logo { height: 40px; margin-bottom: 16px; }
.auth-gate h1 { font-size: 18px; font-weight: 600; margin: 0 0 6px; color: #0f172a; }
.auth-gate-lede { font-size: 13px; color: #64748b; margin: 0 0 18px; }
#authGateBtn { display: flex; justify-content: center; }
.auth-gate-error {
  margin-top: 12px;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #b91c1c;
  font-size: 12px;
}

