:root {
  color-scheme: light;
  --ink: #17232f;
  --muted: #52616f;
  --surface: #ffffff;
  --canvas: #f3f7f6;
  --line: #cbd8d5;
  --brand: #146c63;
  --brand-strong: #0d514b;
  --accent: #bf5b3f;
  --error: #a12b2b;
  --focus: #0c74b8;
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

body { min-width: 320px; }

.entry-shell {
  position: fixed;
  z-index: 2147483000;
  inset: 0;
  overflow: auto;
  background:
    linear-gradient(135deg, rgba(20, 108, 99, 0.08), transparent 42%),
    var(--canvas);
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.entry-shell[hidden] { display: none; }

.entry-shell__frame {
  width: min(100%, 760px);
  margin: 0 auto;
}

.product-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  margin-bottom: 14px;
}

.product-header__logo {
  flex: 0 0 auto;
  border-radius: 8px;
}

.product-header__name,
.product-header__tagline,
.entry-panel__eyebrow,
.engine-status p,
.field-help,
.field-error { margin: 0; }

.product-header__name {
  font-size: 1.15rem;
  font-weight: 700;
}

.product-header__tagline {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.entry-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(18, 44, 42, 0.09);
  padding: clamp(20px, 5vw, 36px);
}

.entry-panel__eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.entry-panel h1 {
  margin: 8px 0 10px;
  font-size: clamp(1.65rem, 6vw, 2.35rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.entry-panel__intro > p:last-child,
.entry-panel--loading > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

form { margin-top: 24px; }

.field-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

label { font-weight: 700; }

output {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

textarea {
  display: block;
  width: 100%;
  min-height: 190px;
  resize: vertical;
  border: 1px solid #849993;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  padding: 14px;
}

textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(12, 116, 184, 0.32);
  outline-offset: 2px;
}

textarea[aria-invalid="true"] { border-color: var(--error); }

.field-help,
.field-error {
  margin-top: 8px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.field-help { color: var(--muted); }
.field-error { color: var(--error); font-weight: 700; }

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 11px 18px;
}

.button:disabled { cursor: wait; opacity: 0.68; }
.button--primary { background: var(--brand); color: #fff; }
.button--primary:hover { background: var(--brand-strong); }
.button--secondary { border-color: var(--brand); background: #fff; color: var(--brand-strong); }
.button--quiet { background: transparent; color: var(--muted); }

.engine-status {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-top: 1px solid #e2e9e7;
  margin-top: 24px;
  padding-top: 18px;
}

.engine-status__indicator {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  margin-top: 4px;
  border: 2px solid #9db0ab;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: entry-spin 0.9s linear infinite;
}

.entry-shell[data-engine-state="ready"] .engine-status__indicator {
  border: 0;
  background: var(--brand);
  animation: none;
}

.entry-shell[data-engine-state="error"] .engine-status__indicator {
  border: 0;
  background: var(--error);
  animation: none;
}

.engine-status__title { font-weight: 700; }
.engine-status__detail { margin-top: 3px !important; color: var(--muted); font-size: 0.88rem; }

.entry-panel--loading {
  min-height: 280px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.entry-panel--loading[hidden] { display: none; }
.entry-panel--loading .engine-status__indicator { width: 24px; height: 24px; }

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

@media (max-width: 520px) {
  .entry-shell { padding-top: max(10px, env(safe-area-inset-top)); }
  .product-header { margin-bottom: 8px; }
  .entry-panel { padding: 20px 16px; }
  .entry-actions { display: grid; }
  .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .engine-status__indicator { animation-duration: 1.8s; }
}
