/* MediMind Lite · 시안 A · 엄지선 (design spec 2026-09-27)
 * 왼쪽에 붙은 좁은 메뉴 + 오른쪽 작업창. 위계는 글자 굵기와 구분선으로 만들고, 색은 재고 상태와 알림에만 씁니다.
 * CSP: style 속성은 쓰지 않습니다(클래스와 CSSOM 만). 아이콘은 data: SVG 마스크, 글꼴은 시스템 글꼴만 씁니다. */

/* ── 1. 토큰 (spec §2) ─────────────────────────────────────── */
:root {
  /* surfaces */
  --a-page: #eef1f5;
  --a-surface: #ffffff;
  --a-sunken: #f5f7fa;
  --a-row-hover: #f5f8fc;

  /* rail (dark) */
  --a-rail: #223140;
  --a-rail-hover: #2b3d50;
  --a-rail-current: #2e4256;
  --a-rail-line: #33445a;
  --a-rail-line-strong: #46596e;
  --a-rail-ink: #c3cedb;
  --a-rail-ink-dim: #9aa9ba;
  --a-rail-strong: #eef2f7;
  --a-rail-marker: #7fb0dc;
  --a-focus-on-dark: #9cc4e8;

  /* ink */
  --a-ink: #1b2430;
  --a-ink-2: #3d4b5a;
  --a-muted: #5b6977;
  --a-placeholder: #697683;

  /* lines */
  --a-line: #d5dde6;
  --a-line-soft: #e7ecf2;
  --a-line-input: #7d8da1;
  --a-line-strong: #a9c0d6;

  /* accent (navy) */
  --a-accent: #1f4f7a;
  --a-accent-hover: #183f62;
  --a-accent-soft: #e7eff7;
  --a-accent-press: #d6e4f1;
  --a-accent-line: #a9c0d6;

  /* recovery family = accent hue, dashed shape */
  --a-recover-soft: #eef4fa;
  --a-recover-line: #8fb0cf;

  /* error / danger / recording */
  --a-warn: #8a3b2c;
  --a-warn-strong: #6f3025;
  --a-warn-soft: #fbefeb;
  --a-warn-line: #e6c9bf;
  --a-warn-on-dark: #f3d9d2;

  /* attention (주문 필요 · 저장 대기 · 충돌) */
  --a-order: #8a5a12;
  --a-order-ink: #7a4f0f;
  --a-order-fill: #b7791f;
  --a-order-soft: #fdf6e8;
  --a-order-line: #e2c48f;

  /* success */
  --a-ok: #2d6a57;
  --a-ok-soft: #e8f3ef;
  --a-ok-line: #a8cdbd;

  /* neutral info / offline */
  --a-slate: #3d4b5a;

  /* disabled (no opacity) */
  --a-disabled-bg: #e7ecf2;
  --a-disabled-ink: #6b7886;

  /* type */
  --a-font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --a-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* space (4-base) */
  --a-s1: 4px; --a-s2: 8px; --a-s3: 12px; --a-s4: 16px; --a-s5: 20px; --a-s6: 24px; --a-s8: 32px;

  /* radius */
  --a-r-sm: 4px;
  --a-r: 6px;
  --a-r-lg: 8px;
  --a-r-pill: 999px;

  /* targets */
  --a-hit: 44px; --a-hit-lg: 56px; --a-hit-xl: 72px;

  /* elevation */
  --a-e1: 0 1px 0 #d5dde6, 0 2px 8px #182c431a;
  --a-e1-up: 0 -1px 0 #d5dde6, 0 -2px 8px #182c431a;
  --a-e2: 0 8px 28px #182c4330;
  --a-e3: 0 16px 48px #182c433d;
  --a-backdrop: #182c4366;
  --a-scroll-cue: #182c4347;      /* scroll shadow: more content above / below inside a popover */

  /* layout */
  --a-rail-w: 176px;
  --a-side-w: 228px;
  --a-toolbar-h: 96px;
  --a-dur: 140ms;

  /* icons (CSS mask, data: SVG — CSP img-src 'self' data:) */
  --a-i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --a-i-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5.5M12 16.5v.5'/%3E%3C/svg%3E");
  --a-i-triangle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 2.5 20h19z'/%3E%3Cpath d='M12 10v4.5M12 17.2v.3'/%3E%3C/svg%3E");
  --a-i-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3.5 2'/%3E%3C/svg%3E");
  --a-i-tray: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 13.5h5l1.5 3h5l1.5-3h5'/%3E%3Cpath d='M5.5 5h13L21 13.5V19H3v-5.5z'/%3E%3C/svg%3E");
  --a-i-doc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h8l4 4v14H6z'/%3E%3Cpath d='M14 3v4h4M9 12h6M9 16h6'/%3E%3C/svg%3E");
  --a-i-mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21'/%3E%3C/svg%3E");
  --a-i-wifi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l18 18M8.5 16a5 5 0 0 1 7 0M5 12.3a10 10 0 0 1 4-2.2M15 10.1a10 10 0 0 1 4 2.2M2 8.8a15 15 0 0 1 4.5-2.9M11 5a15 15 0 0 1 11 3.8M12 19.5h.01'/%3E%3C/svg%3E");
  --a-i-upload: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V4M7.5 8.5 12 4l4.5 4.5M4 15v4.5h16V15'/%3E%3C/svg%3E");
  --a-i-login: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h5v16h-5M3 12h11M10 8l4 4-4 4'/%3E%3C/svg%3E");
  --a-i-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* ── 2. 바탕 ────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { background: var(--a-page); }
body {
  margin: 0;
  font-family: var(--a-font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--a-ink);
  background: var(--a-page);
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
code { font-family: var(--a-mono); }
:focus-visible { outline: 3px solid var(--a-accent); outline-offset: 2px; }

/* 숨김은 언제나 이깁니다(공용 부품이 display 를 정해도). */
[hidden] { display: none !important; }

.a-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* 인라인 style 을 대신하는 도구 */
.a-mt-16 { margin-top: 16px; }
.a-grow-1 { flex: 1 1 0; }
.a-grow-2 { flex: 2 1 0; }
.a-inline { display: inline; }
.a-muted { color: var(--a-muted); }
.a-num { font-variant-numeric: tabular-nums; }

@keyframes a-spin { to { transform: rotate(360deg); } }
@keyframes a-pulse { 50% { opacity: .35; } }
@keyframes a-toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── 3. 버튼 (spec §5.3) ────────────────────────────────────── */
.a-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--a-line-input); border-radius: var(--a-r);
  background: var(--a-surface); color: var(--a-ink);
  font-size: 13.5px; font-weight: 600; line-height: 1.4;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color var(--a-dur), border-color var(--a-dur);
}
.a-btn:hover:not(:disabled) { background: var(--a-accent-soft); border-color: var(--a-line-strong); }
.a-btn:active:not(:disabled) { background: var(--a-accent-press); }
.a-btn-main { background: var(--a-accent); border-color: var(--a-accent); color: #fff; }
.a-btn-main:hover:not(:disabled) { background: var(--a-accent-hover); border-color: var(--a-accent-hover); }
.a-btn-main:active:not(:disabled) { background: var(--a-accent-hover); }
.a-btn-quiet { background: transparent; border-color: transparent; color: var(--a-ink-2); }
.a-btn-quiet:hover:not(:disabled) { background: var(--a-sunken); border-color: transparent; color: var(--a-ink); }
.a-btn-sm { min-height: 32px; padding: 0 10px; font-size: 12.5px; }
.a-btn-danger { background: var(--a-surface); border-color: var(--a-warn); color: var(--a-warn); }
.a-btn-danger:hover:not(:disabled) { background: var(--a-warn-soft); border-color: var(--a-warn); }
.a-btn-danger-quiet { background: transparent; border-color: transparent; color: var(--a-warn); }
.a-btn-danger-quiet:hover:not(:disabled) { background: transparent; border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
.a-btn:disabled, .a-btn[aria-disabled="true"] {
  background: var(--a-disabled-bg); border-color: transparent; color: var(--a-disabled-ink); cursor: not-allowed;
}
.a-btn[aria-busy="true"] { cursor: progress; }
.a-btn[aria-busy="true"]::before {
  content: ""; flex: 0 0 auto; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: a-spin .8s linear infinite;
}
/* 파일 선택: 진짜 버튼 + 업로드 아이콘 */
.a-btn-file::before {
  content: ""; flex: 0 0 auto; width: 16px; height: 16px; background-color: currentColor;
  -webkit-mask: var(--a-i-upload) center / contain no-repeat; mask: var(--a-i-upload) center / contain no-repeat;
}
.a-file-name { font-family: var(--a-mono); font-size: 12.5px; color: var(--a-ink-2); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.a-file-name[data-empty="true"] { font-family: var(--a-font); color: var(--a-muted); }

/* ── 4. 입력 (spec §5.4) ────────────────────────────────────── */
.a-field { display: block; }
.a-field > span, .a-field-name {
  display: block; margin-bottom: 4px;
  font-size: 12.5px; font-weight: 600; line-height: 1.4; color: var(--a-ink-2);
}
.a-input, .a-textarea {
  width: 100%;
  appearance: none; -webkit-appearance: none;
  min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--a-line-input); border-radius: var(--a-r-sm);
  background: var(--a-surface); color: var(--a-ink);
  font-size: 14px; line-height: 1.5;
  outline: none;
  transition: border-color var(--a-dur);
}
.a-input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
.a-input:focus, .a-textarea:focus { border-color: var(--a-accent); box-shadow: 0 0 0 3px #1f4f7a2e; }
.a-input::placeholder, .a-textarea::placeholder { color: var(--a-placeholder); opacity: 1; }
.a-input[aria-invalid="true"], .a-textarea[aria-invalid="true"] { border-color: var(--a-warn); box-shadow: 0 0 0 3px #8a3b2c26; }
.a-input:disabled, .a-textarea:disabled { background: var(--a-disabled-bg); color: var(--a-disabled-ink); border-color: var(--a-line); cursor: not-allowed; }
.a-textarea { line-height: 1.7; resize: vertical; }
.a-select {
  padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235b6977' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
#a-inv-search {
  min-height: 48px; font-size: 16px; padding-left: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%235b6977' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center;
}
/* 필드 아래 오류 문장 (4xx) */
#a-quantity-error, #a-name-error, #a-memo-error, #a-notice-error, #a-add-error, #a-pack-error, .a-field-error {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--a-warn);
}
#a-quantity-error::before, #a-name-error::before, #a-memo-error::before, #a-notice-error::before, #a-add-error::before, #a-pack-error::before, .a-field-error::before {
  content: ""; flex: 0 0 14px; height: 14px; background-color: currentColor;
  -webkit-mask: var(--a-i-alert) center / contain no-repeat; mask: var(--a-i-alert) center / contain no-repeat;
}
#a-quantity-error:empty, #a-name-error:empty, #a-memo-error:empty, #a-notice-error:empty, #a-add-error:empty, #a-pack-error:empty { display: none; }

/* ── 5. 병원 선택 화면 (renderClinicPicker) ─────────────────── */
.a-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px 56px; }
.a-login-card {
  width: 100%; max-width: 400px; padding: 32px 28px 24px;
  background: var(--a-surface); border: 1px solid var(--a-line); border-top: 3px solid var(--a-accent); border-radius: var(--a-r);
}
.a-login-mark { margin-bottom: 12px; font-size: 12.5px; font-weight: 700; color: var(--a-muted); }
.a-login-card h1 { font-size: 20px; line-height: 1.35; font-weight: 700; letter-spacing: -0.3px; }
.a-login-sub { margin-top: 4px; font-size: 13.5px; color: var(--a-muted); word-break: keep-all; overflow-wrap: anywhere; }
.a-clinic-list button { min-height: 56px; padding: 12px; }

/* ── 6. 뼈대 · 메뉴 (spec §5.1) ─────────────────────────────── */
.a-shell { display: grid; grid-template-columns: var(--a-rail-w) minmax(0, 1fr); min-height: 100vh; }

.a-rail {
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
  background: var(--a-rail); color: var(--a-rail-ink);
}
.a-rail :focus-visible { outline-color: var(--a-focus-on-dark); }
.a-rail-inner { display: flex; flex-direction: column; min-height: 100%; padding: 18px 0 0; }
.a-rail-mark { padding: 0 18px 16px; }
.a-rail-mark img { display: block; max-width: 100%; height: auto; filter: invert(1) hue-rotate(180deg); opacity: 1; }
.a-rail-clinic {
  padding: 0 18px 16px; margin: 0;
  font-size: 12.5px; line-height: 1.4; color: var(--a-rail-ink-dim);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere;
}
.a-rail-nav { display: flex; flex-direction: column; }
.a-rail-nav button {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 18px 0 15px;
  border: 0; border-left: 3px solid transparent; background: transparent; color: var(--a-rail-ink);
  font-size: 15px; font-weight: 600; text-align: left; cursor: pointer;
  transition: background-color var(--a-dur);
}
.a-rail-nav button:hover { background: var(--a-rail-hover); color: #fff; }
.a-rail-nav button[aria-current="page"] { background: var(--a-rail-current); border-left-color: var(--a-rail-marker); color: #fff; }
/* 아직 열지 않은 메뉴(진료 기록, 알파): 회색으로 두고 '준비 중'을 붙입니다. */
.a-rail-nav button.a-rail-soon, .a-rail-nav button.a-rail-soon:hover { opacity: .45; background: transparent; color: inherit; cursor: not-allowed; }
.a-rail-soon span { margin-left: 6px; padding: 1px 6px; border: 1px solid currentColor; border-radius: var(--a-r-pill); font-size: 11px; font-weight: 600; }
.a-rail-foot { margin-top: auto; padding: 16px 18px 12px; border-top: 1px solid var(--a-rail-line); }
.a-rail-user { font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--a-rail-strong); overflow-wrap: anywhere; }
.a-rail-role { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--a-rail-ink-dim); }
.a-rail-foot .a-btn {
  width: 100%; min-height: 36px; margin-top: 8px; padding: 0 10px;
  background: transparent; border-color: var(--a-rail-line); color: var(--a-rail-ink); font-size: 12.5px;
}
.a-rail-foot .a-rail-user + .a-btn { margin-top: 12px; }
.a-rail-foot .a-btn:hover:not(:disabled) { background: var(--a-rail-hover); border-color: var(--a-rail-line-strong); color: #fff; }
.a-rail-version { margin-top: 12px; font-family: var(--a-mono); font-size: 12px; color: var(--a-rail-ink-dim); font-variant-numeric: tabular-nums; }

/* ── 7. 작업창 머리 ─────────────────────────────────────────── */
.a-stage { min-width: 0; background: var(--a-page); display: flex; flex-direction: column; }
.a-stage-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap;
  min-height: 64px; padding: 10px 20px;
  background: var(--a-surface); border-bottom: 1px solid var(--a-line);
}
.a-stage-head h1 { font-size: 20px; line-height: 1.35; font-weight: 700; letter-spacing: -0.3px; overflow-wrap: anywhere; }
.a-stage-meta { margin-top: 2px; font-size: 13px; color: var(--a-muted); font-variant-numeric: tabular-nums; word-break: keep-all; overflow-wrap: anywhere; }
.a-stage-meta b { color: var(--a-ink-2); font-weight: 600; }
.a-stage-right { font-size: 12.5px; color: var(--a-muted); text-align: right; word-break: keep-all; overflow-wrap: anywhere; }
.a-stage-right b { color: var(--a-ink-2); font-weight: 600; }
.a-stage > .a-banner, .a-stage > .a-banner-stack { margin: 12px 20px 0; }
.a-stage > .a-staff-full { margin-bottom: 0; }

/* ── 8. 진료 기록: 분할 작업창 (spec §6.4) ───────────────────── */
.a-split {
  display: grid; grid-template-columns: var(--a-side-w) minmax(0, 1fr) minmax(0, 1fr);
  flex: 1; background: var(--a-surface);
}
.a-pane { min-width: 0; display: flex; flex-direction: column; padding: 0 0 16px; }
.a-pane + .a-pane { border-left: 1px solid var(--a-line); }
.a-pane-side { background: var(--a-sunken); }
.a-pane-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px; padding: 8px 16px; border-bottom: 1px solid var(--a-line-soft);
}
.a-pane-head h2 { font-size: 14px; line-height: 1.4; font-weight: 700; }
.a-pane-count { font-size: 12.5px; color: var(--a-muted); font-variant-numeric: tabular-nums; }
.a-pane-body { padding: 16px 16px 0; }

