:root{
  color-scheme: light;
  --bg:#e5e7eb;
  --bg-soft:#f3f4f6;
  --panel:#ffffff;
  --panel-2:#f8fafc;
  --line:#d1d5db;
  --line-strong:#94a3b8;
  --text:#111827;
  --text-soft:#475569;
  --accent:#0f766e;
  --accent-strong:#1f2937;
  --danger:#b91c1c;
  --radius:18px;
  --shadow:0 18px 44px rgba(15,23,42,.10);
}

/* Public redesign: Technical Minimalist */
body#page-top{
  --tm-surface:#f9f9f7;
  --tm-surface-low:#f4f4f2;
  --tm-surface-mid:#eeeeec;
  --tm-surface-ink:#1a1c1b;
  --tm-surface-muted:#5f665f;
  --tm-outline:rgba(198,198,198,.68);
  --tm-outline-strong:rgba(26,28,27,.72);
  --tm-font-ui:"DM Sans","SUIT Variable","Noto Sans KR","Apple SD Gothic Neo","Malgun Gothic",sans-serif;
  --tm-font-tech:"DM Mono","SFMono-Regular","JetBrains Mono","Roboto Mono","Menlo",monospace;
  background:var(--tm-surface);
  color:var(--tm-surface-ink);
  font-family:var(--tm-font-ui);
  letter-spacing:-.01em;
}

body#page-top::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background-image:
    radial-gradient(rgba(26,28,27,.025) .45px, transparent .6px),
    radial-gradient(rgba(26,28,27,.018) .35px, transparent .55px);
  background-position:0 0, 7px 11px;
  background-size:15px 15px, 19px 19px;
  opacity:.28;
}

body#page-top .app-shell{
  position:relative;
  max-width:1480px;
  padding:28px 32px 44px;
}

body#page-top .topbar{
  align-items:flex-start;
  gap:28px;
  padding:0 0 24px;
  border-radius:0;
  border:none;
  border-bottom:.5px solid var(--tm-outline);
  background:transparent;
  color:var(--tm-surface-ink);
  box-shadow:none;
}

body#page-top .brand{
  align-items:center;
  gap:16px;
}

body#page-top .brand-logo{
  width:44px;
  height:44px;
  border-radius:2px;
}

body#page-top .brand-text{
  justify-content:center;
  gap:4px;
}

body#page-top .brand-text small{
  color:var(--tm-surface-muted);
  font-size:11px;
  font-weight:700;
  letter-spacing:.18em;
}

body#page-top .brand-text strong{
  font-size:31px;
  line-height:1.02;
  font-weight:700;
  letter-spacing:-.04em;
}

body#page-top .top-actions{
  gap:8px;
}

body#page-top .top-utility{
  display:flex;
  align-items:flex-start;
  justify-content:flex-end;
  gap:14px;
  margin-left:auto;
  flex:0 0 auto;
}

body#page-top .top-clock{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  justify-content:center;
  min-width:max-content;
  color:var(--tm-surface-muted);
  font-family:var(--tm-font-data);
  line-height:1.1;
}

body#page-top .top-clock span{
  font-size:11px;
  font-weight:600;
  letter-spacing:.05em;
}

body#page-top .top-clock strong{
  color:var(--tm-text);
  font-size:17px;
  font-weight:700;
  letter-spacing:-.03em;
}

body#page-top .action-btn,
body#page-top .action-link,
body#page-top .machine-tab,
body#page-top .text-btn{
  min-height:38px;
  padding:0 13px;
  border-radius:2px;
  border:.5px solid var(--tm-outline);
  background:transparent;
  color:var(--tm-surface-ink);
  box-shadow:none;
  font-family:var(--tm-font-ui);
  font-size:12px;
  font-weight:700;
  letter-spacing:.05em;
  text-transform:uppercase;
}

body#page-top .action-icon{
  width:14px;
  height:14px;
  border-radius:0;
  background:transparent;
  color:currentColor;
}

body#page-top #printRows.action-btn{
  background:#000;
  color:#fff;
  border-color:#000;
}

body#page-top .layout{
  grid-template-columns:minmax(240px,290px) minmax(0,1fr);
  gap:38px;
  margin-top:26px;
}

body#page-top .sidebar{
  gap:20px;
}

body#page-top .machine-tabs{
  gap:6px;
  padding:6px;
  border:.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
}

body#page-top .machine-tab{
  min-height:42px;
  padding:0 10px;
}

body#page-top .machine-tab.active{
  background:#fff;
  color:#000;
  border-color:var(--tm-outline-strong);
}

body#page-top .sidebar-overview{
  gap:18px;
}

body#page-top .search-stack{
  gap:14px;
  padding:18px 18px 14px;
  border:.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
}

body#page-top .search-wrap input{
  min-height:0;
  padding:0 30px 12px 0;
  border:none;
  border-bottom:.5px solid var(--tm-outline);
  border-radius:0;
  background:transparent;
  box-shadow:none;
  font-family:var(--tm-font-ui);
  font-size:15px;
  font-weight:500;
}

body#page-top .search-wrap input::placeholder{
  color:rgba(95,102,95,.92);
}

body#page-top .search-wrap input:focus{
  outline:none;
  border-bottom-color:#000;
}

body#page-top .search-clear{
  top:24px;
  right:0;
  bottom:auto;
  transform:none;
  width:22px;
  height:22px;
  min-width:22px;
  border:none;
  background:transparent;
  box-shadow:none;
  color:var(--tm-surface-muted);
  font-size:16px;
  font-weight:500;
  z-index:4;
  pointer-events:auto;
}

body#page-top .search-tools{
  justify-content:flex-start;
}

body#page-top .search-filter-check{
  min-height:28px;
  padding:0 10px;
  border-radius:2px;
  border:.5px solid var(--tm-outline);
  background:#fff;
  color:var(--tm-surface-muted);
  box-shadow:none;
  font-size:11px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
}

body#page-top .search-filter-check.is-active{
  background:#fff;
  color:#000;
  border-color:var(--tm-outline-strong);
  box-shadow:none;
}

body#page-top .search-filter-check:hover,
body#page-top .search-filter-check:focus-within{
  filter:none;
  outline:none;
}

body#page-top .search-suggestions{
  gap:0;
  padding:8px 0 0;
  border:none;
  border-top:.5px solid var(--tm-outline);
  border-radius:0;
  background:transparent;
  box-shadow:none;
  backdrop-filter:none;
}

body#page-top .suggestion-item{
  padding:10px 0;
  border:none;
  border-bottom:.5px solid rgba(198,198,198,.42);
  border-radius:0;
  background:transparent;
}

body#page-top .summary-stack{
  grid-template-columns:1fr;
  gap:8px;
}

body#page-top .side-card,
body#page-top .side-card-compact{
  min-height:78px;
  padding:14px 16px 12px;
  border-radius:0;
  border:.5px solid var(--tm-outline);
  background:var(--tm-surface-mid);
  box-shadow:none;
  gap:4px;
}

body#page-top .side-card .side-label,
body#page-top .side-card-compact .side-label{
  color:var(--tm-surface-muted);
  font-size:10px;
  font-weight:700;
  letter-spacing:.16em;
  text-transform:uppercase;
}

body#page-top .side-card strong,
body#page-top .side-card-compact strong{
  font-family:var(--tm-font-tech);
  font-size:24px;
  font-weight:500;
  line-height:1;
  letter-spacing:.03em;
}

body#page-top .status-line{
  padding:12px 0 0;
  border-top:.5px solid var(--tm-outline);
  border-radius:0;
  background:transparent;
  color:var(--tm-surface-muted);
  font-size:11px;
  font-weight:600;
  letter-spacing:.04em;
}

body#page-top .content{
  gap:22px;
}

body#page-top .card-list{
  grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
  gap:18px;
}

body#page-top .medicine-card{
  gap:14px;
  padding:16px;
  border-radius:2px;
  border:.5px solid var(--tm-outline);
  background:#fff;
  box-shadow:none;
  transition:border-color .16s ease, background-color .16s ease;
}

body#page-top .medicine-card.deep-link-target{
  border-color:var(--tm-outline-strong);
  box-shadow:0 0 0 3px rgba(15,118,110,.18);
  background:#f3fbfa;
}

@media (hover:hover) and (pointer:fine){
  body#page-top .medicine-card:hover,
  body#page-top .medicine-card:focus-within{
    transform:none;
    border-color:var(--tm-outline-strong);
    box-shadow:none;
    background:#fff;
  }

  body#page-top .medicine-card:hover .card-no,
  body#page-top .medicine-card:focus-within .card-no{
    color:#000;
  }

  body#page-top .medicine-card:hover .medicine-media,
  body#page-top .medicine-card:focus-within .medicine-media{
    border-color:var(--tm-outline-strong);
  }
}

body#page-top .card-head{
  align-items:flex-start;
  gap:14px;
}

body#page-top .card-head-actions{
  gap:6px;
}

body#page-top .card-no{
  font-family:var(--tm-font-tech);
  color:#000;
  font-size:28px;
  font-weight:500;
  letter-spacing:.04em;
}

body#page-top .expiry-chip,
body#page-top .card-code-value,
body#page-top .identifier-trigger{
  min-height:26px;
  padding:0 8px;
  border-radius:2px;
  border:.5px solid var(--tm-outline);
  background:transparent;
  color:var(--tm-surface-muted);
  font-family:var(--tm-font-tech);
  font-size:11px;
  font-weight:500;
  letter-spacing:.02em;
  box-shadow:none;
}

body#page-top .card-title{
  gap:10px;
}

body#page-top .card-title > strong{
  font-size:18px;
  line-height:1.26;
  font-weight:700;
  color:var(--tm-surface-ink);
  letter-spacing:-.02em;
}

body#page-top .card-meta-row{
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

body#page-top .card-code-value{
  margin-right:auto;
}

body#page-top .identifier-trigger{
  text-transform:uppercase;
}

body#page-top .identifier-trigger:hover,
body#page-top .identifier-trigger:focus-visible{
  background:#fff;
  border-color:var(--tm-outline-strong);
  color:#000;
  outline:none;
}

body#page-top .medicine-media{
  min-height:172px;
  border-radius:0;
  border:.5px solid var(--tm-outline);
  background:var(--tm-surface-mid);
}

body#page-top .medicine-media img{
  height:172px;
  object-fit:cover;
}

body#page-top .media-placeholder{
  gap:8px;
  padding:18px;
  color:var(--tm-surface-muted);
}

body#page-top .media-placeholder strong{
  font-size:12px;
  font-weight:700;
  letter-spacing:.12em;
  text-transform:uppercase;
}

body#page-top .media-placeholder span{
  font-size:12px;
}

body#page-top .empty-state{
  gap:8px;
  padding:22px 0 0;
  border:none;
  border-top:.5px solid var(--tm-outline);
  border-radius:0;
  background:transparent;
  color:var(--tm-surface-muted);
}

