/* =========================================================
   Home Health Nursing Teaching Generator — UI v2
   Static, dependency-free. Deep teal / slate clinical palette.
   ========================================================= */

:root {
  /* Surfaces */
  --page: #f2f4f4;
  --surface: #ffffff;
  --surface-soft: #f6f8f8;
  --field: #fcfdfd;

  /* Ink */
  --ink: #1c2826;
  --muted: #5c6b68;
  --faint: #8a9794;

  /* Lines */
  --line: #dfe5e4;
  --line-strong: #c3cecb;

  /* Brand teal */
  --teal-900: #093430;
  --teal-800: #0b443f;
  --teal-700: #0e554f;
  --teal-600: #147066;
  --teal-soft: #e7f1ef;
  --teal-border: rgba(14, 85, 79, 0.32);

  /* Accents */
  --warm: #8c5a33;
  --warm-soft: #f8f1ea;
  --amber: #946410;
  --amber-soft: #fdf6e4;
  --danger: #9e3a3a;
  --danger-soft: #fcf1f1;

  /* Focus ring */
  --ring: 0 0 0 3px rgba(20, 112, 102, 0.22);

  --shadow-card: 0 1px 2px rgba(20, 40, 37, 0.05), 0 8px 24px rgba(20, 40, 37, 0.06);
  --shadow-pop: 0 18px 44px rgba(9, 52, 48, 0.16);
  --radius: 8px;
  --radius-sm: 6px;

  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  cursor: pointer;
}

::selection {
  background: rgba(20, 112, 102, 0.18);
}

/* ---------- Access gate ---------- */

body.access-locked {
  overflow: hidden;
}

body.access-locked .app-shell {
  display: none;
}

body:not(.access-locked) .access-gate {
  display: none;
}

.access-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 460px at 50% -120px, rgba(14, 85, 79, 0.14), transparent 70%),
    var(--page);
}

.access-card {
  width: min(440px, 100%);
  padding: 32px 30px 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}

.access-card h1 {
  font-size: 1.35rem;
}

.access-mark {
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
}

.access-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.access-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.access-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--ink);
  letter-spacing: 0.12em;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.access-form input:focus {
  border-color: var(--teal-600);
  background: #ffffff;
  box-shadow: var(--ring);
}

.access-message {
  min-height: 22px;
  margin-top: 0;
}

/* ---------- App header (dark bar) ---------- */

.app-header {
  background: linear-gradient(180deg, var(--teal-800), var(--teal-900));
  border-bottom: 1px solid var(--teal-900);
}

