@font-face {
  font-family: LocalSans;
  src: local("Segoe UI");
}
* {
  box-sizing: border-box;
}
:root {
  --ink: #203d36;
  --muted: #687a71;
  --green: #245e4c;
  --light: #eaf0e8;
  --paper: #f7f7f1;
  --line: #dce4da;
  --white: #fff;
  --amber: #9a692b;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--app-font, LocalSans), "Segoe UI", Arial, sans-serif;
  font-size: calc(14px * var(--font-scale, 1));
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 4px;
}
button {
  cursor: pointer;
}
button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 14px;
  font-weight: 600;
  transition: background 0.15s;
}
button:hover {
  background: #f0f4ee;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
button.primary:hover {
  background: #194737;
}
button.ghost {
  background: transparent;
  border-color: transparent;
}
button.small {
  font-size: calc(12px * var(--font-scale, 1));
  padding: 6px 9px;
}
button.danger {
  color: #a13b38;
}
button.icon-button {
  padding: 6px 10px;
  border-color: transparent;
  font-size: calc(20px * var(--font-scale, 1));
  line-height: 1;
  background: transparent;
}
a {
  color: var(--green);
  text-decoration: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: calc(30px * var(--font-scale, 1));
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.7px;
}
h2 {
  font-size: calc(20px * var(--font-scale, 1));
  font-weight: 600;
  letter-spacing: -0.3px;
}
h3 {
  font-size: calc(15px * var(--font-scale, 1));
  font-weight: 650;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-size: calc(10px * var(--font-scale, 1));
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 9px;
}
.muted,
small {
  color: var(--muted);
}
.hidden {
  display: none !important;
}
.topbar {
  height: 86px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 0 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  min-width: 205px;
}
.brand-symbol {
  width: 40px;
  height: 44px;
  border: 1px solid #9bb29d;
  border-radius: 14px 3px 14px 3px;
  display: grid;
  place-items: center;
  color: var(--green);
  font-family: serif;
  font-size: calc(26px * var(--font-scale, 1));
}
.brand strong {
  display: block;
  letter-spacing: 2px;
  font-size: calc(14px * var(--font-scale, 1));
}
.brand small {
  display: block;
  letter-spacing: 2px;
  font-size: calc(9px * var(--font-scale, 1));
  margin-top: 4px;
}
.topbar nav {
  display: flex;
  align-self: stretch;
  align-items: stretch;
  gap: 20px;
}
.nav {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 0 4px;
  font-size: calc(13px * var(--font-scale, 1));
  color: var(--muted);
  white-space: nowrap;
}
.nav.active {
  border-bottom-color: var(--green);
  color: var(--green);
}
.nav-count {
  font-size: calc(10px * var(--font-scale, 1));
  background: var(--light);
  border-radius: 12px;
  padding: 2px 6px;
  margin-left: 3px;
}
.account {
  display: flex;
  gap: 10px;
  margin-left: auto;
  align-items: center;
}
.account strong {
  font-size: calc(12px * var(--font-scale, 1));
  display: block;
}
.account small {
  font-size: calc(10px * var(--font-scale, 1));
  display: block;
  margin-top: 4px;
}
.avatar {
  height: 34px;
  width: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ececde;
  color: #657453;
  font-size: calc(16px * var(--font-scale, 1));
}
.modebar {
  display: flex;
  justify-content: space-between;
  padding: 8px 32px;
  border-bottom: 1px solid var(--line);
  background: #eff3eb;
  font-size: calc(11px * var(--font-scale, 1));
  color: #687962;
}
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #709057;
  margin-right: 6px;
  vertical-align: middle;
}
main#app {
  max-width: 1600px;
  margin: 0 auto;
  padding: 29px 32px 40px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}