body#page-top .expiry-toast-inner,
body#page-top .image-modal,
body#page-top .identifier-panel{
  border-radius:2px;
  border:.5px solid var(--tm-outline);
  background:#fff;
  box-shadow:none;
}

body#page-top .expiry-toast-inner{
  background:#fff;
  color:var(--tm-surface-ink);
}

body#page-top .expiry-toast-copy strong,
body#page-top .expiry-toast-copy span{
  color:inherit;
}

body#page-top .toast-close{
  border-radius:2px;
  border:.5px solid var(--tm-outline);
  background:transparent;
  color:var(--tm-surface-ink);
}

body#page-top .identifier-panel-head,
body#page-top .modal-head{
  border-bottom:.5px solid var(--tm-outline);
}

body#page-top .identifier-code-row,
body#page-top .identifier-row{
  border-bottom:.5px solid rgba(198,198,198,.42);
}

body#page-top .identifier-code-row:last-child,
body#page-top .identifier-row:last-child{
  border-bottom:none;
}

body#page-top .identifier-code-label{
  font-size:10px;
  font-weight:700;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--tm-surface-muted);
}

body#page-top .identifier-grid dt{
  color:var(--tm-surface-muted);
}

body#page-top .identifier-grid dd,
body#page-top #identifierCode{
  font-family:var(--tm-font-tech);
}

@media (max-width:980px){
  body#page-top .app-shell{
    padding:22px 18px 34px;
  }

  body#page-top .topbar{
    flex-direction:column;
    gap:18px;
  }

  body#page-top .layout{
    grid-template-columns:1fr;
    gap:24px;
  }

  body#page-top .sidebar{
    gap:14px;
  }

  body#page-top .summary-stack{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  body#page-top .card-list{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width:640px){
  body#page-top .app-shell{
    padding:16px 12px 24px;
  }

  body#page-top .top-actions{
    display:none;
  }

  body#page-top .brand-text strong{
    font-size:26px;
  }

  body#page-top .action-btn{
    min-height:34px;
    padding:0 10px;
    font-size:11px;
  }

  body#page-top .search-stack{
    padding:14px 14px 12px;
  }

  body#page-top .summary-stack{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  body#page-top .side-card,
  body#page-top .side-card-compact{
    min-height:64px;
    padding:12px 12px 10px;
  }

  body#page-top .side-card strong,
  body#page-top .side-card-compact strong{
    font-size:18px;
  }

  body#page-top .card-list{
    gap:10px;
  }

  body#page-top .medicine-card{
    gap:10px;
    padding:12px;
  }

  body#page-top .card-no{
    font-size:22px;
  }

  body#page-top .card-title > strong{
    font-size:15px;
  }

  body#page-top .medicine-media{
    min-height:126px;
  }

  body#page-top .medicine-media img{
    height:126px;
  }
}

*{box-sizing:border-box}
html,body{margin:0;min-height:100%}
[hidden]{display:none !important}
html{
  overflow-y:auto;
  scroll-behavior:smooth;
}
body{
  font-family:'Malgun Gothic','맑은 고딕','Segoe UI',Arial,sans-serif;
  background:linear-gradient(180deg,#f3f4f6 0%,#e5e7eb 100%);
  color:var(--text);
  line-height:1.5;
  text-rendering:optimizeLegibility;
  overflow-x:hidden;
}
a{color:inherit;text-decoration:none}
button,input{font:inherit}
button{cursor:pointer}

.app-shell{
  max-width:1280px;
  margin:0 auto;
  padding:16px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:20px 22px;
  border-radius:24px;
  background:linear-gradient(135deg,#111827 0%,#0f172a 100%);
  color:#fff;
  box-shadow:0 16px 40px rgba(15,23,42,.22);
}

.brand{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
}

.brand-logo{
  width:42px;
  height:42px;
  border-radius:14px;
  flex:0 0 auto;
}

.brand-text{
  display:flex;
  flex-direction:column;
  min-width:0;
}

.brand-text small{
  font-size:12px;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:#6ee7b7;
  font-weight:800;
}

.brand-text strong{
  font-size:20px;
  line-height:1.2;
}

.top-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.mode-chip,
.action-btn,
.machine-tab,
.text-btn{
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
}

.mode-chip{
  display:inline-flex;
  align-items:center;
  min-height:42px;
  padding:0 16px;
  font-size:13px;
  font-weight:800;
}

.mode-chip.is-public{
  background:rgba(14,116,144,.18);
  color:#dbeafe;
}

.mode-chip.is-admin{
  background:rgba(15,118,110,.22);
  color:#d1fae5;
}

.action-btn,
.action-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:42px;
  padding:0 15px;
  background:#fff;
  color:#0f172a;
  border:1px solid #d6dde8;
  font-size:13px;
  font-weight:800;
  box-shadow:0 8px 22px rgba(15,23,42,.10);
  text-decoration:none;
}

.action-copy{
  display:inline-flex;
  align-items:center;
}

.action-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:18px;
  height:18px;
  border-radius:999px;
  background:#f3f4f6;
  color:#475569;
  flex:0 0 auto;
}

.action-icon svg{
  width:12px;
  height:12px;
  display:block;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
  fill:none;
}

.action-btn:hover,
.action-link:hover,
.machine-tab:hover,
.search-clear:hover,
.text-btn:hover{
  filter:brightness(.98);
}