.header-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  width: min(1460px, calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.access-mark {
  background: var(--teal-700);
  border: 0;
}

.brand-mark span {
  display: block;
  width: 22px;
  height: 22px;
  background:
    linear-gradient(#ffffff, #ffffff) center / 7px 22px no-repeat,
    linear-gradient(#ffffff, #ffffff) center / 22px 7px no-repeat;
}

.title-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: #9fc6c0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app-header h1 {
  color: #ffffff;
  font-size: clamp(1.18rem, 1.6vw, 1.45rem);
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* ---------- Page scaffold ---------- */

.page {
  width: min(1460px, calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 0 44px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

h2 {
  font-size: 1.07rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}

h3 {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.panel-kicker {
  margin: 0 0 4px;
  color: var(--teal-600);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.section-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- Workflow strip ---------- */

.workflow-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 28px;
  margin: 0 2px 16px;
  padding: 0;
  list-style: none;
}

.workflow-strip li {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}

.workflow-strip li strong {
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 1px solid var(--teal-border);
  background: var(--surface);
  color: var(--teal-700);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.workflow-strip li:not(:last-child)::after {
  content: "";
  width: 16px;
  height: 1px;
  margin-left: 28px;
  background: var(--line-strong);
  margin-right: -28px;
  transform: translateX(6px);
}

/* ---------- Workspace + panels ---------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 0.92fr) minmax(480px, 1.32fr) minmax(290px, 0.74fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.panel-head {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.panel-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-body {
  padding: 18px 20px 20px;
}

.result-panel .panel-head {
  border-top: 3px solid var(--teal-700);
}

.result-body {
  display: flex;
  flex-direction: column;
}

/* ---------- Fields ---------- */

.field-group {
  display: grid;
  gap: 7px;
  color: var(--ink);
}

.field-group > span {
  font-size: 0.86rem;
  font-weight: 650;
}

.field-hint {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 450;
}

.field-hint.warn {
  color: var(--danger);
  font-weight: 600;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background-color: var(--field);
  color: var(--ink);
  outline: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 18px,
    calc(100% - 12px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

select:hover {
  border-color: var(--faint);
}

select:focus {
  border-color: var(--teal-600);
  background-color: #ffffff;
  box-shadow: var(--ring);
}

/* ---------- Keyword builder ---------- */

.keyword-builder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: 7px;
  min-height: 104px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--field);
  cursor: text;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.keyword-builder:focus-within {
  border-color: var(--teal-600);
  background: #ffffff;
  box-shadow: var(--ring);
}

.keyword-list {
  display: contents;
}

.keyword-token {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  min-height: 30px;
  padding: 4px 4px 4px 11px;
  border: 1px solid var(--teal-border);
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-800);
  font-size: 0.85rem;
  font-weight: 600;
}

.keyword-token span {
  overflow-wrap: break-word;
  word-break: normal;
}

.keyword-remove {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: 3px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--teal-700);
  font-size: 0.95rem;
  line-height: 1;
  transition: background-color 130ms ease, color 130ms ease;
}

.keyword-remove:hover,
.keyword-remove:focus-visible {
  background: rgba(14, 85, 79, 0.14);
  color: var(--teal-900);
  outline: none;
}

#keyword-entry {
  flex: 1 1 170px;
  min-width: 140px;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

#keyword-entry::placeholder {
  color: var(--faint);
}

.keyword-add {
  min-height: 30px;
  padding: 5px 13px;
  border: 1px solid var(--teal-border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal-700);
  font-size: 0.82rem;
  font-weight: 650;
  transition: background-color 130ms ease, border-color 130ms ease;
}

.keyword-add:hover {
  background: var(--teal-soft);
  border-color: var(--teal-600);
}

.keyword-add:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* ---------- Keyword suggestions ---------- */

.keyword-suggestions {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding: 11px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.keyword-suggestions[hidden] {
  display: none;
}

.keyword-suggestions > span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.suggestion-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal-800);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background-color 130ms ease, border-color 130ms ease;
}

.suggestion-button::before {
  content: "+";
  color: var(--teal-600);
  font-weight: 700;
}

.suggestion-button:hover {
  border-color: var(--teal-600);
  background: var(--teal-soft);
}

.suggestion-button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-color: var(--teal-600);
}

/* ---------- Quick starts ---------- */

.quick-row {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.quick-row > span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.example-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.example-button {
  min-height: 31px;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background-color 130ms ease, border-color 130ms ease, color 130ms ease;
}

.example-button:hover {
  border-color: var(--teal-600);
  background: var(--teal-soft);
  color: var(--teal-800);
}

.example-button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-color: var(--teal-600);
}

/* ---------- Selects / style details ---------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.style-details {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.style-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 650;
  list-style: none;
  user-select: none;
}

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

.style-details summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}

.style-details[open] summary::before {
  transform: rotate(45deg);
}

.style-details summary:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.style-grid {
  margin-top: 0;
  padding: 2px 13px 14px;
  border-top: 0;
}

/* ---------- Messages ---------- */

.message {
  min-height: 20px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.message.success {
  color: var(--teal-700);
}

.message.error {
  color: var(--danger);
}

.panel-head-row .message {
  margin: 2px 0 0;
  max-width: 220px;
  text-align: right;
  flex: 0 1 auto;
}

/* ---------- Buttons ---------- */

.button-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 0;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.15;
  text-align: center;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease;
}

.button:focus-visible,
.version-tab:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.button:disabled,
.version-tab:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

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

.button-icon {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.button-icon svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.primary {
  background: var(--teal-700);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(9, 52, 48, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.primary:hover:not(:disabled) {
  background: var(--teal-800);
}

.secondary {
  border-color: var(--teal-border);
  background: var(--teal-soft);
  color: var(--teal-800);
}

.secondary:hover:not(:disabled) {
  border-color: var(--teal-600);
  background: #dcebe8;
}

.ghost {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--muted);
}

.ghost:hover:not(:disabled) {
  border-color: var(--faint);
  color: var(--ink);
}

/* ---------- Draft toolbar ---------- */

.draft-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.version-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.version-tab {
  min-height: 32px;
  padding: 4px 16px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
  white-space: nowrap;
  transition: background-color 130ms ease, color 130ms ease, box-shadow 130ms ease;
}

.version-tab:hover:not(:disabled):not(.active) {
  color: var(--ink);
}

.version-tab.active {
  background: #ffffff;
  color: var(--teal-800);
  box-shadow: 0 1px 3px rgba(20, 40, 37, 0.14);
}

.note-meta {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Output ---------- */

.output-wrap {
  position: relative;
  display: flex;
  min-height: 430px;
  flex: 1 1 auto;
}

.output-box {
  width: 100%;
  min-height: 430px;
  flex: 1 1 auto;
  padding: 18px 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #213733;
  font-size: 0.98rem;
  line-height: 1.75;
  resize: vertical;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.output-box:focus {
  border-color: var(--teal-600);
  box-shadow: var(--ring);
}

.empty-state {
  position: absolute;
  inset: 1px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 24px;
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  position: relative;
  display: block;
  width: 34px;
  height: 42px;
  margin-bottom: 8px;
  border: 1.6px solid var(--line-strong);
  border-radius: 5px;
  background: #ffffff;
}

.empty-icon::before {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 9px;
  height: 17px;
  background: repeating-linear-gradient(
    to bottom,
    var(--line-strong) 0,
    var(--line-strong) 1.6px,
    transparent 1.6px,
    transparent 7px
  );
}

.empty-state strong {
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 650;
}

.empty-state em {
  font-style: normal;
  font-weight: 650;
  color: var(--teal-700);
}

/* ---------- Copy area ---------- */

.copy-area {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.copy-area-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.copy-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 auto;
}

.copy-button {
  min-height: 36px;
  padding: 6px 14px;
  border-color: var(--teal-border);
  background: var(--teal-soft);
  color: var(--teal-800);
  font-size: 0.85rem;
}

.copy-button:hover:not(:disabled) {
  border-color: var(--teal-600);
  background: #dcebe8;
}

.copy-button.subtle {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--muted);
}

.copy-button.subtle:hover:not(:disabled) {
  border-color: var(--faint);
  background: var(--surface-soft);
  color: var(--ink);
}

/* ---------- Disclaimer ---------- */

.disclaimer {
  margin: 14px 0 0;
  color: var(--faint);
  font-size: 0.8rem;
  line-height: 1.55;
}

/* ---------- Review panel ---------- */

.review-panel .panel-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review-block {
  min-width: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.review-block:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.review-block h3 {
  margin-bottom: 10px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border: 1px solid var(--teal-border);
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-800);
  font-size: 0.78rem;
  font-weight: 600;
}

.tag.muted {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.tag.warn {
  border-color: rgba(148, 100, 16, 0.36);
  background: var(--amber-soft);
  color: #6f4b0b;
}

/* ---------- QA check list ---------- */

.check-list {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  overflow: hidden;
}

.check-list li {
  position: relative;
  padding: 9px 11px 9px 30px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.check-list li:last-child {
  border-bottom: 0;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}

.check-list li.pass {
  color: #2b4a44;
}

.check-list li.pass::before {
  background: var(--teal-600);
}

.check-list li.warn {
  background: var(--amber-soft);
  color: #6f4b0b;
}

.check-list li.warn::before {
  background: var(--amber);
}

.check-list li.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.check-list li.danger::before {
  background: var(--danger);
}

/* ---------- Section previews ---------- */

.section-preview {
  display: grid;
  gap: 10px;
  margin: 0;
}

.section-preview div {
  min-width: 0;
}

.section-preview dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.section-preview dd {
  max-height: 96px;
  overflow: auto;
  margin: 5px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: #334742;
  font-size: 0.83rem;
  line-height: 1.5;
}

/* ---------- Responsive ---------- */

@media (min-width: 720px) {
  .button-row {
    grid-template-columns: 1.2fr 1.2fr auto;
  }
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(300px, 0.92fr) minmax(420px, 1.18fr);
  }

  .review-panel {
    grid-column: 1 / -1;
  }

  .review-panel .panel-body {
    display: grid;
    grid-template-columns: 0.8fr 1.1fr 1.1fr;
    gap: 0 20px;
  }

  .review-block {
    padding: 0 20px 0 0;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .review-block:last-child {
    border-right: 0;
    padding-right: 0;
  }
}

@media (max-width: 920px) {
  .header-inner {
    width: calc(100% - 36px);
  }

  .page {
    width: calc(100% - 36px);
  }
}

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

  .review-panel .panel-body {
    display: flex;
    flex-direction: column;
  }

  .review-block {
    padding: 0 0 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .review-block:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .output-wrap,
  .output-box {
    min-height: 340px;
  }

  .panel-head-row {
    flex-direction: column;
    gap: 4px;
  }

  .panel-head-row .message {
    text-align: left;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .header-inner,
  .page {
    width: calc(100% - 28px);
  }

  .header-inner {
    padding: 14px 0;
    gap: 12px;
  }

  .workflow-strip {
    gap: 6px 18px;
  }

  .workflow-strip li:not(:last-child)::after {
    display: none;
  }

  .panel-head {
    padding: 14px 16px 12px;
  }

  .panel-body {
    padding: 16px;
  }

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

  .version-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .note-meta {
    align-self: flex-start;
  }

  .copy-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .copy-grid .copy-button:first-child {
    grid-column: 1 / -1;
  }

  .access-card {
    padding: 26px 22px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
