:root {
  --background: #f6f7f3;
  --surface: #ffffff;
  --text: #17201a;
  --muted: #5c675f;
  --line: #d8ded6;
  --accent: #136f63;
  --accent-strong: #0b4f48;
  --error: #a52424;
  --success: #176b42;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family:
    Arial,
    Helvetica,
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.appShell {
  min-height: 100vh;
  padding: 48px 20px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  gap: 40px;
  max-width: 1120px;
  margin: 0 auto;
  align-items: start;
}

.masthead {
  padding-top: 16px;
}

.brandLogo {
  display: block;
  width: 9.75rem;
  height: auto;
  margin: 0 0 16px;
}

.titleRow {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.betaIcon {
  flex: 0 0 auto;
  width: 6.5rem;
  height: auto;
  margin-bottom: 0.22rem;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 12ch;
  font-size: 3.25rem;
  line-height: 1.02;
}

.mastheadDescription {
  max-width: 33rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.appRemarks {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0;
}

.appRemarks p {
  margin: 0;
}

.connectLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 8px;
  padding: 0 16px;
  color: var(--accent-strong);
  background: #e9f4ef;
  border: 1px solid rgba(19, 111, 99, 0.26);
  border-radius: 6px;
  font-weight: 800;
  text-decoration: none;
}

.connectLink:hover {
  background: #dceee7;
}

.connectionStatus {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-top: 8px;
  padding: 0 14px;
  border-radius: 6px;
  font-weight: 800;
}

.connectionStatus.connected {
  color: var(--success);
  background: #edf8f1;
  border: 1px solid rgba(23, 107, 66, 0.22);
}

.logoutLink {
  margin-left: 12px;
  color: var(--accent-strong);
  font-weight: 800;
}

.searchForm {
  display: grid;
  gap: 20px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(23, 32, 26, 0.08);
}

.lockedPanel h2,
.lockedPanel p {
  margin: 0;
}

.lockedPanel p {
  color: var(--muted);
  line-height: 1.55;
}

.fieldGrid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 16px;
}

.fieldGroup {
  display: grid;
  gap: 8px;
}

label,
legend {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--text);
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 6px;
}

input:focus,
select:focus {
  outline: 3px solid rgba(19, 111, 99, 0.18);
  border-color: var(--accent);
}

.checkboxGroup {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.checkboxGroup label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
}

.checkboxGroup input {
  width: 18px;
  min-height: 18px;
}

button {
  min-height: 48px;
  color: #ffffff;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.errorMessage,
.successMessage {
  margin: 0;
  padding: 12px 14px;
  border-radius: 6px;
  font-weight: 700;
}

.errorMessage {
  color: var(--error);
  background: #fff1f1;
}

.successMessage {
  color: var(--success);
  background: #edf8f1;
}

.progressLine {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 800;
}

.previewPanel {
  display: grid;
  gap: 14px;
  padding-top: 4px;
}

.previewPanel[hidden] {
  display: none;
}

.previewHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.previewHeader h2 {
  margin: 0;
  font-size: 1.15rem;
}

.secondaryButton {
  width: auto;
  min-height: 42px;
  padding: 0 14px;
  color: var(--accent-strong);
  background: #e9f4ef;
  border: 1px solid rgba(19, 111, 99, 0.26);
}

.secondaryButton:hover {
  background: #dceee7;
}

.previewTableWrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.previewTable {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

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

.previewTable th {
  background: #f2f6f1;
  color: var(--text);
  font-weight: 800;
}

.previewTable td {
  color: var(--muted);
}

@media (max-width: 820px) {
  .appShell {
    padding: 28px 16px;
  }

  .workspace,
  .fieldGrid {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: 12ch;
    font-size: 2.6rem;
  }

  .brandLogo {
    width: 7.8rem;
  }

  .titleRow {
    gap: 12px;
  }

  .betaIcon {
    width: 5.5rem;
    margin-bottom: 0.15rem;
  }

  .searchForm {
    padding: 20px;
  }

  .previewHeader {
    align-items: stretch;
    flex-direction: column;
  }

  .secondaryButton {
    width: 100%;
  }
}