.primary-btn{
  background:linear-gradient(180deg,#0f766e 0%,#115e59 100%);
  color:#fff;
  border-color:#115e59;
}

.layout{
  display:grid;
  grid-template-columns:minmax(260px,300px) minmax(0,1fr);
  align-items:start;
  gap:22px;
  margin-top:18px;
}

.sidebar,
.content{
  min-width:0;
}

.sidebar{
  display:grid;
  gap:14px;
  align-content:start;
}

.sidebar-overview{
  display:grid;
  gap:12px;
}

.summary-stack{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.machine-tabs{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
}

.machine-tab{
  min-height:46px;
  background:#fff;
  color:var(--accent-strong);
  border:1px solid #d4dbe6;
  font-weight:800;
}

.machine-tab.active{
  background:linear-gradient(180deg,#0f766e 0%,#115e59 100%);
  border-color:#115e59;
  color:#fff;
}

.search-wrap{
  position:relative;
}

.search-stack{
  display:grid;
  gap:8px;
}

.search-wrap input{
  width:100%;
  min-height:48px;
  border-radius:16px;
  border:1px solid #d4dbe6;
  background:#fff;
  padding:0 48px 0 16px;
  font-size:16px;
  box-shadow:0 12px 30px rgba(15,23,42,.08);
}

.search-wrap input:focus{
  outline:2px solid rgba(15,118,110,.18);
  outline-offset:2px;
}

.search-wrap input::-webkit-search-cancel-button{
  display:none;
}

.search-clear{
  position:absolute;
  top:50%;
  right:10px;
  transform:translateY(-50%);
  width:34px;
  height:34px;
  min-width:34px;
  border:1px solid #c7d3e0;
  background:#dce5ef;
  color:#334155;
  display:none;
  align-items:center;
  justify-content:center;
  font-size:20px;
  font-weight:800;
  box-shadow:0 4px 10px rgba(148,163,184,.18);
}

.search-wrap.has-value .search-clear{
  display:inline-flex;
}

.search-tools{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.search-filter-check{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:34px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid #cfe0dc;
  background:#eef8f6;
  color:#0f766e;
  font-size:12px;
  font-weight:800;
  letter-spacing:.01em;
  cursor:pointer;
  user-select:none;
  transition:border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.search-filter-check:hover{
  filter:brightness(.98);
}

.search-filter-check:focus-within{
  outline:2px solid rgba(15,118,110,.18);
  outline-offset:2px;
}

.search-filter-check.is-active{
  background:linear-gradient(180deg,#0f766e 0%,#115e59 100%);
  border-color:#115e59;
  color:#fff;
  box-shadow:0 10px 24px rgba(15,118,110,.18);
}

.search-filter-checkbox{
  width:15px;
  height:15px;
  margin:0;
  accent-color:#0f766e;
  cursor:pointer;
}

.search-filter-label{
  line-height:1;
}

.search-suggestions{
  display:grid;
  gap:6px;
  padding:10px;
  border-radius:18px;
  border:1px solid #dbe3ed;
  background:rgba(255,255,255,.98);
  box-shadow:0 18px 34px rgba(15,23,42,.12);
  backdrop-filter:blur(12px);
}

.suggestion-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  width:100%;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid transparent;
  background:#f8fafc;
  color:#0f172a;
  text-align:left;
}

.suggestion-item:hover,
.suggestion-item:focus-visible{
  border-color:#cfe0dc;
  background:#eef8f6;
  outline:none;
}

.suggestion-copy{
  display:grid;
  gap:2px;
  min-width:0;
}

.suggestion-value{
  font-size:13px;
  font-weight:800;
  color:#0f172a;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.suggestion-number{
  display:inline-block;
  margin-right:8px;
  font-family:var(--tm-font-data);
  font-weight:700;
}

.suggestion-meta{
  font-size:11px;
  color:#64748b;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.suggestion-kind{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:24px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid #d7deea;
  background:#eef2f7;
  color:#475569;
  font-size:11px;
  font-weight:800;
  white-space:nowrap;
}

.side-card{
  display:grid;
  gap:4px;
  padding:18px;
  border-radius:22px;
  border:1px solid #dbe3ed;
  background:rgba(255,255,255,.92);
  box-shadow:var(--shadow);
}

.side-label{
  font-size:11px;
  font-weight:800;
  color:#64748b;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.side-card strong{
  font-size:18px;
  line-height:1.2;
}

.side-card span:last-child{
  color:var(--text-soft);
  font-size:13px;
}

.side-card-compact{
  gap:6px;
  padding:16px 18px;
  justify-items:center;
  align-content:center;
  text-align:center;
}

.side-card-compact strong{
  font-size:20px;
}

.status-line{
  padding:14px 16px;
  border-radius:18px;
  border:1px solid #cfe7e2;
  background:#ecfeff;
  color:#0f766e;
  font-size:13px;
  font-weight:700;
  text-align:center;
}

.status-line.is-error{
  border-color:#fecaca;
  background:#fff1f2;
  color:#b91c1c;
}

.content{
  display:grid;
  gap:16px;
}

.caption-stats{
  color:#0f766e;
  font-size:14px;
  font-weight:800;
  white-space:nowrap;
}

.card-list{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(260px,298px));
  gap:16px;
  align-items:start;
  justify-content:start;
}

.medicine-card,
.admin-card{
  position:relative;
  display:grid;
  gap:12px;
  padding:18px;
  border-radius:24px;
  border:1px solid #d9e1eb;
  background:#fff;
  box-shadow:var(--shadow);
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease, background-color .18s ease;
  will-change:transform;
}

@media (hover:hover) and (pointer:fine){
  .medicine-card:hover,
  .medicine-card:focus-within,
  .admin-card:hover,
  .admin-card:focus-within{
    transform:translateY(-6px);
    border-color:rgba(15,118,110,.28);
    box-shadow:0 24px 52px rgba(15,23,42,.16), 0 0 0 1px rgba(15,118,110,.08);
  }

  .medicine-card:hover .card-no,
  .medicine-card:focus-within .card-no,
  .admin-card:hover .card-no,
  .admin-card:focus-within .card-no{
    color:#0f766e;
  }

  .medicine-card:hover .medicine-media,
  .medicine-card:focus-within .medicine-media,
  .admin-card:hover .field input,
  .admin-card:focus-within .field input{
    border-color:#b8d7d3;
  }
}

.card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
}

.card-head-actions{
  display:flex;
  align-items:flex-start;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:nowrap;
  margin-left:auto;
}

.card-no,
.expiry-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:32px;
  padding:0 12px;
  border-radius:999px;
  font-size:13px;
  font-weight:800;
  border:1px solid #d7deea;
  background:#eef2f7;
  color:#334155;
  font-variant-numeric:tabular-nums;
  line-height:1;
}

.card-no{
  min-height:auto;
  padding:0;
  border:none;
  border-radius:0;
  background:transparent;
  color:#0f172a;
  font-size:30px;
  font-weight:900;
  line-height:1;
  letter-spacing:-.05em;
  font-variant-numeric:tabular-nums;
}

.card-title{
  display:grid;
  gap:6px;
}

.card-title > strong{
  font-size:18px;
  line-height:1.22;
  font-weight:800;
  letter-spacing:-.02em;
  color:#0f172a;
}

.card-code,
.card-meta-row{
  display:flex;
  align-items:center;
  gap:8px;
}

.card-meta-row{
  justify-content:flex-end;
  flex-wrap:wrap;
}

.card-code-label{
  color:#64748b;
  font-size:13px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.expiry-chip,
.card-code-value,
.identifier-trigger{
  display:inline-flex;
  align-items:center;
  min-height:30px;
  padding:0 11px;
  border-radius:999px;
  background:#f8fafc;
  color:#334155;
  font-size:12px;
  font-weight:800;
  letter-spacing:0;
  text-transform:none;
  border:1px solid #d7dee8;
  line-height:1;
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
}

.admin-entry-btn{
  background:#fff;
  color:#0f172a;
  border-color:#d6dde8;
}

.identifier-trigger{
  justify-content:center;
  transition:border-color .18s ease, color .18s ease, background .18s ease, transform .18s ease;
}

.identifier-trigger::after{
  content:none;
}

.identifier-trigger:hover,
.identifier-trigger:focus-visible{
  border-color:#94a3b8;
  color:#0f172a;
  background:#eef2f7;
  outline:none;
}

.medicine-media{
  position:relative;
  display:grid;
  place-items:center;
  min-height:136px;
  border-radius:18px;
  overflow:hidden;
  border:1px solid #dbe3ed;
  background:#f8fafc;
}

.medicine-media img{
  width:100%;
  height:136px;
  object-fit:cover;
}

.image-load-status{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding:12px;
  color:#5c625c;
  font-family:inherit;
  font-size:12px;
  line-height:1.5;
  text-align:center;
}
.image-load-status[hidden]{display:none}
.medicine-media.is-image-loading img,
.medicine-media.is-image-failed img{visibility:hidden}

.media-placeholder{
  display:grid;
  place-items:center;
  gap:6px;
  color:#64748b;
  text-align:center;
  padding:20px;
}

.card-meta{
  display:grid;
  gap:8px;
}

.meta-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  font-size:13px;
}

.meta-row span:first-child{
  color:#64748b;
}

.empty-state{
  display:grid;
  gap:4px;
  padding:20px;
  border-radius:22px;
  border:1px dashed #cbd5e1;
  background:rgba(255,255,255,.66);
  color:#475569;
}

.expiry-toast{
  position:fixed;
  left:50%;
  bottom:18px;
  z-index:25;
  width:min(calc(100vw - 24px), 420px);
  opacity:0;
  transform:translate(-50%, 14px);
  pointer-events:none;
  transition:opacity .18s ease, transform .18s ease;
}

.expiry-toast.is-visible{
  opacity:1;
  transform:translate(-50%, 0);
  pointer-events:auto;
}

.expiry-toast-inner{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 16px;
  border-radius:18px;
  border:1px solid rgba(251,191,36,.35);
  background:rgba(17,24,39,.94);
  color:#fff7ed;
  box-shadow:0 20px 40px rgba(15,23,42,.24);
}

.expiry-toast-copy{
  display:grid;
  gap:2px;
  min-width:0;
  flex:1 1 auto;
}

.expiry-toast-copy strong{
  font-size:13px;
  line-height:1.1;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:#fde68a;
}

.expiry-toast-copy span{
  font-size:14px;
  color:#f8fafc;
}

.toast-close{
  min-width:58px;
  min-height:34px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(255,255,255,.08);
  color:#fff;
  font-size:12px;
  font-weight:800;
}

.modal-backdrop{
  position:fixed;
  inset:0;
  display:grid;
  place-items:center;
  padding:20px;
  background:rgba(15,23,42,.6);
  z-index:20;
}

.image-modal{
  width:min(860px,100%);
  border-radius:22px;
  background:#fff;
  overflow:hidden;
  box-shadow:0 24px 60px rgba(15,23,42,.28);
}

.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:16px 18px;
  border-bottom:1px solid #e5e7eb;
}

.modal-body{
  padding:18px;
}

.image-body{
  display:grid;
  place-items:center;
}

.image-body img{
  max-width:100%;
  max-height:75vh;
  object-fit:contain;
}

.identifier-overlay{
  position:fixed;
  inset:0;
  z-index:26;
}

.identifier-backdrop{
  position:absolute;
  inset:0;
  border:0;
  background:transparent;
  padding:0;
}

.identifier-panel{
  position:fixed;
  display:flex;
  flex-direction:column;
  width:min(440px, calc(100vw - 24px));
  max-height:min(78vh, 560px);
  border-radius:20px;
  border:1px solid #d9e1eb;
  background:#fff;
  box-shadow:0 24px 60px rgba(15,23,42,.24);
  overflow:hidden;
}

.identifier-panel-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:16px 18px 14px;
  border-bottom:1px solid #e5e7eb;
}

.identifier-panel-copy{
  display:grid;
  gap:3px;
  flex:1 1 auto;
  min-width:0;
}

.identifier-panel-copy strong{
  font-size:16px;
  line-height:1.15;
}

.identifier-panel-copy span{
  color:#64748b;
  font-size:12px;
  font-weight:700;
  line-height:1.45;
  overflow-wrap:anywhere;
  word-break:keep-all;
}

.identifier-panel-body{
  display:grid;
  gap:12px;
  padding:16px 18px 18px;
  overflow-y:auto;
  overscroll-behavior:contain;
}

.identifier-code-row{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.identifier-panel-head .text-btn{
  flex:0 0 auto;
  white-space:nowrap;
}

.identifier-code-label{
  color:#64748b;
  font-size:12px;
  font-weight:800;
}

.identifier-grid{
  display:grid;
  gap:8px;
  margin:0;
}

.identifier-row{
  display:grid;
  gap:4px;
  margin:0;
  padding:10px 12px;
  border-radius:16px;
  border:1px solid #e2e8f0;
  background:#f8fafc;
}

.identifier-row dt{
  color:#64748b;
  font-size:11px;
  font-weight:800;
}

.identifier-row dd{
  margin:0;
  color:#0f172a;
  font-size:13px;
  font-weight:800;
  line-height:1.35;
  word-break:break-word;
}

.identifier-actions{
  display:flex;
  justify-content:flex-end;
}

.identifier-source-link{
  min-height:36px;
  padding:0 12px;
  background:#ecfeff;
  color:#0f766e;
  border-color:#99f6e4;
}

.text-btn{
  min-height:38px;
  padding:0 14px;
  background:#fff;
  color:#0f172a;
  border:1px solid #d6dde8;
  font-size:13px;
  font-weight:800;
}

.admin-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.admin-card-list{
  display:grid;
  gap:16px;
}

.admin-card{
  gap:16px;
}

.admin-fields{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.admin-fields .full{
  grid-column:1 / -1;
}

.field{
  display:grid;
  gap:6px;
}

.field label{
  font-size:12px;
  font-weight:800;
  color:#64748b;
}

.field input{
  min-height:46px;
  border-radius:14px;
  border:1px solid #d4dbe6;
  background:#fff;
  padding:0 14px;
}

.admin-card .save-row{
  justify-self:start;
}

.admin-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  color:#64748b;
  font-size:13px;
}

.admin-card.is-dirty{
  border-color:#0f766e;
  box-shadow:0 20px 44px rgba(15,118,110,.16);
}

.admin-card.is-saving{
  opacity:.75;
}

.admin-card .save-row.is-saved{
  background:#ecfdf5;
  color:#047857;
  border-color:#a7f3d0;
}

.notice{
  padding:18px;
  border-radius:22px;
  border:1px solid #cfe7e2;
  background:#ecfeff;
  color:#115e59;
  font-size:14px;
}

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

@media (max-width: 720px){
  .app-shell{
    padding:12px;
  }
  .topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:12px 14px;
    border-radius:22px;
    gap:8px;
  }
  .brand{
    gap:10px;
    flex:1 1 auto;
    min-width:0;
  }
  .brand-logo{
    width:32px;
    height:32px;
    border-radius:11px;
  }
  .brand-text small{
    display:none;
  }
  .brand-text strong{
    font-size:15px;
    line-height:1.15;
  }
  .top-actions{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:4px;
    flex:0 1 auto;
    min-width:0;
    flex-wrap:nowrap;
  }
  .action-btn,
  .action-link{
    min-height:32px;
    padding:0 8px;
    font-size:10px;
    white-space:nowrap;
    box-shadow:0 6px 16px rgba(15,23,42,.12);
  }
  .action-btn{
    gap:5px;
  }
  .action-icon{
    width:15px;
    height:15px;
  }
  .action-icon svg{
    width:10px;
    height:10px;
  }
  .machine-tabs{
    gap:8px;
  }
  .machine-tab{
    min-height:42px;
    font-size:14px;
  }
  .sidebar-overview{
    grid-template-columns:minmax(0,1.18fr) minmax(156px,.82fr);
    gap:8px;
    align-items:start;
  }
  .search-wrap{
    align-self:center;
  }
  .search-stack{
    gap:6px;
  }
  .summary-stack{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:6px;
  }
  .search-wrap input{
    min-height:52px;
    height:52px;
    padding:0 40px 0 13px;
    font-size:14px;
  }
  .search-clear{
    right:8px;
    width:28px;
    height:28px;
    min-width:28px;
    font-size:16px;
  }
  .search-tools{
    gap:6px;
  }
  .search-filter-check{
    min-height:30px;
    padding:0 11px;
    font-size:10px;
  }
  .search-filter-checkbox{
    width:13px;
    height:13px;
  }
  .search-suggestions{
    top:calc(100% + 8px);
    gap:5px;
    padding:8px;
    border-radius:16px;
  }
  .suggestion-item{
    padding:9px 10px;
    border-radius:12px;
    gap:8px;
  }
  .suggestion-value{
    font-size:12px;
  }
  .suggestion-meta,
  .suggestion-kind{
    font-size:10px;
  }
  .suggestion-kind{
    min-height:22px;
    padding:0 8px;
  }
  .side-card-compact{
    min-height:52px;
    padding:8px 9px;
    border-radius:16px;
    gap:1px;
    box-shadow:0 12px 28px rgba(15,23,42,.08);
  }
  .side-card-compact .side-label{
    font-size:9px;
    letter-spacing:.04em;
  }
  .side-card-compact strong{
    font-size:15px;
    line-height:1;
  }
  .status-line{
    padding:10px 12px;
    font-size:11px;
  }
  .card-list{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
  }
  .medicine-card{
    aspect-ratio:1 / 1;
    grid-template-rows:auto auto minmax(0,1fr);
    gap:6px;
    padding:8px;
    border-radius:18px;
    align-content:start;
    overflow:hidden;
  }
  .card-head{
    gap:6px;
  }
  .card-head-actions{
    gap:5px;
  }
  .card-no,
  .expiry-chip{
    min-height:24px;
    padding:0 7px;
    font-size:10px;
  }
  .card-no{
    min-height:auto;
    padding:0;
    font-size:24px;
  }
  .card-title{
    gap:3px;
  }
  .card-title > strong{
    min-height:28px;
    font-size:13px;
    line-height:1.15;
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
    overflow:hidden;
  }
  .card-meta-row{
    gap:4px;
  }
  .card-code{
    gap:4px;
  }
  .expiry-chip,
  .card-code-value{
    min-height:22px;
    padding:0 7px;
    font-size:10px;
  }
  .identifier-trigger{
    min-height:22px;
    padding:0 7px;
    font-size:10px;
  }
  .medicine-media{
    min-height:0;
    height:100%;
    aspect-ratio:auto;
    border-radius:12px;
  }
  .medicine-media img{
    height:100%;
    object-fit:cover;
  }
  .media-placeholder{
    padding:8px;
    gap:3px;
  }
  .media-placeholder strong{
    font-size:11px;
  }
  .media-placeholder span{
    font-size:9px;
  }
  .expiry-toast{
    width:min(calc(100vw - 20px), 420px);
    bottom:14px;
  }
  .expiry-toast-inner{
    gap:10px;
    padding:12px 14px;
    border-radius:16px;
  }
  .expiry-toast-copy span{
    font-size:13px;
  }
  .toast-close{
    min-width:50px;
    min-height:32px;
    padding:0 10px;
  }
  .identifier-overlay{
    background:rgba(15,23,42,.48);
  }
  .identifier-panel{
    left:0 !important;
    right:0 !important;
    top:auto !important;
    bottom:0;
    width:100%;
    max-height:min(78vh, 560px);
    border-radius:22px 22px 0 0;
    box-shadow:0 -24px 60px rgba(15,23,42,.28);
  }
  .identifier-panel-head{
    padding:15px 16px 13px;
  }
  .identifier-panel-body{
    gap:10px;
    padding:14px 16px calc(18px + env(safe-area-inset-bottom));
  }
  .identifier-row{
    padding:9px 10px;
    border-radius:14px;
  }
  .admin-fields{
    grid-template-columns:1fr;
  }
}

