.wiki-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.wiki-toolbar > a { flex-shrink: 0; }
.wiki-toolbar > button { width: auto; flex: 0 0 auto; }
.wiki-status { color: var(--ink-soft); font-size: var(--text-sm); margin: 1rem 0; }
.wiki-layout { display: grid; grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.wiki-sidebar { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-panel); padding: 1rem; }
.wiki-sidebar label { display: grid; gap: .5rem; font-weight: 650; }
.wiki-sidebar input { width: 100%; min-width: 0; min-height: 2.75rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: .5rem .65rem; font: inherit; color: var(--ink); background: var(--surface-panel); }
.wiki-sidebar ul { list-style: none; padding: 0; margin: 1rem 0 0; }
.wiki-sidebar a { display: block; padding: .65rem .5rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink-muted); }
.wiki-sidebar a[aria-current="page"] { background: var(--surface-tint); color: var(--brand-deep); font-weight: 750; }
.wiki-article { min-width: 0; padding: clamp(1rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-panel); line-height: 1.8; overflow-wrap: anywhere; }
.wiki-article > :first-child { margin-top: 0; }
.wiki-article h2, .wiki-article h3, .wiki-article h4 { line-height: 1.4; margin-top: 1.8rem; scroll-margin-top: 6rem; }
.wiki-article li { margin: .45rem 0; }
.wiki-article a, .wiki-toolbar a { color: var(--brand); text-underline-offset: .2em; }
.wiki-article code { font-size: .86em; background: var(--surface-tint); padding: .1em .25em; border-radius: .2rem; }
.wiki-article pre { max-width: 100%; overflow-x: auto; padding: 1rem; background: var(--surface-subtle); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.wiki-article pre code { padding: 0; background: transparent; }
.wiki-table-scroll { max-width: 100%; overflow-x: auto; }
.wiki-article table { width: 100%; border-collapse: collapse; font-size: .92em; }
.wiki-article th, .wiki-article td { min-width: 9rem; padding: .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.wiki-article th { background: var(--surface-subtle); }
.wiki-article blockquote { margin-inline: 0; padding-left: 1rem; border-left: 3px solid var(--line-strong); color: var(--ink-muted); }
.wiki-source-path { color: var(--ink-soft); }
.wiki-content { min-width: 0; display: grid; gap: 1rem; }
.wiki-sidebar summary, .wiki-content summary { cursor: pointer; font-weight: 700; padding: .35rem 0; }
.wiki-sidebar details[open] > label { margin-top: 1rem; }
.wiki-toc, .wiki-context { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-panel); }
.wiki-toc nav { display: grid; gap: .5rem; padding-top: .75rem; }
.wiki-toc a { color: var(--brand); overflow-wrap: anywhere; }
.wiki-context label { display: grid; gap: .5rem; margin: 1rem 0; }
.wiki-context select, .wiki-context textarea { width: 100%; min-width: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: .65rem; color: var(--ink); background: var(--surface-panel); font: inherit; }
.wiki-context select { min-height: 2.75rem; }
.wiki-context textarea { font-size: var(--text-sm); line-height: 1.6; resize: vertical; }
.wiki-context button { width: auto; }
@media (max-width: 64rem) {
  .wiki-layout { grid-template-columns: minmax(0, 1fr); }
  .wiki-sidebar ul { display: flex; flex-wrap: wrap; gap: .25rem; }
  .wiki-sidebar a { border: 1px solid var(--line-soft); }
}

@font-face {
  font-family: "Pretendard Variable";
  font-style: normal;
  font-weight: 45 920;
  font-display: swap;
  src: url("/assets/pretendard-variable.9599f12fd42f.woff2") format("woff2-variations");
}

:root {
  color-scheme: light;
  --header-h: 4.5rem;
  --tap: 2.75rem;

  --surface-page: #f3f7f5;
  --surface-panel: #ffffff;
  --surface-subtle: #f9fcfb;
  --surface-tint: #eaf5f1;
  --surface-tint-strong: #e7f5ef;
  --line-soft: #e1e9e6;
  --line: #d2e1dc;
  --line-strong: #a9c6bd;
  --ink: #17332f;
  --ink-strong: #294b45;
  --ink-muted: #315e55;
  --ink-soft: #546b66;
  --ink-faint: #71827e;
  --ink-inverse: #f8fffc;
  --brand-deep: #123e37;
  --brand: #0d695b;
  --brand-strong: #0d5a4f;
  --brand-mid: #2c7667;
  --brand-soft: #9ce2c8;
  --warn-ink: #6c4b0b;
  --warn-line: #e2c982;
  --warn-surface: #fff9e9;
  --warn-surface-strong: #fff0c7;
  --danger-ink: #a13c33;
  --danger-ink-strong: #7d3e35;
  --danger-surface: #f8e8e5;

  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-base: 0.9375rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.15rem, 2.5vw, 1.5rem);
  --text-title: clamp(1.35rem, 3vw, 1.9rem);
  --text-display: clamp(1.6rem, 4vw, 2.25rem);

  --radius-xs: 0.4rem;
  --radius-sm: 0.55rem;
  --radius-md: 0.7rem;
  --radius-lg: 0.85rem;
  --radius-xl: 1.1rem;
  --radius-pill: 999px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: var(--surface-page);
  font-synthesis: none;
}

dialog {
  box-sizing: border-box;
  max-width: calc(100vw - 1rem);
  max-height: calc(100dvh - 1rem);
  overflow: auto;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  overflow-x: clip;
}

body {
  background:
    radial-gradient(circle at 100% 0, rgba(74, 154, 137, 0.12), transparent 24rem),
    var(--surface-page);
}

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

button,
input,
select,
a,
textarea {
  min-width: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible,
.table-scroll:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

button,
input[type="file"],
input[type="checkbox"],
select,
summary {
  min-height: 2.75rem;
}

h1,
h2,
p,
dd,
dt,
span,
button,
label {
  overflow-wrap: anywhere;
  word-break: keep-all;
}

code {
  overflow-wrap: anywhere;
}

pre,
code,
.queue-item,
.import-list-button {
  max-width: 100%;
}

pre {
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  min-height: var(--header-h);
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  color: var(--ink-inverse);
  background: var(--brand-deep);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-block,
.header-identity,
.brand-copy {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-block {
  gap: 0.75rem;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  color: var(--brand-deep);
  font-weight: 800;
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
}

.brand-copy {
  align-items: flex-start;
  flex-direction: column;
  line-height: 1.15;
}

.brand-copy strong {
  font-size: var(--text-md);
  letter-spacing: 0.02em;
}

.brand-copy span,
.header-identity > span {
  color: var(--line);
  font-size: var(--text-sm);
}

.header-identity {
  gap: 0.9rem;
  margin-left: auto;
}

.quiet-button,
.nav-toggle {
  min-height: 2.5rem;
  padding: 0.55rem 0.85rem;
  color: var(--ink-inverse);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
}

.nav-toggle {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  padding-inline: 0;
}

.nav-toggle-icon {
  position: relative;
  display: block;
  width: 1.15rem;
  height: 0.9rem;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 160ms ease, top 160ms ease, box-shadow 160ms ease;
  content: "";
}

.nav-toggle-icon::before {
  top: 0;
  box-shadow: 0 0.4rem 0 currentColor;
}

.nav-toggle-icon::after {
  top: 0.8rem;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
  top: 0.4rem;
  transform: rotate(45deg);
  box-shadow: none;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
  top: 0.4rem;
  transform: rotate(-45deg);
}

.startup-view,
.centered-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  min-height: calc(100dvh - var(--header-h));
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
}

.startup-view p {
  color: var(--ink-soft);
}

.login-card,
.message-card {
  width: min(100%, 29rem);
  min-width: 0;
  padding: clamp(1.35rem, 5vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1.2rem 3.5rem rgba(19, 62, 55, 0.1);
}

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

.login-card h1,
.message-card h1,
.welcome-panel h1 {
  margin: 0;
  color: var(--ink);
  line-height: 1.25;
}

.login-card h1,
.message-card h1,
.welcome-panel h1 {
  font-size: var(--text-display);
}

.supporting-copy,
.message-card > p:not(.eyebrow),
.shell-ready-message,
.authority-note {
  color: var(--ink-soft);
  line-height: 1.65;
}

.login-card form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.05rem;
  margin-top: 1.6rem;
}

.field-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.45rem;
  min-width: 0;
}

.field-group label {
  color: var(--ink-strong);
  font-size: var(--text-base);
  font-weight: 700;
}

.field-group input {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.8rem;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
}

.remember-device {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
  min-width: 0;
  padding: 0.25rem 0;
}

.checkbox-field {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  min-width: 0;
}

.checkbox-field input {
  flex: 0 0 1.15rem;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--brand);
}

.checkbox-field label {
  min-width: 0;
  color: var(--ink-strong);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.25;
}

.checkbox-field input:disabled + label {
  opacity: 0.65;
}

.primary-button {
  min-height: 2.85rem;
  padding: 0.7rem 1rem;
  color: var(--surface-panel);
  font-weight: 700;
  border: 1px solid var(--brand-strong);
  border-radius: var(--radius-md);
  background: var(--brand);
  cursor: pointer;
}

.primary-button:hover {
  background: var(--brand-strong);
}

.primary-button:disabled,
.quiet-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.full-width {
  width: 100%;
}

.form-status,
.workspace-status {
  min-height: 1.5rem;
  margin: 1rem 0 0;
  color: var(--danger-ink);
  font-size: var(--text-base);
  line-height: 1.5;
}

#medicine-center-status[data-tone="info"] {
  color: var(--ink-muted);
}

#medicine-center-status[data-tone="success"] {
  color: #176347;
}

#medicine-center-status[data-tone="error"] {
  color: var(--danger-ink);
}

.application-layout {
  display: grid;
  grid-template-columns: minmax(13rem, 16rem) minmax(0, 1fr);
  align-items: start;
  min-width: 0;
  min-height: calc(100dvh - var(--header-h));
}

html.has-collapsed-nav .application-layout {
  grid-template-columns: minmax(0, 1fr);
}

html.has-collapsed-nav .primary-navigation {
  display: none;
}

html.has-collapsed-nav .nav-toggle {
  display: inline-flex;
}

.primary-navigation,
.workspace,
.welcome-panel,
.nav-list,
.nav-list li,
.nav-list button {
  min-width: 0;
}

.primary-navigation {
  position: sticky;
  display: flex;
  flex-direction: column;
  top: var(--header-h);
  align-self: start;
  min-height: calc(100dvh - var(--header-h));
  max-height: calc(100dvh - var(--header-h));
  padding: 0.9rem 0.85rem 1.4rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  color: var(--line-soft);
  background: var(--brand-deep);
}

.nav-controls {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 0.8rem;
  background: var(--brand-deep);
}

.nav-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  min-height: 2.25rem;
  padding: 0;
  color: var(--line-soft);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.nav-collapse:hover {
  color: var(--surface-panel);
  border-color: rgba(156, 226, 200, 0.5);
  background: rgba(156, 226, 200, 0.15);
}

.nav-collapse-icon {
  position: relative;
  display: block;
  width: 0.62rem;
  height: 0.62rem;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  border-bottom-left-radius: 2px;
  transform: rotate(45deg);
}

.nav-group + .nav-group {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-heading {
  margin: 0;
  padding: 0 0.55rem 0.75rem;
  color: var(--line-strong);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.planned-label {
  flex: 0 0 auto;
  padding: 0.18rem 0.42rem;
  color: var(--line-strong);
  font-size: var(--text-xs);
  border: 1px solid rgba(184, 211, 203, 0.25);
  border-radius: var(--radius-pill);
}

.nav-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.85rem;
  padding: 0.65rem 0.7rem;
  color: var(--line-soft);
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
}

.nav-list button:disabled {
  opacity: 0.8;
}

.nav-parent-row {
  position: relative;
  display: flex;
  min-height: 2.85rem;
  color: var(--line-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
}

.nav-parent-row #medicine-parent-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 2.9rem;
  color: inherit;
  border: 0;
  background: transparent;
}

.nav-parent-row .nav-parent-caret {
  position: absolute;
  inset: 0 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 2.2rem;
  min-height: 0;
  justify-content: center;
  padding: 0;
  color: inherit;
  border: 0;
  background: transparent;
}

.nav-parent-row:not(:has(.contains-active)):hover {
  color: var(--surface-panel);
  border-color: rgba(156, 226, 200, 0.5);
  background: rgba(156, 226, 200, 0.15);
}

.nav-parent-row #medicine-parent-nav:hover,
.nav-parent-row #medicine-parent-caret:hover {
  color: inherit;
  border: 0;
  background: transparent;
}

.nav-parent-row .nav-parent-caret:hover span {
  opacity: 0.7;
}

.nav-parent-row #medicine-parent-nav:focus-visible,
.nav-parent-row .nav-parent-caret:focus-visible {
  outline: none;
}

.nav-parent-row:has(:focus-visible) {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

.nav-parent-caret span {
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
}

.nav-parent-caret[aria-expanded="true"] span {
  transform: rotate(225deg) translate(-2px, -2px);
}

.nav-parent-row #medicine-parent-nav.contains-active {
  font-weight: 700;
}

html.has-collapsed-nav .nav-parent-caret {
  display: none;
}

.nav-sublist[hidden] {
  display: none;
}

.nav-sublist {
  padding-inline-start: 0.6rem;
  border-inline-start: 1px solid rgba(184, 211, 203, 0.25);
  margin-inline-start: 0.7rem;
}

.nav-alert-badge {
  flex: 0 0 auto;
  padding: 0.1rem 0.45rem;
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--danger-ink-strong);
  border-radius: var(--radius-pill);
  background: var(--danger-surface);
}

.nav-alert-badge[hidden] {
  display: none;
}

.nav-list button:not(:disabled) {
  cursor: pointer;
}

.nav-list button:not(:disabled):hover,
.nav-list button.is-active {
  color: var(--surface-panel);
  border-color: rgba(156, 226, 200, 0.5);
  background: rgba(156, 226, 200, 0.15);
}

.workspace:has(> .materials-matching-section:not([hidden])) {
  max-width: none;
  padding-inline: clamp(0.75rem, 1.6vw, 1.5rem);
}

.workspace {
  container-type: inline-size;
  container-name: workspace;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 1rem;
  width: 100%;
  max-width: 88rem;
  margin-inline: auto;
  padding: clamp(1rem, 4vw, 3rem);
}

.shell-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  min-width: 0;
}

.welcome-panel {
  padding: clamp(1.25rem, 4vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.9);
}

.welcome-panel {
  background:
    linear-gradient(135deg, rgba(160, 225, 201, 0.22), transparent 50%),
    rgba(255, 255, 255, 0.92);
}

.shell-ready-message {
  max-width: 52rem;
  margin: 1rem 0 0;
}

.authority-note {
  margin: 1.1rem 0 0;
  padding-top: 1rem;
  font-size: var(--text-sm);
  border-top: 1px solid var(--line-soft);
}

.order-import-workspace,
.prescription-source-workspace,
#medicine-center-root,
.data-workspace-bar,
.data-workspace-tabs,
.order-import-heading,
.import-card,
.import-browser,
.section-heading,
.file-picker-row,
.upload-result,
.upload-result-heading,
.compact-metadata,
.import-list,
.import-list li,
.import-list-button,
.import-list-heading,
.import-detail-panel,
.import-metadata,
.issue-section,
.issue-list,
.shadow-row-section,
.table-scroll,
.lineage-list,
.prescription-source-metadata-fields,
.phi-attestation {
  min-width: 0;
}

.order-import-workspace,
.prescription-source-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.data-workspace-bar {
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.88);
}

.data-workspace-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
}

.data-workspace-tabs button {
  min-height: 2.75rem;
  padding: 0.6rem 0.85rem;
  color: var(--ink-soft);
  font: inherit;
  font-size: var(--text-base);
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
}

.data-workspace-tabs button:hover {
  background: var(--surface-tint);
}

.data-workspace-tabs button[aria-selected="true"] {
  color: #174d43;
  border-color: #87b9ab;
  background: var(--surface-tint-strong);
}

.medicine-center-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
}

.medicine-center-tabs button {
  flex: 1 0 max-content;
}

.numbered-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-top: 1rem;
}

.numbered-pagination button {
  min-width: 2.75rem;
}

.numbered-pagination button[aria-current="page"] {
  color: var(--surface-panel);
  border-color: var(--brand-strong);
  background: var(--brand);
}

.health-kr-search {
  display: inline-flex;
  margin-top: 0.75rem;
}

.health-kr-search button {
  width: auto;
}

.order-import-heading,
.section-heading,
.upload-result-heading,
.import-list-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.order-import-heading > *,
.section-heading > *,
.upload-result-heading > *,
.import-list-heading > * {
  min-width: 0;
}

.order-import-heading h1,
.section-heading h2,
.section-heading h3,
.issue-section h3 {
  margin: 0;
  color: var(--ink);
  line-height: 1.3;
}

.order-import-heading h1 {
  font-size: var(--text-display);
}

.order-import-heading p:not(.eyebrow),
.section-heading p,
.import-card > p,
.shadow-row-section .section-heading p {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-size: var(--text-base);
  line-height: 1.6;
}

.quiet-light-button {
  flex: 0 0 auto;
  min-height: 2.55rem;
  padding: 0.55rem 0.8rem;
  color: var(--ink-muted);
  font: inherit;
  font-size: var(--text-base);
  font-weight: 700;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
  cursor: pointer;
}

.quiet-light-button:hover {
  background: var(--surface-tint);
}

.quiet-light-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.shadow-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.35rem 0.9rem;
  min-width: 0;
  padding: 0.95rem 1rem;
  color: #5a430f;
  font-size: var(--text-base);
  line-height: 1.55;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-lg);
  background: var(--warn-surface);
}

.shadow-notice strong {
  white-space: nowrap;
}

.import-card {
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0.55rem 1.8rem rgba(20, 64, 56, 0.05);
}

#order-import-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1.15rem;
}

#prescription-source-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1.15rem;
}

.prescription-source-metadata-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(12rem, 0.65fr);
  gap: 0.85rem;
  align-items: start;
}

.field-help {
  min-width: 0;
  margin: 0;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.optional-label {
  margin-left: 0.25rem;
  color: var(--ink-faint);
  font-size: var(--text-xs);
  font-weight: 600;
}

.prescription-source-file-admission,
.order-import-file-admission {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 0.85fr);
  gap: 0.85rem;
  align-items: stretch;
}

.prescription-source-drop-target,
.order-import-drop-target {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-content: center;
  gap: 0.35rem;
  min-height: 7rem;
  padding: 1rem;
  color: var(--ink-muted);
  font: inherit;
  text-align: center;
  border: 2px dashed #8db2a8;
  border-radius: var(--radius-lg);
  background: var(--surface-page);
  cursor: pointer;
}

.prescription-source-drop-target span,
.order-import-drop-target span {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.prescription-source-drop-target:hover,
.prescription-source-drop-target.is-dragging,
.order-import-drop-target:hover,
.order-import-drop-target.is-dragging {
  border-color: var(--brand-mid);
  background: var(--surface-tint-strong);
}

.prescription-source-drop-target:disabled,
.order-import-drop-target:disabled {
  color: var(--ink-faint);
  border-color: var(--line);
  background: var(--surface-page);
  cursor: not-allowed;
}

.prescription-source-queue-panel,
.order-import-queue-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
}

.prescription-source-batch-panel {
  margin-top: 1rem;
}

.prescription-source-batch-list > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.prescription-source-batch-outcomes {
  margin: 0;
}

.prescription-format-mapping-panel {
  overflow: hidden;
}

.prescription-format-coordinate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 0.9rem;
  margin-block: 1rem;
}

.prescription-format-coordinate-grid label {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
  min-width: 0;
}

.prescription-format-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-block: 1rem;
  min-width: 0;
}

.prescription-format-header-scroll {
  max-height: 18rem;
}

.prescription-format-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block: 1rem;
}

.prescription-format-mapping-panel .digest-value,
.prescription-format-mapping-panel select,
.prescription-format-mapping-panel option {
  overflow-wrap: anywhere;
  min-width: 0;
  max-width: 100%;
}

.status-complete {
  color: var(--brand-strong);
  background: var(--surface-tint-strong);
}

.status-awaiting_files {
  color: var(--warn-ink);
  background: var(--warn-surface-strong);
}

.queue-heading,
.queue-item-heading,
.queue-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

/* Without wrapping, a narrow column shrinks each button below its label and
   the text breaks one character per line. */
.queue-actions {
  flex-wrap: wrap;
}

.queue-actions > button {
  flex: 0 1 auto;
  min-width: max-content;
}

.queue-heading h3,
.queue-heading p,
.queue-item-message {
  margin: 0;
}

.queue-heading p,
.queue-file-size,
.queue-item-message {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.prescription-source-queue,
.order-import-queue {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
  min-width: 0;
  margin: 0;
  padding-left: 1.65rem;
}

.queue-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem 0.75rem;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
}

.queue-item-heading,
.queue-progress,
.queue-item-message {
  grid-column: 1;
  min-width: 0;
}

.queue-filename {
  min-width: 0;
  overflow-wrap: anywhere;
}

.queue-file-size {
  flex: 0 0 auto;
}

.queue-state {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  padding: 0.2rem 0.45rem;
  color: var(--ink-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
  border-radius: var(--radius-pill);
  background: var(--surface-tint);
}

.queue-state-rejected,
.queue-state-stopped,
.queue-state-failed,
.queue-state-outcome_unknown {
  color: var(--danger-ink-strong);
  background: var(--danger-surface);
}

.queue-progress {
  display: grid;
  grid-template-columns: minmax(5rem, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
}

.queue-progress progress {
  width: 100%;
}

.queue-progress-text {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.queue-remove-button {
  grid-column: 2;
  align-self: end;
  min-height: 2rem;
  padding: 0.3rem 0.6rem;
  color: var(--ink-soft);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  border: 1px solid #bdcfca;
  border-radius: var(--radius-xs);
  background: var(--surface-panel);
  cursor: pointer;
}

.queue-remove-button:disabled {
  color: #899692;
  cursor: not-allowed;
}

.order-import-queue-item .queue-item-message {
  overflow-wrap: anywhere;
}

.queue-result-metadata {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
  min-width: 0;
  margin: 0;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--surface-page);
}

.queue-result-metadata div {
  display: grid;
  grid-template-columns: minmax(5rem, auto) minmax(0, 1fr);
  gap: 0.65rem;
  min-width: 0;
}

.queue-result-metadata dt {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 700;
}

.queue-result-metadata dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: var(--text-sm);
}

.queue-item-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  min-width: 0;
}

