:root {
  --app-accent: #0b4f8a;
  --app-accent-dark: #07345c;
  --app-accent-soft: #e9f2f9;
  --app-bg: #f2f5f8;
  --app-card: #ffffff;
  --app-text: #172332;
  --app-muted: #667487;
  --app-border: #dbe2ea;
  --app-danger: #b42318;
  --app-success: #147d51;
  --app-shadow: 0 18px 44px rgba(28, 44, 64, 0.1);
  --rx-accent: #0b4f8a;
  --rx-accent-dark: #07345c;
  --rx-accent-soft: #e9f2f9;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--app-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--app-text);
  background:
    radial-gradient(circle at top left, rgba(11, 79, 138, 0.08), transparent 28rem),
    var(--app-bg);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 82px;
  padding: 14px clamp(18px, 3vw, 42px);
  border-bottom: 1px solid rgba(210, 220, 230, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.app-brand__mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--app-accent), #2b7cb8);
  box-shadow: 0 10px 24px rgba(11, 79, 138, 0.24);
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -1px;
}

.app-brand h1,
.app-brand p,
.panel-intro h2,
.panel-intro p,
.preview-toolbar h2,
.preview-toolbar p {
  margin: 0;
}

.app-brand h1 {
  font-size: clamp(18px, 2.2vw, 23px);
  letter-spacing: -0.035em;
}

.app-brand p {
  margin-top: 3px;
  color: var(--app-muted);
  font-size: 13px;
}

.app-header__actions,
.export-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.privacy-pill,
.live-badge,
.preview-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.privacy-pill {
  padding: 8px 11px;
  color: var(--app-success);
  background: #eaf8f1;
}

.privacy-pill > span {
  font-size: 8px;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
  line-height: 1;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:focus-visible,
.text-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(11, 79, 138, 0.2);
  outline-offset: 2px;
}

.button--primary {
  color: #fff;
  background: var(--app-accent);
  box-shadow: 0 9px 18px rgba(11, 79, 138, 0.2);
}

.button--primary:hover:not(:disabled) {
  background: var(--app-accent-dark);
  box-shadow: 0 12px 24px rgba(11, 79, 138, 0.24);
}

.button--secondary {
  color: var(--app-text);
  border-color: var(--app-border);
  background: #fff;
}

.button--secondary:hover:not(:disabled),
.button--ghost:hover:not(:disabled) {
  border-color: #b9c5d2;
  background: #f8fafc;
}

.button--ghost {
  min-height: 38px;
  padding-inline: 12px;
  color: var(--app-muted);
  border-color: transparent;
  background: transparent;
}

.button--small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 470px) minmax(0, 1fr);
  gap: 24px;
  width: min(1880px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 2.4vw, 36px) 38px;
}

.form-panel,
.preview-panel {
  min-width: 0;
}

.form-panel {
  align-self: start;
  max-height: calc(100vh - 106px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(215, 223, 232, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--app-shadow);
  scrollbar-gutter: stable;
}

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

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

.panel-intro h2 {
  font-size: 22px;
  letter-spacing: -0.025em;
}

.panel-intro__copy {
  margin: 8px 0 20px;
  color: var(--app-muted);
  font-size: 13px;
  line-height: 1.55;
}

.live-badge {
  padding: 7px 9px;
  color: var(--app-success);
  background: #eaf8f1;
}

.live-badge > span,
.preview-status > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(20, 125, 81, 0.12);
}

.form-section {
  margin-top: 12px;
  overflow: clip;
  border: 1px solid var(--app-border);
  border-radius: 14px;
  background: #fff;
}

.form-section summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 15px;
  list-style: none;
  user-select: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.form-section summary::-webkit-details-marker {
  display: none;
}

.form-section summary::after {
  content: "+";
  margin-left: auto;
  color: var(--app-muted);
  font-size: 18px;
  font-weight: 500;
}

.form-section[open] summary::after {
  content: "−";
}

.section-number {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 9px;
  color: var(--app-accent);
  background: var(--app-accent-soft);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.form-section__body {
  display: grid;
  gap: 14px;
  padding: 2px 15px 16px;
  border-top: 1px solid #eef2f5;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.field-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.registration-field--full {
  grid-column: 1 / -1;
}

.field {
  min-width: 0;
}

.form-section__body > .field:first-child,
.form-section__body > .field-grid:first-child {
  margin-top: 13px;
}

.field label,
.medicine-heading label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: #304053;
  font-size: 12px;
  font-weight: 760;
}

.field label > span[aria-hidden="true"] {
  color: var(--app-danger);
}