/* 2026-03-29 redesign overrides: Technical Minimalist */
:root{
  --tm-surface:#f9f9f7;
  --tm-surface-low:#f4f4f2;
  --tm-surface-mid:#eeeeec;
  --tm-surface-high:#e2e3e1;
  --tm-surface-strong:#ffffff;
  --tm-outline:rgba(198,198,198,.52);
  --tm-outline-strong:rgba(26,28,27,.22);
  --tm-text:#1a1c1b;
  --tm-text-soft:#65685f;
  --tm-text-faint:#878a82;
  --tm-primary:#000000;
  --tm-primary-soft:#111111;
  --tm-danger:#8a3434;
  --tm-success:#21362d;
  --tm-radius-sm:2px;
  --tm-radius-md:4px;
  --tm-font-ui:"DM Sans","Noto Sans KR","Apple SD Gothic Neo","Malgun Gothic","맑은 고딕",sans-serif;
  --tm-font-data:"DM Mono","SFMono-Regular","Noto Sans KR",monospace;
  --bg:var(--tm-surface);
  --bg-soft:var(--tm-surface-low);
  --panel:var(--tm-surface-strong);
  --panel-2:var(--tm-surface-mid);
  --line:var(--tm-outline);
  --line-strong:var(--tm-outline-strong);
  --text:var(--tm-text);
  --text-soft:var(--tm-text-soft);
  --accent:var(--tm-primary);
  --accent-strong:var(--tm-primary-soft);
  --danger:var(--tm-danger);
  --radius:var(--tm-radius-md);
  --shadow:none;
}

html{
  background:var(--tm-surface);
}

body{
  font-family:var(--tm-font-ui);
  background:var(--tm-surface);
  color:var(--tm-text);
  letter-spacing:-.01em;
}

body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:.05;
  background-image:
    linear-gradient(to right, rgba(0,0,0,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,.05) 1px, transparent 1px);
  background-size:24px 24px;
  mask-image:linear-gradient(180deg, rgba(0,0,0,.55), transparent 72%);
}

button,
input{
  font:inherit;
}

.app-shell{
  max-width:1440px;
  padding:28px 32px 40px;
}

.topbar{
  gap:18px;
  padding:18px 20px;
  border-radius:var(--tm-radius-md);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  color:var(--tm-text);
  align-items:center;
  box-shadow:none !important;
}

.brand{
  align-items:center;
  gap:12px;
}

.brand-logo{
  width:40px;
  height:40px;
  border-radius:var(--tm-radius-sm);
}

.brand-text{
  align-items:center;
  gap:2px;
}

.brand-text small{
  color:var(--tm-text-faint);
  font-size:11px;
  font-weight:700;
  letter-spacing:.16em;
}

.brand-text strong{
  color:var(--tm-text);
  font-size:24px;
  font-weight:800;
  line-height:1;
  letter-spacing:-.03em;
}

.top-actions{
  gap:8px;
}

.top-utility{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:12px;
  margin-left:auto;
  flex:0 0 auto;
}

.top-clock{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  justify-content:center;
  min-width:max-content;
  font-family:var(--tm-font-data);
  color:var(--tm-text-faint);
  line-height:1.1;
}

.top-clock span{
  font-size:11px;
  font-weight:600;
  letter-spacing:.05em;
}

.top-clock strong{
  font-size:16px;
  font-weight:700;
  letter-spacing:-.03em;
}

.mode-chip,
.action-btn,
.action-link,
.machine-tab,
.text-btn{
  border-radius:var(--tm-radius-sm);
  box-shadow:none !important;
}

.mode-chip{
  min-height:40px;
  padding:0 12px;
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-mid);
  color:var(--tm-text);
  font-family:var(--tm-font-data);
  font-size:11px;
  letter-spacing:.08em;
}

.mode-chip.is-public,
.mode-chip.is-admin{
  background:var(--tm-surface-mid);
  color:var(--tm-text);
}

.action-btn,
.action-link,
.text-btn{
  min-height:40px;
  padding:0 13px;
  border:0.5px solid var(--tm-outline);
  background:transparent;
  color:var(--tm-text);
  font-size:12px;
  font-weight:700;
  letter-spacing:.04em;
  text-decoration:none;
}

.action-btn:hover,
.action-link:hover,
.machine-tab:hover,
.search-clear:hover,
.text-btn:hover{
  border-width:1px;
  border-color:var(--tm-primary);
  background:var(--tm-surface-strong);
  filter:none;
}

.primary-btn{
  background:var(--tm-primary);
  border-color:var(--tm-primary);
  color:#fff;
}

.primary-btn:hover{
  background:#111;
  color:#fff;
}

.action-icon{
  width:16px;
  height:16px;
  border-radius:0;
  background:transparent;
  color:var(--tm-text-faint);
}

.layout{
  grid-template-columns:minmax(280px,320px) minmax(0,1fr);
  gap:32px;
  margin-top:20px;
}

.sidebar{
  gap:14px;
}

.sidebar-overview{
  gap:14px;
}

.summary-stack{
  gap:10px;
}

.machine-tabs{
  gap:8px;
}

.machine-tab{
  min-height:44px;
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:12px;
  font-weight:500;
  letter-spacing:.08em;
}

.machine-tab.active{
  background:var(--tm-primary);
  border-color:var(--tm-primary);
  color:#fff;
}

#machine3Tab{
  font-family:var(--tm-font-ui);
  font-weight:700;
  letter-spacing:-.02em;
}

.search-stack{
  gap:10px;
}

.search-primary-row{
  display:grid;
  gap:10px;
}

.search-wrap{
  position:relative;
  padding:14px 0 0;
}

.search-wrap::before{
  content:"SEARCH";
  position:absolute;
  left:0;
  top:0;
  color:var(--tm-text-faint);
  font-family:var(--tm-font-data);
  font-size:10px;
  letter-spacing:.16em;
}

.search-wrap input{
  min-height:52px;
  border:none;
  border-bottom:0.5px solid var(--tm-outline-strong);
  border-radius:0;
  background:transparent;
  padding:0 44px 0 0;
  box-shadow:none !important;
  color:var(--tm-text);
  font-size:15px;
}

.search-wrap input::placeholder{
  color:var(--tm-text-faint);
}

.search-wrap input:focus{
  outline:none;
  border-bottom-color:var(--tm-primary);
}

.search-clear{
  top:auto;
  bottom:10px;
  right:0;
  transform:none;
  width:26px;
  height:26px;
  min-width:26px;
  border:0.5px solid var(--tm-outline);
  border-radius:var(--tm-radius-sm);
  background:var(--tm-surface-low);
  color:var(--tm-text-soft);
  font-size:14px;
  box-shadow:none !important;
}

.search-tools{
  gap:8px;
}

.search-filter-check{
  min-height:30px;
  padding:0 10px;
  border-radius:var(--tm-radius-sm);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
  letter-spacing:.1em;
  box-shadow:none !important;
}

.search-filter-check:hover{
  background:var(--tm-surface-strong);
}

.search-filter-check:focus-within{
  outline:none;
  border-color:var(--tm-primary);
}

.search-filter-check.is-active{
  background:var(--tm-primary);
  border-color:var(--tm-primary);
  color:#fff;
  box-shadow:none !important;
}

.search-filter-checkbox{
  width:13px;
  height:13px;
  accent-color:var(--tm-primary);
}

.search-suggestions{
  gap:0;
  padding:6px 0;
  border-radius:var(--tm-radius-md);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-strong);
  box-shadow:none !important;
  backdrop-filter:none;
}

.suggestion-item{
  padding:10px 14px;
  border:none;
  border-radius:0;
  border-top:0.5px solid transparent;
  border-bottom:0.5px solid transparent;
  background:transparent;
}