.queue-item-actions .queue-remove-button,
.queue-retry-button {
  grid-column: auto;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
}

.queue-retry-button {
  color: var(--ink-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface-page);
  cursor: pointer;
}

.queue-retry-button:disabled {
  color: #899692;
  cursor: not-allowed;
}

.phi-attestation {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.45rem;
  padding: 0.9rem;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-md);
  background: var(--warn-surface);
}

.phi-attestation > p {
  min-width: 0;
  margin: 0 0 0 1.9rem;
  color: #716644;
  font-size: var(--text-sm);
  line-height: 1.55;
}

.queue-actions {
  justify-content: flex-end;
}

.file-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: end;
}

.file-field input {
  padding: 0.45rem;
  line-height: 1.55;
}

.file-field input::file-selector-button {
  min-height: 2.15rem;
  margin-right: 0.75rem;
  padding: 0.4rem 0.7rem;
  color: var(--ink-strong);
  font: inherit;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-page);
  cursor: pointer;
}

.upload-progress {
  display: grid;
  grid-template-columns: auto minmax(8rem, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.9rem;
  color: var(--ink-muted);
  font-size: var(--text-sm);
}

.upload-progress progress {
  width: 100%;
  accent-color: var(--brand);
}

.upload-result {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #b9dacf;
  border-radius: var(--radius-lg);
  background: var(--surface-tint);
}

.upload-result > p {
  margin: 0.65rem 0;
  color: var(--ink-muted);
  font-size: var(--text-base);
  line-height: 1.55;
}

.compact-metadata,
.import-metadata,
.lineage-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.55rem;
  margin: 0;
}

.compact-metadata div,
.import-metadata div,
.lineage-list div {
  display: grid;
  grid-template-columns: minmax(7rem, 0.4fr) minmax(0, 1fr);
  gap: 0.75rem;
  min-width: 0;
}

.compact-metadata dt,
.import-metadata dt,
.lineage-list dt {
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.compact-metadata dd,
.import-metadata dd,
.lineage-list dd {
  min-width: 0;
  margin: 0;
  color: var(--ink-strong);
  font-size: var(--text-base);
  font-weight: 600;
}

.digest-value dd,
.identifier-value dd,
.import-list-digest {
  overflow-wrap: anywhere;
  word-break: break-all;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: var(--text-sm);
}

.import-browser {
  display: grid;
  grid-template-columns: minmax(16rem, 0.75fr) minmax(0, 1.6fr);
  gap: 1rem;
  align-items: start;
}

.import-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
}

.import-list-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
  width: 100%;
  padding: 0.8rem;
  color: var(--ink-strong);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  cursor: pointer;
}

.import-list-button:hover,
.import-list-button.is-selected {
  border-color: #5c9d8e;
  background: var(--surface-tint);
}

.filename-value {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.import-list-heading .filename-value {
  display: block;
  flex: 1 1 auto;
}

.import-list-time,
.import-list-counts,
.import-list-digest,
.duplicate-label {
  color: var(--ink-faint);
  font-size: var(--text-sm);
}

.duplicate-label {
  width: max-content;
  max-width: 100%;
  padding: 0.18rem 0.45rem;
  color: #5e4511;
  border-radius: var(--radius-pill);
  background: var(--warn-surface-strong);
}

.status-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 1.65rem;
  padding: 0.22rem 0.55rem;
  font-size: var(--text-sm);
  font-weight: 800;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
}

.status-review_required {
  color: var(--warn-ink);
  border-color: #e2c46c;
  background: var(--warn-surface-strong);
}

.status-quarantined {
  color: #79431e;
  border-color: #dfa879;
  background: var(--warn-surface);
}

.status-rejected_with_reason {
  color: #812f2f;
  border-color: #dda0a0;
  background: var(--danger-surface);
}

.listing-status {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  padding: 0.22rem 0.5rem;
  overflow-wrap: anywhere;
  color: var(--ink-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-tint);
}

.listing-status-exact_duplicate {
  color: #4d531e;
  border-color: #cbd28a;
  background: var(--warn-surface);
}

.listing-status-identifier_conflict,
.listing-conflict-cross_provenance_identifier_conflict {
  color: #812f2f;
  border-color: #dda0a0;
  background: var(--danger-surface);
}

.listing-status-abstain {
  color: #5a4a70;
  border-color: #cbb9dc;
  background: #f6f0fb;
}

.panel-status {
  min-height: 1.35rem;
  margin: 0.75rem 0 0;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.keyboard-shortcuts {
  margin: 0;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.matching-comparison {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.matching-review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 31rem), 1fr));
  gap: 0.75rem;
  align-items: start;
  margin-top: 0.75rem;
}

.review-action-help {
  margin-top: 0.8rem;
  color: var(--ink-muted);
  font-size: var(--text-sm);
}

.review-action-help summary {
  color: var(--ink-strong);
  font-weight: 700;
  cursor: pointer;
}

.review-action-help .import-list {
  margin-top: 0.5rem;
}

.matching-review-grid > .import-card {
  min-width: 0;
  margin: 0;
  scroll-margin-block: 1.5rem;
}

.matching-review-summary,
.matching-review-card {
  padding: 0.9rem 1rem;
}

.matching-review-summary > h2,
.matching-review-card > h2 {
  margin: 0;
  font-size: var(--text-xl);
  line-height: 1.25;
}

.matching-review-summary > .panel-status,
.matching-review-card > .panel-status {
  margin-top: 0.25rem;
}

.review-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(8rem, 1fr));
  gap: 0.5rem 0.65rem;
  align-items: end;
  min-width: 0;
  margin-top: 0.65rem;
}

.review-filter-grid label,
.matching-review-size {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.2rem;
  min-width: 0;
  color: var(--ink-muted);
  font-size: var(--text-xs);
  font-weight: 700;
}

.review-filter-grid input,
.review-filter-grid select,
.matching-review-size select {
  width: 100%;
  min-width: 0;
  min-height: 2.25rem;
  padding: 0.35rem 0.5rem;
  color: var(--brand-deep);
  font: inherit;
  font-size: var(--text-sm);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-panel);
}

.review-query-field {
  grid-column: span 2;
}

.review-filter-apply {
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  font-size: var(--text-sm);
}

.matching-review-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  align-items: end;
  margin-top: 0.6rem;
}

.matching-review-toolbar > .panel-status,
.matching-auto-note {
  min-height: 0;
  margin: 0;
  font-size: var(--text-sm);
}

.matching-review-size {
  grid-template-columns: auto auto;
  align-items: center;
}

.matching-review-size select {
  width: auto;
}

.matching-auto-note {
  color: var(--brand-strong);
  font-weight: 700;
}

.matching-review-card .comparison-field,
.matching-review-card .comparison-value {
  padding: 0.45rem 0.55rem;
  font-size: var(--text-sm);
}

.matching-review-selection,
.matching-review-raw-summary {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin: 0.45rem 0 0;
  font-size: var(--text-sm);
}

.matching-review-raw-summary {
  flex-wrap: wrap;
  color: var(--ink-muted);
}

.matching-review-bulk {
  margin-top: 0.65rem;
}

.supplier-unsupported-details,
.supplier-saved-products,
.supplier-product-more {
  margin-top: 0.6rem;
}

.supplier-saved-products > summary,
.supplier-unsupported-details > summary,
.supplier-product-more > summary {
  cursor: pointer;
  font-weight: 700;
}

.order-status-original {
  display: block;
  color: var(--ink-muted);
  font-size: var(--text-xs);
}

.matching-review-actions,
.candidate-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
}

.matching-review-actions {
  margin-top: 0.65rem;
}

.matching-review-actions > button,
.candidate-switch > button {
  flex: 0 1 auto;
  width: auto;
  min-width: max-content;
  min-height: 2.25rem;
  padding: 0.35rem 0.65rem;
  font-size: var(--text-sm);
}

.manual-match-search {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line-soft);
}

.manual-match-search summary {
  color: var(--ink-strong);
  font-weight: 700;
  cursor: pointer;
}

.manual-match-search .queue-actions {
  margin-top: 0.7rem;
}

.manual-match-search input {
  min-width: 0;
  flex: 1 1 14rem;
}

.manual-match-search select {
  min-width: 8rem;
  flex: 0 1 12rem;
}

.manual-match-results .import-list {
  margin-top: 0.65rem;
}

.medicine-matching-search-form {
  justify-content: flex-start;
}

.medicine-matching-search-form input {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  flex: 1 1 20rem;
  padding: 0.5rem 0.7rem;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
}

.medicine-matching-search-form > button {
  min-height: 2.75rem;
  padding-block: 0.5rem;
}

.medicine-match-tab-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
  border-bottom: 1px solid var(--line-strong);
}

.medicine-match-tab-list {
  display: flex;
  align-items: flex-end;
  gap: 0.2rem;
  min-width: 0;
}

.medicine-match-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.45rem;
  margin-bottom: -1px;
  padding: 0.45rem 0.8rem;
  color: var(--ink-soft);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 800;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--surface-tint);
  cursor: pointer;
}

.medicine-match-tab-count {
  min-width: 1.45rem;
  padding: 0.08rem 0.38rem;
  color: var(--ink-soft);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  text-align: center;
  border-radius: var(--radius-pill);
  background: var(--surface-panel);
}

.medicine-match-tab:hover,
.medicine-match-tab:focus-visible {
  color: var(--brand-strong);
  border-color: var(--brand-mid);
}

.medicine-match-tab.is-active {
  position: relative;
  z-index: 1;
  color: var(--brand-strong);
  border-color: var(--line-strong);
  border-bottom-color: var(--surface-panel);
  background: var(--surface-panel);
}

.medicine-match-tab.is-active .medicine-match-tab-count {
  color: var(--surface-panel);
  background: var(--brand-strong);
}

.medicine-match-tab-bar .medicine-match-search-summary {
  flex: 0 0 auto;
  margin: 0 0 0.45rem auto;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 700;
  text-align: right;
}

.medicine-card-heading {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.medicine-card-heading > h2 {
  margin: 0;
}

.medicine-card-heading > .queue-actions button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.medicine-more-button,
.medicine-history-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ink-muted);
  border: 1px solid var(--line-strong);
  background: var(--surface-panel);
  cursor: pointer;
}

.medicine-more-button {
  width: 2.5rem;
  min-height: 2.5rem;
  border-radius: var(--radius-pill);
}

.medicine-row-more { min-width: 3.75rem; white-space: nowrap; }
.medicine-detail-dialog {
  width: min(94vw, 44rem);
  max-height: 85vh;
  overflow: auto;
  box-sizing: border-box;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--ink);
  background: var(--surface-panel);
}
.medicine-detail-dialog::backdrop { background: rgb(0 0 0 / 35%); }
.medicine-detail-dialog .queue-actions { flex-wrap: wrap; }
.medicine-link-management,.medicine-link-picker{width:min(92vw,52rem)}
.medicine-link-management-body{display:grid;gap:1rem}
.medicine-link-section{display:grid;gap:.55rem;padding:1rem;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--surface-subtle)}
.medicine-link-section h4{margin:0;font-size:var(--text-base)}
.medicine-link-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.65rem;padding:.55rem 0;border-top:1px solid var(--line-soft)}
.medicine-link-kind{padding:.2rem .5rem;border-radius:var(--radius-pill);background:var(--surface-tint);font-size:var(--text-xs);white-space:nowrap}
.medicine-link-description{min-width:0;overflow-wrap:anywhere}
.medicine-link-sales-option{display:flex;align-items:center;gap:.45rem;margin:.5rem 0}
.medicine-link-preview{margin:.65rem 0;padding:.75rem;border:1px solid var(--brand-mid);border-radius:var(--radius-md);background:var(--surface-tint)}
.medicine-link-preview:empty{display:none}
.medicine-detail-dialog.medicine-link-picker .medicine-match-tab-list{display:none}
@media(max-width:600px){.medicine-link-section{padding:.7rem}.medicine-link-row{grid-template-columns:minmax(0,1fr) auto}.medicine-link-kind{grid-column:1}.medicine-link-description{grid-column:1;grid-row:2}.medicine-link-row>.medicine-detail-row-more{grid-column:2;grid-row:1/3}}

.medicine-more-button:hover,
.medicine-history-toggle:hover {
  color: var(--ink-strong);
  border-color: var(--brand-mid);
  background: var(--surface-tint);
}

.medicine-more-button .medicine-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.medicine-more-menu {
  position: absolute;
  z-index: 4;
  top: calc(100% + 0.4rem);
  right: 0;
  display: grid;
  min-width: 11rem;
  padding: 0.45rem;
  gap: 0.35rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 0.8rem 2rem rgba(7, 38, 32, 0.16);
  background: var(--surface-panel);
}

.medicine-more-menu[hidden] {
  display: none;
}

.medicine-detail-inline-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
  padding: clamp(0.85rem, 2vw, 1.2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-tint);
}

.medicine-detail-inline-workspace[hidden] {
  display: none;
}

.medicine-detail-inline-workspace > h3 {
  margin: 0;
}

.medicine-standard-edit-form,
.medicine-inline-search-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 0.75rem;
}

.medicine-standard-edit-form label,
.medicine-inline-search-form label {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  font-weight: 700;
}

.medicine-standard-edit-form input,
.medicine-standard-edit-form select,
.medicine-inline-search-form input,
.medicine-inline-search-form select {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-panel);
  color: var(--ink-strong);
  font: inherit;
}

.medicine-standard-edit-form .queue-actions,
.medicine-standard-reference-help {
  grid-column: 1 / -1;
}

.medicine-standard-reference-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.medicine-binding-results {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.medicine-binding-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.75rem;
  width: 100%;
  min-height: 0;
  padding: 0.85rem 0.95rem;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-panel);
}

.medicine-binding-result-content {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.medicine-binding-match-button {
  white-space: nowrap;
}

.medicine-binding-result-detail {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 600;
}

.medicine-binding-result-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.medicine-binding-result-title > strong {
  min-width: 0;
  color: var(--ink-strong);
  overflow-wrap: anywhere;
}

.medicine-binding-official-mark {
  flex: 0 0 auto;
  padding: 0.12rem 0.38rem;
  color: var(--brand-strong);
  font-size: var(--text-xs);
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid var(--brand-mid);
  border-radius: var(--radius-pill);
  background: var(--surface-tint-strong);
}

.medicine-binding-result-source {
  color: var(--brand-strong);
  font-size: var(--text-xs);
  font-weight: 750;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.medicine-detail-match-results .medicine-match-search-summary {
  margin: 0.1rem 0 0.45rem;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 700;
}

.medicine-detail-match-results .medicine-binding-results {
  gap: 0.3rem;
}

.medicine-detail-match-results .medicine-binding-result {
  padding: 0.52rem 0.7rem;
  border-radius: var(--radius-md);
}

.medicine-detail-match-results .medicine-binding-result-title > strong {
  font-size: var(--text-sm);
}

.medicine-detail-match-results .medicine-binding-result-detail {
  font-size: var(--text-xs);
  font-weight: 500;
}

.medicine-detail-match-results .medicine-match-pagination {
  margin-top: 0.55rem;
}

.medicine-binding-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.medicine-binding-source {
  padding: 0.2rem 0.48rem;
  color: var(--brand-strong);
  font-size: var(--text-xs);
  font-weight: 800;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-tint);
}

@media (max-width: 48rem) {
  .medicine-standard-edit-form,
  .medicine-inline-search-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .medicine-standard-edit-form .queue-actions {
    grid-column: auto;
  }
}

.medicine-order-table {
  min-width: 68rem;
}

.medicine-sales-table {
  min-width: 0;
  table-layout: fixed;
}

.medicine-sales-table th,
.medicine-sales-table td {
  overflow-wrap: anywhere;
}

.medicine-sales-table th:last-child {
  width: 10rem;
}

.medicine-sales-table .queue-actions {
  justify-content: flex-end;
}

@media (max-width: 48rem) {
  .medicine-sales-table thead {
    display: none;
  }

  .medicine-sales-table tbody {
    display: block;
  }

  .medicine-sales-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .medicine-sales-table td {
    display: block;
    border: 0;
  }

  .medicine-sales-table td::before {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--ink-muted);
    content: attr(data-label);
  }

  .medicine-sales-table td:last-child {
    grid-column: 1 / -1;
  }
}

.supplier-offer-table-scroll {
  max-height: none;
  overflow-y: visible;
}

.supplier-offer-table {
  min-width: 92rem;
  table-layout: fixed;
}

.supplier-offer-table th:nth-child(1) { width: 3.25rem; }
.supplier-offer-table th:nth-child(2) { width: 18rem; }
.supplier-offer-table th:nth-child(3) { width: 9rem; }
.supplier-offer-table th:nth-child(4) { width: 8rem; }
.supplier-offer-table th:nth-child(5) { width: 14rem; }
.supplier-offer-table th:nth-child(6) { width: 7rem; }
.supplier-offer-table th:nth-child(7) { width: 9rem; }
.supplier-offer-table th:nth-child(8) { width: 10rem; }
.supplier-offer-table th:nth-child(9) { width: 14rem; }
.supplier-offer-table th:nth-child(10) { width: 9rem; }
.supplier-offer-table th:nth-child(11) { width: 7rem; }

.supplier-offer-group + .supplier-offer-group .supplier-offer-primary-row > td {
  border-top: 1px solid var(--line);
}

.supplier-offer-primary-row > td[rowspan] {
  vertical-align: top;
  background: var(--surface-panel);
}

.supplier-offer-toggle-cell {
  text-align: center;
}

.supplier-offer-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  color: var(--brand-strong);
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-panel);
  cursor: pointer;
}

.supplier-offer-toggle:hover {
  border-color: var(--brand-mid);
  background: var(--surface-tint);
}

.supplier-offer-product {
  color: var(--ink-strong);
  overflow-wrap: anywhere;
}

.supplier-offer-product > strong {
  font-weight: 800;
}

.supplier-offer-medicine-link {
  display: inline;
}

.supplier-offer-seller {
  color: var(--ink-strong);
  overflow-wrap: anywhere;
}

.supplier-offer-stock,
.supplier-offer-price,
.supplier-offer-discount-price,
.supplier-offer-confirmed-date {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.supplier-offer-stock.is-sold-out {
  color: var(--danger-ink-strong);
  font-weight: 800;
}

.supplier-offer-price > strong,
.supplier-offer-discount-price > strong {
  color: var(--ink-strong);
  font-weight: 800;
}

.supplier-offer-shipping,
.supplier-offer-list-price,
.supplier-offer-discount-amount {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink-muted);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.supplier-offer-discount-price > strong {
  color: var(--brand-strong);
}

.supplier-offer-conditions span {
  display: block;
  white-space: nowrap;
}

.supplier-offer-conditions span + span {
  margin-top: 0.15rem;
}

.supplier-offer-detail-row[hidden] {
  display: none;
}

.supplier-offer-detail-row > td {
  background: var(--surface-subtle);
}

.supplier-offer-detail-row > td:first-child {
  position: relative;
  padding-left: 1.25rem;
}

.supplier-offer-detail-row > td:first-child::before {
  position: absolute;
  top: 50%;
  left: 0.35rem;
  width: 0.55rem;
  height: 1px;
  content: "";
  background: var(--line-strong);
}

.order-inventory-excluded > td,
.order-history-mobile-item.order-inventory-excluded {
  color: var(--ink-soft);
  text-decoration: line-through;
  opacity: 0.68;
}

.order-inventory-exclusion {
  display: block;
  margin-top: 0.2rem;
  color: var(--danger-ink);
  font-size: var(--text-xs);
  font-weight: 800;
}

.medicine-package-table {
  margin-top: 0.75rem;
}

.medicine-order-package-group th {
  padding-block: 0.65rem;
  color: var(--brand-strong);
  font-weight: 850;
  text-align: left;
  background: var(--surface-tint);
}

.medicine-order-link {
  min-height: 0;
  padding: 0;
  color: var(--brand);
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.medicine-history-table {
  min-width: 64rem;
  table-layout: fixed;
}

.medicine-history-table th:nth-child(2) {
  width: 10.5rem;
}

.medicine-history-table th:last-child {
  width: 9rem;
}

.medicine-history-table td {
  overflow-wrap: anywhere;
}

.medicine-history-code {
  display: block;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

.medicine-history-table th:first-child,
.medicine-history-table td:first-child {
  width: 3.4rem;
  text-align: center;
}

.medicine-history-time {
  width: 10.5rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.medicine-history-action {
  width: auto;
}

.medicine-history-menu .medicine-order-link {
  display: block;
  margin: 0 0 0.4rem auto;
  white-space: nowrap;
}

.medicine-history-toggle {
  width: 2rem;
  min-height: 2rem;
  border-radius: var(--radius-sm);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
}

.medicine-history-event[hidden] {
  display: none;
}

.comparison-headings,
.comparison-row {
  display: grid;
  grid-template-columns: minmax(7rem, 0.28fr) repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: stretch;
}

.comparison-headings {
  padding-bottom: 0.4rem;
  color: var(--ink-strong);
  border-bottom: 1px solid var(--line);
}

.comparison-headings strong:first-child {
  grid-column: 2;
}

.comparison-field,
.comparison-value {
  min-width: 0;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}

.comparison-field {
  color: var(--ink-muted);
  font-weight: 700;
  background: var(--surface-page);
}

.comparison-value {
  border: 1px solid var(--line);
  background: var(--surface-panel);
}

.comparison-value.is-different {
  border-color: #d2b35d;
  background: var(--warn-surface);
}

.comparison-row.has-warning .comparison-value {
  border-color: #c77b6c;
}

.comparison-warning {
  margin: 0.35rem 0 0;
  padding: 0.55rem 0.7rem;
  color: var(--danger-ink-strong);
  border-left: 0.25rem solid #c77b6c;
  background: var(--danger-surface);
}

.candidate-switch {
  margin-top: 0;
}

.candidate-switch button[aria-pressed="true"] {
  color: var(--surface-panel);
  border-color: var(--brand);
  background: var(--brand);
}

.import-detail-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.15rem;
}

.import-metadata {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 0.65rem;
}

.import-metadata div {
  grid-template-columns: minmax(7rem, 0.35fr) minmax(0, 1fr);
  align-items: start;
  padding: 0.7rem;
  border-radius: var(--radius-md);
  background: var(--surface-page);
}

.import-metadata dd {
  overflow-wrap: anywhere;
}

.issue-section,
.shadow-row-section {
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
}

.issue-section h3,
.shadow-row-section h3 {
  font-size: var(--text-md);
}

.issue-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.issue-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.35rem 0.65rem;
  align-items: center;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  color: #574d32;
  font-size: var(--text-sm);
  border-left: 0.25rem solid #d8b95e;
  border-radius: var(--radius-xs);
  background: var(--warn-surface);
}

.issue-list code {
  color: #716548;
  font-size: var(--text-xs);
}

.issue-rows {
  grid-column: 1 / -1;
  color: #756b50;
  font-size: var(--text-sm);
}

.issue-empty {
  display: block !important;
  color: var(--ink-soft) !important;
  border-left-color: #8bb8ab !important;
  background: var(--surface-page) !important;
}

.order-history-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-panel);
}

