:root {
  color-scheme: light;
  --bg: #f2f6fa;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --text: #17211d;
  --muted: #64706a;
  --line: #d8ded9;
  --accent: #0b5ea8;
  --accent-strong: #08467e;
  --brand-red: #d71920;
  --warn-bg: #fff7ed;
  --warn: #9a3412;
  --ok-bg: #ecfdf5;
  --ok: #047857;
  --shadow: 0 12px 34px rgba(13, 48, 83, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(248, 251, 255, 0.34), rgba(248, 251, 255, 0.48)),
    url("../public/assets/hospital-background.png") center top / cover no-repeat fixed,
    #eef6ff;
  background-attachment: fixed;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

body::before {
  content: none;
}

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

button {
  cursor: pointer;
}

#app {
  min-height: 100vh;
  padding: 0 22px 22px;
}

.system-bar {
  min-height: 64px;
  margin: 0 -22px 24px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, #173f68, #285f8f);
  color: #fff;
  box-shadow: 0 14px 34px rgba(13, 48, 83, 0.2);
}

.system-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 18px;
  font-weight: 900;
}

.system-brand img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
}

.system-pill {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 8px 22px rgba(0, 0, 0, 0.16);
  font-size: 18px;
  font-weight: 900;
}

.system-pill:hover {
  background: rgba(255, 255, 255, 0.24);
}