.page-heading p.muted {
  font-size: calc(13px * var(--font-scale, 1));
  margin-top: 8px;
}
.stats {
  display: flex;
  gap: 28px;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale, 1));
}
.stats strong {
  font-size: calc(20px * var(--font-scale, 1));
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}
.workspace {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.panel-head {
  padding: 18px 19px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.patient-search {
  padding: 14px 14px 9px;
}
.search-input {
  width: 100%;
  background: #f7f9f4 !important;
  border: 1px solid var(--line) !important;
  border-radius: 7px;
  padding: 10px 12px;
}
.patient-count {
  font-size: calc(10px * var(--font-scale, 1));
  color: var(--muted);
  padding: 2px 17px 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.patient-list {
  max-height: 660px;
  overflow: auto;
}
.patient-row {
  border: 0;
  border-left: 3px solid transparent;
  border-bottom: 1px solid #edf0ea;
  border-radius: 0;
  display: flex;
  gap: 11px;
  width: 100%;
  padding: 15px 14px;
  text-align: left;
  align-items: center;
  font-weight: 400;
  background: transparent;
}
.patient-row.selected {
  border-left-color: var(--green);
  background: #edf3e9;
}
.patient-row .initials {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #eef0e8;
  display: grid;
  place-items: center;
  font-size: calc(11px * var(--font-scale, 1));
  color: #708065;
}
.patient-row.selected .initials {
  background: #dfe9d8;
  color: #31573b;
}
.patient-row strong {
  display: block;
  font-size: calc(12px * var(--font-scale, 1));
  font-weight: 600;
}
.patient-row small {
  display: block;
  font-size: calc(10px * var(--font-scale, 1));
  margin-top: 5px;
}
.patient-row .chevron {
  margin-left: auto;
  color: #82977c;
}
.right-column {
  min-width: 0;
}
.patient-summary {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.patient-summary h2 {
  font-size: calc(23px * var(--font-scale, 1));
}
.patient-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  font-size: calc(11px * var(--font-scale, 1));
  color: var(--muted);
  margin-top: 9px;
}
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.section-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin: 0 0 16px;
}
.section-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  border-radius: 0;
  padding: 10px 0;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale, 1));
}
.section-tabs button.active {
  color: var(--ink);
  border-bottom-color: var(--green);
}
.recipe-list {
  display: grid;
  gap: 10px;
}
.recipe-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.recipe-card:hover {
  border-color: #9db69b;
}
.recipe-icon {
  width: 38px;
  height: 44px;
  border-radius: 8px;
  background: #eef3e9;
  display: grid;
  place-items: center;
  color: #6c8b5e;
  font-size: calc(19px * var(--font-scale, 1));
}
.recipe-card h3 {
  margin: 5px 0;
  font-size: calc(14px * var(--font-scale, 1));
}
.recipe-card small {
  font-size: calc(10px * var(--font-scale, 1));
}
.recipe-card .right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}
.badge {
  font-size: calc(10px * var(--font-scale, 1));
  padding: 4px 8px;
  border-radius: 5px;
  background: #eef1e8;
  color: #557349;
  white-space: nowrap;
}
.badge.draft {
  background: #fcf0d9;
  color: #926d2d;
}
.badge.checked {
  background: #e3eee9;
  color: #28684d;
}
.recipe-editor {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.editor-head {
  padding: 21px 24px;
  display: flex;
  gap: 14px;
  align-items: start;
  border-bottom: 1px solid var(--line);
}
.editor-head .actions {
  margin-left: auto;
}
.editor-head h2 {
  margin: 6px 0;
  font-size: calc(21px * var(--font-scale, 1));
}
.editor-body {
  padding: 22px 24px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.span-all {
  grid-column: 1/-1;
}
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: calc(11px * var(--font-scale, 1));
  color: var(--muted);
  font-weight: 600;
}
input,
select,
textarea {
  color: var(--ink);
  background: #fff;
  border: 1px solid #d6dfd2;
  padding: 9px 11px;
  border-radius: 7px;
  min-width: 0;
  width: 100%;
  font-size: calc(13px * var(--font-scale, 1));
  font-weight: 400;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #65865f;
  outline: 2px solid #e1ecd9;
}
textarea {
  resize: vertical;
  min-height: 86px;
  line-height: 1.6;
}
input[readonly],
textarea[readonly],
select:disabled {
  background: #f6f7f3;
  color: #526359;
}
.label-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.label-line button {
  font-size: calc(10px * var(--font-scale, 1));
  padding: 4px 8px;
  color: var(--green);
  border: 0;
  background: #edf3e9;
}
.editor-section {
  margin-top: 24px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}
.section-heading h3 span {
  font-weight: 400;
  color: var(--muted);
  font-size: calc(11px * var(--font-scale, 1));
  margin-left: 5px;
}
.positions {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(12px * var(--font-scale, 1));
}
.positions th {
  text-align: left;
  font-size: calc(10px * var(--font-scale, 1));
  letter-spacing: 0.8px;
  font-weight: 600;
  color: var(--muted);
  background: #f4f6f0;
  padding: 10px 9px;
}
.positions td {
  padding: 12px 9px;
  border-bottom: 1px solid #e8ece4;
  vertical-align: middle;
}
.positions .num {
  width: 26px;
  color: #9ca794;
}
.positions .code {
  width: 75px;
}
.positions .quantity {
  width: 113px;
}
.positions .row-actions {
  width: 88px;
  white-space: nowrap;
  text-align: right;
}
.positions .row-actions button {
  padding: 4px;
  font-size: calc(14px * var(--font-scale, 1));
}
.positions td strong {
  font-weight: 600;
  display: block;
  font-size: calc(12px * var(--font-scale, 1));
}
.positions td small {
  font-size: calc(10px * var(--font-scale, 1));
  display: block;
  margin-top: 4px;
}
.positions input {
  padding: 7px 7px;
  font-size: calc(12px * var(--font-scale, 1));
}
.code-button {
  padding: 0;
  background: none !important;
  border: 0;
  color: #4d7b5b;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: calc(11px * var(--font-scale, 1));
}
.unit {
  font-size: calc(10px * var(--font-scale, 1));
  color: var(--muted);
}
.quantity-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 9px;
  font-size: calc(11px * var(--font-scale, 1));
  color: var(--muted);
}
.total-line strong {
  color: var(--ink);
  font-size: calc(16px * var(--font-scale, 1));
  font-weight: 600;
}
.editor-footer {
  background: #f7f9f3;
  border-top: 1px solid var(--line);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  bottom: 0;
}
.save-state {
  font-size: calc(11px * var(--font-scale, 1));
  color: var(--muted);
}
.notice {
  background: #f1f5eb;
  border: 1px solid #d8e4ce;
  border-radius: 7px;
  color: #52664a;
  padding: 12px 14px;
  font-size: calc(12px * var(--font-scale, 1));
  line-height: 1.5;
  margin-bottom: 14px;
}
.notice.error {
  background: #fff0ed;
  border-color: #eac5bc;
  color: #913e32;
}
.notice.warning {
  background: #fff7e6;
  border-color: #e8d6a7;
  color: #88642c;
}
.empty {
  padding: 40px 25px;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
  font-size: calc(13px * var(--font-scale, 1));
}
.empty h3 {
  color: var(--ink);
  margin-bottom: 8px;
}
.empty button {
  margin-top: 15px;
}
.loading {
  padding: 50px;
  text-align: center;
  color: var(--muted);
}
.pager {
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  font-size: calc(11px * var(--font-scale, 1));
}
.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(680px, 90vw);
  background: #244b3c;
  color: #fff;
  padding: 14px 22px;
  border-radius: 9px;
  box-shadow: 0 8px 30px #18342525;
  font-size: calc(13px * var(--font-scale, 1));
  z-index: 100;
}
.toast.error {
  background: #853e32;
}
dialog {
  width: 700px;
  max-width: calc(100vw - 30px);
  max-height: 85vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 80px #173b3633;
  color: var(--ink);
}
dialog::backdrop {
  background: #18342e55;
  backdrop-filter: blur(2px);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
#dialog-body {
  padding: 20px 24px;
  max-height: calc(85vh - 75px);
  overflow: auto;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
}
.dialog-list {
  display: grid;
  gap: 8px;
  margin-top: 15px;
  max-height: 430px;
  overflow: auto;
}
.pick-row {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  width: 100%;
  font-weight: 400;
  padding: 13px;
}
.pick-row strong {
  display: block;
  font-size: calc(12px * var(--font-scale, 1));
}
.pick-row p {
  font-size: calc(12px * var(--font-scale, 1));
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-line;
  margin-top: 6px;
}
.pick-row small {
  font-size: calc(10px * var(--font-scale, 1));
  display: block;
  margin-top: 3px;
}
.pick-row .arrow {
  margin-left: auto;
}
.pick-row.unavailable {
  opacity: 0.65;
}
.list-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin: 0 0 20px;
}
.list-toolbar input {
  max-width: 350px;
}
.block-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.block-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}
.block-card h3 {
  margin: 13px 0 9px;
}
.block-card p {
  white-space: pre-line;
  color: var(--muted);
  font-size: calc(12px * var(--font-scale, 1));
  line-height: 1.65;
}
.outbox-table {
  width: 100%;
  border-collapse: collapse;
}
.outbox-table th,
.outbox-table td {
  text-align: left;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.outbox-table th {
  font-size: calc(10px * var(--font-scale, 1));
  color: var(--muted);
  background: #f0f4eb;
}
.outbox-table td {
  font-size: calc(12px * var(--font-scale, 1));
}
.login-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  background: #fafaf5;
}
.login-card {
  align-self: center;
  justify-self: center;
  width: 390px;
  padding: 30px 10px;
}
.login-card .brand-symbol {
  margin-bottom: 24px;
}
.login-card h1 {
  font-size: calc(35px * var(--font-scale, 1));
  margin: 15px 0 16px;
  line-height: 1.2;
  letter-spacing: -1px;
}
.login-card .muted {
  font-size: calc(13px * var(--font-scale, 1));
  line-height: 1.7;
}
.login-form {
  display: grid;
  gap: 19px;
  margin-top: 33px;
}
/* iOS focuses small inputs by zooming the page. Keep login text at least 16px
   while retaining the user's ability to zoom manually. */