.suggestion-item:hover,
.suggestion-item:focus-visible{
  border-color:var(--tm-outline);
  background:var(--tm-surface-low);
  outline:none;
}

.suggestion-value{
  font-size:13px;
  font-weight:700;
  color:var(--tm-text);
}

.suggestion-meta{
  color:var(--tm-text-faint);
  font-family:var(--tm-font-data);
  font-size:10px;
  letter-spacing:.04em;
}

.suggestion-kind{
  min-height:20px;
  padding:0 8px;
  border-radius:var(--tm-radius-sm);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
}

.side-card,
.side-card-compact{
  gap:8px;
  padding:14px;
  border-radius:var(--tm-radius-md);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  box-shadow:none !important;
  text-align:left;
  justify-items:start;
}

.side-label{
  color:var(--tm-text-faint);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
  letter-spacing:.14em;
}

.side-card strong,
.side-card-compact strong{
  color:var(--tm-text);
  font-size:20px;
  font-weight:800;
  line-height:1.05;
}

.side-card span:last-child{
  color:var(--tm-text-soft);
  font-size:12px;
}

.side-card-compact{
  min-height:88px;
  align-content:start;
}

.status-line{
  padding:12px 14px;
  border-radius:var(--tm-radius-md);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-mid);
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:11px;
  font-weight:500;
  letter-spacing:.06em;
  text-align:left;
}

.status-line.is-error{
  border-color:rgba(138,52,52,.32);
  background:#f4ece9;
  color:var(--tm-danger);
}

.content{
  gap:20px;
}

.content-head{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:16px;
  align-items:end;
  padding:0 0 18px;
  border-bottom:0.5px solid var(--tm-outline);
}

.content-head h1{
  margin:0;
  color:var(--tm-text);
  font-size:34px;
  font-weight:800;
  line-height:1;
  letter-spacing:-.04em;
}

.content-head p{
  margin:8px 0 0;
  max-width:720px;
  color:var(--tm-text-soft);
  font-size:14px;
  line-height:1.6;
}

.caption-stats{
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:11px;
  font-weight:500;
  letter-spacing:.14em;
}

.card-list{
  grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
  gap:18px;
}

.medicine-card,
.admin-card{
  gap:14px;
  padding:16px;
  border-radius:var(--tm-radius-md);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-strong);
  box-shadow:none !important;
  transition:border-color .16s ease, background-color .16s ease;
  will-change:auto;
}

@media (hover:hover) and (pointer:fine){
  .medicine-card:hover,
  .medicine-card:focus-within,
  .admin-card:hover,
  .admin-card:focus-within{
    transform:none;
    border-color:var(--tm-primary);
    background:#fff;
    box-shadow:none !important;
  }

  .medicine-card:hover .card-no,
  .medicine-card:focus-within .card-no,
  .admin-card:hover .card-no,
  .admin-card:focus-within .card-no{
    color:var(--tm-primary);
  }

  .medicine-card:hover .medicine-media,
  .medicine-card:focus-within .medicine-media,
  .admin-card:hover .field input,
  .admin-card:focus-within .field input{
    border-color:var(--tm-primary);
  }
}

.card-head{
  align-items:flex-start;
  gap:10px;
}

.card-head-actions{
  gap:6px;
}

.card-no,
.expiry-chip{
  min-height:28px;
  padding:0 8px;
  border-radius:var(--tm-radius-sm);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
  letter-spacing:.08em;
  line-height:1;
}

.card-no{
  min-height:auto;
  padding:0;
  border:none;
  background:transparent;
  color:var(--tm-text);
  font-size:31px;
  font-weight:500;
  letter-spacing:-.08em;
}

.card-title{
  gap:10px;
}

.card-title > strong{
  color:var(--tm-text);
  font-size:18px;
  line-height:1.3;
  font-weight:700;
  letter-spacing:-.02em;
}

.card-code,
.card-meta-row{
  gap:6px;
}

.card-meta-row{
  justify-content:flex-end;
}

.card-code-label{
  color:var(--tm-text-faint);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
  letter-spacing:.14em;
}

.expiry-chip,
.card-code-value,
.identifier-trigger{
  min-height:26px;
  padding:0 8px;
  border-radius:var(--tm-radius-sm);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
  letter-spacing:.08em;
  white-space:nowrap;
}

body#page-top .injection-card,
body#page-top .injection-card .card-title > strong,
body#page-top .injection-card .expiry-chip,
body#page-top .injection-card .card-code-value,
body#page-top .injection-card .match-badge{
  font-family:var(--tm-font-ui);
  letter-spacing:-.02em;
}

.identifier-trigger{
  transition:border-color .16s ease, background-color .16s ease, color .16s ease;
}

.identifier-trigger:hover,
.identifier-trigger:focus-visible{
  border-color:var(--tm-primary);
  background:var(--tm-surface-strong);
  color:var(--tm-primary);
  outline:none;
}

.medicine-media{
  min-height:154px;
  border-radius:var(--tm-radius-sm);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-high);
}

.medicine-media::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:.06;
  background-image:radial-gradient(circle at 1px 1px, rgba(0,0,0,.4) 0.7px, transparent 0.8px);
  background-size:8px 8px;
  mix-blend-mode:multiply;
}

.medicine-media img{
  height:154px;
}

.media-placeholder{
  gap:4px;
  padding:18px;
  color:var(--tm-text-faint);
  font-family:var(--tm-font-data);
}

.media-placeholder strong{
  font-size:13px;
  font-weight:700;
  color:var(--tm-text-soft);
}

.media-placeholder span{
  font-size:10px;
  letter-spacing:.08em;
}

.meta-row{
  font-family:var(--tm-font-data);
  font-size:11px;
  letter-spacing:.03em;
}

.meta-row span:first-child{
  color:var(--tm-text-faint);
}

.empty-state{
  gap:8px;
  padding:20px 18px;
  border-radius:var(--tm-radius-md);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  color:var(--tm-text-soft);
}

.empty-state strong{
  color:var(--tm-text);
  font-size:16px;
}

.expiry-toast-inner{
  padding:14px;
  border-radius:var(--tm-radius-md);
  border:0.5px solid var(--tm-outline);
  background:rgba(249,249,247,.96);
  color:var(--tm-text);
  box-shadow:none !important;
}

.expiry-toast-copy strong{
  color:var(--tm-text);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
  letter-spacing:.16em;
}

.expiry-toast-copy span{
  color:var(--tm-text-soft);
  font-size:13px;
}

.toast-close{
  min-width:52px;
  min-height:30px;
  border-radius:var(--tm-radius-sm);
  border:0.5px solid var(--tm-outline);
  background:transparent;
  color:var(--tm-text);
  font-size:11px;
  font-weight:700;
}

.modal-backdrop{
  background:rgba(18,18,18,.2);
  backdrop-filter:blur(6px);
}

.image-modal,
.identifier-panel{
  border-radius:var(--tm-radius-md);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface);
  box-shadow:none !important;
}

.modal-head,
.identifier-panel-head{
  padding:14px 16px;
  border-bottom:0.5px solid var(--tm-outline);
}

.modal-body,
.identifier-panel-body{
  padding:16px;
}

.identifier-panel-copy strong{
  font-size:15px;
  font-weight:700;
}

.identifier-panel-copy span,
.identifier-code-label,
.identifier-row dt{
  color:var(--tm-text-faint);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
  letter-spacing:.12em;
}

.identifier-row{
  gap:4px;
  padding:10px 0;
  border:none;
  border-top:0.5px solid var(--tm-outline);
  border-radius:0;
  background:transparent;
}

.identifier-row:first-child{
  border-top:none;
}

.identifier-row dd{
  color:var(--tm-text);
  font-size:13px;
  font-weight:700;
}

.identifier-source-link{
  min-height:34px;
  border-radius:var(--tm-radius-sm);
  background:transparent;
  color:var(--tm-text);
  border-color:var(--tm-outline);
}

.admin-actions{
  gap:8px;
}

.admin-card-list{
  gap:18px;
}

.admin-fields{
  gap:14px 16px;
}

.field{
  gap:5px;
}

.field label{
  color:var(--tm-text-faint);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
  letter-spacing:.14em;
}

.field input{
  min-height:44px;
  border:none;
  border-bottom:0.5px solid var(--tm-outline-strong);
  border-radius:0;
  background:transparent;
  padding:0 0 4px;
  color:var(--tm-text);
  box-shadow:none !important;
}

.field input:focus{
  outline:none;
  border-bottom-color:var(--tm-primary);
}

.admin-meta{
  color:var(--tm-text-faint);
  font-family:var(--tm-font-data);
  font-size:10px;
  letter-spacing:.08em;
}

.admin-card.is-dirty{
  border-color:var(--tm-primary);
  box-shadow:none !important;
}

.admin-card .save-row.is-saved{
  background:var(--tm-surface-low);
  color:var(--tm-success);
  border-color:rgba(33,54,45,.32);
}

.notice{
  padding:16px;
  border-radius:var(--tm-radius-md);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  color:var(--tm-text-soft);
}

@media (max-width: 980px){
  .app-shell{
    padding:20px;
  }

  .layout{
    grid-template-columns:1fr;
    gap:24px;
  }

  .content-head{
    grid-template-columns:1fr;
    align-items:start;
  }
}

@media (max-width: 720px){
  body::before{
    opacity:.035;
    background-size:20px 20px;
  }

  .app-shell{
    padding:14px;
  }

  .topbar{
    padding:12px;
    gap:10px;
    border-radius:var(--tm-radius-md);
  }

  .brand{
    gap:8px;
  }

  .brand-logo{
    width:30px;
    height:30px;
  }

  .brand-text strong{
    font-size:16px;
  }

  .top-actions{
    gap:4px;
  }

  .action-btn,
  .action-link,
  .text-btn{
    min-height:30px;
    padding:0 7px;
    font-size:10px;
  }

  .action-btn{
    gap:4px;
  }

  .action-icon{
    width:12px;
    height:12px;
  }

  .machine-tab{
    min-height:38px;
    font-size:11px;
  }

  .sidebar-overview{
    grid-template-columns:1fr;
    gap:10px;
  }

  .summary-stack{
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:8px;
  }

  .search-wrap{
    padding-top:12px;
  }

  .search-wrap input{
    min-height:46px;
    font-size:14px;
  }

  .search-clear{
    bottom:8px;
  }

  .side-card,
  .side-card-compact{
    min-height:auto;
    padding:12px;
  }

  .side-card-compact strong{
    font-size:16px;
  }

  .status-line{
    font-size:11px;
  }

  body#page-top .card-list{
    grid-template-columns:minmax(0, 1fr);
    gap:12px;
  }

  .medicine-card{
    aspect-ratio:auto;
    gap:10px;
    padding:12px;
    align-content:start;
    overflow:hidden;
  }

  .card-head{
    gap:6px;
  }

  .card-head-actions{
    gap:6px;
  }

  .card-no{
    font-size:26px;
  }

  .expiry-chip,
  .card-code-value,
  .identifier-trigger{
    min-height:24px;
    padding:0 7px;
    font-size:10px;
  }

  .card-title{
    gap:6px;
  }

  .card-title > strong{
    min-height:auto;
    font-size:15px;
    line-height:1.2;
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
    overflow:hidden;
  }

  .medicine-media{
    min-height:154px;
    height:auto;
  }

  .medicine-media img{
    height:154px;
  }

  .media-placeholder{
    padding:8px;
  }

  .content-head h1{
    font-size:24px;
  }

  .content-head p{
    font-size:13px;
  }

  .admin-fields{
    grid-template-columns:1fr;
  }

  .admin-fields .full{
    grid-column:auto;
  }

  .identifier-panel{
    left:0 !important;
    right:0 !important;
    top:auto !important;
    bottom:0 !important;
    width:100%;
    max-width:none;
    max-height:min(78vh, 520px);
    border-radius:var(--tm-radius-md) var(--tm-radius-md) 0 0;
  }
}