.order-history-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.order-history-heading h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: var(--text-xl);
}

.order-history-heading .panel-status {
  margin-top: 0.2rem;
}

.order-history-totals {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem 1rem;
  margin: 0;
}

.order-history-totals div {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  white-space: nowrap;
}

.order-history-totals dt {
  color: var(--ink-soft);
  font-size: var(--text-xs);
}

.order-history-totals dd {
  margin: 0;
  color: var(--ink-strong);
  font-size: var(--text-base);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.order-history-filter {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto;
  gap: 0.45rem;
}

.order-history-filter input {
  width: 100%;
  min-width: 0;
  min-height: 2.45rem;
  padding: 0.45rem 0.65rem;
  color: var(--ink-strong);
  font: inherit;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-page);
}

.order-history-filter button {
  min-height: 2.45rem;
  padding-block: 0.4rem;
}

.order-history-panel {
  min-width: 0;
}

.order-history-wide-table-wrap,
.order-history-compact-table-wrap {
  width: 100%;
  min-width: 0;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-panel);
}

.order-history-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: var(--text-xs);
}

.order-history-table th,
.order-history-table td {
  max-width: none;
  padding: 0.42rem 0.5rem;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.order-history-wide-table th:nth-child(1) { width: 11%; }
.order-history-wide-table th:nth-child(2) { width: 14%; }
.order-history-wide-table th:nth-child(3) { width: 24%; }
.order-history-wide-table th:nth-child(4) { width: 7%; }
.order-history-wide-table th:nth-child(5) { width: 10%; }
.order-history-wide-table th:nth-child(6) { width: 10%; }
.order-history-wide-table th:nth-child(7) { width: 10%; }
.order-history-wide-table th:nth-child(8) { width: 14%; }

.order-history-wide-table th:nth-child(4),
.order-history-wide-table th:nth-child(5),
.order-history-wide-table th:nth-child(6),
.order-history-compact-table th:nth-child(3),
.order-history-compact-table th:nth-child(4),
.order-history-compact-table th:nth-child(5) {
  text-align: right;
}

.order-history-group {
  --order-history-background: var(--surface-panel);
}

.order-history-group:nth-of-type(even) {
  --order-history-background: var(--surface-tint);
}

/* Keep every cell, including row-spanned identities and messages, in its order band. */
.order-history-table .order-history-group,
.order-history-table .order-history-group > tr,
.order-history-table .order-history-group > tr > td {
  background: var(--order-history-background);
}

/* Item facts stay separated; the row-spanned order identity remains one block. */
.order-history-table .order-history-group > .order-history-detail-row > td:not([rowspan]) {
  border-bottom: 1px solid var(--line-soft);
}

.order-history-unit-price,
.order-history-total,
.order-history-financial-note {
  display: grid;
  gap: 0.15rem;
}

.order-history-unit-price small,
.order-history-financial-note small {
  color: var(--ink-soft);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.35;
}

.order-history-supplier,
.order-history-item-name,
.order-history-total {
  color: var(--ink-strong);
  font-weight: 800;
}

.order-history-supplier strong,
.order-history-supplier small,
.order-history-order > span,
.order-history-order-number,
.order-history-order-supplier,
.order-history-order-seller,
.order-history-item-name > strong,
.order-history-item-meta {
  display: block;
}

.order-history-order-number {
  margin-top: 0.2rem;
  color: var(--brand-strong);
  font-size: var(--text-xs);
}

.order-history-supplier small,
.order-history-order-seller,
.order-history-item-meta,
.order-history-mobile-shipment,
.order-history-compact-shipment {
  margin-top: 0.18rem;
  color: var(--ink-soft);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.4;
}

.order-history-secondary {
  display: block;
  margin-top: 0.25rem;
  color: var(--ink-soft);
  font-size: var(--text-xs);
  font-weight: 700;
}

.order-history-item-link {
  width: auto;
  max-width: 100%;
  min-height: 1.8rem;
  padding: 0;
  color: var(--brand-strong);
  font: inherit;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--brand-mid);
  text-underline-offset: 0.18rem;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.order-history-item-link:hover,
.order-history-item-link:focus-visible {
  color: var(--brand-deep);
  text-decoration-thickness: 0.12rem;
}

.order-history-statuses .semantic-state {
  display: inline-flex;
  margin: 0.08rem 0.2rem 0.08rem 0;
  white-space: nowrap;
}

.order-history-shipment span {
  display: block;
  overflow-wrap: anywhere;
}

.order-history-shipment small {
  color: var(--ink-soft);
  font-size: inherit;
  font-weight: 700;
}

.order-history-shipment > .order-history-source {
  display: block;
  margin-top: 0.25rem;
}

.order-history-message-row td.panel-status {
  margin: 0;
  padding: 0.45rem 0.7rem;
  background: var(--surface-subtle);
}

.order-history-compact-table-wrap,
.order-history-mobile-list {
  display: none;
}

.order-history-compact-table th:nth-child(1) { width: 24%; }
.order-history-compact-table th:nth-child(2) { width: 34%; }
.order-history-compact-table th:nth-child(3) { width: 12%; }
.order-history-compact-table th:nth-child(4) { width: 14%; }
.order-history-compact-table th:nth-child(5) { width: 16%; }

.order-history-mobile-list {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.7rem;
}

.order-history-mobile-order {
  --order-history-background: var(--surface-panel);
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--order-history-background);
}

.order-history-mobile-order:nth-child(even) {
  --order-history-background: var(--surface-tint);
}

.order-history-mobile-order-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line-soft);
}

.order-history-mobile-order-heading > div {
  display: grid;
  gap: 0.12rem;
}

.order-history-mobile-order-heading > strong {
  color: var(--brand-strong);
  white-space: nowrap;
}

.order-history-mobile-order > .order-history-statuses {
  margin-top: 0.45rem;
}

.order-history-mobile-items {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin-top: 0.55rem;
}

.order-history-mobile-item {
  min-width: 0;
  padding: 0.65rem;
  background: transparent;
}

.order-history-mobile-item + .order-history-mobile-item {
  border-top: 1px solid var(--line-soft);
}

.order-history-mobile-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  margin: 0.55rem 0 0;
}

.order-history-mobile-values div {
  min-width: 0;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  background: transparent;
}

.order-history-mobile-values dt {
  color: var(--ink-soft);
  font-size: var(--text-xs);
  font-weight: 700;
}

.order-history-mobile-values dd {
  margin: 0.1rem 0 0;
  color: var(--ink-strong);
  font-size: var(--text-sm);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.order-history-collection-link {
  margin-left: 0.5rem;
  padding: 0.15rem 0.5rem;
  font-size: var(--text-xs);
  vertical-align: baseline;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  max-height: none;
  margin-top: 0.75rem;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.table-scroll.prescription-format-header-scroll {
  max-height: 18rem;
  overflow-y: auto;
}

.table-scroll.hospital-source-page-table {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior: auto;
}

.supplier-list-scroll {
  max-height: none;
  overflow-y: visible;
}

.supplier-list-table {
  min-width: 72rem;
  table-layout: fixed;
}

.supplier-list-table th,
.supplier-list-table td {
  max-width: none;
}

.supplier-list-table th:nth-child(1) { width: 2.6rem; }
.supplier-list-table th:nth-child(2) { width: 15rem; }
.supplier-list-table th:nth-child(3) { width: 7rem; }
.supplier-list-table th:nth-child(4) { width: 20rem; }
.supplier-list-table th:nth-child(5) { width: 7rem; }
.supplier-list-table th:nth-child(6) { width: 10rem; }
.supplier-list-table th:nth-child(7) { width: 10rem; }

.supplier-summary-row td {
  padding: 0.5rem 0.6rem;
  vertical-align: middle;
}

.supplier-list-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  color: var(--brand-strong);
  font: inherit;
  font-size: var(--text-sm);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-panel);
  cursor: pointer;
}

.supplier-list-toggle:hover {
  border-color: var(--brand-mid);
  background: var(--surface-tint);
}

.supplier-detail-row[hidden] {
  display: none;
}

.supplier-detail-row > td {
  padding: 0.75rem;
  background: var(--surface-subtle);
}

.supplier-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(14rem, 0.7fr);
  gap: 0.75rem;
  min-width: 0;
}

.supplier-connector-actions,
.supplier-management-actions {
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
}

.supplier-connector-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 0.55rem;
}

.supplier-connector-actions > h3,
.supplier-connector-actions > .semantic-type-form,
.supplier-connector-actions > .queue-actions,
.supplier-connector-actions > p {
  grid-column: 1 / -1;
}

.supplier-connector-actions h3,
.supplier-management-actions h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: var(--text-base);
}

.supplier-manual-upload {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
}

.supplier-manual-upload h4,
.supplier-manual-upload p { margin: 0; }
.supplier-manual-upload input[type="file"] { width: 100%; min-width: 0; }
.supplier-upload-results { margin: 0; padding-left: 1.25rem; overflow-wrap: anywhere; }
.supplier-upload-results li + li { margin-top: 0.35rem; }
.supplier-upload-results button { margin-left: 0.5rem; }

.supplier-management-actions {
  display: flex;
  align-content: flex-start;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.supplier-management-actions h3 {
  flex-basis: 100%;
}

.supplier-management-actions button {
  width: auto;
}

.hospital-source-open {
  font: inherit;
}

.hospital-source-bulk-actions {
  justify-content: flex-start;
  margin-top: 1rem;
}

.hospital-source-edit-cell input,
.hospital-source-page-table select {
  width: 100%;
  min-width: 7rem;
}

.hospital-source-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  min-width: 20rem;
  align-items: start;
}

.hospital-source-row-actions .manual-match-search {
  flex: 1 1 12rem;
  min-width: 0;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.hospital-source-row-actions > button {
  flex: 0 0 auto;
}

.hospital-source-row-actions > .panel-status {
  flex-basis: 100%;
}

.medicine-list-card { position: relative; min-width: 0; }

.medicine-list-toolbar > h2 {
  margin: 0;
  font-size: var(--text-lg);
  white-space: nowrap;
}

.medicine-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 0.55rem;
  margin: 0.7rem 0 0.2rem;
}

.medicine-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.medicine-list-toolbar-title {
  min-width: 0;
  flex: 1 1 16rem;
}

.medicine-list-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.medicine-list-search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}

.medicine-list-search-field {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.2rem 0.2rem 0.2rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-panel);
}

.medicine-list-search-field:focus-within {
  border-color: var(--brand-mid);
  box-shadow: 0 0 0 0.18rem rgba(23, 118, 101, 0.12);
}

.medicine-list-search-field > .medicine-icon {
  width: 1.05rem;
  height: 1.05rem;
  color: var(--ink-faint);
}

.medicine-list-search input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 2.3rem;
  padding: 0.35rem 0.1rem;
  color: var(--ink);
  font: inherit;
  border: 0;
  background: transparent;
}

.medicine-list-search input:focus-visible {
  outline-offset: -0.4rem;
}

.medicine-list-search-submit {
  flex: 0 0 auto;
  min-height: 2.3rem;
  padding: 0.4rem 1.1rem;
  color: var(--surface-panel);
  font-weight: 700;
  border: 1px solid var(--brand-strong);
  border-radius: var(--radius-pill);
  background: var(--brand);
  cursor: pointer;
}

.medicine-list-search-submit:hover {
  background: var(--brand-strong);
}

/* Order and medicine workspaces share one search control contract. */
.workspace-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.workspace-search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}

.workspace-search-field {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.2rem 0.2rem 0.2rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-panel);
}

.workspace-search-field:focus-within {
  border-color: var(--brand-mid);
  box-shadow: 0 0 0 0.18rem rgba(23, 118, 101, 0.12);
}

.workspace-search-field > .medicine-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  color: var(--ink-faint);
}

.workspace-search-field > input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 2.3rem;
  padding: 0.35rem 0.1rem;
  color: var(--ink);
  font: inherit;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
}

.workspace-search-field > .workspace-search-submit {
  flex: 0 0 auto;
  width: auto;
  min-height: 2.3rem;
  padding: 0.4rem 1.1rem;
  color: var(--surface-panel);
  font-weight: 700;
  border: 1px solid var(--brand-strong);
  border-radius: var(--radius-pill);
  background: var(--brand);
  cursor: pointer;
}

.workspace-search-field > .workspace-search-submit:hover {
  background: var(--brand-strong);
}

.supplier-medicine-search-form { gap: .75rem; margin: 1rem 0; }
.supplier-medicine-search-form > select {
  min-height: 2.8rem; padding: .45rem .7rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface-panel); color: var(--ink);
  font: inherit;
}
.supplier-medicine-search .panel-status[aria-live] { margin: .8rem 0; font-weight: 700; color: var(--brand-deep); }
.supplier-medicine-overview { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0 1rem; }
.supplier-medicine-provider {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .35rem .55rem;
  padding: .5rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-tint); color: var(--ink-soft); font-size: var(--text-sm);
}
.supplier-medicine-provider strong { color: var(--ink-strong); }
.supplier-medicine-provider.is-loading { border-color: var(--brand-mid); }
.supplier-medicine-provider.has-issue { background: #fff4ee; border-color: #dfb9a4; }
.supplier-medicine-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.supplier-medicine-table { width: 100%; border-collapse: collapse; text-align: left; }
.supplier-medicine-table th { padding: .65rem .8rem; background: var(--surface-tint); color: var(--ink-strong); font-size: var(--text-sm); white-space: nowrap; }
.supplier-medicine-table td { padding: .7rem .8rem; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.supplier-medicine-table td:first-child { min-width: 16rem; }
.supplier-medicine-table td strong { display: block; color: var(--ink-strong); }
.supplier-medicine-table td small { display: block; margin-top: .2rem; color: var(--ink-soft); font-size: var(--text-xs); }
.supplier-medicine-table td:nth-child(3) strong { font-size: 1.05rem; color: var(--brand-deep); white-space: nowrap; }
.supplier-medicine-table td:last-child { white-space: nowrap; }
.supplier-medicine-family { background: var(--surface-tint); }
.supplier-medicine-family td { overflow-wrap: anywhere; }
.supplier-medicine-row:hover { background: var(--surface-subtle); }
.supplier-stock { display: inline-block; padding: .2rem .5rem; border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: 700; }
.supplier-stock-available { color: #0b6144; background: #e4f5e9; }
.supplier-stock-low { color: #805300; background: #fff1d0; }
.supplier-stock-out { color: #a1372b; background: #ffebe6; }
.supplier-stock-unknown { color: var(--ink-soft); background: var(--surface-subtle); }
.supplier-medicine-detail-row td { padding: 0; background: var(--surface-subtle); }
.supplier-medicine-comparison { display: grid; gap: .4rem; padding: .8rem; }
.supplier-medicine-offer {
  display: grid; grid-template-columns: minmax(7rem, .7fr) minmax(10rem, 2fr) minmax(7rem, .7fr) minmax(9rem, 1fr) auto;
  align-items: center; gap: .7rem; padding: .5rem .65rem; border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); background: var(--surface-panel); font-size: var(--text-sm);
}
.supplier-medicine-offer > * { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.supplier-medicine-offer > strong { grid-column: 1; grid-row: 1; }
.supplier-medicine-offer > small:nth-child(2) { grid-column: 1; grid-row: 2; }
.supplier-medicine-offer > span:nth-child(3) { grid-column: 2; grid-row: 1; }
.supplier-medicine-offer > small:nth-child(4) { grid-column: 2; grid-row: 2; }
.supplier-medicine-offer > small:nth-child(5) { grid-column: 2; grid-row: 3; }
.supplier-medicine-offer > b { grid-column: 3; grid-row: 1; }
.supplier-medicine-offer > .supplier-stock { grid-column: 4; grid-row: 1; }
.supplier-medicine-offer > button { grid-column: 5; grid-row: 1 / 4; }
.supplier-medicine-offer b { color: var(--brand-deep); }
.supplier-medicine-offer .supplier-stock { justify-self: start; }
.supplier-medicine-pages, .supplier-medicine-page { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.supplier-medicine-pages { margin-top: .8rem; }
.supplier-medicine-page { padding: .35rem .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
@media (max-width: 760px) {
  .supplier-medicine-search-form { flex-wrap: wrap; }
  .supplier-medicine-search-form > select { width: 100%; }
  .supplier-medicine-table-wrap { overflow: visible; border: 0; }
  .supplier-medicine-table, .supplier-medicine-table tbody { display: block; }
  .supplier-medicine-table thead { display: none; }
  .supplier-medicine-family, .supplier-medicine-family td { display: block; min-width: 0; }
  .supplier-medicine-family { margin-top: .8rem; border-radius: var(--radius-sm); }
  .supplier-medicine-row {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: .65rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
    overflow: hidden;
  }
  .supplier-medicine-row td { min-width: 0; padding: .55rem .7rem; overflow-wrap: anywhere; }
  .supplier-medicine-row td:first-child { grid-column: 1 / -1; min-width: 0; background: var(--surface-tint); }
  .supplier-medicine-row td:nth-child(2) { grid-column: 1 / -1; }
  .supplier-medicine-row td:nth-child(3)::before,
  .supplier-medicine-row td:nth-child(4)::before {
    display: block; margin-bottom: .2rem; color: var(--ink-soft); font-size: var(--text-xs);
  }
  .supplier-medicine-row td:nth-child(3)::before { content: "최저가"; }
  .supplier-medicine-row td:nth-child(4)::before { content: "재고"; }
  .supplier-medicine-row td:last-child { grid-column: 1 / -1; }
  .supplier-medicine-row td:last-child button { width: 100%; }
  .supplier-medicine-detail-row { display: block; }
  .supplier-medicine-detail-row td { display: block; }
  .supplier-medicine-offer { display: flex; flex-direction: column; align-items: stretch; gap: .35rem; }
  .supplier-medicine-offer .supplier-stock { align-self: start; }
}

.medicine-list-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.85rem;
  margin: 0;
  padding: 0.45rem 0.7rem;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.medicine-list-skeleton { min-height: 2.8rem; }
.medicine-list-conditions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; min-width: 0; margin: 0.65rem 0; font-size: var(--text-sm); }
.medicine-list-active-conditions { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: center; gap: 0.4rem; min-width: 0; }
.medicine-list-active-conditions > strong { margin-right: 0.2rem; white-space: nowrap; }
.medicine-list-condition-chip, .medicine-list-clear-conditions { width: auto; max-width: 100%; min-height: 2rem; padding: 0.3rem 0.6rem; font: inherit; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface-panel); cursor: pointer; overflow-wrap: anywhere; }
.medicine-list-condition-chip { color: var(--ink-strong); }
.medicine-list-clear-conditions { color: var(--brand-strong); }
.medicine-list-result-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.25rem 0.8rem; margin-left: auto; }
.medicine-list-result-count { color: var(--ink-soft); white-space: nowrap; }
.medicine-list-page-area { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-top: 0.85rem; }
.medicine-list-page-area .medicine-pagination { align-self: center; margin: 0; }
.medicine-list-page-text { display: inline-flex; align-items: center; min-height: 2.2rem; color: var(--ink-faint); font-size: var(--text-sm); }

.medicine-list-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  min-height: 1.9rem;
  padding: 0.15rem 0.5rem;
  color: var(--ink-soft);
  font: inherit;
  font-size: var(--text-sm);
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
}

.medicine-list-stat:hover {
  border-color: var(--line-strong);
  background: var(--surface-panel);
}

.medicine-list-stat[aria-pressed="true"] {
  color: var(--ink-inverse);
  border-color: var(--brand-strong);
  background: var(--brand);
}

.medicine-list-stat[aria-pressed="true"] > strong,
.medicine-list-stat[aria-pressed="true"][data-tone] > strong {
  color: var(--ink-inverse);
}

.medicine-list-stat > strong {
  color: var(--ink-strong);
  font-weight: 800;
}

.medicine-list-stat[data-tone="warn"] > strong { color: var(--warn-ink); }
.medicine-list-stat[data-tone="danger"] > strong { color: var(--danger-ink); }

.medicine-list-note {
  margin: 0.5rem 0 0;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.medicine-benefit-deleted {
  color: #b45309;
}

.medicine-table-scroll {
  max-height: none;
}

.medicine-list-loading { min-height: 8rem; margin: 0.75rem 0 0; padding: 1.25rem; color: var(--ink-faint); border: 1px dashed var(--line); border-radius: var(--radius-md); background: linear-gradient(110deg, var(--surface-subtle) 25%, var(--surface-tint) 42%, var(--surface-subtle) 58%); background-size: 220% 100%; animation: medicine-list-loading 1.2s linear infinite; }
@keyframes medicine-list-loading { to { background-position: -220% 0; } }

.medicine-search-suggestions {
  position: absolute;
  z-index: 12;
  top: calc(100% + 0.4rem);
  left: 0;
  width: min(27rem, calc(100vw - 2.5rem));
  padding: 0.45rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 0.8rem 2rem rgba(27, 67, 58, 0.18);
  background: var(--surface-panel);
}

.medicine-search-suggestions[hidden] { display: none; }
.medicine-search-suggestions-title { margin: 0.2rem 0.4rem 0.45rem; color: var(--ink-soft); font-size: var(--text-sm); font-weight: 600; }
.medicine-search-suggestions-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.2rem; margin: 0; padding: 0; list-style: none; }
.medicine-search-suggestion { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; gap: 0.2rem; padding: 0.6rem 0.65rem; text-align: left; border: 0; border-radius: var(--radius-sm); background: transparent; }
.medicine-search-suggestion:hover,
.medicine-search-suggestion:focus-visible { background: var(--surface-tint); }
.medicine-search-suggestion strong { color: var(--ink-strong); font-size: var(--text-base); }
.medicine-search-suggestion span { color: var(--ink-soft); font-size: var(--text-sm); font-weight: 600; }

.medicine-page-size {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.medicine-page-size select {
  min-width: 0;
  min-height: 2.4rem;
  padding: 0.4rem 0.6rem;
  color: var(--ink-muted);
  font: inherit;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
}

.medicine-list-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 1 auto;
  min-width: 0;
}

.medicine-list-toolbar-actions .quiet-light-button {
  width: auto;
  min-height: 2.4rem;
  padding: 0.4rem 0.8rem;
}

.shared-list-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.shared-list-search {
  flex: 1 1 20rem;
  min-width: 12rem;
}

.shared-list-controls {
  position: relative;
  flex: 0 0 auto;
}

.shared-list-controls > summary {
  white-space: nowrap;
}

.shared-list-controls > .shared-list-controls-panel {
  position: fixed;
  z-index: 45;
  inset: auto;
  display: grid;
  width: min(25rem, calc(100vw - 2rem));
  max-height: min(38rem, calc(100dvh - 7rem));
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
  padding: 0.8rem;
  overflow-y: auto;
}

.shared-list-controls-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.shared-list-controls-heading h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: var(--text-md);
}

.shared-list-controls-heading button {
  width: auto;
}

.shared-list-sort-field,
.shared-list-controls-panel > .field-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.shared-list-sort-field select,
.shared-list-controls-panel > .field-group select {
  width: 100%;
  min-height: 2.4rem;
  padding: 0.4rem 0.55rem;
  color: var(--ink-strong);
  font: inherit;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
}

.shared-list-filter-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
}

.shared-list-filter-section {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
}

.shared-list-filter-section > summary {
  min-height: 2.4rem;
  padding: 0.55rem 0.65rem;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.shared-list-filter-section > summary::-webkit-details-marker {
  display: none;
}

.shared-list-filter-section > summary::after {
  float: right;
  content: "+";
}

.shared-list-filter-section[open] > summary::after {
  content: "−";
}

.shared-list-filter-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-height: 12rem;
  gap: 0.15rem;
  padding: 0 0.6rem 0.6rem;
  overflow-y: auto;
}

.order-status-group-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0.6rem 0.6rem;
  font-size: var(--text-sm);
}