.a-search { display: flex; gap: 8px; }
.a-search .a-input { min-width: 0; }
.a-pane-body .a-search .a-age { flex: 1 1 64px; max-width: none; }
#patient-search, #visit-create { flex-wrap: wrap; }
#patient-search > .a-input:first-child { flex: 1 1 100%; }
#visit-create > .a-input { flex: 1 1 140px; }
#patient-search > .a-btn, #visit-create > .a-btn { flex: 1 0 auto; }
.a-list { margin-top: 12px; border-top: 1px solid var(--a-line-soft); }
.a-list li { border-bottom: 1px solid var(--a-line-soft); }
.a-list button {
  display: block; width: 100%; min-height: 56px; padding: 8px 12px 8px 9px;
  border: 0; border-left: 3px solid transparent; background: transparent; text-align: left; cursor: pointer;
  transition: background-color var(--a-dur);
}
.a-list button:hover { background: var(--a-row-hover); }
.a-list button[aria-current="true"] { background: var(--a-accent-soft); border-left-color: var(--a-accent); }
.a-list .a-list-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.a-list .a-list-name { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.a-list .a-list-age { font-size: 12.5px; color: var(--a-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.a-list .a-list-sub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--a-muted); font-variant-numeric: tabular-nums; }
.a-list-empty { padding: 16px 4px; font-size: 12.5px; color: var(--a-muted); word-break: keep-all; }

.a-subhead { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--a-line); font-size: 12.5px; font-weight: 700; color: var(--a-ink-2); }
.a-new-visit { margin-top: 8px; }
.a-visits { margin-top: 8px; display: grid; gap: 4px; }
.a-visits button {
  width: 100%; min-height: 52px; padding: 8px 12px; text-align: left; cursor: pointer;
  border: 1px solid var(--a-line); border-radius: var(--a-r-sm); background: var(--a-surface);
  transition: border-color var(--a-dur);
}
.a-visits button:hover { border-color: var(--a-line-strong); }
.a-visits button[aria-current="true"] { border-color: var(--a-accent); box-shadow: inset 3px 0 0 var(--a-accent); }
.a-visits .a-visit-date { display: block; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.a-visits .a-visit-sub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--a-muted); }
.a-patient-add { margin-top: 12px; font-size: 13.5px; }
.a-patient-add summary { min-height: 40px; padding: 8px 0; color: var(--a-accent); font-weight: 600; cursor: pointer; }
.a-patient-add .a-memo-form { margin-top: 8px; display: grid; gap: 8px; }

/* 녹음 (spec §5.18) */
.a-rec { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 64px; padding: 8px 0; background: var(--a-surface); }
#record-button { min-height: 48px; min-width: 148px; font-size: 15px; font-weight: 700; }
#record-button::before {
  content: ""; flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: #fff; opacity: .6;
}
#record-button[data-on="true"] { background: var(--a-warn); border-color: var(--a-warn); color: #fff; }
#record-button[data-on="true"]:hover:not(:disabled) { background: var(--a-warn-strong); border-color: var(--a-warn-strong); }
#record-button[data-on="true"]::before { opacity: 1; animation: a-pulse 1.1s infinite; }
#record-button:disabled::before { background: currentColor; }
#record-button[aria-busy="true"]::before { background: transparent; opacity: 1; }
.a-rec .a-btn-file { min-height: 48px; }
.a-rec-time { display: inline-flex; align-items: center; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--a-ink); }
#record-indicator { font-size: 13px; font-weight: 400; color: var(--a-muted); }
.a-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--a-line-input); }
.a-dot[data-on="true"] { background: var(--a-warn); animation: a-pulse 1.1s infinite; }
.a-rec-note { margin-top: 4px; font-size: 12.5px; color: var(--a-muted); word-break: keep-all; }

/* 입력 블록 · 요약 · 설명 */
.a-block { margin-top: 16px; }
.a-block + .a-block { margin-top: 16px; }
.a-block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; margin-bottom: 8px; }
.a-block-head label, .a-block-head h3 { font-size: 14px; font-weight: 700; }
.a-block .a-textarea { font-size: 16px; line-height: 1.75; }
.a-transcript { min-height: 260px; }
#korean_translation { min-height: 160px; }
.a-summary { min-height: 240px; font-weight: 500; }
.a-explain { min-height: 140px; }
.a-hint { margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--a-muted); word-break: keep-all; overflow-wrap: anywhere; }
.a-hint[data-warn="true"] { color: var(--a-warn); }
#explanation-player { width: 100%; margin-top: 8px; }

.a-audio-history { margin-top: 12px; font-size: 13.5px; }
.a-audio-history summary { min-height: 40px; padding: 8px 0; color: var(--a-accent); font-weight: 600; cursor: pointer; }
.a-audio-row { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--a-line-soft); }
.a-audio-row audio { max-width: 260px; height: 36px; }
.a-audio-row small { font-size: 12px; color: var(--a-muted); }

/* AI 버튼: 미설정이면 '연결 안 됨'으로 보이게 (spec §5.20) */
.a-btn[data-ai-off]:disabled { background: var(--a-sunken); border: 1px dashed var(--a-line-input); color: var(--a-muted); }

/* AI 표시 칩 */
.a-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px;
  border: 1px solid var(--a-line); border-radius: var(--a-r-pill);
  font-size: 12.5px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.a-chip[data-tone="ok"] { background: var(--a-ok-soft); border-color: var(--a-ok-line); color: var(--a-ok); }
.a-chip[data-tone="ok"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.a-chip[data-tone="neutral"] { background: var(--a-sunken); border-style: dashed; border-color: var(--a-line-input); color: var(--a-ink-2); }
.a-stage-right .a-chip { display: inline-flex; }

/* 진료 기록 아래 줄 (spec §5.19) */
.a-pane-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 16px 0; border-top: 1px solid var(--a-line);
  background: var(--a-surface);
}
.a-pane-foot #save-encounter { margin-left: auto; }
.a-pane-foot .a-btn { min-height: 44px; }
.a-pane-foot:has(#copy-summary:disabled) #approve-encounter:not(:disabled) { background: var(--a-accent); border-color: var(--a-accent); color: #fff; }
.a-pane-foot:has(#copy-summary:disabled) #approve-encounter:not(:disabled):hover { background: var(--a-accent-hover); border-color: var(--a-accent-hover); }
.a-foot-note { flex-basis: 100%; margin-top: 0; }
.a-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.a-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--a-accent); }

/* 저장 상태 줄: 앞 8px 점으로 상태 (spec §5.12) */
#a-status, #save-state { font-size: 12.5px; color: var(--a-muted); }
#a-status::before, #save-state::before {
  content: none; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; vertical-align: 1px;
}
#a-status[data-tone="saving"], #save-state[data-tone="saving"] { color: var(--a-ink-2); }
#a-status[data-tone="saving"]::before, #save-state[data-tone="saving"]::before { content: ""; background: var(--a-accent); }
#a-status[data-tone="saved"], #save-state[data-tone="saved"] { color: var(--a-ok); font-weight: 600; }
#a-status[data-tone="saved"]::before, #save-state[data-tone="saved"]::before { content: ""; background: var(--a-ok); }
#a-status[data-dirty="true"], #a-status[data-tone="queued"], #a-status[data-tone="offline"],
#save-state[data-dirty="true"], #save-state[data-tone="queued"], #save-state[data-tone="offline"] { color: var(--a-order-ink); font-weight: 600; }
#a-status[data-dirty="true"]::before, #a-status[data-tone="queued"]::before, #a-status[data-tone="offline"]::before,
#save-state[data-dirty="true"]::before, #save-state[data-tone="queued"]::before, #save-state[data-tone="offline"]::before { content: ""; background: var(--a-order-fill); }
#a-status[data-tone="failed"], #save-state[data-tone="failed"] { color: var(--a-warn); font-weight: 600; }
#a-status[data-tone="failed"]::before, #save-state[data-tone="failed"]::before { content: ""; background: var(--a-warn); }
/* idle 은 기본 모양(점 없음 · muted) 그대로. data-dirty="true" 가 남아 있어도 data-tone 이 이깁니다. */
#a-status[data-tone="idle"], #save-state[data-tone="idle"] { color: var(--a-muted); font-weight: 400; }
#a-status[data-tone="idle"]::before, #save-state[data-tone="idle"]::before { content: none; }
#a-status[data-tone="saving"][data-dirty="true"] { color: var(--a-ink-2); font-weight: 400; }
#a-status[data-tone="saving"][data-dirty="true"]::before { background: var(--a-accent); }
#a-status[data-tone="saved"][data-dirty="true"] { color: var(--a-ok); }
#a-status[data-tone="saved"][data-dirty="true"]::before { background: var(--a-ok); }
/* 실패 줄의 오류 번호 칩: 표면색 바탕 · warn 선 · mono (배너 .a-banner-ref 와 같은 모양, 한 줄 높이 20px 안) */
#a-status code, #save-state code {
  display: inline-block; margin-left: 2px; padding: 0 6px; line-height: 18px;
  border: 1px solid var(--a-warn-line); border-radius: var(--a-r-sm); background: var(--a-surface);
  color: var(--a-warn); font-family: var(--a-mono); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums;
  vertical-align: 0; user-select: all; -webkit-user-select: all;
}
.a-stage-right #save-state { display: block; margin-top: 4px; }
#save-state[data-approved="true"] {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--a-r-pill);
  background: var(--a-ok-soft); color: var(--a-ok); font-weight: 600;
}

/* 진료 기록 충돌 (#conflict): 충돌 배너 모양으로 */
.a-conflict { margin-top: 16px; }

/* ── 9. 약품 재고: 작업 공간 · 도구 줄 (spec §5.6) ─────────────── */
.a-inv-workspace { min-width: 0; padding: 20px 20px 28px; background: var(--a-surface); }
.a-inventory .a-inv-workspace { padding-top: 0; }
.a-workbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; }

.a-inv-toolbar {
  position: sticky; top: 0; z-index: 6;
  height: var(--a-toolbar-h); margin: 0 -20px; padding: 12px 20px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 44px 20px; gap: 8px 12px;
  background: var(--a-surface); box-shadow: var(--a-e1);
}
.a-inv-toolbar :focus-visible { outline-offset: -3px; }
.a-inv-toolbar [aria-pressed="true"]:focus-visible, .a-inv-toolbar .a-btn-main:focus-visible { box-shadow: inset 0 0 0 5px #fff; }
.a-inv-toolbar > #a-location-controls { grid-column: 1; grid-row: 1; }
.a-inv-toolbar > .a-inv-findrow { grid-column: 2; grid-row: 1; }
.a-inv-toolbar > .a-list-meta { grid-column: 1 / -1; grid-row: 2; }
/* 종류 칩 줄이 있으면 도구 줄이 한 줄(36 + 간격 8) 더 높아집니다. 높이 토큰도 함께 늘려 표 머리·팝오버 위치가 맞습니다. */
.a-inv-toolbar > .a-kind-switch { grid-column: 1 / -1; grid-row: 2; margin-top: 0; }
.a-inv-toolbar:has(> .a-kind-switch:not([hidden])) { grid-template-rows: 44px 36px 20px; }
.a-inv-toolbar:has(> .a-kind-switch:not([hidden])) > .a-list-meta { grid-row: 3; }
:root:has(.a-inv-toolbar > .a-kind-switch:not([hidden])) { --a-toolbar-h: 140px; }
.a-inv-findrow { display: flex; align-items: center; gap: 8px; min-width: 0; height: 44px; }
.a-inv-findrow .a-inv-search { flex: 0 1 360px; width: min(360px, 32vw); min-width: 0; margin: 0; }
.a-inv-findrow .a-inv-search > span {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.a-inv-findrow #a-inv-search { min-height: 44px; height: 44px; }
.a-inv-findrow [data-act="item-add"] { flex: 0 0 auto; min-height: 44px; }
.a-add-short { display: none; }

/* 목록 수 · 저장 상태: 한 줄 (말줄임) */
.a-list-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-width: 0; height: 20px; font-size: 12.5px; line-height: 20px; color: var(--a-muted);
  font-variant-numeric: tabular-nums;
}
.a-list-meta > p:first-child { flex: 0 0 auto; white-space: nowrap; }
.a-list-meta b { color: var(--a-ink-2); font-weight: 700; }
.a-list-meta #a-status { flex: 1 1 auto; min-width: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 도구 줄 아래 알림 자리 */
.a-inv-alerts { display: grid; gap: 8px; }
.a-inv-alerts:has(.a-banner) , .a-inv-alerts:has(.a-location-error:not(:empty)) { padding-top: 12px; }
.a-inv-alert:empty { display: none; }
.a-location-error { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--a-warn); }
.a-location-error::before {
  content: ""; flex: 0 0 14px; height: 14px; background-color: currentColor;
  -webkit-mask: var(--a-i-alert) center / contain no-repeat; mask: var(--a-i-alert) center / contain no-repeat;
}
.a-location-error:empty { display: none; }