body#page-top .card-public{
  display:grid;
  gap:6px;
  margin-top:4px;
}

body#page-top .card-ingredients{
  display:flex;
  align-items:baseline;
  gap:8px;
  min-width:0;
  min-height:20px;
  margin-top:0;
  color:var(--tm-text-soft);
  font-family:var(--tm-font-ui);
  font-size:11px;
  font-weight:500;
  line-height:1.35;
  letter-spacing:-.01em;
}

body#page-top .card-ingredients.is-empty{
  visibility:hidden;
}

body#page-top .card-ingredients-prefix{
  flex:0 0 auto;
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:600;
  letter-spacing:.04em;
}

body#page-top .card-ingredients-value{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

body#page-top .card-public-row{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}

body#page-top .public-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:22px;
  padding:0 8px;
  border-radius:999px;
  border:.5px solid rgba(26,28,27,.18);
  background:rgba(26,28,27,.06);
  color:#111;
  font-size:10px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  white-space:nowrap;
}

body#page-top .public-manufacturer{
  min-width:0;
  color:rgba(26,28,27,.84);
  font-size:12px;
  font-weight:600;
  letter-spacing:-.01em;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

body#page-top .public-meta{
  color:rgba(26,28,27,.62);
  font-size:11px;
  line-height:1.45;
  letter-spacing:-.01em;
}

@media (max-width: 720px) {
  body#page-top .card-public{
    gap:4px;
  }

  body#page-top .public-manufacturer{
    font-size:11px;
  }

  body#page-top .public-meta{
    font-size:10px;
  }
}

body#page-top .sidebar-overview{
  grid-template-columns:1fr;
}

body#page-top .search-status{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
}

body#page-top .search-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:0 10px;
  border-radius:var(--tm-radius-sm);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
  letter-spacing:.1em;
  text-transform:uppercase;
}

body#page-top .search-chip-primary{
  background:var(--tm-surface-mid);
  border-color:var(--tm-outline-strong);
  color:var(--tm-text);
}

body#page-top .recent-searches{
  display:grid;
  gap:8px;
}

body#page-top .recent-searches[hidden]{
  display:none;
}

body#page-top .recent-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

body#page-top .recent-title{
  color:var(--tm-text-faint);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
  letter-spacing:.14em;
  text-transform:uppercase;
}

body#page-top .recent-clear{
  padding:0;
  border:none;
  background:transparent;
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:600;
  letter-spacing:.1em;
  text-transform:uppercase;
  cursor:pointer;
}

body#page-top .recent-clear:hover{
  color:var(--tm-text);
}

body#page-top .recent-list{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

body#page-top .recent-chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  min-height:30px;
  padding:0 10px;
  border-radius:var(--tm-radius-sm);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  color:var(--tm-text);
  font-size:12px;
  font-weight:600;
  letter-spacing:-.01em;
}

body#page-top .recent-chip small{
  color:var(--tm-text-faint);
  font-family:var(--tm-font-data);
  font-size:10px;
  letter-spacing:.08em;
  text-transform:uppercase;
}

body#page-top .recent-chip:hover{
  border-color:var(--tm-primary);
  background:var(--tm-surface-strong);
}

body#page-top .result-match-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:2px;
}

body#page-top .match-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:22px;
  padding:0 8px;
  border-radius:var(--tm-radius-sm);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
  letter-spacing:.08em;
  text-transform:uppercase;
}

body#page-top .empty-state{
  min-height:180px;
}

body#page-top .empty-state strong{
  letter-spacing:-.02em;
}

@media (max-width: 720px) {
  body#page-top .search-stack{
    gap:8px;
  }

  body#page-top .search-primary-row{
    gap:8px;
  }

  body#page-top .sidebar-overview{
    grid-template-columns:1fr;
    gap:10px;
  }

  body#page-top .search-status{
    gap:5px;
  }

  body#page-top .search-chip{
    min-height:26px;
    padding:0 8px;
    font-size:9px;
  }

  body#page-top .recent-head{
    align-items:flex-start;
    flex-direction:column;
  }

  body#page-top .recent-list{
    gap:5px;
  }

  body#page-top .recent-chip{
    min-height:28px;
    padding:0 9px;
    font-size:11px;
  }

  body#page-top .recent-chip small{
    font-size:9px;
  }

  body#page-top .match-badge{
    min-height:20px;
    padding:0 7px;
    font-size:9px;
  }

  body#page-top .empty-state{
    min-height:140px;
  }
}

@media (max-width: 720px) {
  body#page-top.is-mobile-search-focus{
    overflow-anchor:none;
  }

  body#page-top.is-mobile-search-focus .app-shell{
    min-height:var(--mobile-visible-height, 100dvh);
    padding-top:max(8px, env(safe-area-inset-top));
    padding-bottom:max(10px, env(safe-area-inset-bottom));
  }

  body#page-top.is-mobile-search-focus .topbar{
    position:sticky;
    top:0;
    z-index:40;
    align-items:flex-start;
    padding:8px 10px;
    gap:8px;
  }

  body#page-top.is-mobile-search-focus .brand{
    gap:6px;
  }

  body#page-top.is-mobile-search-focus .brand-logo{
    width:24px;
    height:24px;
  }

  body#page-top.is-mobile-search-focus .brand-text{
    gap:0;
  }

  body#page-top.is-mobile-search-focus .brand-text small{
    display:none;
  }

  body#page-top.is-mobile-search-focus .brand-text strong{
    font-size:15px;
  }

  body#page-top.is-mobile-search-focus .top-actions{
    display:none;
  }

  body#page-top.is-mobile-search-focus .top-utility{
    align-items:flex-start;
    align-self:flex-start;
    gap:0;
  }

  body#page-top.is-mobile-search-focus .top-clock{
    align-self:flex-start;
    justify-content:flex-start;
    margin-top:-11px;
    min-width:max-content;
  }

  body#page-top.is-mobile-search-focus .top-clock span{
    font-size:9px;
    font-weight:600;
    line-height:1;
    letter-spacing:.04em;
  }

  body#page-top.is-mobile-search-focus .top-clock strong{
    font-size:12px;
    line-height:1;
  }

  body#page-top.is-mobile-search-focus .layout{
    gap:8px;
    margin-top:8px;
  }

  body#page-top.is-mobile-search-focus .sidebar{
    gap:8px;
  }

  body#page-top.is-mobile-search-focus .sidebar-overview{
    gap:6px;
  }

  body#page-top.is-mobile-search-focus .search-stack{
    position:sticky;
    top:var(--mobile-search-stick-top, 48px);
    z-index:35;
    gap:4px;
    padding:6px 0 4px;
    border:none;
    background:transparent;
    box-shadow:none;
  }

  body#page-top.is-mobile-search-focus .search-primary-row{
    grid-template-columns:minmax(0, 1fr) 126px;
    align-items:center;
    gap:5px;
    min-height:80px;
    overflow:visible;
  }

  body#page-top.is-mobile-search-focus .search-wrap{
    display:flex;
    flex-direction:column;
    justify-content:center;
    width:100%;
    min-width:0;
    min-height:80px;
    gap:4px;
    padding-top:0;
    align-self:center;
    overflow:visible;
  }

  body#page-top.is-mobile-search-focus .search-wrap::before{
    position:static;
    display:block;
    font-size:9px;
    letter-spacing:.12em;
  }

  body#page-top.is-mobile-search-focus .search-wrap input{
    width:100%;
    min-width:0;
    min-height:0;
    height:28px;
    padding-right:34px;
    border-bottom-color:transparent;
    font-size:11px;
  }

  body#page-top.is-mobile-search-focus .search-wrap input:focus{
    border-bottom-color:transparent;
  }

  body#page-top.is-mobile-search-focus .search-status,
  body#page-top.is-mobile-search-focus .search-tools{
    display:none;
  }

  body#page-top.is-mobile-search-focus .machine-tabs{
    width:126px;
    grid-template-columns:repeat(3, minmax(0, 1fr));
    gap:3px;
    min-height:56px;
    padding:0;
    border:none;
    background:transparent;
    align-content:center;
    align-self:center;
  }

  body#page-top.is-mobile-search-focus .machine-tab{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:2px;
    min-height:28px;
    min-width:0;
    padding:0 3px;
    border:none;
    background:transparent;
    font-size:8px;
    letter-spacing:.02em;
  }

  body#page-top.is-mobile-search-focus .machine-tab.active{
    border:none;
  }

  body#page-top.is-mobile-search-focus .machine-tab.active::before{
    content:"✓";
    display:block;
    flex:0 0 auto;
    font-size:8px;
    font-weight:700;
    line-height:1;
  }

  body#page-top.is-mobile-search-focus .search-chip{
    min-height:24px;
    padding:0 7px;
    font-size:9px;
  }

  body#page-top.is-mobile-search-focus .search-filter-check{
    min-height:28px;
    padding:0 8px;
  }

  body#page-top.is-mobile-search-focus .search-suggestions{
    max-height:min(124px, 28vh);
    overflow:auto;
  }

  body#page-top.is-mobile-search-focus .recent-head{
    gap:4px;
  }

  body#page-top.is-mobile-search-focus .recent-list{
    max-height:60px;
    overflow:auto;
  }

  body#page-top.is-mobile-search-focus .summary-stack,
  body#page-top.is-mobile-search-focus .status-line{
    display:none;
  }

  body#page-top.is-mobile-search-focus .content{
    gap:10px;
    min-height:0;
    max-height:var(--mobile-search-results-height, 42vh);
    overflow-y:auto;
    padding-bottom:max(10px, env(safe-area-inset-bottom));
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }

  body#page-top.is-mobile-search-focus .card-list{
    gap:8px;
  }

  body#page-top.is-mobile-search-focus .medicine-card{
    gap:8px;
    padding:10px;
  }

  body#page-top.is-mobile-search-focus .card-head{
    gap:5px;
  }

  body#page-top.is-mobile-search-focus .card-head-actions{
    gap:5px;
  }

  body#page-top.is-mobile-search-focus .card-no{
    font-size:22px;
  }

  body#page-top.is-mobile-search-focus .card-title{
    gap:5px;
  }

  body#page-top.is-mobile-search-focus .card-title > strong{
    font-size:14px;
    line-height:1.18;
  }

  body#page-top.is-mobile-search-focus .expiry-chip,
  body#page-top.is-mobile-search-focus .card-code-value,
  body#page-top.is-mobile-search-focus .identifier-trigger{
    min-height:22px;
    padding:0 6px;
    font-size:9px;
  }

  body#page-top.is-mobile-search-focus .card-public{
    gap:4px;
  }

  body#page-top.is-mobile-search-focus .public-badge{
    min-height:20px;
    padding:0 7px;
    font-size:9px;
  }

  body#page-top.is-mobile-search-focus .public-manufacturer{
    font-size:10px;
  }

  body#page-top.is-mobile-search-focus .public-meta,
  body#page-top.is-mobile-search-focus .meta-row{
    font-size:9px;
  }

  body#page-top.is-mobile-search-focus .medicine-media{
    min-height:124px;
  }

  body#page-top.is-mobile-search-focus .medicine-media img{
    height:124px;
  }

  body#page-top.is-mobile-search-focus .media-placeholder{
    padding:8px;
  }

  body#page-top.is-mobile-search-focus .empty-state{
    min-height:0;
    gap:0;
    padding:10px 12px;
  }

  body#page-top.is-mobile-search-focus .empty-state strong{
    font-size:12px;
    line-height:1.45;
  }