.function-panel {
  position: absolute;
  top: 78px;
  right: 22px;
  z-index: 30;
  width: min(430px, calc(100vw - 44px));
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(23, 63, 104, 0.96);
  box-shadow: 0 22px 48px rgba(13, 48, 83, 0.28);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.function-card {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.function-head {
  display: none;
}

.function-head span {
  font-size: 20px;
  font-weight: 900;
}

.function-head small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.welcome-brand {
  max-width: 1500px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
}

.welcome-brand img {
  width: min(880px, 82vw);
  height: 190px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.top-actions,
.purchase-actions,
.external-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.top-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: center;
  align-items: stretch;
  gap: 12px;
  width: 100%;
}

.primary-btn,
.ghost-btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
  line-height: 1.15;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #087e8f);
  color: #fff;
}

.top-actions .primary-btn,
.top-actions .ghost-btn {
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #fff;
  background: rgba(11, 78, 130, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  font-size: 16px;
}

.top-actions .ghost-btn {
  background: rgba(11, 78, 130, 0.82);
}

.top-actions .primary-btn {
  background: rgba(11, 78, 130, 0.82);
}

.top-actions .primary-btn:hover,
.top-actions .ghost-btn:hover {
  border-color: rgba(255, 255, 255, 0.58);
  background: #0d5f9f;
  color: #fff;
}

.primary-btn:hover {
  background: var(--accent-strong);
}

.ghost-btn,
.icon-btn {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.ghost-btn:hover,
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn {
  min-width: 38px;
  padding: 0;
  font-size: 20px;
}

.full-width {
  width: 100%;
}

.summary-strip {
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.summary-strip div,
.summary-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 11px 12px;
  box-shadow: none;
  text-align: left;
}

.summary-card {
  color: #fff;
}

.summary-card:hover,
.summary-card.active {
  border-color: rgba(255, 255, 255, 0.55);
}

.summary-strip span,
.summary-card span {
  display: block;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.summary-strip small,
.summary-card small {
  color: rgba(255, 255, 255, 0.86);
}

.purchase-panel {
  max-width: 1500px;
  margin: 0 auto 18px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading p,
.results-head p,
.drug-card p,
.detail-title p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

textarea {
  width: 100%;
  margin: 12px 0;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.file-import {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.file-import span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.file-import input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 12px;
}

.workspace {
  max-width: 1500px;
  margin: 0 auto;
  display: block;
}

.filters,
.results,
.detail {
  min-height: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.filters {
  padding: 16px;
}

.filter-strip {
  max-width: 1500px;
  min-height: auto;
  margin: 0 auto 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
  padding: 16px;
}

.filter-strip label,
.filter-strip .search-box {
  margin-bottom: 0;
}

.filter-strip input[type="search"],
.filter-strip select {
  height: 52px;
  min-height: 52px;
}

.filters label,
.detail-section label,
.search-box {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.filters span,
.detail-section span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filter-note,
.save-hint,
.basis-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

input[type="search"],
input[type="text"],
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

.search-box input {
  min-height: 48px;
  font-size: 16px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.24);
  border-color: var(--accent);
}

.check-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
}

.results {
  padding: 16px;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.bulk-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.bulk-actions .ghost-btn {
  min-height: 44px;
  padding: 0 16px;
  white-space: nowrap;
}

.drug-list {
  display: grid;
  gap: 14px;
}

.drug-card {
  display: grid;
  grid-template-columns: clamp(190px, 20vw, 260px) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.drug-card:hover,
.drug-card.active {
  border-color: var(--accent);
}

.drug-card:hover {
  transform: translateY(-1px);
}

.mini-pack {
  position: relative;
  min-height: 210px;
  border-radius: 7px;
  background: var(--pack-bg);
  color: var(--pack-fg);
  border: 1px solid color-mix(in srgb, var(--pack-fg) 24%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 34px 12px 16px;
  text-align: center;
}

.mini-pack span {
  position: absolute;
  top: 10px;
  left: 12px;
  width: calc(100% - 24px);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.mini-pack strong {
  max-height: 96px;
  overflow: hidden;
  font-size: 27px;
  line-height: 1.2;
  word-break: break-word;
}

.mini-pack small {
  max-width: 100%;
  color: color-mix(in srgb, var(--pack-fg) 72%, white);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  word-break: break-word;
}

.mini-pack-mobile-meta {
  display: none;
}

.mini-pack-actions {
  display: none;
}

.card-title-row,
.detail-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.drug-card h3 {
  margin-bottom: 8px;
  padding-right: 8px;
  font-size: 24px;
  line-height: 1.25;
  word-break: break-word;
}

.detail-link-btn {
  min-height: 32px;
  margin-left: 8px;
  border: 1px solid rgba(11, 94, 168, 0.22);
  border-radius: 999px;
  padding: 0 12px;
  background: #eef6ff;
  color: var(--accent);
  vertical-align: middle;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.detail-link-btn:hover {
  border-color: var(--accent);
  background: #fff;
}

.drug-card-main {
  min-width: 0;
}

.select-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 110px;
  height: 56px;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
  flex-shrink: 0;
}

.select-pill input {
  margin: 0;
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.card-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
}

.card-disable-btn {
  height: 56px;
  min-width: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--warn);
  font-size: 13px;
  font-weight: 800;
}

.card-disable-btn:hover,
.danger-btn:hover {
  border-color: var(--warn);
  color: var(--warn);
}

.price-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.price-line strong {
  color: var(--accent-strong);
  font-size: 20px;
}

.price-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.distributor-line {
  margin-top: 8px;
  line-height: 1.45;
  word-break: break-word;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--surface-2);
  color: #34423b;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.tag.purchase {
  background: #e0f2fe;
  color: #075985;
}

.tag.talk {
  background: #fef3c7;
  color: #92400e;
}

.tag.tcm {
  background: #dcfce7;
  color: #166534;
}

.tag.bio {
  background: #ede9fe;
  color: #6d28d9;
}

.tag.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.tag.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.tag.update {
  background: #e0f2fe;
  color: #075985;
}

.supply-status {
  gap: 6px;
}

.signal-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 16%, transparent);
  flex: 0 0 auto;
}

.supply-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.supply-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.supply-danger {
  background: #fef2f2;
  color: #b91c1c;
}

.supply-muted {
  background: #f1f5f9;
  color: #64748b;
}

.supply-text-ok {
  color: var(--ok);
}

.supply-text-warn {
  color: var(--warn);
}

.supply-text-danger {
  color: #b91c1c;
}

.supply-text-muted {
  color: #64748b;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

.price-diff {
  color: var(--warn);
  font-weight: 800;
}

.detail {
  display: none;
}

.detail.mobile-open {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  max-height: none;
  overflow: hidden;
  margin: 0;
  padding: 20px;
  border: 0;
  border-radius: 0;
  background: rgba(13, 48, 83, 0.34);
  box-shadow: none;
  backdrop-filter: blur(4px);
}

.detail.mobile-open #drugDetail {
  position: relative;
  isolation: isolate;
  width: min(720px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(13, 48, 83, 0.22);
}

.detail.mobile-open .detail-title {
  position: sticky;
  top: -18px;
  z-index: 30;
  margin: -18px -18px 0;
  padding: 18px 18px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 18px rgba(13, 48, 83, 0.08);
  isolation: isolate;
}

.detail.mobile-open .visual-actions {
  position: static;
  z-index: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  background: color-mix(in srgb, var(--pack-bg) 82%, white);
  border-top: 1px solid color-mix(in srgb, var(--pack-fg) 12%, transparent);
}

.detail.mobile-open .visual-actions a {
  min-height: 38px;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
  font-size: 13px;
}

.detail.mobile-open .detail-title::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--surface);
}

.empty-detail {
  min-height: 420px;
  display: grid;
  place-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-detail strong {
  color: var(--text);
  font-size: 20px;
}

.detail-title h2 {
  margin: 8px 0 4px;
  font-size: 22px;
  line-height: 1.2;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.detail.mobile-open .basket-toggle,
.detail.mobile-open .danger-btn {
  display: none;
}

.danger-btn {
  color: var(--warn);
}

.detail-close {
  display: inline-flex;
}

.basket-toggle {
  min-width: 50px;
  min-height: 50px;
}

.visual-card {
  position: relative;
  z-index: 0;
  isolation: isolate;
  margin: 16px 0;
  min-height: 210px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--pack-bg);
}

.visual-card img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}

.visual-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.visual-actions a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(11, 94, 168, 0.22);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  box-shadow: 0 8px 22px rgba(13, 48, 83, 0.1);
  backdrop-filter: blur(8px);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.visual-actions a:hover {
  border-color: var(--accent);
  background: #fff;
}

.generated-pack {
  min-height: 220px;
  color: var(--pack-fg);
  display: grid;
  grid-template-columns: 78px 1fr;
  grid-template-rows: 1fr auto;
  background: var(--pack-bg);
}

.pack-band {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.56);
  font-size: 14px;
  font-weight: 900;
  writing-mode: vertical-rl;
  letter-spacing: 0;
}

.pack-body {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px 20px 14px;
  text-align: center;
}

.pack-body span,
.generated-pack em {
  font-style: normal;
  font-size: 13px;
  font-weight: 800;
}

.pack-body strong {
  width: 100%;
  max-width: 320px;
  font-size: 29px;
  line-height: 1.18;
  word-break: break-word;
}

.pack-body small {
  max-width: 100%;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.generated-pack em {
  display: block;
  padding: 0 18px 16px;
  color: color-mix(in srgb, var(--pack-fg) 76%, white);
  text-align: right;
}

.detail-section {
  border-top: 1px solid var(--line);
  padding-top: 15px;
  margin-top: 15px;
}

dl {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 8px 12px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.detail-section .ghost-btn + label {
  margin-top: 14px;
}

.group-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: -4px 0 14px;
}

.group-actions .ghost-btn {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
}

.similar-list {
  display: grid;
  gap: 8px;
}

.similar-list button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  text-align: left;
}

.similar-list button:hover {
  border-color: var(--accent);
}

.similar-list strong,
.similar-list span {
  display: block;
}

.similar-list em {
  display: block;
  margin-top: 5px;
  color: var(--warn);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.similar-list span,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.empty-list {
  padding: 30px;
  text-align: center;
  color: var(--muted);
}

.maintenance-panel {
  max-width: 1680px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.maintenance-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.maintenance-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.maintenance-header,
.maintenance-row {
  display: grid;
  grid-template-columns: minmax(320px, 1.45fr) minmax(260px, 1fr) 170px 250px 96px;
  gap: 18px;
  align-items: center;
}

.disabled-header,
.disabled-row {
  grid-template-columns: minmax(360px, 1.45fr) minmax(280px, 1fr) 210px 140px;
}

.selected-header,
.selected-row {
  grid-template-columns: minmax(360px, 1.45fr) minmax(280px, 1fr) 210px 220px;
}

.selected-row-actions {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 8px;
}

.maintenance-header {
  padding: 0 12px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.maintenance-list {
  display: grid;
  gap: 12px;
}

.maintenance-row {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

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

.maintenance-row strong {
  font-size: 21px;
  line-height: 1.3;
  word-break: break-word;
}

.maintenance-row span,
.maintenance-row small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.maintenance-price strong {
  color: var(--accent-strong);
  font-size: 22px;
}

.maintenance-row input[type="text"] {
  min-height: 50px;
  font-size: 17px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  #app {
    padding: 0 14px 14px;
  }

  .system-bar {
    margin: 0 -14px 18px;
  }

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

  .maintenance-header,
  .maintenance-row {
    grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 1fr);
  }

  .disabled-header,
  .disabled-row {
    grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 1fr);
  }
}

@media (max-width: 760px) {
  .function-panel {
    position: static;
    width: auto;
    margin: 0 auto 18px;
    grid-template-columns: 1fr;
  }

  .function-card {
    padding: 0;
  }

  .results-head,
  .panel-heading {
    display: grid;
  }

  .system-bar {
    min-height: 56px;
    padding: 0 14px;
  }

  .system-brand {
    font-size: 15px;
  }

  .system-brand img {
    width: 30px;
    height: 30px;
  }

  .system-pill {
    min-height: 40px;
    padding: 0 18px;
  }

  .top-actions,
  .purchase-actions {
    width: 100%;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 390px);
    max-width: 390px;
    margin: 0 auto;
    gap: 12px;
  }

  .top-actions button,
  .purchase-actions button {
    flex: 1;
  }

  .top-actions button {
    width: 100%;
    min-height: 52px;
    padding: 0 10px;
    white-space: nowrap;
    font-size: 17px;
  }

  .summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-strip {
    grid-template-columns: 1fr;
  }

  .workspace {
    display: block;
  }

  .filters,
  .results {
    margin-bottom: 14px;
    position: static;
  }

  .detail.mobile-open {
    display: block;
    padding: 12px;
  }

  .detail.mobile-open #drugDetail {
    width: auto;
    max-height: calc(100vh - 24px);
    padding: 14px;
    border-radius: 8px;
  }

  .detail.mobile-open .detail-title {
    top: -14px;
    z-index: 30;
    margin: -14px -14px 0;
    padding: 14px 14px 10px;
  }

  .detail.mobile-open .visual-card {
    z-index: 0;
  }

  .detail.mobile-open .visual-actions {
    position: static;
    z-index: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    background: color-mix(in srgb, var(--pack-bg) 82%, white);
    border-top: 1px solid color-mix(in srgb, var(--pack-fg) 12%, transparent);
  }

  .detail.mobile-open .visual-actions a {
    min-height: 38px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: none;
    font-size: 13px;
  }

  .drug-card {
    display: block;
    padding: 12px;
  }

  .mini-pack {
    min-height: 340px;
    display: flex;
    gap: 10px;
    padding: 12px 12px 14px;
  }

  .drug-card-main {
    display: none;
  }

  .card-title-row {
    display: contents;
  }

  .drug-card h3 {
    display: flex;
    justify-content: flex-end;
    margin: 10px 0 0;
    padding-right: 0;
    font-size: 0;
    line-height: 1;
  }

  .detail-link-btn {
    min-height: 30px;
    margin-left: 0;
    margin-top: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
  }

  .drug-card p {
    display: none;
  }

  .price-line {
    display: none;
  }

  .mini-pack span {
    position: static;
    width: 100%;
    font-size: 13px;
  }

  .mini-pack strong {
    max-height: 116px;
    font-size: 26px;
  }

  .mini-pack small {
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
  }

  .mini-pack-mobile-meta {
    width: 100%;
    display: grid;
    gap: 5px;
    border-top: 1px solid color-mix(in srgb, var(--pack-fg) 18%, transparent);
    padding-top: 9px;
    text-align: left;
  }

  .mini-pack-mobile-meta div {
    min-width: 0;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 8px;
    align-items: baseline;
    font-size: 12px;
    line-height: 1.25;
  }

  .mini-pack-mobile-meta b {
    color: color-mix(in srgb, var(--pack-fg) 70%, #1c2a33);
    font-weight: 900;
  }

  .mini-pack-mobile-meta em {
    min-width: 0;
    overflow: hidden;
    color: color-mix(in srgb, var(--pack-fg) 82%, #10243a);
    font-style: normal;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mini-pack-mobile-meta div:first-child em {
    color: #0b4e82;
    font-size: 18px;
    font-weight: 900;
  }

  .mini-pack-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding-top: 4px;
  }

  .mini-pack-actions .detail-link-btn,
  .mini-pack-actions .select-pill,
  .mini-pack-actions .card-disable-btn {
    width: 100%;
    min-width: 0;
    height: 44px;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-color: color-mix(in srgb, var(--pack-fg) 22%, white);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    font-family: inherit;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
  }

  .mini-pack-actions .detail-link-btn {
    color: var(--pack-fg);
  }

  .mini-pack-actions .select-pill {
    position: relative;
    justify-content: center;
    gap: 0;
    color: #234155;
    padding: 0;
    text-align: center;
  }

  .mini-pack-actions .select-pill input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }

  .mini-pack-actions .select-pill span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
  }

  .mini-pack-actions .select-pill.is-selected {
    border-color: #1d8f78;
    background: linear-gradient(135deg, #1f9d8b, #38b7a5);
    color: #fff;
    box-shadow: 0 8px 18px rgba(31, 157, 139, 0.18);
  }

  .mini-pack-actions .card-disable-btn {
    color: var(--warn);
  }

  .distributor-line,
  .card-tags,
  .card-foot {
    display: none;
  }

  .select-pill {
    width: 100%;
    min-width: 0;
    height: 48px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
  }

  .card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    order: 10;
    margin: 12px 0 0;
  }

  .card-disable-btn {
    width: 100%;
    min-width: 0;
    height: 48px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
  }

  .generated-pack {
    grid-template-columns: 58px 1fr;
  }

  .pack-body strong {
    max-width: 100%;
    font-size: 24px;
  }

dl,
  .maintenance-header,
  .maintenance-row,
  .disabled-header,
  .disabled-row,
  .selected-header,
  .selected-row {
    grid-template-columns: 1fr;
  }

  .maintenance-header {
    display: none;
  }

  .maintenance-panel {
    padding: 12px;
  }

  .maintenance-head {
    display: grid;
  }

  .maintenance-row {
    gap: 12px;
    padding: 14px;
  }

  .maintenance-row strong {
    font-size: 19px;
  }

  .group-actions {
    grid-template-columns: 1fr;
  }
}

/* 2026-06 brand alignment: visual-only overrides for the chlab portal refresh. */
:root {
  --brand-bg: #f6fbff;
  --brand-ink: #0b1527;
  --brand-blue: #1f6fff;
  --brand-green: #00a982;
  --brand-line: rgba(33, 78, 126, 0.16);
  --brand-shadow: 0 22px 70px rgba(33, 74, 118, 0.15);
}

body {
  color: var(--brand-ink);
  background:
    linear-gradient(90deg, rgba(247, 252, 255, 0.96), rgba(237, 248, 255, 0.88)),
    url("../public/assets/pharmacy-lab-bg-v2.png") 58% top / cover no-repeat fixed,
    var(--brand-bg);
}

#app {
  position: relative;
}

#app::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(247, 252, 255, 0.98), rgba(247, 252, 255, 0.66) 56%, rgba(247, 252, 255, 0.22)),
    linear-gradient(rgba(21, 72, 120, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 72, 120, 0.026) 1px, transparent 1px);
  background-size: auto, 48px 48px, 48px 48px;
  content: "";
}

.system-bar {
  min-height: 60px;
  background: linear-gradient(135deg, rgba(8, 63, 114, 0.94), rgba(15, 76, 129, 0.9));
  box-shadow: 0 18px 42px rgba(8, 32, 58, 0.22);
}

.system-brand img {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 20px rgba(8, 32, 58, 0.16);
}

.system-pill {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.16);
}