.order-status-group-picker select {
  min-width: 0;
  max-width: 70%;
}

.medicine-category-edit {
  display: block;
  margin-top: 0.3rem;
  width: auto;
  white-space: nowrap;
}

.matching-review-source-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.shared-list-filter-options label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2rem;
  color: var(--ink-strong);
  font-size: var(--text-sm);
}

.shared-list-filter-options input {
  width: 1rem;
  height: 1rem;
  min-height: 1rem;
  accent-color: var(--brand);
}

.shared-list-control-actions {
  display: flex;
  gap: 0.45rem;
}

.shared-list-control-actions button {
  flex: 1 1 0;
  width: auto;
}

.shared-list-controls-backdrop {
  display: none;
}

.supplier-editor-trigger { margin-top: 0.5rem; }
.supplier-editor-dialog {
  box-sizing: border-box;
  width: min(38rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 1rem;
  overflow-y: auto;
  color: var(--ink-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-panel);
  box-shadow: 0 0.9rem 2.4rem rgba(27, 67, 58, 0.22);
}
.supplier-editor-dialog::backdrop { background: rgba(7, 29, 25, 0.48); }
.supplier-editor-panel { display: grid; gap: 0.8rem; min-width: 0; }
.supplier-editor-panel > .semantic-type-form { display: grid; gap: 0.8rem; min-width: 0; }
.supplier-editor-panel .shared-list-controls-heading {
  position: sticky;
  top: -1rem;
  z-index: 1;
  padding: 0.4rem 0;
  background: var(--surface-panel);
}
.supplier-editor-panel .field-group > :is(input, select, textarea) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}
.supplier-editor-panel fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  min-width: 0;
}
.supplier-editor-panel fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
@media (max-width: 640px) {
  .supplier-editor-dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
    padding: 0.8rem;
  }
  .supplier-editor-panel .shared-list-controls-heading { top: -0.8rem; }
}

.shared-list-current-sort,
.medicine-mobile-current-sort {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 700;
  white-space: nowrap;
}

.shared-list-active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  color: var(--ink-soft);
  font-size: var(--text-xs);
}

.shared-list-active-filters {
  margin-top: 0.55rem;
}

.shared-list-active-filters > span {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.18rem 0.5rem;
  color: var(--brand-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-tint);
}

.shared-list-active-filters button {
  width: auto;
  min-height: 1.8rem;
  padding: 0.18rem 0.5rem;
  font-size: var(--text-xs);
}

.shared-table-heading-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 2rem;
  gap: 0.3rem;
  padding: 0.25rem 0.3rem;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

.shared-table-heading-trigger:hover,
.shared-table-heading-trigger:focus-visible {
  color: var(--ink-strong);
  border-color: var(--line-strong);
  background: var(--surface-panel);
}

.shared-table-sort-mark {
  display: inline-flex;
  align-items: center;
  margin-left: 0.2rem;
  color: var(--brand);
}

.shared-table-sort-mark .medicine-icon {
  width: 0.85rem;
  height: 0.85rem;
  vertical-align: 0;
}

.supplier-list-toggle .medicine-icon {
  width: 0.95rem;
  height: 0.95rem;
  vertical-align: 0;
}

.supplier-list-toolbar .workspace-search-field {
  background: var(--surface-panel);
}

.medicine-table-more-menu > summary { gap: 0.35rem; }
.medicine-table-more-menu > summary .medicine-icon { width: 1.1rem; height: 1.1rem; }
.medicine-table-more-menu-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.6rem; }
.medicine-table-more-menu-panel > h3 { margin: 0.2rem 0 -0.25rem; color: var(--ink-strong); font-size: var(--text-md); }
.medicine-table-more-menu-panel > .panel-status { margin: 0; font-size: var(--text-xs); }
.medicine-table-more-menu-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.medicine-table-more-menu-row .medicine-page-size { grid-template-columns: auto auto; align-items: center; gap: 0.5rem; }
.medicine-table-more-menu .medicine-page-size select { max-width: 7.5rem; }
.medicine-table-popover { position: relative; min-width: 0; }

.medicine-table-popover > summary {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: 0.4rem 0.7rem;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 800;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
  cursor: pointer;
}

.medicine-icon { display: inline-block; width: 1rem; height: 1rem; flex: 0 0 auto; vertical-align: -0.15em; }

.medicine-table-popover > summary::-webkit-details-marker { display: none; }
.medicine-table-popover > summary::after { margin-left: 0.45rem; content: "\2304"; }
.medicine-table-popover[open] > summary { border-color: var(--brand-mid); box-shadow: 0 0 0 0.18rem rgba(23, 118, 101, 0.12); }

.medicine-table-popover > :not(summary) {
  position: fixed;
  z-index: 40;
  inset: auto;
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 6rem);
  margin: 0;
  padding: 0.8rem;
  overflow-y: auto;
  color: var(--ink-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 0.9rem 2.4rem rgba(27, 67, 58, 0.22);
  background: var(--surface-panel);
}

.medicine-table-filter > :not(summary) { width: min(20rem, calc(100vw - 1.5rem)); }
.medicine-table-more-menu > :not(summary) { width: min(30rem, calc(100vw - 1.5rem)); }

.medicine-table-settings-form,
.medicine-table-filter-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.55rem; margin-top: 0.55rem; }
.medicine-table-filter-form > strong { color: var(--ink-strong); font-size: var(--text-sm); }

.medicine-column-settings-list,
.medicine-table-filter-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-height: 19rem;
  gap: 0.1rem;
  margin: 0;
  padding: 0.25rem;
  overflow: auto;
  list-style: none;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.medicine-column-settings-list { grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); }

.medicine-column-setting,
.medicine-table-filter-options label,
.medicine-table-select-all { display: flex; align-items: center; gap: 0.45rem; min-width: 0; min-height: 1.95rem; padding: 0.18rem 0.35rem; border-radius: var(--radius-xs); }
.medicine-column-setting { display: grid; grid-template-columns: 1.05rem minmax(0, 1fr); }
.medicine-column-setting:hover,
.medicine-table-filter-options label:hover,
.medicine-table-select-all:hover { background: var(--surface-tint); }
.medicine-column-setting.is-dragging { opacity: 0.45; }
.medicine-column-setting:has(input:checked) { background: var(--surface-tint-strong); }
.medicine-column-drag-handle { display: inline-flex; align-items: center; justify-content: center; width: 1.05rem; color: #6f928a; cursor: grab; }
.medicine-column-drag-handle .medicine-icon { width: 0.85rem; height: 0.85rem; }
.medicine-column-setting label { display: grid; grid-template-columns: 1rem minmax(0, 1fr); align-items: center; gap: 0.45rem; min-height: 0; padding: 0; }
.medicine-column-setting label,
.medicine-table-filter-options label,
.medicine-table-select-all { color: var(--ink-strong); font-size: var(--text-sm); font-weight: 600; }
.medicine-column-setting input,
.medicine-table-filter-options input,
.medicine-table-select-all input { width: 1rem; height: 1rem; min-height: 1rem; margin: 0; accent-color: var(--brand); }
.medicine-column-setting span,
.medicine-table-filter-options span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.medicine-table-select-all { border: 1px solid var(--line-soft); background: var(--surface-subtle); }
.medicine-table-filter-form input[type="search"] { min-height: 2.4rem; padding: 0.4rem 0.6rem; color: var(--ink); font: inherit; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-panel); }
.medicine-table-filter-actions { display: flex; gap: 0.4rem; }
.medicine-table-filter-actions button { flex: 1 1 auto; min-height: 2.4rem; }
.medicine-table-sort-actions { display: flex; gap: 0.4rem; }
.medicine-table-sort-actions button { display: inline-flex; align-items: center; justify-content: center; flex: 1 1 auto; width: auto; min-height: 2.25rem; gap: 0.35rem; padding: 0.4rem 0.6rem; }
.medicine-table-sort-actions button[aria-pressed="true"] { color: var(--surface-panel); border-color: var(--brand); background: var(--brand); }

.medicine-center-list-table th { overflow: visible; padding: 0.15rem 0.25rem; }
.medicine-center-list-table th:not(:has(.medicine-table-heading)) { padding: 0.65rem 0.7rem; }
.medicine-center-list-table td { padding: 0.4rem 0.7rem; }
.medicine-center-list-table td button { min-height: 1.95rem; padding: 0.25rem 0.6rem; font-size: var(--text-xs); white-space: nowrap; }
.medicine-center-list-table th[data-column="category"],
.medicine-center-list-table td[data-column="category"] { min-width: 8rem; white-space: nowrap; }
.medicine-center-list-table th.has-open-popover { z-index: 12; }
.medicine-list-price-coverage { color: var(--ink-soft); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }
.medicine-table-heading { display: block; min-width: 0; }
.medicine-table-heading .medicine-table-filter { width: 100%; }
.medicine-center-list-table th .medicine-table-filter > summary.medicine-table-heading-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.4rem;
  min-width: 0;
  min-height: 2rem;
  padding: 0.3rem 0.35rem;
  color: var(--ink-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}
.medicine-table-heading-trigger:hover { color: var(--ink-strong); border-color: var(--line-strong); background: var(--surface-panel); }
.medicine-table-heading-trigger > span:first-child { display: inline-flex; align-items: center; min-width: 0; gap: 0.3rem; overflow: hidden; text-overflow: ellipsis; }
.medicine-table-heading-icons { display: inline-flex; align-items: center; gap: 0.3rem; flex: 0 0 auto; color: var(--brand); }
.medicine-table-heading-icons .medicine-icon { width: 1rem; height: 1rem; }
.medicine-center-list-table th .medicine-table-filter > summary::after { display: none; }
.medicine-center-list-table th .medicine-table-filter > summary:hover { color: var(--ink-strong); border-color: var(--line-strong); background: var(--surface-panel); }
.medicine-center-list-table th .medicine-table-filter > summary.has-active-filter { color: var(--surface-panel); border-color: var(--brand-strong); background: var(--brand); }

.medicine-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.85rem;
}

.medicine-pagination button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  min-height: 2.2rem;
  padding: 0.25rem 0.55rem;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 700;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-panel);
  cursor: pointer;
}

.medicine-pagination button:disabled { cursor: default; opacity: 0.4; }
.medicine-pagination button:not(:disabled):hover { color: var(--ink-strong); border-color: var(--brand-mid); background: var(--surface-tint); }
.medicine-pagination .medicine-icon { width: 0.95rem; height: 0.95rem; }
.medicine-pagination-numbers { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.medicine-pagination-numbers button[aria-current="page"] {
  color: var(--surface-panel);
  border-color: var(--brand-strong);
  background: var(--brand);
  opacity: 1;
}

.medicine-pagination-jump {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 0.35rem;
  margin: 0 0 0 auto;
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.medicine-pagination-jump input {
  width: 3.8rem;
  min-height: 2.2rem;
  padding: 0.25rem 0.4rem;
  color: var(--ink);
  font: inherit;
  text-align: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-panel);
}

.medicine-center-list-table th[data-column="standard_name"],
.medicine-center-list-table td[data-column="standard_name"] {
  width: 26rem;
  min-width: 14rem;
  max-width: none;
}

.medicine-center-list-table td[data-column="standard_name"] {
  white-space: normal;
}

.medicine-search-match { display: inline; margin-inline-start: 0.5rem; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 600; line-height: 1.45; }

.medicine-compact-table-wrap,
.medicine-mobile-list,
.medicine-mobile-controls,
.medicine-mobile-controls-backdrop,
.medicine-mobile-current-sort {
  display: none;
}

.medicine-compact-table {
  table-layout: fixed;
}

.medicine-compact-table th,
.medicine-compact-table td {
  max-width: none;
  padding: 0.5rem 0.65rem;
  vertical-align: top;
}

.medicine-compact-table th:nth-child(1) { width: 38%; }
.medicine-compact-table th:nth-child(2) { width: 25%; }
.medicine-compact-table th:nth-child(3) { width: 37%; }

.medicine-responsive-fields,
.medicine-mobile-card-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.28rem;
  margin: 0;
}

.medicine-responsive-field {
  display: grid;
  grid-template-columns: minmax(4.6rem, 0.34fr) minmax(0, 1fr);
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}

.medicine-responsive-field dt {
  color: var(--ink-soft);
  font-size: var(--text-xs);
  font-weight: 700;
}

.medicine-responsive-field dd {
  min-width: 0;
  margin: 0;
  color: var(--ink-strong);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.medicine-responsive-field dd > .semantic-state {
  display: inline-flex;
}

.medicine-responsive-field button {
  min-height: 1.9rem;
  margin: 0.18rem 0 0;
  padding: 0.22rem 0.55rem;
  font-size: var(--text-xs);
}

.medicine-mobile-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-panel);
}

.medicine-mobile-card:focus-visible,
.medicine-mobile-card:hover {
  border-color: var(--brand-mid);
  box-shadow: 0 0 0 0.16rem rgba(23, 118, 101, 0.1);
}

.medicine-mobile-card-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
}

.medicine-mobile-card-heading h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: var(--text-base);
  line-height: 1.4;
}

.medicine-mobile-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.medicine-mobile-controls > summary {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 800;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
  cursor: pointer;
}

.medicine-mobile-controls > summary::-webkit-details-marker,
.medicine-mobile-filter-section > summary::-webkit-details-marker {
  display: none;
}

.medicine-mobile-controls-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.8rem;
}

.medicine-mobile-controls-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.medicine-mobile-controls-heading h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: var(--text-lg);
}

.medicine-mobile-sort {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.45rem;
  padding: 0.65rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.medicine-mobile-sort label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.medicine-mobile-sort select {
  width: 100%;
  min-width: 0;
  min-height: 2.4rem;
  padding: 0.4rem 0.55rem;
  color: var(--ink-strong);
  font: inherit;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
}

.medicine-mobile-filter-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
}

.medicine-mobile-filter-section {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
}

.medicine-mobile-filter-section > summary {
  padding: 0.65rem 0.7rem;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.medicine-mobile-filter-section > summary::after {
  float: right;
  content: "+";
}

.medicine-mobile-filter-section[open] > summary::after { content: "−"; }
.medicine-mobile-filter-section > summary.has-active-filter { color: var(--brand-strong); background: var(--surface-tint); }
.medicine-mobile-filter-section > .medicine-table-filter-form { margin: 0; padding: 0 0.65rem 0.65rem; }

table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink-strong);
  font-size: var(--text-sm);
}

.prescription-source-listing-scroll table {
  min-width: 64rem;
}

.prescription-source-listing-scroll td:nth-child(2),
.prescription-source-listing-scroll td:nth-child(3),
.prescription-source-listing-scroll td:nth-child(4),
.prescription-source-listing-scroll td:nth-child(5),
.prescription-source-listing-scroll td:nth-child(6) {
  min-width: 8rem;
  word-break: break-word;
}

th,
td {
  max-width: 18rem;
  padding: 0.65rem 0.7rem;
  overflow-wrap: anywhere;
  word-break: keep-all;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
}

th {
  position: sticky;
  z-index: 1;
  top: 0;
  color: var(--ink-muted);
  font-weight: 800;
  white-space: nowrap;
  background: var(--surface-tint);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:nth-child(even) {
  background: var(--surface-subtle);
}

.item-name-cell {
  min-width: 10rem;
  font-weight: 700;
}

.numeric-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.source-ordinal-cell {
  overflow-wrap: anywhere;
  word-break: break-all;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

details {
  min-width: 9rem;
}

summary {
  color: var(--brand);
  font-weight: 700;
  cursor: pointer;
}

.lineage-list {
  width: min(26rem, 80vw);
  margin-top: 0.65rem;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--surface-tint);
}

.lineage-list div {
  grid-template-columns: minmax(6rem, 0.35fr) minmax(0, 1fr);
}

html.has-open-drawer {
  overflow: hidden;
}

.nav-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(7, 29, 25, 0.48);
}

@media (max-width: 1024px) and (min-width: 768.01px) {
  .application-layout {
    grid-template-columns: minmax(11.5rem, 13rem) minmax(0, 1fr);
  }

  .primary-navigation {
    padding-inline: 0.65rem;
  }

  .nav-list button {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.3rem;
  }
}