body#page-top.is-mobile-search-focus .empty-state span{
    display:none;
  }

  body#page-top.is-mobile-search-focus .expiry-filter{
    display:flex !important;
    align-items:center;
    gap:5px;
    overflow-x:auto;
    padding:0 0 2px;
    width:100%;
    visibility:visible !important;
    opacity:1 !important;
  }

  body#page-top.is-mobile-search-focus .expiry-filter-label{
    flex:0 0 auto;
    font-size:8px;
    letter-spacing:.1em;
  }

  body#page-top.is-mobile-search-focus .expiry-filter-buttons{
    flex:1 1 auto;
    flex-wrap:nowrap;
    gap:4px;
    min-width:0;
  }

  body#page-top.is-mobile-search-focus .expiry-filter-btn{
    min-height:22px;
    padding:0 6px;
    font-size:8px;
    white-space:nowrap;
  }
}

body#page-top .expiry-filter{
  display:grid !important;
  gap:6px;
  position:relative;
  z-index:2;
  visibility:visible !important;
  opacity:1 !important;
  pointer-events:none;
}

body#page-top .search-primary-row,
body#page-top .search-wrap{
  overflow:visible !important;
}

body#page-top .expiry-filter-label{
  color:var(--tm-text-faint);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:500;
  letter-spacing:.14em;
  text-transform:uppercase;
}

body#page-top .expiry-filter-buttons{
  display:flex;
  flex-wrap:nowrap;
  gap:4px;
  pointer-events:none;
}

body#page-top .expiry-filter-btn{
  min-height:28px;
  flex:0 0 auto;
  padding:0 7px;
  border-radius:var(--tm-radius-sm);
  border:0.5px solid var(--tm-outline);
  background:var(--tm-surface-low);
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:9px;
  font-weight:500;
  letter-spacing:.04em;
  box-shadow:none !important;
  pointer-events:auto;
}

body#page-top .expiry-filter-btn:hover{
  border-color:var(--tm-primary);
  background:var(--tm-surface-strong);
}

body#page-top .expiry-filter-btn.is-active{
  background:var(--tm-primary);
  border-color:var(--tm-primary);
  color:#fff;
}


/* ─────────────────────────────────────────────────────────────
   2026-06 유효기간 상태색 (Fable 5 제안) — 운영 베이스 재적용
   만료(빨강) / D-30(주황) / D-90(겨자) / 안전·없음(무채색)
   ───────────────────────────────────────────────────────────── */
.expiry-chip{
  font-size:13px !important;
  letter-spacing:0 !important;
  padding:4px 9px !important;
  border-width:1px !important;
  border-style:solid !important;
  line-height:1.2 !important;
  white-space:nowrap;
}
.expiry-chip.is-safe{
  background:#F1F1ED !important;
  border-color:#D6D6D0 !important;
  color:#5C625C !important;
}
.expiry-chip.is-none{
  background:#F1F1ED !important;
  border-color:#D6D6D0 !important;
  color:#8A8D85 !important;
  opacity:.75;
}
.expiry-chip.is-d90{
  background:#FBF8E9 !important;
  border-color:#E3DCAE !important;
  color:#7A6A00 !important;
}
.expiry-chip.is-d30{
  background:#FFFAEB !important;
  border-color:#F2D49B !important;
  color:#B54708 !important;
  font-weight:700 !important;
}
.expiry-chip.is-expired{
  background:#FEF3F2 !important;
  border-color:#F4B9B3 !important;
  color:#B42318 !important;
  font-weight:800 !important;
}


/* ─────────────────────────────────────────────────────────────
   2026-06 점검 모드 (읽기 전용 밀집 표) + 뷰 토글 (Fable 5 제안)
   ───────────────────────────────────────────────────────────── */