.login-form input {
  font-size: max(16px, 1rem);
}
.login-form button {
  display: flex;
  justify-content: space-between;
  padding: 13px;
}
.login-foot {
  border-top: 1px solid var(--line);
  margin-top: 32px;
  padding-top: 22px;
  font-size: calc(10px * var(--font-scale, 1));
  color: var(--muted);
}
.login-foot .kaser-egg {
  color:var(--muted); background:transparent; border:0; box-shadow:none;
  padding:0 6px; min-width:24px; min-height:24px; font-size:12px;
}
#kaser-dialog { width:min(520px, calc(100vw - 30px)); }
#kaser-dialog h2 { margin:0; font-size:20px; }
.kaser-content { padding:8px 24px 20px; line-height:1.55; }
.login-art {
  background: #dfe8d6;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 65px;
  overflow: hidden;
}
.login-art:before {
  content: "";
  position: absolute;
  width: 430px;
  height: 630px;
  border: 1px solid #8da284;
  border-radius: 100% 0 100% 0;
  transform: rotate(15deg);
  top: 8%;
  left: 15%;
  background: linear-gradient(130deg, #e8efdf88, #bfd2ab66);
}
.login-art:after {
  content: "";
  position: absolute;
  width: 360px;
  height: 510px;
  border: 1px solid #9baf91;
  border-radius: 0 100% 0 100%;
  transform: rotate(-8deg);
  top: 4%;
  left: 48%;
  background: #d7e4c533;
}
.login-art p {
  font-size: calc(36px * var(--font-scale, 1));
  font-weight: 300;
  line-height: 1.25;
  z-index: 1;
  letter-spacing: -1px;
}
.login-art small {
  letter-spacing: 3px;
  font-size: calc(10px * var(--font-scale, 1));
  margin-top: 25px;
}
.unsaved-dot {
  color: #aa772e;
}
.warning-text {
  color: #a66533 !important;
}
.inline-error {
  margin-top: 12px;
}
.form-errors {
  margin-bottom: 15px;
}
.table-scroll {
  overflow: auto;
}
.row-highlight {
  background: #fff7e6;
}
.detail-note {
  font-size: calc(11px * var(--font-scale, 1));
  line-height: 1.5;
  color: var(--muted);
  margin-top: 12px;
}
@media (min-width: 1500px) {
  .workspace {
    grid-template-columns: 320px 1fr;
  }
  .patient-list {
    max-height: 750px;
  }
}
@media (max-width: 1100px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 14px 20px 0;
    gap: 8px 20px;
  }
  .topbar nav {
    order: 3;
    width: 100%;
    height: 46px;
    gap: 12px;
  }
  .account small {
    max-width: 150px;
  }
  .workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  main#app {
    padding: 23px 20px;
  }
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .block-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .editor-body {
    padding: 20px 17px;
  }
  .editor-head {
    padding: 18px;
  }
  .editor-footer {
    padding: 14px 17px;
  }
}
@media (max-width: 780px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 14px 16px 0;
    gap: 8px 20px;
  }
  .brand {
    min-width: 140px;
  }
  .brand-symbol {
    width: 30px;
    height: 34px;
    font-size: calc(20px * var(--font-scale, 1));
  }
  .brand strong {
    font-size: calc(11px * var(--font-scale, 1));
  }
  .brand small {
    font-size: calc(8px * var(--font-scale, 1));
  }
  .account {
    max-width: 55%;
  }
  .account strong {
    font-size: calc(11px * var(--font-scale, 1));
  }
  .account small {
    display: none;
  }
  .account .avatar {
    display: none;
  }
  .topbar nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    height: 46px;
    gap: 0;
    overflow-x: auto;
  }
  .nav {
    font-size: calc(11px * var(--font-scale, 1));
    flex-shrink: 0;
  }
  .modebar {
    padding: 8px 16px;
    font-size: calc(10px * var(--font-scale, 1));
  }
  .modebar > span:last-child {
    display: inline-flex;
  }
  main#app {
    padding: 22px 14px;
  }
  .page-heading {
    align-items: start;
  }
  .page-heading h1 {
    font-size: calc(25px * var(--font-scale, 1));
  }
  .stats {
    gap: 14px;
  }
  .stats strong {
    font-size: calc(17px * var(--font-scale, 1));
  }
  .stats > div:first-child {
    display: none;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .patient-list {
    max-height: 175px;
  }
  .patient-row {
    padding: 11px 13px;
  }
  .patient-summary {
    padding: 18px;
    align-items: start;
  }
  .patient-summary h2 {
    font-size: calc(20px * var(--font-scale, 1));
  }
  .patient-summary .actions {
    max-width: 140px;
    justify-content: flex-end;
  }
  .patient-summary .actions button {
    font-size: calc(11px * var(--font-scale, 1));
  }
  .recipe-card {
    gap: 12px;
    padding: 15px;
  }
  .recipe-card .right {
    gap: 6px;
  }
  .recipe-icon {
    display: none;
  }
  .recipe-card h3 {
    font-size: calc(13px * var(--font-scale, 1));
  }
  .editor-head {
    flex-wrap: wrap;
  }
  .editor-head .actions {
    width: 100%;
    margin-left: 0;
  }
  .editor-footer {
    align-items: start;
    flex-direction: column;
    position: static;
  }
  .editor-footer .actions {
    width: 100%;
    justify-content: flex-end;
  }
  .positions .num {
    display: none;
  }
  .positions .code {
    width: 56px;
  }
  .positions th,
  .positions td {
    padding: 9px 5px;
  }
  .positions .quantity {
    width: 84px;
  }
  .positions .row-actions {
    width: 54px;
  }
  .positions .row-actions .move {
    display: none;
  }
  .positions td strong {
    font-size: calc(11px * var(--font-scale, 1));
  }
  .form-grid.two {
    grid-template-columns: 1fr;
  }
  .block-grid {
    grid-template-columns: 1fr;
  }
  .list-toolbar {
    flex-wrap: wrap;
  }
  .login-page {
    display: block;
    min-height: 100dvh;
  }
  .login-card {
    width: min(100%, 420px);
    margin: auto;
    padding: 24px;
  }
  .login-art {
    display: none;
  }
  .login-card:focus-within .brand-symbol { margin-bottom: 8px; }
  .login-card:focus-within h1 { font-size: 28px; margin: 8px 0; }
  .login-card:focus-within .login-form { margin-top: 16px; gap: 14px; }
  .login-card:focus-within .login-foot { margin-top: 16px; padding-top: 12px; }
  .outbox-table th,
  .outbox-table td {
    padding: 12px 10px;
  }
  .patient-meta {
    gap: 6px 12px;
  }
  #dialog-body {
    padding: 18px;
  }
  .dialog-head {
    padding: 16px 18px;
  }
  .dialog-head h2 {
    font-size: calc(18px * var(--font-scale, 1));
  }
  .page-heading .muted {
    max-width: 230px;
  }
  .stats {
    font-size: calc(9px * var(--font-scale, 1));
  }
}