@container workspace (max-width: 1024px) {
  .import-browser {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --header-h: 4rem;
  }

  .site-header {
    min-height: var(--header-h);
    padding: 0.6rem 0.8rem;
  }

  .brand-copy span,
  .header-identity > span {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
  }

  .nav-controls {
    display: none;
  }

  html.has-collapsed-nav .application-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  html.has-collapsed-nav .primary-navigation {
    display: block;
  }

  .application-layout {
    display: block;
    min-height: calc(100dvh - var(--header-h));
  }

  .primary-navigation {
    position: fixed;
    z-index: 25;
    inset: var(--header-h) auto 0 0;
    display: flex;
    width: min(85vw, 18rem);
    height: calc(100dvh - var(--header-h));
    min-height: 0;
    max-height: calc(100dvh - var(--header-h));
    padding: 1.1rem 0.9rem max(1.4rem, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .primary-navigation.is-open {
    transform: translateX(0);
  }

  .workspace {
    padding: 1rem;
  }
}

@container workspace (max-width: 768px) {
  .order-history-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .order-history-totals {
    justify-content: flex-start;
  }

  .order-import-heading,
  .section-heading,
  .file-picker-row,
  .shadow-notice,
  .import-metadata,
  .prescription-source-metadata-fields,
  .prescription-source-file-admission,
  .order-import-file-admission {
    grid-template-columns: minmax(0, 1fr);
  }

  .order-import-heading,
  .section-heading,
  .upload-result-heading,
  .import-list-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .quiet-light-button,
  .file-picker-row .primary-button {
    width: 100%;
  }

  .queue-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .queue-actions button {
    width: 100%;
  }

  #medicine-center-root .matching-review-actions,
  #medicine-center-root .candidate-switch {
    align-items: center;
    flex-direction: row;
  }

  #medicine-center-root .matching-review-actions button,
  #medicine-center-root .candidate-switch button {
    flex: 1 1 8rem;
    width: auto;
  }

  .numbered-pagination:not(.medicine-pagination) {
    align-items: stretch;
  }

  .numbered-pagination:not(.medicine-pagination) button {
    flex: 1 1 2.75rem;
    width: auto;
  }

  .medicine-center-workspace,
  .materials-matching-section,
  .semantic-ingestion-workspace {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .shadow-notice strong {
    white-space: normal;
  }

  .import-browser {
    grid-template-columns: minmax(0, 1fr);
  }

  .compact-metadata div,
  .import-metadata div,
  .lineage-list div {
    grid-template-columns: minmax(0, 1fr);
  }

  .issue-list li {
    grid-template-columns: minmax(0, 1fr);
  }

  .issue-rows {
    grid-column: auto;
  }

  .phi-attestation > p {
    margin-left: 0;
  }

  .queue-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .queue-state,
  .queue-remove-button {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }

  .queue-result-metadata div {
    grid-template-columns: minmax(0, 1fr);
  }

}


@container workspace (max-width: 639px) {
  .medicine-list-search-submit {
    width: auto;
    padding-inline: 0.8rem;
  }

  .medicine-list-search {
    flex: 1 1 auto;
  }

  .medicine-pagination-numbers {
    display: none;
  }

  .medicine-pagination-jump {
    margin-left: 0;
  }

  .medicine-table-more-menu > summary {
    font-size: var(--text-sm);
  }

  .medicine-table-more-menu > summary .medicine-icon {
    width: 1.25rem;
    height: 1.25rem;
  }

  .medicine-list-toolbar-title {
    flex-basis: 100%;
  }

  .medicine-list-toolbar-actions {
    justify-content: flex-end;
    width: 100%;
  }

  .shared-list-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .shared-list-search {
    min-width: 0;
  }

  .order-history-list-toolbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .shared-list-controls-heading button,
  .shared-list-control-actions button,
  .shared-list-active-filters button {
    width: auto;
  }
}


@container workspace (max-width: 480px) {
  .data-workspace-tabs {
    grid-template-columns: minmax(0, 1fr);
  }

  .medicine-center-tabs {
    display: flex;
  }

  .comparison-headings,
  .comparison-row {
    grid-template-columns: minmax(5.5rem, 0.35fr) repeat(2, minmax(7rem, 1fr));
  }

  .matching-comparison {
    overflow-x: auto;
  }

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

  .review-query-field {
    grid-column: 1 / -1;
  }

  .table-scroll {
    max-height: none;
  }

  .compact-metadata,
  .import-metadata,
  .lineage-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@container workspace (max-width: 360px) {
  .review-filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-query-field {
    grid-column: auto;
  }
}

@media (pointer: coarse) {
  .review-filter-grid input,
  .review-filter-grid select,
  .matching-review-size select,
  .matching-review-actions > button,
  .candidate-switch > button {
    min-height: var(--tap);
  }
}

@media (max-width: 480px) {
  .brand-mark {
    width: 2.15rem;
    height: 2.15rem;
  }

  .site-header {
    gap: 0.45rem;
  }

  .quiet-button,
  .nav-toggle {
    padding-inline: 0.55rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Touch input keeps the 44px floor that compact pointer styling trims. */
@media (pointer: coarse) {
  .quiet-button,
  .nav-toggle {
    min-height: var(--tap);
  }

  .quiet-light-button {
    min-height: var(--tap);
  }

  .queue-remove-button {
    min-height: var(--tap);
  }

  .file-field input::file-selector-button {
    min-height: var(--tap);
  }

  .medicine-list-search input,
  .medicine-page-size select {
    min-height: var(--tap);
  }

  .medicine-table-popover > summary {
    min-height: var(--tap);
  }

  .medicine-table-sort-actions button {
    min-height: var(--tap);
  }

  .medicine-pagination button,
  .medicine-pagination-jump input {
    min-height: var(--tap);
    min-width: var(--tap);
  }

  .medicine-table-heading-trigger {
    min-height: var(--tap);
  }

  .medicine-list-stat {
    min-height: var(--tap);
  }

  .medicine-center-list-table th .medicine-table-filter > summary {
    min-height: var(--tap);
  }
}
 #pharmacy-price-explorer-root { min-width: 0; }
.price-explorer-search { display: flex; gap: .75rem; margin: 1rem 0; }
.price-explorer-search input { min-width: 0; flex: 1; }
.price-explorer-summary { color: var(--muted-text, #52606d); }
.price-explorer-tabs { display: flex; gap: .5rem; margin-top: 1rem; border-bottom: 1px solid #d9e2ec; }
.price-explorer-tabs button { border: 0; border-bottom: .2rem solid transparent; border-radius: .35rem .35rem 0 0; background: transparent; color: #52606d; }
.price-explorer-tabs button[aria-pressed="true"] { border-bottom-color: #136f63; color: #0b544b; font-weight: 700; }
.price-explorer-list { display: grid; gap: 1rem; margin: 1rem 0; padding: 0; list-style: none; }
.price-explorer-list > li { position: relative; padding: 1rem; border: 1px solid #d9e2ec; border-radius: .75rem; background: #fff; }
.price-explorer-list h2 { margin: 0 0 .5rem; font-size: 1.05rem; }
.price-explorer-list p { margin: .4rem 0 .8rem; color: #52606d; }
.price-explorer-list strong { color: #b42318; font-size: 1.25rem; }
.price-explorer-review-card { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.price-explorer-review-preview img { display: block; width: 7rem; height: 7rem; border-radius: .55rem; object-fit: cover; background: #f0f4f8; }
.price-explorer-card-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.price-explorer-delete-button { border-color: #f1b4ae; background: #fff5f4; color: #9b1c13; }
.price-explorer-more { position: absolute; top: .75rem; right: .75rem; }
.price-explorer-more summary { width: 2rem; height: 2rem; border-radius: 50%; cursor: pointer; list-style: none; text-align: center; font-weight: 700; }
.price-explorer-more summary::-webkit-details-marker { display: none; }
.price-explorer-more > div { position: absolute; right: 0; z-index: 2; display: grid; width: max-content; padding: .4rem; border: 1px solid #cbd5e1; border-radius: .5rem; background: #fff; box-shadow: 0 .5rem 1.5rem rgba(15, 23, 42, .14); }
.price-explorer-paging { display: flex; align-items: center; justify-content: center; gap: .75rem; margin: 1.5rem 0; }
.price-explorer-gallery { width: min(94vw, 70rem); max-height: 90vh; border: 0; border-radius: .75rem; padding: 1.25rem; box-shadow: 0 1rem 3rem rgba(0, 0, 0, .25); }
.price-explorer-gallery::backdrop { background: rgba(0, 0, 0, .55); }
.price-explorer-gallery > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.price-explorer-gallery h2 { margin: 0; font-size: 1.1rem; }
.price-explorer-gallery ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1rem; margin: 1rem 0 0; padding: 0; list-style: none; overflow: auto; max-height: 72vh; }
.price-explorer-gallery li { color: #334e68; font-size: .9rem; }
.price-explorer-gallery img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .5rem; background: #f0f4f8; }
.price-explorer-editor { width: min(94vw, 42rem); }
.price-explorer-selected-image { width: min(100%, 24rem); margin: 1rem auto; }
.price-explorer-edit-form { display: flex; align-items: end; gap: .75rem; margin: 1rem 0; }
.price-explorer-edit-form label { display: grid; flex: 1; gap: .35rem; }
.price-explorer-history { border-top: 1px solid #d9e2ec; margin-top: 1.25rem; padding-top: 1rem; }
.price-explorer-history ol { display: grid; grid-template-columns: 1fr; max-height: 16rem; }
.price-explorer-history li { padding: .65rem 0; border-bottom: 1px solid #e7edf3; }
@media (max-width: 42rem) { .price-explorer-edit-form { align-items: stretch; flex-direction: column; } .price-explorer-review-card { grid-template-columns: 5.5rem minmax(0, 1fr); } .price-explorer-review-preview img { width: 5.5rem; height: 5.5rem; } }

.supplier-collection-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0 0.15rem;
}

.supplier-collection-bulk-summary {
  margin-right: auto;
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.supplier-schedule-switch {
  min-width: 4rem;
  font-weight: 700;
}

.supplier-schedule-switch.is-on {
  border-color: var(--accent-line, var(--line));
  color: var(--ink-strong);
}

/* Medicine detail: compact source rows, package-level actions and scoped dialogs. */
.medicine-detail-package{margin-top:1rem;border:1px solid var(--line);border-radius:var(--radius-md);overflow:hidden}
.medicine-detail-package-heading{padding:1rem 1rem .5rem;background:var(--surface-tint)}
.medicine-detail-package-title{display:flex;flex-wrap:wrap;gap:.5rem 1.2rem;align-items:center;min-width:0}.medicine-detail-package-title h3{margin:0;overflow-wrap:anywhere}
.medicine-detail-package-source{padding:0 1rem 1rem!important;margin:0!important;background:var(--surface-tint);font-size:var(--text-sm);color:var(--ink-soft)}
.medicine-detail-conversion{color:var(--brand-strong);font-weight:600}.medicine-detail-secondary{display:block;margin-top:.2rem;font-size:var(--text-xs)}
.medicine-detail-orders-table,.medicine-detail-sales-table{width:100%;min-width:0;table-layout:fixed;border-collapse:collapse}
.medicine-detail-orders-table th,.medicine-detail-orders-table td,.medicine-detail-sales-table th,.medicine-detail-sales-table td{padding:.65rem .75rem;vertical-align:middle;white-space:normal;overflow-wrap:anywhere}
.medicine-detail-orders-table th:nth-child(1){width:16%}.medicine-detail-orders-table th:nth-child(2){width:29%}.medicine-detail-orders-table th:nth-child(3){width:13%}.medicine-detail-orders-table th:nth-child(4){width:9%}.medicine-detail-orders-table th:nth-child(5){width:14%}.medicine-detail-orders-table th:nth-child(6){width:14%}.medicine-detail-orders-table th:last-child{width:5%}
.medicine-detail-orders-table td:last-child,.medicine-detail-sales-table td:last-child{text-align:right}.medicine-detail-orders-table .medicine-order-link{display:block;font-size:var(--text-xs);margin-top:.2rem;text-align:left}
.medicine-detail-sales-table th:nth-child(1){width:20%}.medicine-detail-sales-table th:nth-child(2){width:14%}.medicine-detail-sales-table th:nth-child(3){width:10%}.medicine-detail-sales-table th:nth-child(4){width:10%}.medicine-detail-sales-table th:nth-child(5){width:16%}.medicine-detail-sales-table th:nth-child(6){width:12%}.medicine-detail-sales-table th:nth-child(7){width:10%}.medicine-detail-sales-table th:last-child{width:8%}
.medicine-detail-package-footer{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.6rem 1rem;border-top:1px solid var(--line);font-size:var(--text-sm)}
.medicine-detail-row-more{min-width:var(--tap);min-height:var(--tap);padding:.2rem;border:0;background:transparent;font:inherit;font-size:1.3rem;color:var(--ink-soft);cursor:pointer}
.medicine-detail-quantity{display:flex;gap:.5rem;align-items:center}.medicine-detail-quantity input{width:7rem!important;min-width:0}
.medicine-detail-package-heading>div:has(>.medicine-standard-edit-form){width:100%}.medicine-detail-package-heading .medicine-standard-edit-form{grid-template-columns:minmax(0,2fr) minmax(0,1fr)}
.medicine-detail-actions-popover{position:fixed;inset:auto;margin:0;padding:.35rem;width:15rem;max-width:calc(100vw - 16px);border:1px solid var(--line-strong);border-radius:var(--radius-md);background:var(--surface-panel);box-shadow:0 .5rem 1.5rem #17332f24;color:var(--ink)}
.medicine-detail-actions-popover:popover-open{display:grid;gap:.2rem}.medicine-detail-actions-popover button{text-align:left;border:0;background:transparent;width:100%;box-shadow:none}.medicine-detail-actions-popover button:hover{background:var(--surface-tint)}
@container workspace (max-width:42rem){
.medicine-detail-package-footer{flex-direction:column;align-items:stretch}.medicine-detail-package-footer>span{white-space:nowrap}.medicine-detail-package-footer>button{width:100%;min-width:0;white-space:normal}
.medicine-detail-orders-table thead,.medicine-detail-sales-table thead{display:none}.medicine-detail-orders-table tbody,.medicine-detail-sales-table tbody{display:block}
.medicine-detail-orders-table tr,.medicine-detail-sales-table tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));padding:.65rem;gap:.55rem;border-bottom:1px solid var(--line)}
.medicine-detail-orders-table td,.medicine-detail-sales-table td{display:block;border:0;padding:0;min-width:0}.medicine-detail-orders-table td:last-child,.medicine-detail-sales-table td:last-child{grid-column:2;grid-row:1;text-align:right}
.medicine-detail-orders-table td:not(:first-child):not(:last-child)::before,.medicine-detail-sales-table td:not(:first-child):not(:last-child)::before{content:attr(data-label);display:block;font-size:var(--text-xs);color:var(--ink-faint);margin-bottom:.15rem}
.medicine-detail-package-heading .medicine-standard-edit-form{grid-template-columns:1fr}
}

.medicine-detail-match-scope{display:grid;gap:.5rem;padding:1rem;background:var(--surface-tint);border-radius:var(--radius-sm);font-size:var(--text-sm)}

/* One purchasing list: collection state lives under its supplier identity. */
.supplier-unified-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.supplier-unified-table th:first-child { width: 40%; }
.supplier-unified-table th:nth-child(2) { width: 17%; }
.supplier-unified-table th:nth-child(3) { width: 17%; }
.supplier-unified-table th:nth-child(4) { width: 12%; }
.supplier-unified-table th:nth-child(5) { width: 14%; }
.supplier-unified-table.is-manual th:first-child { width: 65%; }
.supplier-unified-table.is-manual th:nth-child(2) { width: 20%; }
.supplier-unified-table.is-manual th:nth-child(3) { width: 15%; }
.supplier-unified-table th, .supplier-unified-table td { padding: .75rem .65rem; max-width: none; word-break: keep-all; overflow-wrap: normal; vertical-align: middle; }
.supplier-unified-table td:last-child, .supplier-unified-table th:last-child { text-align: right; }
.supplier-unified-table td:not(:first-child) { white-space: nowrap; }
.supplier-unified-table .supplier-list-toggle { width: auto; min-height: 2.5rem; display: inline-flex; gap: .5rem; border: 0; text-align: left; }
.supplier-unified-table .supplier-list-toggle .medicine-icon { flex: 0 0 1rem; }
.supplier-row-status, .supplier-row-meta, .supplier-row-failure { margin: .3rem 0 0 1.5rem; font-size: var(--text-sm); white-space: normal; }
.supplier-row-status { color: var(--ink-strong); font-weight: 700; }
.supplier-row-meta { color: var(--ink-muted); }
.supplier-row-failure { color: var(--ink-strong); }
.supplier-unified-table .supplier-detail-row > td { white-space: normal; text-align: left; }
.supplier-toggle-switch { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.5rem; padding: .2rem 0; border: 0; background: transparent; color: var(--ink-strong); font: inherit; font-size: var(--text-sm); white-space: nowrap; cursor: pointer; }
.supplier-toggle-track { display: inline-block; position: relative; width: 2.4rem; height: 1.4rem; flex: 0 0 2.4rem; border-radius: 1rem; background: var(--ink-muted); }
.supplier-toggle-track::after { content: ""; position: absolute; top: .2rem; left: .2rem; width: 1rem; height: 1rem; border-radius: 50%; background: var(--surface-panel); }
.supplier-toggle-switch[aria-checked="true"] .supplier-toggle-track { background: var(--brand); }
.supplier-toggle-switch[aria-checked="true"] .supplier-toggle-track::after { left: 1.2rem; }
.supplier-toggle-switch:disabled { opacity: .5; cursor: default; }
.supplier-period-fields { display: flex; flex-wrap: wrap; align-items: end; gap: .8rem; grid-column: 1 / -1; }
.supplier-period-fields > .field-group { flex: 1 1 11rem; min-width: 0; }
.supplier-until-current { display: flex; align-items: center; gap: .5rem; min-height: 2.7rem; }
.supplier-until-current input { width: 1.1rem; min-height: 1.1rem; margin: 0; }
.supplier-coverage-details { grid-column: 1 / -1; }
.supplier-coverage-details summary { cursor: pointer; padding: .5rem 0; }
.supplier-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.supplier-batch-status:empty { display: none; }
.supplier-bulk-actions { margin-top: .75rem; }
@media (max-width: 1050px) {
  .supplier-unified-table, .supplier-unified-table tbody, .supplier-unified-table tr, .supplier-unified-table td { display: block; width: 100%; }
  .supplier-unified-table thead { display: none; }
  .supplier-unified-table .supplier-summary-row { padding: .7rem; border-bottom: 1px solid var(--line); }
  .supplier-unified-table td { border: 0; padding: .3rem 0; }
  .supplier-unified-table td[data-label] { display: flex; justify-content: space-between; align-items: center; gap: .8rem; white-space: normal; }
  .supplier-unified-table td[data-label]::before { content: attr(data-label); color: var(--ink-muted); font-size: var(--text-sm); }
  .supplier-unified-table .supplier-detail-layout { grid-template-columns: minmax(0, 1fr); }
}

.medicine-official-card { max-width: 90rem; min-width: 0; overflow-wrap: anywhere; }
.medicine-official-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.medicine-official-grid > * { min-width: 0; }
.medicine-official-ingredients p, .medicine-ingredient-preview { white-space: pre-line; overflow-wrap: anywhere; }
.medicine-ingredient-preview { max-height: 9em; overflow: hidden; }
.medicine-official-card .table-scroll { max-width: 100%; overflow-x: auto; }
.medicine-official-card table { width: 100%; table-layout: fixed; }
.medicine-official-card td { white-space: normal; overflow-wrap: anywhere; }
.medicine-official-card .medicine-package-table th { white-space: normal; overflow-wrap: anywhere; }
.medicine-package-composition summary { cursor: pointer; }
.medicine-package-composition p { white-space: pre-wrap; }
.medicine-item-management { min-width: 0; margin-block: 1rem; }
.medicine-item-management summary { cursor: pointer; padding: .75rem; }
.medicine-official-match { width: min(64rem, 94vw); max-height: 90vh; overflow: auto; }
@media (max-width: 900px) { .medicine-official-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .medicine-official-grid { grid-template-columns: minmax(0, 1fr); } }

/* Keep the new detail/workspace tabs reachable under the mobile full-width button rule. */
.medicine-business-tabs { min-width: 0; max-width: 100%; }
.medicine-business-tabs > .medicine-match-tab-list,
.medicine-official-match > .medicine-match-tab-list { flex-wrap: wrap; }
.medicine-business-tabs > .medicine-match-tab-list > [role="tab"],
.medicine-official-match > .medicine-match-tab-list > [role="tab"] {
  width: auto;
  min-width: 0;
  flex: 0 1 auto;
}

/* Desktop detail keeps business sections visible together; mobile retains tabs. */
@media (min-width: 901px) {
  .medicine-business-tabs > .medicine-match-tab-list { display: none; }
  .medicine-business-tabs > [data-business-section][hidden] { display: block !important; }
  .medicine-business-tabs > [data-business-section] { margin-block: 1rem; }
}

/* Sales workspace uses the same search and column controls as medicines. */
.sales-price-workspace .workspace-search { width: min(100%, 48rem); margin-bottom: 1rem; }
.sales-price-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin: .75rem 0; }
.sales-price-toolbar > label { display: grid; gap: .35rem; color: var(--ink-muted); font-size: var(--text-sm); }
.sales-price-toolbar select { min-height: 2.6rem; padding: .45rem .7rem; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-panel); color: var(--ink-strong); }
.sales-price-margin { font-weight: 800; white-space: nowrap; }
.sales-price-margin[data-tone="negative"] { color: #a52d34; }
.sales-price-margin[data-tone="positive"] { color: var(--brand-mid); }
@media (max-width: 640px) {
  .sales-price-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-price-toolbar select { width: 100%; min-width: 0; }
}

.sales-price-workspace .medicine-center-list-table { min-width: 1050px; }
.sales-price-workspace .medicine-center-list-table th { white-space: nowrap; }
.sales-price-workspace .medicine-center-list-table td { min-width: 5rem; }
.sales-price-workspace .medicine-center-list-table td button { white-space: nowrap; }
.sales-price-workspace .medicine-center-list-table .panel-status { word-break: keep-all; }
.sales-price-workspace .sales-price-group-heading th {
  padding: .8rem .7rem;
  background: var(--surface-tint);
  border-top: 2px solid var(--line-strong);
  text-align: left;
}
.sales-price-group-title { display: flex; align-items: center; gap: .7rem; width: max-content; max-width: calc(100vw - 3rem); }
.sales-price-group-title .order-history-item-link { min-width: 0; white-space: normal; overflow-wrap: anywhere; font-weight: 800; font-size: var(--text-sm); }
.sales-price-group-count { flex-shrink: 0; padding: .2rem .55rem; border-radius: var(--radius-sm); background: var(--surface-panel); color: var(--ink-muted); font-size: var(--text-xs); }

.sales-price-conversion { display: inline-block; margin-left: .45rem; padding: .15rem .35rem; border-radius: .3rem; color: var(--ink-muted); font-size: var(--text-xs); white-space: nowrap; }
.sales-price-conversion.is-provisional { color: #715313; background: #fff2cf; border: 1px solid #d2b967; }

/* Sales and prescription analytics share the application's surfaces and controls. */
.retail-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0; }
.prescription-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.retail-card { min-width: 0; display: flex; flex-direction: column; gap: .5rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-panel); }
.retail-card > span { color: var(--ink-soft); font-size: var(--text-sm); font-weight: 700; }
.retail-card strong { font-size: var(--text-xl); font-variant-numeric: tabular-nums; color: var(--ink-strong); overflow-wrap: anywhere; }
.retail-tabs, .retail-filters, .retail-periods, .retail-pagination { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; align-items: center; }
.retail-tabs > button, .retail-periods > button, .retail-pagination > button, .retail-series-views > button { width: auto; }
.retail-tabs [aria-current="page"], .retail-periods [aria-pressed="true"], .retail-series-views [aria-pressed="true"] { border-color: var(--brand-strong); background: var(--brand); color: var(--ink-inverse); }
.period-picker { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin: 1rem 0 0; }
.period-picker .retail-periods { margin: 0; }
.period-step { display: flex; align-items: center; gap: .5rem; }
.period-step > button { width: auto; min-width: var(--tap); }
.period-step strong { min-width: 8.5rem; text-align: center; font-size: var(--text-lg); font-variant-numeric: tabular-nums; color: var(--ink-strong); }
.retail-filters { gap: .75rem; align-items: end; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-panel); }
.retail-filters label, .retail-review label { min-width: 0; display: flex; flex-direction: column; gap: .35rem; font-size: var(--text-sm); color: var(--ink-soft); }
.retail-filters input:not([type="checkbox"]):not([type="radio"]), .retail-filters select, .retail-review input:not([type="checkbox"]):not([type="radio"]), .retail-review select { width: 100%; min-width: 0; padding: .55rem .7rem; border: 1px solid var(--line-strong); border-radius: var(--radius-md); min-height: var(--tap); background: var(--surface-panel); color: var(--ink-strong); }
.retail-review .retail-check-field { flex-direction: row; align-items: center; min-height: var(--tap); }
.retail-review input[type="checkbox"], .retail-review input[type="radio"] { width: 1.25rem; min-height: 1.25rem; padding: 0; flex: 0 0 auto; }
.retail-chart { margin: 1.5rem 0; }
.retail-chart-scroll, .retail-table-scroll { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; margin: .75rem 0; overscroll-behavior-inline: contain; }
.retail-chart-scroll svg { display: block; min-width: 780px; width: 100%; max-height: 340px; }
.retail-table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); background: var(--surface-panel); }
.retail-table th, .retail-table td { border-bottom: 1px solid var(--line-soft); padding: .65rem .7rem; text-align: left; white-space: nowrap; vertical-align: middle; font-variant-numeric: tabular-nums; }
.retail-table td { overflow: hidden; }
.retail-table .cell-clip { display: block; box-sizing: border-box; width: 100%; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.retail-table .cell-clip[aria-expanded="true"] { white-space: normal; overflow-wrap: anywhere; }
.retail-table tbody tr:last-child td { border-bottom: 0; }
.retail-table th { background: var(--surface-tint); }
.retail-table button { width: auto; }
.retail-chart .retail-table tr > th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface-tint); }
.retail-chart .retail-table td { text-align: right; white-space: nowrap; }
.evidence-note p { margin: .25rem 0; }
.evidence-note details { margin-top: .35rem; }
.evidence-note summary { cursor: pointer; width: max-content; }
.retail-series-views { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.retail-freshness { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.retail-detail-section { margin: 1rem 0; padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface-panel); }
.retail-detail-section > h3 { margin-top: 0; font-size: var(--text-lg); }
.retail-review { width: min(700px, 95vw); max-height: 85vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.5rem; color: var(--ink); background: var(--surface-panel); }
.retail-review form, .prescription-editor { display: grid; gap: .75rem; }
.retail-filters.prescription-editor { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
.prescription-editor fieldset { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); }
.prescription-editor fieldset > small { grid-column: 1 / -1; }
.retail-review::backdrop { background: rgba(18, 62, 55, .5); }
@media (max-width: 1100px) { .retail-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container workspace (max-width: 1100px) { .retail-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 850px) { .retail-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .retail-card:last-child:nth-child(odd) { grid-column: 1 / -1; } }
@container workspace (max-width: 850px) { .retail-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .retail-card:last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (max-width: 640px) {
  .period-picker, .period-step { width: 100%; }
  .period-step strong { flex: 1; min-width: 0; }
  .retail-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .75rem; }
  .retail-filters > button { grid-column: 1 / -1; }
  .retail-detail-section { padding: 1rem; }
  .prescription-editor fieldset { grid-template-columns: minmax(0, 1fr); }
}
@container workspace (max-width: 640px) {
  .period-picker, .period-step { width: 100%; }
  .period-step strong { flex: 1; min-width: 0; }
  .retail-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .75rem; }
  .retail-filters > button { grid-column: 1 / -1; }
  .prescription-editor fieldset { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .medicine-table-scroll,
  .medicine-compact-table-wrap {
    display: none;
  }

  .order-history-wide-table-wrap,
  .order-history-compact-table-wrap {
    display: none;
  }

  .order-history-mobile-list {
    display: grid;
  }

  .medicine-mobile-controls,
  .medicine-mobile-current-sort {
    display: block;
  }

  .medicine-mobile-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.55rem;
    margin-top: 0.65rem;
  }

  .medicine-mobile-controls > .medicine-mobile-controls-panel,
  .shared-list-controls > .shared-list-controls-panel {
    position: fixed;
    z-index: 60;
    inset: auto 0 0;
    width: 100%;
    max-height: min(82dvh, 44rem);
    padding: 0.9rem 0.9rem max(1rem, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -0.8rem 2.4rem rgba(27, 67, 58, 0.22);
    background: var(--surface-panel);
  }

  .medicine-mobile-controls-backdrop,
  .shared-list-controls-backdrop {
    position: fixed;
    z-index: 55;
    inset: 0;
    width: 100%;
    min-height: 100dvh;
    padding: 0;
    border: 0;
    background: rgba(7, 29, 25, 0.48);
  }

  .medicine-mobile-controls[open] + .medicine-mobile-controls-backdrop,
  .shared-list-controls[open] + .shared-list-controls-backdrop {
    display: block;
  }

  .medicine-mobile-current-sort {
    align-self: center;
  }

  .medicine-mobile-controls-heading button,
  .medicine-mobile-card button,
  .medicine-responsive-field button {
    width: auto;
  }

}

.order-history-heading-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  min-height: 2.4rem;
  padding: 0.35rem;
  margin: 0 0 0 0.2rem;
}
.shared-list-control-actions {
  position: sticky;
  bottom: -0.8rem;
  padding-block: 0.5rem;
  background: var(--surface-panel);
}
@media (min-width: 641px) and (max-width: 1024px) {
  .medicine-center-list-table th,
  .medicine-center-list-table td { padding-inline: 0.55rem; }
}

.order-history-table th { white-space: normal; }
.order-history-heading-filter { width: auto; font-size: var(--text-xs); gap: 0.25rem; }
.order-history-wide-table-wrap { overflow-x: auto; }
.order-history-wide-table { min-width: 48rem; }

.order-history-heading-filter { white-space: nowrap; }
.shared-list-controls-heading,
.medicine-mobile-controls-heading {
  position: sticky;
  top: -0.8rem;
  z-index: 1;
  padding-block: 0.5rem;
  background: var(--surface-panel);
}
@media (max-width: 640px) {
  .shared-list-controls-heading,
  .medicine-mobile-controls-heading { top: -0.9rem; }
}


/* A single column heading is the control, across list workspaces. */
th > .medicine-table-heading-trigger,
th > .medicine-table-popover > .medicine-table-heading-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.45rem 0.35rem;
  color: var(--ink-muted);
  font: inherit;
  font-weight: 800;
  text-align: inherit;
  white-space: normal;
  list-style: none;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
}
th > .medicine-table-heading-trigger:hover,
th > .medicine-table-popover > .medicine-table-heading-trigger:hover {
  background: var(--surface-panel);
}
@media (min-width: 641px) {
  .order-history-list-toolbar.has-column-controls > .shared-list-controls > summary,
  .order-history-list-toolbar.has-column-controls > .shared-list-current-sort { display: none; }

}

.order-history-table .medicine-table-heading-trigger {
  white-space: nowrap;
  gap: 0.2rem;
  padding-inline: 0.15rem;
}

.sales-price-advanced { margin: 12px 0; border: 1px solid var(--border, #d9e1e8); border-radius: 10px; padding: 12px; }
.sales-price-advanced > summary { cursor: pointer; font-weight: 600; }
.sales-price-advanced-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.sales-price-advanced-form fieldset { min-width: 0; margin: 0; padding: 10px; border: 1px solid #d9e1e8; border-radius: 8px; }
.sales-price-advanced-form label { display: grid; gap: 4px; margin-bottom: 8px; }
.sales-price-advanced-form input { width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box; border: 1px solid #b9d2d0; border-radius: 8px; padding: 8px 10px; font: inherit; color: inherit; background: #fff; }
.sales-price-advanced-form input:focus { outline: 2px solid #0e766c; outline-offset: 2px; }
.sales-price-advanced-form legend { font-weight: 600; }
.sales-price-advanced-form label { font-size: 0.875rem; }
.sales-price-advanced-form > button { align-self: end; }
.sales-price-filter-chips { margin: 12px 0; flex-wrap: wrap; }

/* Medicine-wide stock and specification workspace. */
.medicine-detail-dialog.medicine-spec-workbench { width: min(1180px, calc(100vw - 32px)); max-width: calc(100vw - 32px); padding: 24px; }
.medicine-spec-stock { padding: 16px; margin: 16px 0; border-radius: 10px; background: #eef6f3; display: grid; gap: 6px; }
.medicine-spec-stock strong { font-size: 24px; }
.medicine-spec-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.medicine-spec-column { min-width: 0; padding: 16px; border: 1px solid #d5e3dd; border-radius: 12px; background: #f7faf8; }
.medicine-spec-workbench .medicine-detail-card { background: white; padding: 16px; margin: 12px 0; border: 1px solid #d5e3dd; border-radius: 10px; overflow-wrap: anywhere; }
.medicine-spec-workbench .medicine-spec-field { display: grid; gap: 6px; flex: 1 1 150px; min-width: 0; }
.medicine-spec-workbench input, .medicine-spec-workbench select { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; min-height: 42px; padding: 9px; border: 1px solid #9bbdb0; border-radius: 7px; background: white; color: inherit; font: inherit; }
.medicine-spec-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 12px; }
.medicine-spec-controls select { flex: 1 1 180px; width: auto; }
.medicine-spec-workbench button { min-height: 42px; white-space: normal; }
.medicine-spec-definition > button, .medicine-spec-definition > select { margin-top: 8px; }
.medicine-spec-calculation { padding: 10px; background: #eef6f3; border-radius: 6px; }
.medicine-stock-summary { margin-block: 20px; }
.medicine-stock-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.medicine-stock-summary-grid > div { min-width: 0; padding: 16px; border: 1px solid #d5e3dd; border-radius: 10px; overflow-wrap: anywhere; }
.medicine-stock-summary-grid strong { font-size: 20px; }
@media (max-width: 700px) {
  .medicine-detail-dialog.medicine-spec-workbench { padding: 14px; width: calc(100vw - 20px); max-width: calc(100vw - 20px); }
  .medicine-spec-columns, .medicine-stock-summary-grid { grid-template-columns: 1fr; }
  .medicine-spec-column { padding: 10px; }
  .medicine-spec-workbench input, .medicine-spec-workbench select { font-size: 16px; }
}

.medicine-spec-stock > h4, .medicine-spec-stock > p { margin: 0; }
.medicine-spec-stock { gap: 10px; }
.medicine-spec-workbench .medicine-spec-choice { display: flex; align-items: center; gap: 8px; flex: 0 1 auto; }
.medicine-spec-workbench input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; padding: 0; flex: 0 0 18px; }
.medicine-spec-workbench .medicine-spec-save { position: sticky; bottom: 0; z-index: 1; width: 100%; margin-top: 16px; box-shadow: 0 -4px 16px #ffffff; }

.medicine-detail-price-summary { margin-top: 20px; }
.medicine-detail-price-row { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.medicine-detail-price-row > div { min-width: 0; overflow-wrap: anywhere; }
.medicine-detail-price-row span, .medicine-detail-price-row strong { display: block; }
.medicine-detail-price-row span { font-size: var(--text-xs); color: var(--ink-faint); margin-bottom: 4px; }
@media (max-width: 900px) {
  .medicine-detail-price-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .medicine-detail-price-row > div:first-child { grid-column: 1 / -1; }
}

/* Medicine detail: one page, viewport menus and continuous row rules. */
.medicine-stage1{min-width:0;max-width:100%}
.medicine-stage1>section,.medicine-stage1>details{min-width:0;max-width:100%;scroll-margin-top:5rem}
.medicine-detail-official-strip{display:flex;flex-wrap:wrap;gap:.7rem 1rem;align-items:center;padding:1rem;border:1px solid var(--brand);border-radius:var(--radius-md);background:var(--surface-tint)}
.medicine-detail-official-strip.is-unlinked{border-color:var(--line-strong);background:var(--surface-subtle)}
.medicine-detail-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem;margin-block:1rem}
.medicine-detail-kpis>div{display:grid;gap:.3rem;padding:1rem;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--surface-panel);min-width:0;overflow-wrap:anywhere}
.medicine-detail-kpis span,.medicine-detail-kpis small{font-size:var(--text-sm);color:var(--ink-soft)}
.medicine-detail-kpis strong{font-size:1.4rem}
.medicine-detail-section-nav{display:flex;gap:.5rem;overflow-x:auto;position:sticky;top:0;z-index:10;padding:.7rem;background:var(--surface-panel);max-width:100%;min-width:0}
.medicine-detail-section-nav a{flex:0 0 auto;padding:.35rem .7rem;border:1px solid var(--line);border-radius:2rem;text-decoration:none;color:var(--ink)}
.medicine-detail-section-nav .is-empty{opacity:.5;border-style:dashed}
.medicine-detail-conversions{margin:1rem 0;padding:1rem;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--surface-panel)}
.medicine-detail-conversions>summary{font-weight:700;cursor:pointer}
.medicine-detail-conversion-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.7fr) minmax(0,1fr);gap:1rem;margin-top:1rem}
.medicine-detail-conversion-grid>section{min-width:0;padding:1rem;background:var(--surface-subtle);border:1px solid var(--line);border-radius:var(--radius-md)}
.medicine-detail-conversion-stock{background:var(--surface-tint)!important}
.medicine-detail-conversion-field{display:grid;grid-template-columns:minmax(0,1fr) 7rem;gap:.5rem;align-items:center;margin:.7rem 0;overflow-wrap:anywhere}
.medicine-detail-conversion-field input,.medicine-detail-review-row input,.medicine-detail-conversion-stock select{width:100%;min-width:0}
.medicine-detail-review-row{display:grid;grid-template-columns:minmax(0,1fr) 7rem auto;align-items:center;gap:.7rem;padding:.7rem 0;border-bottom:1px solid var(--line)}
.medicine-detail-stock-chart svg,.medicine-detail-price-chart svg{display:block;width:100%;height:auto;min-width:0}
.medicine-detail-stock-chart text,.medicine-detail-price-chart text{font-size:12px;fill:var(--ink-soft)}
.medicine-detail-stock-chart circle{fill:var(--brand)}
.medicine-detail-stock-chart .movement-loss,.medicine-detail-stock-chart .movement-disposal{fill:#b2443a}
.medicine-detail-flow-lanes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}
.medicine-detail-month-bar{display:grid;grid-template-columns:5rem minmax(0,1fr) 4rem;gap:.5rem;align-items:center;font-size:var(--text-sm)}
.medicine-detail-month-bar meter{width:100%}
.medicine-detail-ledger-table,.medicine-stage1 table{width:100%;border-collapse:collapse;min-width:0}
.medicine-stage1 tbody tr{border-bottom:1px solid var(--line)}
.medicine-stage1 td,.medicine-stage1 th{vertical-align:middle;border-bottom:0!important;min-width:0;overflow-wrap:anywhere}
.medicine-stage1 .medicine-detail-orders-table td{display:table-cell}
.medicine-stage1 .medicine-detail-row-more{margin-left:auto;width:var(--tap);height:var(--tap);padding:0;border:1px solid var(--line);border-radius:.5rem}
.medicine-stage1 .medicine-card-heading{align-items:center;flex-wrap:nowrap}
.medicine-stage1 .medicine-card-heading>div{min-width:0}
.medicine-stage1 td:last-child{text-align:right}
.medicine-detail-actions-popover{max-height:calc(100dvh - 16px);overflow-y:auto;z-index:1000}
.medicine-detail-actions-popover button{min-height:2.5rem}
.medicine-detail-actions-popover .medicine-overview-menu-group{display:block;padding:.5rem .65rem .2rem;color:var(--ink-soft);font-size:var(--text-xs);border-top:1px solid var(--line-soft)}
.medicine-detail-actions-popover .medicine-overview-menu-group:first-child{border-top:0}
.medicine-overview-page{min-width:0;max-width:100%;display:grid;gap:1rem}
.medicine-overview-page>*{min-width:0;max-width:100%;box-sizing:border-box}
.medicine-overview-back{margin-bottom:-.5rem}
.medicine-overview-header{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;padding:1rem;border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface-panel)}
.medicine-overview-heading{min-width:0;display:grid;gap:.35rem}
.medicine-overview-heading h2{margin:0;line-height:1.25;overflow-wrap:anywhere}
.medicine-overview-size{color:var(--ink-muted);font-weight:600}
.medicine-overview-chips{display:flex;flex-wrap:wrap;gap:.35rem}
.medicine-overview-chip{display:inline-flex;max-width:100%;padding:.22rem .55rem;border:1px solid var(--line);border-radius:999px;background:var(--surface-subtle);font-size:var(--text-xs);overflow-wrap:anywhere}
.medicine-overview-top-more{flex:none;min-width:6.5rem;min-height:var(--tap)}
.medicine-overview-tiles{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.75rem}
.medicine-overview-tile{min-width:0;display:grid;align-content:start;gap:.35rem;padding:1rem;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--surface-panel);overflow-wrap:anywhere}
.medicine-overview-tile[hidden]{display:none}
.medicine-overview-tile>span,.medicine-overview-tile small{font-size:var(--text-sm);color:var(--ink-soft)}
.medicine-overview-tile-note{white-space:pre-line}
.medicine-overview-tile strong{font-size:clamp(1rem,1.7vw,1.35rem);line-height:1.3}
.medicine-overview-tile[role=button]{cursor:pointer;border-color:var(--warn-line);background:var(--warn-surface)}
.medicine-overview-tile[role=button]:focus-visible{outline:3px solid var(--brand);outline-offset:2px}
.medicine-overview-cover{height:.4rem;background:var(--surface-tint);border-radius:99px;overflow:hidden}
.medicine-overview-cover i{display:block;height:100%;background:var(--brand);border-radius:inherit}
.medicine-overview-card{min-width:0;padding:1rem;border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface-panel);scroll-margin-top:5rem}
.medicine-overview-card-head{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.5rem;margin-bottom:.8rem}
.medicine-overview-card-head h3{margin:0}
.medicine-overview-card-body{min-width:0;max-width:100%;color:var(--ink)}
.medicine-overview-segments{display:flex;flex-wrap:wrap;gap:.25rem;align-items:center}
.medicine-overview-segments button{min-height:2.25rem;padding:.35rem .65rem;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--surface-panel);color:var(--ink)}
.medicine-overview-segments .medicine-detail-row-more { min-height: var(--tap); }
.medicine-overview-segments button[aria-pressed=true]{background:var(--surface-tint);border-color:var(--brand);font-weight:700}
.medicine-overview-month-chart,.medicine-overview-price-chart{min-width:0;width:100%;overflow:hidden}
.medicine-overview-month-chart svg,.medicine-overview-price-chart svg{display:block}
.medicine-overview-bar-out{fill:#ae7652}.medicine-overview-bar-in{fill:#5f9a84}
.medicine-overview-chart-label{font-size:11px;fill:var(--ink);paint-order:stroke;stroke:var(--surface-panel);stroke-width:4px;stroke-linejoin:round}
.medicine-overview-legend{font-size:var(--text-xs);color:var(--ink-soft);margin:.4rem 0 .8rem}
.medicine-overview-table-scroll{min-width:0;max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain}
.medicine-overview-table{width:100%;min-width:44rem;border-collapse:collapse;font-size:var(--text-sm)}
.medicine-overview-table th,.medicine-overview-table td{padding:.7rem .5rem;border-bottom:1px solid var(--line-soft);text-align:left;vertical-align:middle;white-space:nowrap}
.medicine-overview-table th{color:var(--ink-soft);font-weight:700;background:var(--surface-subtle)}
.medicine-overview-table td:nth-child(n+3){font-variant-numeric:tabular-nums}
.medicine-overview-table .cell-clip{display:block;max-width:min(18rem,32vw);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.medicine-overview-month-toggle,.medicine-overview-month-details{display:none}
.medicine-overview-total{font-weight:700;background:var(--surface-tint)}
.medicine-overview-events{list-style:none;margin:0;padding:0}
.medicine-overview-events li{display:grid;grid-template-columns:9.5rem 5.5rem minmax(0,1fr) auto auto;gap:.5rem;align-items:center;padding:.65rem 0;border-bottom:1px solid var(--line-soft);min-width:0}
.medicine-overview-events time{font-size:var(--text-sm);color:var(--ink-soft)}
.medicine-overview-events strong{white-space:nowrap;font-size:var(--text-sm)}
.medicine-overview-event-description{min-width:0;overflow-wrap:anywhere}
.medicine-overview-kind-chip{justify-self:start;padding:.18rem .5rem;border-radius:999px;background:var(--surface-tint);font-size:var(--text-xs);white-space:nowrap}
.medicine-overview-kind-chip.kind-order{background:#f4eadb}.medicine-overview-kind-chip.kind-sale{background:#e5f3eb}.medicine-overview-kind-chip.kind-prescription{background:#e9ebf9}
.medicine-overview-orders-table{min-width:48rem}
.medicine-overview-expiry-cell{white-space:normal!important}
.medicine-overview-expiry-chip{display:inline-flex;margin:.1rem;padding:.2rem .45rem;border-radius:999px;border:1px solid var(--line);font-size:var(--text-xs)}
.medicine-overview-stale td:nth-last-child(2){color:var(--warn-ink);font-weight:700}
.medicine-overview-bottom{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;min-width:0}
.medicine-overview-bottom>.medicine-overview-card{min-width:0}
.medicine-overview-label-preview{display:flex;align-items:flex-start;justify-content:center;min-width:0;max-width:100%;overflow:hidden;padding:.5rem;background:var(--surface-subtle)}
.medicine-overview-barcode-digits{font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.medicine-overview-fold{min-width:0;padding:.8rem 1rem;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--surface-panel);scroll-margin-top:5rem}
.medicine-overview-fold>summary{cursor:pointer;font-weight:700}
.medicine-overview-fold[open]{display:grid;gap:.8rem}
.medicine-overview-records[hidden]{display:none}
.medicine-overview-form{display:grid;gap:.75rem;margin-top:1rem}
.medicine-overview-form label{display:grid;gap:.25rem}
.medicine-overview-form input,.medicine-overview-form select{max-width:100%;min-width:0}
.medicine-overview-supplier-workspace{max-width:100%;max-height:70dvh;overflow:auto}
@media(max-width:720px){
  .medicine-overview-header{padding:.8rem;gap:.5rem}.medicine-overview-top-more{min-width:5rem}
  .medicine-overview-tiles{grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem}
  .medicine-overview-tile{padding:.75rem}.medicine-overview-tile strong{font-size:1.05rem}
  .medicine-overview-bottom{grid-template-columns:minmax(0,1fr)}
  .medicine-overview-card{padding:.8rem}
  .medicine-overview-events li{grid-template-columns:5rem 4.5rem minmax(0,1fr) auto;gap:.3rem;font-size:var(--text-sm)}
  .medicine-overview-events li>strong{grid-column:3/4;grid-row:2;justify-self:end}
  .medicine-overview-events li>.medicine-detail-row-more{grid-column:4;grid-row:1}
  .medicine-overview-events time{overflow-wrap:anywhere}
  .medicine-overview-table .cell-clip{max-width:12rem}
}
@media(max-width:600px){
  .medicine-overview-monthly-table{width:100%;min-width:0;font-size:.8rem;table-layout:fixed}
  .medicine-overview-monthly-table th,.medicine-overview-monthly-table td{padding:.45rem .2rem;white-space:normal;overflow-wrap:anywhere}
  .medicine-overview-monthly-table th:nth-child(2),.medicine-overview-monthly-table th:nth-child(4),.medicine-overview-monthly-table th:nth-child(5),
  .medicine-overview-monthly-table tr:not(.medicine-overview-month-details) td:nth-child(2),
  .medicine-overview-monthly-table tr:not(.medicine-overview-month-details) td:nth-child(4),
  .medicine-overview-monthly-table tr:not(.medicine-overview-month-details) td:nth-child(5){display:none}
  .medicine-overview-monthly-table tr:not(.medicine-overview-month-details){cursor:pointer}
  .medicine-overview-month-static{display:none}
  .medicine-overview-month-toggle{display:inline;min-height:2rem;padding:.2rem .3rem;border:0;background:transparent;color:var(--brand);font:inherit;font-weight:700;text-align:left}
  .medicine-overview-month-details:not([hidden]){display:table-row}
  .medicine-overview-month-details td{display:table-cell;padding:.6rem;background:var(--surface-subtle)}
  .medicine-overview-month-extra{display:grid;grid-template-columns:minmax(6rem,42%) minmax(0,1fr);gap:.3rem .6rem}
  .medicine-overview-month-extra strong{color:var(--ink-soft);font-size:var(--text-xs)}
  .medicine-overview-stacked{display:block;width:100%;min-width:0}
  .medicine-overview-stacked thead{display:none}
  .medicine-overview-stacked tbody{display:grid;gap:.65rem}
  .medicine-overview-stacked tr{display:grid;min-width:0;padding:.5rem .75rem;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--surface-panel)}
  .medicine-overview-stacked td{display:grid;grid-template-columns:minmax(5.5rem,34%) minmax(0,1fr);gap:.4rem;align-items:start;min-width:0;width:100%;padding:.32rem 0;border:0;white-space:normal;overflow-wrap:anywhere}
  .medicine-overview-stacked td::before{content:attr(data-label);color:var(--ink-soft);font-size:var(--text-xs);font-weight:600}
  .medicine-overview-stacked td:last-child:empty{display:none}
  .medicine-overview-stacked .cell-clip{max-width:100%;white-space:normal;overflow:visible;text-overflow:clip}
  .medicine-overview-stacked .medicine-overview-expiry-cell{white-space:normal}
  .medicine-overview-stacked .medicine-detail-row-more{justify-self:start}
}
.medicine-detail-filters{display:flex;gap:.4rem;flex-wrap:wrap;margin:.8rem 0}
.medicine-detail-filters [aria-pressed=true]{background:var(--surface-tint);border-color:var(--brand)}
.medicine-detail-ledger-table td{padding:.7rem;white-space:normal}
.ledger-delta{font-weight:700;text-align:right}
.ledger-balance{font-size:var(--text-sm);color:var(--ink-soft);text-align:right}
.medicine-manual-tag{color:var(--ink-soft);font-size:var(--text-xs)}
.medicine-detail-package.is-flat .medicine-detail-package-heading,.medicine-detail-package.is-flat .medicine-detail-package-source{display:none}
.medicine-detail-entry{margin-block:1rem;padding:1rem;background:var(--surface-tint);border:1px solid var(--brand);border-radius:var(--radius-md)}
.medicine-detail-entry-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:.7rem}
.medicine-detail-entry label{display:grid;gap:.3rem;min-width:0}
.medicine-detail-entry input,.medicine-detail-entry select{min-width:0;width:100%}
@media(max-width:1020px){.medicine-detail-conversion-grid{grid-template-columns:1fr}.medicine-detail-conversion-stock{grid-row:1}}
@media(max-width:720px){
.medicine-detail-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:.6rem}
.medicine-detail-kpis>div{padding:.8rem}.medicine-detail-kpis strong{font-size:1.1rem}
.medicine-detail-actions-popover{position:fixed;inset:auto 8px 8px!important;width:auto!important;max-width:none;max-height:80dvh;border-radius:1rem;padding:1rem;box-shadow:0 -1rem 3rem #0003}
.medicine-detail-actions-popover::backdrop{background:#0003}
.medicine-detail-flow-lanes{grid-template-columns:1fr}
.medicine-detail-ledger-table thead{display:none}.medicine-detail-ledger-table tbody{display:block}
.medicine-detail-ledger-table tr{display:grid;grid-template-columns:minmax(0,1fr) auto 2.25rem;gap:.4rem .6rem;padding:.8rem 0}
.medicine-detail-ledger-table td{display:block;padding:0;border:0!important}
.medicine-detail-ledger-table td::before{content:none!important}
.ledger-date{grid-column:1;grid-row:1;font-size:var(--text-sm)}.ledger-delta{grid-column:2;grid-row:1;text-align:right}
.ledger-description{grid-column:1/-1;grid-row:2}.ledger-balance{grid-column:1/-1;grid-row:3;text-align:right}.ledger-action{grid-column:3;grid-row:1}
.medicine-stage1 .medicine-detail-orders-table tr,.medicine-stage1 .medicine-detail-sales-table tr{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 2.25rem}
.medicine-stage1 .medicine-detail-orders-table td,.medicine-stage1 .medicine-detail-sales-table td{display:block}
.medicine-stage1 .medicine-detail-orders-table td:first-child,.medicine-stage1 .medicine-detail-sales-table td:first-child{grid-column:1/3;grid-row:1}
.medicine-stage1 .medicine-detail-orders-table td:last-child,.medicine-stage1 .medicine-detail-sales-table td:last-child{grid-column:3;grid-row:1}
.medicine-stage1 .medicine-detail-orders-table td:nth-child(2),.medicine-stage1 .medicine-detail-sales-table td:nth-child(2){grid-column:1/3}
.medicine-detail-review-row{grid-template-columns:minmax(0,1fr) auto}.medicine-detail-review-row>span{grid-column:1/-1}
.medicine-history-table thead{display:none}.medicine-history-table tbody{display:block}.medicine-history-table tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem;padding:.7rem 0}.medicine-history-table td{display:block;padding:0}.medicine-history-table td:first-child{display:none}
.medicine-history-table .medicine-history-summary td:first-child{display:block;grid-column:1/-1;width:auto;text-align:left}
}
.medicine-spec-workbench .medicine-spec-save { display: block; box-sizing: border-box; }
.medicine-spec-workbench > button { max-width: 100%; box-sizing: border-box; }

.medicine-spec-workbench .medicine-card-heading { flex-wrap: wrap; }
.medicine-spec-workbench .medicine-card-heading h3 { min-width: 0; overflow-wrap: anywhere; }

.medicine-ledger-kind-dot { display: inline-block; width: .45rem; height: .45rem; margin-right: .3rem; border-radius: 50%; background: #187763; vertical-align: middle; }
.medicine-ledger-kind-dot.is-out { background: #b2443b; }

@media (max-width: 720px) {
  .medicine-stage1 .medicine-detail-orders-table thead,
  .medicine-stage1 .medicine-detail-sales-table thead { display: none; }
  .medicine-stage1 .medicine-detail-orders-table tbody,
  .medicine-stage1 .medicine-detail-sales-table tbody { display: block; }
  .medicine-stage1 .medicine-detail-orders-table tr,
  .medicine-stage1 .medicine-detail-sales-table tr { display: grid; padding: .8rem 0; gap: .4rem .6rem; }
  .medicine-stage1 .medicine-detail-orders-table td,
  .medicine-stage1 .medicine-detail-sales-table td { width: auto; padding: 0; }
  .medicine-stage1 .medicine-detail-orders-table td:not(:first-child):not(:last-child)::before,
  .medicine-stage1 .medicine-detail-sales-table td:not(:first-child):not(:last-child)::before {
    content: attr(data-label); display: block; color: var(--ink-soft); font-size: var(--text-xs);
  }
}

/* Detail review: concise rows, full-width activity and readable mobile cards. */
.medicine-stage1 > #medicine-detail-sales,.medicine-stage1 > #medicine-detail-prescriptions{width:100%;box-sizing:border-box;grid-column:1/-1}
.medicine-stage1 > .is-empty{display:flex;align-items:center;gap:1rem;padding:.8rem 1rem;color:var(--ink-faint);background:var(--surface-subtle)}
.medicine-stage1 > .is-empty h3{margin:0;font-size:var(--text-sm);font-weight:500}
.medicine-stage1 .medicine-detail-orders-table th{width:auto}
.medicine-stage1 .medicine-detail-orders-table th:nth-child(1){width:10%}
.medicine-stage1 .medicine-detail-orders-table th:nth-child(2){width:11%}
.medicine-stage1 .medicine-detail-orders-table th:nth-child(3){width:24%}
.medicine-stage1 .medicine-detail-orders-table th:nth-child(4){width:12%}
.medicine-stage1 .medicine-detail-orders-table th:nth-child(5){width:6%}
.medicine-stage1 .medicine-detail-orders-table th:nth-child(6){width:10%}
.medicine-stage1 .medicine-detail-orders-table th:nth-child(7),.medicine-stage1 .medicine-detail-orders-table th:nth-child(8){width:11%}
.medicine-stage1 .medicine-detail-orders-table th:last-child{width:5%}
.medicine-detail-orders-table .order-name strong{font-weight:500}
.medicine-detail-item-information{margin:1rem 0;padding:1rem;border:1px solid var(--line);border-radius:var(--radius-md)}
.medicine-detail-item-information > summary{font-weight:600;cursor:pointer}
.medicine-detail-assessment{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.5fr);gap:1rem}
.medicine-detail-assessment > div{min-width:0}
.medicine-detail-verdict{padding:1rem;background:var(--surface-tint);border:1px solid var(--brand);border-radius:var(--radius-md)}
.medicine-detail-verdict > span{font-size:var(--text-sm);color:var(--ink-soft)}
.medicine-detail-verdict > strong{display:block;font-size:1.4rem;margin:.5rem 0 1rem;color:var(--brand)}
.medicine-detail-verdict.needs-purchase{background:#fff5df;border-color:#dfb15a}
.medicine-detail-verdict.needs-purchase > strong{color:#915b16}
.medicine-detail-verdict p{font-size:var(--text-sm);color:var(--ink-soft);overflow-wrap:anywhere}
.medicine-detail-gauge{position:relative;height:14px;border-radius:7px;background:var(--line);margin:6px 0 32px}
.medicine-detail-gauge i{position:absolute;left:0;top:0;bottom:0;border-radius:7px;background:var(--brand)}
.medicine-detail-gauge b{position:absolute;top:-4px;bottom:-4px;width:2px;background:var(--ink)}
.medicine-detail-gauge span{position:absolute;top:18px;transform:translateX(-50%);font-size:var(--text-xs);white-space:nowrap}
.medicine-detail-demand-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.5rem}
.medicine-detail-demand-facts > div{min-width:0;padding:.7rem;background:var(--surface-subtle);border:1px solid var(--line);border-radius:var(--radius-sm);overflow-wrap:anywhere}
.medicine-detail-demand-facts span,.medicine-detail-demand-facts small{display:block;font-size:var(--text-xs);color:var(--ink-soft)}
.medicine-detail-demand-facts strong{display:block;font-size:1.1rem;margin:.25rem 0}
.medicine-detail-demand-facts input{width:4rem;min-width:0;padding:.3rem;box-sizing:border-box}
.medicine-detail-demand-facts button{font-size:var(--text-xs);padding:.3rem .5rem;white-space:normal}
.medicine-detail-demand-months{display:flex;align-items:flex-end;gap:.3rem;height:70px;margin-top:.7rem}
.medicine-detail-demand-months > div{flex:1;min-width:0;display:grid;justify-items:center;align-content:end;height:100%;gap:.2rem;font-size:var(--text-xs);color:var(--ink-soft)}
.medicine-detail-demand-months i{display:block;width:100%;max-width:26px;min-height:2px;background:var(--brand);border-radius:3px 3px 0 0}
.medicine-stage1 .medicine-detail-retail-table table{min-width:50rem;table-layout:fixed}
.medicine-stage1 .medicine-detail-retail-table col:nth-child(1){width:9rem}
.medicine-stage1 .medicine-detail-retail-table col:nth-child(3){width:8.5rem}
.medicine-stage1 .medicine-detail-retail-table col:nth-child(4){width:4rem}
.medicine-stage1 .medicine-detail-retail-table col:nth-child(5),.medicine-stage1 .medicine-detail-retail-table col:nth-child(6){width:6rem}
.medicine-stage1 .medicine-detail-retail-table col:nth-child(7){width:5rem}
@media(max-width:1020px){.medicine-detail-assessment{grid-template-columns:1fr}}
@media(max-width:720px){
 .medicine-detail-demand-facts{grid-template-columns:repeat(2,minmax(0,1fr))}
 .medicine-stage1 .medicine-detail-orders-table tr,.medicine-stage1 .medicine-detail-sales-table tr{position:relative;grid-template-columns:repeat(2,minmax(0,1fr));padding:.8rem 0;gap:.6rem .8rem}
 .medicine-stage1 .medicine-detail-orders-table td,.medicine-stage1 .medicine-detail-sales-table td{grid-column:auto;grid-row:auto;font-size:var(--text-sm);min-width:0;overflow-wrap:anywhere}
 .medicine-stage1 .medicine-detail-orders-table td:first-child,.medicine-stage1 .medicine-detail-orders-table td:nth-child(2){grid-column:auto;grid-row:2}
 .medicine-stage1 .medicine-detail-orders-table td:nth-child(3),.medicine-stage1 .medicine-detail-sales-table td:first-child{grid-column:1/-1;grid-row:1;padding-right:calc(var(--tap) + .5rem);font-size:var(--text-base)}
 .medicine-stage1 .medicine-detail-sales-table td:nth-child(2){grid-column:auto;grid-row:auto}
 .medicine-stage1 .medicine-detail-orders-table td:last-child,.medicine-stage1 .medicine-detail-sales-table td:last-child{position:absolute;top:.8rem;right:0;grid-column:auto;grid-row:auto;width:var(--tap);padding:0}
 .medicine-stage1 .medicine-detail-orders-table td.order-name:nth-child(3)::before,.medicine-stage1 .medicine-detail-orders-table td:last-child::before,.medicine-stage1 .medicine-detail-sales-table td:last-child::before{content:none}
 .medicine-stage1 .medicine-detail-orders-table td:first-child::before{content:attr(data-label);display:block;font-size:var(--text-xs);color:var(--ink-soft)}
 .medicine-detail-orders-table .medicine-order-link{margin:0}
 .medicine-stage1 .medicine-detail-retail-table table,.medicine-stage1 #medicine-detail-prescriptions table{display:block;width:100%}
 .medicine-stage1 .medicine-detail-retail-table table{min-width:0}
 .medicine-stage1 .medicine-detail-retail-table colgroup{display:none}
 .medicine-stage1 .medicine-detail-retail-table thead,.medicine-stage1 #medicine-detail-prescriptions thead{display:none}
 .medicine-stage1 .medicine-detail-retail-table tbody,.medicine-stage1 #medicine-detail-prescriptions tbody{display:block}
 .medicine-stage1 .medicine-detail-retail-table tr,.medicine-stage1 #medicine-detail-prescriptions tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.6rem;padding:.7rem 0}
 .medicine-stage1 .medicine-detail-retail-table td,.medicine-stage1 #medicine-detail-prescriptions td{display:block;padding:0;white-space:normal;overflow-wrap:anywhere}
 .medicine-stage1 .medicine-detail-retail-table .cell-clip,.medicine-stage1 #medicine-detail-prescriptions .cell-clip{white-space:normal;overflow-wrap:anywhere}
 .medicine-stage1 .medicine-detail-retail-table td::before,.medicine-stage1 #medicine-detail-prescriptions td::before{content:attr(data-label);display:block;font-size:var(--text-xs);color:var(--ink-soft)}
}

.medicine-usage-nav { display: grid; gap: 0.4rem; min-width: 0; margin: 0.65rem 0; }
.medicine-usage-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; min-width: 0; }
.medicine-usage-chip { width: auto; text-align: left; }
.medicine-usage-subchips .medicine-usage-chip { background: var(--surface-panel); }
.medicine-usage-subchips .medicine-usage-chip[aria-pressed="true"] { background: var(--brand); }
.medicine-usage-subchips { padding: 0.4rem; border-radius: var(--radius-md); background: var(--surface-subtle); }
.medicine-usage-value { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; min-width: 6rem; }
.medicine-usage-review { padding: 0.1rem 0.3rem; border-radius: var(--radius-sm); color: var(--warn-ink); background: var(--surface-tint); font-size: var(--text-xs); white-space: nowrap; }
.medicine-sales-insight { display: inline-flex; flex-direction: column; min-width: 0; }
.medicine-sales-insight.needs-purchase { color: var(--warn-ink); }
.medicine-sales-coverage { color: var(--ink-soft); font-size: var(--text-xs); }
.medicine-center-list-table td[data-column="purchase_needed"] { min-width: 7.5rem; }
.medicine-mobile-card, .medicine-mobile-card-fields { min-width: 0; }
.medicine-table-scroll { max-width: 100%; overflow-x: auto; }
.medicine-usage-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.medicine-usage-history { margin-top: 0.6rem; font-size: var(--text-sm); }
@media (max-width: 390px) { .medicine-usage-nav, .medicine-usage-chips { max-width: 100%; } }
@media (max-width: 768px) {
  .medicine-list-toolbar-title, .medicine-list-search {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }
  .medicine-list-toolbar-actions {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
  }
  .medicine-list-toolbar-actions > :not(.medicine-mobile-controls-backdrop) {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .medicine-list-toolbar-actions button,
  .medicine-list-toolbar-actions summary { white-space: nowrap; }
  .medicine-list-toolbar-actions .medicine-mobile-controls { order: 1; }
  .medicine-list-toolbar-actions .medicine-table-more-menu { order: 2; margin-left: auto; }
  .medicine-list-toolbar-actions .medicine-mobile-current-sort {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
  }
  .medicine-list-stats, .medicine-usage-chips {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
  .medicine-list-stat, .medicine-usage-chip { flex: 0 0 auto; white-space: nowrap; }
  .medicine-list-conditions { max-width: 100%; }
}
#price-labels-root { min-width: 0; }
.price-label-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0.5rem; }
.price-label-toolbar input[type="search"] { flex: 1 1 14rem; min-width: 0; }
.price-label-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.price-label-chip { border: 1px solid var(--line); border-radius: 999px; background: var(--surface-panel);
  color: var(--ink); padding: 0.3rem 0.75rem; font-size: var(--text-sm); min-height: 2.25rem; }
.price-label-chip[aria-pressed="true"] { border-color: var(--brand); background: var(--surface-tint); font-weight: 700; }
.price-label-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-md); }
.price-label-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.price-label-table th, .price-label-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line-soft);
  text-align: left; vertical-align: top; word-break: keep-all; }
.price-label-table th { background: var(--surface-subtle); color: var(--ink-soft); white-space: nowrap; position: sticky; top: 0; }
.price-label-table tbody tr { cursor: pointer; }
.price-label-table tbody tr:hover, .price-label-table tbody tr:focus-visible { background: var(--surface-tint); outline: none; }
.price-label-table td.is-owner { font-weight: 700; color: var(--brand-strong); }
.price-label-medicine strong, .price-label-medicine small { display: block; }
.price-label-medicine small, .price-label-muted { color: var(--ink-faint); font-size: var(--text-xs); }
.price-label-category { color: var(--ink-soft); white-space: nowrap; }
.price-label-prices { white-space: nowrap; font-variant-numeric: tabular-nums; }
.price-label-state small { display: block; color: var(--warn-ink); font-size: var(--text-xs); }
.price-label-badge { display: inline-block; border-radius: 999px; padding: 0.1rem 0.5rem; font-size: var(--text-xs); white-space: nowrap; }
.price-label-badge.is-ai { background: var(--warn-surface); color: var(--warn-ink); }
.price-label-badge.is-owner { background: var(--surface-tint-strong); color: var(--brand-strong); }
.price-label-badge.is-missing { background: var(--danger-surface); color: var(--danger-ink); }
.price-label-pager { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin: 0.75rem 0; }
.price-label-dialog { width: min(60rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); border: 0;
  border-radius: var(--radius-lg); padding: 1.25rem; }
.price-label-dialog::backdrop { background: rgb(0 0 0 / 0.4); }
.price-label-dialog h2 { margin: 0; font-size: var(--text-lg); }
.price-label-dialog-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.25rem; margin-top: 1rem; }
@media (max-width: 720px) { .price-label-dialog-body { grid-template-columns: minmax(0, 1fr); } }
.price-label-inputs { display: grid; gap: 0.6rem; min-width: 0; }
.price-label-field { display: grid; gap: 0.25rem; font-size: var(--text-sm); color: var(--ink-soft); }
.price-label-field em { font-style: normal; margin-left: 0.4rem; color: var(--ink-faint); font-size: var(--text-xs); }
.price-label-field input { min-width: 0; }
.price-label-units { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; min-width: 0; }
.price-label-units legend { font-size: var(--text-sm); color: var(--ink-soft); }
.price-label-unit-row { display: grid; grid-template-columns: minmax(0, 1fr) 6rem 4.5rem; gap: 0.4rem; align-items: center;
  font-size: var(--text-xs); margin-top: 0.35rem; }
.price-label-side { display: grid; gap: 0.5rem; align-content: start; justify-items: start; }
.price-label-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
/* 50 x 30 mm label preview at 1.9x; monochrome like the thermal print. */
.price-label-preview { width: calc(50mm * 1.9); height: calc(30mm * 1.9); }
.price-label-sheet { width: 50mm; height: 30mm; transform: scale(1.9); transform-origin: 0 0; background: #fff; color: #000;
  box-shadow: 0 0 0 0.15mm #9aa3ad; padding: 1.6mm 1.8mm; display: flex; flex-direction: column; overflow: hidden;
  font-family: "Pretendard Variable", sans-serif; letter-spacing: -0.02em; line-height: 1.15; }
.price-label-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.2mm; }
.price-label-title { font-size: 15pt; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.price-label-lead { font-size: 6.6pt; font-weight: 700; margin-top: 0.5mm; white-space: nowrap; overflow: hidden; }
.price-label-qr { width: 8.6mm; height: 8.6mm; border: 0.3mm dashed #000; font-size: 5pt; display: grid; place-items: center; }
.price-label-rule { border-top: 0.3mm solid #000; margin: 1mm 0 0.9mm; }
.price-label-detail { font-size: 6.2pt; white-space: nowrap; overflow: hidden; }
.price-label-foot { flex: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 1.2mm; min-height: 0; }
.price-label-name { font-size: 7.6pt; font-weight: 800; white-space: nowrap; overflow: hidden; min-width: 0; padding-bottom: 0.5mm; }
.price-label-price { font-weight: 900; font-size: 20pt; white-space: nowrap; line-height: 0.95; letter-spacing: -0.03em; }
.price-label-won { font-size: 0.45em; font-weight: 700; margin-left: 0.12em; }
.price-label-sheet.is-units .price-label-title { font-size: 13pt; }
.price-label-subline { font-size: 6.6pt; font-weight: 800; margin-top: 0.5mm; white-space: nowrap; overflow: hidden; }
.price-label-boxes { flex: 1; display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 1mm; margin-top: 1mm; min-height: 0; }
.price-label-box { border: 0.3mm solid #000; border-radius: 1mm; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 0.5mm; min-width: 0; }
.price-label-box .price-label-price { font-size: 11pt; }
.price-label-pill { border: 0.3mm solid #000; border-radius: 99mm; font-size: 6.4pt; font-weight: 800; padding: 0 1.1mm; white-space: nowrap; }
.price-label-per { font-size: 5.8pt; font-weight: 700; white-space: nowrap; }
#shelf-check-root { min-width: 0; display: grid; gap: 0.75rem; margin-top: 0.75rem; }
.shelf-views, .shelf-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.shelf-location-bar, .shelf-location-form, .shelf-scan-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.shelf-location-bar select { flex: 1 1 14rem; min-width: 0; min-height: 2.75rem; }
.shelf-location-form input, .shelf-scan-form input { flex: 1 1 12rem; min-width: 0; min-height: 2.75rem; font-size: var(--text-md); }
.shelf-location-form .shelf-form-message { flex-basis: 100%; }
.shelf-danger { color: var(--danger-ink); }
.shelf-scanner { display: grid; gap: 0.5rem; }
.shelf-camera { position: relative; width: 100%; max-width: 32rem; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius-md); background: #000; }
.shelf-camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.shelf-camera::after { content: ""; position: absolute; inset: 22% 12%; border: 2px solid rgb(255 255 255 / 0.85);
  border-radius: 0.5rem; pointer-events: none; }
.shelf-scan-message:empty { display: none; }
.shelf-scan-message, .shelf-note { margin: 0; font-size: var(--text-sm); color: var(--brand-strong); }
.shelf-muted { color: var(--ink-faint); font-size: var(--text-sm); margin: 0; }
.shelf-card { border: 1px solid var(--brand); border-radius: var(--radius-md); background: var(--surface-panel);
  padding: 0.75rem; display: grid; gap: 0.5rem; }
.shelf-card h2 { margin: 0; font-size: var(--text-lg); }
.shelf-card-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: flex-start; }
.shelf-card-head small { color: var(--ink-soft); font-size: var(--text-xs); }
.shelf-expiries, .shelf-choices, .shelf-item-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.shelf-expiry { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; padding: 0.4rem 0;
  border-bottom: 1px solid var(--line-soft); }
.shelf-expiry-date { font-weight: 700; font-variant-numeric: tabular-nums; }
.shelf-expiry small { color: var(--ink-soft); font-size: var(--text-xs); }
.shelf-expiry-actions { margin-left: auto; display: flex; gap: 0.3rem; }
.shelf-expiry-actions button { min-height: 2rem; padding: 0.15rem 0.6rem; font-size: var(--text-xs); }
.shelf-expiry-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; gap: 0.4rem; }
.shelf-expiry-form input { min-width: 0; min-height: 2.75rem; font-size: var(--text-md); }
.shelf-expiry-form .shelf-form-message { grid-column: 1 / -1; color: var(--danger-ink); }
@media (max-width: 40rem) { .shelf-expiry-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .shelf-expiry-form button { grid-column: 1 / -1; } }
.shelf-choice, .shelf-item-open { width: 100%; text-align: left; display: grid; gap: 0.2rem; padding: 0.55rem 0.7rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-panel); color: var(--ink); }
.shelf-choice small, .shelf-item-open small { color: var(--ink-soft); font-size: var(--text-xs); }
.shelf-item { display: flex; gap: 0.4rem; align-items: stretch; }
.shelf-item .shelf-item-open { flex: 1; min-width: 0; }
.shelf-remove { flex: none; }
.shelf-item-meta { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.shelf-badge, .shelf-date { display: inline-block; border-radius: 999px; padding: 0.05rem 0.5rem; font-size: var(--text-xs);
  white-space: nowrap; background: var(--surface-subtle); color: var(--ink-soft); }
.shelf-date { font-variant-numeric: tabular-nums; }
.shelf-badge.is-expired, .shelf-date.is-expired { background: var(--danger-surface); color: var(--danger-ink); font-weight: 700; }
.shelf-badge.is-imminent, .shelf-date.is-imminent { background: var(--warn-surface); color: var(--warn-ink); font-weight: 700; }
.shelf-badge.is-no_expiry, .shelf-badge.is-check_due { background: var(--surface-tint); color: var(--brand-strong); }
.shelf-map { display: grid; gap: 1rem; }
.shelf-map-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.shelf-map-tools p { margin: 0; }
.shelf-zone h3 { margin: 0 0 0.5rem; font-size: var(--text-md); }
.shelf-fixture-photo { position: relative; overflow: hidden; width: 100%; border-radius: var(--radius-sm);
  background: var(--surface-subtle); touch-action: none; }
.shelf-fixture-photo img { position: absolute; top: 0; height: 100%; max-width: none; object-fit: fill; user-select: none;
  -webkit-user-drag: none; }
.shelf-zone { min-width: 0; }
.shelf-grid-wrap { max-width: 100%; overflow-x: auto; }
.shelf-grid { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 3px;
  font-variant-numeric: tabular-nums; }
.shelf-grid th:first-child { width: 1.4rem; }
.shelf-grid th { padding: 0 0.15rem; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 600; text-align: center; }
.shelf-grid tbody th { min-width: 1.4rem; }
.shelf-grid td { padding: 0; }
.shelf-grid-head { width: 100%; min-width: 2.4rem; min-height: 2rem; padding: 0.1rem 0.3rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-subtle); color: var(--ink); font-weight: 800;
  font-size: var(--text-sm); }
.shelf-cell { display: grid; place-items: center; align-content: center; gap: 0; width: 100%; min-width: 2.4rem;
  min-height: 2.6rem; padding: 0.1rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-panel); color: var(--ink); cursor: pointer; }
.shelf-cell strong { font-size: var(--text-md); }
.shelf-cell small { color: var(--warn-ink); font-size: 0.65rem; font-weight: 700; }
.shelf-cell span { color: var(--ink-soft); font-size: var(--text-xs); }
.shelf-cell.is-empty strong { color: var(--ink-faint); font-weight: 400; }
.shelf-cell.is-attention { border-color: var(--warn-ink); background: var(--warn-surface); }
.shelf-cell.is-selected { border: 2px solid var(--brand); background: var(--surface-tint); }
.shelf-grid-add { width: 100%; min-width: 2.4rem; min-height: 2rem; padding: 0; border: 1px dashed var(--line);
  border-radius: var(--radius-sm); background: transparent; color: var(--ink-soft); font-size: var(--text-xs); }
.shelf-grid-legend { display: block; margin-top: 0.3rem; }
.shelf-place { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 0.4rem 0.75rem; }
.shelf-place-text { display: grid; gap: 0.25rem; }
.shelf-place-text strong { font-size: var(--text-xl, 1.35rem); }
.shelf-place-column { grid-row: span 2; list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; width: 5.5rem; }
.shelf-place-column .shelf-cell { grid-template-columns: auto auto; justify-content: space-between; min-height: 2.1rem;
  padding: 0.1rem 0.45rem; }
.shelf-place-column .shelf-cell small { display: none; }
.shelf-place > .shelf-grid-add { grid-column: 1; justify-self: start; width: auto; padding: 0 0.75rem; }
.shelf-photo-part summary { cursor: pointer; color: var(--ink-soft); font-size: var(--text-sm); }
.shelf-fixture-editor { display: grid; gap: 0.6rem; padding: 0.75rem; border: 2px solid var(--brand);
  border-radius: var(--radius-sm); background: var(--surface-panel); }
.shelf-fixture-editor h3 { margin: 0; }
.shelf-fixture-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.5rem; }
.shelf-field { display: grid; gap: 0.2rem; font-size: var(--text-sm); }
.shelf-field input { min-width: 0; min-height: 2.5rem; }
.shelf-fixture-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.shelf-fixture-levels { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; max-width: 32rem; }
.shelf-level-row { display: flex; align-items: center; gap: 0.4rem; }
.shelf-level-row span { flex: 1; font-variant-numeric: tabular-nums; }
.shelf-level-row button { min-height: 2.25rem; padding: 0.1rem 0.6rem; font-size: var(--text-sm); }
.shelf-bounds-editor { max-width: 32rem; }
.shelf-crop-shade { position: absolute; top: 0; bottom: 0; background: rgba(40, 40, 40, 0.55); pointer-events: none; }
.shelf-crop-line { position: absolute; top: 0; bottom: 0; width: 1.25rem; margin-left: -0.625rem; cursor: ew-resize;
  background: linear-gradient(90deg, transparent 45%, var(--brand) 45%, var(--brand) 55%, transparent 55%); }
.shelf-bound-line { position: absolute; height: 1.25rem; margin-top: -0.625rem; cursor: ns-resize;
  background: linear-gradient(transparent 42%, #ffd23c 42%, #ffd23c 58%, transparent 58%); }
.shelf-bound-line span { position: absolute; left: 0.25rem; top: 100%; padding: 0 0.3rem; border-radius: 999px;
  background: rgba(0, 0, 0, 0.62); color: #fff; font-size: var(--text-xs); font-weight: 700; }
.shelf-lots { display: grid; gap: 0.4rem; }
.shelf-lots h3 { margin: 0.25rem 0 0; font-size: var(--text-md); }
.shelf-lot-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.shelf-lot { display: grid; gap: 0.3rem; }
.shelf-lot-pick { width: 100%; text-align: left; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 0.2rem 0.75rem; padding: 0.5rem 0.65rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-panel); color: var(--ink); }
.shelf-lot-pick[aria-pressed="true"] { border: 2px solid var(--brand); background: var(--surface-tint); }
.shelf-lot.is-depleted .shelf-lot-pick { color: var(--ink-faint); }
.shelf-lot .shelf-expiries { padding-left: 0.75rem; }
.shelf-lot-receipt { display: grid; gap: 0.2rem; min-width: 0; }
.shelf-lot-expiry { display: grid; justify-items: end; gap: 0.1rem; text-align: right; }
.shelf-lot-expiry small { color: var(--ink-soft); font-size: var(--text-xs); }
.shelf-lot-expiry strong { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.shelf-lot-expiry strong .shelf-badge { margin-left: 0.3rem; vertical-align: middle; }
.shelf-lot-expiry .is-missing { color: var(--ink-faint); font-size: var(--text-md); font-weight: 600; }
.shelf-lot-expiry .is-expired { color: var(--danger-ink); }
.shelf-lot-expiry .is-imminent { color: var(--warn-ink); }
.shelf-lot-action { justify-self: start; min-height: 2.25rem; font-size: var(--text-sm); }
.shelf-badge.is-depleted { background: var(--surface-subtle); color: var(--ink-faint); border: 1px solid var(--line); }
.shelf-display { display: grid; gap: 0.75rem; }
.shelf-display-level { display: grid; gap: 0.4rem; padding: 0.6rem 0; border-top: 1px solid var(--line-soft); }
.shelf-display-level > button { justify-self: start; }
.shelf-display-level details summary { cursor: pointer; font-size: var(--text-sm); color: var(--brand-strong); }
.shelf-display-products { list-style: none; margin: 0.3rem 0 0; padding: 0; display: grid; gap: 0 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); }
.shelf-display-product { display: grid; gap: 0.05rem; padding: 0.25rem 0; border-bottom: 1px solid var(--line-soft); }
.shelf-display-product small { color: var(--ink-soft); font-size: var(--text-xs); }
.shelf-badge.is-plan { background: var(--surface-tint); color: var(--brand-strong); white-space: normal; }
.shelf-badge.is-fill-room { background: var(--surface-tint); color: var(--brand-strong); font-weight: 700; }
.shelf-badge.is-fill-fit { background: var(--surface-subtle); color: var(--ink); font-weight: 700; }
.shelf-badge.is-fill-tight { background: var(--warn-surface); color: var(--warn-ink); font-weight: 700; }
.shelf-display-editor { display: grid; gap: 0.5rem; padding: 0.6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.shelf-display-editor select, .shelf-display-editor textarea { width: 100%; min-width: 0; min-height: 2.75rem;
  font-size: var(--text-md); box-sizing: border-box; }
.shelf-display-chosen { margin: 0; padding-left: 1.4rem; display: grid; gap: 0.3rem; }
.shelf-display-chosen li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.shelf-display-chosen li span { flex: 1 1 10rem; min-width: 0; }
.shelf-display-chosen button { min-height: 2rem; padding: 0.15rem 0.6rem; font-size: var(--text-xs); }
.shelf-display-categories summary { cursor: pointer; font-weight: 700; }
.shelf-display-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.shelf-display-table th, .shelf-display-table td { padding: 0.35rem 0.4rem; border-bottom: 1px solid var(--line-soft);
  text-align: left; }
.shelf-display-table td:nth-child(2), .shelf-display-table td:nth-child(3), .shelf-display-table td:nth-child(4) {
  text-align: right; font-variant-numeric: tabular-nums; }
.shelf-display-table tr.is-unplanned td { color: var(--warn-ink); }
.shelf-display-product.is-unsold span { color: var(--ink-soft); }
.shelf-display-group { display: grid; gap: 0.2rem; padding: 0.35rem 0 0.35rem 0.6rem; border-left: 3px solid var(--surface-tint); }
.shelf-display-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; }
.shelf-display-group details summary { cursor: pointer; font-size: var(--text-sm); color: var(--brand-strong); }
.shelf-display-map { display: grid; gap: 1rem; }
.shelf-display-fixtures { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); }
.shelf-display-fixture { display: grid; align-content: start; gap: 0.35rem; min-width: 0; padding: 0.5rem; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-panel); color: var(--ink); cursor: pointer; font: inherit; }
.shelf-display-fixture:hover, .shelf-display-fixture:focus-visible { border-color: var(--brand); }
.shelf-display-fixture-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.4rem; }
.shelf-display-fixture-head small { color: var(--ink-soft); font-size: var(--text-xs); }
.shelf-display-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.shelf-display-mini li { display: grid; grid-template-columns: 1.1rem minmax(0, 1fr); gap: 0.3rem; align-items: center;
  min-height: 1.5rem; padding: 0.1rem 0.3rem; border-radius: 4px; background: var(--surface-tint); font-size: var(--text-xs); }
.shelf-display-mini li b { color: var(--ink-soft); font-weight: 600; text-align: right; }
.shelf-display-mini li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf-display-mini li.is-empty { background: var(--surface-subtle); color: var(--ink-faint); }
.shelf-display-mini li.is-fill-tight { box-shadow: inset 3px 0 0 var(--warn-ink); }
.shelf-display-mini li.is-fill-room { box-shadow: inset 3px 0 0 var(--brand); }
.shelf-floor-section { display: grid; gap: 0.4rem; }
.shelf-floor-section h3 { margin: 0; font-size: var(--text-md); }
.shelf-floor-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-subtle); }
.shelf-floor { position: relative; min-width: 72rem; }
.shelf-floor-mark { position: absolute; display: grid; place-items: center; color: var(--ink-faint);
  font-size: var(--text-xs); text-align: center; overflow: hidden; }
.shelf-floor-mark.is-room { border: 1px dashed var(--line); background: var(--surface-panel); }
.shelf-floor-mark.is-door { background: var(--surface-tint); color: var(--brand-strong); border: 2px solid var(--brand); font-weight: 700; }
.shelf-floor-fixture { position: absolute; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 1px;
  padding: 2px 3px; overflow: hidden; text-align: left; border: 1px solid var(--brand); border-radius: 4px;
  background: var(--surface-panel); color: var(--ink); cursor: pointer; font: inherit; }
.shelf-floor-fixture:hover, .shelf-floor-fixture:focus-visible { border-width: 2px; z-index: 1; }
.shelf-floor-fixture.is-empty { border-color: var(--line); color: var(--ink-faint); }
.shelf-floor-fixture strong { font-size: var(--text-xs); color: var(--brand-strong); }
.shelf-floor-fixture ol { list-style: none; margin: 0; padding: 0; display: grid; align-content: start; min-height: 0; }
.shelf-floor-fixture li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.68rem; line-height: 1.3; }
.shelf-floor-fixture li.is-fill-tight { color: var(--warn-ink); }
.shelf-expiry-form .shelf-form-target { grid-column: 1 / -1; color: var(--brand-strong); font-weight: 700; }
.shelf-photo-button { position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  min-height: 2.75rem; padding: 0 0.9rem; border: 1px solid var(--brand); border-radius: var(--radius-sm);
  background: var(--surface-panel); color: var(--brand-strong); font-weight: 700; }
.shelf-photo-button:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.shelf-photo-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
@media (max-width: 40rem) { .shelf-expiry-form .shelf-photo-button { grid-column: 1 / -1; } }
.shelf-photos { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.75rem; display: grid; gap: 0.5rem;
  background: var(--surface-panel); }
.shelf-photos h2 { margin: 0; font-size: var(--text-md); }
.shelf-photo { display: flex; gap: 0.5rem; align-items: flex-start; justify-content: space-between;
  border-bottom: 1px solid var(--line-soft); padding-bottom: 0.4rem; }
.shelf-photo strong, .shelf-photo small { display: block; }
.shelf-photo small { color: var(--ink-soft); font-size: var(--text-xs); }
.shelf-photo p { margin: 0.2rem 0 0; }
.shelf-photo-result { font-weight: 700; font-variant-numeric: tabular-nums; }
.shelf-photo-actions { display: flex; gap: 0.3rem; flex: none; }

/* Audit follow-up: retain the existing tokens, filters and original evidence. */
/* Queue observations must not override the application's explicit return position. */
#owner-review-workspace { overflow-anchor: none; }
.asset-version-notice { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin-bottom: 1rem; padding: .65rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius-md); background: var(--surface-tint); color: var(--ink);
  max-width: 100%; overflow-wrap: anywhere; }
.asset-version-notice button { width: auto; min-width: var(--tap); min-height: var(--tap); }
.medicine-detail-actions-popover button,
.inventory-table td button,
.order-history-table th > .medicine-table-heading-trigger,
.inventory-table th .medicine-table-filter > summary.medicine-table-heading-trigger,
.shelf-expiry-actions button,
.shelf-grid-head, .shelf-cell, .shelf-place-column .shelf-cell, .shelf-grid-add,
#owner-review-root button { min-width: var(--tap); min-height: var(--tap); }
.shelf-expiry-actions { gap: .5rem; flex-wrap: wrap; }
.shelf-cell small, .shelf-floor-fixture li { font-size: .75rem; }
#owner-review-root input, #owner-review-root select, #owner-review-root textarea { font-size: var(--text-md); }
.order-history-status-history { width: 100%; min-width: 0; }
.order-history-status-history summary, .sales-price-purchase-evidence summary,
.sales-price-stock-evidence summary {
  min-height: var(--tap); padding: .5rem 0; cursor: pointer; overflow-wrap: anywhere; }
.order-history-status-history[open] > div { display: grid; gap: .5rem; padding: .5rem 0; }
.order-history-status-history[open] > div > div { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.sales-price-purchase-evidence, .sales-price-stock-evidence { white-space: normal; overflow-wrap: anywhere; max-width: 22rem; }
.sales-price-purchase-evidence p, .sales-price-stock-evidence p { margin: .25rem 0; }
@media (min-width: 40.01rem) {
  .inventory-table th:first-child, .inventory-table td:first-child { position: sticky; left: 0;
    z-index: 1; min-width: 14rem; max-width: 20rem; white-space: normal; overflow-wrap: anywhere;
    background: var(--surface-panel); }
  .inventory-table th:first-child { z-index: 2; }
}
@media (max-width: 40rem) {
  .inventory-table { display: block; width: 100%; min-width: 0 !important; }
  .inventory-table thead, .inventory-table tbody { display: block; }
  .inventory-table thead tr { display: flex; flex-wrap: wrap; gap: .5rem; }
  .inventory-table thead th { display: block; flex: 1 1 45%; min-width: 0; max-width: 100%; }
  .inventory-table tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr));
    margin-top: .75rem; border: 1px solid var(--line); border-radius: var(--radius-md); padding: .5rem; }
  .inventory-table tbody td { display: block; min-width: 0; max-width: 100%; white-space: normal;
    overflow-wrap: anywhere; text-align: left; padding: .5rem; }
  .inventory-table tbody td::before { content: attr(data-label); display: block;
    margin-bottom: .2rem; font-size: var(--text-xs); color: var(--ink-soft); }
  .inventory-table tbody td:first-child, .inventory-table tbody td:nth-child(2),
  .inventory-table tbody td:last-child { grid-column: 1 / -1; }
}


.owner-restore-history {
  width: min(720px, calc(100% - 24px));
  max-height: 85dvh;
  overflow: auto;
  border: 1px solid #a2acba;
  border-radius: 12px;
  color: inherit;
  background: var(--panel-bg, #fff);
  padding: 16px;
}
.owner-restore-history::backdrop { background: rgb(15 23 42 / 55%); }
.owner-restore-history li { margin-block: 8px; overflow-wrap: anywhere; }
.owner-restore-history button { margin: 4px; }
.owner-restore-history pre {
  margin: 4px 0 12px;
  max-height: 16rem;
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
