:root {
  color-scheme: light;
  --bg: #eff4f8;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(15, 55, 86, 0.12);
  --text: #1d2833;
  --muted: #5f6f7b;
  --brand: #005f8f;
  --brand-deep: #0a4563;
  --brand-soft: #d6ebf4;
  --warning-bg: #fff2e7;
  --warning-border: #ef7d00;
  --danger-bg: #ffe5e0;
  --danger-border: #d9472f;
  --surface: #f9fbfc;
  --shadow: 0 24px 70px rgba(0, 33, 56, 0.16);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(0, 95, 143, 0.22), transparent 28%),
    linear-gradient(180deg, #0f5e8d 0 14%, var(--bg) 14% 100%);
}

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

.page-shell {
  min-height: 100vh;
  padding: 32px;
  display: grid;
  place-items: center;
}

.panel-card {
  width: min(1120px, 100%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 36px;
}

.panel-header,
.result-card-header,
.dialog-footer,
.form-actions-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 3vw, 3rem);
}

h2 {
  font-size: 1.15rem;
}

.ghost-icon,
.ghost-button,
.secondary-button,
.primary-button {
  border-radius: 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

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

.ghost-icon {
  width: 48px;
  height: 48px;
  font-size: 2rem;
  background: transparent;
  color: var(--muted);
}

.panel-copy {
  display: grid;
  gap: 6px;
  margin: 28px 0 22px;
  max-width: 70ch;
  color: var(--muted);
  line-height: 1.45;
  font-size: 1.1rem;
}

.info-callout,
.warning-callout,
.error-banner {
  border-radius: 20px;
  padding: 18px 20px;
}

.info-callout {
  background: var(--brand-soft);
  color: var(--brand-deep);
  margin-bottom: 20px;
}

.warning-callout {
  margin: 18px 0 26px;
  background: var(--warning-bg);
  border: 2px solid var(--warning-border);
  color: #7d4300;
  font-weight: 600;
}

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

.field {
  display: grid;
  gap: 10px;
}

.field-feedback,
.action-feedback {
  color: var(--muted);
  font-size: 0.95rem;
}

.field-feedback {
  min-height: 1.2rem;
}

.field-feedback.error,
.action-feedback.error {
  color: #8f2316;
  font-weight: 600;
}

.action-feedback.success {
  color: #17613d;
  font-weight: 600;
}

.field span {
  font-weight: 700;
}

select,
textarea {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(29, 40, 51, 0.2);
  background: #fff;
  padding: 18px 20px;
  color: var(--text);
  resize: vertical;
}

select:focus,
textarea:focus {
  outline: 2px solid rgba(0, 95, 143, 0.24);
  border-color: var(--brand);
}

.secondary-button,
.primary-button,
.ghost-button {
  padding: 14px 22px;
  min-height: 54px;
  font-weight: 700;
}

.secondary-button {
  background: white;
  color: var(--text);
  border-color: rgba(29, 40, 51, 0.25);
}

.secondary-button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.primary-button {
  min-width: 280px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: white;
  box-shadow: 0 16px 30px rgba(0, 95, 143, 0.28);
}

.inline-primary {
  min-width: 220px;
}

.ghost-button {
  min-width: 160px;
  background: transparent;
  border-color: rgba(29, 40, 51, 0.25);
}

.button-icon {
  margin-right: 8px;
}

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 6px 0 12px;
}

.check-field input {
  width: 22px;
  height: 22px;
  margin-top: 3px;
  accent-color: var(--brand);
}

.check-field span {
  display: grid;
  gap: 6px;
}

.check-field small {
  color: var(--muted);
  font-size: 0.95rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.result-card {
  background: var(--surface);
  border: 1px solid rgba(15, 55, 86, 0.12);
  border-radius: 24px;
  padding: 20px;
}

.generated-note {
  min-height: 220px;
  margin-top: 16px;
  background: white;
}

.structured-fields {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.structured-field {
  background: white;
  border: 1px solid rgba(15, 55, 86, 0.12);
  border-radius: 18px;
  padding: 14px 16px;
}

.structured-field strong {
  display: block;
  margin-bottom: 6px;
}

.empty-state {
  color: var(--muted);
  line-height: 1.5;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 0.9rem;
  font-weight: 700;
}

.pill.muted {
  background: rgba(29, 40, 51, 0.08);
  color: var(--muted);
}

.error-banner {
  margin-top: 18px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #8f2316;
}

.dialog-footer {
  justify-content: flex-end;
  margin-top: 26px;
}

@media (max-width: 900px) {
  .panel-card {
    padding: 24px;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .dialog-footer,
  .form-actions-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-button,
  .ghost-button,
  .secondary-button {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .page-shell {
    padding: 16px;
  }

  .panel-card {
    border-radius: 22px;
    padding: 20px;
  }
}