.view-toolbar{
  display:flex;
  justify-content:flex-end;
  margin-bottom:14px;
}
.view-toggle{
  display:inline-flex;
  border:1px solid #D6D6D0;
  border-radius:6px;
  overflow:hidden;
  background:#fff;
}
.view-toggle-btn{
  font:inherit;
  font-size:13px;
  font-weight:600;
  padding:7px 14px;
  border:0;
  background:#fff;
  color:#5C625C;
  cursor:pointer;
}
.view-toggle-btn + .view-toggle-btn{ border-left:1px solid #D6D6D0; }
.view-toggle-btn.is-active{ background:#111111; color:#fff; }

.card-list.is-table-mode{
  display:block;
}
.inspection-table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
  border:1px solid #D6D6D0;
  border-radius:6px;
  overflow:hidden;
  font-size:14px;
}
.inspection-table thead th{
  font-size:11px;
  font-weight:700;
  letter-spacing:.08em;
  color:#8A8D85;
  text-align:left;
  padding:10px 14px;
  background:#F1F1ED;
  border-bottom:1px solid #D6D6D0;
}
.inspection-table tbody td{
  padding:0 14px;
  height:46px;
  border-bottom:1px solid #ECECE8;
  vertical-align:middle;
}
.inspection-table tbody tr:last-child td{ border-bottom:0; }
.inspection-table tbody tr:hover{ background:#FAFAF8; }
.inspection-table .it-no{
  width:64px;
  font-family:"DM Mono",ui-monospace,monospace;
  font-size:13px;
  color:#5C625C;
}
.inspection-table .it-name{
  font-weight:700;
  letter-spacing:-.01em;
  word-break:keep-all;
}
.inspection-table .it-code{
  width:110px;
  font-family:"DM Mono",ui-monospace,monospace;
  font-size:13px;
  color:#5C625C;
}
.inspection-table .it-exp{ width:200px; }
@media (max-width:640px){
  .card-list.is-table-mode{ overflow-x:auto; }
  .inspection-table{ min-width:520px; }
}


/* ─────────────────────────────────────────────────────────────
   2026-06 상단 30일 이내 임박/만료 알림 배너 (읽기 전용, 클릭=30일 필터)
   상단바 바로 아래 가로 띠, 콘텐츠 가운데 정렬. 0건이면 자동 숨김.
   ───────────────────────────────────────────────────────────── */
.expiry-banner{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  width:100%;
  padding:10px 16px;
  border:0;
  border-bottom:1px solid #F2D49B;
  background:#FFFAEB;
  color:#B54708;
  font-family:inherit;
  font-size:14px;
  font-weight:700;
  cursor:pointer;
  text-align:center;
}
.expiry-banner:hover{ background:#FFF4D6; }
.expiry-banner[hidden]{ display:none; }
.expiry-banner.has-expired{
  background:#FEF3F2;
  border-bottom-color:#F4B9B3;
  color:#B42318;
}
.expiry-banner-icon{ font-size:15px; line-height:1; }
.expiry-banner-text{ letter-spacing:-.01em; }
.expiry-banner-cta{
  font-size:12px;
  font-weight:600;
  opacity:.75;
}
@media (max-width:640px){
  .expiry-banner{ font-size:13px; padding:9px 12px; gap:7px; flex-wrap:wrap; }
  .expiry-banner-cta{ width:100%; }
}


/* 점검표 — 줄무늬(zebra) + 열폭(유효기간 우선 순서) */
.inspection-table tbody tr:nth-child(odd){ background:#FCFCFA; }
.inspection-table tbody tr:nth-child(even){ background:#F4F4F0; }
.inspection-table tbody tr:hover{ background:#EFEFE9; }
.inspection-table .it-exp{ width:190px; }
.inspection-table .it-name{ width:auto; }
.inspection-table .it-no{ width:60px; }
.inspection-table .it-code{ width:110px; }


/* ── 점검표: 약품명 여백 해소 — 표를 내용 너비로 좌측 정렬 ── */
.inspection-table{ width:auto; min-width:min(100%, 720px); table-layout:auto; }
.inspection-table .it-name{ width:auto; white-space:normal; max-width:600px; }
.card-list.is-table-mode{ display:block; overflow-x:auto; }

/* ─────────────────────────────────────────────────────────────
   해상도별 적응형 (FHD / QHD / UHD) — 큰 화면일수록 시원하게
   ───────────────────────────────────────────────────────────── */
@media (min-width:1680px){   /* FHD~ */
  body#page-top .app-shell{ max-width:1680px; }
}
@media (min-width:2200px){   /* QHD~ */
  html{ font-size:17px; }
  body#page-top .app-shell{ max-width:2000px; padding:34px 40px 52px; }
  body#page-top .card-list{ grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:22px; }
}
@media (min-width:3200px){   /* UHD/4K~ */
  html{ font-size:19px; }
  body#page-top .app-shell{ max-width:2560px; padding:44px 56px 64px; }
  body#page-top .card-list{ grid-template-columns:repeat(auto-fill,minmax(340px,1fr)); gap:28px; }
  body#page-top .inspection-table{ font-size:16px; }
  body#page-top .inspection-table tbody td{ height:54px; }
}
/* ── 성분 검색: 현재 관리시스템과 공공데이터 결과를 분리 ── */
.public-ingredient-results{
  margin-top:clamp(28px,4vw,56px);
  padding-bottom:12px;
}
.public-ingredient-results[hidden]{ display:none; }
.public-ingredient-divider{
  height:1px;
  margin-bottom:clamp(24px,3vw,40px);
  background:linear-gradient(90deg,transparent 0%,rgba(26,28,27,.22) 12%,rgba(26,28,27,.22) 88%,transparent 100%);
}
.public-ingredient-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  margin-bottom:16px;
}
.public-ingredient-eyebrow{
  display:block;
  margin-bottom:6px;
  color:#7B817B;
  font-family:"DM Mono",ui-monospace,monospace;
  font-size:11px;
  font-weight:700;
  letter-spacing:.12em;
}
.public-ingredient-head h2{
  margin:0;
  color:#1A1C1B;
  font-size:clamp(20px,2vw,28px);
  font-weight:800;
  letter-spacing:-.045em;
}
.public-ingredient-status{
  max-width:760px;
  margin:8px 0 0;
  color:#6B726B;
  font-size:13px;
  line-height:1.55;
}
.public-ingredient-count{
  flex:none;
  min-width:58px;
  padding:8px 11px;
  border:1px solid rgba(26,28,27,.14);
  border-radius:999px;
  background:#F4F4F0;
  color:#4F5650;
  font-family:"DM Mono",ui-monospace,monospace;
  font-size:12px;
  font-weight:700;
  text-align:center;
}
.public-ingredient-list{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
  gap:12px;
}
.public-ingredient-card{
  min-width:0;
  padding:17px 18px 15px;
  border:1px solid rgba(26,28,27,.14);
  border-radius:14px;
  background:#FCFCFA;
  box-shadow:0 6px 18px rgba(15,23,42,.035);
}
.public-ingredient-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:13px;
}
.public-ingredient-card-head > div{ min-width:0; }
.public-ingredient-source{
  display:block;
  margin-bottom:5px;
  color:#7B817B;
  font-size:11px;
  font-weight:700;
}
.public-ingredient-card-head strong{
  display:block;
  color:#20231F;
  font-size:17px;
  line-height:1.35;
  letter-spacing:-.035em;
  overflow-wrap:anywhere;
}
.public-ingredient-kind{
  flex:none;
  padding:5px 7px;
  border-radius:7px;
  background:#E9F2EA;
  color:#2F6338;
  font-size:11px;
  font-weight:700;
  white-space:nowrap;
}
.public-ingredient-kind.is-combo{
  background:#FFF2D8;
  color:#8A5B12;
}
.public-ingredient-meta{
  display:grid;
  gap:8px;
  margin:0;
}
.public-ingredient-meta > div{
  display:grid;
  grid-template-columns:70px minmax(0,1fr);
  gap:10px;
  align-items:start;
}
.public-ingredient-meta dt{
  color:#858B85;
  font-size:12px;
  font-weight:700;
}
.public-ingredient-meta dd{
  min-width:0;
  margin:0;
  color:#414841;
  font-size:12px;
  line-height:1.45;
  overflow-wrap:anywhere;
}
.public-ingredient-meta .public-ingredient-code{
  color:#69706A;
  font-family:"DM Mono",ui-monospace,monospace;
}
.public-ingredient-link{
  display:inline-flex;
  margin-top:14px;
  color:#3E6650;
  font-size:12px;
  font-weight:700;
  text-decoration:none;
}
.public-ingredient-link:hover{ text-decoration:underline; }
.public-ingredient-empty,
.public-ingredient-loading{
  padding:18px;
  border:1px dashed rgba(26,28,27,.2);
  border-radius:12px;
  color:#747B74;
  background:#FBFBF8;
  font-size:13px;
  line-height:1.55;
}
.public-ingredient-more{
  display:block;
  min-height:40px;
  margin:16px auto 0;
  padding:0 16px;
  border:1px solid rgba(26,28,27,.16);
  border-radius:8px;
  background:#fff;
  color:#39433B;
  font-family:inherit;
  font-size:13px;
  font-weight:700;
  cursor:pointer;
}
.public-ingredient-more:hover{ background:#F4F4F0; }
@media (max-width:640px){
  .public-ingredient-results{ margin-top:32px; }
  .public-ingredient-head{ gap:12px; }
  .public-ingredient-head h2{ font-size:21px; }
  .public-ingredient-status{ font-size:12px; }
  .public-ingredient-count{ padding:7px 9px; font-size:11px; }
  .public-ingredient-list{ grid-template-columns:1fr; gap:10px; }
  .public-ingredient-card{ padding:15px; }
.public-ingredient-card-head strong{ font-size:16px; }
}

/* 공공데이터 결과도 현재 약품 카드의 구조·이미지 영역을 그대로 사용한다.
   품목번호와 허가정보는 재고 번호/유효기간과 혼동하지 않도록 별도 표기한다. */
.public-ingredient-list{
  grid-template-columns:repeat(auto-fill,minmax(260px,298px));
  justify-content:start;
  align-items:start;
  gap:16px;
}
.public-medicine-card{ width:100%; min-width:0; box-sizing:border-box; }
.public-card-no{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:0 8px;
  border:.5px solid var(--tm-outline);
  border-radius:var(--tm-radius-sm);
  background:var(--tm-surface-low);
  color:var(--tm-text-soft);
  font-family:var(--tm-font-data);
  font-size:10px;
  font-weight:700;
  letter-spacing:.08em;
  line-height:1;
}
.public-card-chip{ color:#2F6338; border-color:rgba(47,99,56,.22); background:#E9F2EA; font-family:var(--tm-font-ui); letter-spacing:-.01em; }
.public-card-code{ max-width:174px; overflow:hidden; text-overflow:ellipsis; }
.public-card-detail{ color:var(--tm-text-soft); text-decoration:none; cursor:pointer; }
.public-card-detail:hover,.public-card-detail:focus-visible{ text-decoration:none; }
.public-card-kind{ justify-self:start; margin-top:-2px; }
.public-card-media{ width:100%; }
.public-card-media img{ object-fit:cover; }
.public-medicine-card .public-ingredient-link{ margin-top:-2px; }
@media (max-width:640px){
  .public-ingredient-list{ grid-template-columns:1fr; gap:10px; }
  .public-medicine-card{ padding:15px; }
  .public-medicine-card .card-title > strong{ font-size:16px; }
}

/* 원외내복약 공공 카탈로그: 기존 재고와 분리된 읽기 전용 화면 */
body#page-top .machine-tabs{grid-template-columns:repeat(2,minmax(0,1fr))}
body#page-top.is-catalog-mode .expiry-filter,
body#page-top.is-catalog-mode .search-tools,
body#page-top.is-catalog-mode .view-toolbar,
body#page-top.is-catalog-mode #expiryBanner,
body#page-top.is-catalog-mode #printRows,
body#page-top.is-catalog-mode #openAdmin,
body#page-top.is-catalog-mode #publicIngredientSection{display:none!important}
body#page-top .catalog-medicine-card{align-content:start;min-width:0}
body#page-top .catalog-source-badge,
body#page-top .catalog-readonly-badge{display:inline-flex;align-items:center;min-height:26px;padding:0 8px;border:.5px solid var(--tm-outline);border-radius:2px;background:var(--tm-surface-low);color:#2f6338;font-size:10px;font-weight:700;white-space:nowrap}
body#page-top .catalog-readonly-badge{margin-left:auto;color:var(--tm-surface-muted)}
body#page-top .catalog-official-name{display:grid;gap:2px;min-width:0;padding:9px 10px;border-left:3px solid #0f766e;background:#f3faf8}
body#page-top .catalog-official-name span,
body#page-top .catalog-code-grid small{color:var(--tm-surface-muted);font-size:9px;font-weight:700;letter-spacing:.08em;text-transform:uppercase}
body#page-top .catalog-official-name strong{overflow-wrap:anywhere;font-size:12px;line-height:1.45}
body#page-top .catalog-code-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
body#page-top .catalog-code-grid>span{display:grid;gap:2px;min-width:0;padding:8px 9px;border:.5px solid var(--tm-outline);background:var(--tm-surface-low)}
body#page-top .catalog-code-grid strong{overflow-wrap:anywhere;color:var(--tm-surface-ink);font-family:var(--tm-font-tech);font-size:11px}
body#page-top .catalog-meta{display:grid;gap:7px;margin:0}
body#page-top .catalog-meta>div{display:grid;grid-template-columns:66px minmax(0,1fr);gap:8px;min-width:0}
body#page-top .catalog-meta dt{color:var(--tm-surface-muted);font-size:10px;font-weight:700}
body#page-top .catalog-meta dd{min-width:0;margin:0;overflow-wrap:anywhere;color:var(--tm-surface-ink);font-size:11px;line-height:1.45}
body#page-top .catalog-detail-link{display:inline-flex;align-items:center;justify-content:center;min-height:36px;border:.5px solid var(--tm-outline);background:var(--tm-surface-low);color:#2f6338;font-size:11px;font-weight:700}
body#page-top .catalog-detail-link:hover,
body#page-top .catalog-detail-link:focus-visible{border-color:var(--tm-outline-strong);background:#fff;outline:none}
body#page-top .catalog-card-media{width:100%}
@media(max-width:640px){
  body#page-top .machine-tabs{display:flex;gap:6px;overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  body#page-top .machine-tabs::-webkit-scrollbar{display:none}
  body#page-top .machine-tab{flex:0 0 auto;min-width:68px;padding-inline:10px;white-space:nowrap}
  body#page-top .catalog-code-grid{grid-template-columns:1fr}
  body#page-top .catalog-meta>div{grid-template-columns:58px minmax(0,1fr)}
}

/* 원외내복약 카드 정렬: 한 행의 카드 높이·이미지·하단 링크를 동일하게 유지한다. */
body#page-top.is-catalog-mode .card-list{align-items:stretch}
body#page-top.is-catalog-mode .catalog-medicine-card{
  display:flex;
  flex-direction:column;
  height:100%;
  min-height:0;
  align-content:normal;
}
body#page-top.is-catalog-mode .catalog-medicine-card>.card-title{
  display:flex;
  flex:1 1 auto;
  flex-direction:column;
  min-width:0;
  min-height:0;
}
body#page-top.is-catalog-mode .catalog-medicine-card>.card-title>strong{
  display:block;
  width:100%;
  min-width:0;
  min-height:1.35em;
  height:1.35em;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  font-size:var(--catalog-title-font-size,clamp(12px,1.15vw,18px));
  line-height:1.35;
  letter-spacing:-.035em;
}
body#page-top.is-catalog-mode .catalog-official-name{
  min-height:64px;
  align-content:start;
}
body#page-top.is-catalog-mode .catalog-official-name strong{
  display:-webkit-box;
  overflow:hidden;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}
body#page-top.is-catalog-mode .catalog-code-grid>span{
  min-height:48px;
  align-content:start;
}
body#page-top.is-catalog-mode .catalog-card-media{
  flex:0 0 172px;
  height:172px;
  min-height:172px;
}
body#page-top.is-catalog-mode .catalog-card-media img{
  width:100%;
  height:100%;
  object-fit:cover;
}
body#page-top.is-catalog-mode .catalog-detail-link{
  flex:0 0 36px;
  min-height:36px;
}
@media(max-width:640px){
  body#page-top.is-catalog-mode .catalog-official-name{min-height:60px}
  body#page-top.is-catalog-mode .catalog-card-media{
    flex-basis:154px;
    height:154px;
    min-height:154px;
  }
}