.practice-heading {
  display: inline-block;
  margin-top: 7px;
  letter-spacing: 0.02em;
  font-size: calc(12px * var(--font-scale, 1));
  text-transform: none;
}
.history-patient {
  margin: 6px 0;
  font-weight: 600;
}
[hidden] {
  display: none !important;
}

.patient-sort {
  padding: 0 16px 8px;
}

.view-choice {
  min-width: 112px;
  font-size: calc(10px * var(--font-scale, 1));
}
.view-choice select {
  padding: 6px 9px;
  margin-top: 3px;
  font-size: calc(12px * var(--font-scale, 1));
}
.topbar {
  gap: 20px;
}
.brand {
  min-width: 165px;
}
.topbar nav {
  gap: 12px;
}
.classic main#app {
  max-width: 1260px;
  padding-top: 14px;
}
.classic .page-heading {
  margin-bottom: 12px;
}
.classic .page-heading h1 {
  display: none;
}
.classic .page-heading .eyebrow {
  margin-bottom: 0;
}
.classic .practice-heading {
  margin-top: 4px;
}
.classic .panel,
.classic .recipe-editor {
  border-radius: 5px;
  box-shadow: none;
}
.classic .panel-head {
  padding: 9px 14px;
}
.classic-patient-fields {
  display: grid;
  grid-template-columns: 1.4fr 0.65fr 1.6fr;
  gap: 12px;
  padding: 12px 14px;
}
.input-action {
  display: flex;
  gap: 6px;
}
.input-action input {
  min-width: 0;
}
.input-action button {
  flex-shrink: 0;
}
.classic input,
.classic select {
  min-height: 32px;
  padding: 6px 9px;
  border-radius: 3px;
  font-size: calc(13px * var(--font-scale, 1));
}
.classic textarea {
  min-height: 62px;
  padding: 8px;
  border-radius: 3px;
  font-size: calc(13px * var(--font-scale, 1));
}
.classic label {
  font-size: calc(11px * var(--font-scale, 1));
  gap: 4px;
}
.classic button {
  border-radius: 3px;
}
.classic-recipe-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
}
.classic-recipe-bar > strong {
  font-size: calc(14px * var(--font-scale, 1));
}
.classic .editor-head {
  padding: 8px 14px;
  align-items: center;
}
.classic .editor-head h2 {
  display: none;
}
.classic .editor-head .eyebrow {
  margin: 0;
}
.classic .editor-body {
  padding: 12px 14px;
}
.classic .editor-section {
  margin-top: 12px;
  padding-top: 12px;
}
.classic .classic-head-fields {
  grid-template-columns: 0.85fr 1fr 1fr 1.4fr 1fr 1fr;
  gap: 12px;
  align-items: start;
}

