:root {
  color-scheme: dark;
  --bg: #202326;
  --panel: #2b2f33;
  --panel-2: #32373d;
  --panel-3: #262a2e;
  --line: #40464d;
  --text: #edf0f2;
  --muted: #aeb7c2;
  --soft: #808a95;
  --accent: #70d6b7;
  --accent-2: #8ab4f8;
  --danger: #ff8a7a;
  --warn: #f4c96b;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  color: #07100d;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
  min-height: 42px;
  padding: 0 16px;
}

button:hover {
  filter: brightness(1.06);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7);
  opacity: 0.55;
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #1f2226;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(112, 214, 183, 0.14);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.subtle {
  color: var(--muted);
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-panel h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 0;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.error-text {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
}

.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  min-height: 100vh;
  border-right: 1px solid var(--line);
  background: #1d2023;
  padding: 22px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
}

.sidebar h1,
.workspace-header h2,
.review-panel h3,
.section-heading h3 {
  margin: 0;
  letter-spacing: 0;
}

.form-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.form-card {
  width: 100%;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  color: var(--text);
  background: var(--panel);
}

.form-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(112, 214, 183, 0.11);
}

.form-card[disabled] {
  cursor: not-allowed;
  opacity: 0.62;
}

.form-card strong {
  display: block;
  font-size: 16px;
}

.form-card span {
  display: inline-block;
  margin-top: 10px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #10130f;
  background: var(--warn);
  font-size: 11px;
  font-weight: 800;
}

.form-card.active span {
  background: var(--accent);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-2);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: var(--panel);
  font-size: 12px;
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.guided-form {
  display: grid;
  gap: 16px;
}

.form-section,
.review-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-heading span {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #07100d;
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

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

.wide {
  grid-column: 1 / -1;
}

.check-row,
.option-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-3);
}

.check-row input,
.option-grid input {
  width: 16px;
  min-height: 16px;
}

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

.consent {
  margin-bottom: 14px;
}

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

.signature-box {
  display: grid;
  gap: 10px;
}

.signature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}

.clear-signature {
  min-height: 30px;
  padding: 0 10px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}

canvas {
  width: 100%;
  height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  touch-action: none;
}

.submit-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.review-panel {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 14px;
}

.missing-list {
  margin: 0;
  padding-left: 18px;
  color: var(--danger);
}

.missing-list:empty::before {
  content: "All required fields look ready.";
  color: var(--accent);
  font-weight: 700;
}

.result-box {
  border: 1px solid rgba(112, 214, 183, 0.35);
  border-radius: 8px;
  background: rgba(112, 214, 183, 0.08);
  padding: 12px;
  word-break: break-word;
}

.result-box a {
  color: var(--accent);
}

.source-note {
  border-left: 3px solid var(--accent-2);
  padding-left: 10px;
  color: var(--muted);
  font-size: 12px;
}

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

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content-grid,
  .signature-grid {
    grid-template-columns: 1fr;
  }

  .review-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 14px;
  }

  .field-grid,
  .option-grid {
    grid-template-columns: 1fr;
  }

  .workspace-header,
  .submit-row,
  .inline-field {
    display: grid;
    grid-template-columns: 1fr;
  }
}