.optional {
  color: #8a96a4;
  font-size: 10px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea,
.medicine-row input {
  width: 100%;
  border: 1px solid #cfd8e2;
  border-radius: 10px;
  color: var(--app-text);
  background: #fff;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field input,
.field select,
.medicine-row input {
  min-height: 42px;
  padding: 9px 11px;
}

.field textarea {
  min-height: 82px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.45;
}

.field input::placeholder,
.field textarea::placeholder,
.medicine-row input::placeholder {
  color: #9aa5b2;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.medicine-row input:hover {
  border-color: #aebbc9;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.medicine-row input:focus {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 3px rgba(11, 79, 138, 0.1);
  outline: none;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--app-danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.08);
}

.field-error {
  min-height: 0;
  margin: 5px 0 0;
  color: var(--app-danger);
  font-size: 11px;
  line-height: 1.35;
}

.color-field {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 6px;
  border: 1px solid #cfd8e2;
  border-radius: 10px;
}

.color-field input {
  width: 42px;
  min-height: 30px;
  padding: 0;
  overflow: hidden;
  border: none;
  border-radius: 7px;
  cursor: pointer;
}

.color-field output {
  color: var(--app-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
}

.file-input {
  padding: 8px !important;
  font-size: 11px;
}

.file-input::file-selector-button {
  margin-right: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  color: var(--app-accent);
  background: var(--app-accent-soft);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.text-button {
  margin-top: 7px;
  padding: 0;
  border: 0;
  color: var(--app-danger);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.checkbox-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  margin-top: 2px;
  padding: 11px;
  border-radius: 11px;
  background: #f6f8fa;
  cursor: pointer;
}

.checkbox-row input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--app-accent);
}

.checkbox-row strong,
.checkbox-row small {
  display: block;
}

.checkbox-row strong {
  color: #324255;
  font-size: 12px;
}

.checkbox-row small {
  margin-top: 3px;
  color: var(--app-muted);
  font-size: 10px;
  line-height: 1.45;
}

.medicine-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-top: 1px;
}

.medicine-heading label {
  margin: 0;
}

.medicine-heading p {
  margin: 3px 0 0;
  color: var(--app-muted);
  font-size: 10px;
}

.medicine-rows {
  display: grid;
  gap: 9px;
}

.medicine-row {
  position: relative;
  display: grid;
  grid-template-columns: 1.35fr 0.8fr 0.8fr 1fr 0.8fr 1.2fr auto;
  gap: 7px;
  align-items: end;
  padding: 10px;
  border: 1px solid #e0e6ec;
  border-radius: 11px;
  background: #f9fafb;
}

.medicine-row__number {
  position: absolute;
  top: -7px;
  left: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--app-muted);
  background: #fff;
  font-size: 9px;
  font-weight: 800;
}

.medicine-row label {
  display: block;
  color: #677587;
  font-size: 9px;
  font-weight: 750;
}

.medicine-row label span {
  display: block;
  margin-bottom: 4px;
}

.medicine-row input {
  min-height: 36px;
  padding: 7px 8px;
  font-size: 11px;
}

.medicine-row__remove {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #e5c8c5;
  border-radius: 9px;
  color: var(--app-danger);
  background: #fff7f6;
  font-size: 17px;
}

.preview-panel {
  display: flex;
  min-height: calc(100vh - 130px);
  flex-direction: column;
  border: 1px solid rgba(212, 221, 230, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--app-shadow);
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--app-border);
  background: #fff;
}