@media (min-width: 1000px) {
  .classic .topbar {
    height: 64px;
    flex-wrap: nowrap;
    padding: 0 24px;
    gap: 14px;
  }
  .classic .brand {
    min-width: 135px;
  }
  .classic .brand-symbol {
    width: 30px;
    height: 34px;
    font-size: calc(21px * var(--font-scale, 1));
  }
  .classic .brand strong {
    font-size: calc(12px * var(--font-scale, 1));
  }
  .classic .brand small {
    font-size: calc(8px * var(--font-scale, 1));
  }
  .classic .topbar nav {
    order: 0;
    width: auto;
    height: auto;
    gap: 8px;
  }
  .classic .nav {
    font-size: calc(12px * var(--font-scale, 1));
  }
  .classic .account small {
    display: none;
  }
  .classic .account > span {
    max-width: 145px;
  }
}
.classic .modebar {
  padding-top: 5px;
  padding-bottom: 5px;
}
.classic .panel-head {
  padding: 6px 12px;
}
.classic-patient-fields {
  padding: 8px 12px;
}
.classic-recipe-bar {
  padding: 6px 0;
}
.classic button:not(.nav):not(.icon-button):not(.code-button) {
  padding: 6px 9px;
  font-size: calc(12px * var(--font-scale, 1));
}
.classic .editor-body {
  padding: 8px 12px;
}
.classic .editor-section {
  margin-top: 8px;
  padding-top: 0;
}
.classic textarea {
  min-height: 54px;
  height: 54px;
  line-height: 1.4;
}
.classic .positions td strong {
  display: inline;
}
.classic .positions td small {
  display: inline;
  margin: 0 0 0 9px;
}
.classic .positions td {
  padding-top: 3px;
  padding-bottom: 3px;
}
.classic .editor-section .table-scroll {
  max-height: clamp(170px, calc(100dvh - 505px), 480px);
  overflow-y: auto;
}
.classic .positions th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.classic-head-fields > .span-all {
  grid-column: auto;
}
.classic .form-grid.two {
  gap: 12px;
}
.classic .section-heading {
  margin-bottom: 8px;
}
.classic .section-heading h3 {
  font-size: calc(14px * var(--font-scale, 1));
}
.classic .positions th,
.classic .positions td {
  padding: 5px 8px;
}
.classic .positions td small {
  font-size: calc(10px * var(--font-scale, 1));
}
.classic .positions input {
  min-height: 28px;
  padding: 4px 6px;
}
.classic .total-line {
  padding: 8px 0;
}
.classic .editor-footer {
  padding: 9px 14px;
}
.classic-assignment {
  display: flex;
  justify-content: flex-end;
}
.classic-assignment .detail-note {
  margin: 0;
}
.classic-empty {
  padding: 14px;
}
.classic-empty-fields {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}
.classic-empty-fields > label {
  flex: 1;
}
.classic-empty h3 {
  font-size: calc(14px * var(--font-scale, 1));
  margin: 12px 0;
}
.classic-article-entry {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 0 0 9px;
}
.classic-article-entry label {
  flex: 1;
}
.classic-search-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.classic-search-controls input {
  flex: 1;
  min-width: 120px;
}
.classic-search-controls select {
  width: auto;
  max-width: 230px;
}
.classic-search-table {
  border-collapse: collapse;
  width: 100%;
  font-size: calc(12px * var(--font-scale, 1));
}
.classic-search-table td,
.classic-search-table th {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.classic-search-table button {
  text-align: left;
  padding: 5px 8px;
  white-space: nowrap;
}
@media (max-width: 1300px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 12px 20px 0;
    gap: 7px 16px;
  }
  .topbar nav {
    order: 3;
    width: 100%;
    height: 42px;
    overflow-x: auto;
  }
  .topbar .account {
    max-width: none;
  }
}
@media (max-width: 900px) {
  .classic .classic-head-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .classic-patient-fields {
    grid-template-columns: 1.5fr 1fr;
  }
  .classic-patient-fields > label:last-child {
    grid-column: 1 / -1;
  }
}
@media (max-width: 600px) {
  .topbar {
    padding: 10px 12px 0;
  }
  .topbar .brand {
    min-width: 130px;
  }
  .topbar .account > span {
    display: none;
  }
  .topbar nav {
    gap: 0;
  }
  .classic .classic-head-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .classic .editor-head .actions {
    width: auto;
  }
  .classic .classic-assignment {
    display: flex;
  }
  .classic-patient-fields {
    grid-template-columns: 1fr;
  }
  .classic-empty-fields {
    flex-wrap: wrap;
  }
  .classic-empty-fields > label {
    min-width: 130px;
  }
  .classic-search-controls {
    flex-wrap: wrap;
  }
  .classic-search-controls input {
    width: 100%;
    flex-basis: 100%;
  }
  .classic-search-table th,
  .classic-search-table td {
    padding: 5px 3px;
    font-size: calc(11px * var(--font-scale, 1));
  }
  .classic-search-table .badge {
    white-space: normal;
  }
  .classic-article-entry {
    flex-wrap: wrap;
  }
  .classic-article-entry label {
    flex-basis: 100%;
  }
}