/* 보관 장소 칩: 줄바꿈 없이 가로 스크롤 (spec §5.5) */
.a-location-controls {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; min-width: 0; height: 44px; margin: 0;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scrollbar-width: none;
}
.a-location-controls::-webkit-scrollbar { display: none; }
.a-loc-switch, .a-loc-actions { display: inline-flex; flex: 0 0 auto; flex-wrap: nowrap; gap: 6px; }
.a-loc-switch button {
  flex: 0 0 auto; min-height: 44px; padding: 0 14px; scroll-snap-align: start;
  border: 1px solid var(--a-line-input); border-radius: var(--a-r); background: var(--a-surface); color: var(--a-ink);
  font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer;
  transition: background-color var(--a-dur), border-color var(--a-dur);
}
.a-loc-switch button:hover { background: var(--a-accent-soft); }
.a-loc-switch button[aria-pressed="true"] { background: var(--a-accent); border-color: var(--a-accent); color: #fff; }
.a-loc-actions { margin-left: 2px; padding-left: 8px; border-left: 1px solid var(--a-line); }
.a-loc-actions .a-btn { min-height: 44px; padding: 0 14px; font-size: 14px; font-weight: 700; }
.a-loc-actions [data-act="location-add"] { border: 1px dashed var(--a-accent); color: var(--a-accent); }
.a-loc-actions [data-act="location-add"]:hover:not(:disabled) { border-color: var(--a-accent); }
/* 장소 삭제는 되돌릴 수 없어 채운 빨강으로 둡니다(smoke 'delete affordance is visibly red'). */
.a-loc-actions .a-btn-danger { background: var(--a-warn); border-color: var(--a-warn); color: #fff; }
.a-loc-actions .a-btn-danger:hover:not(:disabled) { background: var(--a-warn-strong); border-color: var(--a-warn-strong); }

/* ── 10. 보기 · 정렬 · 계산 (spec §5.7) ───────────────────────── */
.a-options-panel { border-bottom: 1px solid var(--a-line-soft); }
.a-options-panel > summary {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0;
  list-style: none; font-size: 13.5px; font-weight: 600; color: var(--a-ink-2); cursor: pointer;
}
.a-options-panel > summary::-webkit-details-marker { display: none; }
.a-options-panel > summary::after {
  content: ""; flex: 0 0 18px; height: 18px; margin-left: auto; background-color: var(--a-muted);
  -webkit-mask: var(--a-i-chevron) center / contain no-repeat; mask: var(--a-i-chevron) center / contain no-repeat;
  transition: transform var(--a-dur);
}
.a-options-panel[open] > summary::after { transform: rotate(180deg); }
#a-options-current { flex: 0 1 auto; min-width: 0; font-size: 12.5px; font-weight: 400; color: var(--a-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-inv-options {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); align-items: end; gap: 12px 16px;
  margin: 0 0 12px; padding: 12px; border-radius: var(--a-r-lg); background: var(--a-sunken);
}
.a-inv-options .a-input { min-height: 44px; }
.a-inv-help { grid-column: 1 / -1; font-size: 13.5px; }
.a-inv-help summary { min-height: 44px; padding: 10px 0; color: var(--a-ink-2); font-weight: 600; cursor: pointer; }
.a-inv-help p { word-break: keep-all; }

.a-view-switch, .a-name-size-bar { display: flex; align-items: center; gap: 6px; }
.a-view-switch button, .a-name-size-bar button {
  min-height: 44px; border: 1px solid var(--a-line-input); border-radius: var(--a-r); background: var(--a-surface);
  font-weight: 600; cursor: pointer;
}
.a-view-switch button { flex: 1 1 0; min-width: 0; padding: 0 12px; font-size: 13.5px; }
.a-view-switch button[aria-pressed="true"] { background: var(--a-accent); border-color: var(--a-accent); color: #fff; }
.a-view-switch button:focus-visible { outline-offset: -3px; }
.a-view-switch button[aria-pressed="true"]:focus-visible { box-shadow: inset 0 0 0 5px #fff; }
.a-name-size-bar button { flex: 0 0 44px; width: 44px; font-size: 20px; }
.a-name-size-bar button:disabled { background: var(--a-disabled-bg); border-color: transparent; color: var(--a-disabled-ink); cursor: not-allowed; }
.a-name-size-bar input { flex: 1 1 auto; width: auto; min-width: 0; min-height: 44px; margin: 0 4px; accent-color: var(--a-accent); }
#a-name-size-value { float: right; font-weight: 400; color: var(--a-muted); font-variant-numeric: tabular-nums; }
.a-window { display: flex; border: 1px solid var(--a-line-input); border-radius: var(--a-r); overflow: hidden; }
.a-window button { flex: 1; min-height: 42px; border: 0; background: var(--a-surface); padding: 0 8px; font-size: 13.5px; cursor: pointer; }
.a-window button + button { border-left: 1px solid var(--a-line-input); }
.a-window button[aria-pressed="true"] { background: var(--a-accent); color: #fff; font-weight: 700; }
.a-window button:focus-visible { outline-offset: -3px; }
.a-window button[aria-pressed="true"]:focus-visible { box-shadow: inset 0 0 0 5px #fff; }
.a-th-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--a-ink-2); }
.a-th { width: 76px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── 11. 재고 표 · 데스크톱 (spec §5.8) ───────────────────────── */
.a-table-wrap { overflow: visible; max-height: none; }
.a-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.a-table thead th { position: sticky; top: var(--a-toolbar-h); z-index: 2; box-shadow: 0 1px 0 var(--a-line); }
.a-table th {
  padding: 8px 12px; text-align: left; white-space: nowrap;
  font-size: 12px; line-height: 1.4; font-weight: 700; color: var(--a-muted);
  background: var(--a-sunken); border-bottom: 1px solid var(--a-line);
}
.a-table td { height: 64px; padding: 8px 12px; border-bottom: 1px solid var(--a-line-soft); vertical-align: middle; }
.a-table .a-col-name { min-width: 260px; font-weight: 600; }
.a-table .a-col-qty { width: 340px; text-align: right; }
.a-table .a-col-stock { width: 156px; }
.a-table .a-col-avg { width: 144px; font-variant-numeric: tabular-nums; }
.a-table .a-col-when { width: 200px; color: var(--a-muted); font-variant-numeric: tabular-nums; }
.a-table th[data-sort-column="qty"] { text-align: right; }
.a-sort-head { min-height: 28px; padding: 0; border: 0; background: transparent; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.a-sort-head span { margin-left: 2px; color: var(--a-muted); }
.a-table th[aria-sort="ascending"], .a-table th[aria-sort="descending"],
.a-table th[aria-sort="ascending"] span, .a-table th[aria-sort="descending"] span { color: var(--a-accent); }

/* 줄 상태 */
.a-table tr[data-row]:focus-within > td:first-child { box-shadow: inset 3px 0 0 var(--a-accent); }
.a-table tr[data-changed="true"] > td { background: var(--a-order-soft); }
.a-table tr[data-changed="true"] > td:first-child { box-shadow: inset 3px 0 0 var(--a-order); }

/* 장소 · 그룹 머리 줄 */
.a-loc-row th {
  padding: 20px 12px 8px; background: var(--a-surface); border-bottom: 2px solid var(--a-accent);
  font-size: 16px; font-weight: 700; color: var(--a-accent);
}
.a-loc-row th span { margin-left: 8px; font-size: 12.5px; font-weight: 600; color: var(--a-muted); }
.a-group-row th { height: 40px; padding: 8px 12px; background: var(--a-accent-soft); font-size: 15px; font-weight: 700; color: var(--a-ink); }
.a-group-row th span { margin-left: 8px; font-size: 12.5px; font-weight: 400; color: var(--a-muted); }

/* 이름 칸 */
.a-name { display: flex; align-items: center; gap: 8px; }
.a-name-text { min-width: 0; font-size: var(--a-name-size, 18px); line-height: 1.4; font-weight: 600; word-break: keep-all; overflow-wrap: anywhere; }
.a-name-edit { padding: 4px 0; border: 0; background: transparent; color: inherit; text-align: left; font-family: inherit; cursor: pointer; }
.a-name-edit:hover { color: var(--a-accent); text-decoration: underline; text-underline-offset: 4px; }
.a-kind-button, .a-favorite {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; padding: 0;
  border: 0; border-radius: var(--a-r-sm); background: transparent; color: var(--a-muted); cursor: pointer;
}
.a-kind-button { width: 40px; height: 40px; color: var(--a-accent); background: var(--a-accent-soft); }
.a-favorite { width: 36px; height: 40px; margin-left: auto; }
.a-favorite svg { fill: none; stroke: currentColor; stroke-width: 1.5; }
.a-favorite[aria-pressed="true"] { color: var(--a-order); }
.a-favorite[aria-pressed="true"] svg { fill: currentColor; }
.a-kind-button:hover, .a-favorite:hover { background: var(--a-line-soft); }

/* 수량 묶음: 포장 · 되돌리기 · 수량 · − (DOM 순서 = 보이는 순서, spec §5.8 / §5.10).
   포장 칸은 비어 있어도 같은 폭을 차지해 행마다 되돌리기·수량·−가 한 줄로 맞습니다. */
.a-qty-control { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; white-space: nowrap; vertical-align: middle; }
.a-qty {
  display: inline-flex; align-items: baseline; justify-content: safe center; gap: 4px;
  width: auto; min-width: 76px; max-width: 120px; min-height: 48px; padding: 0 8px; overflow: hidden;
  border-radius: var(--a-r-sm); cursor: pointer; text-align: center; font-variant-numeric: tabular-nums;
}
.a-qty.a-input { padding-top: 0; padding-bottom: 0; align-items: center; }
.a-qty-number { font-size: 22px; line-height: 1; font-weight: 700; color: var(--a-ink); }
.a-qty-number { flex: 0 0 auto; }
/* 수량 칸이 좁으면 숫자는 그대로 두고 단위만 줄임표로 줄입니다(전체 값은 title·aria-label). */
.a-qty-unit { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; color: var(--a-muted); }
.a-qty:hover { border-color: var(--a-accent); background: var(--a-accent-soft); }
.a-qty[data-unknown="true"] .a-qty-number { font-size: 15px; font-weight: 700; color: var(--a-order-ink); }
.a-pack-summary {
  display: block; flex: 0 1 auto; max-width: 80px; margin: 0; padding: 2px 0;
  border: 0; background: transparent; color: var(--a-ink-2);
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1.35; font-variant-numeric: tabular-nums;
  text-align: right; white-space: normal; cursor: pointer;
}
.a-pack-summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.a-pack-required { color: var(--a-order-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.a-qty-control .a-pack-summary, .a-pack-slot { flex: 0 0 104px; width: 104px; max-width: 104px; }
.a-pack-line { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 표 보기에서는 수량 칸도 고정 폭이라 행마다 되돌리기 위치가 같습니다. */
.a-qty-control .a-qty { flex: 0 0 104px; width: 104px; min-width: 104px; max-width: 104px; }
.a-pack-slot { display: block; }
.a-qty[data-needs-pack="true"], .a-qty[data-needs-pack="true"]:hover { border: 2px dashed var(--a-order-fill); background: var(--a-order-soft); }
.a-pack-prompt { margin: 4px 0 10px; padding: 10px 12px; border: 1px solid var(--a-order-line); border-radius: var(--a-r-sm); background: var(--a-order-soft); }
.a-pack-prompt strong { display: block; font-size: 14px; color: var(--a-order-ink); }
.a-pack-prompt p { margin: 4px 0 6px; font-size: 12.5px; line-height: 1.5; color: var(--a-ink-2); }
/* 종류 칩 (같은 장소 안에서 종류로 나눠 보기) */
.a-kind-switch { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
.a-kind-switch[hidden] { display: none; }
.a-kind-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px;
  border: 1px solid var(--a-line-input); border-radius: var(--a-r-pill); background: var(--a-surface); color: var(--a-ink-2);
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.a-kind-chip span { font-weight: 500; color: var(--a-muted); font-variant-numeric: tabular-nums; }
.a-kind-chip[aria-pressed="true"] { border-color: var(--a-accent); background: var(--a-accent-soft); color: var(--a-accent); }
.a-name-sub { display: none; }
.a-row-expand, .a-table .a-col-rowact { display: none; }
.a-quick-sort { flex: 0 0 auto; position: relative; display: inline-flex; }
.a-quick-sort select { -webkit-appearance: none; appearance: none; height: 36px; min-height: 36px; padding: 0 28px 0 12px; border: 1px solid var(--a-line-input); border-radius: var(--a-r-pill); background-color: var(--a-surface); font: inherit; font-size: 13.5px; font-weight: 700; color: var(--a-ink); }
.a-quick-chip[data-tone="order"] { border-color: var(--a-order-line); background: var(--a-order-soft); color: var(--a-order-ink); }
.a-quick-chip[data-tone="favorite"] { color: var(--a-order); }
.a-quick-chip[aria-pressed="true"] { border-color: var(--a-accent); background: var(--a-accent-soft); color: var(--a-accent); }
.a-chip-sep { flex: 0 0 1px; height: 24px; align-self: center; background: var(--a-line); }
/* 재고 링 (휴대폰 목록): 남은 양만큼 채워진 도넛, 색은 상태 */
.a-ring {
  flex: 0 0 16px; width: 16px; height: 16px; border-radius: 999px; --p: 0%; --c: var(--a-line-input);
  background: conic-gradient(var(--c) 0 var(--p), var(--a-line) var(--p) 100%);
  -webkit-mask: radial-gradient(circle, transparent 3.5px, #000 4px); mask: radial-gradient(circle, transparent 3.5px, #000 4px);
}
.a-ring[data-status="ok"] { --c: var(--a-ok); }
.a-ring[data-status="order"] { --c: var(--a-order-fill); }
.a-ring[data-status="out"] { background: transparent; box-shadow: inset 0 0 0 2px var(--a-warn); -webkit-mask: none; mask: none; }
.a-ring[data-fill="1"] { --p: 10%; } .a-ring[data-fill="2"] { --p: 20%; } .a-ring[data-fill="3"] { --p: 30%; } .a-ring[data-fill="4"] { --p: 40%; } .a-ring[data-fill="5"] { --p: 50%; }
.a-ring[data-fill="6"] { --p: 60%; } .a-ring[data-fill="7"] { --p: 70%; } .a-ring[data-fill="8"] { --p: 80%; } .a-ring[data-fill="9"] { --p: 90%; } .a-ring[data-fill="10"] { --p: 100%; }
.a-pack-size { width: 96px; min-height: 44px; }
.a-pack-help { font-size: 12px; color: var(--a-muted); }
.a-decrement, .a-undo {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 48px; min-width: 48px; height: 48px; padding: 0; border-radius: var(--a-r); cursor: pointer;
  transition: background-color var(--a-dur), border-color var(--a-dur);
}
.a-decrement {
  border: 1px solid var(--a-accent-line); background: var(--a-accent-soft); color: var(--a-accent);
  font-size: 32px; line-height: 1; font-weight: 500;
}
.a-decrement:hover:not(:disabled) { background: var(--a-accent-press); border-color: var(--a-accent); }
.a-decrement:active:not(:disabled) { transform: scale(.96); }
.a-decrement:disabled { background: var(--a-disabled-bg); border-color: transparent; color: var(--a-disabled-ink); cursor: not-allowed; }
.a-undo { border: 1px solid var(--a-accent); background: var(--a-surface); color: var(--a-accent); }
.a-undo svg { display: block; width: 24px; height: 24px; }
.a-undo:hover:not(:disabled) { background: var(--a-accent-soft); }
.a-undo:disabled { border-color: var(--a-line); color: var(--a-disabled-ink); cursor: default; }

/* 재고 상태 (spec §5.11) */
.a-stock { display: inline-grid; gap: 4px; width: 140px; font-size: 12.5px; color: var(--a-ink-2); font-variant-numeric: tabular-nums; vertical-align: middle; }
.a-stock-label {
  justify-self: start; display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: var(--a-r-pill); font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.a-stock[data-status="out"] .a-stock-label { background: var(--a-warn); color: #fff; }
.a-stock[data-status="order"] .a-stock-label { background: var(--a-order-soft); color: var(--a-order-ink); box-shadow: inset 0 0 0 1px var(--a-order-line); }
.a-stock[data-status="ok"] .a-stock-label { padding: 0; color: var(--a-ok); font-weight: 600; }
.a-stock[data-status="unknown"] .a-stock-label { color: var(--a-muted); box-shadow: inset 0 0 0 1px var(--a-line-input); }
.a-stock-bar { display: block; height: 6px; border-radius: 3px; background: var(--a-line-soft); overflow: hidden; }
.a-stock-bar > i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--a-muted); }
.a-stock[data-status="out"] .a-stock-bar { background: var(--a-warn-soft); box-shadow: inset 0 0 0 1px var(--a-warn); }
.a-stock[data-status="order"] .a-stock-bar > i { background: var(--a-order-fill); }
.a-stock[data-status="ok"] .a-stock-bar > i { background: var(--a-ok); }
.a-stock-bar[data-fill="0"] > i { width: 0; }
.a-stock-bar[data-fill="1"] > i { width: 10%; }
.a-stock-bar[data-fill="2"] > i { width: 20%; }
.a-stock-bar[data-fill="3"] > i { width: 30%; }
.a-stock-bar[data-fill="4"] > i { width: 40%; }
.a-stock-bar[data-fill="5"] > i { width: 50%; }
.a-stock-bar[data-fill="6"] > i { width: 60%; }
.a-stock-bar[data-fill="7"] > i { width: 70%; }
.a-stock-bar[data-fill="8"] > i { width: 80%; }
.a-stock-bar[data-fill="9"] > i { width: 90%; }
.a-stock-bar[data-fill="10"] > i { width: 100%; }
.a-stock-days { color: var(--a-ink-2); white-space: nowrap; }
.a-stock[data-status="unknown"] .a-stock-days { color: var(--a-muted); }

/* 평균 감소량 */
.a-avg { display: inline-block; font-size: 13px; color: var(--a-ink-2); font-variant-numeric: tabular-nums; line-height: 1.4; }
.a-avg b { font-size: 14px; font-weight: 700; color: var(--a-ink); }
.a-avg small { display: block; margin-top: 2px; font-size: 12px; color: var(--a-muted); }
.a-avg-none { font-size: 12.5px; color: var(--a-muted); }

/* 최근 변경 · 메모 (M3) */
.a-when { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.a-latest { display: inline-flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 12px; line-height: 1.4; color: var(--a-muted); overflow-wrap: anywhere; }
.a-latest b { font-size: 12.5px; font-weight: 700; color: var(--a-ink-2); }
.a-cell-settings {
  display: block; min-width: 0; padding: 4px; margin: -4px; border: 0; border-radius: var(--a-r-sm);
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.a-cell-settings:hover, .a-cell-settings:focus-visible { background: var(--a-accent-soft); color: var(--a-accent); }
.a-when .a-cell-settings { flex: 1 1 auto; margin: 0; }
.a-memo-trigger { flex: 0 0 auto; }

/* 빈 목록 · 불러오는 중 (spec §5.21) */
.a-empty { padding: 32px 16px; text-align: center; font-size: 14px; color: var(--a-muted); word-break: keep-all; overflow-wrap: anywhere; }
td.a-empty { height: auto; }
.a-empty-title { display: block; margin-bottom: 4px; font-size: 17px; font-weight: 700; color: var(--a-ink); }
.a-loading { font-size: 13.5px; color: var(--a-muted); }
/* 불러오는 중 막대(.a-skeleton, 가져오기 미리보기 · 되돌리기 대화상자): 고정 막대, 반짝임 없음 (§5.21).
   자리 · 폭은 admin.css. 흰 카드 위에서도 보이도록 line-soft 채움 + line 테두리 1px. 움직임이 없어 reduced-motion 에서도 같습니다. */
.a-skeleton span {
  display: block; height: 12px; border-radius: 3px;
  background: var(--a-line-soft); box-shadow: inset 0 0 0 1px var(--a-line);
}

/* 변경 기록 (설정 안) */
.a-log-check { margin: 8px 0; padding: 8px 12px; border: 1px solid var(--a-line); border-radius: var(--a-r-sm); background: var(--a-surface); font-size: 12.5px; overflow-wrap: anywhere; }
.a-log-check[data-pending="true"] { border-color: var(--a-order-line); background: var(--a-order-soft); }
.a-log-check-head { margin-bottom: 4px; font-weight: 700; color: var(--a-ink-2); }
.a-log-check p + p { margin-top: 2px; }
.a-log-check b { margin-right: 6px; color: var(--a-muted); font-weight: 600; }
.a-log-in { padding: 4px 12px 4px; border: 1px solid var(--a-line); border-left: 3px solid var(--a-accent); border-radius: var(--a-r); background: var(--a-sunken); }
.a-log-head { padding: 8px 0 2px; font-size: 12.5px; font-weight: 700; color: var(--a-ink-2); overflow-wrap: anywhere; }
.a-log-stats { padding: 4px 0 8px; font-size: 12px; color: var(--a-muted); }
.a-log-admin-note { font-size: 12px; color: var(--a-muted); }
.a-log-more { margin: 4px 0 8px; }
.a-log-none { padding: 8px 0 12px; font-size: 13px; color: var(--a-muted); }
.a-log-item { padding: 12px 0; border-bottom: 1px solid var(--a-line-soft); }
.a-log-item:last-child { border-bottom: 0; }
.a-log-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: 12.5px; }
.a-log-top time { color: var(--a-muted); font-variant-numeric: tabular-nums; }
.a-log-move { margin-top: 4px; font-size: 13.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.a-log-move i { font-style: normal; color: var(--a-muted); }
.a-log-arrow { padding: 0 6px; color: var(--a-accent); }
.a-log-memo { padding: 6px 0 2px; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.a-log-memo small { display: inline-block; margin-left: 8px; font-size: 12px; color: var(--a-muted); }
.a-log-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* 팝오버 (메모 · 약품 설정 · 품목 추가) */
.a-memo-popover {
  position: fixed; inset: auto; margin: 0;
  width: min(320px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto;
  padding: 16px; border: 1px solid var(--a-line); border-radius: var(--a-r-lg);
  background: var(--a-surface); color: var(--a-ink); box-shadow: var(--a-e2);
}
.a-settings-popover {
  width: min(440px, calc(100vw - 24px)); max-height: min(65dvh, 640px); padding: 20px;
  overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--a-line-input) transparent;
  /* 이어지는 내용 표시: 위·아래에 더 볼 내용이 있으면 가장자리 그림자가 보이고, 끝까지 내리면 사라집니다. */
  background:
    linear-gradient(var(--a-surface) 30%, transparent) center top / 100% 40px no-repeat local,
    linear-gradient(transparent, var(--a-surface) 70%) center bottom / 100% 40px no-repeat local,
    radial-gradient(farthest-side at 50% 0, var(--a-scroll-cue), transparent) center top / 100% 20px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, var(--a-scroll-cue), transparent) center bottom / 100% 20px no-repeat scroll,
    var(--a-surface);
}
.a-settings-popover > :last-child { margin-bottom: 4px; }
/* 아래에 이어지는 내용이 있으면 아래 가장자리를 흐리게 덮어 '더 있음'을 보여 줍니다. 끝까지 내리면 사라집니다.
   (scroll-driven animation 을 지원하지 않는 브라우저에서는 보이지 않고, 위의 가장자리 그림자만 남습니다.) */
.a-settings-popover::after {
  content: ""; position: sticky; bottom: -20px; z-index: 1; display: block; height: 40px; margin: -40px -20px 0;
  background: linear-gradient(to bottom, transparent, var(--a-surface) 80%); pointer-events: none;
  opacity: 0; animation: a-scroll-more linear both; animation-timeline: scroll(nearest);
}
@keyframes a-scroll-more { 0%, 92% { opacity: 1; } 100% { opacity: 0; } }
/* 기록 상자는 배경을 비워 두어 가장자리 그림자가 가려지지 않게 합니다(왼쪽 강조선과 테두리는 유지). */
.a-settings-popover .a-log-in { background: transparent; }
.a-settings-popover .a-memo-head strong { font-size: 17px; }
.a-settings-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--a-line-soft); }
.a-settings-section > summary { min-height: 36px; padding: 6px 0; font-size: 14px; font-weight: 700; color: var(--a-accent); cursor: pointer; }
.a-settings-section > .a-field { display: block; margin: 12px 0 4px; }
.a-settings-section > .a-input { width: 100%; }
.a-settings-section .a-log-in { margin-top: 12px; }
.a-settings-average-value { margin: 12px 0 8px; font-size: 15px; }
.a-memo-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.a-memo-head strong { font-size: 15px; line-height: 1.5; }
.a-memo-head button { min-width: 44px; min-height: 44px; padding: 0; font-size: 22px; }
.a-memo-form { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 12px; }
.a-memo-form textarea { width: 100%; resize: vertical; }
.a-memo-form > button { align-self: flex-end; }
.a-memo-form .a-input { min-width: 0; min-height: 44px; }
.a-memo-form .a-btn { min-height: 44px; flex-shrink: 0; }
.a-memo-author { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--a-muted); }
.a-memo-author b { color: var(--a-ink); }
.a-notice-settings { margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--a-line); }
.a-notice-settings summary { min-height: 44px; padding: 12px 0; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.a-notice-settings summary span { float: right; font-size: 12px; font-weight: 400; color: var(--a-muted); }
.a-notice-preview { margin-top: 12px; padding: 12px; border-left: 3px solid var(--a-accent); background: var(--a-accent-soft); font-size: 13.5px; }
.a-notice-preview p { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.a-quantity-entry { display: flex; align-items: center; gap: 12px; }
.a-quantity-entry #a-quantity-input {
  width: 100%; min-width: 0; min-height: 60px; font-size: 28px; font-weight: 700; text-align: center;
  font-variant-numeric: tabular-nums; appearance: textfield;
}
#a-quantity-input::-webkit-inner-spin-button, #a-quantity-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#a-quantity-unit { flex-shrink: 0; font-size: 14px; color: var(--a-muted); }
.a-quantity-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.a-quantity-steps button { min-width: 0; min-height: 52px; padding: 0 6px; font-size: 18px; font-weight: 800; }
#a-quantity-form > button[type="submit"] { align-self: stretch; min-height: 48px; }

/* 차감 시 관리자 안내 (spec §5.22) */
.a-decrease-notice {
  position: fixed; inset: calc(var(--a-toolbar-h) + 12px) 12px auto auto; margin: 0;
  width: min(360px, calc(100vw - 24px)); max-height: calc(100dvh - var(--a-toolbar-h) - 24px); overflow-y: auto;
  padding: 8px 16px 16px; border: 1px solid var(--a-line); border-left: 4px solid var(--a-accent); border-radius: var(--a-r-lg);
  background: var(--a-surface); color: var(--a-ink); box-shadow: var(--a-e2); pointer-events: none;
}
.a-decrease-notice button { pointer-events: auto; }
.a-notice-item { margin-bottom: 4px; font-size: 13px; color: var(--a-muted); overflow-wrap: anywhere; }
.a-notice-message { font-size: 16px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── 12. 알림 토스트 (#notice, spec §5.13) ───────────────────── */
.notice {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 50;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  width: max-content; max-width: min(560px, calc(100vw - 24px)); min-height: 44px; padding: 12px 16px;
  border-radius: var(--a-r); background: var(--a-ok); color: #fff; box-shadow: var(--a-e2);
  font-size: 13.5px; line-height: 1.5; word-break: keep-all; overflow-wrap: anywhere;
  animation: a-toast-in 180ms ease-out;
}
.notice::before {
  content: ""; flex: 0 0 16px; height: 16px; background-color: currentColor;
  -webkit-mask: var(--a-i-check) center / contain no-repeat; mask: var(--a-i-check) center / contain no-repeat;
}
.notice :focus-visible { outline-color: var(--a-focus-on-dark); }
.notice.success { background: var(--a-ok); }
.notice.info { background: var(--a-slate); }
.notice.info::before { -webkit-mask-image: var(--a-i-alert); mask-image: var(--a-i-alert); }
.notice.busy { background: var(--a-accent); }
.notice.busy::before {
  background: transparent; -webkit-mask: none; mask: none; flex-basis: 14px; width: 14px; height: 14px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: a-spin .8s linear infinite;
}
.notice.error { background: var(--a-warn); }
.notice.error::before { -webkit-mask-image: var(--a-i-alert); mask-image: var(--a-i-alert); }
.notice.offline { background: var(--a-slate); }
.notice.offline::before { -webkit-mask-image: var(--a-i-wifi); mask-image: var(--a-i-wifi); }
.notice-msg, .notice-ref { margin: 0; min-width: 0; }
.notice-msg { flex: 1 1 auto; }
.notice-ref { font-size: 12.5px; white-space: nowrap; }
.notice-ref code {
  padding: 1px 6px; border-radius: var(--a-r-sm); background: #ffffff1f; color: var(--a-warn-on-dark);
  font-family: var(--a-mono); font-size: 12.5px; user-select: all; -webkit-user-select: all;
}
.notice-close {
  flex: 0 0 auto; min-width: 44px; min-height: 44px; margin: -10px -10px -10px auto; padding: 0;
  border: 0; border-radius: var(--a-r); background: transparent; color: inherit; font-size: 20px; line-height: 1; cursor: pointer;
}
.notice-close:hover { background: #ffffff1f; }
.notice-report { flex: 0 0 auto; min-height: 32px; margin-left: 8px; padding: 0 10px; border: 1px solid #ffffff66; border-radius: var(--a-r-sm); background: transparent; color: inherit; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.notice-report:hover { background: #ffffff1f; }

/* ── 13. 안내 띠 (.a-banner, spec §5.14) ─────────────────────── */
.a-banner {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; grid-template-areas: "icon text actions";
  align-items: center; gap: 10px;
  padding: 10px 12px 10px 14px; border: 1px solid var(--a-line); border-left: 4px solid var(--a-slate); border-radius: var(--a-r);
  background: var(--a-surface); color: var(--a-ink);
  font-size: 14px; line-height: 1.5;
}
.a-banner-icon {
  grid-area: icon; align-self: start; width: 20px; height: 20px; margin-top: 1px; background-color: currentColor;
  -webkit-mask: var(--a-icon, var(--a-i-alert)) center / contain no-repeat; mask: var(--a-icon, var(--a-i-alert)) center / contain no-repeat;
}
.a-banner[data-icon="check"] { --a-icon: var(--a-i-check); }
.a-banner[data-icon="alert"] { --a-icon: var(--a-i-alert); }
.a-banner[data-icon="triangle"] { --a-icon: var(--a-i-triangle); }
.a-banner[data-icon="clock"] { --a-icon: var(--a-i-clock); }
.a-banner[data-icon="tray"] { --a-icon: var(--a-i-tray); }
.a-banner[data-icon="doc"] { --a-icon: var(--a-i-doc); }
.a-banner[data-icon="mic"] { --a-icon: var(--a-i-mic); }
.a-banner[data-icon="wifi"] { --a-icon: var(--a-i-wifi); }
.a-banner-text { grid-area: text; min-width: 0; word-break: keep-all; overflow-wrap: anywhere; }
.a-banner-text > b { font-weight: 600; color: var(--a-ink); }
.a-banner-text > span { display: block; font-size: 13.5px; font-weight: 400; color: var(--a-ink-2); }
.a-banner-text > .a-banner-ref { display: inline-block; margin-top: 4px; }
.a-banner-actions { grid-area: actions; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.a-banner-ref { font-size: 12.5px; color: var(--a-ink-2); }
.a-banner-ref code {
  padding: 1px 6px; border: 1px solid var(--a-warn-line); border-radius: var(--a-r-sm); background: var(--a-surface);
  color: var(--a-warn); font-family: var(--a-mono); font-size: 12.5px; font-variant-numeric: tabular-nums;
  user-select: all; -webkit-user-select: all;
}
.a-banner[data-kind="recovery"] { background: var(--a-recover-soft); border: 1px dashed var(--a-recover-line); border-left: 4px solid var(--a-accent); }
.a-banner[data-kind="recovery"] .a-banner-icon { color: var(--a-accent); }
.a-banner[data-kind="conflict"] { background: var(--a-order-soft); border-color: var(--a-order-line); border-left-color: var(--a-order); }
.a-banner[data-kind="conflict"] .a-banner-icon { color: var(--a-order); }
.a-banner[data-kind="error"] { background: var(--a-warn-soft); border-color: var(--a-warn-line); border-left-color: var(--a-warn); }
.a-banner[data-kind="error"] .a-banner-icon { color: var(--a-warn); }
.a-banner[data-kind="offline"] { background: var(--a-sunken); border-color: var(--a-line); border-left: 4px dashed var(--a-slate); }
.a-banner[data-kind="offline"] .a-banner-icon { color: var(--a-slate); }
.a-banner[data-kind="success"] { background: var(--a-ok-soft); border-color: var(--a-ok-line); border-left-color: var(--a-ok); }
.a-banner[data-kind="success"] .a-banner-icon { color: var(--a-ok); }
.a-banner-stack { display: grid; gap: 8px; }
/* 배너 묶음은 2개까지만 보입니다 (§5.14). 3번째부터는 data-overflow 가 붙고, 묶음에 data-expanded 가 생기면 다시 보입니다. */
.a-banner-stack:not([data-expanded]) > .a-banner[data-overflow] { display: none; }
/* '알림 N개 더 보기': 조용한 글자 버튼(테두리 · 바탕 없음, accent 글자). 묶음 격자 안에서 왼쪽에 붙습니다. */
.a-banner-more {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 8px;
  border: 1px solid transparent; border-radius: var(--a-r); background: transparent;
  color: var(--a-accent); font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1.4;
  font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer;
  transition: background-color var(--a-dur);
}
.a-banner-more.a-btn, .a-banner-more.a-btn:hover:not(:disabled) { border-color: transparent; }
.a-banner-more:hover:not(:disabled) { background: var(--a-accent-soft); color: var(--a-accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.a-banner-more[hidden] { display: none; }

/* ── 14. 대화상자 (spec §5.15) ───────────────────────────────── */
.a-dialog {
  width: min(460px, calc(100vw - 32px)); max-width: none; padding: 0;
  border: 1px solid var(--a-line); border-radius: var(--a-r-lg); background: var(--a-surface); color: var(--a-ink);
  box-shadow: var(--a-e3);
}
.a-dialog::backdrop { background: var(--a-backdrop); }
.a-dialog-in { padding: 24px; }
.a-dialog-in > h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 17px; line-height: 1.4; font-weight: 700; }
.a-dialog-in > p { margin-bottom: 12px; font-size: 14px; line-height: 1.6; color: var(--a-ink-2); word-break: keep-all; overflow-wrap: anywhere; }
.a-dialog-in > p.a-dialog-sub { font-size: 12.5px; color: var(--a-muted); }
.a-dialog-meta { font-size: 13px; color: var(--a-muted); font-variant-numeric: tabular-nums; }
.a-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.a-dialog-actions .a-btn { min-height: 44px; }
.a-dialog-status:empty, #feedback-error:empty { display: none; }
.a-dialog-status, .a-dialog-error { margin-top: 12px; }
/* 대화상자의 조용한 출구 (#reauth-exit): 주 버튼 아래 가는 선으로 나누고, 설명은 보조 문장 크기 · 링크는 강조색 (spec §4 · §5.15) */
.a-dialog-exit { display: grid; gap: 4px; justify-items: start; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--a-line-soft); }
.a-dialog-exit .a-dialog-sub { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--a-muted); word-break: keep-all; overflow-wrap: anywhere; }
.a-link-quiet {
  display: inline-flex; align-items: center; min-height: 32px;
  color: var(--a-accent); font-size: 13.5px; font-weight: 600; text-decoration: none; border-radius: var(--a-r-sm);
}
.a-link-quiet:hover { color: var(--a-accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.a-link-quiet:focus-visible { outline: 3px solid var(--a-accent); outline-offset: 2px; }
#reauth-title::before {
  content: ""; flex: 0 0 20px; height: 20px; background-color: var(--a-accent);
  -webkit-mask: var(--a-i-clock) center / contain no-repeat; mask: var(--a-i-clock) center / contain no-repeat;
}
#reauth-start { width: 100%; min-height: 48px; }
#reauth .a-dialog-actions { justify-content: stretch; }
.a-dialog-feedback { width: min(520px, calc(100vw - 32px)); }
.a-dialog-feedback .a-banner { margin-bottom: 12px; }
.a-dialog-feedback .a-banner-text > b { font-size: 14px; }
.a-dialog-feedback label.a-field { margin-bottom: 4px; font-size: 12.5px; font-weight: 600; color: var(--a-ink-2); }
.a-dialog-feedback textarea { display: block; width: 100%; font-size: 16px; resize: vertical; }
.a-feedback-count { margin-top: 4px; text-align: right; font-family: var(--a-mono); font-size: 12.5px; color: var(--a-muted); font-variant-numeric: tabular-nums; }
.a-feedback-count[data-near="true"] { color: var(--a-order-ink); font-weight: 600; }
.a-feedback-meta { margin-top: 4px; font-size: 12.5px; color: var(--a-muted); overflow-wrap: anywhere; }
/* 문의·오류 보내기: 종류 칩, Enter 안내, 함께 가는 사용 기록, 보낸 말풍선 */
.a-feedback-kind { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.a-feedback-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--a-line-input); border-radius: var(--a-r-pill); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.a-feedback-chip:has(input:checked) { border-color: var(--a-accent); background: var(--a-accent-soft); color: var(--a-accent); }
.a-feedback-chip input { margin: 0; accent-color: var(--a-accent); }
.a-feedback-hint { margin-top: 2px; font-size: 12px; color: var(--a-muted); }
.a-feedback-trail { margin-top: 8px; font-size: 12.5px; color: var(--a-ink-2); }
.a-feedback-trail summary { cursor: pointer; color: var(--a-muted); }
.a-feedback-trail ol { max-height: 160px; overflow: auto; margin: 6px 0 0; padding: 6px 8px 6px 28px; border: 1px solid var(--a-line-soft); border-radius: var(--a-r-sm); font-family: var(--a-mono); font-size: 11.5px; line-height: 1.5; overflow-wrap: anywhere; }
.a-feedback-trail time { color: var(--a-muted); }
.a-feedback-bubble { align-self: flex-end; max-width: 85%; margin: 10px 0 8px auto; padding: 10px 14px; border-radius: 14px 14px 4px 14px; background: var(--a-accent); color: #fff; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
/* 불편한 점 알려주기: 오른쪽 아래 떠 있는 버튼(태블릿·데스크톱)과 채팅 모양 대화창 */
.a-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 30; display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 18px 0 16px; border: 0; border-radius: var(--a-r-pill);
  background: var(--a-accent); color: #fff; box-shadow: var(--a-e2); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.a-fab:hover { background: var(--a-accent-hover); }
.a-shell .a-stage { padding-bottom: 88px; }
.a-chat-dialog { width: min(420px, calc(100vw - 32px)); margin: auto 24px 24px auto; }
.a-chat { display: flex; flex-direction: column; max-height: min(640px, calc(100vh - 48px)); }
.a-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 10px 20px; border-bottom: 1px solid var(--a-line-soft); }
.a-chat-head h2 { font-size: 16px; font-weight: 700; }
.a-chat-close { min-width: 40px; min-height: 40px; font-size: 20px; }
.a-chat-log { flex: 1 1 auto; min-height: 120px; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--a-page); }
.a-chat-row { display: flex; flex-direction: column; max-width: 85%; }
.a-chat-them { align-self: flex-start; }
.a-chat-me { align-self: flex-end; align-items: flex-end; }
.a-chat-msg { margin: 0; padding: 9px 13px; border-radius: 14px 14px 14px 4px; background: var(--a-surface); border: 1px solid var(--a-line-soft); font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; word-break: keep-all; }
.a-chat-me .a-chat-msg { border-radius: 14px 14px 4px 14px; border-color: var(--a-accent); background: var(--a-accent); color: #fff; }
.a-chat-stamp { margin-top: 3px; font-size: 11.5px; color: var(--a-muted); }
.a-chat-warn { margin: 0; padding: 8px 16px 0; font-size: 12.5px; color: var(--a-order-ink); }
.a-chat #feedback-error { padding: 0 16px; }
.a-chat-input { display: flex; align-items: flex-end; gap: 8px; padding: 8px 16px 0; }
.a-chat-input textarea { flex: 1 1 auto; min-height: 44px; max-height: 140px; resize: none; font-size: 16px; }
.a-chat-input .a-btn { flex: 0 0 auto; min-height: 44px; }
.a-chat-foot { display: flex; justify-content: space-between; gap: 8px; margin: 4px 16px 0; }
.a-chat-foot .a-feedback-count { margin: 0; }
.a-chat > .a-feedback-meta { margin: 2px 16px 0; }
.a-chat > .a-feedback-trail { margin: 6px 16px 14px; }
.notice-auto { margin: 0; font-size: 12.5px; opacity: .9; }
@media (max-width: 700px) {
  /* 휴대폰에서도 떠 있는 둥근 버튼: 보던 자리에서 바로 보냅니다. 위쪽 메뉴의 같은 버튼은 숨깁니다. */
  /* 왼쪽 아래: 오른쪽 −(주 동작)을 가리지 않습니다. 이름 쪽은 눌러도 펼치기만 해서 덜 위험합니다. */
  .a-fab { right: auto; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 52px; min-height: 52px; height: 52px; padding: 0; justify-content: center; }
  .a-fab span { display: none; }
  .a-rail-foot [data-act="feedback"] { display: none; }
  .a-shell .a-stage { padding-bottom: 84px; }
  .a-chat-dialog { width: 100vw; max-width: 100vw; margin: auto 0 0 0; border-radius: var(--a-r-lg) var(--a-r-lg) 0 0; }
  .a-chat { max-height: calc(100dvh - 24px); }
}
.a-feedback-sent > p { display: flex; align-items: center; gap: 8px; color: var(--a-ok); font-weight: 600; }
.a-feedback-sent > p::before {
  content: ""; flex: 0 0 20px; height: 20px; background-color: currentColor;
  -webkit-mask: var(--a-i-check) center / contain no-repeat; mask: var(--a-i-check) center / contain no-repeat;
}

/* 영향 타일 · 목록 (되돌리기 · 불러오기, 배치는 admin.css) */
.a-effect-tile { border: 1px solid var(--a-line); border-radius: var(--a-r); background: var(--a-surface); }
.a-effect-tile b { font-size: 24px; font-weight: 700; color: var(--a-ink); font-variant-numeric: tabular-nums; }
.a-effect-tile span { font-size: 12.5px; font-weight: 600; color: var(--a-ink-2); }
.a-effect-tile[data-alert="true"] { background: var(--a-warn-soft); border-color: var(--a-warn-line); }
.a-effect-tile[data-alert="true"] b { color: var(--a-warn); }
.a-effect-list h3 { font-size: 13.5px; font-weight: 700; }
.a-effect-list li { min-height: 36px; border-bottom: 1px solid var(--a-line-soft); font-size: 13.5px; }
.a-effect-list li:last-child { border-bottom: 0; }
.a-effect-fields { display: block; font-size: 12.5px; line-height: 1.5; color: var(--a-muted); }
.a-effect-more, .a-effect-none { font-size: 12.5px; color: var(--a-muted); }
.a-arrow { color: var(--a-accent); }

/* ── 15. 직원 관리 (spec §6.6, §5.17) ───────────────────────── */
.a-staff-add { align-items: end; margin-bottom: 20px; }
.a-staff-add .a-input { min-width: 220px; }
.a-staff-table td, .a-staff-table th { font-size: 13.5px; white-space: nowrap; }
.a-staff-table td { height: 40px; padding: 6px 12px; }
.a-staff-table .a-select { min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
.a-staff-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.a-staff-status::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; }
.a-staff-status[data-status="active"] { color: var(--a-ok); }
.a-staff-status[data-status="active"]::before { background: currentColor; }
.a-staff-status[data-status="pending"] { color: var(--a-order-ink); }
.a-staff-status[data-status="pending"]::before { box-shadow: inset 0 0 0 2px currentColor; }
.a-staff-status[data-status="disabled"] { color: var(--a-muted); font-weight: 400; }
.a-staff-status[data-status="disabled"]::before { height: 2px; border-radius: 1px; background: currentColor; }
.a-staff-table tr[data-member]:hover > td { background: var(--a-row-hover); }
.a-inv-workspace > .a-hint { margin-top: 12px; font-size: 13px; }

/* ── 16. 재고 백업 (spec §6.7, §5.16) ───────────────────────── */
.a-backup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.a-backup-card { padding: 16px 18px; border: 1px solid var(--a-line); border-radius: var(--a-r-lg); background: var(--a-surface); min-width: 0; }
.a-backup-card h2 { margin-bottom: 4px; font-size: 15px; font-weight: 700; }
.a-backup-card .a-hint { margin: 0 0 12px; font-size: 13px; }
.a-backup-card .a-btn { min-height: 44px; }
.a-backup-card .a-block-head { flex-wrap: wrap; margin-bottom: 12px; }
.a-backup-card .a-search .a-input { width: 320px; max-width: 100%; }
.a-backup-export p:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
.a-preview { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--a-line-soft); font-size: 13.5px; }
.a-preview-sum { color: var(--a-ink-2); font-variant-numeric: tabular-nums; }
.a-preview-sum b { font-weight: 700; color: var(--a-ink); }
.a-preview-sum .a-file-name { display: inline-block; max-width: 100%; }
.a-preview-err { font-weight: 700; color: var(--a-warn); }
.a-preview-h { font-size: 13.5px; font-weight: 700; color: var(--a-ink-2); }
summary.a-preview-h { min-height: 40px; display: flex; align-items: center; }
.a-preview-list { margin-top: 4px; max-height: 240px; overflow: auto; padding: 4px 12px; border: 1px solid var(--a-line-soft); border-radius: var(--a-r-sm); background: var(--a-surface); }
.a-preview-list li { padding: 4px 0; border-bottom: 1px solid var(--a-line-soft); overflow-wrap: anywhere; }
.a-preview-list li:last-child { border-bottom: 0; }
.a-preview-errors { color: var(--a-warn); }
/* 파일에 없어 숨겨질 품목: warn 줄 블록 (§5.16) — 왼쪽 4px warn 막대 + warn-soft 바탕, 제목은 warn 글자.
   눈에 띄지만 차분하게: 채운 빨강 없음, 목록은 흰 바탕 그대로. 자리 · 안쪽 여백은 admin.css. */
.a-preview-hide {
  border: 1px solid var(--a-warn-line); border-left: 4px solid var(--a-warn); border-radius: var(--a-r);
  background: var(--a-warn-soft); color: var(--a-ink);
}
.a-preview-hide > .a-preview-h { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--a-warn); font-variant-numeric: tabular-nums; }
.a-preview-hide > .a-preview-h::before {
  content: ""; flex: 0 0 16px; height: 16px; background-color: currentColor;
  -webkit-mask: var(--a-i-alert) center / contain no-repeat; mask: var(--a-i-alert) center / contain no-repeat;
}
/* admin.css 의 '.a-preview-hide ul { padding: 0 }' 보다 강하게: 목록 글자가 테두리에 붙지 않도록 안쪽 여백 유지 */
.a-preview-hide ul.a-preview-list { margin-top: 8px; padding: 4px 12px; border-color: var(--a-warn-line); }
.a-preview-hide .a-num { color: var(--a-ink-2); }
.a-preview-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.a-preview-actions .a-btn { min-height: 44px; }
.a-preview-loading { color: var(--a-muted); }
.a-snapshot-table td.a-cell-title { font-family: var(--a-mono); font-size: 12.5px; }

/* ── 17. 시작 페이지 (spec §5.23) — 승인된 카드 유지 ─────────── */
.landing { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f6f8f7; }
.landing-skip { position: absolute; top: -80px; left: 16px; padding: 8px 12px; background: #fff; }
.landing-skip:focus { top: 12px; }
.landing-card { width: min(100%, 430px); padding: clamp(26px, 6vw, 44px); border: 1px solid #d9e3e1; border-radius: 12px; background: #fff; box-shadow: 0 22px 65px #1a403014; }
.landing-logo { display: block; max-width: 100%; height: auto; margin-bottom: 42px; }
.landing-eyebrow { color: #326b5a; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.landing-card h1 { margin-top: 12px; color: #17384b; font-size: clamp(25px, 6vw, 31px); line-height: 1.35; letter-spacing: -.05em; word-break: keep-all; }
.landing-invite-note { margin-top: 12px; color: #526a74; font-size: 14px; }
.landing-primary {
  display: flex; align-items: center; gap: 12px; min-height: 52px; margin-top: 30px; padding: 0 18px;
  border-radius: 6px; background: #183b50; color: #fff; text-decoration: none; font-size: 14px; font-weight: 700;
}
.landing-primary::before {
  content: ""; flex: 0 0 20px; height: 20px; background-color: #fff;
  -webkit-mask: var(--a-i-login) center / contain no-repeat; mask: var(--a-i-login) center / contain no-repeat;
}
.landing-primary:hover { background: #255b70; }
.landing-guide-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 22px; color: #315d5c; font-size: 13px; font-weight: 700; text-underline-offset: 4px; }
.landing-message {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 10px 12px 10px 14px;
  border: 1px solid var(--a-warn-line); border-left: 4px solid var(--a-warn); border-radius: 6px;
  background: var(--a-warn-soft); color: var(--a-warn); font-size: 13.5px; font-weight: 600; line-height: 1.5; word-break: keep-all; overflow-wrap: anywhere;
}
.landing-message::before {
  content: ""; flex: 0 0 18px; height: 18px; margin-top: 1px; background-color: currentColor;
  -webkit-mask: var(--a-i-alert) center / contain no-repeat; mask: var(--a-i-alert) center / contain no-repeat;
}
.landing-account { margin-top: 16px; padding: 10px 12px; border: 1px solid #d9e3e1; border-radius: 6px; background: #f3f6f5; overflow-wrap: anywhere; }
.landing-account-caption { font-size: 12px; font-weight: 600; line-height: 1.5; color: #526a74; }
.landing-account-caption b { display: block; margin-top: 2px; font-size: 15px; font-weight: 600; color: #17384b; overflow-wrap: anywhere; }
.landing-secondary {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin-top: 10px; padding: 0 12px;
  border: 1px solid #8fa7a3; border-radius: 6px; background: #fff; color: #183b50; font-size: 14px; font-weight: 700; text-decoration: none; text-align: center;
}
.landing-secondary:hover { background: #f3f6f5; }

/* ══ 폭 · 입력 장치 대응 ═══════════════════════════════════════ */

@media (hover: hover) and (min-width: 701px) {
  .a-table tr[data-row]:not([data-changed="true"]):hover > td { background: var(--a-row-hover); }
}

/* 진료 기록 데스크톱: 녹음 막대 · 아래 줄 고정 (spec §5.18, §5.19) */
@media (min-width: 861px) {
  #talk-pane .a-rec { position: sticky; top: 0; z-index: 3; margin: -16px -16px 0; padding: 8px 16px; box-shadow: var(--a-e1); }
  .a-pane-foot {
    position: sticky; bottom: 0; z-index: 3;
    min-height: 72px; margin-top: 16px; padding: 12px 16px;
    border-top: 0; box-shadow: var(--a-e1-up);
  }
}
@media (min-width: 861px) and (max-height: 960px) {
  .a-summary { min-height: 200px; }
  .a-explain { min-height: 120px; }
  .a-transcript { min-height: 220px; }
  #korean_translation { min-height: 120px; }
}

@media (max-width: 1180px) {
  .a-split { grid-template-columns: var(--a-side-w) minmax(0, 1fr); }
  .a-pane-note { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--a-line); }
  .a-table .a-col-name { min-width: 180px; }
  .a-table .a-col-qty { width: auto; }
  .a-table .a-col-stock { width: 140px; }
  .a-table .a-col-avg { width: 120px; }
  .a-table .a-col-when { width: 160px; }
  .a-table td { padding-left: 8px; padding-right: 8px; }
}

/* 태블릿 · 휴대폰: 메뉴가 위로 (spec §5.2, CSS 만) */
@media (max-width: 860px) {
  .a-shell { grid-template-columns: 1fr; }
  .a-rail { position: static; height: auto; overflow: visible; min-width: 0; }
  .a-rail-inner { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0 8px; min-width: 0; min-height: 0; padding: 4px 12px; }
  /* 1줄(로고 · 병원 · 사용자) 뒤에서 강제로 줄을 바꿉니다. */
  .a-rail-inner::after { content: ""; order: 4; flex: 0 0 100%; height: 0; }
  .a-rail-foot { display: contents; }
  .a-rail-mark { order: 1; padding: 0; }
  .a-rail-mark img { width: auto; height: 20px; }
  .a-rail-clinic {
    order: 2; flex: 1 1 0; min-width: 0; min-height: 44px; margin: 0; padding: 0;
    display: flex; align-items: center;
    font-size: 13px; font-weight: 600; color: var(--a-rail-strong);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal;
  }
  .a-rail-user { order: 3; min-width: 0; max-width: 40%; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
  .a-rail-role { display: inline; margin: 0 0 0 4px; }
  .a-rail-nav { order: 5; flex-direction: row; flex-wrap: wrap; gap: 0 4px; min-width: 0; }
  .a-rail-nav button {
    width: auto; min-height: 44px; padding: 0 12px;
    border-left: 0; border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0;
  }
  .a-rail-nav button[aria-current="page"] { border-left-color: transparent; border-bottom-color: var(--a-rail-marker); }
  /* 휴대폰 탭: '준비 중'은 글자 아래 작게 둬서 탭 줄 폭을 늘리지 않습니다. */
  .a-rail-nav button.a-rail-soon { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
  .a-rail-soon span { margin: 2px 0 0; padding: 0; border: 0; font-size: 10px; font-weight: 600; }
  .a-rail-foot .a-btn, .a-rail-foot .a-rail-user + .a-btn { order: 6; width: auto; min-height: 36px; margin: 0; padding: 0 10px; }
  .a-rail-version { order: 7; margin: 0 0 0 auto; }

  .a-split, .a-split.a-split-2 { grid-template-columns: 1fr; }
  .a-pane + .a-pane { border-left: 0; border-top: 1px solid var(--a-line); }
  .a-pane-note { border-left: 0; }
}
/* 태블릿 세로(701–860): 표는 유지하고 칸을 좁힙니다. */
@media (min-width: 701px) and (max-width: 860px) {
  .a-inv-workspace { padding-left: 16px; padding-right: 16px; }
  .a-inv-toolbar { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .a-table td { padding-left: 6px; padding-right: 6px; }
  .a-table th { padding-left: 6px; padding-right: 6px; }
  .a-table .a-col-name { min-width: 120px; }
  .a-table .a-col-stock, .a-table .a-col-avg, .a-table .a-col-when { width: auto; }
  .a-qty { min-width: 64px; }
  .a-qty-control .a-pack-summary, .a-pack-slot { flex-basis: 88px; width: 88px; max-width: 88px; font-size: 12px; }
  .a-qty-control .a-qty { flex-basis: 88px; width: 88px; min-width: 88px; max-width: 88px; }
  .a-stock { width: 96px; }
  .a-when { flex-direction: column; align-items: flex-start; gap: 2px; }
}
@media (max-width: 860px) and (pointer: coarse) {
  .a-rail-foot .a-btn, .a-rail-foot .a-rail-user + .a-btn { min-height: 44px; }
}

/* ── 휴대폰 (≤ 700) ──────────────────────────────────────────── */
@media (max-width: 700px) {
  :root { --a-toolbar-h: 140px; }
  :root:has(.a-inv-toolbar > .a-kind-switch:not([hidden])) { --a-toolbar-h: 182px; }
  .a-input, .a-textarea { min-height: 48px; font-size: 16px; }
  .a-textarea { min-height: 0; }
  .a-login { padding: 24px 16px 40px; min-height: 0; }
  .a-login-card { padding: 24px 20px 20px; }

  .a-stage-head { min-height: 0; padding: 12px 16px; }
  .a-stage-head h1 { font-size: 18px; }
  .a-stage-right { text-align: left; }
  .a-stage > .a-banner, .a-stage > .a-banner-stack { margin: 12px 16px 0; }
  .a-pane-head { padding: 8px 16px; }
  .a-pane-body, .a-pane-foot { padding-left: 16px; padding-right: 16px; }
  .a-summary { min-height: 176px; }
  .a-explain { min-height: 132px; }
  .a-transcript { min-height: 200px; }
  .a-pane-foot { padding-bottom: 12px; }
  .a-pane-foot .a-check { flex: 1 1 100%; }
  .a-pane-foot #save-encounter { margin-left: 0; }
  .a-pane-foot .a-btn { flex: 1 1 0; min-width: 0; padding: 0 8px; }

  /* 재고: 머리는 화면 밖(스크린 리더는 h1 을 읽음), 도구 줄이 바로 붙습니다. */
  .a-inventory .a-stage-head {
    position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .a-inv-workspace { padding: 16px 16px 24px; }
  .a-inventory .a-inv-workspace { padding: 0 12px 24px; }
  .a-inv-toolbar {
    margin: 0 -12px; padding: 8px 12px 6px;
    display: flex; flex-direction: column; gap: 0;
  }
  .a-inv-toolbar > #a-location-controls { flex: 0 0 44px; }
  .a-inv-toolbar > .a-inv-findrow { flex: 0 0 48px; height: 48px; margin-top: 8px; }
  .a-inv-toolbar > .a-list-meta { flex: 0 0 20px; margin-top: 6px; }
  .a-inv-toolbar > .a-kind-switch { flex: 0 0 36px; margin: 6px -12px 0; padding: 0 12px; }
  .a-inv-findrow .a-inv-search { flex: 1 1 auto; width: auto; }
  .a-inv-findrow #a-inv-search { height: 48px; min-height: 48px; }
  .a-inv-findrow [data-act="item-add"] { min-height: 48px; height: 48px; padding: 0 14px; font-size: 14px; }
  .a-add-long { display: none; }
  .a-add-short { display: inline; }
  .a-location-controls { margin: 0 -12px; padding: 0 12px; scroll-padding: 0 12px; }
  .a-inv-options { grid-template-columns: minmax(0, 1fr); }
  #a-name-size-value { font-size: 12px; }

  /* 재고 카드 (spec §5.9) */
  .a-table-wrap { overflow: visible; max-height: none; }
  .a-table, .a-table tbody, .a-table tr, .a-table td { display: block; width: 100%; }
  .a-table thead { display: none; }
  .a-table td { height: auto; }
  /* 휴대폰 목록: 한 줄에 이름(크게) · 수량 · −. 상태·평균·최근 변경은 이름을 눌러 여는 설정 창에서 봅니다.
     손이 필요할 때(주문 필요·소진)만 왼쪽 색 띠와 이름 아래 한 줄로 알립니다. */
  .a-table tr[data-row] {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name qty";
    align-items: center; column-gap: 8px; min-height: 64px; padding: 8px 0; margin: 0;
    border: 0; border-bottom: 1px solid var(--a-line-soft); border-radius: 0; background: transparent;
  }
  /* 모든 줄 같은 정렬: 재고 링 · 이름 · 수량 · −. 이름을 누르면 그 자리에서 펼쳐 자세히(상태 · 평균 · 최근 변경 · 자주/메모/설정). */
  .a-table tr[data-row] > .a-col-stock, .a-table tr[data-row] > .a-col-avg, .a-table tr[data-row] > .a-col-when, .a-table tr[data-row] > .a-col-rowact { display: none; }
  .a-table tr[data-row][data-open="true"] { grid-template-areas: "name qty" "stock stock" "avg when" "act act"; row-gap: 6px; background: var(--a-page); }
  .a-table tr[data-row][data-open="true"] > .a-col-stock, .a-table tr[data-row][data-open="true"] > .a-col-avg,
  .a-table tr[data-row][data-open="true"] > .a-col-when, .a-table tr[data-row][data-open="true"] > .a-col-rowact { display: block; padding-left: 26px; }
  .a-table tr[data-row][data-open="true"] > .a-col-rowact { grid-area: act; }
  .a-table tr[data-row][data-open="true"] > .a-col-avg::before, .a-table tr[data-row][data-open="true"] > .a-col-when::before {
    content: attr(data-label); display: block; font-size: 12px; font-weight: 700; line-height: 1.4; color: var(--a-muted);
  }
  .a-row-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 6px; }
  .a-row-actions [aria-pressed="true"] { color: var(--a-order); border-color: var(--a-order-line); }
  .a-table tr[data-row] .a-name { display: none; }
  .a-row-expand { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: 48px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
  .a-row-name { display: flex; flex-direction: column; min-width: 0; }
  .a-row-title { font-size: calc(var(--a-name-size, 18px) + 1px); font-weight: 700; line-height: 1.3; color: var(--a-ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  .a-row-star { color: var(--a-order); }
  .a-name-sub { display: block; margin: 2px 0 0; font-size: 12.5px; line-height: 1.4; font-weight: 500; color: var(--a-muted); }
  .a-name-sub[data-status="order"] { color: var(--a-order-ink); font-weight: 700; }
  .a-name-sub[data-status="out"] { color: var(--a-warn); font-weight: 700; }
  .a-table tr[data-row] > td { width: auto; min-width: 0; padding: 0; border: 0; background: transparent; white-space: normal; }
  .a-table tr[data-changed="true"] { background: var(--a-order-soft); box-shadow: inset 3px 0 0 var(--a-order); border-color: var(--a-order-line); }
  .a-table tr[data-changed="true"] > td, .a-table tr[data-changed="true"] > td:first-child { background: transparent; box-shadow: none; }
  .a-table tr[data-row]:focus-within { box-shadow: inset 3px 0 0 var(--a-accent); }
  .a-table tr[data-row]:focus-within > td:first-child { box-shadow: none; }
  .a-table tr[data-row] > .a-col-name { grid-area: name; }
  .a-table tr[data-row] > .a-col-qty { grid-area: qty; padding: 0; margin: 0; text-align: right; }
  .a-table tr[data-row] > .a-col-stock { grid-area: stock; padding-top: 8px; }

  .a-table tr[data-row] > .a-col-avg { grid-area: avg; }
  .a-table tr[data-row] > .a-col-when { grid-area: when; }
  .a-table tr[data-row] > td::before { content: none; }
  .a-table tr[data-row] > td.a-col-avg::before, .a-table tr[data-row] > td.a-col-when::before {
    content: attr(data-label); font-size: 12px; font-weight: 700; line-height: 1.4; color: var(--a-muted);
  }
  .a-name { min-height: 44px; }
  .a-kind-button { width: 44px; height: 44px; }
  .a-favorite { width: 44px; height: 44px; }
  .a-qty-control { display: flex; width: auto; align-items: center; gap: 6px; }
  .a-qty-control .a-undo { flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; }
  .a-qty-control .a-undo:disabled { display: none; }
  .a-qty-control .a-qty {
    flex: 0 0 72px; width: 72px; min-width: 72px; max-width: 72px; min-height: 48px; height: 48px; padding: 0 4px;
    justify-content: center; align-items: center; text-align: center;
  }
  .a-qty-control .a-qty:hover { background: var(--a-accent-soft); }
  .a-qty-control .a-qty[data-needs-pack="true"] { border: 2px dashed var(--a-order-fill); background: var(--a-order-soft); }
  .a-qty-control .a-qty-number { font-size: 22px; }
  /* 포장 안내는 단어 단위로만 줄을 바꿉니다(글자 단위로 쪼개지 않음). 남는 폭은 수량이 가져갑니다. */
  .a-qty-control .a-pack-summary { display: none; }
  .a-pack-slot { display: none; }
  .a-qty-control .a-decrement {
    flex: 0 0 56px; width: 56px; min-width: 56px; height: 48px; margin-left: 0;
    background: var(--a-accent); border-color: var(--a-accent); color: #fff;
  }
  .a-qty-control .a-decrement:hover:not(:disabled) { background: var(--a-accent-hover); border-color: var(--a-accent-hover); }
  .a-qty-control .a-decrement:disabled { background: var(--a-disabled-bg); border-color: transparent; color: var(--a-disabled-ink); }
  .a-stock { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 24px; }
  .a-stock-bar { flex: 1 1 auto; max-width: 96px; }
  .a-when .a-memo-trigger { min-height: 44px; }
  .a-latest { font-size: 12.5px; }

  .a-table tr.a-loc-row { margin: 0; padding: 0; border: 0; background: transparent; }
  .a-loc-row th { display: flex; align-items: center; height: 32px; margin: 0 0 8px; padding: 0 2px; }
  .a-loc-row + tr[data-row] { margin-top: 0; }
  .a-table tr[data-row] + tr.a-loc-row th { margin-top: 16px; }
  .a-table tr.a-group-row { margin: 0; padding: 0; border: 0; background: transparent; }
  .a-group-row th { display: flex; align-items: center; height: 40px; margin: 8px 0; padding: 0 12px; border-radius: var(--a-r-sm); }
  #a-inv-rows > tr:not([data-row]):not(.a-loc-row):not(.a-group-row) { border: 0; background: transparent; }
  .a-table tr > td.a-empty { padding: 32px 16px; }

  /* 이름표 달린 표 (직원 · 스냅샷, spec §5.17) */
  .a-staff-table tr {
    margin-bottom: 8px; padding: 8px 12px;
    border: 1px solid var(--a-line); border-radius: var(--a-r); background: var(--a-surface);
  }
  .a-staff-table tr[data-member]:hover > td { background: transparent; }
  .a-staff-table td {
    display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 8px;
    min-height: 36px; height: auto; padding: 4px 0; border: 0; white-space: normal; overflow-wrap: anywhere;
  }
  .a-staff-table td::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--a-muted); }
  .a-staff-table td.a-cell-title { display: block; padding-bottom: 6px; font-size: 15px; font-weight: 600; font-family: var(--a-font); }
  .a-staff-table td.a-cell-act, .a-staff-table td[colspan] { display: block; padding-top: 8px; }
  .a-staff-table td.a-cell-title::before, .a-staff-table td.a-cell-act::before, .a-staff-table td[colspan]::before { content: none; }
  .a-staff-table td.a-cell-act .a-btn { width: 100%; min-height: 44px; }
  .a-staff-table .a-select { min-height: 44px; }
  .a-staff-add { flex-direction: column; align-items: stretch; gap: 12px; }
  .a-staff-add .a-field { width: 100%; }
  .a-staff-add .a-input { min-width: 0; }
  .a-staff-add .a-btn { width: 100%; min-height: 48px; }

  .a-backup-card { padding: 16px; }
  .a-backup-card .a-search { flex-wrap: wrap; }
  .a-backup-card .a-search .a-input { width: 100%; }

  /* 안내 띠: 버튼은 문장 아래로 (spec §5.14) */
  .a-banner { grid-template-columns: 20px minmax(0, 1fr); grid-template-areas: "icon text" ". actions"; }
  .a-banner-actions { justify-content: flex-end; }

  /* 대화상자: 버튼은 세로로 전체 폭, 주 버튼이 위 */
  .a-dialog-in { padding: 20px; }
  .a-dialog-actions { flex-direction: column-reverse; align-items: stretch; }
  .a-dialog-actions .a-btn { width: 100%; min-height: 48px; }

  /* 토스트 · 차감 안내는 아래에 붙습니다 (검색을 가리지 않게). */
  /* 휴대폰: 알림은 왼쪽 아래 떠 있는 '불편한 점' 버튼(52px) 위로 띄워 겹치지 않게 합니다. */
  .notice {
    top: auto; bottom: calc(80px + env(safe-area-inset-bottom)); left: 12px; right: 12px;
    transform: none; width: auto; max-width: none;
  }
  .a-decrease-notice { inset: auto 12px calc(12px + env(safe-area-inset-bottom)) 12px; width: auto; max-height: 50dvh; }
  .a-memo-popover { width: calc(100vw - 24px); max-height: 70dvh; }
  .a-settings-popover { width: min(440px, calc(100vw - 24px)); max-height: min(65dvh, 640px); }
}

@media (max-width: 900px) { .a-backup-grid { grid-template-columns: 1fr; } }

@media (max-width: 380px) {
  .a-rail-nav button { padding: 0 9px; font-size: 14px; }
  .a-rail-foot .a-btn, .a-rail-foot .a-rail-user + .a-btn { padding: 0 8px; }
}

@media (max-width: 360px) {
  .a-qty-control .a-undo { flex-basis: 48px; width: 48px; min-width: 48px; height: 48px; }
  .a-qty-control .a-decrement { flex-basis: 60px; width: 60px; min-width: 60px; height: 48px; }
  .a-qty-control .a-qty { min-height: 48px; }
  .a-qty-control .a-qty-number { font-size: 22px; }
  .a-loc-switch button { padding: 0 12px; font-size: 13.5px; }
}

/* 터치 기기: 누르는 모든 것은 44 이상 (spec §4) */
@media (pointer: coarse) {
  .a-btn, .a-btn-sm, button, summary, select, .a-input:not(textarea),
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  .a-loc-switch button, .a-rail-nav button, .notice-close { min-height: 44px; }
  summary { padding-top: 10px; padding-bottom: 10px; }
  .a-options-panel > summary { padding-top: 0; padding-bottom: 0; }
  .a-rail-foot .a-btn, .a-rail-foot .a-rail-user + .a-btn, .a-window button, .a-view-switch button,
  .a-settings-section > summary, .a-patient-add summary, .a-audio-history summary, .a-inv-help summary,
  .a-notice-settings summary, summary.a-preview-h, .a-preview-block > summary, .a-log-actions .a-btn,
  .a-banner-actions .a-btn, .a-staff-table .a-btn, .a-memo-head .a-btn { min-height: 44px; }
  .a-banner-more { min-height: 44px; padding: 0 12px; }
  .a-kind-button, .a-favorite, .a-memo-head button, .notice-close { min-width: 44px; min-height: 44px; }
  .a-name-edit, .a-pack-summary, .a-cell-settings, .a-sort-head { min-height: 44px; }
  .a-input, .a-textarea, select { font-size: 16px; }
  .a-decrement, .a-undo { width: 56px; min-width: 56px; height: 56px; }
  /* 태블릿에서도 −는 채운 주 동작 */
  .a-decrement { background: var(--a-accent); border-color: var(--a-accent); color: #fff; }
  .a-decrement:hover:not(:disabled) { background: var(--a-accent-hover); border-color: var(--a-accent-hover); }
  .a-decrement:disabled { background: var(--a-disabled-bg); border-color: transparent; color: var(--a-disabled-ink); }
  .a-staff-table .a-select { min-height: 44px; }
  .a-link-quiet { min-height: 44px; }
}
@media (pointer: coarse) and (max-width: 700px) {
  .a-qty-control .a-decrement { flex-basis: 56px; width: 56px; min-width: 56px; height: 48px; }
  .a-qty-control .a-undo { flex-basis: 44px; width: 44px; min-width: 44px; height: 44px; }
}
@media (pointer: coarse) and (max-width: 360px) {
  .a-qty-control .a-undo { width: 48px; min-width: 48px; height: 48px; }
  .a-qty-control .a-decrement { width: 60px; min-width: 60px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .a-decrement:active:not(:disabled) { transform: none; }
}

/* 긴 수량 (spec §5.8): 숫자는 절대 자르지 않습니다. 다섯 자리 이상(API 최대 1,000,000)은 자리 수에 따라 글자만 줄입니다.
   휴대폰 규칙(.a-qty-control .a-qty-number)보다 구체적이고 뒤에 있어야 하므로 파일 끝에 둡니다. */
.a-qty-control .a-qty-number[data-len="5"] { font-size: 19px; }
.a-qty-control .a-qty-number[data-len="6"] { font-size: 16px; }
.a-qty-control .a-qty-number[data-len="7"] { font-size: 14px; }
@media (max-width: 700px) {
  /* 휴대폰 목록의 수량 칸은 72px: 네 자리까지 22px, 그 이상은 자리 수에 따라 줄입니다. */
  .a-qty-control .a-qty-number[data-len="5"] { font-size: 18px; }
  .a-qty-control .a-qty-number[data-len="6"] { font-size: 15px; }
  .a-qty-control .a-qty-number[data-len="7"] { font-size: 13px; }
}
@media (max-width: 360px) {
  .a-qty-control .a-pack-summary { max-width: 84px; font-size: 11.5px; }
  .a-qty-control .a-qty-number[data-len="5"] { font-size: 18px; }
  .a-qty-control .a-qty-number[data-len="6"] { font-size: 15px; }
  .a-qty-control .a-qty-number[data-len="7"] { font-size: 13px; }
}

/* 터치 기기: 정렬·빠른 보기·종류 칩도 44px (spec §4). 칩 줄이 8px 높아지는 만큼 도구 줄 높이 토큰도 늘립니다. */
@media (pointer: coarse) {
  .a-quick-sort select, .a-kind-chip { min-height: 44px; height: 44px; }
  .a-inv-toolbar:has(> .a-kind-switch:not([hidden])) { grid-template-rows: 44px 44px 20px; }
  :root:has(.a-inv-toolbar > .a-kind-switch:not([hidden])) { --a-toolbar-h: 148px; }
}
@media (pointer: coarse) and (max-width: 700px) {
  .a-inv-toolbar > .a-kind-switch { flex-basis: 44px; }
  :root:has(.a-inv-toolbar > .a-kind-switch:not([hidden])) { --a-toolbar-h: 190px; }
}

/* ── v4: 부족함만 체크 · 길게 눌러 여러 개 · 인수인계 · 하루 마감 · 주문/공급처 (2026-10-05) ───────────── */
/* − 는 누른 채 끌어 여러 개를 고르므로 끄는 동안 화면이 스크롤되지 않게 합니다. */
.a-decrement { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }
/* 0.5초 누르면 − 버튼 위에 뜨는 세로 막대: 위 = 빼기, 아래 = 채우기. 가운데 선이 0(누른 자리). */
.a-scrub { position: fixed; z-index: 60; width: 68px; height: 256px; border-radius: 34px; pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--a-accent) 22%, var(--a-surface)) 0 var(--zero, 128px), color-mix(in srgb, var(--a-ok) 22%, var(--a-surface)) var(--zero, 128px) 100%);
  box-shadow: var(--a-e2), inset 0 0 0 1px var(--a-line); }
.a-scrub::before { content: ""; position: absolute; left: 10px; right: 10px; top: var(--zero, 128px); height: 2px; background: var(--a-ink-2); opacity: .45; }
.a-scrub[hidden] { display: none; }
.a-scrub-up, .a-scrub-down { position: absolute; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 800; color: var(--a-ink-2); }
.a-scrub-up { top: 10px; } .a-scrub-down { bottom: 10px; }
.a-scrub-thumb { position: absolute; left: 50%; top: var(--thumb, 128px); transform: translate(-50%, -50%); min-width: 76px; padding: 6px 8px; border-radius: 12px; background: var(--a-ink); color: #fff; text-align: center; box-shadow: var(--a-e2); }
.a-scrub[data-dir="down"] .a-scrub-thumb { background: var(--a-accent); }
.a-scrub[data-dir="up"] .a-scrub-thumb { background: var(--a-ok); }
.a-scrub-value { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.a-scrub-left { display: block; font-size: 10.5px; font-weight: 600; opacity: .9; white-space: nowrap; }
.a-level { display: inline-flex; border: 1px solid var(--a-line-input); border-radius: var(--a-r); overflow: hidden; vertical-align: middle; }
.a-level button { min-width: 52px; min-height: 44px; padding: 0 10px; border: 0; border-left: 1px solid var(--a-line); background: var(--a-surface); color: var(--a-ink-2); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.a-level button:first-child { border-left: 0; }
.a-level button[aria-pressed="true"][data-tone="enough"] { background: var(--a-ok); color: #fff; }
.a-level button[aria-pressed="true"][data-tone="normal"] { background: var(--a-accent); color: #fff; }
.a-level button[aria-pressed="true"][data-tone="low"] { background: var(--a-order-fill); color: #fff; }
.a-action-chip { border-color: var(--a-accent); color: var(--a-accent); font-weight: 700; }
.a-bulk-popover { width: min(360px, calc(100vw - 24px)); position: fixed; inset: auto 12px 16px auto; margin: 0; }
.a-bulk-amount { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px 0; }
.a-bulk-amount output { min-width: 64px; text-align: center; font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.a-bulk-amount .a-btn { min-width: 48px; min-height: 48px; font-size: 22px; }
.a-bulk-range { width: 100%; min-height: 44px; accent-color: var(--a-accent); }
.a-handover { margin: 8px 0 12px; border: 1px solid var(--a-line); border-radius: var(--a-r); background: var(--a-surface); }
.a-handover > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; font-weight: 700; cursor: pointer; }
.a-handover > summary span { color: var(--a-order-ink); }
.a-handover > div, .a-handover-form { padding: 0 12px 10px; }
.a-handover-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.a-handover-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; padding: 8px 10px; border-radius: var(--a-r-sm); background: var(--a-page); }
.a-handover-list li p { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.a-handover-list li .a-hint { grid-column: 1; margin: 0; font-size: 12px; }
.a-handover-list li .a-btn { grid-column: 2; grid-row: 1 / span 2; }
.a-handover-list li[data-done="true"] p { color: var(--a-muted); text-decoration: line-through; }
.a-handover-form { display: flex; gap: 8px; }
.a-handover-form .a-input { flex: 1 1 auto; min-width: 0; }
/* 하루 마감 */
.a-close-wrap { padding: 0 20px 120px; }
.a-close-list { list-style: none; margin: 0; padding: 0; }
.a-close-row { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 6px 0; border-bottom: 1px solid var(--a-line-soft); }
.a-close-row[data-touched="true"] { background: var(--a-accent-soft); }
.a-close-name { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.a-close-name b { font-size: 17px; overflow-wrap: anywhere; }
.a-close-name .a-hint { margin: 0; font-size: 12.5px; }
.a-close-input { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
.a-close-input input { width: 96px; min-height: 44px; text-align: right; font-size: 20px; font-weight: 700; }
.a-close-group { margin: 16px 0 4px; font-size: 15px; color: var(--a-accent); }
.a-close-group span { font-size: 12.5px; font-weight: 500; color: var(--a-muted); }
.a-close-foot { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 20px; border-top: 1px solid var(--a-line); background: var(--a-surface); }
.a-close-foot .a-btn-main { margin-left: auto; min-height: 48px; }
.a-close-bad { color: var(--a-warn); font-weight: 700; }
/* 주문 · 공급처 */
.a-orders { padding: 0 20px 40px; max-width: 760px; }
.a-orders-request { padding: 10px 12px; border-radius: var(--a-r-sm); background: var(--a-order-soft); color: var(--a-order-ink); }
.a-sup-list, .a-order-list, .a-line-list { list-style: none; margin: 0 0 12px; padding: 0; }
.a-sup-card { padding: 14px 0; border-bottom: 1px solid var(--a-line-soft); }
.a-sup-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.a-sup-head b { font-size: 18px; }
.a-sup-meta { margin: 2px 0 10px; font-size: 13px; color: var(--a-ink-2); }
.a-sup-need { color: var(--a-order-ink); }
.a-sup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.a-sup-actions .a-btn-main { flex: 1 1 auto; }
.a-sup-actions a.a-btn { display: inline-flex; align-items: center; text-decoration: none; }
.a-orders-h, .a-build-h { margin: 18px 0 6px; font-size: 15px; }
.a-order-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--a-line-soft); }
.a-order-row p { margin: 2px 0 0; }
.a-order-lines { font-size: 13.5px; overflow-wrap: anywhere; }
.a-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--a-r-pill); font-size: 12px; font-weight: 700; background: var(--a-line-soft); color: var(--a-ink-2); }
.a-pill[data-status="ordered"] { background: var(--a-order-soft); color: var(--a-order-ink); }
.a-pill[data-status="received"] { background: var(--a-accent-soft); color: var(--a-ok); }
.a-sup-form { display: grid; gap: 8px; max-width: 420px; padding: 0 20px 40px; }
.a-build-head h2 { margin: 4px 0 0; font-size: 20px; }
.a-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 60px; padding: 6px 0; border-bottom: 1px solid var(--a-line-soft); }
.a-line[data-checked="false"] { opacity: .75; }
.a-line-check { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.a-line-check input { width: 22px; height: 22px; accent-color: var(--a-accent); }
.a-line-check > span { display: flex; flex-direction: column; min-width: 0; }
.a-line-check b { font-size: 16px; overflow-wrap: anywhere; }
.a-line-check .a-hint { margin: 0; font-size: 12.5px; }
.a-line-qty { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.a-line-qty input { width: 72px; min-height: 44px; text-align: center; font-weight: 700; }
.a-line-qty .a-btn { min-width: 44px; min-height: 44px; }
.a-order-text { margin: 0; padding: 10px 12px; border: 1px dashed var(--a-line-input); border-radius: var(--a-r-sm); background: var(--a-page); font: inherit; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.a-build-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 8px; }
.a-build-foot a.a-btn { display: inline-flex; align-items: center; text-decoration: none; }
.a-build-foot .a-btn-main { margin-left: auto; min-height: 48px; }
.a-channel { display: inline-flex; gap: 12px; font-size: 14px; }
.a-channel label { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; cursor: pointer; }
@media (max-width: 700px) {
  .a-close-wrap, .a-orders { padding-left: 12px; padding-right: 12px; }
  .a-close-foot { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .a-bulk-popover { inset: auto 12px calc(16px + env(safe-area-inset-bottom, 0px)) 12px; width: auto; }
  .a-table tr[data-row] .a-level button { min-width: 48px; padding: 0 8px; font-size: 13.5px; }
}
.a-handover-jump { margin-left: 6px; font-weight: 700; color: var(--a-order-ink); text-decoration: underline; text-underline-offset: 2px; }
.a-handover-jump[hidden] { display: none; }
.a-row-spec { font-size: 0.78em; font-weight: 600; color: var(--a-muted); white-space: nowrap; }
@media (max-width: 700px) {
  /* 떠 있는 '불편한 점' 버튼(왼쪽 아래)이 마감 저장 줄의 글자를 가리지 않게 */
  .a-close-foot { padding-left: 80px; }
}
/* 소모품 5단계 막대: 부족 · 적음 · 보통 · 넉넉 · 가득. 누른 칸까지 채워지고 색은 상태. */
.a-level5 { display: inline-flex; gap: 3px; vertical-align: middle; }
.a-level5 button { width: 40px; min-height: 44px; padding: 0; border: 1px solid var(--a-line-input); border-radius: 6px; background: var(--a-surface); color: var(--a-muted); font: inherit; font-size: 11px; font-weight: 700; line-height: 1.1; cursor: pointer; }
.a-level5 button span { display: block; }
.a-level5[data-tone="high"] button[data-on="true"] { background: var(--a-ok); border-color: var(--a-ok); color: #fff; }
.a-level5[data-tone="mid"] button[data-on="true"] { background: var(--a-accent); border-color: var(--a-accent); color: #fff; }
.a-level5[data-tone="few"] button[data-on="true"] { background: var(--a-order-fill); border-color: var(--a-order-fill); color: #fff; }
.a-level5[data-tone="low"] button[data-on="true"] { background: var(--a-warn); border-color: var(--a-warn); color: #fff; }
.a-level5 button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--a-surface), 0 0 0 4px currentColor; }
.a-level5[data-tone] button[aria-pressed="true"] { color: #fff; }
@media (max-width: 380px) { .a-level5 button { width: 34px; font-size: 10px; } }
/* 끄는 동안 − 버튼: 글자가 −4 · +3으로 바뀌고 많을수록 진해집니다(빼기 남색 · 채우기 초록). */
.a-qty-control .a-decrement[data-scrub] { font-size: 18px; font-weight: 800; transform: scale(1.06); }
.a-qty-control .a-decrement[data-scrub="down"] { background: color-mix(in srgb, var(--a-accent) calc(100% - 40% * var(--scrub-strength, 0)), #000); border-color: transparent; color: #fff; }
.a-qty-control .a-decrement[data-scrub="up"] { background: color-mix(in srgb, var(--a-ok) calc(100% - 40% * var(--scrub-strength, 0)), #000); border-color: transparent; color: #fff; }
#a-quantity-input { touch-action: none; cursor: ns-resize; }

/* 품목 옮기기: 누른 품목 바로 옆에 작은 판이 뜹니다. 왼쪽 = 보관 장소, 오른쪽 = 관리 방식, 가운데 = 손가락 자리. */
.a-move { position: fixed; inset: 0; z-index: 70; background: color-mix(in srgb, var(--a-ink) 30%, transparent); touch-action: none; user-select: none; -webkit-user-select: none; }
.a-move[hidden] { display: none; }
.a-move-dock { position: fixed; display: grid; grid-template-columns: 124px 116px 124px; gap: 0; max-width: calc(100vw - 16px); }
.a-move-side { display: flex; flex-direction: column; gap: 6px; }
.a-move-side[data-side="mode"] { grid-column: 3; }
.a-move-label { margin: 0; align-self: flex-start; padding: 3px 9px; border-radius: 999px; background: var(--a-ink); color: var(--a-surface); font-size: 12.5px; font-weight: 700; }
.a-move-side[data-side="mode"] .a-move-label { align-self: flex-end; }
.a-move-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow: auto; }
.a-move-target { min-height: 52px; padding: 6px 10px; border-radius: 8px; background: var(--a-surface); border: 2px dashed var(--a-line-strong); box-shadow: var(--a-e2);
  display: flex; flex-direction: column; justify-content: center; gap: 1px; transition: transform .08s, background .08s; }
.a-move-side[data-side="mode"] .a-move-target { text-align: right; }
.a-move-target b { font-size: 16px; color: var(--a-ink); overflow-wrap: anywhere; }
.a-move-target small { font-size: 12px; color: var(--a-muted); }
.a-move-target[data-current="true"] { border-style: solid; border-color: var(--a-line); background: var(--a-sunken); }
.a-move-target[data-current="true"] b { color: var(--a-muted); }
.a-move-target[data-over="true"] { border-style: solid; border-color: var(--a-accent); background: var(--a-accent-soft); transform: scale(1.05); }
.a-move-target[data-over="true"][data-current="true"] { border-color: var(--a-line); background: var(--a-sunken); transform: none; }
.a-move-ghost { position: fixed; left: 0; top: 0; display: flex; align-items: center; gap: 6px; max-width: 150px; padding: 4px 10px 4px 4px;
  border-radius: 10px; background: var(--a-surface); box-shadow: var(--a-e2); font-size: 14px; font-weight: 700; color: var(--a-ink); pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-move-ghost .a-kind-button { flex: 0 0 auto; width: 32px; height: 32px; }
.a-move-status { position: fixed; left: 12px; right: 12px; bottom: 16px; margin: 0; text-align: center; color: var(--a-surface); font-size: 13px; font-weight: 600; }
.a-moving, .a-moving * { cursor: grabbing !important; }
tr[data-row] .a-row-expand, tr[data-row] .a-name-edit, tr[data-row] .a-kind-button { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