.preview-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-toolbar h2 {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.preview-toolbar p {
  margin-top: 4px;
  color: var(--app-muted);
  font-size: 11px;
}

.preview-status {
  padding: 5px 8px;
  color: var(--app-success);
  background: #eaf8f1;
  font-size: 10px;
}

.preview-stage {
  display: grid;
  min-height: 0;
  flex: 1;
  place-items: start center;
  overflow: auto;
  padding: 28px;
  background:
    linear-gradient(45deg, #e9edf1 25%, transparent 25%),
    linear-gradient(-45deg, #e9edf1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e9edf1 75%),
    linear-gradient(-45deg, transparent 75%, #e9edf1 75%),
    #eef1f4;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.preview-sizer {
  position: relative;
  flex: 0 0 auto;
}

.preview-scale-layer {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}

/* A4 preview at 96 CSS pixels per inch. */
.prescription-page {
  position: relative;
  display: flex;
  width: 794px;
  height: 1123px;
  flex-direction: column;
  overflow: hidden;
  color: #182331;
  background: #fff;
  box-shadow: 0 28px 65px rgba(18, 31, 46, 0.22);
  font-family: Arial, Helvetica, sans-serif;
  isolation: isolate;
}

.page-accent {
  width: 100%;
  height: 11px;
  flex: 0 0 11px;
  background: var(--rx-accent);
}

.draft-watermark {
  position: absolute;
  z-index: -1;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-28deg);
  color: rgba(22, 35, 49, 0.055);
  font-size: 118px;
  font-weight: 900;
  letter-spacing: 0.08em;
  pointer-events: none;
  user-select: none;
}

.rx-header {
  padding: 28px 38px 0;
}

.rx-header__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 258px;
  gap: 24px;
  align-items: start;
}

.clinic-identity {
  display: grid;
  min-width: 0;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.clinic-logo {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--rx-accent);
  border-radius: 19px;
  background: var(--rx-accent-soft);
}

.clinic-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.clinic-logo__fallback {
  color: var(--rx-accent);
  font-size: 35px;
  font-weight: 900;
  line-height: 1;
}

.clinic-copy,
.doctor-identity {
  min-width: 0;
}

.clinic-kicker,
.doctor-kicker,
.clinic-copy h1,
.clinic-address,
.doctor-identity h2,
.doctor-meta,
.doctor-registration {
  margin: 0;
}

.clinic-kicker,
.doctor-kicker {
  color: var(--rx-accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.clinic-copy h1 {
  max-width: 390px;
  margin-top: 4px;
  color: var(--rx-accent-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 31px;
  line-height: 0.98;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.clinic-address {
  max-width: 405px;
  margin-top: 8px;
  color: #566477;
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.doctor-identity {
  min-height: 87px;
  padding: 13px 15px;
  border-left: 4px solid var(--rx-accent);
  border-radius: 0 12px 12px 0;
  background: var(--rx-accent-soft);
}

.doctor-identity h2 {
  margin-top: 4px;
  color: var(--rx-accent-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  line-height: 1.06;
  overflow-wrap: anywhere;
}

.doctor-meta {
  margin-top: 5px;
  color: #3d4a5b;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.doctor-registration {
  margin-top: 4px;
  color: #6b7787;
  font-size: 8.5px;
  overflow-wrap: anywhere;
}

.rx-contact-strip {
  display: grid;
  grid-template-columns: 1.15fr 0.78fr 0.92fr;
  gap: 0;
  margin-top: 21px;
  border-top: 1px solid #dfe5eb;
  border-bottom: 1px solid #dfe5eb;
}

.rx-contact-strip > span {
  display: flex;
  min-width: 0;
  gap: 7px;
  align-items: center;
  padding: 10px 12px;
  color: #4e5a6a;
  font-size: 9.5px;
  overflow: hidden;
}

.rx-contact-strip > span + span {
  border-left: 1px solid #e2e7ec;
}

.rx-contact-strip b {
  color: var(--rx-accent);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rx-contact-strip span span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-card {
  display: grid;
  grid-template-columns: 2fr 0.62fr 0.82fr 0.82fr 1fr 0.98fr;
  gap: 0;
  margin: 20px 38px 0;
  border: 1px solid #dce3e9;
  border-radius: 12px;
  background: #fbfcfd;
  overflow: hidden;
}

.patient-field {
  min-width: 0;
  padding: 10px 11px;
}

.patient-field + .patient-field {
  border-left: 1px solid #e1e6eb;
}

.patient-field__label,
.patient-field strong {
  display: block;
}

.patient-field__label {
  margin-bottom: 5px;
  color: #7a8795;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.patient-field strong {
  min-height: 13px;
  color: #273444;
  font-size: 10px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-field--wide strong {
  font-size: 11px;
}

.prescription-body {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  margin: 22px 38px 0;
}

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

.rx-symbol {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: var(--rx-accent);
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 700;
}

.rx-section-heading p,
.rx-section-heading h3 {
  margin: 0;
}

.rx-section-heading p {
  color: var(--rx-accent);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rx-section-heading h3 {
  margin-top: 2px;
  color: #273444;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.medicine-table-wrap {
  min-height: 0;
  flex: 1;
  overflow: hidden;
  border: 1px solid #d8e0e7;
  border-radius: 12px;
}

.medicine-table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.medicine-table th {
  padding: 9px 8px;
  color: #fff;
  background: var(--rx-accent);
  font-size: 7.8px;
  font-weight: 850;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
}

.medicine-table th:nth-child(1) { width: 25%; }
.medicine-table th:nth-child(2) { width: 12%; }
.medicine-table th:nth-child(3) { width: 10%; }
.medicine-table th:nth-child(4) { width: 16%; }
.medicine-table th:nth-child(5) { width: 13%; }
.medicine-table th:nth-child(6) { width: 24%; }

.medicine-table td {
  height: 41px;
  padding: 8px;
  border-top: 1px solid #e3e8ed;
  color: #384657;
  font-size: 9px;
  line-height: 1.3;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.medicine-table td:first-child {
  color: #243345;
  font-weight: 750;
}

.medicine-table td + td {
  border-left: 1px solid #eef1f4;
}

.medicine-table tr:nth-child(even) td {
  background: #fbfcfd;
}

.medicine-table .empty-medicine td {
  height: 100%;
  color: #9aa5b1;
  text-align: center;
  vertical-align: middle;
  font-style: italic;
}

.clinical-notes {
  display: grid;
  grid-template-columns: 1.1fr 1.25fr 0.85fr;
  gap: 10px;
  margin: 16px 38px 0;
}

.clinical-note {
  min-width: 0;
  min-height: 109px;
  padding: 12px;
  border: 1px solid #dde4ea;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.clinical-note__heading {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 7px;
  border-bottom: 1px solid #e9edf1;
}

.clinical-note__heading span {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 7px;
  color: var(--rx-accent);
  background: var(--rx-accent-soft);
  font-size: 7px;
  font-weight: 900;
}

.clinical-note h3,
.clinical-note p {
  margin: 0;
}

.clinical-note h3 {
  color: #334154;
  font-size: 9px;
}

.clinical-note p {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  color: #596677;
  font-size: 8.7px;
  line-height: 1.43;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.rx-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 252px;
  gap: 28px;
  align-items: end;
  margin: 18px 38px 28px;
  padding-top: 12px;
  border-top: 2px solid var(--rx-accent);
}

.rx-footer__notice {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.notice-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: var(--rx-accent);
  background: var(--rx-accent-soft);
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 800;
}

.rx-footer__notice p {
  margin: 0;
  color: #738091;
  font-size: 7.7px;
  line-height: 1.45;
}

.signature-block {
  min-width: 0;
  text-align: right;
}

.signature-line {
  width: 100%;
  height: 19px;
  border-bottom: 1px solid #758293;
}

.signature-block strong,
.signature-block span,
.signature-block small {
  display: block;
  overflow-wrap: anywhere;
}

.signature-block strong {
  margin-top: 5px;
  color: var(--rx-accent-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
}

.signature-block span {
  margin-top: 2px;
  color: #4e5b6b;
  font-size: 8px;
}

.signature-block small {
  margin-top: 2px;
  color: #7a8694;
  font-size: 7.5px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(390px, calc(100vw - 44px));
  padding: 12px 14px;
  border: 1px solid #cbd7e2;
  border-radius: 11px;
  color: #263648;
  background: #fff;
  box-shadow: 0 16px 42px rgba(20, 32, 47, 0.2);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.toast[data-type="error"] {
  border-color: #e6bcb8;
  color: #7f1d1d;
  background: #fff7f6;
}

.toast[data-type="success"] {
  border-color: #b8decf;
  color: #0d6141;
  background: #f3fcf7;
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  }

  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 980px) {
  .app-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

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

  .form-panel {
    max-height: none;
  }

  .preview-panel {
    min-height: 700px;
  }
}

@media (max-width: 620px) {
  .app-header__actions,
  .export-actions {
    width: 100%;
  }

  .privacy-pill {
    width: 100%;
    justify-content: center;
  }

  .app-header__actions .button,
  .export-actions .button {
    flex: 1;
  }

  .workspace {
    padding-inline: 10px;
  }

  .form-panel {
    padding: 16px;
    border-radius: 14px;
  }

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

  .medicine-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .medicine-row__remove {
    grid-column: 2;
    justify-self: end;
  }

  .preview-stage {
    padding: 14px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  html,
  body {
    width: 210mm !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  .app-header,
  .form-panel,
  .preview-toolbar,
  .toast {
    display: none !important;
  }

  .workspace,
  .preview-panel,
  .preview-stage {
    display: block !important;
    width: 210mm !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .preview-sizer,
  .preview-scale-layer {
    display: block !important;
    width: 210mm !important;
    height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }

  .preview-scale-layer {
    position: static !important;
  }

  .prescription-page {
    width: 210mm !important;
    height: 297mm !important;
    margin: 0 !important;
    box-shadow: none !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