.function-panel,
.purchase-panel,
.maintenance-panel,
.filters,
.results,
.detail,
.drug-card {
  border-color: rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--brand-shadow);
}

.function-panel {
  backdrop-filter: blur(18px);
}

.function-panel .summary-strip div,
.function-panel .summary-card {
  border-color: rgba(33, 78, 126, 0.16);
  background: rgba(31, 111, 255, 0.08);
  color: var(--brand-ink);
}

.function-panel .summary-strip span,
.function-panel .summary-card span {
  color: var(--brand-blue);
}

.function-panel .summary-strip small,
.function-panel .summary-card small {
  color: var(--brand-muted);
}

.welcome-brand img {
  filter: drop-shadow(0 12px 24px rgba(33, 74, 118, 0.1));
}

.primary-btn,
.ghost-btn,
.icon-btn,
.select-pill,
.detail-link-btn,
.card-disable-btn {
  border-radius: 12px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-green));
}

.ghost-btn,
.icon-btn,
.select-pill {
  border-color: rgba(33, 78, 126, 0.16);
}

.drug-card {
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.drug-card:hover,
.drug-card.active {
  border-color: rgba(31, 111, 255, 0.46);
  box-shadow: 0 28px 82px rgba(33, 74, 118, 0.18);
}

.mini-pack,
.visual-card {
  border-radius: 16px;
}

input,
select,
textarea {
  border-color: rgba(33, 78, 126, 0.18);
  border-radius: 12px;
}

@media (max-width: 760px) {
  body {
    background:
      linear-gradient(180deg, rgba(247, 252, 255, 0.96), rgba(237, 248, 255, 0.9)),
      url("../public/assets/pharmacy-lab-bg-v2.png") 58% top / auto 520px no-repeat,
      var(--brand-bg);
  }

  #app {
    padding-inline: 14px;
  }

  .system-bar {
    margin-inline: -14px;
    padding: 0 14px;
  }

  .function-panel {
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.86);
  }

  .welcome-brand {
    margin-bottom: 14px;
  }

  .welcome-brand img {
    width: min(86vw, 360px);
    height: 150px;
  }

  .drug-card {
    border-radius: 18px;
  }

  .mini-pack {
    min-height: 300px;
    border-radius: 16px;
  }
}