.deleted-filter { display:flex; align-items:center; gap:.5rem; margin:.65rem 0; font-size:.85rem; }
.deleted-filter input[type="checkbox"] { width:auto; margin:0; }
.badge.deleted { background:#fbe9e7; color:#9b3027; font-size:.72rem; vertical-align:middle; }

/* Tour: native modal focus management; highlighted controls remain inert. */
.modebar { display:flex; align-items:center; justify-content:space-between; }
.tour-link { border:0; background:transparent; color:var(--muted); padding:2px 8px; font-size: calc(12px * var(--font-scale, 1)); text-decoration:underline; text-underline-offset:3px; }
dialog.tour-dialog { position:fixed; inset:0; width:100vw; height:100dvh; max-width:none; max-height:none; margin:0; padding:0; border:0; border-radius:0; background:transparent; overflow:hidden; box-shadow:none; }
dialog.tour-dialog::backdrop { background:transparent; backdrop-filter:none; -webkit-backdrop-filter:none; }
.tour-shade { position:absolute; inset:0; background:rgb(17 38 32 / 55%); }
.tour-spot { position:absolute; border:3px solid #84d4b0; border-radius:8px; box-shadow:0 0 0 9999px rgb(17 38 32 / 55%); pointer-events:none; }
.tour-card { position:absolute; z-index:1; right:24px; bottom:24px; width:min(460px, calc(100vw - 32px)); max-height:calc(100dvh - 48px); overflow:auto; background:#fff; color:var(--text); border-radius:14px; box-shadow:0 14px 60px #0005; padding:24px; }
.tour-card.tour-card-top { top:24px; bottom:auto; }
.tour-card h2 { font-size: calc(22px * var(--font-scale, 1)); line-height:1.25; margin:8px 0 14px; outline:none; }
.tour-card p { line-height:1.55; margin:0 0 16px; }
.tour-control {
  color:#174d3a; background:#e2f1e8; border-radius:4px;
  padding:1px 3px; font-weight:700;
  -webkit-box-decoration-break:clone; box-decoration-break:clone;
}
.tour-topline { display:flex; align-items:center; justify-content:space-between; }
.tour-progress { color:var(--muted); font-size: calc(12px * var(--font-scale, 1)); letter-spacing:.07em; text-transform:uppercase; }
.tour-topline .tour-progress { margin:0; }
.tour-note { font-size: calc(13px * var(--font-scale, 1)); color:var(--muted); }
.tour-actions { display:flex; justify-content:space-between; gap:12px; margin-top:20px; }
.tour-example { border:1px solid #dbe4df; background:#f5f8f6; border-radius:8px; padding:12px; font-size: calc(13px * var(--font-scale, 1)); }
.tour-example > small { display:block; color:var(--muted); margin-bottom:10px; }
.tour-example-row { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; padding:7px 0; }
.tour-example p { margin:8px 0 0; }
.tour-example-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.tour-example-grid small,.tour-example-grid strong { display:block; }
@media(max-width:600px) {
 .tour-card { right:16px; bottom:16px; padding:18px; }
 .tour-card.tour-card-top { top:16px; bottom:auto; }
 .tour-card h2 { font-size: calc(20px * var(--font-scale, 1)); }
}

/* Personal display options: presentation only, independent of record/PDF data. */
html { font-size:calc(16px * var(--font-scale, 1)); }
button.primary:hover { background:var(--green); filter:brightness(.92); }
.patient-row.selected,.patient-row:hover,.pick-row:hover,.positions tbody tr:hover,.positions tbody tr:focus-within,.skin-preview-row { background:var(--skin-selection, var(--light)); }
:root[data-density="compact"] .positions td { padding-top:4px; padding-bottom:4px; }
:root[data-density="roomy"] .positions td { padding-top:14px; padding-bottom:14px; }
:root[data-density="compact"] .patient-row,:root[data-density="compact"] .pick-row { padding-top:7px; padding-bottom:7px; }
:root[data-density="roomy"] .patient-row,:root[data-density="roomy"] .pick-row { padding-top:17px; padding-bottom:17px; }
.modebar > span:last-child { display:inline-flex; flex-wrap:wrap; justify-content:flex-end; }
.skin-preview { padding:14px; border:1px solid var(--line); border-radius:8px; margin-top:16px; background:var(--paper); }
.skin-preview-row { display:flex; justify-content:space-between; gap:16px; padding:10px; margin:10px 0; }
.skin-preview button:disabled { opacity:1; }
.skin-transfer { display:flex; flex-wrap:wrap; gap:12px; margin:16px 0; align-items:center; }
.skin-import-label { display:flex; gap:6px; }
.skin-import-label input { max-width:220px; }
#skin-json { width:100%; font-family:monospace; margin:10px 0; }
#appearance-form input[type="color"] { width:100%; height:40px; padding:3px; }
#appearance-form details summary { cursor:pointer; color:var(--muted); }

.substance-title { display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; }
.substance-info { white-space:nowrap; font-size:calc(11px * var(--font-scale, 1)); padding:4px 7px; }
.article-choice { display:flex; align-items:center; gap:8px; }
.article-choice > .pick-row { flex:1; min-width:0; }
.compendium-dialog { width:min(1180px,96vw); max-width:96vw; padding:0; }
.compendium-dialog iframe { display:block; width:100%; height:70dvh; min-height:260px; border:0; background:white; }
.compendium-toolbar { display:flex; justify-content:space-between; flex-wrap:wrap; gap:8px; padding:10px 18px; border-bottom:1px solid var(--line); font-size:calc(12px * var(--font-scale, 1)); }
#compendium-loading { padding:10px 18px; font-size:calc(12px * var(--font-scale, 1)); }
@media(max-width:600px) { .compendium-dialog iframe { height:65dvh; } .article-choice { gap:4px; } }
/* Compact inline actions, with a direct destination for long position lists. */
.substance-info { padding:1px 5px; font-size:calc(11px * var(--font-scale,1)); line-height:1.4; color:var(--muted); background:transparent; }
.text-with-catalog { display:flex; gap:5px; align-items:flex-start; }
.text-with-catalog textarea { flex:1; min-width:0; }
.catalog-button { padding:3px 8px; line-height:1.2; margin-top:2px; }
.positions .num { width:65px; }
.position-target { min-width:48px; padding:4px 2px; font-size:inherit; }
.positions .row-actions { white-space:nowrap; width:100px; }
.qms-dialog { width:min(940px,95vw); max-width:95vw; padding:0; }
#qms-form { padding:0 22px 22px; }
.qms-sections fieldset { border:1px solid var(--line); border-radius:7px; margin:16px 0; padding:14px; }
.qms-sections legend { color:var(--green); font-weight:650; padding:0 7px; }
.qms-medication { display:grid; grid-template-columns:1fr 1fr auto; gap:8px; margin-bottom:8px; }
.qms-confirm { display:flex; align-items:center; gap:10px; margin:18px 0; }
.qms-confirm input { width:auto; }
.qms-due { font-weight:750; color:#894214; }
#qms-error { color:#984024; padding:8px 0; }
.language-choice { display:inline-flex; align-items:center; gap:3px; margin:0 8px 0 0; }
.language-choice select { padding:3px 5px; font-size:12px; }
html[lang="zh-Hans"] body { font-family:"Microsoft YaHei","PingFang SC","Noto Sans CJK SC",sans-serif; }
@media(max-width:600px){ .qms-medication { grid-template-columns:1fr auto; } .qms-medication .qms-med-dosage { grid-column:1;grid-row:2; } }

.account-identity { display:flex; align-items:center; gap:8px; min-width:0; }
.account-identity .avatar { flex:0 0 34px; display:grid; }
.language-choice { flex-direction:row; }

/* One responsive application header; no separate utilities bar. */
.topbar, .classic .topbar { height:auto; min-height:64px; padding:8px 16px; gap:12px; flex-wrap:wrap; }
.topbar .brand { min-width:120px; gap:8px; }
.topbar .brand-symbol { width:30px; height:34px; font-size:21px; }
.topbar .brand strong { font-size:12px; }
.topbar .brand small { font-size:8px; }
.topbar nav, .classic .topbar nav { order:0; width:auto; min-height:38px; height:auto; gap:8px; overflow:visible; }
.topbar .nav { font-size:calc(12px * var(--font-scale, 1)); }
.header-tools { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-left:auto; font-size:11px; color:var(--muted); }
.header-tools > span:last-child { display:flex; align-items:center; flex-wrap:wrap; gap:2px; }
.header-tools .beta-status { white-space:nowrap; }
.header-tools .language-choice { margin:0 4px 0 0; }
.topbar .account { max-width:none; margin-left:0; gap:8px; }
.topbar .view-choice { font-size:10px; gap:2px; margin:0; }
.topbar .view-choice select { width:90px; padding:4px 6px; font-size:12px; }
.topbar .account .account-identity { display:flex; max-width:155px; }
.topbar .account-identity > span:last-child { min-width:0; overflow-wrap:anywhere; }
.topbar .account-identity .avatar { display:grid; }
@media(max-width:700px) {
 .topbar, .classic .topbar { gap:8px 12px; padding:8px 12px; }
 .topbar .brand { min-width:110px; }
 .topbar .account { margin-left:auto; flex-wrap:wrap; justify-content:flex-end; }
 .topbar .account .account-identity { max-width:125px; }
 .topbar nav, .classic .topbar nav { order:2; width:100%; justify-content:flex-start; flex-wrap:wrap; gap:4px; overflow:visible; }
 .header-tools { order:1; margin-left:0; width:100%; justify-content:space-between; }
 .header-tools .beta-status { font-size:10px; }
}

@media(max-width:700px) { .topbar .nav { min-height:32px; flex:1 1 auto; } .topbar .account .account-identity { max-width:125px; } }

.header-tools .language-choice { flex-direction:column; align-items:stretch; gap:2px; font-size:10px; }
.header-tools .language-choice select { padding:4px 6px; font-size:12px; }

.topbar .view-choice select, .header-tools .language-choice select { margin-top:0; }
.topbar .view-choice { min-width:0; }

/* Action buttons use the same accent as the appearance preview. List rows,
   navigation and inline links retain their quieter presentation. */
button:not(.nav):not(.icon-button):not(.tour-link):not(.code-button):not(.substance-info):not(.patient-row):not(.pick-row):not(.ghost):not(.danger):not(.section-tabs button) {
 background:var(--green); border-color:var(--green); color:#fff;
}
button:not(.nav):not(.icon-button):not(.tour-link):not(.code-button):not(.substance-info):not(.patient-row):not(.pick-row):not(.ghost):not(.danger):not(.section-tabs button):hover:not(:disabled) {
 background:var(--green); filter:brightness(.92);
}
button:focus-visible { outline:2px solid var(--green); }
button.danger { background:#fff0ed; border-color:#c57d73; color:#913e32; }
button.danger:hover:not(:disabled) { background:#f8ddd6; }
.code-button, .substance-info, .icon-button, .tour-link:not(.qms-due) { color:var(--green); }

.classic-recipe-panel { margin-top:12px; overflow:hidden; }
.classic .classic-recipe-bar.panel-head { padding:6px 12px; background:#fff; border-bottom:1px solid var(--line); }
.classic-recipe-panel .recipe-editor, .classic-recipe-panel .classic-empty { border:0; border-radius:0; box-shadow:none; }
.classic-patient-qms { padding:6px 12px 0; }
.page-heading.compact-heading { margin-bottom:12px; gap:0; }
.page-heading.compact-heading .eyebrow,
.page-heading.compact-heading h1 { font-size:16px; line-height:1.4; margin:0; font-weight:600; letter-spacing:0; }
.page-heading.compact-heading .eyebrow { text-transform:none; }
.positions-empty { padding:14px 0; margin:0; color:var(--muted); font-size:13px; }
.position-actions { justify-content:flex-end; margin-top:10px; }
.section-heading h3:has(#position-count) { white-space:nowrap; }
.positions td > .substance-info { display:block; margin-top:3px; }
/* Checkbox + label form one horizontal control in every view/language. */
label:has(> input[type="checkbox"]) {
  display:flex; flex-direction:row; flex-wrap:nowrap; align-items:flex-start; gap:8px;
}
:root body label > input[type="checkbox"] {
  flex:0 0 18px; width:18px; height:18px; min-height:18px; margin:0; padding:0;
}
label:has(> input[type="checkbox"]) > span { min-width:0; }
.classic .editor-head { padding-right:12px; padding-left:12px; }
.editor-head .actions { margin-left:auto; justify-content:flex-end; }

@media (max-width:780px) {
  .page-heading { flex-wrap:wrap; }
  .page-heading > div:first-child { flex:1 0 100%; min-width:0; }
  .page-heading .stats { width:100%; justify-content:space-between; }
  .page-heading .stats > div:first-child { display:block; }
  .patient-list, #dialog-body .dialog-list { max-height:none; overflow:visible; }
  /* Prevent iOS focus zoom in searches and editors as well as the login. */
  :root body input, :root body select, :root body textarea {
    font-size:max(16px, 1rem);
  }
}
@media (max-width:600px) {
  .editor-body > .form-grid > *, .editor-body > .form-grid label { min-width:0; }
  .editor-body > .form-grid > :has(#f-date) { grid-column:1 / -1; }
  .editor-body input[type="date"] {
    display:block; width:100%; min-width:0; max-width:100%; height:40px;
    appearance:none; -webkit-appearance:none; box-sizing:border-box;
  }
  .editor-body input[type="date"]::-webkit-date-and-time-value { min-width:0; text-align:left; }
  .editor-body textarea { resize:none; }
  #classic-patient > .panel-head { gap:8px; }
  #classic-patient > .panel-head h3 { flex:0 0 auto; }
  #classic-patient > .panel-head .actions { justify-content:flex-end; gap:5px; }
  .classic .classic-head-fields { grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .classic .classic-head-fields > :has(#f-date),
  .classic .classic-head-fields > .span-all { grid-column:1 / -1; }
  .classic-head-fields > *, .classic-head-fields label { min-width:0; }
  .classic-head-fields input, .classic-head-fields select {
    width:100%; min-width:0; max-width:100%; height:40px;
  }
  .classic-head-fields input[type="date"] { appearance:none; -webkit-appearance:none; }
  .classic-head-fields input[type="date"]::-webkit-date-and-time-value { text-align:left; }
  .classic .editor-head .actions { margin-left:auto; }
  /* A single page scroll on phones; no hidden, nested position scroller. */
  .classic .editor-section .table-scroll { max-height:none; overflow:visible; }
  .positions { table-layout:fixed; }
  .positions .code { width:52px; }
  .positions .quantity { width:88px; }
  .positions .row-actions { width:32px; }
  .positions:has(td.row-actions:empty) .row-actions { display:none; }
  .positions.positions-locked .row-actions { display:none; }
  .classic .positions th, .classic .positions td { padding:6px 4px; }
  .positions .substance-title { flex-wrap:nowrap; align-items:flex-start; gap:4px; }
  .positions .substance-title strong { min-width:0; overflow-wrap:anywhere; }
  .classic .positions .substance-info, .positions .substance-info {
    flex:0 0 26px; width:26px; height:26px; padding:2px; font-size:14px; line-height:20px;
  }
  .classic .positions td small, .positions td small {
    display:block; margin:3px 0 0; overflow-wrap:anywhere;
  }
  .positions .quantity-wrap { gap:3px; min-width:0; }
  .positions .quantity-wrap input { width:100%; min-width:0; flex:1; padding:5px 3px; }
  .positions .quantity-wrap .unit { flex:0 0 auto; }
}
