:root {
  --ink: #17211b;
  --muted: #526257;
  --text-muted: #526257;
  --line: #dfe6e1;
  --canvas: #f4f7f4;
  --panel: #ffffff;
  --green: #1f6f4a;
  --green-dark: #15543a;
  --mint: #e5f4eb;
  --amber: #b56b12;
  --amber-bg: #fff4df;
  --red: #a53e3e;
  --red-bg: #fff0f0;
  --shadow: 0 10px 30px rgba(24, 48, 34, .06);
}
.connection-manager { padding:24px; margin-bottom:24px; }
.connection-device-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:14px; margin:20px 0; }
.connection-device { padding:18px; border:1px solid var(--line); border-radius:12px; background:var(--canvas); min-width:0; }
.connection-device.selected { border:2px solid var(--green); }
.connection-device-title { display:block; font-size:18px; font-weight:800; margin-bottom:10px; }
.connection-device-title span { display:block; font-size:14px; color:var(--muted); }
.connection-device form, .connection-add { display:flex; gap:10px; align-items:end; flex-wrap:wrap; margin-top:12px; }
.connection-device input, .connection-add input { min-width:0; width:100%; }
.connection-add label { flex:1; min-width:200px; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  word-break: keep-all;
  overflow-wrap: break-word;
}
button, input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px; color: #eaf4ee; background: #172d22; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; flex-shrink: 0; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #153726; background: #b8e2c8; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .02em; }
.brand small { margin-top: 2px; color: #9fb5a8; font-size: 14px; letter-spacing: .12em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar-section-title {
  margin: 1.15rem 0 0.35rem 0.65rem;
  font-size: 0.72rem;
  color: #7d9687;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sidebar nav > .sidebar-section-title:first-child {
  margin-top: 0.15rem;
}
.mobile-only-block {
  display: none !important;
}
.sidebar-user-card {
  display: none;
}
.sidebar nav a { padding: 10px 13px; border-radius: 9px; color: #abc0b2; display: flex; gap: 11px; align-items: center; font-size: 14px; font-weight: 650; }
.sidebar nav a:hover, .sidebar nav a.active { color: white; background: rgba(255,255,255,.09); }
.sidebar nav a.active { box-shadow: inset 3px 0 #87cba1; }
.sidebar nav a.sidebar-revert-link {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.35);
  font-weight: 750;
  margin-top: 4px;
  white-space: nowrap;
}
.sidebar nav a.sidebar-revert-link:hover {
  color: #ffffff;
  background: rgba(239, 68, 68, 0.38);
  border-color: rgba(248, 113, 113, 0.7);
}
.sidebar nav a.sidebar-revert-link span { color: #f87171; }
.sidebar nav a > span { width: 18px; text-align: center; color: #8fd0a7; }
.sidebar-foot { margin-top: auto; padding: 14px; border-radius: 10px; color: #97ab9f; background: rgba(0,0,0,.18); font-size: 13.5px; display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.sidebar-foot .env-tag-wrap { display: flex; align-items: center; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #6ee7a0; box-shadow: 0 0 0 4px rgba(110,231,160,.1); }

main { min-width: 0; transition: margin-right 0.22s cubic-bezier(0.16, 1, 0.3, 1); }
.topbar { padding: 28px 40px 22px; background: rgba(244,247,244,.92); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 5; backdrop-filter: blur(12px); }
.topbar h1 { margin: 3px 0 0; font-size: 25px; letter-spacing: -.04em; }
.topbar-heading, .account-area { display: flex; align-items: center; }
.topbar-heading { gap: 12px; }
.account-area { gap: 16px; }
.account-summary { text-align: right; font-size: 15px; }
.account-role { display: inline-block; margin-left: 4px; padding: 2px 6px; border-radius: 4px; background: #e2e8f0; font-size: 13px; }
.account-email { color: var(--muted); font-size: 13px; }
.logout-button { min-height: 36px !important; padding: 0 12px !important; font-size: 13px; }
.mobile-menu-button, .mobile-menu-close, .mobile-menu-backdrop, .mobile-bottom-nav, .mobile-bottom-nav-btn, .tablet-expand-button { display: none; }
.eyebrow, .section-kicker { margin: 0; color: var(--green); font-size: 12px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.local-badge { padding: 7px 10px; border: 1px solid #c9d8cf; border-radius: 999px; color: var(--muted); background: white; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.content { padding: 24px 36px 56px; max-width: 100%; width: 100%; box-sizing: border-box; margin: 0; }
.notice { margin: 16px 36px 0; padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.notice.success { color: var(--green-dark); background: var(--mint); border: 1px solid #c6d9cc; }
.notice.error { color: var(--red); background: var(--red-bg); border: 1px solid #efc5c5; }
.notice.warning { color: #b45309; background: #fffbeb; border: 1px solid #fde68a; }
.notice.info { color: #1d4ed8; background: #eff6ff; border: 1px solid #bfdbfe; }
.impersonation-banner { position: sticky; z-index: 1000; top: 0; padding: 10px 24px; color: white; background: #4338ca; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 15px; }
.impersonation-banner form { margin: 0; }
.impersonation-banner button { min-height: 34px; padding: 0 12px; color: #4338ca; background: white; white-space: nowrap; }
.impersonation-banner + .shell .topbar { top: 48px; }

.security-banner { margin-bottom: 22px; padding: 16px 20px; border: 1px solid #c8e1d1; border-radius: 14px; background: linear-gradient(90deg, #e5f4eb, #f4fbf7); display: flex; align-items: center; gap: 14px; }
.security-banner p { margin: 3px 0 0; color: #52705e; font-size: 15px; }
.security-banner a { margin-left: auto; color: var(--green); font-size: 15px; font-weight: 750; }
.security-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: white; background: var(--green); font-weight: 900; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card { min-height: 130px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.stat-card span { display: block; color: var(--muted); font-size: 15px; font-weight: 650; }
.stat-card strong { display: inline-block; margin: 18px 6px 0 0; font-size: 34px; letter-spacing: -.05em; }
.stat-card small { color: #8c9790; }
.stat-card.warning { border-color: #ecd3ab; background: linear-gradient(145deg, white 50%, #fff7ea); }
.stat-card.warning strong { color: var(--amber); }

.two-column { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(340px, .8fr); gap: 22px; }
.page-grid { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(0, 1.28fr); gap: 22px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { min-height: 74px; padding: 20px 22px; border-bottom: 1px solid #edf1ee; display: flex; align-items: center; justify-content: space-between; }
.panel-head h2, .form-panel h2 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.025em; }
.panel-head > a { color: var(--green); font-size: 14px; font-weight: 750; }
.panel-head > strong { color: var(--muted); font-size: 15px; }
.form-panel { padding: 24px; position: sticky; top: 112px; }
.form-panel > .section-kicker { display: block; }
.form-panel > h2 { margin-bottom: 22px; }
.panel-copy { margin: 0; padding: 20px 22px 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.stack-form { padding: 20px 22px 24px; display: grid; gap: 16px; }
.form-panel .stack-form { padding: 0; }
.stack-form label { display: grid; gap: 7px; color: #34443a; font-size: 14px; font-weight: 750; }
.stack-form label small { color: var(--muted); font-weight: 450; line-height: 1.5; }
input:not([type="checkbox"]):not([type="radio"]), textarea, select { width: 100%; border: 1px solid #ccd6cf; border-radius: 10px; color: var(--ink); background: #fbfcfb; outline: none; box-sizing: border-box; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select { height: 42px; padding: 0 12px; }
input[type="checkbox"], input[type="radio"] {
  width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
  accent-color: var(--green);
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
}
input[type="file"] {
  height: auto;
  min-height: 44px;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  cursor: pointer;
  line-height: normal;
  font-size: 13px;
  color: #3b4e43;
}
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  margin-right: 12px;
  border: 1px solid #b2d5c0;
  border-radius: 7px;
  background: #eef7f2;
  color: #1a6341;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
  transition: all 0.15s ease;
  font-family: inherit;
}
input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  background: #def0e6;
  border-color: #8bbfa0;
  color: #134e32;
}
textarea { padding: 11px 12px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: #75ac8a; box-shadow: 0 0 0 3px rgba(56,133,86,.1); }
.form-row { display: grid; grid-template-columns: 1fr 1.5fr; gap: 12px; }
button, .button-link { border: 0; border-radius: 10px; cursor: pointer; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; box-sizing: border-box; line-height: 1.2; }
button.primary, .button-link { min-height: 43px; padding: 0 18px; color: white; background: var(--green); }
button.primary:hover, .button-link:hover { background: var(--green-dark); }
button.secondary, .button-link.secondary { min-height: 43px; padding: 0 18px; color: var(--green-dark); background: var(--mint); }
button.ghost, .button-link.ghost { min-height: 40px; padding: 0 16px; color: var(--muted); background: #eff3f0; }
button:disabled { opacity: .45; cursor: not-allowed; }
.form-warning { margin: -6px 0 0; color: var(--amber); font-size: 14px; }
.form-context-note { padding: 11px; border-radius: 9px; color: #684614; background: var(--amber-bg); font-size: 13px; line-height: 1.5; }

.admin-create-panel { margin-bottom: 28px; padding: 24px; border: 1px solid #b8d4c2; border-radius: 16px; background: linear-gradient(135deg, #edf7f1 0%, #f7fbf8 100%); box-shadow: 0 10px 28px rgba(25, 83, 53, .07); }
.admin-create-heading { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.admin-create-heading h2 { margin: 5px 0 6px; font-size: 21px; letter-spacing: -.03em; }
.admin-create-heading p { margin: 0; color: #55675c; font-size: 14px; line-height: 1.55; }
.admin-create-guide { flex: 0 0 auto; padding: 7px 10px; border: 1px solid #c5d9cc; border-radius: 999px; color: #586b60; background: rgba(255,255,255,.72); font-size: 12px; font-weight: 800; }
.admin-create-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.admin-create-form label { min-width: 0; display: grid; gap: 7px; color: #263c2f; font-size: 14px; font-weight: 800; }
.admin-create-form input { height: 46px; border: 2px solid #a8bdb0; border-radius: 9px; color: var(--ink); background: #fff; box-shadow: 0 2px 7px rgba(35, 72, 49, .05), inset 0 1px 1px rgba(20, 46, 29, .03); }
.admin-create-form input::placeholder { color: #8a968f; opacity: 1; }
.admin-create-form input:hover { border-color: #7fa18c; }
.admin-create-form input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 4px rgba(31,111,74,.13); }
.admin-create-actions { grid-column: 1 / -1; padding-top: 2px; display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.admin-create-actions small { color: #607067; font-size: 12px; }
.admin-create-actions button { min-width: 210px; }
.admin-org-mobile-list { display: none; }
.admin-org-mobile-card {
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 5px 16px rgba(24,48,34,.05);
  box-sizing: border-box;
  overflow: hidden;
}
.admin-org-mobile-card > header {
  padding-bottom: 12px;
  border-bottom: 1px solid #e8ede9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.admin-org-mobile-title {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}
.admin-org-mobile-name-wrap {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.admin-org-mobile-name-wrap strong {
  display: block;
  font-size: 14.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f172a;
}
.admin-org-mobile-name-wrap small {
  display: block;
  max-width: 170px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-org-mobile-badge-wrap {
  flex-shrink: 0;
  margin-left: auto;
}
.admin-org-mobile-badge-wrap .badge {
  white-space: nowrap;
  font-size: 12px;
  padding: 4px 8px;
}
.admin-org-mobile-meta { margin: 12px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-org-mobile-meta div { min-width: 0; }
.admin-org-mobile-meta .wide { grid-column: 1 / -1; }
.admin-org-mobile-meta dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.admin-org-mobile-meta dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 13.5px; font-weight: 750; }
.admin-org-mobile-stats { margin-bottom: 12px; padding: 10px; border-radius: 9px; background: #f4f8f5; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; color: var(--muted); text-align: center; font-size: 12px; }
.admin-org-mobile-stats strong { color: var(--ink); font-size: 14px; }
.admin-org-mobile-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-org-mobile-actions .wide {
  width: 100%;
}
.mobile-impersonate-btn {
  width: 100% !important;
  min-height: 42px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #eef2ff !important;
  color: #3730a3 !important;
  border: 1px solid #c7d2fe !important;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}
.mobile-impersonate-btn:hover {
  background: #e0e7ff !important;
}
.admin-org-mobile-manage-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}
.mobile-manage-btn {
  width: 100% !important;
  min-height: 38px;
  padding: 0 6px;
  border-radius: 8px;
  font-size: 13px !important;
  font-weight: 700 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

/* 입점 도매상 관리 테이블 스타일 */
.admin-org-table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-top: 12px;
}

.admin-org-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 900px;
}

.admin-org-table th {
  background: #f8fafc;
  padding: 12px 10px;
  font-weight: 700;
  color: #475569;
  border-bottom: 1.5px solid #cbd5e1;
  white-space: nowrap !important;
  word-break: keep-all !important;
  text-align: left;
}

.admin-org-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: #1e293b;
}

.admin-org-table tbody tr:hover td {
  background-color: #f8fafc;
}

.admin-org-table .col-nowrap {
  white-space: nowrap !important;
  word-break: keep-all !important;
}

.admin-org-table .col-center {
  text-align: center;
}

.admin-org-table .org-action-group,
.admin-org-table .org-manage-action-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.admin-org-table .btn-impersonate-cs {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 7px;
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: all 0.15s ease;
}

.admin-org-table .btn-impersonate-cs:hover {
  background: #c7d2fe;
  color: #1e1b4b;
}

.admin-org-table .btn-manage-edit,
.admin-org-table .edit-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 650;
  border-radius: 6px;
  background: #f2f7f4;
  color: var(--green-dark, #1b4332);
  border: 1px solid #c8d9ce;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-org-table .btn-manage-edit:hover,
.admin-org-table .edit-button:hover {
  background: #e2ede5;
  color: #0f291e;
}

.admin-org-table .btn-manage-toggle {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 650;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-org-table .btn-manage-toggle:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.admin-org-table .btn-manage-delete,
.admin-org-table .danger-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 650;
  border-radius: 6px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-org-table .btn-manage-delete:hover,
.admin-org-table .danger-button:hover {
  background: #fee2e2;
  color: #991b1b;
}

.admin-org-panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid #edf1ee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.admin-org-panel-head h2 {
  margin: 2px 0 0;
  font-size: 18px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.trash-link-btn {
  text-decoration: none;
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.trash-count-badge {
  color: #b42318;
}
.trash-mobile-label { display: none; }
.trash-desktop-label { display: inline; }

.admin-trash-head {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.trash-back-btn {
  text-decoration: none;
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}
.mobile-only-trash-list {
  display: none;
}

/* 입점 업체 통합 검색 및 소유자 그룹 필터 바 */
.org-search-filter-bar {
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.org-search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0;
  flex: 1 1 auto;
}

.org-search-input-wrap {
  position: relative;
  flex: 1 1 280px;
  min-width: 220px;
  max-width: 420px;
}

.org-search-input-wrap input {
  width: 100%;
  height: 38px;
  padding: 6px 36px 6px 42px !important;
  font-size: 13.5px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  box-sizing: border-box;
}

.org-search-input-wrap input:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.org-search-input-wrap .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14.5px;
  line-height: 1;
  opacity: 0.65;
  pointer-events: none;
  z-index: 2;
}

.btn-clear-search {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 13px;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.btn-clear-search:hover {
  color: #0f172a;
}

.org-group-select-wrap select {
  height: 38px;
  padding: 6px 12px;
  font-size: 13.5px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  min-width: 170px;
  box-sizing: border-box;
}

.btn-search-submit {
  height: 38px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  white-space: nowrap;
}

.btn-reset-filter {
  height: 38px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 8px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.org-search-status {
  display: flex;
  align-items: center;
}

.search-result-pill {
  font-size: 13px;
  font-weight: 600;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 5px 11px;
  border-radius: 20px;
  white-space: nowrap;
}

/* 모바일 370px 반응형 검색바 */
@media (max-width: 640px) {
  .org-search-filter-bar {
    padding: 10px 12px;
    gap: 8px;
  }
  .org-search-form {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  .org-search-input-wrap {
    grid-column: 1 / -1;
    max-width: 100%;
    min-width: 0;
  }
  .org-group-select-wrap {
    min-width: 0;
  }
  .org-group-select-wrap select {
    width: 100%;
    min-width: 0;
  }
  .btn-reset-filter {
    grid-column: 1 / -1;
    justify-content: center;
    width: 100%;
  }
  .org-search-status {
    width: 100%;
    margin-top: 4px;
  }
}

/* ==========================================================================
   동일 소유자 그룹 퀵 지정 및 일괄 관리 바 (Modern Batch UX)
   ========================================================================== */

.org-batch-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2563eb;
  vertical-align: middle;
}

.btn-group-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.3;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-group-pill.has-group {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.btn-group-pill.has-group:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.btn-group-pill.is-empty {
  background: #f8fafc;
  color: #64748b;
  border: 1px dashed #cbd5e1;
  font-weight: 500;
}

.btn-group-pill.is-empty:hover {
  background: #f1f5f9;
  color: #334155;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.pill-caret {
  font-size: 11px;
  opacity: 0.7;
}

.batch-label-mobile { display: none; }
.batch-label-desktop { display: inline; }
.batch-count-suffix-mobile { display: none; }
.batch-count-suffix-desktop { display: inline; }

/* 하단 고정 플로팅 액션 바 */
.batch-action-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  animation: batchSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes batchSlideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.batch-bar-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: #0f172a;
  color: #ffffff;
  border-radius: 9999px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35), 0 4px 10px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-sizing: border-box;
}

.batch-count-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  padding-right: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  white-space: nowrap;
  flex-shrink: 0;
}

.batch-check-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}

.batch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-batch-primary {
  padding: 7px 14px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 20px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.btn-batch-primary:hover {
  background: #1d4ed8;
}

.btn-batch-secondary {
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-batch-secondary:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #fca5a5;
}

.btn-batch-cancel {
  padding: 7px 8px;
  background: transparent;
  color: #94a3b8;
  border: none;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-batch-cancel:hover {
  color: #ffffff;
}

/* 모바일 화면 대응: 바텀 네비게이션 회피 및 1행 최적화 */
@media (max-width: 768px) {
  .batch-label-mobile { display: inline; }
  .batch-label-desktop { display: none; }
  .batch-count-suffix-mobile { display: inline; }
  .batch-count-suffix-desktop { display: none; }

  .batch-action-bar {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 20px);
    max-width: 400px;
  }

  .batch-bar-inner {
    padding: 8px 12px;
    gap: 8px;
    width: 100%;
    justify-content: space-between;
  }

  .batch-count-info {
    font-size: 13px;
    gap: 6px;
    padding-right: 8px;
  }

  .batch-actions {
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
  }

  .btn-batch-primary {
    padding: 6px 11px;
    font-size: 13px;
  }

  .btn-batch-secondary {
    padding: 6px 9px;
    font-size: 12.5px;
  }

  .btn-batch-cancel {
    padding: 6px 6px;
    font-size: 12px;
  }
}

/* 370px 극소형 모바일 화면 대응 */
@media (max-width: 380px) {
  .batch-action-bar {
    width: calc(100% - 12px);
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  }

  .batch-bar-inner {
    padding: 6px 8px;
    gap: 6px;
  }

  .batch-count-info {
    font-size: 12px;
    gap: 4px;
    padding-right: 6px;
  }

  .batch-check-badge {
    width: 18px;
    height: 18px;
    font-size: 11px;
  }

  .btn-batch-primary {
    padding: 6px 8px;
    font-size: 12px;
  }

  .btn-batch-secondary {
    padding: 6px 7px;
    font-size: 12px;
  }

  .btn-batch-cancel {
    padding: 6px 4px;
    font-size: 11.5px;
  }
}

/* 소유자 그룹 팝업 모달 */
.owner-group-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.owner-group-modal-card {
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .owner-group-modal-card {
    width: calc(100% - 16px);
    max-height: 88vh;
    border-radius: 14px;
  }
  .modal-header {
    padding: 14px 18px !important;
  }
  .modal-body {
    padding: 16px 18px !important;
    gap: 16px !important;
  }
  .modal-footer {
    padding: 12px 18px !important;
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.modal-header h3 {
  margin: 0;
  font-size: 16.5px;
  color: #0f172a;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
}

.modal-close-btn:hover {
  color: #0f172a;
  background: #e2e8f0;
}

.modal-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-target-summary {
  background: #f1f5f9;
  padding: 12px 16px;
  border-radius: 10px;
}

.target-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.target-org-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

.preset-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-height: 140px;
  overflow-y: auto;
}

.group-preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 550;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.group-preset-chip:hover,
.group-preset-chip.active {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

.chip-count {
  font-size: 12px;
  color: #64748b;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}
.desktop-only-table {
  display: block;
}

@media (max-width: 900px) {
  .admin-org-panel-head {
    padding: 12px 14px;
  }
  .admin-org-panel-head h2 {
    font-size: 15px;
    white-space: nowrap;
  }
  .trash-link-btn {
    padding: 5px 8px;
    font-size: 11.5px;
  }
  .trash-mobile-label { display: inline; }
  .trash-desktop-label { display: none; }
  .admin-org-desktop-table { display: none; }
  .admin-org-mobile-list { padding: 0 14px 16px; display: grid; gap: 12px; }

  .admin-trash-head {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .admin-trash-head h2 {
    font-size: 16px;
    white-space: nowrap;
  }
  .admin-trash-head .panel-copy {
    font-size: 12px;
    margin: 4px 0 0;
    line-height: 1.45;
    color: var(--muted);
  }
  .trash-back-btn {
    align-self: flex-start;
    padding: 5px 10px;
    font-size: 12px;
  }
  .desktop-only-table {
    display: none !important;
  }
  .mobile-only-trash-list {
    display: grid !important;
    gap: 12px;
    padding: 0 14px 16px;
  }
  .trash-card {
    border-left: 4px solid #ef4444 !important;
  }
  .trash-avatar {
    background: #fee2e2 !important;
    color: #b91c1c !important;
  }
  .trash-badge {
    background: #fee2e2 !important;
    color: #991b1b !important;
    font-size: 11px !important;
    padding: 3px 7px !important;
    border-radius: 6px !important;
  }
  .trash-restore-btn {
    width: 100%;
    min-height: 42px;
    font-size: 13px;
    font-weight: 850;
    border-radius: 9px;
  }
}

.empty-state { min-height: 250px; padding: 34px; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-state > span { font-size: 28px; color: #90b19c; }
.empty-state h3 { margin: 12px 0 6px; font-size: 16px; }
.empty-state p { max-width: 430px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.empty-state .button-link { margin-top: 18px; padding: 0 20px; height: 42px; min-height: 42px; font-size: 14.5px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; border-radius: 9px; }
.order-list { padding: 6px 12px 14px; }
.order-row { padding: 13px 10px; border-bottom: 1px solid #edf1ee; display: flex; align-items: center; gap: 12px; }
.order-row:last-child { border-bottom: 0; }
.order-main { flex: 1; min-width: 0; }
.order-main strong, .order-main span { display: block; }
.order-main strong { font-size: 15px; }
.order-main span { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: var(--green-dark); background: var(--mint); font-weight: 850; }
.badge { padding: 6px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.badge.ready { color: #216541; background: #e5f5eb; }
.badge.needs_review { color: #9a5e10; background: #fff0d5; }
.badge.duplicate { color: #92400e; background: #fef3c7; border: 1px solid #fcd34d; font-size: 13px; }
.badge.confirmed { color: #285d8c; background: #e9f3fc; }
.badge.ignored { color: #777; background: #eee; }
.steps { list-style: none; margin: 0; padding: 12px 22px 20px; }
.steps li { min-height: 68px; border-bottom: 1px solid #edf1ee; display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; }
.steps li:last-child { border-bottom: 0; }
.steps li > span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #5f7267; background: #ecf1ee; font-size: 13px; font-weight: 800; }
.steps li.done > span { color: white; background: var(--green); }
.steps strong, .steps small { display: block; }
.steps strong { font-size: 15px; }
.steps small { margin-top: 3px; color: var(--muted); font-size: 13px; }
.steps a { color: var(--green); font-size: 13px; font-weight: 800; }

/* 거래처 관리 상단 1줄 등록 및 하단 전체 폭 1업체 1행 고밀도 목록 */
.partner-workspace {
  display: grid;
  gap: 18px;
}
.partner-create-panel {
  padding: 18px 22px;
}
.partner-create-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.partner-create-heading h2 {
  margin: 3px 0 0;
  font-size: 19px;
  font-weight: 850;
}
.partner-create-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}
.partner-create-form,
.partner-create-form-2row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.partner-create-row {
  display: grid;
  gap: 12px;
  align-items: flex-end;
}
.partner-create-row-1 {
  grid-template-columns: minmax(130px, 1.2fr) minmax(100px, 0.9fr) minmax(160px, 1.4fr) minmax(120px, 1fr);
}
.partner-create-row-2 {
  grid-template-columns: minmax(200px, 2.2fr) minmax(160px, 1.6fr) minmax(120px, auto);
}
.partner-create-form label,
.partner-create-form-2row label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 750;
  color: #334a3b;
}
.partner-create-form label span,
.partner-create-form-2row label span {
  display: flex;
  align-items: center;
  gap: 3px;
}
.partner-create-form label strong.req,
.partner-create-form-2row label strong.req {
  color: #e11d48;
}
.partner-create-form input,
.partner-create-form-2row input {
  height: 42px;
  padding: 0 14px;
  font-size: 14px;
  border-radius: 8px;
}
.partner-field-submit {
  display: flex;
  align-items: flex-end;
}
.partner-create-submit {
  height: 42px;
  padding: 0 22px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  width: 100%;
}

.partner-list-panel {
  overflow: hidden;
}
.partner-list-panel .panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.partner-list-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.partner-search-input {
  height: 38px;
  width: 240px;
  max-width: 100%;
  padding: 0 12px;
  font-size: 13.5px;
  border-radius: 8px;
}
.partner-total-count {
  font-size: 13px;
  font-weight: 800;
  color: var(--green-dark);
  background: #eef6f1;
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
}
.partner-table-head {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) minmax(115px, 0.9fr) minmax(200px, 1.8fr) minmax(140px, 1.4fr) 65px;
  gap: 12px;
  padding: 10px 20px;
  background: #f8faf8;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .02em;
  align-items: center;
}
.partner-table-head .col-action {
  text-align: right;
}
.partner-table-body {
  display: flex;
  flex-direction: column;
}
.partner-row-item {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) minmax(115px, 0.9fr) minmax(200px, 1.8fr) minmax(140px, 1.4fr) 65px;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid #edf2ee;
  align-items: center;
  background: #ffffff;
  transition: background 0.12s ease;
}
.partner-row-item:last-child {
  border-bottom: none;
}
.partner-row-item:hover {
  background: #f8fbf9;
}
.partner-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.partner-name-cell .avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--mint);
  color: var(--green-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 850;
  font-size: 13.5px;
}
.partner-name-cell .name-info {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.partner-name-cell strong {
  font-size: 14px;
  font-weight: 800;
  color: #1e293b;
}
.partner-bizno-cell code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 650;
  color: #475569;
  background: #f1f5f9;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid #e2e8f0;
}
.partner-phone-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.partner-phones-cell .phone-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #edf6f0;
  color: #1b4d33;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #cce5d4;
  white-space: nowrap;
}
.partner-phones-cell .phone-badge small {
  color: #059669;
  font-weight: 650;
  font-size: 11px;
}
.partner-notes-cell {
  min-width: 0;
}
.partner-notes-cell .notes-text {
  display: block;
  font-size: 12.5px;
  color: #4b5563;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.partner-action-cell {
  text-align: right;
}
.partner-edit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 29px;
  height: 29px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 750;
  border-radius: 6px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.mobile-col-label {
  display: none;
}
.partner-edit-layout { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(440px, 1.2fr); gap: 22px; align-items: start; }
.partner-edit-panel { overflow: visible; }
.partner-phone-editor { padding: 10px 22px 2px; display: grid; gap: 9px; }
.partner-phone-row { padding: 12px; border: 1px solid #e2e9e4; border-radius: 11px; background: #fbfdfb; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.partner-phone-row > form:first-child { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 8px; align-items: end; }
.partner-phone-row label, .partner-phone-add label { display: grid; gap: 5px; color: #34443a; font-size: 13px; font-weight: 750; }
.partner-phone-row input, .partner-phone-add input { height: 39px; }
.partner-phone-row button { min-height: 39px; padding: 0 13px; }
.partner-phone-add { margin: 18px 22px 24px; padding: 16px; border-radius: 12px; background: #eef6f1; display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 9px; align-items: end; }
.partner-phone-add button { min-height: 42px; }
.product-table { padding: 12px; display: grid; gap: 10px; }
.product-row { padding: 16px; border: 1px solid #e5ebe7; border-radius: 13px; }
.catalog-controls { padding: 14px 16px; border-bottom: 1px solid #edf1ee; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.catalog-search { flex: 1; display: flex; gap: 8px; }
.catalog-search input { max-width: 420px; }
.catalog-search button { min-height: 42px; padding: 0 16px; }
.clear-search { align-self: center; color: var(--muted); font-size: 13px; font-weight: 700; }
.details-actions { display: flex; gap: 6px; }
.details-actions button { min-height: 34px; padding: 0 11px; color: #52645a; background: #edf2ee; font-size: 12px; }
.compact-products { gap: 7px; }
.product-disclosure { padding: 0; overflow: hidden; background: #fff; }
.product-disclosure > summary { min-height: 68px; padding: 12px 15px; cursor: pointer; list-style: none; display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(160px, 1.4fr) auto 66px; gap: 14px; align-items: center; }
.product-disclosure > summary::-webkit-details-marker { display: none; }
.product-disclosure > summary:hover { background: #f8faf8; }
.product-disclosure[open] > summary { border-bottom: 1px solid #e6ece8; background: #f7faf8; }
.product-summary-main strong, .product-summary-main small { display: block; }
.product-summary-main strong { font-size: 15px; }
.product-summary-main small { margin-top: 5px; color: var(--muted); font-size: 12px; }
.alias-preview { min-width: 0; display: flex; align-items: center; gap: 5px; overflow: hidden; }
.alias-preview span, .alias-preview em { flex: 0 0 auto; padding: 5px 7px; border-radius: 7px; color: #3b5947; background: #edf5f0; font-size: 12px; font-style: normal; }
.alias-preview em { color: var(--muted); background: #f1f3f1; }
.product-counts { display: flex; gap: 12px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.product-counts strong { color: var(--green-dark); }
.disclosure-label { color: var(--green); font-size: 12px; font-weight: 800; text-align: right; }
.disclosure-label b { display: inline-block; margin-left: 5px; transition: transform .18s ease; }
.product-disclosure[open] .disclosure-label b { transform: rotate(180deg); }
.product-detail-body { padding: 16px; background: #fcfdfc; }
.detail-heading { margin-bottom: 9px; display: flex; align-items: baseline; gap: 9px; }
.detail-heading strong { font-size: 13px; }
.detail-heading small { color: var(--muted); font-size: 12px; }
.detail-heading.alias-heading { margin-top: 18px; }
.alias-add-form { padding-top: 10px; border-top: 1px dashed #dce5df; }
.pagination { padding: 8px 16px 18px; display: flex; justify-content: center; gap: 6px; }
.pagination a { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 8px; color: var(--muted); background: #f0f3f1; display: grid; place-items: center; font-size: 13px; font-weight: 750; }
.pagination a.active { color: white; background: var(--green); }
.product-edit-form { display: block; }
.product-edit-form input { height: 36px; font-size: 14px; font-weight: 650; }
.product-edit-form button { min-height: 36px; padding: 0 12px; font-size: 13px; }
.product-fields-grid { display: grid; grid-template-columns: 1.4fr .8fr .8fr .8fr .75fr; gap: 7px; }
.product-fields-grid label, .price-entry-grid label { display: grid; gap: 6px; color: #4c5b52; font-size: 12px; font-weight: 750; }
.product-fields-grid select { height: 36px; font-size: 14px; }
.price-entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.price-entry-grid input { text-align: right; }
.price-heading { margin-top: 18px; }
.product-price-grid { max-width: 720px; }
.product-save-button { margin-top: 10px; }
.price-summary { display: grid; gap: 4px; }
.price-history { margin-top: 13px; border: 1px solid #e4ebe6; border-radius: 9px; background: white; }
.price-history > summary { padding: 10px 12px; cursor: pointer; color: var(--green); font-size: 12px; font-weight: 750; }
.price-history > div { padding: 0 12px 8px; }
.price-history p { margin: 0; padding: 8px 0; border-top: 1px solid #edf1ee; display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; font-size: 12px; }
.price-history p span, .price-history p small { color: var(--muted); }

/* ==========================================================================
   단위 설정 화면 분할 레이아웃 (Split Layout: 좌측 3열 목록 + 우측 사이드 패널)
   ========================================================================== */
.unit-split-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
}

/* [좌측 메인 패널: 사용 가능한 단위 목록] */
.unit-master-panel {
  flex: 1 1 0%;
  min-width: 0;
  padding: 20px 22px;
  background: var(--bg-panel, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
}

.unit-master-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 12px;
}

.unit-master-head h2 {
  margin: 3px 0 0;
  font-size: 19px;
  font-weight: 850;
  color: #0f172a;
}

.unit-badge-count {
  font-size: 12.5px;
  color: #475569;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.unit-badge-count strong {
  color: #1e7e48;
  font-weight: 850;
}

/* [단위 목록 그리드: PC 3열 기본 -> 2열 -> 1열 반응형] */
.unit-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 4px 0 8px;
}

/* [우측 사이드 패널: 새 단위 등록 (PC 분할 화면 기본 배치, Sticky)] */
.unit-side-panel {
  flex: 0 0 380px;
  width: 380px;
  position: sticky;
  top: 16px;
  padding: 22px 24px;
  background: var(--bg-panel, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.unit-side-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 12px;
}

.unit-side-header h2 {
  margin: 3px 0 0;
  font-size: 18px;
  font-weight: 850;
  color: #0f172a;
}

.unit-side-desc {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12.5px;
  line-height: 1.5;
}

.unit-side-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.unit-side-form .field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unit-side-form .field-group span {
  font-size: 12.5px;
  font-weight: 800;
  color: #334a3b;
}

.unit-side-form .field-group input {
  height: 40px;
  padding: 0 12px;
  font-size: 13.5px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  box-sizing: border-box;
}

.unit-side-form .field-group input:focus {
  background: #ffffff;
  border-color: #1f6f4a;
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 111, 74, 0.12);
}

.unit-side-form .field-tip {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.45;
}

.unit-side-actions {
  margin-top: 4px;
}

.unit-create-submit {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  font-size: 14.5px;
  font-weight: 850;
  border-radius: 8px;
}

.unit-create-submit .pc-text {
  display: inline;
}

.unit-create-submit .mobile-text {
  display: none;
}

.unit-guide-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  color: #475569;
}

.unit-guide-card h4 {
  margin: 0 0 6px 0;
  font-size: 12.5px;
  font-weight: 800;
  color: #1e293b;
}

.unit-guide-card ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.6;
}

/* [반응형 미디어 쿼리: 3열 -> 2열] */
@media (max-width: 1450px) {
  .unit-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* [모바일 & 태블릿 반응형: 새 단위 등록을 최상단으로 올리고 텍스트 및 폼 컴팩트화] */
@media (max-width: 1050px) {
  .unit-split-layout {
    flex-direction: column;
    gap: 14px;
  }
  .unit-side-panel {
    order: -1; /* 모바일에서 맨 위로 노출 */
    width: 100%;
    flex: 1 1 100%;
    position: static;
    padding: 14px 16px;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  }
  .unit-master-panel {
    order: 1;
    padding: 16px 14px;
  }
  .unit-side-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    margin-bottom: 2px;
  }
  .unit-side-header h2 {
    font-size: 15px;
    margin: 0;
  }
  .unit-side-panel .mobile-hide-desc,
  .unit-master-panel .mobile-hide-desc {
    display: none !important;
  }
  .unit-create-submit .pc-text {
    display: none;
  }
  .unit-create-submit .mobile-text {
    display: inline;
  }
  .unit-list {
    grid-template-columns: 1fr;
  }
}

/* [스마트폰 모바일: 손으로 빠르고 간결하게 등록할 수 있는 1행 가로 그리드] */
@media (max-width: 680px) {
  .unit-list {
    grid-template-columns: 1fr;
  }
  .unit-side-form {
    display: grid;
    grid-template-columns: minmax(75px, 1fr) minmax(110px, 1.4fr) auto;
    gap: 8px;
    align-items: center;
  }
  .unit-side-form .field-group {
    gap: 0;
    margin: 0;
  }
  .unit-side-form .field-group input {
    height: 38px;
    font-size: 13px;
    padding: 0 10px;
  }
  .unit-side-actions {
    margin-top: 0;
  }
  .unit-create-submit {
    height: 38px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 850;
    white-space: nowrap;
    width: auto !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .unit-side-panel {
    padding: 12px;
    gap: 8px;
  }
  .unit-side-form {
    grid-template-columns: minmax(65px, 1fr) minmax(95px, 1.3fr) auto;
    gap: 6px;
  }
  .unit-side-form .field-group input {
    height: 36px;
    font-size: 12.5px;
    padding: 0 8px;
  }
  .unit-create-submit {
    height: 36px;
    padding: 0 10px;
    font-size: 12.5px;
  }
}

.unit-row {
  padding: 5px 8px;
  min-height: 42px;
  border: 1px solid #e1ece5;
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  grid-template-columns: 66px 1fr 48px 36px;
  gap: 6px;
  align-items: center;
  transition: all 0.12s ease;
}
.unit-row:hover {
  border-color: var(--green);
  box-shadow: 0 2px 6px rgba(31, 111, 74, 0.08);
  background-color: #fbfdfc;
}
.unit-row.inactive {
  opacity: .55;
  background: #f6f8f6;
}
.unit-row input {
  height: 34px;
  padding: 0 8px;
  font-size: 13px;
  border-radius: 6px;
}
.unit-field-name input {
  font-weight: 800;
  text-align: center;
}
.unit-save-btn {
  height: 34px;
  min-height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  font-size: 13px;
  font-weight: 800;
  border: 1px solid #b8dfc7;
  border-radius: 6px;
  box-sizing: border-box;
  white-space: nowrap;
}
.unit-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 38px;
  height: 22px;
  flex: 0 0 38px;
  cursor: pointer;
  user-select: none;
}
.unit-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}
.unit-switch .switch-slider {
  position: absolute;
  inset: 0;
  background-color: #cbd5e1;
  border-radius: 22px;
  transition: background-color 0.2s ease;
}
.unit-switch .switch-slider::before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.unit-switch input:checked + .switch-slider {
  background-color: var(--green);
}
.unit-switch input:checked + .switch-slider::before {
  transform: translateX(16px);
}
.unit-switch input:focus-visible + .switch-slider {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.mobile-field-label {
  display: none;
}

.alias-editor { margin: 13px 0; display: grid; gap: 7px; }
.alias-edit-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.alias-edit-row > form:first-child { display: grid; grid-template-columns: 1.1fr 1fr auto; gap: 7px; }
.alias-edit-row input, .alias-edit-row select { height: 34px; font-size: 13px; }
.alias-edit-row button { padding: 0 11px; color: var(--green-dark); background: var(--mint); font-size: 13px; }
.danger-ghost { height: 34px; padding: 0 11px; color: var(--red) !important; background: var(--red-bg) !important; }

.connection-hero { margin-bottom: 22px; padding: 24px 26px; border-radius: 16px; color: white; background: linear-gradient(120deg, #1a3a28, #276746); display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow); }
.connection-hero .section-kicker { color: #99d5b0; }
.connection-hero h2 { margin: 7px 0 6px; font-size: 21px; }
.connection-hero p { margin: 0; color: #bdd1c5; font-size: 15px; }
.connection-state { padding: 8px 11px; border-radius: 999px; color: #d8e7de; background: rgba(255,255,255,.1); font-size: 13px; font-weight: 750; }
.connection-state.online { color: #153b26; background: #9de3b7; }
.check-row { grid-template-columns: 20px 1fr !important; align-items: start; }
.check-row input { width: 17px; height: 17px; margin-top: 2px; }
.check-row span strong, .check-row span small { display: block; }
.config-summary { padding: 13px; border-radius: 11px; background: #f3f7f4; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.config-summary div { padding: 4px; border-right: 1px solid #dfe7e1; }
.config-summary div:last-child { border-right: 0; }
.config-summary span, .config-summary strong { display: block; }
.config-summary span { color: var(--muted); font-size: 12px; }
.config-summary strong { margin-top: 5px; color: var(--green-dark); font-size: 14px; }
.sensitive-note { margin: 0 22px 22px; padding: 14px; border: 1px solid #f0d5a9; border-radius: 10px; color: #76501f; background: #fff8ec; }
.sensitive-note strong { font-size: 14px; }
.sensitive-note p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }
.device-meta {
  margin: 0 22px 22px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f5f7f5;
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px 14px;
  font-size: 13px;
  align-items: baseline;
}
.device-meta span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.device-meta code {
  color: var(--green-dark);
  word-break: break-all;
  overflow-wrap: anywhere;
  font-size: 12.5px;
}
.device-meta strong {
  word-break: break-all;
  font-size: 13px;
}
.smsgate-prep-body { padding: 20px 22px 22px; display: grid; gap: 16px; }
.smsgate-prep-action { display: inline-flex; align-items: center; justify-content: center; }
.smsgate-setup { margin-top: 22px; }
.smsgate-fields { padding: 20px 22px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.smsgate-fields > label { display: grid; gap: 7px; color: #34443a; font-size: 14px; font-weight: 750; }
.smsgate-key-action { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 12px; }
.smsgate-key-action > span { color: #34443a; font-size: 14px; font-weight: 750; }
.smsgate-key-action > strong { color: var(--green-dark); font-size: 14px; }
.smsgate-key-action form { grid-column: 1 / -1; }
.smsgate-key-action button { width: 100%; min-height: 40px; }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.copy-field input { min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.copy-field button { min-width: 92px; padding: 0 13px; color: white; background: var(--green); font-size: 13px; }
.smsgate-events { margin: 16px 22px; padding: 14px; border-radius: 11px; color: #395344; background: #f0f6f2; }
.smsgate-events strong { display: block; margin-bottom: 9px; font-size: 14px; }
.smsgate-events div { display: flex; flex-wrap: wrap; gap: 7px; }
.smsgate-events code { padding: 5px 8px; border: 1px solid #d9e8dd; border-radius: 7px; color: var(--green-dark); background: white; font-size: 13px; }
.one-time-key-panel { max-width: 920px; margin: 0 auto; padding-bottom: 22px; }
.one-time-key-panel > .notice { margin: 0 22px; }
.one-time-key-fields { grid-template-columns: 1fr; }
.one-time-key-actions { padding: 0 22px; display: flex; justify-content: flex-end; }
.one-time-key-actions a { min-height: 40px; padding: 0 16px; border-radius: 9px; background: #eff3f0; display: inline-grid; place-items: center; }
.install-guide { margin-top: 22px; }
.install-guide ol { list-style: none; margin: 0; padding: 22px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.install-guide li { min-height: 110px; padding: 15px; border: 1px solid #e1e8e3; border-radius: 12px; display: flex; gap: 11px; }
.install-guide li > span { flex: 0 0 auto; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: white; background: var(--green); font-size: 13px; font-weight: 800; }
.install-guide strong { font-size: 14px; }
.install-guide p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.smsgate-guide ol { grid-template-columns: repeat(3, 1fr); }
.smsgate-guide-notice { margin-bottom: 0; }
@media (max-width: 700px) {
  .smsgate-fields { grid-template-columns: 1fr; padding: 16px; }
  .smsgate-events { margin: 14px 16px; }
  .smsgate-setup .sensitive-note { margin: 0 16px 16px; }
  .copy-field { grid-template-columns: minmax(0, 1fr); }
  .copy-field button { min-height: 40px; }
}
.telegram-grid { grid-template-columns: minmax(320px, .75fr) minmax(0, 1.25fr); }
.telegram-column { display: grid; gap: 22px; }
.telegram-actions { padding: 0 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.telegram-actions form, .telegram-actions button { width: 100%; }
.telegram-actions button { min-height: 40px; }
.telegram-settings .sensitive-note { margin: 0; }
.telegram-guide { margin-top: 0; }
.telegram-guide ol { grid-template-columns: repeat(2, 1fr); }
.bot-usage { margin: 0 22px 22px; padding: 15px; border-radius: 11px; color: #395344; background: #f0f6f2; }
.bot-usage strong { font-size: 14px; }
.bot-usage p { margin: 8px 0 0; font-size: 14px; }
.bot-usage code { padding: 3px 6px; border-radius: 5px; background: white; color: var(--green-dark); }

.orders-nav-box { margin-bottom: 24px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.orders-nav-top { display: grid; grid-template-columns: minmax(430px, auto) minmax(520px, 1fr); gap: 28px; align-items: center; }
.date-toolbar { min-width: 0; display: flex; align-items: center; gap: 10px; }
.date-stepper { min-width: 0; display: flex; align-items: center; gap: 8px; }
.date-step { flex: 0 0 auto; height: 42px; padding: 0 13px; border: 1px solid #c9d8cf; border-radius: 10px; color: var(--green-dark); background: #f4faf6; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 800; white-space: nowrap; }
.date-step:hover { border-color: #8fbaa0; background: var(--mint); }
.date-step span { font-size: 20px; font-weight: 500; line-height: 1; }
.date-picker-field { min-width: 174px; display: flex; align-items: center; }
.date-picker-field > span { display: none; }
.date-picker-field input { width: 174px; height: 42px; padding-inline: 11px; border-radius: 10px; background: white; font-size: 14px; font-weight: 800; cursor: pointer; }
.quick-date-links { flex: 0 0 auto; height: 42px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #f3f6f4; display: flex; gap: 2px; }
.quick-date-links a { min-width: 45px; padding: 0 10px; border-radius: 7px; color: var(--muted); display: grid; place-items: center; font-size: 13px; font-weight: 750; white-space: nowrap; }
.quick-date-links a:hover { color: var(--green-dark); background: white; }
.quick-date-links a.active { color: white; background: var(--green); box-shadow: 0 2px 5px rgba(31,111,74,.2); }
.orders-summary { min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(76px, 1fr)) repeat(2, minmax(108px, 1.25fr)); align-items: stretch; }
.orders-summary-item { min-width: 0; padding: 5px 12px; border-left: 1px solid #e6ece8; text-align: center; display: grid; align-content: center; gap: 5px; }
.orders-summary-item:first-child { border-left: 0; }
.orders-summary-item span { color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.orders-summary-item strong { font-size: 16px; letter-spacing: -.03em; white-space: nowrap; }
.orders-summary-item.needs-attention strong { color: var(--red); }
.orders-summary-item.amount strong,
.orders-summary-item.amount-item strong { font-size: 17px; font-weight: 850; }
.orders-summary-item.total strong { color: #2563eb; }
.orders-summary-item.confirmed strong { color: #059669; }

/* 거래명세서 일괄 인쇄 버튼 (주문별 보기 탭 바로 옆 배치) */
.orders-view-header-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  flex-wrap: wrap;
}
.orders-view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 2px;
}
.batch-print-btn {
  height: 38px;
  min-height: 38px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 850;
  color: #ffffff !important;
  background: linear-gradient(180deg, #227b4f 0%, #175e39 100%);
  border: 1px solid #134e2f;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none !important;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(23, 94, 57, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.batch-print-btn:hover {
  background: linear-gradient(180deg, #298d5a 0%, #1b6c42 100%);
  box-shadow: 0 4px 10px rgba(23, 94, 57, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  color: #ffffff !important;
}
.batch-print-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(23, 94, 57, 0.2);
}
.batch-print-btn .btn-icon {
  font-size: 15px;
}
.batch-print-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
html[data-theme="dark"] .batch-print-btn {
  background: linear-gradient(180deg, #1f6f47 0%, #155734 100%);
  border-color: #0d3821;
}
.batch-print-all-btn {
  height: 44px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 750;
  color: #21613d !important;
  background: #f4faf6;
  border: 1.5px solid #b7d6c2;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}
.batch-print-all-btn:hover {
  background: #e6f4ec;
  border-color: #1e5837;
  color: #0e3d23 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}


/* 거래처별 보기 탭 상단 헤더 액션 바 */
.partner-view-header-strip {
  margin-bottom: 16px;
  padding: 12px 18px;
  background: #ffffff;
  border: 1px solid #dce5df;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.partner-view-header-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.partner-view-header-title strong {
  font-size: 14.5px;
  font-weight: 800;
  color: #173f28;
}
.partner-view-header-title span {
  font-size: 12px;
  color: #64748b;
}

/* 툴팁 및 도움말 버블 스타일 */
.summary-label-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.help-tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.help-tooltip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  min-width: 15px;
  min-height: 15px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #94a3b8;
  background: white;
  color: #475569;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: all 0.15s ease;
  vertical-align: middle;
}
.help-tooltip-btn:hover,
.help-tooltip-btn:focus-visible,
.help-tooltip-wrap.is-open .help-tooltip-btn {
  border-color: #2563eb;
  background: #2563eb;
  color: white;
  outline: none;
}
.amount-item.confirmed .help-tooltip-btn:hover,
.amount-item.confirmed .help-tooltip-btn:focus-visible,
.amount-item.confirmed .help-tooltip-wrap.is-open .help-tooltip-btn {
  border-color: #10b981;
  background: #10b981;
  color: white;
}
.help-tooltip-bubble {
  position: absolute;
  bottom: calc(100% + 10px);
  z-index: 120;
  width: 245px;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 12px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #1e293b;
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
  box-shadow: 0 12px 28px -4px rgba(15, 23, 42, 0.16), 0 4px 10px -2px rgba(15, 23, 42, 0.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  word-break: break-word;
  overflow-wrap: break-word;
}
.help-tooltip-bubble * {
  box-sizing: border-box;
}
.amount-item.total .help-tooltip-bubble {
  border-color: #bfdbfe;
}
.amount-item.confirmed .help-tooltip-bubble {
  border-color: #bbf7d0;
}
.help-tooltip-bubble .bubble-title {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 5px;
  color: #1d4ed8;
  word-break: break-word;
  overflow-wrap: break-word;
}
.amount-item.confirmed .help-tooltip-bubble .bubble-title {
  color: #15803d;
}
.help-tooltip-bubble .bubble-desc {
  margin: 0 0 6px;
  font-size: 12px;
  color: #334155;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: break-word;
}
.help-tooltip-bubble .bubble-desc strong {
  color: #0f172a;
  font-weight: 750;
  word-break: break-word;
  overflow-wrap: break-word;
}
.help-tooltip-bubble .bubble-list {
  margin: 0;
  padding-left: 14px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.5;
}
.help-tooltip-bubble .bubble-list li {
  margin-bottom: 2px;
}
/* 말풍선 꼬리표: 테두리 있는 화이트 삼각형 */
.help-tooltip-bubble::before {
  content: "";
  position: absolute;
  top: 100%;
  border-width: 7px;
  border-style: solid;
  border-color: #cbd5e1 transparent transparent transparent;
}
.amount-item.total .help-tooltip-bubble::before {
  border-color: #bfdbfe transparent transparent transparent;
}
.amount-item.confirmed .help-tooltip-bubble::before {
  border-color: #bbf7d0 transparent transparent transparent;
}
.help-tooltip-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  border-width: 6px;
  border-style: solid;
  border-color: #ffffff transparent transparent transparent;
}
.help-tooltip-bubble.align-left {
  left: 50%;
  transform: translateX(-35%) translateY(6px);
}
.help-tooltip-bubble.align-left::before {
  left: 35%;
  transform: translateX(-50%);
}
.help-tooltip-bubble.align-left::after {
  left: 35%;
  transform: translateX(-50%);
  margin-top: -1.5px;
}
.help-tooltip-bubble.align-right {
  right: -6px;
  left: auto;
  transform: translateY(6px);
}
.help-tooltip-bubble.align-right::before {
  right: 12px;
}
.help-tooltip-bubble.align-right::after {
  right: 13px;
  margin-top: -1.5px;
}
.help-tooltip-wrap:hover .help-tooltip-bubble,
.help-tooltip-btn:focus-visible + .help-tooltip-bubble,
.help-tooltip-wrap.is-open .help-tooltip-bubble {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.help-tooltip-wrap:hover .help-tooltip-bubble.align-left,
.help-tooltip-btn:focus-visible + .help-tooltip-bubble.align-left,
.help-tooltip-wrap.is-open .help-tooltip-bubble.align-left {
  transform: translateX(-35%) translateY(0);
}
.help-tooltip-wrap:hover .help-tooltip-bubble.align-right,
.help-tooltip-btn:focus-visible + .help-tooltip-bubble.align-right,
.help-tooltip-wrap.is-open .help-tooltip-bubble.align-right {
  transform: translateY(0);
}

.orders-control-row { margin-top: 20px; padding-top: 16px; border-top: 1px solid #e6ece8; display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.orders-view-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.orders-view-tabs a { min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #f7f9f7; display: inline-flex; align-items: center; font-size: 13px; font-weight: 800; white-space: nowrap; }
.orders-view-tabs a:hover { color: var(--green-dark); border-color: #aacbb7; }
.orders-view-tabs a.active { color: white; border-color: #1e293b; background: #1e293b; }
.partner-order-filter { min-width: 220px; margin-left: auto; display: grid; grid-template-columns: minmax(110px, .85fr) minmax(150px, 1.15fr); gap: 5px 7px; }
.partner-order-filter label { color: var(--muted); font-size: 12px; font-weight: 800; }
.partner-order-filter label { grid-column: 1 / -1; }
.partner-order-filter input,
.partner-order-filter select { height: 38px; background-color: white; font-size: 14px; font-weight: 750; }
.partner-order-filter select { padding-right: 34px; }
.partner-group-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.partner-group-title h2 { margin: 0; font-size: 1.25rem; }
.statement-link { min-height: 30px; padding: 0 10px; border: 1px solid #9fc8ae; border-radius: 7px; color: var(--green-dark); background: #f1faf4; display: inline-flex; align-items: center; font-size: 13px; font-weight: 800; white-space: nowrap; }
.statement-link:hover { color: white; border-color: var(--green); background: var(--green); }
.orders-view-tabs { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
.orders-view-tabs a { min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #f7f9f7; display: inline-flex; align-items: center; font-size: 13px; font-weight: 800; white-space: nowrap; }
.orders-view-tabs a:hover { color: var(--green-dark); border-color: #aacbb7; }
.orders-view-tabs a.active { color: white; border-color: #1e293b; background: #1e293b; }
.order-status-filter { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.order-status-filter a { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: white; display: inline-flex; align-items: center; font-size: 13.5px; font-weight: 800; white-space: nowrap; }
.order-status-filter a.active { color: white; border-color: #2563eb; background: #2563eb; }
.order-status-filter a.active.review { border-color: #b94a48; background: #b94a48; }
.order-status-filter a.active.duplicate { border-color: #d97706; background: #d97706; color: white; }
.order-status-filter a.active.ready { border-color: #248259; background: #248259; }
.order-status-filter a.active.confirmed { border-color: #475569; background: #475569; }
.tab-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; font-size: 13px; font-weight: 800; line-height: 1; }
.tab-badge.duplicate-badge { background: #ef4444; color: white; }
.order-status-filter a.active .tab-badge.duplicate-badge { background: white; color: #d97706; }

.daily-order-sheet-panel { overflow: hidden; }
.daily-order-sheet-head { padding: 20px 22px; border-bottom: 1px solid #e6ece8; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.daily-order-sheet-head h2 { margin: 4px 0 5px; font-size: 18px; }
.daily-order-sheet-head > div > p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.sheet-count { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sheet-count strong { color: var(--ink); font-size: 16px; }
.daily-order-sheet-scroll { overflow-x: auto; }
.daily-order-sheet { width: 100%; min-width: 1320px; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.daily-order-sheet th,
.daily-order-sheet td {
  display: table-cell !important;
  box-sizing: border-box;
}
.daily-order-sheet th { height: 42px; padding: 0 12px; border-bottom: 1px solid #cfdad3; border-right: 1px solid #e4eae6; color: #536158; background: #edf3ef; text-align: center; font-size: 12px; font-weight: 850; white-space: nowrap; }
.daily-order-sheet thead th { text-align: center; }
.mobile-sheet-table thead th.col-sticky-product { text-align: left; }
.daily-order-sheet td { height: 48px; padding: 7px 12px; border-bottom: 1px solid #e7ece8; border-right: 1px solid #eef2ef; background: white; vertical-align: middle; white-space: nowrap; }
.daily-order-sheet tbody tr:hover td { background: #f5faf7; }
.daily-order-sheet .editable-cell { position: relative; }
.daily-order-sheet .editable-cell.editing { z-index: 2; }



.daily-order-sheet .time-cell,
.daily-order-sheet .order-id-cell,
.daily-order-sheet .spec-cell,
.daily-order-sheet .unit-cell,
.daily-order-sheet .status-cell,
.daily-order-sheet .source-cell,
.daily-order-sheet .action-cell { text-align: center; }
.daily-order-sheet .partner-cell,
.daily-order-sheet .product-cell { text-align: left; }
.daily-order-sheet .time-cell { color: var(--muted); font-variant-numeric: tabular-nums; }
.daily-order-sheet .partner-cell strong { font-size: 14px; }
.daily-order-sheet .number-cell { text-align: right; font-variant-numeric: tabular-nums; }
.daily-order-sheet .quantity-cell { color: var(--green-dark); font-size: 14px; font-weight: 900; }
.daily-order-sheet .purchase-price-cell { color: var(--muted); font-variant-numeric: tabular-nums; }
.daily-order-sheet .amount-cell { color: #235ea8; font-weight: 850; }
.daily-order-sheet .margin-cell { text-align: center; font-variant-numeric: tabular-nums; }
.margin-badge { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 12px; font-weight: 800; letter-spacing: -0.02em; }
.margin-badge.profit { color: #166534; background: #dcfce7; border: 1px solid #bbf7d0; }
.margin-badge.loss { color: #991b1b; background: #fee2e2; border: 1px solid #fecaca; }
.margin-badge.neutral { color: #475569; background: #f1f5f9; border: 1px solid #e2e8f0; }
.daily-order-sheet .order-number { color: var(--muted); font-weight: 800; }
.daily-order-sheet td > strong { font-size: 14px; }
.sheet-warning { display: block; margin-top: 3px; color: var(--red); font-size: 11px; font-weight: 800; }
.source-chip { padding: 4px 7px; border-radius: 5px; color: #50635a; background: #eef3f0; font-size: 11px; font-weight: 800; }
.sheet-review-link:hover { background: #dff1e6; }
/* 전체 주문표 인라인 수기 수정 스타일 */
.editable-cell {
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}
.editable-cell:hover {
  background-color: #f0fdf4 !important;
  color: #166534 !important;
  box-shadow: inset 0 0 0 1.5px #22c55e;
}
.editable-cell:hover::after {
  content: ' ✎';
  font-size: 11px;
  color: #15803d;
  opacity: 0.8;
}
.editable-cell.editing {
  padding: 3px !important;
  background-color: #ffffff !important;
}
.inline-edit-input {
  width: 100%;
  height: 34px;
  padding: 0 6px;
  font-size: 13.5px;
  font-weight: 850;
  text-align: right;
  border: 2px solid #16a34a !important;
  border-radius: 6px;
  background: #ffffff !important;
  color: #111827 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25) !important;
  box-sizing: border-box;
}
.editable-cell.saving {
  opacity: 0.5;
  pointer-events: none;
}
.editable-cell.flash-success {
  animation: flashEditSuccess 0.8s ease;
}
@keyframes flashEditSuccess {
  0% { background-color: #bbf7d0 !important; }
  100% { background-color: inherit; }
}
html[data-theme="dark"] .editable-cell:hover {
  background-color: #1e3a29 !important;
  color: #86efac !important;
  box-shadow: inset 0 0 0 1.5px #22c55e;
}
html[data-theme="dark"] .inline-edit-input {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #22c55e !important;
}
/* 웹서비스 전체 금액/숫자 입력창 스피너 화살표 제거 */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}
.daily-order-sheet .sheet-row-review td { background: #fffaf3; }
.daily-order-sheet .sheet-row-review:hover td { background: #fff5e7; }
.daily-order-sheet .sheet-row-muted td { color: #929b95; background: #f6f7f6; text-decoration-color: #aab1ac; }
.daily-order-sheet tfoot td { height: 48px; border-top: 2px solid #9fbbaa; border-bottom: 0; color: var(--green-dark); background: #edf7f1; font-size: 14px; font-weight: 900; }
.daily-order-sheet tfoot td:first-child { text-align: right; }
.mobile-only-sheet { display: none; }
.desktop-only-sheet { display: block; }
.orders-head { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; }
.orders-head > p { margin: 0; color: var(--muted); font-size: 15px; }
.legend { display: flex; gap: 7px; }
.orders-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.order-card { border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow); overflow: hidden; }
.order-card > header { padding: 16px 18px; border-bottom: 1px solid #edf1ee; display: flex; align-items: center; gap: 11px; }
.order-card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.order-card header span:not(.badge):not(.order-number-badge) { color: var(--muted); font-size: 12px; }
.order-card header h2 { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.3; }
.order-number-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8 !important;
  font-size: 0.92rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
html[data-theme="dark"] .order-number-badge {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.4);
  color: #93c5fd !important;
}
.message-box {
  margin: 14px 18px;
  padding: 12px 14px;
  border-left: 3.5px solid var(--green);
  border-radius: 4px 10px 10px 4px;
  background: #f6f9f7;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.message-box > span, .parsed-items > .label { color: var(--green); font-size: 11px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.message-box p {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: #17281f;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.message-box small { color: #909b94; font-size: 12px; }
.parsed-items { padding: 0 18px 14px; }
.parsed-row { min-height: 55px; border-bottom: 1px solid #edf1ee; display: grid; grid-template-columns: 1fr auto 42px; gap: 12px; align-items: center; }
.parsed-row strong, .parsed-row small { display: block; }
.parsed-row strong { font-size: 14px; }
.parsed-row strong em { margin-left: 5px; padding: 3px 6px; border-radius: 5px; color: var(--red); background: var(--red-bg); font-size: 11px; font-style: normal; }
.parsed-row small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.quantity { font-size: 16px; font-weight: 800; }
.quantity span { color: var(--muted); font-size: 12px; }
.quantity small { display: block; margin-top: 4px; color: var(--green-dark); font-size: 11px; }
.confidence { color: var(--green); font-size: 12px; font-weight: 800; text-align: right; }
.unmatched-item { margin: 8px 0; padding: 8px; border: 1px solid #efc5c5; border-radius: 9px; background: #fff8f8; grid-template-columns: 1fr auto minmax(120px, auto); }
.excluded-item { background: #f7f8f7; }
.excluded-item > div:first-child, .excluded-item > .quantity { opacity: .55; text-decoration: line-through; }
.unmatched-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.unmatched-actions a, .unmatched-actions button { min-height: 30px; padding: 0 8px; border-radius: 7px; color: var(--red); background: var(--red-bg); display: inline-flex; align-items: center; font-size: 11px; font-weight: 800; }
.unmatched-actions form { display: flex; }
.excluded-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; opacity: 1; text-decoration: none; }
.restore-item-button { min-height: 30px; padding: 0 9px; border: 1px solid #c6d9cc; border-radius: 7px; color: var(--green-dark); background: var(--mint); font-size: 11px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.restore-item-button:hover { background: #dff1e6; }
.unresolved { margin-top: 9px; padding: 12px; color: var(--amber); background: var(--amber-bg); font-size: 14px; }
.parser-note { margin: 0 18px 16px; padding: 12px; border-radius: 10px; background: #f7f8f7; display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; font-size: 12px; }
.parser-note strong { color: var(--green); }
.parser-note span { color: var(--muted); }
.parser-note em { color: #748178; font-style: normal; }
.order-card footer { padding: 14px 18px; border-top: 1px solid #edf1ee; display: flex; justify-content: flex-end; gap: 8px; }
.partner-order-groups { display: grid; gap: 18px; }
.partner-order-group { overflow: hidden; }
.order-card > .partner-order-group-head { padding: 18px 22px; justify-content: space-between; gap: 20px; background: #f8faf8; }
.partner-order-identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.partner-order-identity .avatar { width: 42px; height: 42px; font-size: 16px; }
.partner-order-identity small { color: var(--muted); font-size: 13px; }
.partner-order-status { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; }
.partner-order-status > strong { color: #2563eb; font-size: 19px; }
.partner-order-summary { padding: 20px 22px 22px; }
.partner-order-summary-title { margin-bottom: 12px; display: flex; align-items: baseline; gap: 10px; }
.partner-order-summary-title strong { font-size: 14px; }
.partner-order-summary-title span { color: var(--muted); font-size: 12px; }
.partner-order-summary-scroll { overflow-x: auto; }
.partner-order-summary table { width: 100%; min-width: 760px; border: 1px solid #dce5df; border-collapse: separate; border-spacing: 0; border-radius: 10px; overflow: hidden; font-size: 13px; }
.partner-order-summary th { height: 38px; padding: 0 11px; border-bottom: 1px solid #d5e0d9; color: #56675d; background: #eef4f0; text-align: left; font-size: 12px; font-weight: 850; white-space: nowrap; }
.partner-order-summary td { height: 47px; padding: 7px 11px; border-bottom: 1px solid #e8ede9; background: white; white-space: nowrap; }
.partner-order-summary tr:last-child td { border-bottom: 0; }
.partner-order-summary td:first-child strong, .partner-order-summary td:first-child small { display: block; }
.partner-order-summary td:first-child small { margin-top: 3px; color: var(--green); font-size: 11px; }
.partner-order-summary .summary-item-review td { background: #fffaf3; }
.partner-order-summary .summary-quantity { color: var(--green-dark); font-size: 15px; font-weight: 900; }
.partner-order-summary .summary-amount { color: #2563eb; font-weight: 850; }
.partner-summary-empty { height: 80px !important; color: var(--muted); text-align: center; }
.partner-order-details { border-top: 1px solid #e2e9e4; }
.partner-order-details > summary { min-height: 64px; padding: 10px 22px; background: #f6faf7; display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.partner-order-details > summary::-webkit-details-marker { display: none; }
.partner-order-details > summary small { flex: 1; color: var(--muted); font-size: 12px; font-weight: 500; }
.detail-toggle-label { min-height: 36px; padding: 0 13px; border: 1px solid #87bda0; border-radius: 9px; color: var(--green-dark); background: white; box-shadow: 0 1px 2px rgba(23, 70, 45, 0.08); display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 850; transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.partner-order-details > summary:hover .detail-toggle-label { border-color: var(--green); color: white; background: var(--green); box-shadow: 0 4px 10px rgba(31, 122, 78, 0.18); }
.partner-order-details > summary:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.22); outline-offset: -3px; }
.detail-toggle-label b { font-size: 15px; line-height: 1; transition: transform .18s ease; }
.detail-label-open { display: none; }
.partner-order-details[open] .detail-label-closed { display: none; }
.partner-order-details[open] .detail-label-open { display: inline; }
.partner-order-details[open] .detail-toggle-label { border-color: var(--green); color: white; background: var(--green); }
.partner-order-details[open] .detail-toggle-label b { transform: rotate(180deg); }
.partner-order-detail-list { padding: 16px 22px 22px; background: #f7f9f7; display: grid; gap: 12px; }
.partner-order-detail-card { border: 1px solid #dfe6e1; border-radius: 11px; background: white; overflow: hidden; }
.partner-order-detail-head { min-height: 50px; padding: 9px 14px; border-bottom: 1px solid #edf1ee; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.partner-order-detail-head > div:first-child { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.partner-order-number { color: #526258; font-size: 13px; font-weight: 850; }
.partner-order-detail-head small { color: var(--muted); font-size: 12px; }
.partner-order-actions { display: flex; gap: 6px; }
.partner-order-actions button { min-height: 32px; padding: 0 10px; font-size: 12px; }
.partner-order-detail-card .message-box { margin-top: 12px; }
.context-back-bar { margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f7faf8; display: flex; align-items: center; gap: 10px; }
.context-back-bar span { color: var(--muted); font-size: 13px; }

.purchase-toolbar { margin-bottom: 18px; display: flex; align-items: flex-end; justify-content: space-between; }
.purchase-toolbar h2 { margin: 5px 0; font-size: 20px; }
.purchase-toolbar p { margin: 0; color: var(--muted); font-size: 14px; }
.purchase-toolbar .button-link { display: inline-flex; align-items: center; }
.purchase-table { padding: 8px 18px 4px; }
.purchase-row { min-height: 66px; border-bottom: 1px solid #e8ede9; display: grid; grid-template-columns: minmax(220px, 1.5fr) .7fr .8fr .8fr 1fr; gap: 18px; align-items: center; font-size: 14px; }
.purchase-row:last-child { border-bottom: 0; }
.purchase-row > div:first-child strong, .purchase-row > div:first-child small { display: block; }
.purchase-row > div:first-child strong { font-size: 15px; }
.purchase-row > div:first-child small { margin-top: 4px; color: var(--muted); }
.purchase-header { min-height: 44px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.review-quantity { color: var(--amber); font-weight: 800; }
.final-quantity { color: var(--green-dark); font-size: 20px; font-weight: 850; }
.final-quantity small { color: var(--muted); font-size: 12px; }
.purchase-foot { padding: 15px 18px; border-top: 1px solid #e8ede9; background: #f8faf8; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.purchase-foot a { color: var(--green); font-weight: 800; }

@media (max-width: 1320px) {
  .orders-nav-top { grid-template-columns: 1fr; gap: 17px; }
  .orders-summary { padding-top: 16px; border-top: 1px solid #edf1ee; }
  .orders-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 681px) and (max-width: 1050px) {
  .shell { grid-template-columns: 80px 1fr !important; }
  .sidebar {
    padding: 20px 0 !important;
    width: 80px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .sidebar::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  .sidebar .brand {
    justify-content: center !important;
    align-items: center !important;
    padding: 0 0 16px !important;
    width: 100% !important;
    margin: 0 !important;
  }
  .sidebar .brand > span:not(.brand-mark) {
    display: none !important;
  }
  .sidebar .sidebar-section-title,
  .sidebar .sidebar-tip-box,
  .sidebar nav > div {
    display: none !important;
  }
  .sidebar nav {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 5px !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .sidebar nav a {
    width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    margin: 0 auto !important;
    gap: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 12px !important;
    font-size: 0 !important;
    color: transparent !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    position: relative !important;
    box-shadow: none !important;
    transition: background 0.15s ease, transform 0.15s ease !important;
  }
  .sidebar nav a * {
    font-size: 0 !important;
    color: transparent !important;
  }
  .sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.08) !important;
  }
  .sidebar nav a.active {
    background: #1f6f4a !important;
    box-shadow: 0 4px 12px rgba(31, 111, 74, 0.35) !important;
  }
  .sidebar nav a span {
    width: auto !important;
    font-size: 21px !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #cbd5e1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }
  .sidebar nav a.active span {
    color: #ffffff !important;
  }
  .sidebar-foot {
    width: 100% !important;
    padding: 14px 0 0 !important;
    margin-top: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 6px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
  .sidebar-foot .settings-nav {
    width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    margin: 0 auto !important;
    gap: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0 !important;
    color: transparent !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    position: relative !important;
  }
  .sidebar-foot .settings-nav::before {
    content: '⚙';
    font-size: 20px;
    color: #cbd5e1;
    line-height: 1;
  }
  .sidebar-foot .settings-nav.active {
    background: #1f6f4a !important;
  }
  .sidebar-foot .settings-nav.active::before {
    color: #ffffff;
  }
  .sidebar .tablet-expand-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 48px !important;
    height: 38px !important;
    margin: 0 auto 12px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 9px !important;
    color: #cbd5e1 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
  }
  .sidebar .tablet-expand-button:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
  }
  .sidebar .tablet-expand-button:active {
    transform: scale(0.95);
  }

  .topbar .mobile-menu-button {
    display: grid !important;
  }

  /* --- [태블릿] 펼쳐진 상태 (body.mobile-menu-open) 오버레이 드로어 --- */
  body.mobile-menu-open {
    overflow: hidden !important;
    touch-action: none !important;
  }
  body.mobile-menu-open .mobile-menu-backdrop {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 990 !important;
  }
  body.mobile-menu-open .sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 268px !important;
    height: 100vh !important;
    z-index: 1000 !important;
    align-items: stretch !important;
    padding: 24px 18px 40px !important;
    box-shadow: 18px 0 45px rgba(0, 0, 0, 0.38) !important;
    overflow-y: auto !important;
  }
  body.mobile-menu-open .sidebar .tablet-expand-button {
    display: none !important;
  }
  body.mobile-menu-open .sidebar .mobile-menu-close {
    display: grid !important;
    position: absolute !important;
    top: 18px !important;
    right: 14px !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 9px !important;
    color: #c8d8ce !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: none !important;
    place-items: center !important;
    font-size: 24px !important;
    cursor: pointer !important;
  }
  body.mobile-menu-open .sidebar .brand {
    justify-content: flex-start !important;
    padding: 0 4px 18px !important;
    width: auto !important;
  }
  body.mobile-menu-open .sidebar .brand > span:not(.brand-mark) {
    display: block !important;
  }
  body.mobile-menu-open .sidebar .brand strong {
    font-size: 15px !important;
    color: #ffffff !important;
  }
  body.mobile-menu-open .sidebar .brand small {
    display: block !important;
    color: #9fb5a8 !important;
  }
  body.mobile-menu-open .sidebar .sidebar-section-title {
    display: block !important;
    margin: 1.1rem 0 0.35rem 0.65rem !important;
    font-size: 12px !important;
    color: #8fa397 !important;
    font-weight: 800 !important;
    letter-spacing: 0.05em !important;
  }
  body.mobile-menu-open .sidebar nav > div {
    display: block !important;
  }
  body.mobile-menu-open .sidebar .sidebar-tip-box {
    display: block !important;
    padding: 12px !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    color: #94a3b8 !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border-radius: 8px !important;
    margin: 10px 0 !important;
  }
  body.mobile-menu-open .sidebar nav {
    align-items: stretch !important;
    gap: 4px !important;
  }
  body.mobile-menu-open .sidebar nav a {
    width: 100% !important;
    height: auto !important;
    min-height: 44px !important;
    padding: 10px 14px !important;
    margin: 0 !important;
    font-size: 14px !important;
    color: #abc0b2 !important;
    justify-content: flex-start !important;
    gap: 11px !important;
    border-radius: 9px !important;
  }
  body.mobile-menu-open .sidebar nav a * {
    font-size: inherit !important;
    color: inherit !important;
  }
  body.mobile-menu-open .sidebar nav a span {
    font-size: 18px !important;
    width: 22px !important;
    text-align: center !important;
    color: #8fd0a7 !important;
    display: inline-block !important;
  }
  body.mobile-menu-open .sidebar nav a:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1) !important;
  }
  body.mobile-menu-open .sidebar nav a.active {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.12) !important;
    box-shadow: inset 3px 0 #87cba1 !important;
  }
  body.mobile-menu-open .sidebar nav a.active span {
    color: #ffffff !important;
  }
  body.mobile-menu-open .sidebar nav > .ai-sidebar-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    width: 100% !important;
    gap: 8px !important;
    margin: 4px 0 16px 0 !important;
  }
  body.mobile-menu-open .sidebar .ai-sidebar-btn {
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
  }
  body.mobile-menu-open .sidebar .ai-sidebar-label {
    display: inline-flex !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: inherit !important;
  }
  body.mobile-menu-open .sidebar .ai-sidebar-btn .ai-btn-icon {
    width: 15px !important;
    height: 15px !important;
  }
  body.mobile-menu-open .sidebar-foot {
    align-items: stretch !important;
    padding: 16px 4px 0 !important;
  }
  body.mobile-menu-open .sidebar-logout-form {
    width: 100% !important;
    margin: 0 !important;
  }
  body.mobile-menu-open .sidebar-logout-btn {
    width: 100% !important;
    min-height: 42px !important;
    background: rgba(239, 68, 68, 0.16) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(239, 68, 68, 0.32) !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 750 !important;
    cursor: pointer !important;
  }
  body.mobile-menu-open .mobile-only-block {
    display: block !important;
  }
  body.mobile-menu-open .sidebar-user-card {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 14px !important;
    margin: 0 0 14px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }
  body.mobile-menu-open .user-avatar-mark {
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
    background: #1f6f4a !important;
    color: #fff !important;
    display: grid !important;
    place-items: center !important;
    font-weight: 900 !important;
    font-size: 17px !important;
    flex-shrink: 0 !important;
  }
  body.mobile-menu-open .user-meta-info {
    min-width: 0 !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
  }
  body.mobile-menu-open .user-org-name {
    display: block !important;
    font-size: 14.5px !important;
    font-weight: 750 !important;
    color: #ffffff !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  body.mobile-menu-open .user-sub-text {
    display: block !important;
    font-size: 12.5px !important;
    color: #cbd5e1 !important;
  }
  body.mobile-menu-open .user-role-label {
    color: #86efac !important;
    font-weight: 750 !important;
    margin-left: 4px !important;
  }
  body.mobile-menu-open .sidebar-revert-link {
    display: flex !important;
    align-items: center !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
  }

  /* --- 태블릿 전용 본문 공간 및 탑바 최적화 --- */
  .content {
    padding: 18px 20px 60px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .topbar {
    padding: 14px 20px !important;
    gap: 12px !important;
  }

  /* --- 입금 관리 (Deposits) 태블릿 전용 최적화 --- */
  body.has-deposit-drawer main {
    margin-right: 0 !important;
  }

  .deposit-side-drawer {
    width: min(520px, 86vw) !important;
    max-width: 520px !important;
    z-index: 1060 !important;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.22) !important;
  }

  .deposit-drawer-backdrop {
    display: block !important;
  }

  /* 정산 장부 테이블: 7개 열이 가로 스크롤 없이 한눈에 들어오도록 컴팩트 & 고가독성 패딩 */
  .deposits-table th,
  .deposits-table td {
    padding: 10px 8px !important;
    font-size: 13.5px !important;
  }

  .deposits-table th.th-sortable .th-label-text {
    font-size: 13px !important;
  }

  .deposits-table .hint-pill {
    padding: 2px 7px !important;
    font-size: 12px !important;
  }

  .deposits-table-container .table-header-info {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
  }

  .deposits-table-container .header-search-box {
    width: auto !important;
    min-width: 240px !important;
    flex: 1 1 240px !important;
  }

  /* --- 통합 주문표 (Purchase) 태블릿 최적화 --- */
  .purchase-workspace {
    padding: 16px 18px 60px !important;
  }

  .purchase-toolbar-wrap {
    gap: 10px !important;
    flex-wrap: wrap !important;
  }

  /* --- 주문 확인 (Orders) 태블릿 최적화 --- */
  .orders-nav-top {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .orders-summary {
    padding-top: 14px !important;
    border-top: 1px solid #edf1ee !important;
  }

  .orders-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  /* --- 매입 전표 관리 (Purchase Invoices) 태블릿 최적화 --- */
  body.has-drawer .pi-form-wrapper {
    margin-right: 0 !important;
  }

  .pi-side-drawer {
    width: min(520px, 88vw) !important;
    z-index: 1060 !important;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.22) !important;
  }

  /* 태블릿 상단 영수증 촬영/불러오기 액션바 튜닝 */
  .pi-action-bar {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
  }
  .pi-action-bar .pi-search-form {
    flex: 1 1 240px !important;
    min-width: 200px !important;
  }
  .pi-btn-group.desktop-only {
    display: none !important;
  }
  .pi-btn-group.mobile-only {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    width: auto !important;
  }
  .btn-pi-camera,
  .pi-btn-group.mobile-only .btn-pi-upload,
  .pi-btn-group.mobile-only .btn-pi-manual {
    min-height: 42px !important;
    padding: 0 14px !important;
    font-size: 13.5px !important;
    font-weight: 750 !important;
    white-space: nowrap !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .btn-pi-camera {
    background: linear-gradient(135deg, #059669, #047857) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25) !important;
  }
  .pi-btn-group.mobile-only .btn-pi-upload {
    background: #ffffff !important;
    color: #059669 !important;
    border: 1.5px solid #059669 !important;
    box-shadow: none !important;
  }
  .pi-btn-group.mobile-only .btn-pi-manual {
    background: #f8fafc !important;
    color: #334155 !important;
    border: 1.5px solid #cbd5e1 !important;
  }

  /* --- 거래명세서 (Statements) 태블릿 최적화 --- */
  .batch-statements-workspace {
    width: 100% !important;
    margin: 0 !important;
    padding: 16px 16px 60px !important;
  }

  .toolbar {
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  /* --- 공통 폼 / 2열 레이아웃 태블릿 안정화 --- */
  .two-column, .page-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .partner-edit-layout {
    grid-template-columns: 1fr !important;
  }

  /* --- 마스터 관리자 입점 도매상 관리 (Organizations) 태블릿 최적화 --- */
  .admin-org-table th,
  .admin-org-table td {
    padding: 10px 8px !important;
    font-size: 13px !important;
  }
  .admin-org-table td strong {
    font-size: 13.5px !important;
  }
  .admin-org-table-responsive {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04) !important;
    border: 1.5px solid #cbd5e1 !important;
  }

  /* --- 거래처 관리 (Partners) 태블릿 전용 핏 --- */
  .partner-main-panel {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .partner-card-list {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .partner-list-table-header {
    display: grid !important;
    grid-template-columns: 36px minmax(110px, 1.2fr) 65px 100px minmax(150px, 1.5fr) minmax(90px, 1fr) minmax(80px, 0.9fr) !important;
    gap: 8px !important;
    padding: 10px 12px !important;
    font-size: 13px !important;
    min-width: 680px !important;
  }
  .partner-card-list.view-mode-list .partner-card-item {
    display: grid !important;
    grid-template-columns: 36px minmax(110px, 1.2fr) 65px 100px minmax(150px, 1.5fr) minmax(90px, 1fr) minmax(80px, 0.9fr) !important;
    gap: 8px !important;
    padding: 10px 12px !important;
    min-width: 680px !important;
  }
  .partner-card-list.view-mode-list .card-only-sub {
    display: none !important;
  }
  .partner-card-list.view-mode-list .list-only-col {
    display: block !important;
  }
  .partner-card-list.view-mode-list .partner-col-phones .phone-chip {
    padding: 2px 6px !important;
    font-size: 12px !important;
  }
  body.has-partner-drawer main {
    margin-right: 0 !important;
  }
  .partner-side-drawer {
    width: min(520px, 88vw) !important;
    z-index: 1060 !important;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.22) !important;
  }
  body.has-partner-drawer .partner-drawer-backdrop {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* --- 품목 관리 (Products / Catalog) 태블릿 전용 핏 --- */
  .catalog-workspace {
    --catalog-columns: minmax(170px, 1.8fr) 75px 65px minmax(75px, 0.85fr) minmax(80px, 0.9fr) minmax(80px, 0.9fr) minmax(80px, 0.9fr) minmax(80px, 0.9fr) 170px !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* 1. 상단 검색바 1줄 가로 정렬 */
  .catalog-controls {
    padding: 10px 14px !important;
  }
  .search-bar-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .tax-select-wrapper {
    flex: 0 0 130px !important;
  }
  .catalog-tax-select {
    width: 100% !important;
    height: 40px !important;
    font-size: 13px !important;
  }
  .search-input-wrapper {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  .search-input-wrapper input[type="search"] {
    height: 40px !important;
    font-size: 13.5px !important;
  }
  .search-btn-group {
    flex: 0 0 auto !important;
  }
  .search-btn {
    height: 40px !important;
    padding: 0 16px !important;
    font-size: 13.5px !important;
  }

  /* 2. 테이블 가로 스크롤 전용 프레임 */
  .catalog-table-scroll-frame {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 6px !important;
  }
  .catalog-column-head {
    display: grid !important;
    grid-template-columns: var(--catalog-columns) !important;
    gap: 8px !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    min-width: 860px !important;
    background: #f8faf9 !important;
    border-bottom: 1.5px solid #dce8e0 !important;
  }
  .catalog-rows {
    min-width: 860px !important;
  }
  .catalog-record {
    padding: 8px 14px !important;
    border-bottom: 1px solid #edf2ee !important;
  }
  .mobile-item-summary-bar {
    display: none !important;
  }
  .catalog-record-collapsible {
    display: block !important;
  }
  .catalog-inline-edit {
    display: grid !important;
    grid-template-columns: var(--catalog-columns) !important;
    gap: 8px !important;
    align-items: center !important;
  }
  .catalog-inline-edit .mobile-field-label {
    display: none !important;
  }
  .catalog-inline-edit label {
    min-width: 0 !important;
  }
  .catalog-name {
    min-width: 170px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }
  .catalog-name input {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 75px !important;
    height: 38px !important;
    font-size: 14px !important;
    font-weight: 800 !important;
  }
  .catalog-name small {
    flex: 0 0 auto !important;
    font-size: 11.5px !important;
    white-space: nowrap !important;
  }
  .catalog-inline-edit input,
  .catalog-inline-edit select {
    height: 38px !important;
    font-size: 13.5px !important;
    padding: 0 8px !important;
  }
  .catalog-row-actions {
    display: flex !important;
    gap: 5px !important;
    align-items: center !important;
    grid-column: auto !important;
  }
  .catalog-row-actions button {
    height: 38px !important;
    font-size: 13px !important;
    padding: 0 8px !important;
    white-space: nowrap !important;
  }
  .btn-open-drawer {
    padding: 0 8px !important;
  }

  /* 3. 새 품목 등록 폼 태블릿 전용 안정 배치 */
  .catalog-create {
    padding: 16px 18px !important;
  }
  .catalog-create-row-1 {
    display: grid !important;
    grid-template-columns: minmax(150px, 1.6fr) minmax(85px, 1fr) 75px minmax(85px, 1fr) minmax(85px, 1fr) 90px !important;
    gap: 8px !important;
  }
  .catalog-field-aliases {
    grid-column: 1 / -1 !important;
  }
  .catalog-create-row-2 {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px 12px !important;
  }
  .catalog-field-submit {
    grid-column: auto !important;
    align-self: flex-end !important;
  }
  .catalog-create-submit {
    width: 100% !important;
    height: 40px !important;
  }
  .catalog-create-form-2row input,
  .catalog-create-form-2row select {
    height: 40px !important;
    font-size: 13.5px !important;
  }
  .catalog-create-form-2row .field-header-row {
    font-size: 13px !important;
    gap: 4px !important;
  }

  /* --- 단위 설정 (Units) 태블릿 최적화 --- */
  .unit-split-layout {
    flex-direction: column !important;
    gap: 16px !important;
  }
  .unit-side-panel {
    order: -1 !important;
    width: 100% !important;
    flex: none !important;
    position: static !important;
    padding: 16px 20px !important;
    gap: 10px !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04) !important;
  }
  .unit-side-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-bottom: 8px !important;
    margin-bottom: 4px !important;
  }
  .unit-side-header h2 {
    font-size: 16px !important;
    margin: 0 !important;
  }
  .unit-side-desc,
  .unit-guide-card {
    display: none !important;
  }
  .unit-side-form {
    display: grid !important;
    grid-template-columns: minmax(130px, 1fr) minmax(200px, 2fr) auto !important;
    gap: 10px !important;
    align-items: flex-end !important;
  }
  .unit-side-form .field-group {
    margin: 0 !important;
    gap: 4px !important;
  }
  .unit-side-form .field-group span {
    font-size: 13px !important;
  }
  .unit-side-form .field-group input {
    height: 40px !important;
    font-size: 13.5px !important;
    padding: 0 10px !important;
  }
  .unit-side-form .field-tip {
    display: none !important;
  }
  .unit-side-actions {
    margin: 0 !important;
  }
  .unit-create-submit {
    height: 40px !important;
    padding: 0 16px !important;
    font-size: 13.5px !important;
    white-space: nowrap !important;
  }
  .unit-create-submit .pc-text {
    display: inline !important;
  }
  .unit-create-submit .mobile-text {
    display: none !important;
  }

  .unit-master-panel {
    order: 1 !important;
    width: 100% !important;
    padding: 18px 20px !important;
  }
  .unit-list {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  .unit-row {
    grid-template-columns: 85px 1fr 54px 40px !important;
    gap: 10px !important;
    padding: 8px 12px !important;
    min-height: 46px !important;
  }
  .unit-row input {
    height: 38px !important;
    font-size: 13.5px !important;
  }
  .unit-field-name input {
    font-size: 14px !important;
  }
  .unit-save-btn {
    height: 38px !important;
    min-height: 38px !important;
    font-size: 13px !important;
  }
}

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column, .page-grid { grid-template-columns: 1fr; }
  .partner-edit-layout { grid-template-columns: 1fr; }
  .form-panel { position: static; }
  .orders-grid { grid-template-columns: 1fr; }
  .install-guide ol { grid-template-columns: repeat(2, 1fr); }
  .product-disclosure > summary { grid-template-columns: minmax(140px, 1fr) minmax(130px, 1fr) auto; }
  .product-counts { display: none; }
  .admin-create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  .shell { display: block; max-width: 100vw; overflow-x: hidden; }
  main { max-width: 100vw; overflow-x: hidden; }
  .content { max-width: 100vw; overflow-x: hidden; box-sizing: border-box; }
  body.mobile-menu-open {
    overflow: hidden !important;
    touch-action: none !important;
    -webkit-overflow-scrolling: auto !important;
  }
  .sidebar {
    position: fixed;
    z-index: 50 !important;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    height: 100dvh;
    padding: 20px 16px calc(60px + env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform .22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 20px 0 45px rgba(7, 24, 15, .2);
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
  }
  body.mobile-menu-open .sidebar { transform: translateX(0); }
  .brand { display: flex; justify-content: flex-start; padding: 0 4px 18px; }
  .brand > span:last-child { font-size: initial; }

  .mobile-only-block { display: block !important; }
  .sidebar-user-card {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin: 0 0 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-sizing: border-box;
  }
  .user-avatar-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #1f6f4a;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 17px;
    flex-shrink: 0;
  }
  .user-meta-info {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .user-org-name {
    display: block;
    font-size: 14.5px;
    font-weight: 750;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
  }
  .user-sub-text {
    display: block;
    font-size: 12.5px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .user-name-text {
    color: #cbd5e1;
    font-weight: 550;
  }
  .user-role-label {
    color: #86efac;
    font-weight: 750;
    margin-left: 4px;
    font-size: 11.5px;
  }

  .sidebar nav { width: 100%; display: grid; grid-template-columns: 1fr; gap: 3px; }
  .sidebar nav .sidebar-section-title {
    margin: 12px 0 3px 6px;
    font-size: 11px;
    color: #8fa397;
    letter-spacing: 0.05em;
  }
  .sidebar nav a { min-height: 44px; padding: 10px 12px; font-size: 15px; justify-content: flex-start; display: flex; align-items: center; }
  .sidebar nav a.active { box-shadow: inset 3px 0 #87cba1; background: rgba(255,255,255,.12); }
  .sidebar nav a > span { font-size: 17px; }
  .sidebar-foot { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
  .sidebar-logout-form { margin: 0; width: 100%; }
  .sidebar-logout-btn { width: 100%; min-height: 42px; background: rgba(239, 68, 68, 0.16); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.32); border-radius: 8px; font-size: 14px; font-weight: 750; cursor: pointer; }

  .mobile-menu-close { position: absolute; top: 18px; right: 14px; width: 40px; height: 40px; padding: 0; border-radius: 10px; color: #c8d8ce; background: rgba(255,255,255,.1); display: grid; place-items: center; font-size: 26px; font-weight: 400; border: none; cursor: pointer; }
  .mobile-menu-backdrop {
    position: fixed;
    z-index: 45 !important;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(10, 25, 16, .55);
    opacity: 0;
    pointer-events: none;
    display: block;
    transition: opacity .22s ease;
    touch-action: none !important;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
  body.mobile-menu-open .mobile-menu-backdrop {
    opacity: 1;
    pointer-events: auto;
    touch-action: none !important;
  }
  .mobile-menu-button {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid #d7e0da;
    border-radius: 11px;
    background: white;
    display: grid;
    place-content: center;
    gap: 4px;
    box-shadow: 0 3px 10px rgba(24,48,34,.05);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 10;
  }
  .mobile-menu-button span { width: 20px; height: 2.2px; border-radius: 2px; background: var(--green-dark); display: block; pointer-events: none; }
  .mobile-menu-button:active { background: #f1f5f9; transform: scale(0.96); }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 25;
    right: 0;
    bottom: 0;
    left: 0;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 4px 6px env(safe-area-inset-bottom);
    border-top: 1px solid #dce5df;
    background: rgba(255,255,255,.97);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    box-shadow: 0 -8px 24px rgba(24,48,34,.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .mobile-bottom-nav a,
  .mobile-bottom-nav-btn {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    border-radius: 10px;
    color: #64748b;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 2px;
    padding: 4px 2px;
    background: transparent;
    border: none;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    touch-action: manipulation;
  }
  .mobile-bottom-nav a span,
  .mobile-bottom-nav-btn span { font-size: 20px; line-height: 1; }
  .mobile-bottom-nav a small,
  .mobile-bottom-nav-btn small { font-size: 13px; font-weight: 750; white-space: nowrap; }
  .mobile-bottom-nav a.active { color: var(--green-dark); background: var(--mint); }
  .mobile-bottom-nav a.active::after { content: ""; position: absolute; bottom: 2px; width: 22px; height: 3px; border-radius: 3px; background: var(--green); }
  .mobile-bottom-nav a:active,
  .mobile-bottom-nav-btn:active { background: #f1f5f9; transform: scale(0.96); }

  .impersonation-banner { position: relative; padding: 10px 12px; align-items: stretch; flex-direction: column; gap: 8px; font-size: 13px; }
  .impersonation-banner button { width: 100%; min-height: 38px; }
  .impersonation-banner + .shell .topbar { top: 0 !important; }
  .topbar { padding: 15px 16px; gap: 10px; position: sticky; top: 0 !important; z-index: 20; background: rgba(244,247,244,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .topbar h1 { font-size: 20px; }
  .topbar-heading { min-width: 0; }
  .topbar-heading > div { min-width: 0; }
  .topbar-heading h1, .topbar-heading .eyebrow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .account-area { flex: 0 0 auto; }
  .account-summary { display: none; }
  .content { padding: 16px 12px 85px; }
  .notice { margin: 12px 16px 0; }
  .local-badge { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { min-height: 108px; padding: 15px; }
  .stat-card strong { margin-top: 14px; font-size: 29px; }
  .security-banner { align-items: flex-start; }
  .security-banner a { display: none; }
  .config-summary { grid-template-columns: 1fr; }
  .config-summary div { border-right: 0; border-bottom: 1px solid #dfe7e1; }
  .install-guide ol { grid-template-columns: 1fr; }
  .orders-head { align-items: flex-start; gap: 12px; flex-direction: column; }
  .connection-hero { align-items: flex-start; gap: 18px; flex-direction: column; }
  .inline-form { grid-template-columns: 1fr; gap: 8px; }
  .inline-form input, .inline-form select { height: 40px; font-size: 14px; }
  .inline-form button { height: 40px; min-height: 40px; width: 100%; font-size: 13.5px; }

  /* 거래처 카드 내 추가 전화번호 폼 (모바일 2행 컴팩트 정돈) */
  .partner-phone-inline-form { grid-template-columns: 1fr auto; gap: 8px; }
  .partner-phone-inline-form input[name="phone"] { grid-column: 1 / -1; }
  .partner-phone-inline-form input[name="label"] { grid-column: 1; min-width: 0; }
  .partner-phone-inline-form button { grid-column: 2; width: auto; min-width: 100px; padding: 0 14px; }
  .partner-phone-row { grid-template-columns: 1fr; }
  .partner-phone-row > form:first-child, .partner-phone-add { grid-template-columns: 1fr; }
  .partner-phone-add button, .partner-phone-row button { width: 100%; }
  .product-fields-grid, .price-entry-grid, .unit-row, .alias-edit-row, .alias-edit-row > form:first-child { grid-template-columns: 1fr; }
  .context-back-bar { align-items: flex-start; flex-direction: column; }
  .telegram-guide ol { grid-template-columns: 1fr; }
  .catalog-controls { align-items: stretch; flex-direction: column; }
  .catalog-search { flex-wrap: wrap; }
  .catalog-search input { max-width: none; flex: 1 1 180px; }
  .details-actions button { flex: 1; }
  .product-disclosure > summary { grid-template-columns: 1fr auto; }
  .alias-preview { grid-column: 1 / -1; }
  .disclosure-label { grid-column: 2; grid-row: 1; }
  .purchase-toolbar { align-items: flex-start; gap: 14px; flex-direction: column; }
  .purchase-row { grid-template-columns: 1.4fr .7fr .8fr; }
  .orders-nav-box { padding: 14px 12px; }
  .orders-action-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }
  .action-strip-right {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .batch-print-btn,
  .batch-print-all-btn,
  .partner-view-batch-print {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  .partner-view-header-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .date-toolbar { align-items: stretch; flex-direction: column; gap: 8px; }
  .date-stepper { width: 100%; display: grid; grid-template-columns: auto minmax(130px, 1fr) auto; align-items: center; gap: 6px; }
  .date-picker-field { min-width: 0; display: flex; align-items: center; }
  .date-picker-field input { width: 100%; height: 40px; font-size: 14px; text-align: center; }
  .date-step { height: 40px; padding: 0 10px; font-size: 13.5px; }
  .quick-date-links { width: 100%; height: 38px; }
  .quick-date-links a { flex: 1; font-size: 13px; }

  /* 모바일 요약 통계: 1행(3건수), 2행(2금액) 초슬림 컴팩트 배치 */
  .orders-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px 4px;
    padding-top: 8px;
    margin-top: 6px;
    border-top: 1px dashed #e2e8e4;
  }
  .orders-summary-item {
    padding: 4px 2px;
    border: 0;
    border-radius: 7px;
    background: #f4f7f5;
    min-width: 0;
  }
  .orders-summary-item.count-item {
    grid-column: span 2;
    padding: 4px 2px;
    gap: 1px;
  }
  .orders-summary-item.count-item span {
    font-size: 10px;
    font-weight: 700;
  }
  .orders-summary-item.count-item strong {
    font-size: 13.5px;
  }
  .orders-summary-item.amount-item {
    grid-column: span 3;
    padding: 5px 6px;
    border-radius: 7px;
    display: grid;
    gap: 1px;
  }
  .orders-summary-item.amount-item.total {
    background: #eff6ff;
    border: 1px solid #c7dcfc;
  }
  .orders-summary-item.amount-item.total span {
    color: #2563eb;
    font-size: 10px;
    font-weight: 750;
  }
  .orders-summary-item.amount-item.total strong {
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 850;
  }
  .orders-summary-item.amount-item.confirmed {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
  }
  .orders-summary-item.amount-item.confirmed span {
    color: #16a34a;
    font-size: 10px;
    font-weight: 750;
  }
  .orders-summary-item.amount-item.confirmed strong {
    color: #15803d;
    font-size: 13px;
    font-weight: 850;
  }

  .help-tooltip-bubble {
    width: min(235px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 11.5px;
    bottom: calc(100% + 8px);
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .help-tooltip-bubble .bubble-title {
    font-size: 12.5px;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .help-tooltip-bubble .bubble-desc {
    font-size: 11.5px;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .help-tooltip-bubble .bubble-list {
    font-size: 10.5px;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .orders-nav-box { padding: 8px 8px !important; margin-bottom: 6px !important; }
  .orders-nav-box > div:last-child { align-items: stretch !important; flex-direction: column; gap: 6px; }
  .orders-control-row { align-items: stretch; flex-direction: column; margin-top: 6px; padding-top: 0; gap: 6px; }

  /* 상단 하루/월별 탭 (2분할 세그먼트) */
  .period-toggle-tabs {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    width: 100% !important;
    gap: 2px !important;
    padding: 2px !important;
    margin-bottom: 4px !important;
    border-radius: 7px !important;
    background: #eef2ef !important;
    box-sizing: border-box !important;
  }
  .period-toggle-tabs a {
    min-height: 28px !important;
    height: 28px !important;
    padding: 0 4px !important;
    font-size: 11.5px !important;
    font-weight: 750 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 5px !important;
    text-align: center !important;
    color: #64748b !important;
  }
  .period-toggle-tabs a.active {
    background: #ffffff !important;
    color: #1e293b !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
    font-weight: 850 !important;
  }

  /* 370px 모바일 날짜 네비게이션: 1행 완벽 배치 */
  .order-period-picker {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 3px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .order-period-picker .date-step {
    height: 32px !important;
    min-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    font-size: 11.5px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  .order-period-picker .date-step.prev-step,
  .order-period-picker .date-step.next-step {
    width: 30px !important;
    min-width: 30px !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    background: var(--panel) !important;
    border: 1px solid var(--line) !important;
    color: var(--ink) !important;
  }
  .order-period-picker label.date-input-label,
  .order-period-picker > label {
    flex: 1 !important;
    min-width: 0 !important;
    margin: 0 !important;
  }
  .order-period-picker input {
    width: 100% !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 2px !important;
    font-size: 12.5px !important;
    font-weight: 750 !important;
    text-align: center !important;
    border-radius: 6px !important;
    border: 1px solid var(--line) !important;
    background: var(--panel) !important;
    color: var(--ink) !important;
  }
  .order-period-picker .date-step.today-step {
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 6px !important;
    font-size: 11px !important;
    font-weight: 750 !important;
    color: var(--green) !important;
    background: var(--mint) !important;
    border: 1px solid var(--line) !important;
  }

  /* 모바일 보기 방식 탭 (1행 3분할 세그먼트 버튼) */
  .orders-view-tabs {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2px !important;
    width: 100% !important;
    background: #eef2ef;
    padding: 2px;
    border-radius: 7px;
    box-sizing: border-box;
  }
  .orders-view-tabs a {
    min-height: 30px !important;
    height: 30px !important;
    padding: 0 1px !important;
    font-size: 11px !important;
    font-weight: 750 !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: nowrap !important;
    letter-spacing: -0.04em !important;
    border-radius: 5px !important;
    border: none !important;
    background: transparent;
    color: #64748b;
  }
  .orders-view-tabs a.active {
    background: #ffffff !important;
    color: #1e293b !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
    font-weight: 850 !important;
  }
  .view-tab-btn-wrap {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
  }
  .view-tab-btn-wrap > a {
    width: 100% !important;
    padding-right: 14px !important;
  }
  .view-tab-btn-wrap .help-tooltip-wrap {
    position: absolute !important;
    right: 2px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
  }

  /* 모바일 거래처/품목 필터 (초슬림 2행 미니멀 구조) */
  .orders-control-row .partner-order-filter {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
    width: 100% !important;
    margin: 2px 0 !important;
    padding: 7px 8px !important;
    border-radius: 9px !important;
    background: #f8faf9 !important;
    border: 1px solid #e2e8e4 !important;
    box-shadow: none !important;
  }
  .filter-field-group.partner-group,
  .filter-field-group.search-group {
    width: 100% !important;
    min-width: 0 !important;
  }
  .filter-field-label {
    display: none !important; /* 모바일에서는 플레이스홀더로 충분 */
  }
  .partner-inputs-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 4px !important;
    width: 100% !important;
  }
  .partner-quick-input {
    display: none !important; /* 모바일에서 중복되는 텍스트검색 숨김 */
  }
  .partner-select {
    width: 100% !important;
    height: 34px !important;
    min-height: 34px !important;
    font-size: 12.5px !important;
    border-radius: 6px !important;
    padding: 0 8px !important;
    background: #ffffff !important;
    border: 1px solid var(--line) !important;
  }
  .search-input-action-row {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    width: 100% !important;
  }
  .filter-search-input {
    flex: 1 !important;
    min-width: 0 !important;
    height: 34px !important;
    min-height: 34px !important;
    font-size: 12.5px !important;
    border-radius: 6px !important;
    padding: 0 8px !important;
    background: #ffffff !important;
    border: 1px solid var(--line) !important;
  }
  .filter-submit-btn {
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 12px !important;
    font-size: 12px !important;
    font-weight: 750 !important;
    border-radius: 6px !important;
    flex-shrink: 0 !important;
  }

  /* 모바일 주문 상태 필터 (가로 스크롤 가능한 5개 탭 세그먼트) */
  .order-status-filter {
    display: flex !important;
    overflow-x: auto !important;
    gap: 4px !important;
    width: 100% !important;
    background: #eef2ef;
    padding: 3px;
    border-radius: 8px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
  }
  .order-status-filter a {
    min-height: 34px !important;
    height: 34px !important;
    padding: 0 10px !important;
    font-size: 13px !important;
    font-weight: 750 !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: nowrap !important;
    border-radius: 6px !important;
    border: none !important;
    background: transparent;
    color: #64748b;
    flex: 1 0 auto;
  }
  .order-status-filter a.active {
    background: #ffffff !important;
    color: #2563eb !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
  }
  .order-status-filter a.active.review {
    color: #dc2626 !important;
  }
  .order-status-filter a.active.duplicate {
    color: #d97706 !important;
  }
  .order-status-filter a.active.ready {
    color: #16a34a !important;
  }
  .order-status-filter a.active.confirmed {
    color: #475569 !important;
  }
  .status-tab-btn-wrap {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
  }
  .status-tab-btn-wrap > a {
    width: 100% !important;
    padding-right: 14px !important;
  }
  .status-tab-btn-wrap .help-tooltip-wrap {
    position: absolute !important;
    right: 2px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
  }
  .order-card > .partner-order-group-head { align-items: flex-start; flex-direction: column; }
  .partner-order-status { width: 100%; justify-content: space-between; }
  .partner-order-summary { padding: 16px; }
  .partner-order-summary-title { align-items: flex-start; flex-direction: column; gap: 4px; }
  .partner-order-details > summary { padding: 12px 16px; align-items: flex-start; flex-direction: column; }
  .partner-order-details > summary small { flex: none; }
  .partner-order-detail-list { padding: 12px; }
  .partner-order-detail-head { align-items: flex-start; flex-direction: column; }
  .partner-order-actions { width: 100%; }
  .partner-order-actions form { flex: 1; }
  .partner-order-actions button { width: 100%; }
  .daily-order-sheet-head { align-items: flex-start; flex-direction: column; }
  .daily-order-sheet-scroll {
    max-height: calc(100dvh - 270px);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* PC 전용 뷰 숨김 및 모바일 전용 뷰 노출 */
  .desktop-only-sheet { display: none !important; }
  .mobile-only-sheet { display: block !important; }

  /* 모바일 전용 주문표: 품목 좌측 완벽 고정 & 거래처/시간 상단 & 375px+ 화면 대응 */
  .mobile-sheet-table {
    min-width: 360px;
    width: 100%;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-size: 12px;
  }
  .mobile-sheet-table th,
  .mobile-sheet-table td {
    height: 48px;
    padding: 5px 6px;
    vertical-align: middle;
    position: static;
    box-shadow: none;
    left: auto;
    right: auto;
    box-sizing: border-box;
  }
  .mobile-sheet-table thead th {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 5;
    background: #edf3ef;
  }
  .mobile-sheet-table thead th.center,
  .mobile-sheet-table tbody td.center {
    text-align: center;
  }

  /* 좌측 품목·거래처 고정 컬럼 (완벽한 좌측 틀 고정 Freeze Panes) */
  .mobile-sheet-table thead th.col-sticky-product,
  .mobile-sheet-table tbody td.col-sticky-product,
  .mobile-sheet-table tfoot td.col-sticky-product {
    position: -webkit-sticky !important;
    position: sticky !important;
    left: 0 !important;
    z-index: 10 !important;
    width: 130px !important;
    min-width: 130px !important;
    max-width: 130px !important;
    background: #ffffff !important;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.06) !important;
    border-right: 1px solid #cfdad3 !important;
    padding: 5px 8px !important;
    box-sizing: border-box !important;
  }
  /* 좌상단 코너 헤더: 세로 상단(top: 0) + 가로 좌측(left: 0) 모두 완벽 고정 */
  .mobile-sheet-table thead th.col-sticky-product {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 30 !important;
    background: #e5efe8 !important;
  }
  .mobile-sheet-table tbody tr.sheet-row-review td.col-sticky-product {
    background: #fffaf3 !important;
  }
  .mobile-sheet-table tbody tr.sheet-row-muted td.col-sticky-product {
    background: #f6f7f6 !important;
  }
  .mobile-sheet-table tbody tr:hover td.col-sticky-product {
    background: #f5faf7 !important;
  }
  .mobile-sheet-table tfoot td.col-sticky-product {
    position: -webkit-sticky !important;
    position: sticky !important;
    left: 0 !important;
    z-index: 20 !important;
    background: #edf7f1 !important;
    font-weight: 900 !important;
  }

  /* 상단 거래처명 & 시간 메타 텍스트 */
  .mobile-sheet-partner-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
    line-height: 1.2;
  }
  .mobile-sheet-partner-meta .partner-name {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--green-dark);
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-sheet-partner-meta .order-time-id {
    font-size: 10.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  /* 품목명 */
  .mobile-sheet-product-title {
    line-height: 1.25;
  }
  .mobile-sheet-product-title strong {
    font-size: 13px;
    font-weight: 850;
    color: #1e293b;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
  }
  .mobile-sheet-product-title .spec-text {
    font-size: 11px;
    color: #64748b;
    margin-left: 2px;
    white-space: nowrap;
  }

  /* 수량 셀 */
  .mobile-sheet-table .quantity-cell {
    width: 48px;
    min-width: 48px;
    text-align: center;
    white-space: nowrap;
    position: static !important;
  }
  .mobile-sheet-table .quantity-cell strong {
    font-size: 13px;
    color: var(--green-dark);
  }
  .mobile-sheet-table .quantity-cell .unit-text {
    position: static !important;
    right: auto !important;
    display: inline !important;
    font-size: 10.5px !important;
    font-weight: 700;
    color: #526558 !important;
    margin-left: 2px !important;
    pointer-events: auto !important;
  }

  /* 주문금액 셀 */
  .mobile-sheet-table .amount-cell {
    width: 76px;
    min-width: 76px;
    text-align: right;
    white-space: nowrap;
  }
  .mobile-sheet-table .amount-cell strong {
    font-size: 12px;
    display: block;
  }
  .mobile-sheet-table .amount-cell .unit-price-sub {
    font-size: 9.5px;
    color: var(--muted);
    display: block;
    margin-top: 1px;
  }

  /* 상태 셀 너비 명시 */
  .mobile-sheet-table th:nth-child(4),
  .mobile-sheet-table td:nth-child(4) {
    width: 60px;
    min-width: 60px;
    padding: 5px 2px !important;
    text-align: center;
    white-space: nowrap;
  }

  /* 검수 버튼 컬럼 */
  .mobile-sheet-table .col-action-header,
  .mobile-sheet-table .col-action-cell {
    width: 46px;
    min-width: 46px;
    padding: 5px 4px !important;
    text-align: center;
  }
  .mobile-sheet-table .sheet-review-link {
    min-height: 28px;
    padding: 0 8px;
    font-size: 11.5px;
    font-weight: 800;
  }
  .admin-create-panel { padding: 20px 16px; }
  .admin-create-heading { flex-direction: column; }
  .admin-create-form { grid-template-columns: 1fr; }
  .admin-create-actions { grid-column: auto; align-items: stretch; flex-direction: column; }
  .admin-create-actions button { width: 100%; min-width: 0; }
  
  .device-meta {
    margin: 0 16px 16px;
    padding: 12px 14px;
    grid-template-columns: 72px 1fr;
    gap: 8px 10px;
  }

  /* 모바일 단위 설정 최적화 (가로 1행 정렬 & 토글 스위치) */
  .unit-list-panel {
    padding: 16px 12px;
  }
  .unit-create-form {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .unit-create-form .unit-create-submit {
    width: 100%;
  }
  .unit-table-head {
    display: grid;
    grid-template-columns: 54px 1fr 44px 38px;
    gap: 6px;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: #eef5f0;
    border-radius: 6px;
    color: #3b5947;
    font-size: 11.5px;
    font-weight: 800;
    align-items: center;
  }
  .unit-table-head .center {
    text-align: center;
  }
  .unit-list {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 4px 0 10px;
  }
  .unit-row {
    grid-template-columns: 54px 1fr 44px 38px;
    gap: 6px;
    padding: 5px 8px;
    min-height: 42px;
    border: 1px solid #e3eae5;
    border-radius: 8px;
    background: #ffffff;
    align-items: center;
  }
  .unit-field-name {
    grid-column: 1;
  }
  .unit-field-name input {
    height: 33px;
    padding: 0 2px;
    font-weight: 800;
    text-align: center;
    font-size: 13.5px;
  }
  .unit-field-aliases {
    grid-column: 2;
    min-width: 0;
  }
  .unit-field-aliases input {
    height: 33px;
    padding: 0 8px;
    font-size: 12.5px;
  }
  .unit-save-btn {
    grid-column: 3;
    width: 44px;
    height: 33px;
    min-height: 33px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid #b8dfc7;
    border-radius: 6px;
    box-sizing: border-box;
    white-space: nowrap;
  }
  .unit-switch {
    grid-column: 4;
    justify-self: center;
  }
  .mobile-field-label {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
    font-weight: 700;
  }

  /* 모바일 거래처 관리 최적화 */
  .partner-create-panel {
    padding: 14px 16px;
  }
  .partner-create-heading {
    margin-bottom: 12px;
  }
  .partner-create-form,
  .partner-create-row-1,
  .partner-create-row-2 {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .partner-create-submit {
    width: 100%;
    height: 42px;
  }
  .partner-list-panel .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .partner-list-meta {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .partner-search-input {
    flex: 1;
    width: auto;
  }
  .partner-table-head {
    display: none;
  }
  .partner-row-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #e8efe9;
    align-items: center;
  }
  .partner-name-cell {
    grid-column: 1;
    font-size: 14px;
  }
  .partner-action-cell {
    grid-column: 2;
    grid-row: 1;
  }
  .partner-bizno-cell {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
  }
  .partner-phones-cell {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    flex-wrap: wrap;
  }
  .partner-notes-cell {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 12.5px;
  }
  .mobile-col-label {
    display: inline-block;
    flex: 0 0 68px;
    font-size: 11px;
    font-weight: 750;
    color: var(--muted);
  }
  .partner-notes-cell .notes-text {
    white-space: normal;
    word-break: break-all;
  }

  /* 모바일 주문 카드 및 품목 틀 깨짐 방지 */
  .message-box {
    margin: 10px 12px;
    padding: 10px 12px;
    font-size: 13.5px;
  }
  .parsed-items {
    padding: 0 12px 12px;
  }
  .parsed-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    min-height: auto;
  }
  .parsed-row > div:first-child {
    flex: 1 1 180px;
    min-width: 0;
  }
  .parsed-row strong {
    font-size: 13.5px;
    word-break: break-word;
  }
  .parsed-row .quantity {
    text-align: right;
    font-size: 15px;
    white-space: nowrap;
  }
  .unmatched-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
  }
  .unmatched-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
  }
  .unmatched-actions a,
  .unmatched-actions button {
    flex: 1;
    justify-content: center;
    min-height: 34px;
    font-size: 12px;
  }

  /* 모바일 날짜 네비게이터 균형 */
  .date-stepper a.btn,
  .date-stepper button {
    min-width: 36px;
    padding: 0 8px;
    font-size: 13px;
  }
  .quick-date-links a {
    font-size: 12px;
    padding: 6px 4px;
  }

}
.danger-button {
  border: 1px solid #f5b7b1;
  border-radius: 8px;
  background: #fff1f0;
  color: #b42318;
  padding: 0.5rem 0.85rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.danger-button:hover {
  background: #fee4e2;
  border-color: #e47870;
}

.edit-button {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  margin-right: 0.35rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid #b8d7c4;
  border-radius: 6px;
  color: var(--green-dark);
  background: #edf8f1;
  font-size: 0.85rem;
  font-weight: 800;
  white-space: nowrap;
}

.edit-button:hover { background: #dff1e6; }

.organization-edit-panel {
  padding: 26px;
  overflow: visible;
}

/* identity-notice: 2컬럼(강조+코드)으로 단순화 */
.organization-edit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.organization-edit-head h2 { margin: 5px 0 4px; font-size: 22px; }
.edit-back-button,
.organization-edit-actions a.ghost {
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  color: var(--muted);
  background: #eff3f0;
  font-weight: 750;
  white-space: nowrap;
}
.organization-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.organization-edit-form label { display: grid; gap: 7px; color: #34443a; font-size: 14px; font-weight: 750; }
.organization-edit-form label small { color: var(--muted); font-weight: 450; line-height: 1.5; font-size: 12.5px; }
.organization-edit-form .wide-field { grid-column: 1 / -1; }
.organization-edit-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }


.identity-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px 16px;
  border: 1px solid #dce7df;
  border-radius: 10px;
  background: #f6faf7;
  font-size: 14px;
}
.identity-notice code { color: var(--green-dark); font-weight: 800; }
.identity-notice span { color: var(--muted); }

/* 전체 레이아웃 래퍼 */
.org-edit-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1100px;
}

/* 하단 2컬럼 행 */
.org-edit-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* 하단 서브 패널 */
.org-edit-sub-panel {
  padding: 22px 24px;
}
.org-edit-sub-panel h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 750;
  color: #1e3028;
}
.org-edit-sub-panel > p {
  margin: 0 0 16px;
  font-size: 13.5px;
  color: var(--muted);
}

@media (max-width: 700px) {
  .organization-edit-panel { padding: 20px 16px; }
  .organization-edit-head { align-items: stretch; flex-direction: column; }
  .edit-back-button { align-self: flex-start; }
  .identity-notice { flex-direction: column; align-items: flex-start; }
  .organization-edit-form { grid-template-columns: 1fr; }
  .organization-edit-form .wide-field { grid-column: auto; }
  .organization-edit-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .org-edit-bottom-row { grid-template-columns: 1fr; }
}


/* Full-width catalog: quiet row separators, readable editable fields. */
.purchase-print-actions, .purchase-print-actions form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.purchase-print-actions label { display: grid; gap: 6px; font-size: 15px; font-weight: 650; }
.purchase-print-actions select { min-height: 46px; min-width: 130px; font-size: 16px; }
.purchase-print-actions button, .purchase-print-actions > a { min-height: 46px; white-space: nowrap; }
.catalog-workspace { display: grid; gap: 24px; --catalog-columns: minmax(190px, 1.8fr) minmax(75px, 0.75fr) minmax(70px, 0.7fr) minmax(82px, 0.9fr) minmax(82px, 0.95fr) minmax(82px, 0.95fr) minmax(82px, 0.95fr) minmax(82px, 0.9fr) 215px; }
.catalog-create { padding: 22px 24px; }
.catalog-create-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.catalog-create-heading h2 { margin: 0; font-size: 20px; font-weight: 800; color: #172b1e; }
.catalog-create-heading p { margin: 0; color: #59695f; font-size: 14px; }
.catalog-create-heading > span { color: #59695f; font-size: 14px; }
.catalog-inline-edit, .catalog-column-head { display: grid; grid-template-columns: var(--catalog-columns); gap: 12px; align-items: center; }
.catalog-workspace input, .catalog-workspace select { min-width: 0; width: 100%; height: 42px; font-size: 14.5px; border: 1px solid #cbd8d0; border-radius: 8px; box-sizing: border-box; }

/* 2줄 새 품목 등록 폼 */
.catalog-create-form-2row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.catalog-create-row {
  display: grid;
  gap: 12px;
  align-items: flex-end;
}
.catalog-create-row-1 {
  grid-template-columns: minmax(140px, 1.4fr) minmax(95px, 0.95fr) minmax(75px, 0.75fr) minmax(90px, 0.9fr) minmax(90px, 0.9fr) minmax(80px, 0.8fr) minmax(160px, 1.6fr);
  gap: 10px;
}
.catalog-create-row-2 {
  grid-template-columns: minmax(100px, 1fr) minmax(105px, 1.05fr) minmax(105px, 1.05fr) minmax(105px, 1.05fr) minmax(105px, 1.05fr) minmax(120px, 1.1fr);
  gap: 10px;
}
.catalog-create-form-2row label {
  display: grid;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 750;
  color: #334a3b;
}
.catalog-create-form-2row label span {
  display: flex;
  align-items: center;
  gap: 3px;
}
.catalog-create-form-2row label strong.req {
  color: #e11d48;
}
.catalog-create-form-2row input,
.catalog-create-form-2row select {
  height: 42px;
  padding: 0 12px;
  font-size: 14.5px;
  border: 1px solid #cbd8d0;
  border-radius: 8px;
  background: #ffffff;
}
.catalog-create-form-2row input:focus,
.catalog-create-form-2row select:focus {
  outline: 2px solid #257650;
  outline-offset: 1px;
  border-color: #257650;
}
.catalog-field-submit {
  display: flex;
  align-items: flex-end;
}
.catalog-create-submit {
  height: 42px;
  min-height: 42px;
  padding: 0 16px;
  font-size: 14.5px;
  font-weight: 800;
  white-space: nowrap;
  width: 100%;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.catalog-create-submit.is-blocked {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* 실시간 품목명 중복 검사 스타일 */
.catalog-field-name .field-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.name-dup-badge {
  font-size: 11px;
  font-weight: 750;
  color: #be123c;
  background: #ffe4e6;
  border: 1px solid #fecdd3;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  animation: fadeInDup 0.15s ease-in-out;
}
.catalog-create-form-2row input.has-duplicate-error {
  border-color: #f43f5e !important;
  background-color: #fff1f2 !important;
  color: #9f1239 !important;
  box-shadow: 0 0 0 1px #f43f5e;
}
.name-dup-feedback {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #9f1239;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  padding: 7px 12px;
  border-radius: 7px;
  margin-top: 5px;
  line-height: 1.45;
  animation: fadeInDup 0.15s ease-in-out;
}
.name-dup-feedback .dup-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.name-dup-feedback .dup-text {
  flex: 1;
  word-break: break-word;
}
.name-dup-feedback .dup-text strong {
  color: #881337;
  font-weight: 800;
  margin-left: 2px;
}
@keyframes fadeInDup {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}

.catalog-column-head { padding: 16px 24px; background: #eff5f1; color: #405c4b; font-size: 15px; font-weight: 700; border-bottom: 1px solid #dce6df; }
.catalog-column-head span:nth-child(n+4):nth-child(-n+8) { text-align: right; padding-right: 12px; }
.catalog-list-panel { overflow: hidden; }
.catalog-record { position: relative; padding: 10px 24px; border-bottom: 1px solid #e4ebe6; transition: background .15s; }
.catalog-record:last-child { border-bottom: 0; }
.catalog-record:focus-within { background: #f4f9f6; }
.catalog-inline-edit label { display: block; min-width: 0; }
.catalog-inline-edit input, .catalog-inline-edit select { background: #fbfcfb; border-color: #e0e7e2; }
.catalog-inline-edit input:hover, .catalog-inline-edit select:hover { border-color: #93ae9e; }
.catalog-inline-edit input:focus, .catalog-inline-edit select:focus { outline: 2px solid #257650; outline-offset: 2px; background: white; }
.catalog-inline-edit .catalog-name { position: relative; display: flex; align-items: center; gap: 9px; }
.catalog-name input { flex: 1; width: 0; }
.catalog-name input { font-weight: 750; }
.catalog-name small { display: block; flex: none; color: #627369; font-size: 13px; margin: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.catalog-money input { text-align: right; font-variant-numeric: tabular-nums; }
.catalog-sale input { font-weight: 750; }

/* 등급별 헤더 배지 스타일 */
.col-head-grade {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  font-weight: 800;
}
.col-head-grade.grade-a {
  color: #15803d;
}
.col-head-grade.grade-b {
  color: #1d4ed8;
}
.col-head-grade.grade-c {
  color: #7e22ce;
}

/* 인라인 입력 필드 등급별 테두리 및 배경 (색상 명확 구분) */
.catalog-sale-a input {
  color: #15803d !important;
  font-weight: 750;
  border-color: #86efac !important;
  background-color: #f0fdf4 !important;
}
.catalog-sale-a input:focus {
  outline-color: #16a34a !important;
  border-color: #16a34a !important;
}

.catalog-sale-b input {
  color: #1d4ed8 !important;
  font-weight: 750;
  border-color: #93c5fd !important;
  background-color: #eff6ff !important;
}
.catalog-sale-b input:focus {
  outline-color: #2563eb !important;
  border-color: #2563eb !important;
}
.catalog-sale-b input::placeholder {
  color: #93c5fd;
  font-size: 11.5px;
  font-weight: normal;
}

.catalog-sale-c input {
  color: #7e22ce !important;
  font-weight: 750;
  border-color: #d8b4fe !important;
  background-color: #faf5ff !important;
}
.catalog-sale-c input:focus {
  outline-color: #9333ea !important;
  border-color: #9333ea !important;
}
.catalog-sale-c input::placeholder {
  color: #d8b4fe;
  font-size: 11.5px;
  font-weight: normal;
}

.catalog-inline-edit > button { min-height: 46px; padding: 0 12px; font-size: 16px; align-self: start; width: 70px; }
.catalog-inline-edit > label:not(.catalog-name) { align-self: start; }
.catalog-record-details > summary { position: absolute; top: 10px; right: 24px; display: flex; align-items: center; justify-content: center; gap: 8px; list-style: none; cursor: pointer; width: 100px; height: 46px; margin: 0; padding: 0 8px; border: 1px solid #dce7df; border-radius: 8px; font-size: 14px; color: #315a42; background: #f5f8f6; white-space: nowrap; }
.catalog-record-details > summary::-webkit-details-marker { display: none; }
.catalog-record-details > summary span { display: none; }
.catalog-record-details[open] > summary b { transform: rotate(180deg); }
.catalog-record-details .product-detail-body { margin-top: 12px; border: 1px solid #dce7df; border-radius: 10px; padding: 20px; }
.catalog-record-details .product-fields-grid label, .catalog-record-details .price-entry-grid label { font-size: 15px; }
.mobile-field-label { display: none; }
@media (max-width: 1350px) {
  .catalog-workspace { --catalog-columns: minmax(170px, 1.5fr) minmax(65px, 0.7fr) 65px minmax(75px, 0.85fr) minmax(76px, 0.9fr) minmax(76px, 0.9fr) minmax(76px, 0.9fr) minmax(75px, 0.85fr) 210px; }
  .catalog-create { padding: 18px; }
  .catalog-record { padding: 10px 18px; }
  .catalog-record-details > summary { right: 18px; }
  .catalog-column-head { padding: 16px 18px; }
}
@media (max-width: 1100px) {
  .catalog-create-row-1 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .catalog-create-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-field-aliases, .catalog-field-submit { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .catalog-column-head { display: none; }
  .catalog-inline-edit { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .mobile-field-label { display: block; font-size: 13.5px; color: #52685a; margin-bottom: 5px; }
  .catalog-inline-edit > button { grid-column: auto; }
  .catalog-record-details > summary { position: static; margin-top: 10px; width: fit-content; padding: 0 12px; }
  .catalog-inline-edit .catalog-name { flex-wrap: wrap; }
  .catalog-name .mobile-field-label { width: 100%; margin: 0; }
}

/* ==========================================================================
   재고 관리 (Inventory Management) 스타일
   ========================================================================== */
.inventory-nav-box {
  margin-bottom: 20px;
}
.inventory-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(80px, 1fr)) minmax(130px, 1.4fr);
}
.inventory-control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.inventory-search {
  flex: 1;
  min-width: 260px;
  display: flex;
  gap: 6px;
}
.inventory-status-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* 데스크톱 재고 테이블 */
.inventory-list-panel {
  overflow: hidden;
}
.inventory-table-scroll {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid #dfe7e1;
}
.inventory-table {
  width: 100%;
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
.inventory-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid #cfdad3;
  border-right: 1px solid #e4eae6;
  color: #536158;
  background: #edf3ef;
  text-align: left;
  font-size: 12.5px;
  font-weight: 850;
  white-space: nowrap;
}
.inventory-table td {
  height: 52px;
  padding: 8px 14px;
  border-bottom: 1px solid #e7ece8;
  border-right: 1px solid #eef2ef;
  background: white;
  vertical-align: middle;
}
.inventory-table tbody tr:hover td {
  background: #f5faf7;
}
.inventory-table tr.stock-row-out td {
  background: #fff8f8;
}
.inventory-table tr.stock-row-low td {
  background: #fffdf5;
}

.inventory-product-meta strong {
  font-size: 14.5px;
  color: #1e293b;
  display: block;
}
.inventory-product-meta .spec-text {
  font-size: 12px;
  color: #64748b;
  margin-left: 2px;
}
.inventory-product-meta .code-text {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.location-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f3;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #e2e8e5;
}

.stock-cell .stock-qty-text {
  font-size: 16px;
  font-weight: 900;
  color: #0f172a;
}
.stock-row-out .stock-cell .stock-qty-text {
  color: #e11d48;
}
.stock-row-low .stock-cell .stock-qty-text {
  color: #d97706;
}
.stock-cell .unit-text, .safety-cell .unit-text {
  font-size: 12px;
  color: #64748b;
  margin-left: 3px;
}
.safety-cell span {
  font-weight: 700;
  color: #475569;
}

.stock-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}
.badge-normal {
  background: #eef8f1;
  color: #166534;
  border: 1px solid #bad5c4;
}
.badge-low {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.badge-out {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.quick-adjust-group {
  display: inline-flex;
  gap: 4px;
}
.quick-btn {
  height: 30px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.quick-btn.btn-in {
  background: #eef8f1;
  color: #166534;
  border-color: #bad5c4;
}
.quick-btn.btn-in:hover {
  background: #dcfce7;
}
.quick-btn.btn-out {
  background: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
}
.quick-btn.btn-out:hover {
  background: #ffe4e6;
}
.quick-btn.btn-set {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.quick-btn.btn-set:hover {
  background: #dbeafe;
}

.inventory-detail-toggle-btn {
  background: #f8faf9;
  border: 1px solid #dfe7e1;
  border-radius: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  cursor: pointer;
}
.inventory-detail-toggle-btn:hover {
  background: #eef3f0;
}

/* 상세 행 컨테이너 */
.inventory-detail-container {
  padding: 16px 20px;
  background: #f8faf9;
  border-radius: 8px;
  margin: 6px 0;
}
.detail-columns {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 20px;
}
.detail-card {
  background: white;
  border: 1px solid #dfe7e1;
  border-radius: 8px;
  padding: 16px;
}
.detail-card h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #1e293b;
}
.inventory-info-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.inventory-info-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}
.inventory-info-form input {
  height: 36px;
  border: 1px solid #cfdad3;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13px;
}

.mini-log-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.mini-log-table th {
  background: #f1f5f3;
  padding: 6px 8px;
  text-align: left;
  color: #64748b;
  font-size: 11px;
}
.mini-log-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f3;
}
.log-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
}
.tag-in { background: #dcfce7; color: #15803d; }
.tag-out { background: #fee2e2; color: #b91c1c; }
.tag-set { background: #dbeafe; color: #1d4ed8; }
.log-qty-plus { color: #166534; font-weight: 800; }
.log-qty-minus { color: #be123c; font-weight: 800; }
.empty-hint { color: var(--muted); font-size: 13px; margin: 8px 0; }

/* 모바일 전용 뷰 기본 숨김 */
.mobile-only-inventory {
  display: none;
}

/* ==========================================================================
   모바일 전용 재고 관리 반응형 (화면 폭 860px 이하)
   ========================================================================== */
@media (max-width: 860px) {
  .inventory-nav-box {
    padding: 12px 12px 14px !important;
  }

  /* 상단 통계 바: 1행 4개 카운트 지표 + 2행 평가액 풀와이드 */
  .inventory-summary {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px 5px !important;
    padding-top: 4px !important;
    width: 100% !important;
  }
  .inventory-summary .orders-summary-item.count-item {
    grid-column: span 1 !important;
    padding: 8px 2px !important;
    border: none !important;
    border-radius: 8px !important;
    background: #f6f9f7 !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 3px !important;
    min-width: 0 !important;
  }
  .inventory-summary .orders-summary-item.count-item span {
    font-size: 11px !important;
    color: var(--muted) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    text-align: center !important;
  }
  .inventory-summary .orders-summary-item.count-item strong {
    font-size: 14.5px !important;
    font-weight: 850 !important;
    white-space: nowrap !important;
  }
  .inventory-summary .orders-summary-item.amount-item.total {
    grid-column: 1 / -1 !important;
    padding: 9px 12px !important;
    border-radius: 8px !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: #eff6ff !important;
    border: 1px solid #bfdbfe !important;
    margin-top: 2px !important;
  }
  .inventory-summary .orders-summary-item.amount-item.total span {
    font-size: 12px !important;
    font-weight: 750 !important;
    color: #2563eb !important;
  }
  .inventory-summary .orders-summary-item.amount-item.total strong {
    font-size: 15.5px !important;
    font-weight: 900 !important;
    color: #1d4ed8 !important;
  }

  /* 검색 및 필터 컨트롤 바 */
  .inventory-control-row {
    margin-top: 10px !important;
    padding-top: 10px !important;
    border-top: 1px solid #eef2ef !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }
  .inventory-search {
    display: flex !important;
    width: 100% !important;
    gap: 6px !important;
  }
  .inventory-search input {
    flex: 1 !important;
    min-width: 0 !important;
    height: 38px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    padding: 0 10px !important;
    border: 1px solid #cfdad3 !important;
  }
  .inventory-search button {
    width: 65px !important;
    min-width: 65px !important;
    height: 38px !important;
    padding: 0 !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    border-radius: 8px !important;
  }
  .inventory-status-filter {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 4px !important;
    width: 100% !important;
  }
  .inventory-status-filter a {
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 2px !important;
    font-size: 11.5px !important;
    font-weight: 800 !important;
    text-align: center !important;
    justify-content: center !important;
    border-radius: 7px !important;
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
  }

  /* 재고 목록 패널 및 카드 */
  .inventory-list-panel {
    margin-top: 14px !important;
    margin-bottom: 85px !important; /* 모바일 하단 탭바 여백 */
    border-radius: 14px !important;
  }
  .inventory-list-panel .panel-head {
    padding: 14px 16px !important;
    min-height: auto !important;
  }
  .inventory-list-panel .panel-head h2 {
    font-size: 16px !important;
  }

  .desktop-only-inventory {
    display: none !important;
  }
  .mobile-only-inventory.mobile-inventory-sheet-scroll {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: #ffffff !important;
    border: 1px solid #dfe7e1 !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
    margin-bottom: 85px !important;
  }

  /* 모바일 전용 재고 테이블 (Freeze Panes 좌측 품목 고정) */
  .inventory-sheet-table {
    min-width: 680px !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100% !important;
  }
  .inventory-sheet-table th {
    height: 38px !important;
    padding: 6px 10px !important;
    font-size: 11.5px !important;
    font-weight: 800 !important;
    color: #475569 !important;
    background: #edf3ef !important;
    border-bottom: 1px solid #cfdad3 !important;
    white-space: nowrap !important;
  }
  .inventory-sheet-table td {
    height: 52px !important;
    padding: 6px 10px !important;
    font-size: 12.5px !important;
    border-bottom: 1px solid #edf2ef !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
  }

  /* 좌측 품목 정보 열 고정 */
  .inventory-sheet-table thead th.col-sticky-product,
  .inventory-sheet-table tbody td.col-sticky-product {
    position: -webkit-sticky !important;
    position: sticky !important;
    left: 0 !important;
    width: 145px !important;
    min-width: 145px !important;
    max-width: 145px !important;
    background: #ffffff !important;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.08) !important;
    border-right: 1px solid #cfdad3 !important;
    padding: 8px 10px !important;
    box-sizing: border-box !important;
    white-space: normal !important;
  }
  .inventory-sheet-table thead th.col-sticky-product {
    top: 0 !important;
    z-index: 30 !important;
    background: #e5efe8 !important;
  }
  .inventory-sheet-table tbody tr.stock-row-out td.col-sticky-product {
    background: #fff8f8 !important;
    border-left: 3.5px solid #ef4444 !important;
  }
  .inventory-sheet-table tbody tr.stock-row-low td.col-sticky-product {
    background: #fffdf5 !important;
    border-left: 3.5px solid #f59e0b !important;
  }
  .inventory-sheet-table tbody tr:not(.stock-row-out):not(.stock-row-low) td.col-sticky-product {
    border-left: 3.5px solid #10b981 !important;
  }
  .inventory-sheet-table tbody tr:hover td.col-sticky-product {
    background: #f5faf7 !important;
  }

  .inventory-sheet-table .mobile-sheet-product-title strong {
    font-size: 13.5px !important;
    font-weight: 850 !important;
    color: #0f172a !important;
    line-height: 1.25 !important;
    display: block !important;
    word-break: break-all !important;
  }
  .inventory-sheet-table .mobile-sheet-product-title .spec-text {
    font-size: 11px !important;
    color: #64748b !important;
  }
  .inventory-sheet-table .mobile-sheet-meta-row {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin-top: 3px !important;
  }
  .inventory-sheet-table .loc-mini-text {
    font-size: 10px !important;
    color: #64748b !important;
    background: #f1f5f3 !important;
    padding: 1px 4px !important;
    border-radius: 4px !important;
    max-width: 70px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* 우측 스크롤 항목들 */
  .inventory-sheet-table .col-stock-head,
  .inventory-sheet-table .col-stock-cell {
    min-width: 80px !important;
  }
  .inventory-sheet-table .stock-qty-text {
    font-size: 16px !important;
    font-weight: 900 !important;
    color: #0f172a !important;
  }
  .inventory-sheet-table .stock-row-out .stock-qty-text {
    color: #ef4444 !important;
  }
  .inventory-sheet-table .stock-row-low .stock-qty-text {
    color: #f59e0b !important;
  }
  .inventory-sheet-table .unit-text {
    font-size: 11px !important;
    color: #64748b !important;
    margin-left: 2px !important;
  }

  /* 빠른 버튼 그룹 */
  .inventory-sheet-table .col-quick-head,
  .inventory-sheet-table .col-quick-cell {
    min-width: 170px !important;
  }
  .mobile-quick-group {
    display: inline-flex !important;
    gap: 4px !important;
  }
  .mobile-quick-group .quick-btn {
    height: 30px !important;
    padding: 0 8px !important;
    font-size: 11.5px !important;
    font-weight: 800 !important;
    border-radius: 6px !important;
  }

  .inventory-sheet-table .inventory-detail-toggle-btn {
    height: 28px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    background: transparent !important;
    border: 1px solid #dfe7e1 !important;
    border-radius: 5px !important;
    color: #475569 !important;
    cursor: pointer !important;
  }

  .mobile-sheet-detail-wrap {
    padding: 12px 14px !important;
    background: #fbfdfc !important;
    border-bottom: 2px solid #cfdad3 !important;
    white-space: normal !important;
  }
  .mobile-mini-logs {
    margin-top: 8px !important;
    background: #f1f5f3 !important;
    border-radius: 6px !important;
    padding: 8px 10px !important;
  }
  .mobile-mini-logs h5 {
    margin: 0 0 6px 0 !important;
    font-size: 11.5px !important;
    color: #526558 !important;
  }
  .m-log-row {
    display: flex !important;
    justify-content: space-between !important;
    font-size: 11px !important;
    padding: 3px 0 !important;
    border-bottom: 1px solid #e2e8e5 !important;
  }
  .m-log-row:last-child {
    border-bottom: none !important;
  }
}

/* 빠른 재고 조정 모달 (Dialog) */
.quick-adjust-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  width: min(90vw, 400px);
  background: white;
  margin: auto;
}
.quick-adjust-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.dialog-content {
  padding: 20px 22px;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.dialog-head h3 {
  margin: 0;
  font-size: 17px;
  color: #0f172a;
}
.dialog-close-btn {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
}
.modal-product-name {
  margin: 0 0 16px 0;
  padding: 8px 12px;
  background: #f1f5f3;
  border-radius: 6px;
  color: var(--green-dark);
  font-size: 14px;
}
.quick-adjust-dialog .form-group {
  margin-bottom: 14px;
}
.quick-adjust-dialog label {
  display: block;
  font-size: 12.5px;
  font-weight: 750;
  color: #334155;
  margin-bottom: 6px;
}
.qty-input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid #bad5c4;
  border-radius: 8px;
  overflow: hidden;
  background: white;
}
.qty-input-wrap input {
  flex: 1;
  border: none;
  height: 44px;
  padding: 0 14px;
  font-size: 18px;
  font-weight: 850;
  color: #0f172a;
  outline: none;
}
.qty-unit-addon {
  padding: 0 14px;
  background: #f1f5f3;
  height: 44px;
  display: flex;
  align-items: center;
  font-size: 13.5px;
  font-weight: 700;
  color: #475569;
  border-left: 1px solid #bad5c4;
}
.quick-adjust-dialog input[type="text"] {
  width: 100%;
  height: 40px;
  border: 1px solid #cfdad3;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13.5px;
  box-sizing: border-box;
}
.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 10px;
  margin-top: 18px;
}
.dialog-actions button {
  height: 42px;
  font-size: 14px;
  font-weight: 800;
  border-radius: 8px;
  cursor: pointer;
}

@media (max-width: 600px) {
  .catalog-create { padding: 16px 14px; }
  .catalog-create-row-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-field-name { grid-column: 1 / -1; }
  .catalog-create-row-2 { grid-template-columns: 1fr; }
  .catalog-field-aliases, .catalog-field-submit { grid-column: 1 / -1; }
  .catalog-inline-edit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-name { grid-column: 1 / -1; }
  .catalog-inline-edit > button { grid-column: auto; align-self: end; }
  .catalog-record-details .product-detail-body { padding: 14px; }
}

/* Purchase controls & responsive filters */
.purchase-toolbar { margin-bottom: 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.purchase-export { display: flex; flex-wrap: wrap; gap: 8px; }
.purchase-toolbar .purchase-export .button-link { min-height: 42px; padding: 0 16px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 14px; font-weight: 700; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; }
.purchase-toolbar .purchase-export .button-link:hover { background: var(--mint); border-color: var(--green); }

/* Purchase filters card (신규 통합 컨트롤 UI) */
.purchase-filters-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
  border-radius: 12px;
  background: var(--panel);
  border: 1.5px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* 1행: 기간 바 (날짜 범위 + 프리셋 세그먼트 + 최근 N일 + 조회/초기화 액션) */
.filters-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-period-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-section-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

/* 날짜 범위 피커 (‹ 시작일 ~ 종료일 ›) */
.purchase-range-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--canvas);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 2px 4px;
}

.range-step-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 34px;
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.12s ease;
}
.range-step-btn:hover {
  background: var(--mint);
  color: var(--green);
}

.range-date-inputs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.range-date-inputs input[type="date"] {
  height: 34px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13.5px;
  font-weight: 750;
  color: var(--ink);
  padding: 0 4px;
  outline: none;
  border-radius: 6px;
  transition: border-color 0.12s ease;
}
.range-date-inputs input[type="date"]:focus {
  border-color: var(--green);
  background: var(--panel);
}

.range-separator {
  font-size: 14px;
  font-weight: 800;
  color: #64748b;
  padding: 0 2px;
}

/* 프리셋 알약 세그먼트 ([오늘] [최근 3일] [최근 7일] [이번 달]) */
.period-preset-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--canvas);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.preset-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 750;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.12s ease;
  white-space: nowrap;
}
.preset-pill:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.05);
}
.preset-pill.active {
  background: #16a34a;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(22, 163, 74, 0.3);
}

/* 최근 N일 직접 입력 */
.custom-days-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--canvas);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 2px 8px;
  height: 38px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.custom-days-label {
  font-size: 13.5px;
  font-weight: 750;
  color: var(--ink);
  white-space: nowrap;
}

.custom-days-input {
  width: 52px;
  height: 30px;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  padding: 0 4px;
  outline: none;
  background: var(--panel);
  box-sizing: border-box;
  transition: border-color 0.12s ease;
}
.custom-days-input:focus {
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
}

.btn-custom-days-go {
  height: 30px;
  padding: 0 12px;
  background: #1e293b;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, transform 0.1s ease;
}
.btn-custom-days-go:hover {
  background: #0f172a;
  transform: translateY(-1px);
}

/* 우측 메인 조회 및 초기화 버튼 */
.filters-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.btn-main-search {
  height: 38px;
  min-height: 38px;
  padding: 0 20px;
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
  transition: all 0.15s ease;
}
.btn-main-search:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.btn-main-reset {
  height: 38px;
  min-height: 38px;
  padding: 0 14px;
  background: #f1f5f9;
  color: #475569;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 750;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}
.btn-main-reset:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* 2행: 거래처 & 품목 다중 칩 선택기 (2열 그리드) */
.filters-card-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1.5px dashed var(--line);
}

.main-filter-selector-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--canvas);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  position: relative;
}

.selector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.selector-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-selector-clear {
  background: none;
  border: none;
  font-size: 12.5px;
  color: #64748b;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  transition: color 0.12s ease;
}
.btn-selector-clear:hover {
  color: var(--ink);
}

.selector-search-wrap {
  position: relative;
  width: 100%;
}

.selector-search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-size: 13.5px;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.selector-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.selector-suggest-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 100;
  margin: 0;
  padding: 4px 0;
  list-style: none;
}

.selector-chips-box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 38px;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 7px;
  align-items: center;
  box-sizing: border-box;
}

.selector-placeholder {
  font-size: 13px;
  color: var(--muted);
  padding: 2px 4px;
}

/* 기존 레거시 purchase-filters 호환성 유지 */
form.purchase-filters { display: grid; grid-template-columns: minmax(360px, 1.8fr) minmax(150px, 1fr) minmax(160px, 1.2fr) auto; gap: 14px; padding: 18px 20px; align-items: start; margin-bottom: 20px; border-radius: 12px; }
.purchase-date-group,
.purchase-filter-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.purchase-date-group .filter-field-label,
.purchase-filter-field .filter-field-label { font-size: 13px; font-weight: 750; color: var(--muted); }

.purchase-date-picker { display: flex; align-items: center; gap: 4px; width: 100%; box-sizing: border-box; }
.purchase-date-picker .date-step { height: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; font-size: 13px; font-weight: 750; background: var(--panel); border: 1px solid var(--line); color: var(--ink); text-decoration: none; flex-shrink: 0; }
.purchase-date-picker .date-step.prev-step,
.purchase-date-picker .date-step.next-step { width: 34px; min-width: 34px; padding: 0; font-size: 17px; }

.date-range-inputs { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; }
.date-range-inputs input[type="date"] { width: 100%; min-width: 120px; height: 40px; font-size: 13.5px; font-weight: 750; text-align: center; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 0 4px; box-sizing: border-box; }
.range-tilde { font-size: 14px; font-weight: 800; color: #64748b; flex-shrink: 0; }

.quick-period-group { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.quick-period-btn { display: inline-flex; align-items: center; justify-content: center; height: 28px; padding: 0 9px; font-size: 12.5px; font-weight: 750; border-radius: 6px; background: #f1f5f9; border: 1px solid #cbd5e1; color: #334155; text-decoration: none; transition: all 0.12s ease; white-space: nowrap; }
.quick-period-btn:hover { background: #e2e8f0; color: #0f172a; }
.quick-period-btn.active { background: #16a34a; border-color: #16a34a; color: #ffffff; font-weight: 800; }

.recent-days-box { display: inline-flex; align-items: center; gap: 3px; background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0 5px; height: 28px; }
.recent-label { font-size: 12px; font-weight: 700; color: #475569; }
.input-custom-days { width: 36px; height: 22px; border: 1px solid #cbd5e1; border-radius: 4px; text-align: center; font-size: 12.5px; font-weight: 750; color: #0f172a; padding: 0; }
.btn-custom-days-apply { height: 22px; padding: 0 7px; background: #334155; color: #ffffff; border: none; border-radius: 4px; font-size: 11.5px; font-weight: 700; cursor: pointer; transition: background 0.12s ease; }
.btn-custom-days-apply:hover { background: #0f172a; }

form.purchase-filters select,
form.purchase-filters input[type="search"] { height: 40px; min-height: 40px; width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); padding: 0 10px; font-size: 14px; box-sizing: border-box; }

.purchase-filter-actions { display: flex; gap: 8px; align-items: center; margin-top: 25px; }
.purchase-filter-actions .button-link,
.purchase-filter-actions button { height: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; white-space: nowrap; font-size: 14px; font-weight: 750; border-radius: 7px; }
.purchase-filter-actions .purchase-search-button { min-width: 90px; background: var(--green); color: #fff; border: 1px solid var(--green); }
.purchase-filter-actions .button-link.ghost { background: #f2f6f3; color: #395b47; border: 1px solid #dce6df; }
.purchase-filter-actions .button-link.ghost:hover { background: #e3eee7; }
form.purchase-filters :is(input,select,button,a):focus-visible,
form.purchase-filters-card :is(input,select,button,a):focus-visible { outline: 3px solid #89baa0; outline-offset: 2px; }

@media(max-width:1100px) {
  .filters-card-bottom { grid-template-columns: 1fr; }
  form.purchase-filters { grid-template-columns: 1fr 1fr; }
  .purchase-date-group { grid-column: 1 / -1; }
  .purchase-filter-actions { grid-column: 1 / -1; margin-top: 0; display: grid; grid-template-columns: 1fr 1fr; }
}
}

@media(max-width:650px) {
  .purchase-toolbar { margin-bottom: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .purchase-toolbar form { width: 100%; }
  .purchase-toolbar form input[type="month"] { width: 100%; height: 40px; font-size: 14px; font-weight: 750; border-radius: 8px; border: 1px solid var(--line); padding: 0 10px; }
  .purchase-toolbar h2 { margin: 2px 0 4px; font-size: 17px; }
  .purchase-toolbar p { font-size: 12px; }
  .purchase-toolbar .section-kicker { font-size: 11px; }
  .purchase-export { display: grid !important; grid-template-columns: 1fr 1fr 1fr !important; gap: 4px !important; width: 100% !important; }
  .purchase-toolbar .purchase-export .button-link { height: 32px !important; min-height: 32px !important; padding: 0 2px !important; font-size: 11px !important; font-weight: 700 !important; text-align: center !important; justify-content: center !important; border-radius: 6px !important; white-space: nowrap !important; }

  .bookmark-tabs { gap: 4px; padding-top: 2px; }
  .bookmark-tabs a,
  .btn-bookmark-drawer-trigger { padding: 6px 10px !important; font-size: 11.5px !important; font-weight: 750 !important; border-radius: 6px 6px 0 0 !important; }
  .bookmark-manager { margin-top: 10px !important; margin-bottom: 12px !important; border-radius: 10px !important; }
  .bookmark-summary-btn { padding: 12px 14px !important; gap: 8px !important; }
  .summary-left { gap: 8px !important; }
  .summary-icon { font-size: 20px !important; }
  .summary-title { font-size: 15px !important; }
  .summary-subtitle { font-size: 12px !important; }
  .summary-toggle-badge { padding: 7px 11px !important; font-size: 13px !important; border-radius: 6px !important; }
  .bookmark-manager-body { padding: 14px 12px !important; gap: 14px !important; }
  .bookmark-manager-intro { padding: 8px 12px !important; }
  .bookmark-manager-intro .intro-desc { font-size: 12.5px !important; }
  .bookmark-section-block { padding: 12px 10px !important; border-radius: 10px !important; }
  .bookmark-section-header { margin-bottom: 10px !important; }
  .header-title { font-size: 14px !important; }
  .registered-item-card { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; padding: 12px 10px !important; }
  .card-num-column { flex-direction: row !important; align-items: center !important; gap: 8px !important; min-width: auto !important; }
  .num-circle { width: 28px !important; height: 28px !important; font-size: 14px !important; }
  .card-fields-grid,
  .new-card-fields-grid { grid-template-columns: 1fr !important; gap: 8px !important; }
  .card-actions { flex-direction: row !important; width: 100% !important; margin-top: 4px !important; }
  .card-actions button { flex: 1 !important; height: 40px !important; font-size: 13px !important; }
  .btn-create-submit { height: 46px !important; font-size: 14.5px !important; }

  /* 신규 필터 카드 모바일 대응 */
  .purchase-filters-card { padding: 12px 14px !important; gap: 12px !important; margin-bottom: 14px !important; border-radius: 10px !important; }
  .filters-card-top { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; }
  .filter-period-section { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
  .purchase-range-control { width: 100% !important; justify-content: space-between !important; box-sizing: border-box !important; }
  .range-date-inputs { flex: 1 1 auto !important; justify-content: center !important; }
  .range-date-inputs input[type="date"] { font-size: 13px !important; height: 32px !important; min-width: 105px !important; }
  .period-preset-group { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; width: 100% !important; box-sizing: border-box !important; gap: 4px !important; padding: 3px !important; }
  .preset-pill { height: 32px !important; font-size: 13px !important; padding: 0 !important; }
  .custom-days-group { width: 100% !important; justify-content: center !important; box-sizing: border-box !important; height: 40px !important; gap: 8px !important; }
  .custom-days-input { width: 56px !important; height: 32px !important; font-size: 14.5px !important; }
  .btn-custom-days-go { height: 32px !important; padding: 0 16px !important; font-size: 13.5px !important; }
  .filters-actions-right { margin-left: 0 !important; display: grid !important; grid-template-columns: 2fr 1fr !important; gap: 6px !important; width: 100% !important; }
  .btn-main-search, .btn-main-reset { height: 36px !important; min-height: 36px !important; font-size: 13.5px !important; }
  .filters-card-bottom { grid-template-columns: 1fr !important; gap: 10px !important; padding-top: 10px !important; }
  .main-filter-selector-box { padding: 10px 12px !important; }
  .selector-search-input { height: 36px !important; font-size: 13px !important; }

  form.purchase-filters { display: flex !important; flex-direction: column !important; gap: 8px !important; padding: 10px 12px !important; margin-bottom: 14px !important; border-radius: 10px !important; }
  .purchase-date-group,
  .purchase-filter-field { width: 100% !important; gap: 3px !important; }
  .purchase-date-group .filter-field-label,
  .purchase-filter-field .filter-field-label { font-size: 11.5px !important; font-weight: 750 !important; color: var(--muted) !important; }

  .purchase-date-picker { display: flex !important; flex-wrap: nowrap !important; align-items: center !important; gap: 3px !important; width: 100% !important; }
  .purchase-date-picker .date-step { height: 32px !important; min-height: 32px !important; font-size: 12px !important; border-radius: 6px !important; flex-shrink: 0 !important; }
  .purchase-date-picker .date-step.prev-step,
  .purchase-date-picker .date-step.next-step { width: 30px !important; min-width: 30px !important; padding: 0 !important; font-size: 15px !important; font-weight: 700 !important; }
  .purchase-date-picker label.date-input-label { flex: 1 !important; min-width: 0 !important; margin: 0 !important; display: flex !important; }
  .purchase-date-picker input[type="date"] { width: 100% !important; height: 32px !important; min-height: 32px !important; padding: 0 4px !important; font-size: 12.5px !important; font-weight: 750 !important; text-align: center !important; border-radius: 6px !important; border: 1px solid var(--line) !important; }
  .purchase-date-picker .date-step.today-step { height: 32px !important; min-height: 32px !important; padding: 0 6px !important; font-size: 11px !important; font-weight: 750 !important; border-radius: 6px !important; }

  form.purchase-filters select,
  form.purchase-filters input[type="search"] { height: 34px !important; min-height: 34px !important; font-size: 12.5px !important; padding: 0 8px !important; border-radius: 6px !important; }

  .purchase-filter-actions { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 6px !important; width: 100% !important; margin-top: 2px !important; }
  .purchase-filter-actions .button-link,
  .purchase-filter-actions button { height: 34px !important; min-height: 34px !important; font-size: 12.5px !important; font-weight: 750 !important; border-radius: 6px !important; padding: 0 8px !important; width: 100% !important; }

  .empty-state { padding: 24px 12px !important; }
  .empty-state h3 { font-size: 15px !important; margin: 8px 0 4px !important; }
  .empty-state .button-link { height: 38px !important; min-height: 38px !important; font-size: 13px !important; font-weight: 750 !important; padding: 0 18px !important; border-radius: 8px !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; line-height: 1 !important; text-align: center !important; white-space: nowrap !important; }

  .purchase-panel { padding: 0 !important; }
  .purchase-table { padding: 4px 10px 4px !important; }
  .purchase-row { min-height: 52px !important; gap: 8px !important; font-size: 13px !important; }
  .purchase-row > div:first-child strong { font-size: 13.5px !important; }
  .purchase-row > div:first-child small { font-size: 11px !important; margin-top: 2px !important; }
  .final-quantity { font-size: 16px !important; font-weight: 850 !important; }
  .final-quantity small { font-size: 11px !important; }
  .purchase-foot { padding: 12px 14px !important; font-size: 11.5px !important; flex-direction: column !important; gap: 6px !important; }
}
.sidebar-foot { flex-wrap:wrap; }
.settings-nav { display:block; width:100%; padding:12px 8px; font-size:16px; color:#e6f2e9; border-bottom:1px solid #ffffff24; margin-bottom:8px; }
.settings-nav.active { background:#ffffff18; border-radius:8px; }
.settings-layout { display:grid; grid-template-columns:1.2fr 1fr; gap:24px; align-items:start; }
.settings-card { padding:28px; }
.settings-card h2 { margin:8px 0 16px; font-size:23px; }
.settings-card p { color:var(--muted); font-size:16px; line-height:1.8; }
.settings-example { padding:18px; background:var(--mint); border-radius:12px; line-height:1.9; }
.theme-options { display:flex; gap:12px; flex-wrap:wrap; }
.theme-options button { padding:16px 20px; background:var(--canvas); color:var(--ink); border:1px solid var(--line); }
.theme-options button[aria-pressed="true"] { border:2px solid var(--green); background:var(--mint); }
@media(max-width:800px) { .settings-layout { grid-template-columns:1fr; } }
@media screen {
  html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #f8fafc;
    --muted: #94a3b8;
    --text-muted: #94a3b8;
    --line: #243447;
    --canvas: #0b0f19;
    --panel: #151e2e;
    --panel-hover: #1e2b3e;
    --panel-alt: #1a2536;
    --green: #10b981;
    --green-dark: #34d399;
    --mint: #132e24;
    --amber: #fbbf24;
    --amber-bg: #2d230e;
    --red: #f87171;
    --red-bg: #381619;
    --blue: #60a5fa;
    --blue-bg: #172554;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  }
  html[data-theme="dark"] :is(label, .stack-form label, .eyebrow, .section-kicker) { color: #cbd5e1; }
  html[data-theme="dark"] :is(.account-role, .logout-button) { background: #1c293c; color: #f8fafc; border: 1px solid #2d4056; }
  html[data-theme="dark"] :is(.panel, .topbar, .purchase-row, .order-card, .partner-order-card) { background: var(--panel); color: var(--ink); border-color: var(--line); }
  html[data-theme="dark"] :is(input, select, textarea) { background: #131d2b !important; color: var(--ink) !important; border-color: #33465e !important; }
  html[data-theme="dark"] :is(.purchase-header, .purchase-foot, .settings-example) { background: #172335; color: var(--ink); }
  html[data-theme="dark"] :is(.purchase-filters label, .purchase-export .button-link, .purchase-filters .button-link.ghost) { color: var(--ink); }
  html[data-theme="dark"] :is(.purchase-export .button-link, .purchase-filters .button-link.ghost) { background: #1e2b3e; border-color: var(--line); }
}
.period-toggle-tabs { display:inline-flex; align-self:flex-start; width:fit-content; background:#e4ede7; padding:4px; border-radius:10px; gap:4px; }
.period-toggle-tabs a { padding:8px 16px; font-size:13.5px; font-weight:750; color:var(--muted); border-radius:7px; text-decoration:none; transition: all 0.15s ease; }
.period-toggle-tabs a.active { background:#1e293b; color:#fff; box-shadow:0 1px 3px rgba(0,0,0,0.12); }
.order-period-toolbar { display:flex; flex-direction:column; align-items:flex-start; gap:14px; }
.order-period-picker { display:flex; align-items:center; gap:8px; flex-wrap:nowrap; }
.order-period-picker label { display:flex; flex-direction:column; gap:4px; margin:0; }
.order-period-picker input { min-height:44px; font-size:15px; border:1px solid var(--line); padding:6px 12px; border-radius:9px; background:var(--panel); color:var(--ink); }
.order-period-picker .date-step { min-height:44px; display:inline-flex; align-items:center; justify-content:center; padding:0 14px; border-radius:9px; font-size:14px; font-weight:700; background:var(--panel); border:1px solid var(--line); color:var(--ink); }
.order-period-picker .date-step.prev-step,
.order-period-picker .date-step.next-step { width:40px; min-width:40px; padding:0; font-size:18px; }
.orders-control-row .partner-order-filter { display:flex; flex-wrap:wrap; align-items:end; gap:14px; width:100%; margin:8px 0; padding:16px 20px; background:var(--canvas); border-radius:12px; border:1px solid var(--line); }
.filter-field-group { display:flex; flex-direction:column; gap:6px; }
.filter-field-group.partner-group { flex:1.4; min-width:280px; }
.filter-field-group.search-group { flex:1; min-width:220px; }
.filter-field-label { font-size:13px; font-weight:750; color:var(--muted); }
.partner-inputs-row { display:flex; gap:8px; width:100%; }
.partner-quick-input { flex:1; height:44px; padding:0 12px; border:1px solid var(--line); border-radius:9px; background:var(--panel); color:var(--ink); font-size:14px; }
.partner-select { flex:1.3; height:44px; padding:0 12px; border:1px solid var(--line); border-radius:9px; background:var(--panel); color:var(--ink); font-size:14px; }
.search-input-action-row { display:flex; gap:8px; width:100%; }
.filter-search-input { flex:1; height:44px; padding:0 12px; border:1px solid var(--line); border-radius:9px; background:var(--panel); color:var(--ink); font-size:14px; }
.filter-submit-btn { height:44px; min-height:44px; padding:0 18px; font-size:14.5px; border-radius:9px; white-space:nowrap; }
@media screen {
  html[data-theme="dark"] :is(.date-step, .orders-view-tabs a, .order-status-filter a) { background: #182334; color: #cbd5e1; border-color: #2a3d54; }
  html[data-theme="dark"] :is(.orders-view-tabs a.active, .order-status-filter a.active) { background: #10b981; color: #ffffff; border-color: #10b981; }
  html[data-theme="dark"] .orders-summary-item strong { color: #f8fafc; }
}
.purchase-bookmarks { margin-bottom:18px; }
.bookmark-tabs { display:flex; gap:6px; overflow-x:auto; border-bottom:2px solid var(--line); padding-top:4px; }
.bookmark-tabs a { flex-shrink:0; padding:14px 20px; border:1px solid var(--line); border-bottom:0; border-radius:12px 12px 0 0; background:var(--canvas); color:var(--muted); font-weight:750; }
.bookmark-tabs a.active { background:var(--green); color:#fff; border-color:var(--green); }
.bookmark-tabs a:hover { color:var(--ink); background:var(--mint); }
/* 품목 필터 탭 트리거 버튼 */
.btn-bookmark-drawer-trigger {
  flex-shrink: 0;
  padding: 13px 18px;
  border: 1.5px dashed #22c55e;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: rgba(34, 197, 94, 0.08);
  color: #15803d;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-bookmark-drawer-trigger:hover {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}
html[data-theme="dark"] .btn-bookmark-drawer-trigger {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: #16a34a;
}
html[data-theme="dark"] .btn-bookmark-drawer-trigger:hover {
  background: #16a34a;
  color: #ffffff;
}

/* 통합 주문표 품목 묶음 필터 우측 사이드 패널 (Split View / Drawer) */
body.has-bookmark-drawer main {
  margin-right: 620px;
  transition: margin-right 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.bookmark-side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 620px;
  height: 100vh;
  background: var(--canvas, #ffffff);
  border-left: 1.5px solid #d2e2d8;
  box-shadow: -6px 0 28px rgba(18, 48, 30, 0.1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
}

.bookmark-side-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.bookmark-side-backdrop {
  display: none;
}

.bookmark-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafc;
}

/* [가이드 배너] */
.bookmark-manager-intro {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 13px;
  color: #1e40af;
  line-height: 1.45;
}
.bookmark-manager-intro .intro-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* [공통 섹션 카드] */
.bookmark-section-block {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.bookmark-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
}
.header-badge.new-badge {
  background: #dcfce7;
  color: #15803d;
}
.header-badge.edit-badge {
  background: #fef3c7;
  color: #b45309;
}
.header-badge.registered-badge {
  background: #e2e8f0;
  color: #334155;
}

.header-title {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.btn-cancel-edit-mode {
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 12.5px;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-cancel-edit-mode:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* [필터 설정 폼 레이아웃] */
.new-bookmark-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.form-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-group-label {
  font-size: 13.5px;
  font-weight: 750;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 4px;
}
.form-group-label .required-star {
  color: #dc2626;
}

.btn-label-action {
  font-size: 12px;
  color: #64748b;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.btn-label-action:hover {
  color: #0f172a;
}

.filter-input-main {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-size: 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.filter-input-main:focus {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.filter-search-box {
  position: relative;
}

.filter-search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-size: 13.5px;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.filter-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* 자동완성 팝오버 목록 */
.filter-autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 210px;
  overflow-y: auto;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  z-index: 1020;
  margin: 0;
  padding: 4px 0;
  list-style: none;
}
.filter-autocomplete-item {
  padding: 8px 12px;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #1e293b;
  transition: background 0.1s ease;
}
.filter-autocomplete-item:hover,
.filter-autocomplete-item.is-selected {
  background: #eff6ff;
  color: #1d4ed8;
}
.filter-autocomplete-item .match-hint {
  font-size: 12px;
  color: #64748b;
}

/* 칩 태그 컨테이너 */
.filter-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 7px;
  align-items: center;
}

.chip-empty-placeholder {
  font-size: 13px;
  color: #64748b;
  padding: 2px 4px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  user-select: none;
  transition: transform 0.1s ease;
}
.filter-chip.chip-partner {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}
.filter-chip.chip-product {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.filter-chip:hover {
  transform: translateY(-1px);
}

.chip-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: rgba(0, 0, 0, 0.08);
  border: none;
  border-radius: 50%;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  color: inherit;
  padding: 0;
  line-height: 1;
  transition: background 0.12s ease;
}
.chip-remove-btn:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* 폼 제출 및 리셋 버튼 */
.form-submit-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.btn-save-main {
  flex: 1 1 auto;
  height: 40px;
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(22, 163, 74, 0.25);
  transition: all 0.15s ease;
}
.btn-save-main:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.btn-cancel-main {
  height: 40px;
  padding: 0 16px;
  background: #f1f5f9;
  color: #475569;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-cancel-main:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* [등록된 필터 탭 카드 목록] */
.registered-filter-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-card-item {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.filter-card-item:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.filter-card-item.is-editing {
  border-color: #f59e0b;
  background: #fffbeb;
}

.filter-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-card-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-card-edit {
  height: 28px;
  padding: 0 10px;
  background: #f8fafc;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.12s ease;
}
.btn-card-edit:hover {
  background: #eff6ff;
  border-color: #60a5fa;
}

.btn-card-delete {
  height: 28px;
  padding: 0 10px;
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.12s ease;
}
.btn-card-delete:hover {
  background: #ffe4e6;
  border-color: #fda4af;
}

.filter-card-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #475569;
}

.card-detail-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.card-detail-label {
  font-weight: 700;
  color: #64748b;
  font-size: 12.5px;
  flex-shrink: 0;
}

.card-badge-chip {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
}
.card-badge-chip.partner-badge {
  background: #e0e7ff;
  color: #3730a3;
}
.card-badge-chip.product-badge {
  background: #dcfce7;
  color: #166534;
}
.card-badge-chip.all-badge {
  background: #f1f5f9;
  color: #64748b;
  font-style: italic;
}

/* 모바일 & 태블릿 (1024px 이하) 슬라이드오버 드로어 */
@media (max-width: 1024px) {
  body.has-bookmark-drawer main {
    margin-right: 0 !important;
  }
  .bookmark-side-drawer {
    width: 95vw;
    max-width: 580px;
    z-index: 1050;
    border-radius: 16px 0 0 16px;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.22);
  }
  body.has-bookmark-drawer .bookmark-side-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1040;
  }
}

/* 다크모드 지원 */
html[data-theme="dark"] .bookmark-side-drawer {
  background: #0f172a;
  border-color: #334155;
  box-shadow: -6px 0 28px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .bookmark-drawer-body {
  background: #0b1120;
}
html[data-theme="dark"] .bookmark-section-block,
html[data-theme="dark"] .filter-card-item {
  background: #1e293b;
  border-color: #334155;
}
html[data-theme="dark"] .filter-input-main,
html[data-theme="dark"] .filter-search-input {
  background: #0f172a;
  border-color: #475569;
  color: #f8fafc;
}
html[data-theme="dark"] .filter-autocomplete-list {
  background: #1e293b;
  border-color: #475569;
}
html[data-theme="dark"] .filter-autocomplete-item {
  color: #f1f5f9;
}
html[data-theme="dark"] .filter-autocomplete-item:hover {
  background: #334155;
}
html[data-theme="dark"] .quick-period-btn {
  background: #1e293b;
  border-color: #475569;
  color: #cbd5e1;
}
html[data-theme="dark"] .quick-period-btn:hover {
  background: #334155;
  color: #f8fafc;
}
html[data-theme="dark"] .quick-period-btn.active {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}
html[data-theme="dark"] .recent-days-box {
  background: #1e293b;
  border-color: #475569;
}
html[data-theme="dark"] .recent-label {
  color: #94a3b8;
}
html[data-theme="dark"] .input-custom-days {
  background: #0f172a;
  border-color: #475569;
  color: #f8fafc;
}
html[data-theme="dark"] .filter-chips-wrap {
  background: #0f172a;
  border-color: #334155;
}
html[data-theme="dark"] .header-title,
html[data-theme="dark"] .filter-card-title {
  color: #f8fafc;
}
html[data-theme="dark"] .purchase-filters-card {
  background: var(--panel);
  border-color: var(--line);
}
html[data-theme="dark"] .purchase-range-control,
html[data-theme="dark"] .period-preset-group,
html[data-theme="dark"] .custom-days-group {
  background: #1e293b;
  border-color: #334155;
}
html[data-theme="dark"] .preset-pill {
  color: #94a3b8;
}
html[data-theme="dark"] .preset-pill:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .preset-pill.active {
  background: #16a34a;
  color: #ffffff;
}
html[data-theme="dark"] .main-filter-selector-box {
  background: #0f172a;
  border-color: #334155;
}
html[data-theme="dark"] .selector-search-input {
  background: #1e293b !important;
  border-color: #475569 !important;
  color: #f8fafc !important;
}
html[data-theme="dark"] .selector-suggest-list {
  background: #1e293b;
  border-color: #475569;
}
html[data-theme="dark"] .selector-chips-box {
  background: #1e293b;
  border-color: #475569;
}
html[data-theme="dark"] .btn-main-reset {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #475569;
}
html[data-theme="dark"] .btn-main-reset:hover {
  background: #334155;
  color: #f8fafc;
}
html[data-theme="dark"] .filter-table-wrap {
  background: #1e293b;
  border-color: #334155;
}
html[data-theme="dark"] .filter-table-head {
  background: #0f172a;
  border-bottom-color: #334155;
  color: #94a3b8;
}
html[data-theme="dark"] .filter-row-item {
  border-bottom-color: #334155;
}
html[data-theme="dark"] .filter-row-item:hover {
  background: #243447;
}
html[data-theme="dark"] .filter-input-sm,
html[data-theme="dark"] .filter-select-sm {
  background: #0f172a !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}
html[data-theme="dark"] .num-circle-sm {
  background: #475569;
}
html[data-theme="dark"] .btn-row-action {
  background: #334155;
  color: #e2e8f0;
}
html[data-theme="dark"] .btn-row-save:hover {
  background: #475569;
}
html[data-theme="dark"] .btn-row-delete:hover {
  background: #7f1d1d;
  color: #fca5a5;
}

/* 아코디언 열렸을 때 내부 영역 */
.bookmark-manager-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.bookmark-manager-intro {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f1f5f9;
  border-radius: 8px;
  border-left: 4px solid #2b7a4b;
}
.bookmark-manager-intro .intro-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.bookmark-manager-intro .intro-text {
  flex: 1;
}
.bookmark-manager-intro .intro-desc {
  margin: 0;
  font-size: 13.5px;
  color: #334155;
  line-height: 1.5;
}
.bookmark-manager-intro .intro-desc strong {
  display: inline !important;
  color: #166534;
  font-weight: 750;
}

/* 영역 공통 블록 */
.bookmark-section-block {
  padding: 16px;
  border-radius: 12px;
}
.bookmark-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.bookmark-section-header .header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.header-badge.registered-badge {
  background: #334155;
  color: #ffffff;
}
.header-badge.new-badge {
  background: #16a34a;
  color: #ffffff;
}
.header-title {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--ink);
}
.header-hint {
  font-size: 12.5px;
  color: #64748b;
  font-weight: 500;
}

/* [1] 기존 등록 목록 블록 */
.registered-block {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
}
.registered-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.registered-item-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-num-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 44px;
  flex-shrink: 0;
}
.num-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1e293b;
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.num-label {
  font-size: 11px;
  font-weight: 750;
  color: #64748b;
  white-space: nowrap;
}
.card-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1.1fr;
  gap: 10px;
  flex: 1;
}
.field-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field-item label {
  font-size: 13px;
  font-weight: 750;
  color: #334155;
}
.field-item input,
.field-item select {
  height: 44px;
  padding: 0 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.field-item input:focus,
.field-item select:focus {
  border-color: #2b7a4b;
  outline: none;
  box-shadow: 0 0 0 3px rgba(43, 122, 75, 0.15);
}
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.btn-save-edit {
  height: 38px;
  min-height: 38px;
  padding: 0 14px;
  background: #334155;
  color: #ffffff;
  font-size: 13px;
  font-weight: 750;
  border-radius: 7px;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-save-edit:hover {
  background: #0f172a;
}
.btn-delete-item {
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  background: #ffffff;
  color: #dc2626;
  border: 1.5px solid #fecaca;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 7px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-delete-item:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}
.empty-bookmarks-notice {
  padding: 24px;
  text-align: center;
  background: #ffffff;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}

/* [2] 신규 필터 등록 블록 (완전히 차별화된 초록 점선 카드) */
.create-new-block {
  background: #f0fdf4;
  border: 2px dashed #16a34a;
}
.new-bookmark-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.new-card-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1.1fr;
  gap: 12px;
}
.new-card-fields-grid .field-item input,
.new-card-fields-grid .field-item select {
  background: #ffffff;
  border: 1.5px solid #86efac;
}
.new-card-fields-grid .field-item input:focus,
.new-card-fields-grid .field-item select:focus {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
}
.required-star {
  color: #dc2626;
  font-size: 12px;
  font-weight: 800;
  margin-left: 2px;
}
.new-card-footer {
  display: flex;
  justify-content: flex-end;
}
.btn-create-submit {
  width: 100%;
  height: 48px;
  min-height: 48px;
  background: #16a34a;
  color: #ffffff;
  font-size: 15.5px;
  font-weight: 800;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(22, 163, 74, 0.25);
  transition: all 0.15s;
}
.btn-create-submit:hover {
  background: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 5px 10px rgba(22, 163, 74, 0.3);
}

/* 다크모드 지원 */
html[data-theme="dark"] .bookmark-manager-intro {
  background: #1e293b;
  border-left-color: #387b54;
}
html[data-theme="dark"] .bookmark-manager-intro .intro-desc {
  color: #cbd5e1;
}
html[data-theme="dark"] .bookmark-manager-intro .intro-desc strong {
  color: #86efac;
}
html[data-theme="dark"] .registered-block {
  background: #0f172a;
  border-color: #334155;
}
html[data-theme="dark"] .registered-item-card {
  background: #1e293b;
  border-color: #334155;
}
html[data-theme="dark"] .num-circle {
  background: #334155;
}
html[data-theme="dark"] .field-item label {
  color: #cbd5e1;
}
html[data-theme="dark"] .field-item input,
html[data-theme="dark"] .field-item select {
  border-color: #475569;
}
html[data-theme="dark"] .btn-save-edit {
  background: #475569;
}
html[data-theme="dark"] .btn-save-edit:hover {
  background: #64748b;
}
html[data-theme="dark"] .btn-delete-item {
  background: #1e293b;
  border-color: #7f1d1d;
  color: #f87171;
}
html[data-theme="dark"] .create-new-block {
  background: #062b14;
  border-color: #22c55e;
}
html[data-theme="dark"] .new-card-fields-grid .field-item input,
html[data-theme="dark"] .new-card-fields-grid .field-item select {
  background: #0f172a;
  border-color: #16a34a;
}
html[data-theme="dark"] .header-hint {
  color: #94a3b8;
}
html[data-theme="dark"] .empty-bookmarks-notice {
  background: #1e293b;
  border-color: #334155;
}
/* 탭 내부 물음표 툴팁 래퍼 (데스크톱 1줄 정렬 보장) */
.view-tab-btn-wrap {
  display: inline-flex;
  position: relative;
  align-items: center;
  width: auto;
}
.view-tab-btn-wrap > a {
  width: auto;
  height: 100%;
  padding-right: 32px !important;
}
.view-tab-btn-wrap .help-tooltip-wrap {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}
.status-tab-btn-wrap {
  display: inline-flex;
  position: relative;
  align-items: center;
  width: auto;
}
.status-tab-btn-wrap > a {
  width: auto;
  height: 100%;
  padding-right: 28px !important;
}
.status-tab-btn-wrap .help-tooltip-wrap {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

/* 선주문 및 날짜 배지 */
.badge.preorder-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-weight: 800;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 8px;
}
.badge.date-needs-review-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  font-weight: 800;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 8px;
}
.order-date-text {
  font-size: 14px;
  color: var(--ink);
}
.order-date-box {
  margin: 14px 20px;
  padding: 16px 18px;
  background: var(--mint);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.order-date-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.order-receipt-info {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.order-receipt-info .receipt-stamp {
  font-weight: 600;
}
.order-receipt-info .order-date-note {
  color: #4b5563;
}
.order-date-change-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.order-date-summary-btn {
  display: inline-block;
  font-size: 13px;
  font-weight: 750;
  color: #2563eb;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  background: white;
  border: 1px solid #cbd5e1;
  user-select: none;
}
.order-date-summary-btn:hover {
  background: #f1f5f9;
}
.order-date-form {
  margin-top: 12px;
}
.order-date-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.order-date-inputs label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.order-date-inputs input[type="date"] {
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: var(--panel);
  color: var(--ink);
}
.order-date-inputs button {
  min-height: 40px;
  padding: 0 16px;
  font-size: 14px;
}
.order-date-help {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.orders-view-tabs,.order-status-filter { overflow:visible; }

@media(max-width: 650px) {
  .order-date-box {
    margin: 12px 14px;
    padding: 14px;
  }
  .order-date-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .order-date-inputs {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .order-date-inputs input[type="date"],
  .order-date-inputs button {
    width: 100%;
  }
}

/* 일자별 시세 변동 추이 (Price Trend) 스타일 */
.price-trend-heading {
  margin-top: 18px !important;
  margin-bottom: 8px !important;
}
.price-trend-wrap {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.price-trend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
.price-trend-table th {
  background: #f4f7f5;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 750;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.price-trend-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.price-trend-table tbody tr:last-child td {
  border-bottom: none;
}
.price-trend-table .trend-date strong {
  font-size: 12.5px;
  color: var(--ink);
}
.price-trend-table .sale-price-text {
  color: #1e293b;
  font-weight: 800;
}
.diff-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 750;
  padding: 1px 4px;
  border-radius: 4px;
  margin-left: 3px;
}
.diff-tag.up {
  background: #fef2f2;
  color: #dc2626;
}
.diff-tag.down {
  background: #eff6ff;
  color: #2563eb;
}
.margin-val {
  font-weight: 750;
  color: #059669;
}
.margin-val.negative {
  color: #dc2626;
}
.margin-rate {
  font-size: 10.5px;
  color: var(--muted);
  margin-left: 2px;
}
.empty-trend-note {
  font-size: 12.5px;
  color: var(--muted);
  padding: 8px 0;
  margin: 0;
}

@media (max-width: 680px) {
  .price-trend-table {
    font-size: 11.5px;
  }
  .price-trend-table th,
  .price-trend-table td {
    padding: 6px 8px;
  }
  .diff-tag {
    font-size: 9px;
    padding: 0 3px;
  }
}
.product-calculation { padding:20px; background:var(--canvas); border:1px solid var(--line); border-radius:12px; margin-bottom:20px; }
.product-calculation fieldset { display:flex; flex-wrap:wrap; align-items:end; gap:14px; border:1px solid var(--line); border-radius:10px; margin:18px 0; padding:18px; }
.product-calculation label,.expense-editor label { display:flex; flex-direction:column; gap:8px; min-width:130px; }
.product-calculation .check-label { flex-direction:row; align-items:center; min-height:44px; }
.product-calculation input,.product-calculation select,.expense-editor input { min-height:44px; padding:8px 12px; border:1px solid var(--line); border-radius:8px; background:var(--panel); color:var(--ink); }
.product-calculation input[type=checkbox] { min-height:20px; width:20px; }
.product-calculation p { color:var(--muted); line-height:1.7; }
.expense-editor { display:flex; flex-wrap:wrap; align-items:end; gap:14px; }
.expense-list { margin-top: 24px; }
.expense-detail-row {
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.expense-detail-row:last-of-type {
  border-bottom: none;
}
.expense-detail-row summary {
  display: grid;
  grid-template-columns: 100px 140px 1fr 140px 60px;
  align-items: center;
  gap: 12px;
  padding: 14px 8px;
  cursor: pointer;
  list-style: none;
}
.expense-detail-row summary::-webkit-details-marker {
  display: none;
}
.expense-detail-row summary:hover {
  background: #f6faf7;
  border-radius: 8px;
}
.exp-date {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.exp-cat {
  font-size: 14.5px;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 6px;
}
.exp-desc {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exp-amount {
  font-size: 15px;
  font-weight: 850;
  color: #a53e3e;
  text-align: right;
  font-numeric: tabular-nums;
}
.exp-edit-btn {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  text-align: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--mint);
}
.expense-detail-row[open] {
  padding-bottom: 16px;
  background: #fbfdfc;
  border-radius: 10px;
  padding-inline: 8px;
}
.expense-list .expense-editor { padding: 18px 0; }

@media (max-width: 680px) {
  .expense-detail-row summary {
    grid-template-columns: auto 1fr auto;
    gap: 6px 8px;
    padding: 12px 6px;
  }
  .exp-date {
    grid-column: 1;
    font-size: 12px;
  }
  .exp-cat {
    grid-column: 2;
    font-size: 14px;
  }
  .exp-amount {
    grid-column: 3;
    font-size: 14.5px;
    text-align: right;
  }
  .exp-desc {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--muted);
  }
  .exp-edit-btn {
    display: none;
  }
}

/* ==========================================================================
   고정 비용(정기 지출) 관리 및 월별 일괄 반영 스타일
   ========================================================================== */
.fixed-expense-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1.5px solid #86efac;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(22, 101, 52, 0.06);
}
.fixed-banner-text {
  display: flex;
  align-items: center;
  gap: 14px;
}
.fixed-banner-text .banner-icon {
  font-size: 24px;
  flex-shrink: 0;
}
.fixed-banner-text strong {
  display: block;
  font-size: 14.5px;
  color: #166534;
  margin-bottom: 3px;
}
.fixed-banner-text p {
  margin: 0;
  font-size: 13px;
  color: #15803d;
}
.banner-action-btn {
  white-space: nowrap;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 800;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(22, 101, 52, 0.15);
}

.section-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-header-flex h2 {
  margin: 0 0 4px 0;
}
.section-header-flex p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}
.count-badge {
  padding: 3px 10px;
  border-radius: 20px;
  background: #eef3f0;
  color: var(--green-dark);
  font-size: 12.5px;
  font-weight: 800;
}

/* 새 고정 비용 추가 아코디언 */
.fixed-expense-new-disclosure {
  margin: 14px 0 18px;
  border: 1px dashed #bad5c4;
  border-radius: 10px;
  background: #fbfdfc;
  overflow: hidden;
}
.new-fixed-toggle-btn {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--green-dark);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.new-fixed-toggle-btn::-webkit-details-marker {
  display: none;
}
.new-fixed-toggle-btn:hover {
  background: #f0f7f3;
}
.fixed-expense-create-form {
  padding: 16px;
  border-top: 1px solid #e4eae6;
  background: white;
}
.fixed-create-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}
.fixed-create-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 750;
  color: #334155;
}
.fixed-create-grid input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13.5px;
  background: var(--panel);
}
.day-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.day-input-wrap input {
  width: 70px;
  text-align: center;
}
.fixed-create-action button {
  height: 42px;
  width: 100%;
  font-size: 13.5px;
  font-weight: 800;
  border-radius: 8px;
}

/* 고정 비용 테이블 */
.fixed-table-wrap {
  overflow-x: auto;
  border: 1px solid #e4eae6;
  border-radius: 10px;
}
.fixed-expenses-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 680px;
}
.fixed-expenses-table th {
  padding: 10px 12px;
  background: #edf3ef;
  color: #475569;
  font-weight: 800;
  text-align: left;
  border-bottom: 1px solid #cfdad3;
  white-space: nowrap;
}
.fixed-expenses-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2ef;
  vertical-align: middle;
  background: white;
}
.fixed-expenses-table tbody tr:hover td {
  background: #f8faf9;
}
.fixed-expenses-table .col-day {
  width: 120px;
  white-space: nowrap;
}
.target-date-hint {
  display: block;
  color: #94a3b8;
  font-size: 11px;
  margin-top: 2px;
}
.fixed-expenses-table .col-cat {
  width: 120px;
  font-size: 14px;
}
.fixed-expenses-table .col-desc {
  max-width: 160px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fixed-expenses-table .col-price {
  width: 190px;
}
.inline-price-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.inline-price-input-wrap input {
  width: 105px;
  height: 36px;
  padding: 0 8px;
  border: 1.5px solid #bad5c4;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 800;
  text-align: right;
  color: var(--green-dark);
}
.inline-price-input-wrap input:focus {
  border-color: var(--green);
  outline: 2px solid #bbf7d0;
}
.unit-won {
  font-size: 12.5px;
  font-weight: 700;
  color: #64748b;
}
.inline-save-btn {
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
}
.inline-save-btn:hover {
  background: #e2e8f0;
}

/* 상태 배지 */
.fixed-status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}
.fixed-status-badge.applied {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.fixed-status-badge.unapplied {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}
.unapplied-action-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.apply-single-btn {
  height: 30px;
  padding: 0 9px;
  font-size: 11.5px;
  font-weight: 800;
  border-radius: 6px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  cursor: pointer;
  white-space: nowrap;
}
.apply-single-btn:hover {
  background: #d1fae5;
}
.fixed-expenses-table .delete-btn {
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
  color: #dc2626;
  border-radius: 6px;
}
.fixed-expenses-table .delete-btn:hover {
  background: #fee2e2;
}

/* 지출 내역 row의 고정비 칩 */
.fixed-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #e0e7ff;
  color: #4338ca;
  font-size: 10.5px;
  font-weight: 800;
  vertical-align: middle;
}

/* 모바일 대응 미디어 쿼리 */
@media (max-width: 680px) {
  .fixed-expense-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
  }
  .banner-action-btn {
    width: 100%;
  }
  .fixed-create-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   품목 내보내기 및 가져오기 (Catalog Transfer) 전용 모던 UI
   ========================================================================== */
.transfer-page-wrapper {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 0 32px;
}

.transfer-back-bar {
  margin-bottom: 20px;
}

.transfer-back-bar .back-to-catalog {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: #3b5748;
  background: #f0f5f2;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #d3e2d8;
  text-decoration: none;
  transition: all 0.15s ease;
}

.transfer-back-bar .back-to-catalog:hover {
  background: #e2ede5;
  color: #194a31;
  border-color: #b7d1c1;
}

.transfer-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
  align-items: start;
}

.transfer-card {
  padding: 24px;
  border-radius: 16px;
  background: #ffffff;
  border: 1.5px solid #e1ebe4;
  box-shadow: 0 4px 20px rgba(18, 51, 33, 0.05);
}

.transfer-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #edf2ee;
}

.transfer-card-header .card-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: #eaf5ee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 1px solid #cce5d5;
}

.transfer-card-header h2 {
  margin: 0 0 4px 0;
  font-size: 19px;
  font-weight: 850;
  color: #1c3326;
  letter-spacing: -0.02em;
}

.transfer-card-header .card-subtext {
  margin: 0;
  font-size: 13px;
  color: #607567;
  line-height: 1.5;
}

/* 안내 박스 공통 */
.transfer-notice-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 11px;
  margin-bottom: 20px;
  line-height: 1.55;
  font-size: 13.5px;
}

.transfer-notice-box.info {
  background: #f3f9f5;
  border: 1px solid #cfe5d7;
  color: #274b37;
}

.transfer-notice-box.caution {
  background: #fffbf0;
  border: 1px solid #fae1b8;
  color: #724e12;
}

.transfer-notice-box .notice-icon {
  font-size: 18px;
  line-height: 1.2;
  flex-shrink: 0;
}

.transfer-notice-box .notice-content p {
  margin: 0;
}

.transfer-notice-box .notice-sub {
  margin-top: 5px !important;
  font-size: 12px;
  opacity: 0.85;
}

/* 1. 내보내기 액션 및 알림 */
.export-action-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-download-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 24px;
  font-size: 15px;
  font-weight: 800;
  border-radius: 10px;
  background: #1f6f4a;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(31, 111, 74, 0.2);
  transition: all 0.2s ease;
}

.export-download-btn:hover {
  background: #185a3c;
  box-shadow: 0 5px 14px rgba(31, 111, 74, 0.28);
  transform: translateY(-1px);
}

.export-download-btn.is-downloading {
  background: #2b7a52;
  box-shadow: 0 0 0 3px rgba(43, 122, 82, 0.25);
  transform: translateY(0);
}

.download-alert-banner {
  margin-top: 4px;
  padding: 13px 16px;
  border: 1.5px solid #8fd3af;
  border-radius: 11px;
  background: linear-gradient(135deg, #eef9f2 0%, #f6fcf8 100%);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(31, 111, 74, 0.08);
  animation: slideTransferAlert 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideTransferAlert {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.download-alert-banner .alert-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.download-alert-banner .alert-text strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: #135532;
  margin-bottom: 2px;
}

.download-alert-banner .alert-text p {
  margin: 0;
  font-size: 12.5px;
  color: #4b6656;
}

/* 2. 가져오기 폼 필드 */
.transfer-form {
  padding: 0;
}

.file-dropzone-wrapper {
  display: grid;
  gap: 8px;
}

.catalog-dropzone {
  border: 2px dashed #b7c7bc;
  border-radius: 12px;
  background: #f8faf8;
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  outline: none;
}

.catalog-dropzone:hover,
.catalog-dropzone.dragover {
  border-color: #1f6f4a;
  background: #eaf5ee;
}

.catalog-dropzone:focus-visible {
  border-color: #1f6f4a;
  box-shadow: 0 0 0 3px rgba(31, 111, 74, 0.2);
}

.dropzone-idle-view .dropzone-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
  line-height: 1;
}

.dropzone-idle-view .dropzone-title {
  font-size: 15.5px;
  font-weight: 800;
  color: #1f3729;
  margin: 0 0 6px;
}

.dropzone-idle-view .dropzone-subtitle {
  font-size: 13px;
  color: #6a7f72;
  margin: 0;
}

.dropzone-selected-view {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  background: #ffffff;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid #d1ded5;
}

.dropzone-selected-view .selected-icon {
  font-size: 30px;
  line-height: 1;
}

.dropzone-selected-view .selected-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.dropzone-selected-view .selected-filename {
  font-size: 15px;
  font-weight: 800;
  color: #164e33;
  word-break: break-all;
}

.dropzone-selected-view .selected-meta {
  font-size: 12.5px;
  color: #476352;
  font-weight: 600;
}

.dropzone-selected-view .change-file-btn {
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #c2d4c7;
  background: #f8faf8;
  color: #2c4a38;
  white-space: nowrap;
}

.dropzone-selected-view .change-file-btn:hover {
  background: #eef4f0;
  color: #164e33;
}

.file-upload-feedback.error-feedback {
  margin-top: 4px;
  font-size: 13px;
  color: #c92a2a;
  background: #fff5f5;
  border: 1px solid #ffc9c9;
  padding: 9px 14px;
  border-radius: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.import-actions-row {
  margin-top: 6px;
}

.preview-submit-btn {
  min-height: 45px;
  padding: 0 20px;
  font-size: 14.5px;
  font-weight: 800;
  border-radius: 9px;
  background: #1f6f4a;
  transition: opacity 0.2s ease;
}

.preview-submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #6a8274;
}

/* 중복 품목 처리 모드 선택 카드 */
.import-mode-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.import-mode-card.is-overwrite-mode {
  background: #faf5ff;
  border-color: #c084fc;
}

.imc-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.imc-icon {
  font-size: 26px;
  flex-shrink: 0;
}

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

.imc-title {
  font-size: 15px;
  font-weight: 850;
  color: #0f172a;
}

.badge-mode-safe {
  font-size: 12px;
  font-weight: 800;
  color: #15803d;
  background: #dcfce7;
  border: 1px solid #86efac;
  padding: 2px 8px;
  border-radius: 20px;
}

.badge-mode-overwrite {
  font-size: 12px;
  font-weight: 800;
  color: #7e22ce;
  background: #f3e8ff;
  border: 1px solid #d8b4fe;
  padding: 2px 8px;
  border-radius: 20px;
}

.imc-desc {
  margin: 3px 0 0 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.4;
}

/* 미리보기 화면 */
.import-preview-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preview-mode-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid;
}

.preview-mode-banner.is-safe {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.preview-mode-banner.is-overwrite {
  background: #faf5ff;
  border-color: #c084fc;
  color: #581c87;
}

.preview-mode-banner .pmb-icon {
  font-size: 24px;
}

.preview-mode-banner .pmb-text strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
}

.preview-mode-banner .pmb-text p {
  margin: 2px 0 0 0;
  font-size: 13px;
  opacity: 0.9;
}

.preview-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-badge {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.stat-badge.new {
  background: #eef7f2;
  color: #175d3c;
  border: 1px solid #b7ddc7;
}

.stat-badge.update {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #d8b4fe;
}

.stat-badge.skip {
  background: #f4f5f4;
  color: #55625b;
  border: 1px solid #dcdfdc;
}

.badge-update {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #d8b4fe;
  font-size: 11.5px;
  font-weight: 750;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-new {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  font-size: 11.5px;
  font-weight: 750;
  padding: 2px 6px;
  border-radius: 4px;
}

.preview-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #e0eae3;
  border-radius: 10px;
  background: #fbfdfc;
}

.preview-item-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #edf2ee;
  font-size: 13.5px;
}

.preview-item-list li:last-child {
  border-bottom: none;
}

.preview-price {
  font-weight: 700;
  color: #1d5f3d;
}

.import-confirm-form {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.apply-import-btn {
  min-height: 45px;
  padding: 0 22px;
  font-size: 14.5px;
  font-weight: 800;
  border-radius: 9px;
}

.cancel-import-btn {
  min-height: 45px;
  padding: 0 16px;
  font-size: 13.5px;
  background: #f0f4f1;
  color: #44594c;
  border: 1px solid #cedbd2;
  border-radius: 9px;
}

@media (max-width: 768px) {
  .transfer-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .transfer-card {
    padding: 18px 14px;
  }
  .export-download-btn,
  .preview-submit-btn,
  .apply-import-btn {
    width: 100%;
  }
}
.catalog-filter-fields { display:flex; flex-wrap:wrap; gap:10px; width:100%; }
.catalog-filter-fields select { min-height:44px; min-width:110px; }
.tax-label { display:inline-block; padding:3px 6px; border-radius:5px; background:var(--mint); color:var(--ink); font-size:12px; }

/* ==========================================================================
   품목 관리 (Catalog) UI/UX 전면 개편: 슬림 1행 검색바 · 접힘 필터 · 모던 카드
   ========================================================================== */
.catalog-workspace {
  --border: var(--line);
  --bg-canvas: var(--canvas);
  --bg-panel: var(--panel);
}

/* 1. 검색 및 상단 컨트롤 바 */
.catalog-controls {
  padding: 14px 16px;
  background: #ffffff;
  border-bottom: 1.5px solid #edf2ef;
}

.catalog-search-form {
  width: 100%;
}

.tax-select-wrapper {
  flex: 0 0 auto;
}

.catalog-tax-select {
  height: 42px;
  padding: 0 32px 0 12px;
  border: 1.5px solid #d2ded7;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: #1a2e22;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23526b5d' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.07 2.295 4 3.123 4h9.754c.828 0 1.238 1.07.672 1.658l-4.796 5.482a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat calc(100% - 10px) center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  min-width: 125px;
}

.catalog-tax-select:focus {
  border-color: #21764e;
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 118, 78, 0.15);
}

.catalog-tax-select.is-filtered {
  border-color: #21764e;
  background-color: #eaf5ee;
  color: #125530;
  font-weight: 850;
}

.search-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.search-input-wrapper {
  flex: 1 1 240px;
  min-width: 180px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  line-height: 1;
  color: #8da094;
  pointer-events: none;
  z-index: 2;
}

.search-input-wrapper input[type="search"] {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 42px !important;
  border: 1.5px solid #d2ded7;
  border-radius: 8px;
  font-size: 14px;
  background: #ffffff;
  color: #1a2e22;
  transition: all 0.15s ease;
}

.search-input-wrapper input[type="search"]:focus {
  border-color: #21764e;
  box-shadow: 0 0 0 3px rgba(33, 118, 78, 0.15);
  outline: none;
}

.search-btn {
  height: 42px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 750;
  border-radius: 8px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filter-toggle-btn {
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid #d2ded7;
  border-radius: 8px;
  background: #f4f8f5;
  color: #274535;
  font-size: 13.5px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-toggle-btn:hover {
  background: #eaf3ed;
  border-color: #21764e;
}

.filter-toggle-btn.has-active-filter {
  background: #e5f5eb;
  border-color: #21764e;
  color: #125530;
}

.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: #21764e;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 850;
}

.filter-caret {
  display: inline-block;
  font-size: 11px;
  color: #657b6e;
  transition: transform 0.2s ease;
}

.filter-toggle-btn.is-open .filter-caret {
  transform: rotate(180deg);
}

.clear-search-chip {
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  background: #fdf2ee;
  color: #b73e23;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  border: 1px solid #f6d1c8;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.clear-search-chip:hover {
  background: #fae4dc;
}

.catalog-controls .details-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.catalog-controls .details-actions button {
  height: 38px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 650;
  border-radius: 7px;
  background: #edf3ef;
  color: #435b4c;
  border: 1px solid #d9e4dd;
  white-space: nowrap;
}

.catalog-controls .details-actions button:hover {
  background: #e2ede5;
}

/* 상세 필터 패널 (기본 숨김, is-open 시 표시) */
.catalog-filter-panel {
  display: none;
  width: 100%;
  margin-top: 12px;
  background: #f8faf8;
  border: 1.5px solid #d4dfd8;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 6px 18px rgba(25, 45, 33, 0.05);
}

.catalog-filter-panel.is-open {
  display: block;
}

.filter-panel-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e3ece6;
}

.filter-panel-header strong {
  font-size: 14.5px;
  font-weight: 800;
  color: #1b3d29;
}

.filter-panel-header small {
  font-size: 12.5px;
  color: #667c6f;
}

/* 상세 필터 내 과세구분 칩 */
.tax-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tax-filter-row .filter-title {
  font-size: 13px;
  font-weight: 750;
  color: #2f4537;
  min-width: 60px;
}

.filter-tax-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tax-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1.5px solid #d0ded5;
  border-radius: 7px;
  background: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  color: #3b4e43;
  user-select: none;
  transition: all 0.15s ease;
}

.filter-tax-chip input[type="radio"] {
  display: none;
}

.filter-tax-chip .chip-box {
  width: 16px;
  height: 16px;
  border: 1.5px solid #94a79c;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: transparent;
  background: #ffffff;
  transition: all 0.15s ease;
}

.filter-tax-chip:has(input:checked),
.filter-tax-chip.is-checked {
  background: #eaf5ee;
  border-color: #21764e;
  color: #114c2f;
  font-weight: 800;
}

.filter-tax-chip:has(input:checked) .chip-box,
.filter-tax-chip.is-checked .chip-box {
  background: #21764e;
  border-color: #21764e;
  color: #ffffff;
}


.filter-actions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #e3ece6;
}

.filter-apply-btn {
  height: 40px;
  padding: 0 20px;
  font-size: 13.5px;
  font-weight: 750;
  border-radius: 7px;
}

.filter-reset-link {
  color: #63776b;
  font-size: 13px;
  font-weight: 650;
  text-decoration: underline;
  padding: 6px 10px;
}

.filter-reset-link:hover {
  color: #b73e23;
}

/* ==========================================================================
   2. 품목 상세 설정 (.product-detail-body) 탭 기반 모던 레이아웃
   ========================================================================== */
.catalog-record-details {
  border-top: 1px dashed #e3ede6;
}

.catalog-record-details > summary {
  padding: 10px 16px;
  background: #fafcfb;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  color: #255d3d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  transition: background 0.15s ease;
}

.catalog-record-details > summary::-webkit-details-marker {
  display: none;
}

.catalog-record-details > summary:hover {
  background: #f0f7f2;
}

.catalog-record-details[open] > summary {
  background: #edf5f0;
  border-bottom: 1.5px solid #d7e6dc;
}

.catalog-record-details .product-detail-body {
  background: #f4f8f5;
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* 2-1. 상세 서브 탭 바 */
.product-tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #dbe6df;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.product-tab-nav::-webkit-scrollbar {
  display: none;
}

.product-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #526b5d;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px 6px 0 0;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.product-tab-btn:hover {
  color: #1a4d30;
  background: rgba(33, 118, 78, 0.06);
}

.product-tab-btn.is-active {
  color: #14492b;
  border-bottom-color: #21764e;
  font-weight: 850;
  background: #ffffff;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.02);
}

.product-tab-btn .tab-icon {
  font-size: 14px;
}

.product-tab-btn .tab-badge {
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 10px;
  background: #e2ede6;
  color: #235d3a;
}

.product-tab-btn.is-active .tab-badge {
  background: #21764e;
  color: #ffffff;
}

.product-tab-btn .tab-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

/* 2-2. 탭 패널 공통 */
.product-tab-panel {
  display: none;
  background: #ffffff;
  border: 1px solid #dce5df;
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(18, 38, 26, 0.03);
}

.product-tab-panel.is-active {
  display: block;
  animation: tabFadeIn 0.15s ease-out;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-panel-intro {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f4f1;
}

.panel-intro-badge {
  font-size: 12px;
  font-weight: 800;
  color: #1a5634;
  background: #e8f3ec;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.panel-intro-text {
  font-size: 12px;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}

.tab-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #edf3ef;
  flex-wrap: wrap;
}

.tab-submit-btn {
  height: 38px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 750;
  border-radius: 6px;
  white-space: nowrap;
  margin-left: auto;
}

/* 2-3. 탭 1: 기본 규격 · 등급단가 · 별칭 통합 탭 */
.detail-section-block {
  margin-bottom: 0;
}
.detail-section-block:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   2-4. 품목 관리 우측 사이드 패널 (Split View / Side Drawer)
   ========================================================================== */
.catalog-split-layout {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  width: 100%;
  position: relative;
  transition: all 0.25s ease;
}

.catalog-master-col {
  flex: 1 1 100%;
  min-width: 0;
  transition: flex 0.25s ease;
}

.catalog-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.catalog-row-actions .btn-row-save,
.catalog-row-actions .btn-open-drawer {
  min-height: 43px;
  height: 43px;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 750;
  border-radius: 8px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-sizing: border-box;
}

.btn-open-drawer {
  background: #f0f7f3;
  color: #1e6b43;
  border: 1.5px solid #cbe0d3;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-open-drawer:hover {
  background: #21764e;
  color: #ffffff;
  border-color: #21764e;
}

.catalog-record.is-drawer-active {
  background: #f2f9f4 !important;
  border-left: 4px solid #21764e !important;
  box-shadow: 0 2px 10px rgba(33, 118, 78, 0.08);
}

.catalog-record.is-drawer-active .btn-open-drawer {
  background: #21764e;
  color: #ffffff;
  border-color: #21764e;
}

/* 우측 전체화면 사이드 패널 (Full-Height Side Drawer) */
body.has-product-drawer main {
  margin-right: 520px;
}

.catalog-side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  height: 100vh;
  background: #ffffff;
  border-left: 1.5px solid #d2e2d8;
  box-shadow: -8px 0 32px rgba(18, 48, 30, 0.12);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
}

.catalog-side-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.side-drawer-header {
  padding: 16px 22px;
  background: #f4f8f5;
  border-bottom: 1.5px solid #dce8e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.side-drawer-kicker {
  font-size: 11.5px;
  font-weight: 850;
  color: #1e6b43;
  letter-spacing: 0.06em;
  display: block;
}

.side-drawer-title {
  font-size: 18px;
  font-weight: 850;
  color: #122b1c;
  margin: 3px 0 0;
}

.side-drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #cedcd3;
  background: #ffffff;
  font-size: 17px;
  cursor: pointer;
  color: #4a6354;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.side-drawer-close:hover {
  background: #eef5f1;
  color: #122b1c;
  border-color: #21764e;
}

.side-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px;
  background: #f7faf8;
}

/* 사이드 드로어 공통 섹션 헤더 (군더더기 설명문 제거 & 시원한 15px 볼드) */
.drawer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid #e2ece5;
}

.drawer-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 850;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-sub-badge {
  font-size: 11.5px;
  font-weight: 800;
  color: #166534;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 4px;
}

.drawer-props-stack {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px 12px !important;
}

.drawer-props-stack .detail-field span {
  font-size: 13.5px !important;
  font-weight: 750 !important;
  color: #334155 !important;
  margin-bottom: 4px;
}

.drawer-props-stack .detail-field input,
.drawer-props-stack .detail-field select {
  height: 40px !important;
  font-size: 14px !important;
  border-radius: 8px !important;
  padding: 0 12px !important;
  background: #ffffff !important;
  border: 1px solid #cedcd3 !important;
}

.drawer-props-stack .detail-field input:focus,
.drawer-props-stack .detail-field select:focus {
  border-color: #21764e !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 118, 78, 0.12) !important;
}

.drawer-props-stack .full-col {
  grid-column: 1 / -1 !important;
}

.drawer-props-stack .detail-props-submit {
  grid-column: 1 / -1 !important;
  margin-top: 6px;
}

/* 사이드 드로어 내 하단 저장 버튼 전체폭(Full Width) 통일 스타일 */
.drawer-full-save-btn {
  width: 100% !important;
  height: 44px !important;
  min-height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  font-size: 15px !important;
  font-weight: 850 !important;
  border-radius: 8px !important;
  background: #21764e !important;
  color: #ffffff !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: 0 2px 6px rgba(33, 118, 78, 0.18) !important;
  transition: all 0.15s ease !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

.drawer-full-save-btn:hover {
  background: #195e3e !important;
  box-shadow: 0 4px 12px rgba(33, 118, 78, 0.28) !important;
  transform: translateY(-1px);
}

.drawer-full-save-btn:active {
  transform: translateY(0);
}

.drawer-rules-grid {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
}

.drawer-rules-grid .rule-card-body {
  grid-template-columns: 1fr 1.35fr 1fr !important;
  gap: 10px !important;
}

.drawer-rules-grid .rule-label {
  font-size: 13px !important;
  font-weight: 750 !important;
  color: #334155 !important;
  margin-bottom: 3px;
}

.drawer-rules-grid .rule-field select,
.drawer-rules-grid .input-with-unit input {
  height: 38px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
}

.drawer-rules-grid .unit-text {
  font-size: 13px !important;
  font-weight: 800 !important;
}

.drawer-alias-bar {
  display: grid !important;
  grid-template-columns: 1.2fr 1fr !important;
  gap: 8px 10px !important;
  align-items: center !important;
  padding: 12px 14px !important;
  background: #f4f8f5 !important;
  border: 1px dashed #b8d4c3 !important;
  border-radius: 10px !important;
}

.drawer-alias-bar .add-bar-label {
  grid-column: 1 / -1;
  font-size: 13.5px !important;
  font-weight: 850 !important;
  color: #1e4d32 !important;
  margin-bottom: 2px;
}

.drawer-alias-bar input {
  grid-column: 1 / -1;
  width: 100% !important;
  height: 40px !important;
  flex: none !important;
  border: 1px solid #cedcd3 !important;
  border-radius: 7px !important;
  padding: 0 12px !important;
  font-size: 14px !important;
  background: #ffffff !important;
  box-sizing: border-box !important;
}

.drawer-alias-bar select {
  width: 100% !important;
  height: 40px !important;
  flex: none !important;
  border: 1px solid #cedcd3 !important;
  border-radius: 7px !important;
  padding: 0 10px !important;
  font-size: 14px !important;
  background: #ffffff !important;
  box-sizing: border-box !important;
}

.drawer-alias-bar button {
  width: 100% !important;
  height: 40px !important;
  padding: 0 14px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  border-radius: 7px !important;
  white-space: nowrap !important;
  flex: none !important;
  box-sizing: border-box !important;
}

.side-drawer-backdrop {
  display: none;
}

/* 모바일 & 태블릿 (1024px 이하) 슬라이드오버 드로어 */
@media (max-width: 1024px) {
  body.has-product-drawer main {
    margin-right: 0 !important;
  }

  .catalog-side-drawer {
    width: 92vw;
    max-width: 460px;
    border-radius: 16px 0 0 16px;
    z-index: 1050;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.22);
  }

  body.has-product-drawer .side-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1040;
  }
}

/* ==========================================================================
   주문 확인 페이지 - 품목 추가 사이드 패널 (Split View / Side Drawer)
   ========================================================================== */
body.has-order-item-drawer main {
  margin-right: 460px;
  transition: margin-right 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.order-item-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 460px;
  height: 100vh;
  background: #ffffff;
  border-left: 1.5px solid #d2e2d8;
  box-shadow: -8px 0 32px rgba(18, 48, 30, 0.14);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
}

.order-item-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.order-item-drawer .side-drawer-body {
  padding: 20px;
  background: #f7faf8;
  flex: 1 1 auto;
  overflow-y: auto;
}

.order-item-drawer .add-item-form-group {
  margin-bottom: 14px;
}

.order-item-drawer .add-item-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 6px;
}

.order-item-drawer .add-item-form-group input,
.order-item-drawer .add-item-form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #d2e2d8;
  border-radius: 8px;
  font-size: 13.5px;
  background: #ffffff;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.order-item-drawer .add-item-form-group input:focus,
.order-item-drawer .add-item-form-group select:focus {
  border-color: #21764e;
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 118, 78, 0.12);
}

.order-item-drawer .add-item-tip {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

.order-item-drawer .add-item-drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.order-drawer-backdrop {
  display: none;
}

.sheet-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-sheet-head-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(22, 101, 52, 0.18);
  white-space: nowrap;
}

@media (max-width: 1024px) {
  body.has-order-item-drawer main {
    margin-right: 0 !important;
  }
  .order-item-drawer {
    width: 92vw;
    max-width: 460px;
    border-radius: 16px 0 0 16px;
    z-index: 1050;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.22);
  }
  .order-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    display: block;
  }
  .order-drawer-backdrop.is-open {
    opacity: 1;
    visibility: visible;
  }
}

html[data-theme="dark"] .order-item-drawer {
  background: var(--panel, #1e293b);
  border-color: var(--line, #334155);
}
html[data-theme="dark"] .order-item-drawer .side-drawer-body {
  background: var(--canvas, #0f172a);
}
html[data-theme="dark"] .order-item-drawer .add-item-form-group label {
  color: #cbd5e1;
}
html[data-theme="dark"] .order-item-drawer .add-item-form-group input,
html[data-theme="dark"] .order-item-drawer .add-item-form-group select {
  background: var(--panel, #1e293b);
  border-color: var(--line, #334155);
  color: #f1f5f9;
}
html[data-theme="dark"] .order-item-drawer .add-item-drawer-actions {
  border-color: var(--line, #334155);
}

/* ==========================================================================
   주문 상세 직접 편집 모달 (Order Edit Modal)
   ========================================================================== */
.order-edit-dialog {
  padding: 0;
  border: none;
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.28);
  max-width: 900px;
  width: 95vw;
  background: #ffffff;
  color: #1e293b;
  overflow: hidden;
}

.order-edit-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2.5px);
}

.order-edit-dialog-content {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}

.order-edit-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
}

.order-edit-dialog-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.order-edit-dialog-title-wrap h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}

.order-edit-dialog-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.order-edit-partner-info-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: #f1f5f9;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  font-size: 13.5px;
}

.order-edit-table-wrap {
  overflow-x: auto;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
}

.order-edit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

.order-edit-table th {
  background: #f8fafc;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  border-bottom: 1.5px solid #e2e8f0;
  white-space: nowrap;
}

.order-edit-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.order-edit-table tr:hover {
  background: #fafaf9;
}

.order-edit-input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  background: #ffffff;
  box-sizing: border-box;
}

.order-edit-input:focus {
  border-color: #21764e;
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 118, 78, 0.12);
}

.order-edit-input.qty-input {
  max-width: 90px;
  text-align: right;
  font-weight: 700;
}

.order-edit-input.price-input {
  max-width: 120px;
  text-align: right;
  font-weight: 700;
}

.order-edit-total-cell {
  font-weight: 800;
  color: #0f172a;
  text-align: right;
  white-space: nowrap;
  font-size: 14px;
}

.btn-order-item-delete {
  padding: 5px 9px;
  font-size: 13px;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-order-item-delete:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #b91c1c;
}

.btn-order-item-relink {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 700;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-order-item-relink:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

html[data-theme="dark"] .btn-order-item-relink {
  background: #1e3a8a33;
  border-color: #1e40af;
  color: #60a5fa;
}

html[data-theme="dark"] .btn-order-item-relink:hover {
  background: #1e3a8a66;
  border-color: #3b82f6;
  color: #93c5fd;
}

.order-edit-dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: #f8fafc;
  border-top: 1.5px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 12px;
}

.order-edit-grand-total {
  font-size: 15px;
  font-weight: 700;
  color: #334155;
}

.order-edit-grand-total strong {
  font-size: 18px;
  color: #166534;
  margin-left: 4px;
}

.order-edit-footer-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}

html[data-theme="dark"] .order-edit-dialog {
  background: var(--panel, #1e293b);
  color: #f1f5f9;
}

html[data-theme="dark"] .order-edit-dialog-header,
html[data-theme="dark"] .order-edit-dialog-footer {
  background: #0f172a;
  border-color: var(--line, #334155);
}

html[data-theme="dark"] .order-edit-dialog-title-wrap h3 {
  color: #f8fafc;
}

html[data-theme="dark"] .order-edit-partner-info-strip {
  background: #0f172a;
  border-color: var(--line, #334155);
}

html[data-theme="dark"] .order-edit-table-wrap {
  border-color: var(--line, #334155);
  background: var(--panel, #1e293b);
}

html[data-theme="dark"] .order-edit-table th {
  background: #0f172a;
  color: #94a3b8;
  border-bottom-color: var(--line, #334155);
}

html[data-theme="dark"] .order-edit-table td {
  border-bottom-color: var(--line, #334155);
}

html[data-theme="dark"] .order-edit-table tr:hover {
  background: #243248;
}

html[data-theme="dark"] .order-edit-input {
  background: #0f172a;
  border-color: var(--line, #334155);
  color: #f8fafc;
}

html[data-theme="dark"] .order-edit-total-cell {
  color: #f8fafc;
}

html[data-theme="dark"] .order-edit-grand-total {
  color: #cbd5e1;
}

html[data-theme="dark"] .order-edit-grand-total strong {
  color: #4ade80;
}

/* 2-3. 단일 컴팩트 상세 설정 패널 */
.product-detail-compact-body {
  background: #f7faf8;
  border: 1px solid #dce5df;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(18, 38, 26, 0.03);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-extra-props-form {
  background: #ffffff;
  border: 1px solid #e1ebe4;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.detail-props-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(140px, 1.2fr) minmax(120px, 1fr) auto;
  gap: 12px;
  align-items: flex-end;
}

.detail-props-submit {
  display: flex;
  align-items: flex-end;
}

.detail-save-btn {
  height: 38px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 750;
  border-radius: 6px;
  white-space: nowrap;
}

.alias-integrated-block {
  background: #ffffff;
  border: 1px solid #e1ebe4;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  margin-top: 0;
}

.calc-integrated-block {
  background: #ffffff;
  border: 1px solid #e1ebe4;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.alias-integrated-block .alias-chips-container {
  margin-bottom: 12px;
}

.info-fields-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.8fr) minmax(110px, 1.1fr) minmax(110px, 1.1fr) minmax(110px, 1.1fr) minmax(90px, 0.9fr) minmax(105px, 1fr);
  gap: 10px;
}
@media (max-width: 1200px) {
  .info-fields-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.detail-field span {
  font-size: 12.5px;
  font-weight: 700;
  color: #334a3c;
}

.detail-field .req-star {
  color: #e11d48;
}

.detail-field input,
.detail-field select {
  width: 100%;
  height: 38px;
  border: 1px solid #cedcd3;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13.5px;
  background: #ffffff;
  color: #192e22;
  transition: border-color 0.15s ease;
}

.detail-field input:focus,
.detail-field select:focus {
  border-color: #21764e;
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 118, 78, 0.12);
}

.info-help-text {
  font-size: 12px;
  color: #64748b;
}

.price-history-strip {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #e2ede5;
}

.history-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.history-strip-header strong {
  font-size: 12.5px;
  font-weight: 750;
  color: #334155;
}

.history-count {
  font-size: 11.5px;
  color: #64748b;
}

.history-strip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f1f5f3;
  border: 1px solid #e0ece3;
  border-radius: 6px;
  font-size: 11.5px;
  color: #334155;
}

.history-kind {
  font-weight: 800;
  color: #1e3a2b;
  background: #e2ede6;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10.5px;
}

.history-vals {
  color: #475569;
}

.history-vals strong {
  color: #0f172a;
}

.history-date {
  color: #94a3b8;
  font-size: 11px;
}

/* 2-4. 탭 2: 가격 자동 계산 및 과세 설정 */
.product-calc-tab-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.calc-section-box {
  background: #fbfdfc;
  border: 1px solid #e0eae3;
  border-radius: 8px;
  padding: 12px 16px;
}

.section-box-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.section-box-title {
  font-size: 13px;
  font-weight: 800;
  color: #16462c;
}

.section-box-hint {
  font-size: 11.5px;
  color: #64748b;
}

.tax-segmented-control {
  display: inline-flex;
  background: #eef4f0;
  padding: 3px;
  border-radius: 8px;
  gap: 2px;
  border: 1px solid #d8e6dc;
}

.tax-seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
  color: #475569;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.tax-seg-btn input[type="radio"] {
  display: none;
}

.tax-seg-btn:hover {
  color: #1e293b;
}

.tax-seg-btn.is-checked {
  background: #21764e;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.calc-rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.calc-rule-card {
  background: #ffffff;
  border: 1px solid #dbe6df;
  border-radius: 8px;
  padding: 12px 14px;
}

.rule-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f6f2;
}

.rule-flow-badge {
  font-size: 12.5px;
  font-weight: 800;
  color: #164e2d;
  background: #eaf3ee;
  padding: 2px 8px;
  border-radius: 4px;
}

.rule-toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.rule-toggle-switch input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #21764e;
  cursor: pointer;
}

.rule-toggle-switch .toggle-text {
  font-size: 12px;
  font-weight: 750;
  color: #334155;
}

.rule-card-body {
  display: grid;
  grid-template-columns: 0.95fr 1.25fr 0.95fr;
  gap: 8px;
}

.rule-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rule-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
}

.rule-field select,
.input-with-unit input {
  height: 36px;
  border: 1px solid #cedcd3;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
  background: #ffffff;
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-unit input {
  width: 100%;
  padding-right: 24px;
  text-align: right;
  font-weight: 750;
}

.input-with-unit .unit-text {
  position: absolute;
  right: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  pointer-events: none;
}

.tab-guide-text {
  font-size: 11.5px;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
  flex: 1 1 300px;
}

/* 2-5. 탭 3: 주문 별칭 칩 태그 관리 */
.alias-tab-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alias-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
  align-items: center;
}

.alias-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #edf6f0;
  border: 1px solid #c9ded0;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 750;
  color: #1a4d2e;
  transition: all 0.15s ease;
}

.alias-tag-chip:hover {
  border-color: #a9cfb5;
  background: #e5f2e9;
}

.alias-tag-name {
  font-size: 13px;
}

.alias-partner-tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #ffffff;
  color: #21764e;
  border: 1px solid #bddac6;
  font-weight: 600;
}

.alias-partner-tag.is-all {
  background: #e2ede5;
  color: #475569;
  border-color: #cbdcd1;
}

.alias-quick-del-form {
  display: inline-flex;
  margin: 0;
}

.alias-tag-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: none;
  background: #d8eadc;
  color: #255d3d;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
}

.alias-tag-del:hover {
  background: #fee2e2;
  color: #dc2626;
  transform: scale(1.1);
}

.empty-alias-strip {
  padding: 8px 0;
  color: #64748b;
  font-size: 12.5px;
}

.alias-inline-add-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8faf9;
  border: 1px dashed #c8dcd0;
  border-radius: 8px;
  padding: 10px 14px;
  flex-wrap: wrap;
}

.add-bar-label {
  font-size: 12.5px;
  font-weight: 800;
  color: #16462c;
  white-space: nowrap;
}

.alias-inline-add-bar input {
  flex: 1 1 180px;
  height: 38px;
  border: 1px solid #cedcd3;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13px;
  background: #ffffff;
}

.alias-inline-add-bar select {
  flex: 0 1 180px;
  height: 38px;
  border: 1px solid #cedcd3;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
  background: #ffffff;
}
/* 거래처 검색 가능 드롭다운 */
.alias-partner-search-wrap {
  position: relative;
  flex: 0 1 180px;
  min-width: 140px;
}

.alias-partner-search-input {
  width: 100%;
  height: 38px;
  border: 1px solid #cedcd3;
  border-radius: 6px;
  padding: 0 28px 0 8px;
  font-size: 13px;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E") no-repeat right 8px center;
  cursor: pointer;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alias-partner-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 999;
  background: #ffffff;
  border: 1px solid #cedcd3;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  width: 220px;
  overflow: hidden;
}

.alias-partner-filter {
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-bottom: 1px solid #e8f0ec;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  background: #f7faf8;
}

.alias-partner-list {
  max-height: 200px;
  overflow-y: auto;
}

.alias-partner-option {
  padding: 8px 12px;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.12s;
}

.alias-partner-option:hover {
  background: #e8f5ee;
  color: #047857;
}

.alias-add-submit-btn {
  height: 38px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 750;
  border-radius: 6px;
  white-space: nowrap;
}

/* ==========================================================================
   3. 다크 모드 및 반응형 (PC & 모바일 760px, 370px)
   ========================================================================== */
@media screen {
  html[data-theme="dark"] .catalog-controls { background: var(--panel); border-color: var(--line); }
  html[data-theme="dark"] .catalog-filter-panel { background: var(--canvas); border-color: var(--line); }
  html[data-theme="dark"] .catalog-setting-card { background: var(--panel); border-color: var(--line); }
  html[data-theme="dark"] .current-price-card { background: rgba(255,255,255,0.03); border-color: var(--line); }
  html[data-theme="dark"] .catalog-tax-select { background-color: var(--canvas); border-color: var(--line); color: var(--ink); }
  html[data-theme="dark"] .catalog-tax-select.is-filtered { background-color: rgba(33, 118, 78, 0.25); border-color: #10b981; color: #a7f3d0; }
  html[data-theme="dark"] .catalog-side-drawer { background: var(--panel); border-color: var(--line); }
  html[data-theme="dark"] .side-drawer-header { background: var(--canvas); border-color: var(--line); }
  html[data-theme="dark"] .side-drawer-title { color: var(--ink); }
  html[data-theme="dark"] .side-drawer-close { background: var(--panel); border-color: var(--line); color: var(--ink); }
  html[data-theme="dark"] .side-drawer-body { background: var(--canvas); }
  html[data-theme="dark"] .btn-open-drawer { background: var(--canvas); border-color: var(--line); color: var(--ink); }
  html[data-theme="dark"] .catalog-record.is-drawer-active { background: rgba(33, 118, 78, 0.15) !important; border-left-color: #10b981 !important; }
}

@media (max-width: 760px) {
  .search-bar-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .tax-select-wrapper {
    width: 100%;
  }
  .catalog-tax-select {
    width: 100%;
    height: 42px;
  }
  .search-input-wrapper {
    width: 100%;
    flex: 1 1 100%;
  }
  .search-btn-group {
    display: flex;
    width: 100%;
    gap: 8px;
  }
  .search-btn-group .search-btn {
    flex: 1;
    min-height: 42px;
  }
  .search-btn-group .clear-search-chip {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 14px;
    justify-content: center;
  }
  .catalog-controls .details-actions {
    width: 100%;
    display: flex;
    gap: 8px;
    margin-top: 2px;
  }
  .catalog-controls .details-actions button {
    flex: 1;
    height: 38px;
    justify-content: center;
    text-align: center;
  }
  /* 품목 상세 설정 모바일 반응형 */
  .product-detail-body,
  .product-detail-compact-body {
    padding: 12px 10px 14px;
    gap: 12px;
  }
  .detail-extra-props-form,
  .calc-integrated-block,
  .alias-integrated-block {
    padding: 12px 10px;
  }
  .detail-props-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .detail-save-btn {
    width: 100%;
    margin-top: 4px;
  }
  .product-tab-nav {
    gap: 2px;
    margin-bottom: 10px;
  }
  .product-tab-btn {
    padding: 7px 10px;
    font-size: 12px;
    gap: 4px;
  }
  .product-tab-panel {
    padding: 14px 12px;
  }
  .info-fields-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .info-fields-grid > label:first-child {
    grid-column: 1 / -1;
  }
  .calc-rules-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .rule-card-body {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .tax-segmented-control {
    width: 100%;
    display: flex;
  }
  .tax-seg-btn {
    flex: 1;
    padding: 6px 4px;
    text-align: center;
  }
  .tab-panel-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .tab-submit-btn {
    width: 100%;
    justify-content: center;
  }
  .alias-inline-add-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .alias-inline-add-bar input,
  .alias-inline-add-bar select,
  .alias-add-submit-btn {
    width: 100%;
    flex: none;
  }
}

@media (max-width: 400px) {
  .catalog-controls {
    padding: 10px 12px;
  }
  .search-input-wrapper input[type="search"] {
    height: 40px;
    font-size: 13.5px;
  }
  .search-btn-group .search-btn,
  .search-btn-group .filter-toggle-btn {
    height: 40px;
    font-size: 12.5px;
  }
  .filter-actions-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .filter-apply-btn {
    width: 100%;
    height: 42px;
    justify-content: center;
  }
  .filter-reset-link {
    text-align: center;
    display: block;
  }
  .filter-tax-chips {
    width: 100%;
    gap: 6px;
  }
  .filter-tax-chip {
    flex: 1 1 calc(33.333% - 6px);
    justify-content: center;
    padding: 6px 6px;
    font-size: 12.5px;
  }
  .tax-chip-selector {
    width: 100%;
    gap: 6px;
  }
  .tax-check-chip {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
    padding: 8px 10px;
    font-size: 13px;
  }
  .catalog-setting-card {
    padding: 14px 12px;
  }
  .product-fields-grid {
    grid-template-columns: 1fr;
  }
  .add-panel-inputs {
    flex-direction: column;
    align-items: stretch;
  }
  .add-panel-inputs input,
  .add-panel-inputs select,
  .add-alias-btn {
    width: 100%;
  }
}


/* ==========================================================================
   거래처 입금 및 미수금 관리 (Deposits & Receivables) UI
   ========================================================================== */
.deposits-top-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}
.deposits-title-group h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--text-color, #1e293b);
}
.deposits-title-group p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted, #64748b);
}
/* 공통 월 선택 네비게이션 컨트롤 */
.month-nav-group,
.deposits-month-nav,
.month-selector-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel, #ffffff);
  padding: 3px;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  flex-shrink: 0;
}

.month-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap !important;
  flex-shrink: 0;
  transition: all 0.15s ease;
  line-height: 1;
}

.month-nav-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}

.month-nav-btn:active {
  transform: scale(0.97);
}

.month-nav-group input[type="month"],
.deposits-month-nav input[type="month"],
.month-selector-group input[type="month"] {
  height: 32px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 800;
  color: #1e293b;
  text-align: center;
  cursor: pointer;
  outline: none;
}

.month-nav-group input[type="month"]:hover,
.deposits-month-nav input[type="month"]:hover,
.month-selector-group input[type="month"]:hover {
  background: #f8fafc;
}

/* 입금 관리 상단 컨트롤 바 & 일체형 세그먼트 탭 */
.deposits-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.deposits-segmented-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  overflow-x: auto;
  max-width: 100%;
}

.seg-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 750;
  color: #475569;
  border-radius: 7px;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
}
.seg-tab-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #0f172a;
}
.seg-tab-btn.active {
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

/* 탭 뱃지 */
.tab-badge {
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-weight: 700;
  line-height: 1.2;
}
.tab-badge.warning {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.tab-badge.error {
  background: #fee2e2;
  color: #b91c1c;
}
.tab-badge.count {
  background: #e2e8f0;
  color: #334155;
}

/* 은행 계좌 & SMS 안내 팝오버 (Fixed 포지셔닝으로 상위 overflow 프레임 클리핑 완전 방지) */
.help-q-mark-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #1e293b;
  font-size: 13.5px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  margin-left: 4px;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
  user-select: none;
}
.help-q-mark-btn:hover,
.help-q-mark-btn:focus-visible,
.help-q-mark-btn.is-active {
  background: #2563eb;
  color: #ffffff;
  transform: scale(1.08);
}

.sms-help-popover {
  display: none;
  position: fixed;
  z-index: 99999;
  width: 340px;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
  animation: smsHelpFadeIn 0.15s ease-out;
}
.sms-help-popover.is-open {
  display: block;
}

@keyframes smsHelpFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.sms-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.sms-help-title {
  font-size: 15px;
  font-weight: 800;
  color: #60a5fa;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sms-help-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s ease;
}
.sms-help-close:hover {
  color: #ffffff;
}

.sms-help-body {
  font-size: 13.5px;
  line-height: 1.6;
  color: #e2e8f0;
}
.sms-help-body p {
  margin: 0 0 10px 0;
}
.sms-help-body strong {
  color: #93c5fd;
  font-weight: 700;
}
.sms-help-checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sms-help-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  color: #cbd5e1;
}
.sms-help-checklist li::before {
  content: '✔';
  color: #38bdf8;
  font-weight: bold;
}

/* 모바일 전용 반응형: 화면 중앙에 깔끔한 오버레이 카드로 팝업 */
@media (max-width: 768px) {
  .sms-help-popover {
    width: calc(100% - 36px) !important;
    max-width: 380px;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5), 0 0 0 9999px rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 14px;
  }
  .sms-help-popover.is-open {
    display: block;
    animation: smsHelpPopMobile 0.2s ease-out;
  }
  @keyframes smsHelpPopMobile {
    from { opacity: 0; transform: translate(-50%, -46%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
  }
  .sms-help-title {
    font-size: 16px;
  }
  .sms-help-body {
    font-size: 14px;
  }
  .sms-help-close {
    font-size: 22px;
    padding: 6px;
  }
}

/* 상단 메인 액션 버튼: [＋ 입금 직접 등록] */
.btn-deposit-main-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 18px;
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 9px;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-deposit-main-add:hover {
  background: #15803d;
  transform: translateY(-1px);
}

/* 거래처 정산 테이블 상단 검색바 및 툴바 */
.deposits-table-container .table-header-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.header-title-box h3 {
  margin: 0 0 4px 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}
.header-search-box .partner-search-filter {
  width: 320px;
  max-width: 100%;
  height: 38px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13.5px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.header-search-box .partner-search-filter:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* 테이블 행 클릭 가능 표시 및 활성 상태 */
.deposit-partner-row {
  cursor: pointer;
  transition: background 0.12s ease;
}
.deposit-partner-row:hover {
  background: #f1f5f9;
}
.deposit-partner-row.is-drawer-active,
.partner-settle-card.is-drawer-active {
  background: #eff6ff !important;
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

/* [신규 드로어 1: 거래처 당월 입금 내역 장부] */
.partner-history-drawer {
  width: 560px;
}
.history-summary-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1.5px dashed #cbd5e1;
  flex-wrap: wrap;
}
.history-amounts-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: #475569;
}
.history-amounts-summary .has-sep {
  color: #cbd5e1;
}
.btn-history-add-deposit {
  height: 32px;
  padding: 0 12px;
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}
.btn-history-add-deposit:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.history-list-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1.5px solid #e2e8f0;
}
.history-section-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
}
.history-count-badge {
  font-size: 12.5px;
  font-weight: 800;
  background: #e2e8f0;
  color: #334155;
  padding: 2px 8px;
  border-radius: 10px;
}

/* 입금 내역 카드 아이템 */
.history-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.history-item-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.history-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.history-item-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.history-item-date {
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
}
.history-method-badge {
  font-size: 12px;
  font-weight: 750;
  padding: 2px 7px;
  border-radius: 4px;
}
.history-method-badge.badge-method-card {
  background: #e0e7ff;
  color: #3730a3;
}
.history-method-badge.badge-method-bank {
  background: #dcfce7;
  color: #166534;
}
.history-bank-pill {
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}
.history-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-item-amount {
  font-size: 15px;
  font-weight: 850;
  color: #15803d;
}
.btn-history-item-delete {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  transition: background 0.12s ease;
}
.btn-history-item-delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}
.history-item-sub {
  font-size: 12.5px;
  color: #64748b;
}
.history-item-memo {
  font-size: 13px;
  color: #334155;
  background: #f8fafc;
  padding: 4px 8px;
  border-radius: 5px;
  border-left: 3px solid #cbd5e1;
}

/* 입금 내역 빈 상태 */
.history-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px 16px;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  text-align: center;
}
.history-empty-state .empty-icon {
  font-size: 28px;
}
.history-empty-state .empty-text {
  font-size: 13.5px;
  color: #64748b;
  margin: 0;
}
.history-empty-state .btn-empty-action {
  margin-top: 6px;
  height: 34px;
  padding: 0 14px;
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.12s ease;
}
.history-empty-state .btn-empty-action:hover {
  background: #15803d;
}

/* [드로어 2: 거래처 직접 선택 바 및 자동완성 팝오버] */
.drawer-partner-select-box {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.partner-autocomplete-wrap {
  position: relative;
  margin-top: 6px;
}
.drawer-autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 1050;
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
.drawer-autocomplete-item {
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 13.5px;
  color: #0f172a;
  transition: background 0.1s ease;
}
.drawer-autocomplete-item:hover {
  background: #eff6ff;
  color: #1d4ed8;
}
.drawer-autocomplete-item small {
  color: #64748b;
  font-size: 12px;
}
.drawer-autocomplete-empty {
  padding: 10px 12px;
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
}

/* 기존 레거시 deposits-tab-bar 하위 호환 */
.deposits-tab-bar {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--border-color, #e2e8f0);
  margin-bottom: 20px;
  padding-bottom: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.deposits-tab-bar::-webkit-scrollbar {
  display: none;
}
.deposits-tab-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  border-radius: 9px;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap !important;
  flex-shrink: 0;
  border: 1px solid transparent;
}
.deposits-tab-item:hover {
  color: var(--primary-color, #2563eb);
  background: #f8fafc;
}
.deposits-tab-item.active {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
  font-weight: 800;
}

/* 4대 핵심 요약 KPI 카드 그리드 */
.deposits-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.kpi-card-alert {
  border-color: #fca5a5;
  background: #fff8f8;
}
.kpi-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-color, #0f172a);
  letter-spacing: -0.02em;
}
.kpi-value small {
  font-size: 0.95rem;
  font-weight: 600;
  margin-left: 2px;
}
.kpi-sub {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}
.text-primary { color: #2563eb !important; }
.text-success { color: #059669 !important; }
.text-danger { color: #dc2626 !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.font-numeric { font-variant-numeric: tabular-nums; }

/* 미확인 배너 */
.deposits-alert-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 18px;
}
.deposits-alert-banner p {
  margin: 2px 0 0 0;
  font-size: 0.85rem;
  color: #92400e;
}

/* 정산 테이블 */
.deposits-table-container {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 24px;
  overflow: hidden;
}
.table-header-info {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.table-header-info h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.deposits-table-responsive {
  width: 100%;
  overflow-x: auto;
}
.deposits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.deposits-table th {
  background: #f1f5f9;
  padding: 12px 16px;
  font-weight: 700;
  color: #334155;
  font-size: 13.5px;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap !important;
  word-break: keep-all !important;
  text-align: left;
}
.deposits-table th.th-sortable {
  cursor: pointer;
  user-select: none;
  background: #f1f5f9;
  border-bottom: 2px solid #cbd5e1;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.deposits-table th.th-sortable:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.deposits-table th.th-sortable .th-sort-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}
.deposits-table th.th-sortable .th-sort-inner.justify-end {
  justify-content: flex-end;
  width: 100%;
}
.deposits-table th.th-sortable .th-label-text {
  font-weight: 700;
  color: #334155;
  font-size: 13.5px;
}
.deposits-table th.th-sortable:hover .th-label-text {
  color: #0f172a;
}
.deposits-table th.th-sortable .sort-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1;
  color: #64748b;
  background: rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease;
}
.deposits-table th.th-sortable:hover .sort-indicator {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.1);
}
.deposits-table th.th-sortable.is-sorted {
  background: #ecfdf5 !important;
  border-bottom: 2px solid #10b981 !important;
}
.deposits-table th.th-sortable.is-sorted .th-label-text {
  color: #065f46 !important;
  font-weight: 800;
}
.deposits-table th.th-sortable.is-sorted .sort-indicator {
  background: #10b981 !important;
  color: #ffffff !important;
  font-weight: 900;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
}
.deposits-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  white-space: nowrap !important;
  word-break: keep-all !important;
}
.deposits-table tbody tr:hover td {
  background: #fbfcfe;
}
.deposits-table .row-unpaid td {
  background: #fffcfc;
}
.deposits-table .row-unpaid:hover td {
  background: #fff5f5;
}
.empty-cell {
  text-align: center;
  padding: 36px !important;
  color: var(--text-muted, #94a3b8);
}
.mini-link {
  font-size: 0.78rem;
  color: #3b82f6;
  text-decoration: none;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #eff6ff;
  white-space: nowrap !important;
}
.mini-link:hover {
  text-decoration: underline;
}
.order-link {
  font-weight: 700;
  color: #1e293b;
  text-decoration: none;
  white-space: nowrap !important;
}
.order-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

/* PC vs 모바일 뷰 분기 */
.deposits-desktop-table {
  display: block;
}
.deposits-mobile-cards {
  display: none;
}

@media (max-width: 768px) {
  .deposits-desktop-table {
    display: none !important;
  }
  .deposits-mobile-cards {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 24px;
  }
  .deposits-controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .deposits-segmented-tabs {
    width: 100%;
    box-sizing: border-box;
  }
  .btn-deposit-main-add {
    width: 100%;
    justify-content: center;
    height: 40px;
  }
  .header-search-box {
    width: 100%;
  }
  .header-search-box .partner-search-filter {
    width: 100% !important;
  }
  .partner-history-drawer {
    width: 100vw !important;
    max-width: 100vw !important;
  }
}

/* 모바일 전용 거래처별 정산 카드 (토스/캐시노트 스타일) */
.partner-settle-card {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.15s ease;
}

.partner-settle-card.is-unpaid {
  border-left: 4px solid #ef4444;
  background: #fffdfd;
}

.partner-settle-card.is-paid {
  border-left: 4px solid #10b981;
}

.psc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.psc-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.psc-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
  word-break: keep-all !important;
  white-space: nowrap !important;
}

.psc-stmt-btn {
  font-size: 0.76rem;
  font-weight: 700;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  padding: 2px 8px;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap !important;
}

.psc-stmt-btn:hover {
  background: #dbeafe;
}

.psc-phone {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: -4px;
}

.psc-phone a {
  color: #475569;
  text-decoration: none;
  font-weight: 600;
}

.psc-amounts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
}

.psc-amount-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.psc-amount-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap !important;
}

.psc-amount-val {
  font-size: 0.98rem;
  font-weight: 800;
  color: #1e293b;
  white-space: nowrap !important;
}

.psc-amount-val a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.psc-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
}

.psc-hints {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
}

.psc-hint-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap !important;
}

.hint-pill-mini {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap !important;
}

.psc-hint-empty {
  font-size: 0.74rem;
  color: #94a3b8;
  white-space: nowrap !important;
}

.psc-deposit-btn {
  height: 32px;
  padding: 0 12px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  white-space: nowrap !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  line-height: 1;
}

.psc-deposit-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* 배지 */
.badge-danger {
  display: inline-block;
  background: #fee2e2;
  color: #b91c1c;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
}
.badge-success {
  display: inline-block;
  background: #dcfce7;
  color: #15803d;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
}
.badge-info {
  display: inline-block;
  background: #e0f2fe;
  color: #0369a1;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
}
.badge-muted {
  display: inline-block;
  background: #f1f5f9;
  color: #94a3b8;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.82rem;
}
.badge-partner {
  display: inline-block;
  background: #eef2ff;
  color: #4338ca;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
}
.badge-unmatched {
  display: inline-block;
  background: #fef3c7;
  color: #b45309;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.82rem;
}

/* 힌트 칩 셀 */
.hints-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.hint-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
}
.hint-delete-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 0;
  font-size: 13px;
  line-height: 1;
}
.hint-delete-btn:hover {
  color: #ef4444;
}
.hint-add-popover {
  position: relative;
  display: inline-block;
}
.hint-add-btn {
  list-style: none;
  cursor: pointer;
  font-size: 0.78rem;
  color: #2563eb;
  background: #eff6ff;
  border: 1px dashed #93c5fd;
  padding: 2px 7px;
  border-radius: 9999px;
}
.hint-add-btn::-webkit-details-marker { display: none; }
.hint-add-form {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  gap: 6px;
  width: 210px;
}
.hint-add-form input {
  font-size: 0.82rem;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  flex: 1;
}

/* 입금 등록 접이식 폼 */
.deposit-form-disclosure {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  margin-bottom: 24px;
  overflow: hidden;
}
.deposit-form-summary {
  padding: 14px 20px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #2563eb;
  cursor: pointer;
  background: #f8fafc;
}
.deposit-create-card {
  padding: 20px;
}
.deposit-form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 20px;
  margin-bottom: 16px;
  align-items: start;
}
.deposit-field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}
.deposit-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}
.deposit-form-grid label.grid-span-2 {
  grid-column: span 2;
}
.deposit-form-grid input,
.deposit-form-grid select {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9rem;
  min-height: 44px;
  box-sizing: border-box;
}
.deposit-form-bottom {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  border-top: 1px solid #f1f5f9;
  padding-top: 14px;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  color: #475569;
  user-select: none;
}
.checkbox-label input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  accent-color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
}

/* 미확인 입금 매칭 폼 */
.unmatched-match-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.inline-match-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.inline-match-form select {
  padding: 4px 8px;
  font-size: 0.82rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}
.inline-hint-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.inline-hint-check input[type="checkbox"] {
  width: 14px !important;
  height: 14px !important;
  min-height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  margin: 0 !important;
  padding: 0 !important;
  accent-color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
}

/* 은행 계좌 설정 */
.accounts-guide-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
.accounts-guide-banner strong {
  color: #166534;
  font-size: 0.95rem;
}
.accounts-guide-banner p {
  margin: 4px 0 0 0;
  color: #15803d;
  font-size: 0.88rem;
}
.quick-bank-bar {
  margin-bottom: 20px;
}
.quick-bank-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
  display: block;
}
.quick-bank-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quick-bank-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}
.quick-bank-btn:hover {
  background: #f8fafc;
  border-color: #2563eb;
  color: #2563eb;
}
.account-create-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}
.account-create-card h3 {
  margin: 0 0 16px 0;
  font-size: 1.05rem;
}
.account-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.account-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}
.account-form-grid input {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9rem;
}
.account-form-grid .grid-full {
  grid-column: 1 / -1;
}
.phone-code {
  font-family: monospace;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  color: #0f172a;
}

/* 빠른 모달 */
.deposit-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.deposit-modal-box {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}
.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
}
.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}
.modal-body input {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.95rem;
}
.modal-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 한국식 금액 표시 힌트 */
.korean-amount-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 5px;
  font-weight: 500;
  line-height: 1.4;
  flex-wrap: wrap;
  box-sizing: border-box;
  animation: fadeIn 0.15s ease-out;
}
.korean-amount-hint .kor-badge {
  font-weight: 700;
  color: #15803d;
  font-size: 0.95rem;
}
.korean-amount-hint .kor-text {
  color: #64748b;
  font-size: 0.82rem;
}

/* 결제수단 뱃지 및 토글 박스 */
.badge-card {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.badge-bank {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
/* 입금 등록 결제수단 2버튼 세그먼트 토글 */
.payment-method-toggle-group {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  margin-bottom: 6px;
}
.pay-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  transition: all 0.15s ease-in-out;
  outline: none;
  min-height: 44px;
}
.pay-toggle-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
/* 신용카드 선택 상태 */
.pay-toggle-btn.is-card-active {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  color: #1d4ed8 !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.15);
}
/* 통장입금 선택 상태 */
.pay-toggle-btn.is-bank-active {
  background: #f0fdf4 !important;
  border-color: #22c55e !important;
  color: #15803d !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 3px rgba(34, 197, 94, 0.15);
}

/* 힌트 추가 큼직한 카드형 체크박스 */
.hint-add-card-box {
  display: flex !important;
  align-items: flex-start !important;
  gap: 12px !important;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  padding: 12px 14px !important;
  margin-top: 4px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  box-sizing: border-box;
}
.hint-add-card-box:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.hint-add-card-box input[type="checkbox"] {
  width: 20px !important;
  height: 20px !important;
  margin-top: 2px !important;
  accent-color: #3b82f6;
  cursor: pointer;
  flex-shrink: 0;
}
.hint-add-card-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hint-add-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
}
.hint-add-desc {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
}

/* 다크 모드 대응 */
html[data-theme="dark"] .pay-toggle-btn {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}
html[data-theme="dark"] .pay-toggle-btn:hover {
  background: #334155;
}
html[data-theme="dark"] .pay-toggle-btn.is-card-active {
  background: rgba(59, 130, 246, 0.18) !important;
  border-color: #3b82f6 !important;
  color: #60a5fa !important;
}
html[data-theme="dark"] .pay-toggle-btn.is-bank-active {
  background: rgba(34, 197, 94, 0.18) !important;
  border-color: #22c55e !important;
  color: #4ade80 !important;
}
html[data-theme="dark"] .hint-add-card-box {
  background: #1e293b;
  border-color: #334155;
}
html[data-theme="dark"] .hint-add-card-box:hover {
  background: #27354a;
}
html[data-theme="dark"] .hint-add-title {
  color: #f1f5f9;
}
html[data-theme="dark"] .hint-add-desc {
  color: #94a3b8;
}

/* ============================================================
   입금 거래처 매칭 / 신규 등록 모달 스타일
   ============================================================ */
.match-partner-modal-card {
  max-width: 500px !important;
}
.btn-match-partner {
  background: #eff6ff !important;
  color: #2563eb !important;
  border: 1px solid #bfdbfe !important;
  font-weight: 600 !important;
  padding: 4px 10px !important;
  font-size: 0.8rem !important;
  border-radius: 6px !important;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn-match-partner:hover {
  background: #dbeafe !important;
  border-color: #93c5fd !important;
  color: #1d4ed8 !important;
}
.match-deposit-summary-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.match-deposit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: #64748b;
}
.match-divider {
  color: #cbd5e1;
}
.match-deposit-amount-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed #e2e8f0;
  padding-top: 8px;
}
.match-depositor-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.match-depositor-name {
  font-size: 1.05rem;
  color: #0f172a;
  background: #fef3c7;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #fde68a;
}
.match-amount-num {
  font-size: 1.25rem;
  font-weight: 700;
}
.match-partner-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px;
  background: #fff;
}
.match-partner-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 10px !important;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.12s ease;
  user-select: none;
}
.match-partner-item:hover {
  background: #f1f5f9;
}
.match-partner-item input[type="radio"]:checked + .partner-item-inner {
  color: #1d4ed8;
}
.partner-item-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.partner-item-inner .partner-name {
  font-weight: 600;
  color: #1e293b;
}
.partner-item-inner .partner-phone {
  font-size: 0.82rem;
  color: #64748b;
}
.match-list-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.78rem;
  color: #64748b;
}

/* 다크모드 대응 */
html[data-theme="dark"] .match-deposit-summary-box {
  background: #1e293b;
  border-color: #334155;
}
html[data-theme="dark"] .match-deposit-amount-row {
  border-top-color: #334155;
}
html[data-theme="dark"] .match-depositor-name {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: #f59e0b;
}
html[data-theme="dark"] .match-partner-list {
  background: #0f172a;
  border-color: #334155;
}
html[data-theme="dark"] .match-partner-item:hover {
  background: #1e293b;
}
html[data-theme="dark"] .partner-item-inner .partner-name {
  color: #f1f5f9;
}
html[data-theme="dark"] .btn-match-partner {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #93c5fd !important;
  border-color: #3b82f6 !important;
}

/* 모바일 대응 미디어 쿼리 */
@media (max-width: 1024px) {
  .deposit-form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .deposits-top-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .deposits-month-nav {
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
  }
  .deposits-month-nav input[type="month"] {
    flex: 1;
    min-width: 120px;
    max-width: 160px;
  }
  .deposits-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi-value {
    font-size: 1.3rem;
  }
  .deposit-form-grid {
    grid-template-columns: 1fr;
  }
  .deposit-form-grid label.grid-span-2 {
    grid-column: span 1;
  }
  .deposit-form-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .deposit-form-bottom .checkbox-label {
    justify-content: flex-end;
  }
  .deposit-form-bottom button {
    width: 100%;
  }
}

/* ==========================================================================
   경영 결산 통계 리포트 (Analytics Dashboard) UI
   ========================================================================== */
.analytics-wrapper {
  padding-bottom: 40px;
}
.analytics-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.toolbar-title-group h2 {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}
.toolbar-title-group p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted, #64748b);
}
.toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.month-selector-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.month-selector-group input[type="month"] {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--card-bg, #ffffff);
  font-size: 0.95rem;
  font-weight: 600;
}
.theme-selector-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  white-space: nowrap !important;
  flex-shrink: 0;
}
.theme-selector-group label {
  white-space: nowrap !important;
  word-break: keep-all !important;
}
.theme-selector-group select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--card-bg, #ffffff);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap !important;
}

/* 기간 선택 세그먼트 버튼 컨트롤 */
.period-segment-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #f1f5f9;
  border-radius: 9px;
  padding: 3px;
  border: 1px solid #cbd5e1;
}
.period-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}
.period-tab-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}
.period-tab-btn.active {
  color: #1d4ed8;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 800;
}

.year-select {
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  cursor: pointer;
}
.year-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.analytics-view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #edf2ee;
  border-radius: 9px;
  padding: 3px;
  border: 1px solid #dbe5de;
}
.view-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 750;
  color: #55665c;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}
.view-tab-btn:hover {
  color: #172d22;
  background: rgba(255, 255, 255, 0.6);
}
.view-tab-btn.active {
  color: var(--green-dark);
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(23, 45, 34, 0.12);
  font-weight: 850;
}

/* 툴바 서브타이틀 */
.toolbar-subtitle {
  margin: 4px 0 0 0;
  font-size: 0.88rem;
  color: var(--text-muted, #64748b);
  font-weight: 500;
}

/* 도매 정식 손익계산서 요약 (Financial Statement) */
.statement-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 24px;
}
.statement-period-pill {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
}
.statement-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.statement-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.statement-table th {
  background: #f8fafc;
  padding: 11px 16px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.statement-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  white-space: nowrap;
}
.statement-table tbody tr:hover {
  background: #fbfcfe;
}
.st-row-base td {
  font-size: 0.95rem;
  background: #fafbfc;
}
.st-row-sub td {
  font-size: 0.88rem;
  color: #475569;
}
.st-row-highlight td {
  background: #f8fafc;
  font-size: 0.95rem;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}
.st-row-net td {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  font-size: 1.05rem;
  border-top: 2px solid #86efac;
  border-bottom: 2px solid #86efac;
}
.st-net-val {
  font-size: 1.25rem !important;
  font-weight: 800 !important;
  color: #047857 !important;
}
.st-row-net.net-negative td {
  background: #fff5f5;
  border-color: #fca5a5;
}
.st-row-cash-memo td {
  background: #f5f3ff;
  border-top: 1px dashed #ddd6fe;
  font-size: 0.88rem;
}
.cash-memo-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  color: #7c3aed;
  background: #ede9fe;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
}
.indent-1 {
  padding-left: 32px !important;
}

/* 상위 거래처 집중도 알림 */
.concentration-alert-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.86rem;
  margin-bottom: 14px;
}
html[data-theme="dark"] .concentration-alert-box {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}
html[data-theme="dark"] .concentration-alert-box strong {
  color: #bfdbfe;
}

/* 차트 범례 및 요일별 패턴 */
.legend-this-cum { background: #2563eb; }
.legend-prev-cum {
  background: #94a3b8;
  border-bottom: 2px dashed #94a3b8;
  height: 0 !important;
  width: 14px !important;
}
.weekday-pattern-card {
  display: flex;
  flex-direction: column;
}
.weekday-bars-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}
.weekday-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
}
.wb-name {
  color: #334155;
}
.wb-vals strong {
  color: #0f172a;
  font-weight: 700;
}
.wb-pct {
  color: #64748b;
  font-size: 0.8rem;
  margin-left: 4px;
}
.wb-track {
  height: 10px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
}
.wb-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* 상세 장부 툴바 및 엑셀 내보내기 */
.ledger-action-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.ledger-summary-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.l-chip {
  font-size: 0.82rem;
  color: #475569;
  background: #f8fafc;
  padding: 5px 11px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.l-chip strong {
  color: #0f172a;
  font-weight: 700;
}
.l-chip.highlight-chip {
  background: #f0fdf4;
  border-color: #86efac;
  color: #065f46;
}
.l-chip.highlight-chip strong {
  color: #047857;
}
.l-chip.alert-chip {
  background: #fff5f5;
  border-color: #fca5a5;
  color: #991b1b;
}
.l-chip.alert-chip strong {
  color: #dc2626;
}
html[data-theme="dark"] .l-chip.highlight-chip {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}
html[data-theme="dark"] .l-chip.highlight-chip strong {
  color: #6ee7b7;
}
html[data-theme="dark"] .l-chip.alert-chip {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}
html[data-theme="dark"] .l-chip.alert-chip strong {
  color: #fca5a5;
}
.btn-export-csv {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #15803d;
  color: #ffffff !important;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  white-space: nowrap;
}
.btn-export-csv:hover {
  background: #166534;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(21, 128, 61, 0.25);
}
.full-table-wrap {
  overflow-x: auto;
  max-height: 700px;
}
.ledger-full-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.ledger-full-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.76rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
  z-index: 10;
}
.ledger-full-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  white-space: nowrap;
}
.ledger-full-table tbody tr:hover {
  background: #f8fafc;
}
.ledger-full-table .row-sunday {
  background: #fff8f8;
}
.ledger-full-table .row-saturday {
  background: #f8fbff;
}
.ledger-full-table .row-zero td {
  color: #94a3b8;
}
.font-date {
  font-size: 0.86rem;
  color: #1e293b;
}
.ledger-total-row td {
  position: sticky;
  bottom: 0;
  background: #f8fafc !important;
  border-top: 2px solid #94a3b8 !important;
  font-size: 0.92rem;
  padding: 12px;
  font-weight: 800;
  z-index: 10;
}

/* KPI 카드 그리드 */
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.kpi-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748b;
}
.kpi-main-number {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.kpi-main-number small {
  font-size: 1rem;
  font-weight: 600;
  margin-left: 2px;
}
.kpi-sub-desc {
  margin-top: 10px;
  font-size: 0.8rem;
  color: #64748b;
  border-top: 1px solid #f1f5f9;
  padding-top: 8px;
}
.kpi-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
}
.badge-up { background: #dcfce7; color: #15803d; }
.badge-down { background: #fee2e2; color: #b91c1c; }
.badge-cogs { background: #eff6ff; color: #2563eb; }
.badge-margin { background: #f0fdf4; color: #059669; }
.badge-opex { background: #fff7ed; color: #ea580c; }
.badge-net { background: #ecfdf5; color: #047857; font-size: 0.82rem; }
.badge-cash { background: #f5f3ff; color: #7c3aed; }

.text-cogs { color: #2563eb !important; }
.text-gross { color: #059669 !important; }
.text-opex { color: #ea580c !important; }
.text-net { color: #047857 !important; }
.text-cash { color: #7c3aed !important; }
.text-retail { color: #9333ea !important; }
.text-margin { color: #059669 !important; }

.hero-net {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border-color: #86efac;
  border-width: 2px;
}
.hero-net .kpi-main-number {
  font-size: 2rem;
  color: #047857;
}
.card-negative {
  background: #fff8f8;
  border-color: #fca5a5;
}
.card-negative .text-net {
  color: #dc2626 !important;
}

/* 모던 툴팁 (Progressive Disclosure) */
.card-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.modern-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  vertical-align: middle;
  margin-left: 3px;
  color: #94a3b8;
  transition: color 0.15s ease;
}
.modern-tooltip:hover {
  color: #3b82f6;
}
.modern-tooltip .info-icon {
  display: block;
}
.modern-tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.01em;
  white-space: normal;
  width: max-content;
  max-width: 240px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 120;
  text-align: left;
  word-break: keep-all;
}
.modern-tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border-width: 6px 6px 0 6px;
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.95) transparent transparent transparent;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 120;
}
.modern-tooltip:hover::after,
.modern-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* 손익 분해 스트림 (P&L Financial Flow) */
.analytics-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.card-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.card-title-bar h3 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  color: #0f172a;
}
.pnl-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  color: #065f46;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #a7f3d0;
}
.pnl-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}

/* 캡슐 프로그레스 바 & 범례 */
.pnl-bar-container {
  margin: 16px 0 20px 0;
}
.pnl-bar-track {
  display: flex;
  height: 12px;
  border-radius: 9999px;
  background: #f1f5f9;
  overflow: hidden;
  gap: 2px;
}
.pnl-bar-seg {
  height: 100%;
  transition: width 0.3s ease;
}
.seg-cogs { background: #3b82f6; }
.seg-opex { background: #f97316; }
.seg-net { background: #10b981; }
.seg-empty { background: #e2e8f0; }

.pnl-bar-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #475569;
}
.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.chip-cogs .chip-dot { background: #3b82f6; }
.chip-opex .chip-dot { background: #f97316; }
.chip-net .chip-dot { background: #10b981; }
.legend-chip strong {
  color: #0f172a;
  font-weight: 700;
}

/* 5단계 P&L 파이프라인 그리드 */
.pnl-pipeline-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f8fafc;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.pnl-node {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  flex: 1 1 0;
  min-width: 135px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pnl-node:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}
.pnl-node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.pnl-node-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
}
.pnl-node-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.tag-base { background: #f1f5f9; color: #475569; }
.tag-cogs { background: #eff6ff; color: #2563eb; }
.tag-gross { background: #ecfdf5; color: #059669; }
.tag-opex { background: #fff7ed; color: #ea580c; }
.tag-net { background: #dcfce7; color: #15803d; }

.pnl-node-amt {
  font-size: 15.5px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.pnl-node-amt small {
  font-size: 11px;
  font-weight: 600;
  margin-left: 2px;
}
.pnl-node.highlight {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border: 1.5px solid #86efac;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.1);
}
.pnl-operator {
  font-size: 18px;
  font-weight: 800;
  color: #94a3b8;
  user-select: none;
  flex-shrink: 0;
  padding: 0 4px;
}

/* 2단 분할 그리드 */
.analytics-split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.chart-canvas-wrap {
  width: 100%;
  position: relative;
}
.chart-canvas-wrap canvas {
  width: 100% !important;
  height: 240px !important;
  max-height: 260px !important;
  display: block;
}
#dailyTrendCanvas,
#productPriceCanvas {
  height: 240px !important;
  max-height: 260px !important;
}
.chart-floating-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.08s ease;
  z-index: 50;
  min-width: 140px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.chart-floating-tooltip .tip-date {
  font-weight: 700;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 4px;
}
.chart-floating-tooltip .tip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
  font-size: 11.5px;
  color: #cbd5e1;
}
.chart-floating-tooltip .tip-row strong {
  color: #ffffff;
  font-weight: 700;
}
.chart-floating-tooltip .tip-divider {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
}
.chart-floating-tooltip .tip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}
.tip-dot.dot-rev { background: #3b82f6; }
.tip-dot.dot-cost { background: #ef4444; }
.tip-dot.dot-net { background: #10b981; }
.tip-dot.dot-sale { background: #059669; }
.tip-dot.dot-pur { background: #2563eb; }
.tip-dot.dot-ret { background: #9333ea; }

.chart-legend {
  display: flex;
  gap: 14px;
  font-size: 0.82rem;
  font-weight: 600;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.legend-rev { background: #3b82f6; }
.legend-cost { background: #ef4444; }
.legend-prof { background: #10b981; }
.legend-purchase { background: #2563eb; }
.legend-sale { background: #059669; }
.legend-retail { background: #9333ea; }

/* 지출 구조 분석 */
.expense-structure-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 900px) {
  .expense-structure-body {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: center;
  }
}
.fixed-vs-variable {
  margin-bottom: 0;
  background: #f8fafc;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.fvv-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: #334155;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.fvv-item-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fvv-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-fixed { background: #6366f1; }
.dot-var { background: #f59e0b; }
.fvv-pct {
  color: #64748b;
  font-size: 0.82rem;
}

.fvv-bar {
  display: flex;
  height: 14px;
  border-radius: 9999px;
  overflow: hidden;
  background: #e2e8f0;
  gap: 2px;
}
.fvv-fixed {
  background: #6366f1;
  transition: width 0.3s ease;
  height: 100%;
}
.fvv-variable {
  background: #f59e0b;
  transition: width 0.3s ease;
  height: 100%;
}
.expense-cat-list h4 {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: #334155;
}
.cat-item {
  margin-bottom: 10px;
}
.cat-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.cat-progress-bar {
  height: 8px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
}
.cat-fill {
  height: 100%;
  background: #f97316;
  border-radius: 9999px;
}

/* 품목별 가격 변동 추이 카드 (가로 100% 풀 와이드) */
.price-trend-full-card {
  width: 100%;
}
.price-trend-full-card .chart-canvas-wrap canvas {
  height: 280px !important;
  max-height: 320px !important;
}
.price-trend-header {
  align-items: center;
  gap: 12px;
}
.product-picker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  white-space: nowrap !important;
  flex-shrink: 0;
}

.trend-search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 190px;
}
.trend-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #64748b;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.trend-search-input {
  width: 100%;
  height: 38px;
  padding: 0 28px 0 32px !important;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  background: #ffffff;
  color: #0f172a;
  transition: all 0.15s ease;
  box-sizing: border-box;
}
.trend-search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.btn-clear-search-mini {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: #e2e8f0;
  border: none;
  border-radius: 50%;
  font-size: 11px;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 2;
}
.btn-clear-search-mini:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.trend-select-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.trend-select-label {
  white-space: nowrap !important;
  color: var(--text-color, #1e293b);
  font-weight: 700;
  font-size: 0.88rem;
}
.trend-product-select {
  height: 38px;
  padding: 0 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  background: #f8fafc;
  color: #0f172a;
  cursor: pointer;
  white-space: nowrap !important;
  min-width: 140px;
  max-width: 220px;
  box-sizing: border-box;
  transition: all 0.15s ease;
}
.trend-product-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.product-count-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

html[data-theme="dark"] .trend-search-input,
html[data-theme="dark"] .trend-product-select {
  background: #1e293b;
  border-color: #475569;
  color: #f8fafc;
}
html[data-theme="dark"] .product-count-badge {
  background: #334155;
  border-color: #475569;
  color: #cbd5e1;
}
.product-price-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.price-chip {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.price-chip.highlight {
  background: #f0fdf4;
  border-color: #86efac;
}
.chip-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap !important;
  word-break: keep-all !important;
}
.chip-val {
  font-size: 1.25rem;
  font-weight: 800;
  white-space: nowrap !important;
}
.price-chart-legend {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 8px;
}

/* 랭킹 테이블 */
.rank-table-wrap {
  overflow-x: auto;
}
.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.rank-table th {
  background: #f8fafc;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap !important;
  word-break: keep-all !important;
}
.rank-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  white-space: nowrap !important;
  word-break: keep-all !important;
}
.rank-table tbody tr {
  transition: background 0.1s ease;
}
.rank-table tbody tr:hover {
  background: #f8fafc;
}
.font-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.btn-table-action {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 9px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-table-action:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.card-stat-pill {
  font-size: 12px;
  font-weight: 700;
  color: #ea580c;
  background: #fff7ed;
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid #ffedd5;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.78rem;
}
.rank-1 { background: #fef08a; color: #854d0e; }
.rank-2 { background: #e2e8f0; color: #334155; }
.rank-3 { background: #fed7aa; color: #9a3412; }
.rank-4, .rank-5 { background: #f1f5f9; color: #64748b; }
.rank-alert { background: #fee2e2; color: #b91c1c; }

/* ==========================================================================
   테마 2: 다크 모드 (Slate Dark)
   ========================================================================== */
.theme-dark {
  background: #0f172a;
  color: #f8fafc;
  padding: 16px;
  border-radius: 16px;
}
.theme-dark .kpi-card,
.theme-dark .analytics-card {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}
.theme-dark .kpi-title,
.theme-dark .kpi-sub-desc,
.theme-dark .card-help-text,
.theme-dark .toolbar-title-group p,
.theme-dark .chip-label {
  color: #94a3b8 !important;
}
.theme-dark .kpi-main-number {
  color: #f8fafc;
}
.theme-dark .pnl-pipeline-grid,
.theme-dark .fixed-vs-variable,
.theme-dark .price-chip,
.theme-dark .rank-table th {
  background: #0f172a;
  border-color: #334155;
}
.theme-dark .pnl-node {
  background: #1e293b;
  border-color: #334155;
}
.theme-dark .pnl-node-title {
  color: #94a3b8;
}
.theme-dark .pnl-node-amt {
  color: #f8fafc;
}
.theme-dark .pnl-operator {
  color: #64748b;
}
.theme-dark .pnl-bar-track,
.theme-dark .fvv-bar {
  background: #0f172a;
}
.theme-dark .legend-chip {
  color: #cbd5e1;
}
.theme-dark .legend-chip strong {
  color: #f8fafc;
}
.theme-dark .fvv-labels {
  color: #f8fafc;
}
.theme-dark .fvv-pct {
  color: #94a3b8;
}
.theme-dark .hero-net {
  background: linear-gradient(135deg, #1e293b 0%, #064e3b 100%);
  border-color: #059669;
}
.theme-dark .hero-net .text-net {
  color: #34d399 !important;
}
.theme-dark .month-selector-group input,
.theme-dark .theme-selector-group select,
.theme-dark .product-picker-wrap select {
  background: #1e293b;
  color: #f8fafc;
  border-color: #475569;
}
.theme-dark .rank-table td {
  border-color: #334155;
}
.theme-dark .rank-table tbody tr:hover {
  background: #1e293b;
}
.theme-dark .btn-table-action {
  background: #334155;
  color: #cbd5e1;
}
.theme-dark .btn-table-action:hover {
  background: #475569;
  color: #ffffff;
}

/* ==========================================================================
   테마 3: 클래식 ERP (Warm Business)
   ========================================================================== */
.theme-warm .kpi-card,
.theme-warm .analytics-card {
  background: #fffdfa;
  border: 2px solid #e7e0d6;
  border-radius: 8px;
}
.theme-warm .hero-net {
  background: #f7fee7;
  border-color: #65a30d;
}
.theme-warm .pnl-bar-track {
  border-radius: 4px;
}
.theme-warm .pnl-pipeline-grid {
  background: #f5efe6;
  border-radius: 6px;
  border-color: #e7e0d6;
}
.theme-warm .pnl-node {
  background: #fffdfa;
  border-color: #e7e0d6;
}
.theme-warm .kpi-main-number,
.theme-warm .pnl-node-amt {
  font-family: 'Courier New', monospace;
}

/* 반응형 모바일 */
@media (max-width: 768px) {
  .analytics-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .month-selector-group {
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
  }
  .month-selector-group input {
    flex: 1;
    min-width: 120px;
    max-width: 160px;
  }
  .analytics-view-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    padding: 3px;
    box-sizing: border-box;
  }
  .view-tab-btn {
    padding: 7px 2px;
    font-size: 11.5px;
    justify-content: center;
    text-align: center;
  }
  .analytics-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi-main-number {
    font-size: 1.35rem;
  }
  .pnl-pipeline-grid {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .pnl-node {
    min-width: unset;
    width: 100%;
    box-sizing: border-box;
  }
  .pnl-operator {
    text-align: center;
    font-size: 14px;
    margin: -2px 0;
  }
  .pnl-bar-legend {
    gap: 10px;
    font-size: 11.5px;
  }
  .price-trend-header {
    flex-direction: column;
    align-items: stretch;
  }
  .product-picker-wrap {
    width: 100%;
    margin-top: 8px;
    gap: 8px;
  }
  .trend-search-box {
    flex: 1 1 140px;
    width: auto;
  }
  .trend-select-box {
    flex: 1 1 140px;
    width: 100%;
  }
  .trend-product-select {
    flex: 1;
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}

/* ==========================================================================
   초소형 모바일 (370px 이하) – 결산 통계 최적화
   ========================================================================== */
@media (max-width: 400px) {
  /* 페이지 제목 축소 */
  .toolbar-title-group h2 {
    font-size: 1.15rem;
  }
  .toolbar-title-group p {
    font-size: 0.82rem;
  }

  /* 월 선택기 더 컴팩트하게 */
  .month-selector-group {
    gap: 3px;
  }
  .month-nav-btn {
    font-size: 12px;
    padding: 6px 8px;
    min-width: unset;
  }
  .month-selector-group input[type="month"] {
    font-size: 0.85rem;
    padding: 5px 8px;
  }

  /* 뷰 탭 버튼 축소 */
  .view-tab-btn {
    font-size: 10.5px;
    padding: 6px 1px;
    gap: 2px;
  }
  .view-tab-btn .tab-emoji {
    font-size: 11px;
  }

  /* KPI 카드 → 1열 풀와이드 */
  .analytics-kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .kpi-card {
    padding: 14px;
  }
  .kpi-header {
    flex-wrap: wrap;
    gap: 4px;
  }
  .kpi-title {
    font-size: 0.78rem;
  }
  .kpi-badge {
    font-size: 0.68rem;
    padding: 2px 6px;
  }
  .kpi-main-number {
    font-size: 1.25rem;
  }
  .kpi-main-number small {
    font-size: 0.85rem;
  }
  .kpi-sub-desc {
    font-size: 0.75rem;
  }

  /* Hero (최종 영업순이익) 카드도 조정 */
  .hero-net .kpi-main-number {
    font-size: 1.5rem;
  }

  /* 손익 분해 카드 */
  .analytics-card {
    padding: 16px;
  }
  .card-title-bar h3 {
    font-size: 1rem;
  }

  /* 손익 분해 범례 및 파이프라인 */
  .pnl-bar-legend {
    gap: 8px;
    font-size: 11px;
  }
  .pnl-pipeline-grid {
    padding: 10px;
    gap: 6px;
  }
  .pnl-node {
    padding: 10px 12px;
  }
  .pnl-node-amt {
    font-size: 14px;
  }
  .pnl-node-title {
    font-size: 11px;
  }

  /* 2단 분할 그리드 → 1열 */
  .analytics-split-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* 차트 영역 */
  .chart-canvas-wrap canvas {
    height: 180px !important;
    max-height: 200px !important;
  }
  .chart-legend {
    gap: 8px;
    font-size: 0.75rem;
  }

  /* 지출 구조 분석 */
  .fixed-vs-variable {
    padding: 10px;
  }
  .fvv-labels {
    font-size: 0.8rem;
  }

  /* 품목별 가격 변동 추이 */
  .price-trend-header {
    gap: 8px;
  }
  .price-trend-card {
    padding: 14px;
  }
  .price-trend-full-card .chart-canvas-wrap canvas {
    height: 220px !important;
    max-height: 240px !important;
  }

  /* 랭킹 테이블 */
  .analytics-rankings-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* 바텀 네비게이션과 겹치지 않게 패딩 추가 */
  .analytics-wrapper {
    padding-bottom: 80px;
  }
}

/* ==========================================================================
   반품 관리 (Returns Management) UI
   ========================================================================== */
.returns-wrapper {
  padding-bottom: 40px;
}
.returns-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}
.returns-toolbar .toolbar-title-group h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 4px 0;
}
.returns-toolbar .toolbar-title-group p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted, #64748b);
}
.returns-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.returns-filter-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  flex: 1;
}
.returns-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
}
.returns-filter-group label {
  white-space: nowrap;
  color: #64748b;
  font-size: 13.5px;
}
.returns-filter-group select {
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #cbd5e1);
  font-size: 14px;
  font-weight: 600;
  background: #ffffff;
  color: #1e293b;
}

/* 반품 일체형 검색 바 */
.returns-search-group {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
  height: 42px;
  box-sizing: border-box;
  min-width: 260px;
  max-width: 380px;
  flex: 1;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.returns-search-group:focus-within {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}
.returns-search-icon {
  padding-left: 12px;
  font-size: 14px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  user-select: none;
}
.returns-search-input {
  flex: 1;
  min-width: 0;
  height: 100% !important;
  border: none !important;
  background: transparent !important;
  padding: 0 10px !important;
  font-size: 14px !important;
  color: #1e293b !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}
.returns-search-input::placeholder {
  color: #94a3b8;
}
.returns-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b !important;
  text-decoration: none;
  font-size: 11px;
  font-weight: bold;
}
.btn-returns-search {
  height: 100%;
  padding: 0 18px;
  background: #059669;
  color: #ffffff !important;
  font-size: 14px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-returns-search:hover {
  background: #047857;
}

.btn-returns-new {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 42px;
  padding: 0 18px;
  background: var(--green-dark, #172d22);
  color: #ffffff !important;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
  transition: background 0.15s ease;
  white-space: nowrap;
}
.btn-returns-new:hover {
  background: #1e3a2c;
}

/* KPI */
.returns-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.returns-kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.returns-kpi-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 6px;
}
.returns-kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
}
.returns-kpi-value.text-danger {
  color: #dc2626;
}

/* PC 테이블 */
.returns-table-wrap {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow-x: auto;
}
.returns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.returns-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.returns-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.returns-table .text-right {
  text-align: right;
}
.returns-table .text-center {
  text-align: center;
}
.returns-table .text-muted {
  color: #94a3b8;
  font-style: italic;
}
.returns-table .text-danger {
  color: #dc2626;
}
.returns-table .items-summary {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-cancel-sm {
  display: inline-flex;
  padding: 5px 12px;
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-cancel-sm:hover {
  background: #fecaca;
}

/* 모바일 카드 */
.returns-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.returns-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
}
.returns-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.returns-card-date {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-left: 8px;
}
.returns-card-amount {
  font-size: 1rem;
  font-weight: 800;
}
.returns-card-body {
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 8px;
}
.returns-card-items {
  margin-bottom: 4px;
}
.returns-card-order,
.returns-card-reason {
  font-size: 0.78rem;
  color: #94a3b8;
}
.returns-card-actions {
  display: flex;
  justify-content: flex-end;
}

/* 빈 상태 */
.returns-empty {
  text-align: center;
  padding: 60px 20px;
  background: #f8fafc;
  border: 2px dashed #e2e8f0;
  border-radius: 16px;
}
.returns-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.returns-empty p {
  font-size: 0.95rem;
  color: #64748b;
  margin-bottom: 16px;
}

/* 데스크톱/모바일 토글 */
.desktop-only { display: block; }
.mobile-only { display: none; }

/* ===== 반품 등록 폼 UI (모던 & 직관적인 UX) ===== */
.returns-page-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.btn-back-link {
  font-size: 0.85rem;
  color: #64748b;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-back-link:hover {
  color: #0f172a;
}
.head-titles h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 4px 0;
}
.head-desc {
  font-size: 0.88rem;
  color: #64748b;
  margin: 0;
}

/* 카드 공통 */
.returns-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.step-num {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 800;
  background: #e0e7ff;
  color: #4338ca;
  margin-right: 6px;
  vertical-align: middle;
}
.card-head-compact {
  font-size: 0.95rem;
  font-weight: 750;
  color: #0f172a;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
}

/* [1] 주문 찾기 카드 */
.returns-order-finder {
  border: 1.5px solid #86efac;
  background: #f0fdf4;
}
.finder-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.finder-header strong {
  font-size: 1rem;
  color: #065f46;
}
.finder-guide {
  font-size: 0.82rem;
  color: #059669;
}

/* PC 기준: 검색창과 날짜 필터를 한 줄로 정렬 */
.finder-controls-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid #bbf7d0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.finder-search-row {
  display: flex;
  gap: 8px;
  flex: 1 1 340px;
  min-width: 260px;
  align-items: center;
}
.finder-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}
.search-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #16a34a;
  pointer-events: none;
  z-index: 2;
}
.finder-input {
  width: 100%;
  height: 42px;
  padding: 0 38px 0 44px !important;
  border-radius: 10px;
  border: 1.5px solid #86efac;
  background: #f8fafc;
  font-size: 0.95rem;
  font-weight: 600;
  box-sizing: border-box;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  color: #0f172a;
  transition: all 0.15s ease;
}
.finder-input::placeholder {
  color: #94a3b8;
  font-weight: 500;
}
.finder-input:focus {
  outline: none;
  background: #ffffff;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.btn-clear-search {
  position: absolute;
  right: 10px;
  background: #e2e8f0;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
  cursor: pointer;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 2;
}
.btn-clear-search:hover {
  background: #cbd5e1;
  color: #0f172a;
}
.btn-finder-search {
  height: 42px;
  padding: 0 20px;
  background: var(--green-dark, #172d22);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-finder-search:hover {
  background: #1e3a2c;
}

/* 📅 날짜 필터 (PC: 검색바 우측에 1줄로 배치) */
.finder-date-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 0 12px;
  border-left: 1.5px solid #cbd5e1;
  flex: 0 0 auto;
  white-space: nowrap;
}
.date-filter-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}
.date-filter-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #065f46;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap !important;
  margin: 0;
}
.finder-date-input {
  height: 38px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1.5px solid #86efac;
  background: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  color: #064e3b;
  cursor: pointer;
  box-sizing: border-box;
}
.finder-date-input:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}
.date-quick-buttons {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}
.btn-date-quick {
  height: 34px;
  padding: 0 9px;
  background: #ffffff;
  border: 1px solid #86efac;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #15803d;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-date-quick:hover {
  background: #dcfce7;
  border-color: #4ade80;
}
.btn-date-quick.active {
  background: #15803d;
  color: #ffffff;
  border-color: #15803d;
}
.btn-date-quick.reset {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #64748b;
}
.btn-date-quick.reset:hover {
  background: #e2e8f0;
  color: #334155;
}
.active-date-badge {
  font-size: 0.82rem;
  font-weight: 800;
  color: #047857;
  background: #dcfce7;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #86efac;
  white-space: nowrap;
}
.search-title-tag {
  display: inline-block;
  background: #dcfce7;
  color: #15803d;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  margin-left: 6px;
}

/* 최근 주문 빠른 칩 */
.recent-orders-bar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.recent-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #065f46;
  white-space: nowrap;
}
.recent-chips-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.recent-chip {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #bbf7d0;
  background: #ffffff;
  color: #1e293b;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.recent-chip strong {
  color: #16a34a;
}
.recent-chip:hover {
  background: #dcfce7;
  border-color: #86efac;
}
.recent-chip.active {
  background: #172d22;
  color: #ffffff;
  border-color: #172d22;
}
.recent-chip.active strong {
  color: #4ade80;
}

/* 검색 결과 드롭다운 패널 */
.order-search-results-panel {
  margin-top: 14px;
  max-height: 340px;
  overflow-y: auto;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.results-title-bar {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.84rem;
  font-weight: 750;
  color: #475569;
}
.searching-state,
.no-results-state {
  padding: 24px;
  text-align: center;
  font-size: 0.9rem;
  color: #64748b;
}
.order-cards-container {
  display: flex;
  flex-direction: column;
}
.order-pick-card {
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s ease;
}
.order-pick-card:last-child {
  border-bottom: none;
}
.order-pick-card:hover {
  background: #f0fdf4;
}
.pick-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.pick-num {
  font-weight: 850;
  color: #166534;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.86rem;
}
.pick-partner {
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
}
.pick-date {
  font-size: 0.84rem;
  font-weight: 650;
  color: #047857;
  background: #ecfdf5;
  padding: 2px 7px;
  border-radius: 5px;
}
.status-chip {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}
.status-chip.confirmed {
  background: #dcfce7;
  color: #15803d;
}
.status-chip.ready {
  background: #fef9c3;
  color: #a16207;
}
.pick-amount {
  margin-left: auto;
  font-weight: 850;
  color: #0f172a;
  font-size: 0.95rem;
}
.pick-summary {
  font-size: 0.84rem;
  color: #64748b;
}

/* 선택된 원본 주문 카드 - 시원하고 선명한 고대비 디자인 */
.selected-order-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: #f0fdf4;
  border: 2px solid #10b981;
  border-radius: 14px;
  padding: 16px 22px;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.12);
}
.selected-order-main-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.selected-order-top-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.order-badge {
  background: #064e3b;
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 800;
}
.order-confirmed-chip {
  background: #dcfce7;
  color: #15803d;
  font-size: 0.78rem;
  font-weight: 750;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid #bbf7d0;
}
.selected-order-highlight-content {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.partner-name-hero {
  font-size: 1.25rem;
  font-weight: 900;
  color: #064e3b;
  letter-spacing: -0.02em;
}
.order-date-hero {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 1.05rem;
  color: #047857;
  background: #dcfce7;
  border: 1.5px solid #86efac;
  padding: 5px 12px;
  border-radius: 8px;
}
.order-date-hero strong {
  font-weight: 850;
  color: #065f46;
}
.order-amount-hero {
  font-size: 0.95rem;
  color: #475569;
  background: #ffffff;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.order-amount-hero strong {
  font-weight: 850;
  color: #0f172a;
}
.btn-change-order {
  padding: 9px 15px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 750;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-change-order:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* 거래처 셀렉트 */
.partner-card-section {
  padding: 16px 20px;
}
.partner-select-box {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.92rem;
  font-weight: 600;
  background: #ffffff;
}

/* [2] 품목 리스트 & 제어 */
.items-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.items-header-bar strong {
  font-size: 1rem;
  color: #0f172a;
}
.items-guide {
  display: block;
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 3px;
}
.items-batch-group {
  display: flex;
  gap: 6px;
}
.btn-batch-mini {
  padding: 6px 13px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1.5px solid #bfdbfe;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-batch-mini:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}
.btn-batch-mini.active {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
}
.btn-batch-mini.active:hover {
  background: #fecaca !important;
}

.return-items-list-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* PC 전용 열 헤더 */
.return-items-header {
  display: grid;
  grid-template-columns: minmax(130px, 1.4fr) 110px minmax(210px, 1.2fr) 110px 110px 36px;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
}
.return-items-header .col-head.text-center { text-align: center; }
.return-items-header .col-head.text-right { text-align: right; }

/* 품목 개별 행 */
.return-item-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.4fr) 110px minmax(210px, 1.2fr) 110px 110px 36px;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  transition: all 0.2s ease;
}
.return-item-row:hover {
  border-color: #cbd5e1;
}

/* ⚠️ 전량 취소 상태 - 확실한 경고 느낌 강조 */
.return-item-row.is-full-cancel {
  border: 2px solid #dc2626 !important;
  background: #fef2f2 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2), 0 2px 8px rgba(220, 38, 38, 0.1) !important;
}
.return-item-row.is-full-cancel .input-qty-num {
  border-color: #dc2626 !important;
  color: #991b1b !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2) !important;
}

/* [1] 품목명 */
.return-item-row .col-product-name,
.return-items-header .col-product-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.item-name-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
}
.item-product-select-box {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  font-size: 0.9rem;
  font-weight: 600;
  background: #ffffff;
}

/* ⚠️ 전량 취소 뱃지 */
.status-full-cancel-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #dc2626;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3);
}

/* [2] 원 주문 수량 - 반품 수량 바로 왼쪽 */
.return-item-row .col-orig-qty,
.return-items-header .col-orig-qty {
  display: flex;
  align-items: center;
  justify-content: center;
}
.orig-qty-badge {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  background: #eff6ff;
  color: #1e40af;
  border: 1.5px solid #bfdbfe;
  padding: 6px 12px;
  border-radius: 8px;
  min-width: 70px;
  text-align: center;
}
.orig-qty-num {
  font-size: 1.05rem;
  font-weight: 850;
  color: #1d4ed8;
}
.orig-qty-unit {
  font-size: 0.82rem;
  font-weight: 600;
  color: #3b82f6;
}
.orig-qty-badge.manual {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
}

/* [3] 반품 수량 */
.return-item-row .col-return-qty,
.return-items-header .col-return-qty {
  display: flex;
  align-items: center;
}
.qty-action-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.input-qty-num {
  width: 75px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  font-size: 0.95rem;
  font-weight: 800;
  text-align: right;
  color: #0f172a;
  background: #ffffff;
  transition: all 0.15s ease;
}
.input-qty-num:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.unit-text {
  font-size: 0.85rem;
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
}
.btn-quick-full-cancel {
  padding: 6px 10px;
  background: #f8fafc;
  color: #475569;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn-quick-full-cancel:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}
.btn-quick-full-cancel.active {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #b91c1c !important;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3);
}
.btn-quick-full-cancel.active:hover {
  background: #b91c1c !important;
}

/* [4] 적용 단가 */
.return-item-row .col-price,
.return-items-header .col-price {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.price-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
.input-price-num {
  width: 80px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.9rem;
  text-align: right;
  font-weight: 600;
  color: #334155;
}
.price-unit {
  font-size: 0.82rem;
  color: #64748b;
  white-space: nowrap;
}

/* [5] 반품 금액 */
.return-item-row .col-subtotal,
.return-items-header .col-subtotal {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
}
.subtotal-money-text {
  font-size: 0.98rem;
  font-weight: 850;
  color: #dc2626;
  white-space: nowrap;
}

/* [6] 행 삭제 */
.return-item-row .col-action,
.return-items-header .col-action {
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-item-exclude {
  background: transparent;
  color: #94a3b8;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.btn-item-exclude:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.empty-notice-box {
  padding: 32px 20px;
  text-align: center;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  color: #64748b;
}
.empty-notice-box .notice-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}
.manual-add-row {
  margin-top: 12px;
}
.btn-manual-add {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: #f1f5f9;
  color: #334155;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-manual-add:hover {
  background: #e2e8f0;
}
.item-product-select-box {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.9rem;
  min-width: 220px;
}

/* [3] 반품 정보 */
.info-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.field-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-item.full-col {
  grid-column: 1 / -1;
}
.field-item label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
}
.info-input,
.info-select {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.92rem;
  box-sizing: border-box;
}

/* [4] 하단 고정 액션 바 (화면 맨 아래 선명하게 상시 표시) */
.returns-bottom-action-bar {
  position: sticky;
  bottom: 0;
  z-index: 100;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  padding: 16px 24px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.bottom-summary-info {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1rem;
  color: #0f172a;
  font-weight: 700;
}
.summary-sep {
  color: #cbd5e1;
}
.summary-amount strong {
  font-size: 1.35rem;
  font-weight: 900;
}
.bottom-buttons-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-action-cancel {
  padding: 11px 22px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-action-cancel:hover {
  background: #e2e8f0;
}
.btn-action-submit {
  padding: 12px 28px;
  background: var(--green-dark, #172d22);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(23, 45, 34, 0.25);
  transition: transform 0.1s, background 0.15s;
}
.btn-action-submit:hover {
  background: #1e3a2c;
  transform: translateY(-1px);
}

.order-confirmed-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  border-radius: 0 0 12px 12px;
}
.order-confirmed-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #166534;
}
.btn-return-link-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 750;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-return-link-shortcut:hover {
  background: #fecaca;
}

/* 반품 반응형 */
@media (max-width: 768px) {
  .returns-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .returns-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .returns-filter-form {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .returns-search-group {
    width: 100%;
  }
  .returns-search-input {
    flex: 1;
    width: 100%;
  }
  .btn-returns-new {
    width: 100%;
    justify-content: center;
  }
  .returns-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .returns-kpi-card {
    padding: 12px 8px;
  }
  .returns-kpi-value {
    font-size: 1.1rem;
  }
  .returns-kpi-label {
    font-size: 0.75rem;
  }
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }

  .returns-info-grid,
  .info-fields-grid {
    grid-template-columns: 1fr;
  }

  /* 반품 폼 모바일 대응 */
  .finder-controls-box {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px;
  }
  .finder-search-row {
    width: 100%;
  }
  .finder-date-bar {
    border-left: none;
    padding-left: 0;
    border-top: 1px dashed #bbf7d0;
    padding-top: 10px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .return-items-header {
    display: none !important;
  }
  .return-item-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    position: relative;
    padding: 14px;
  }
  .return-item-row .col-product-name {
    grid-column: 1 / -1;
    padding-right: 38px;
  }
  .return-item-row .col-action {
    position: absolute;
    top: 12px;
    right: 12px;
  }
  .return-item-row .col-orig-qty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: #f1f5f9;
    padding: 8px 10px;
    border-radius: 8px;
  }
  .return-item-row .col-return-qty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: #f8fafc;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
  }
  .return-item-row .col-price {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .return-item-row .col-subtotal {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
  .mobile-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
  }

  .returns-bottom-action-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 16px;
  }
  .bottom-summary-info {
    justify-content: space-between;
    width: 100%;
  }
  .bottom-buttons-wrap {
    width: 100%;
  }
  .btn-action-submit,
  .btn-action-cancel {
    flex: 1;
    text-align: center;
    justify-content: center;
  }
  .returns-wrapper {
    padding-bottom: 90px;
  }
}

@media (max-width: 400px) {
  .returns-kpi-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .returns-kpi-card {
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .returns-kpi-value {
    font-size: 1.15rem;
  }
}

/* ==========================================================================
   기존 품목 연결 및 최신 설정 적용 스타일
   ========================================================================== */
.unmatched-actions button.btn-link-product {
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.unmatched-actions button.btn-link-product:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.btn-reapply-catalog {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  color: #047857;
  background: #f0fdf4;
  border: 1px solid #a7f3d0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn-reapply-catalog:hover {
  background: #dcfce7;
  border-color: #6ee7b7;
  color: #065f46;
}

.link-product-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  width: 92%;
  max-width: 520px;
  background: #ffffff;
  overflow: hidden;
}
.link-product-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.link-product-dialog-content {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.link-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.link-dialog-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #111827;
}
.dialog-close-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 6px;
}
.dialog-close-btn:hover {
  background: #f3f4f6;
  color: #111827;
}
.link-dialog-desc {
  margin: 0;
  font-size: 14px;
  color: #374151;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  line-height: 1.5;
}
.link-dialog-desc strong {
  color: #1d4ed8;
}
.link-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.link-field-group label {
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
}
.link-search-wrapper {
  display: flex;
  gap: 6px;
}
.link-search-input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
.link-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.btn-clear-search {
  padding: 0 12px;
  height: 38px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
  cursor: pointer;
}
.btn-clear-search:hover {
  background: #f3f4f6;
}
.link-product-select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  padding: 4px;
  background: #ffffff;
  outline: none;
  min-height: 160px;
}
.link-product-select option {
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 2px;
  cursor: pointer;
}
.link-product-select option:hover, .link-product-select option:focus {
  background: #f0fdf4;
}
.link-product-select option:checked {
  background: #10b981 !important;
  color: #ffffff !important;
  font-weight: 700;
}
.link-field-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #6b7280;
}
.link-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
}
.link-checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #065f46;
  cursor: pointer;
}
.link-checkbox-group input[type="checkbox"] {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: #059669;
}
.link-checkbox-desc {
  font-size: 11px;
  color: #047857;
  padding-left: 25px;
}
.link-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.link-dialog-actions button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* ==========================================================================
   매입 전표 관리 (Purchase Invoices) & 2분할 영수증 뷰어/검수 스타일
   ========================================================================== */
.purchase-invoices-wrapper,
.pi-form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 100%;
  margin: 0;
  padding-bottom: 40px;
}

.pi-date-input {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  background: #ffffff;
}

.btn-today-shortcut {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  min-height: 38px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  text-decoration: none;
  white-space: nowrap;
}
.btn-today-shortcut:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* 매입 전표 세련된 일체형 검색 바 */
.pi-search-form {
  margin: 0;
  min-width: 280px;
  max-width: 360px;
  flex: 1;
}
.pi-search-group {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
  height: 44px;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pi-search-group:focus-within {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}
.pi-search-icon {
  padding-left: 12px;
  font-size: 15px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  user-select: none;
}
.pi-search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none !important;
  background: transparent !important;
  padding: 0 10px;
  font-size: 14.5px;
  color: #1e293b;
  outline: none !important;
  box-shadow: none !important;
}
.pi-search-input::placeholder {
  color: #94a3b8;
}
.pi-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b !important;
  text-decoration: none;
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
  transition: all 0.15s;
}
.pi-search-clear:hover {
  background: #cbd5e1;
  color: #1e293b !important;
}
.btn-pi-search {
  height: 100%;
  padding: 0 20px;
  background: #059669;
  color: #ffffff !important;
  font-size: 14.5px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-pi-search:hover, .btn-pi-search:active {
  background: #047857;
}

/* 매입 전표 & 반품 검색 바 다크모드 (이중 테두리 및 눈뽕 완벽 제거) */
html[data-theme="dark"] .pi-search-group,
html[data-theme="dark"] .returns-search-group {
  background: var(--canvas, #0b0f19) !important;
  border-color: var(--line, #243447) !important;
}
html[data-theme="dark"] .pi-search-group:focus-within,
html[data-theme="dark"] .returns-search-group:focus-within {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}
html[data-theme="dark"] .pi-search-input,
html[data-theme="dark"] .returns-search-input {
  background: transparent !important;
  color: var(--ink, #f8fafc) !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
html[data-theme="dark"] .pi-search-clear,
html[data-theme="dark"] .returns-search-clear {
  background: var(--panel-hover, #1e2b3e) !important;
  color: var(--muted, #94a3b8) !important;
}
html[data-theme="dark"] .btn-pi-search,
html[data-theme="dark"] .btn-returns-search {
  background: #10b981 !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .btn-pi-search:hover,
html[data-theme="dark"] .btn-returns-search:hover {
  background: #059669 !important;
}
html[data-theme="dark"] .returns-filter-group select {
  background: var(--canvas, #0b0f19) !important;
  border-color: var(--line, #243447) !important;
  color: var(--ink, #f8fafc) !important;
}
html[data-theme="dark"] .returns-filter-group label {
  color: var(--muted, #94a3b8) !important;
}

.pi-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.pi-btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
@media (min-width: 1051px) {
  .pi-btn-group.desktop-only {
    display: flex !important;
  }
  .pi-btn-group.mobile-only {
    display: none !important;
  }
}

.btn-pi-upload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  min-height: 44px;
  background: #059669;
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 800;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-pi-upload:hover {
  background: #047857;
  transform: translateY(-1px);
}
.btn-pi-upload.big {
  min-height: 50px;
  padding: 0 24px;
  font-size: 16px;
}

.btn-pi-manual {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  min-height: 44px;
  background: #ffffff;
  color: #334155 !important;
  border: 1px solid #cbd5e1;
  font-size: 15px;
  font-weight: 750;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s ease;
}
.btn-pi-manual:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.btn-pi-manual.big {
  min-height: 50px;
  padding: 0 22px;
  font-size: 16px;
}

/* 영수증 썸네일 & 뱃지 */
.btn-clean-thumb {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  outline: none;
}
.pi-receipt-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  vertical-align: middle;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-clean-thumb:hover .pi-receipt-thumb,
.pi-receipt-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.badge-ai-success {
  display: inline-block;
  padding: 3px 8px;
  background: #dcfce7;
  color: #15803d;
  font-size: 12px;
  font-weight: 750;
  border-radius: 6px;
  border: 1px solid #bbf7d0;
}
.badge-ai-failed {
  display: inline-block;
  padding: 3px 8px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 750;
  border-radius: 6px;
  border: 1px solid #fecaca;
}
.badge-ai-manual {
  display: inline-block;
  padding: 3px 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

/* 빈 상태 및 기간 선택 액션 */
.pi-empty-state {
  text-align: center;
  padding: 36px 16px;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  margin-top: 10px;
}
.pi-empty-state-large {
  padding: 56px 20px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.pi-empty-icon {
  font-size: 38px;
  margin-bottom: 12px;
  opacity: 0.85;
}
.pi-empty-state h3 {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}
.pi-empty-subtext {
  font-size: 14.5px;
  color: #64748b;
  margin: 10px 0 24px;
}
.pi-empty-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.btn-pi-empty-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-pi-empty-link:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}
.btn-pi-empty-link.primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}
.btn-pi-empty-link.primary:hover {
  background: #1d4ed8;
}
.btn-pi-empty-link.secondary {
  background: #f8fafc;
  color: #1e293b;
}

/* 매입전표 상단 툴바 & 기간 선택기 (일별 / 월별 / 전체) */
.pi-header-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.pi-period-badge {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13.5px;
  font-weight: 750;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
  margin-left: 10px;
  vertical-align: middle;
}
.pi-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pi-period-tabs {
  display: inline-flex;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 9px;
  gap: 3px;
}
.pi-period-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 700;
  color: #475569;
  text-decoration: none;
  transition: all 0.15s ease;
}
.pi-period-tab:hover {
  background: rgba(255, 255, 255, 0.65);
  color: #0f172a;
}
.pi-period-tab.active {
  background: #ffffff;
  color: #1e293b;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.badge-all-period {
  font-size: 13.5px;
  font-weight: 700;
  color: #334155;
  background: #f1f5f9;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
}

/* 표 행 클릭 가능 스타일 */
.pi-clickable-row {
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.pi-clickable-row:hover {
  background-color: #f8fafc;
}

/* 영수증 갤러리 및 라이트박스 뷰어 */
.pi-view-switcher {
  display: inline-flex;
  background: #e2e8f0;
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
  margin-bottom: 16px;
}
.pi-view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pi-view-tab:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}
.pi-view-tab.active {
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.pi-view-tab .tab-count {
  font-size: 12px;
  padding: 2px 6px;
  background: #f1f5f9;
  border-radius: 10px;
  color: #64748b;
}
.pi-view-tab.active .tab-count {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 800;
}

/* 영수증 갤러리 그리드 */
.pi-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.pi-gallery-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.pi-gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}
.pi-gallery-img-wrap {
  position: relative;
  height: 260px;
  background: #0f172a;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pi-gallery-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1);
}
.pi-gallery-card:hover .pi-gallery-img {
  transform: scale(1.04);
}
.pi-gallery-img-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 700;
  gap: 6px;
  transition: opacity 0.18s ease;
  backdrop-filter: blur(2px);
}
.pi-gallery-card:hover .pi-gallery-img-overlay {
  opacity: 1;
}
.pi-gallery-info {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.pi-gallery-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.pi-gallery-supplier {
  font-size: 15px;
  font-weight: 800;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pi-gallery-date {
  font-size: 13px;
  color: #64748b;
}
.pi-gallery-amount {
  font-size: 17px;
  font-weight: 800;
  color: #16a34a;
}
.pi-gallery-summary {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}
.pi-gallery-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}
.btn-gallery-view {
  flex: 1;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-gallery-view:hover {
  background: #e2e8f0;
}
.btn-gallery-edit {
  padding: 8px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: #1d4ed8;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s;
}
.btn-gallery-edit:hover {
  background: #dbeafe;
}

/* 고성능 영수증 라이트박스 뷰어 모달 */
.pi-lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(10, 15, 28, 0.94);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  user-select: none;
  animation: piFadeIn 0.2s ease-out;
}
@keyframes piFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.pi-lightbox-header {
  height: 60px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: #ffffff;
  gap: 12px;
  z-index: 10;
}
.lightbox-info-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.lightbox-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lightbox-badge-amount {
  font-size: 15px;
  font-weight: 800;
  color: #4ade80;
  white-space: nowrap;
  background: rgba(74, 222, 128, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(74, 222, 128, 0.25);
}
.lightbox-ctrl-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.btn-lightbox-tool {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn-lightbox-tool:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}
.btn-lightbox-tool.primary {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
}
.btn-lightbox-tool.primary:hover {
  background: #1d4ed8;
}
.btn-lightbox-close {
  background: #ef4444;
  color: #ffffff;
  border: none;
  font-size: 18px;
  font-weight: bold;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  transition: background 0.15s;
}
.btn-lightbox-close:hover {
  background: #dc2626;
}

.pi-lightbox-body {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}
.pi-lightbox-body:active {
  cursor: grabbing;
}
.pi-lightbox-img-canvas {
  position: absolute;
  transform-origin: center center;
  transition: transform 0.05s ease-out;
  will-change: transform;
}
.pi-lightbox-img-canvas img {
  display: block;
  max-height: 85vh;
  max-width: 90vw;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
}

/* 좌/우 넘김 버튼 */
.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: all 0.18s ease;
  backdrop-filter: blur(4px);
}
.lightbox-nav-btn:hover {
  background: rgba(37, 99, 235, 0.9);
  border-color: #60a5fa;
  transform: translateY(-50%) scale(1.1);
}
.lightbox-nav-prev {
  left: 20px;
}
.lightbox-nav-next {
  right: 20px;
}
.lightbox-nav-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
  pointer-events: none;
}

.lightbox-nav-indicator {
  font-size: 13.5px;
  color: #94a3b8;
  font-weight: 700;
  padding: 0 4px;
}

@media (max-width: 768px) {
  .pi-lightbox-header {
    height: auto;
    padding: 10px 12px;
    flex-wrap: wrap;
  }
  .lightbox-info-group {
    width: 100%;
    justify-content: space-between;
  }
  .lightbox-ctrl-group {
    width: 100%;
    justify-content: flex-end;
    margin-top: 6px;
    overflow-x: auto;
  }
  .lightbox-nav-btn {
    width: 42px;
    height: 42px;
    font-size: 20px;
  }
  .lightbox-nav-prev { left: 8px; }
  .lightbox-nav-next { right: 8px; }
}

/* ==========================================================================
   간결한 모바일 친화적 폼 헤더 & 원터치 업로드
   ========================================================================== */
/* ==========================================================================
   매입 전표 폼 헤더: 모바일/PC 통합 세련된 상단 내비게이션 바
   ========================================================================== */
.pi-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 4px 0;
}
.pi-head-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.pi-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 11px;
  background: #f1f5f9;
  color: #475569 !important;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.pi-nav-back:hover {
  background: #e2e8f0;
  color: #0f172a !important;
}
.pi-form-title {
  font-size: 18px;
  font-weight: 850;
  color: #0f172a;
  margin: 0;
  white-space: nowrap;
  letter-spacing: -0.3px;
}
.pi-head-action {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.btn-pi-photo-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 750;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn-camera-sm {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.btn-camera-sm:hover, .btn-camera-sm:active {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
}
.btn-album-sm {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
}
.btn-album-sm:hover, .btn-album-sm:active {
  background: #f8fafc;
  border-color: #94a3b8;
}
.btn-desktop-upload {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.btn-desktop-upload:hover, .btn-desktop-upload:active {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
}

.pi-mobile-photo-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.desktop-only-inline {
  display: inline-flex !important;
}

.mobile-only-flex {
  display: none !important;
}

@media (max-width: 768px) {
  .desktop-only-inline {
    display: none !important;
  }
  .mobile-only-flex {
    display: flex !important;
  }
}

@media (max-width: 640px) {
  .pi-form-head {
    flex-wrap: wrap;
    gap: 8px;
  }
  .pi-head-action {
    width: 100%;
  }
  .pi-mobile-photo-actions {
    width: 100%;
    gap: 8px;
  }
  .pi-mobile-photo-actions .btn-pi-photo-sm {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 13px;
  }
}

/* 다크모드 대응 */
html[data-theme="dark"] .btn-album-sm {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #475569;
}
html[data-theme="dark"] .btn-album-sm:hover {
  background: #334155;
  border-color: #64748b;
}
html[data-theme="dark"] .btn-desktop-upload,
html[data-theme="dark"] .btn-camera-sm {
  background: rgba(5, 150, 105, 0.2);
  color: #6ee7b7;
  border-color: #059669;
}
html[data-theme="dark"] .btn-desktop-upload:hover,
html[data-theme="dark"] .btn-camera-sm:hover {
  background: #059669;
  color: #ffffff;
}

/* 목록 화면 상단 바로 촬영 버튼 */
.btn-pi-camera {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  min-height: 44px;
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 800;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.25);
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-pi-camera:hover {
  background: #047857;
  transform: translateY(-1px);
}
.btn-pi-camera.big {
  min-height: 50px;
  padding: 0 24px;
  font-size: 16px;
}

/* 플로팅 토스트 알림 */
.pi-toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14.5px;
  font-weight: 750;
  z-index: 999999;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}
.pi-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* 중앙 안내/경고 팝업 모달 다이얼로그 (모바일/태블릿/PC 최적화) */
.pi-center-alert-dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 90vw;
  width: 400px;
  margin: auto;
}
.pi-center-alert-dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.pi-center-alert-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(226, 232, 240, 0.8);
  animation: pi-modal-pop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.pi-alert-icon-wrap {
  font-size: 38px;
  line-height: 1;
  margin-bottom: 12px;
}
.pi-alert-title {
  font-size: 17.5px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
.pi-alert-message {
  font-size: 14.5px;
  color: #334155;
  line-height: 1.6;
  margin: 0 0 22px;
  word-break: keep-all;
  white-space: pre-wrap;
}
.pi-alert-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.btn-pi-alert-confirm {
  width: 100%;
  max-width: 220px;
  height: 44px;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}
.btn-pi-alert-confirm:hover {
  background: #0369a1;
}
.btn-pi-alert-confirm:active {
  transform: scale(0.98);
}

@media (min-width: 769px) {
  .mobile-only-banner {
    display: none !important;
  }
}
.pi-quick-cam {
  font-size: 26px;
  line-height: 1;
}
.pi-quick-text {
  flex: 1;
  min-width: 0;
}
.pi-quick-text strong {
  font-size: 16px;
  font-weight: 850;
  color: #065f46;
}
.pi-quick-badge {
  padding: 4px 8px;
  background: #059669;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  border-radius: 6px;
  white-space: nowrap;
}

/* 간결 체크박스 텍스트 */
.checkbox-simple-text {
  font-size: 14.5px;
  font-weight: 750;
  color: #1e293b;
  line-height: 1.4;
}

.pi-ai-loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 10px;
  z-index: 5;
}
.pi-ai-loading strong {
  font-size: 14px;
  color: #065f46;
}
.pi-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(5, 150, 105, 0.2);
  border-top-color: #059669;
  border-radius: 50%;
  animation: pi-spin 0.8s linear infinite;
}
@keyframes pi-spin {
  to { transform: rotate(360deg); }
}

/* 전체화면 AI 영수증 분석 로딩 오버레이 */
.pi-global-ai-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}
.pi-global-ai-modal {
  background: #ffffff;
  border-radius: 16px;
  padding: 32px 24px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  animation: pi-modal-pop 0.2s ease-out;
}
@keyframes pi-modal-pop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.pi-global-ai-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(5, 150, 105, 0.2);
  border-top-color: #059669;
  border-radius: 50%;
  animation: pi-spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
.pi-global-ai-title {
  font-size: 17px;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 8px;
}
.pi-global-ai-desc {
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.5;
}

/* ==========================================================================
   매입 전표 폼: 전체 너비(Full Width) 와이드 레이아웃 & 상단 접이식 영수증 뷰어
   ========================================================================== */
.pi-form-fullwidth {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* 상단 접이식 영수증 뷰어 카드 */
.pi-receipt-collapsible-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  width: 100%;
  box-sizing: border-box;
}

.pi-receipt-toggle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: #1e293b;
  color: #f8fafc;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #334155;
  transition: background 0.15s ease;
}
.pi-receipt-toggle-header:hover {
  background: #283548;
}
.toggle-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toggle-header-left strong {
  font-size: 15.5px;
  font-weight: 800;
  color: #f8fafc;
}
.viewer-pan-hint {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
  margin-left: 4px;
}
.toggle-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-toggle-viewer {
  padding: 5px 12px;
  background: #334155;
  color: #f8fafc;
  border: 1px solid #475569;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-toggle-viewer:hover {
  background: #475569;
}

/* 뷰어 컨트롤 툴바 */
.pi-viewer-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  flex-wrap: wrap;
  gap: 8px;
}
.viewer-ctrl-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.btn-tool {
  padding: 6px 12px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-tool:hover {
  background: #334155;
  color: #ffffff;
  border-color: #64748b;
}
.btn-tool-save {
  background: #059669 !important;
  color: #ffffff !important;
  border: 1px solid #10b981 !important;
  font-weight: 800;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3);
}
.btn-tool-save:hover {
  background: #047857 !important;
  border-color: #34d399 !important;
}

/* 인터랙티브 마우스 드래그 뷰어 (트랙패드 뒤로가기 차단 및 자유 이동) */
.pi-viewer-interactive-body {
  position: relative;
  height: 480px;
  background: #020617;
  overflow: hidden;
  overscroll-behavior: contain !important; /* 트랙패드 브라우저 뒤로가기 완벽 방지 */
  cursor: grab;
  user-select: none;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pi-viewer-interactive-body.is-dragging {
  cursor: grabbing;
}

.pi-img-pan-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.pi-img-pan-wrapper img {
  max-width: 90%;
  max-height: 440px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  transition: transform 0.05s ease-out;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}

/* 좌측 뷰어 데스크탑 로딩 오버레이 */
.pi-viewer-ai-loading {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
  padding: 24px;
  text-align: center;
  color: #ffffff;
}
.pi-spinner-large {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(52, 211, 153, 0.2);
  border-top-color: #34d399;
  border-radius: 50%;
  animation: pi-spin 0.8s linear infinite;
}
.pi-viewer-ai-loading strong {
  font-size: 17px;
  color: #34d399;
}
.pi-viewer-ai-loading span {
  font-size: 13px;
  color: #94a3b8;
}

/* 좌측 뷰어 빈 상태 (드롭존 / 클릭 안내) */
.pi-viewer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 50px 24px;
  border: 2px dashed rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  color: #cbd5e1;
  cursor: pointer;
  width: 88%;
  box-sizing: border-box;
  transition: all 0.2s;
  background: rgba(30, 41, 59, 0.5);
}
.pi-viewer-empty:hover,
.pi-viewer-body.drag-over .pi-viewer-empty {
  border-color: #34d399;
  color: #ffffff;
  background: rgba(30, 41, 59, 0.8);
  transform: scale(1.02);
}
.pi-viewer-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 14px;
  display: block;
}
.pi-viewer-empty p {
  margin: 0 0 6px;
  font-size: 15.5px;
  color: #f8fafc;
}
.pi-viewer-empty .empty-sub {
  font-size: 13px;
  color: #94a3b8;
}
.empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 8px 18px;
  background: #059669;
  color: #ffffff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.35);
  transition: all 0.15s;
}
.empty-btn:hover {
  background: #047857;
  transform: translateY(-1px);
}

/* ==========================================================================
   매입전표 신규/수정 스플릿 워크스페이스 (좌측 길쭉한 영수증 + 우측 전표 입력)
   ========================================================================== */
.pi-split-workspace {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  width: 100%;
}

/* ◀ 좌측 컬럼: PC 화면 세로 고정 영수증 뷰어 */
.pi-receipt-column {
  width: 440px;
  flex-shrink: 0;
  position: sticky;
  top: 72px;
  height: calc(100vh - 110px);
  min-height: 580px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.pi-receipt-column-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0f172a;
  border-radius: 12px;
  border: 1px solid #334155;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.pi-receipt-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  color: #f8fafc;
}

.pi-receipt-column-header .header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 750;
  color: #f1f5f9;
}

.pi-receipt-column-header .header-tools {
  display: flex;
  gap: 5px;
}

.btn-tool-sm {
  padding: 5px 9px;
  background: #334155;
  border: 1px solid #475569;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-tool-sm:hover {
  background: #475569;
  color: #ffffff;
}

/* 인터랙티브 마우스 드래그 뷰어 바디 (세로 확장) */
.pi-receipt-column .pi-viewer-interactive-body {
  flex: 1;
  height: 100%;
  min-height: 200px;
  background: #020617;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  touch-action: none;
  overscroll-behavior: contain !important;
}

.pi-receipt-column .pi-viewer-interactive-body.is-dragging {
  cursor: grabbing;
}

.pi-receipt-column .pi-img-pan-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

.pi-receipt-column .pi-img-pan-wrapper img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  transition: transform 0.05s ease-out;
}

.pi-receipt-column-footer {
  padding: 8px 12px;
  font-size: 13px;
  color: #94a3b8;
  background: #1e293b;
  border-top: 1px solid #334155;
  text-align: center;
  font-weight: 600;
}

/* ▶ 우측 컬럼: 전표 입력 및 품목 테이블 */
.pi-entry-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 상단 2열 정보 바 (기본정보 + 합계/액션) */
.pi-top-info-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.pi-stack-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pi-form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pi-summary-action-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pi-options-inline-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
}

.pi-action-buttons-wrap {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.pi-action-buttons-wrap .btn-pi-submit {
  flex: 1.6;
}

.pi-action-buttons-wrap .btn-pi-cancel {
  flex: 1;
}

/* 우측 검수/입력 폼 */
.pi-right-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.pi-section-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  min-width: 0;
}
.pi-card-title {
  font-size: 17px;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 14px;
}
.pi-card-desc {
  font-size: 13.5px;
  color: #64748b;
  margin: 2px 0 0;
}
.pi-card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 12px;
}
.btn-add-item-row {
  padding: 8px 14px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 750;
  color: #0f172a;
  cursor: pointer;
  white-space: nowrap;
}
.btn-add-item-row:hover {
  background: #e2e8f0;
}

.pi-basic-info-card {
  padding: 16px 18px;
}
.pi-grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.pi-form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.pi-form-field.field-supplier {
  grid-column: 1 / -1;
}
.pi-form-field.field-phone {
  grid-column: 1 / -1;
}
.pi-form-field label {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 4px;
}
.req-star {
  color: #ef4444;
  font-weight: 800;
}
.label-opt {
  font-size: 11.5px;
  color: #94a3b8;
  font-weight: 500;
}
.pi-input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  font-size: 14.5px;
  color: #1e293b;
  background: #f8fafc;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.pi-input:focus {
  background: #ffffff;
  border-color: #059669;
  outline: none;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

/* 상단 자동 연동 간결 칩 옵션 */
.pi-quick-options {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px dashed #e2e8f0;
}
.pi-chip-checkbox {
  display: block;
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.pi-chip-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pi-chip-checkbox .chip-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 13.5px;
  font-weight: 750;
  transition: all 0.15s ease;
  min-height: 40px;
  box-sizing: border-box;
}
.pi-chip-checkbox .chip-icon {
  font-size: 16px;
  line-height: 1;
}
.pi-chip-checkbox .chip-text {
  flex: 1;
  white-space: nowrap;
  letter-spacing: -0.2px;
}
.pi-chip-checkbox .chip-state-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #64748b;
  transition: all 0.15s ease;
}
.pi-chip-checkbox input[type="checkbox"]:checked + .chip-box {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.08);
}
.pi-chip-checkbox input[type="checkbox"]:checked + .chip-box .chip-state-badge {
  background: #059669;
  color: #ffffff;
}
.pi-chip-checkbox input[type="checkbox"]:not(:checked) + .chip-box .chip-state-badge::before {
  content: "OFF";
}
.pi-chip-checkbox input[type="checkbox"]:not(:checked) + .chip-box .chip-state-badge {
  font-size: 0;
}
.pi-chip-checkbox input[type="checkbox"]:not(:checked) + .chip-box .chip-state-badge::before {
  font-size: 11px;
}

/* 하단 전표 메모 카드 */
.pi-notes-card {
  padding: 14px 18px;
}
.pi-notes-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pi-notes-field label {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

/* ==========================================================================
   품목 2단 스마트 카드 레이아웃 (PC/모바일 무결점 와이드 뷰)
   ========================================================================== */
.pi-items-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
  width: 100%;
}

.pi-item-row-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pi-item-row-card:hover,
.pi-item-row-card:focus-within {
  border-color: #059669;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.08);
}

/* 윗줄: 번호 + 영수증 표기명 + 카탈로그 매칭 + 삭제 */
.item-card-row-top {
  display: grid;
  grid-template-columns: auto 1fr 1.25fr auto;
  gap: 10px;
  align-items: flex-end;
}
.item-badge-wrap {
  display: flex;
  align-items: center;
  padding-bottom: 8px;
}
.item-card-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  padding: 0 6px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 850;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-family: monospace;
}
.item-del-wrap {
  display: flex;
  align-items: center;
}
.btn-item-card-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 12px;
  background: #fef2f2;
  color: #ef4444;
  border: 1px solid #fecaca;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn-item-card-del:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* 아랫줄: 수량 + 단위 + 환산배수 + 매입단가 + 공급금액 */
.item-card-row-bottom {
  display: grid;
  grid-template-columns: 85px 80px 1.2fr 1.1fr 1.1fr;
  gap: 10px;
  align-items: flex-start;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.item-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.item-sub-label {
  font-size: 12px;
  font-weight: 750;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-field-wrap .pi-input,
.item-field-wrap .pi-select {
  height: 38px;
  min-height: 38px;
  font-size: 14px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  width: 100%;
  box-sizing: border-box;
}
.item-field-wrap .pi-select {
  font-size: 13.5px;
}
.item-field-wrap .pi-input:focus,
.item-field-wrap .pi-select:focus {
  border-color: #059669;
  outline: none;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.12);
}

/* 품목 테이블 (레거시/폴백) */
.pi-table-responsive {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 12px;
}
.pi-items-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 13.5px;
}
.pi-items-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 750;
  padding: 10px 6px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
  white-space: nowrap;
}
.pi-items-table td {
  padding: 6px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.pi-items-table tbody tr:hover {
  background: #f8fafc;
}

/* 환산 배수 컨트롤 */
.mult-control-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mult-sign {
  font-size: 15px;
  font-weight: 800;
  color: #059669;
}
.mult-input {
  width: 50px !important;
  min-height: 32px;
  height: 32px;
  padding: 0 4px;
  text-align: center;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.15s ease;
}
.mult-input.is-converted {
  border-color: #10b981 !important;
  background: #ecfdf5 !important;
  color: #065f46 !important;
  font-weight: 800 !important;
}
.mult-summary-tag {
  display: none;
  font-size: 10.5px;
  line-height: 1.1;
  margin-top: 2px;
  border-radius: 4px;
  padding: 1px 4px;
  text-align: center;
  white-space: nowrap;
}
.mult-summary-tag.active {
  display: inline-block;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-weight: 700;
}
.mult-summary-tag.active strong {
  color: #047857;
}
.text-converted-price {
  color: #059669;
  font-weight: 750;
  font-size: 10.5px;
}
.mult-summary-tag.muted {
  display: none !important;
}
.pi-items-table tbody tr:hover {
  background: #f8fafc;
}
.pi-cell-input {
  width: 100%;
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}
.pi-cell-input:focus {
  border-color: #059669;
  outline: none;
}
.pi-cell-select {
  width: 100%;
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13.5px;
  background: #ffffff;
  color: #1e293b;
  box-sizing: border-box;
}
.pi-cell-select:focus {
  border-color: #059669;
  outline: none;
}
.btn-row-del {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #fee2e2;
  color: #ef4444;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-row-del:hover {
  background: #fecaca;
  color: #dc2626;
}

/* ==========================================================================
   매입 전표 2단 분할(Split) 레이아웃 & 엑셀형 1줄 테이블 (스프레드시트 뷰)
   ========================================================================== */
.pi-split-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  width: 100%;
}

.pi-sidebar-panel {
  width: 360px;
  min-width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
}

.pi-main-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pi-stack-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pi-form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pi-options-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pi-sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.pi-btn-block {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}

/* 엑셀형 1줄 스프레드시트 테이블 */
.pi-sheet-table-wrapper {
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px 8px 0 0;
}

.pi-sheet-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
  background: #ffffff;
}

.pi-sheet-table thead th {
  background: #f1f5f9;
  padding: 9px 6px;
  font-weight: 850;
  color: #334155;
  font-size: 12px;
  border-bottom: 1.5px solid #cbd5e1;
  border-right: 1px solid #e2e8f0;
  text-align: center;
  white-space: nowrap;
}

.pi-sheet-table thead th:last-child {
  border-right: none;
}

.pi-sheet-table tbody tr {
  height: 46px;
}

.pi-sheet-table tbody td {
  height: 46px;
  padding: 4px 6px;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #f1f5f9;
  vertical-align: middle;
  box-sizing: border-box;
}

.pi-sheet-table tbody td:last-child {
  border-right: none;
}

.pi-sheet-table tbody tr:hover td {
  background: #f8fafc;
}

.pi-sheet-table tbody tr:focus-within td {
  background: #f0fdf4;
}

/* 컬럼 너비 지정 (table-layout: fixed 완벽 준수) */
.pi-sheet-table .th-no,
.pi-sheet-table .td-no {
  width: 36px;
  text-align: center;
}

.pi-sheet-table .th-raw-name,
.pi-sheet-table .td-raw-name {
  width: 17%;
  min-width: 130px;
}

.pi-sheet-table .th-product-match,
.pi-sheet-table .td-product-match {
  width: 22%;
  min-width: 170px;
}

.product-match-cell-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.product-match-cell-inner select {
  min-width: 0;
  flex: 1;
  text-overflow: ellipsis;
}

.product-match-cell-inner .badge-unmatched {
  font-size: 11px;
  padding: 2px 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.product-match-cell-inner .btn-quick-reg {
  font-size: 11px;
  padding: 2px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pi-sheet-table .th-spec,
.pi-sheet-table .td-spec {
  width: 10%;
  min-width: 80px;
  text-align: center;
}

.pi-sheet-table .th-qty,
.pi-sheet-table .td-qty {
  width: 7%;
  min-width: 60px;
}

.pi-sheet-table .th-unit,
.pi-sheet-table .td-unit {
  width: 11%;
  min-width: 90px;
}

/* 단위 콤보 박스 (선택 + 직접입력 전환) */
.unit-combo-box {
  display: flex;
  align-items: center;
  width: 100%;
}

.unit-combo-box .unit-select {
  width: 100%;
  text-align-last: center;
}

.unit-direct-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 100%;
}

.unit-direct-wrap .unit-direct-input {
  flex: 1;
  min-width: 0;
}

.btn-unit-back {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 5px 6px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  color: #475569;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-unit-back:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.pi-sheet-table .th-mult,
.pi-sheet-table .td-mult {
  width: 9%;
  min-width: 80px;
}

/* 입수/환산 헤더 및 물음표 도움말 팝업 */
.th-mult-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
}

.mult-help-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.mult-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.mult-help-btn:hover,
.mult-help-wrap:hover .mult-help-btn {
  background: #059669;
  color: #ffffff;
  border-color: #047857;
  transform: scale(1.1);
}

.mult-help-tooltip {
  position: fixed !important;
  width: 290px;
  max-width: calc(100vw - 24px);
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
  font-size: 12px;
  line-height: 1.5;
  font-weight: normal;
  text-align: left;
  white-space: normal;
  z-index: 999999 !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.mult-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.btn-tooltip-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.12s ease;
}

.btn-tooltip-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

/* PC 호버 시 표시 */
@media (hover: hover) and (pointer: fine) {
  .mult-help-wrap:hover .mult-help-tooltip,
  .mult-help-tooltip.is-hover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

/* 모바일/터치 클릭 시 토글 표시 */
.mult-help-tooltip.is-open {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.mult-help-title {
  font-size: 13px;
  font-weight: 800;
  color: #34d399;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mult-help-desc {
  margin: 0 0 8px 0;
  color: #cbd5e1;
  font-size: 11.5px;
}

.mult-help-desc strong {
  color: #ffffff;
}

.mult-help-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.example-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #f1f5f9;
}

.badge-sample {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: #047857;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.example-sub {
  font-size: 10.5px;
  color: #94a3b8;
  margin-left: 36px;
  margin-top: 2px;
}

.mult-help-tip {
  font-size: 11px;
  color: #93c5fd;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  padding-top: 6px;
  margin-top: 4px;
}

.mult-control-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.mult-control-cell .mult-sign {
  font-size: 13px;
  font-weight: 800;
  color: #059669;
}

.pi-sheet-table .th-price,
.pi-sheet-table .td-price {
  width: 11%;
  min-width: 90px;
}

.pi-sheet-table .th-total,
.pi-sheet-table .td-total {
  width: 12%;
  min-width: 95px;
}

.pi-sheet-table .th-del,
.pi-sheet-table .td-del {
  width: 36px;
  text-align: center;
}

/* 엑셀 인풋/셀렉트 스타일 */
.sheet-input,
.sheet-select {
  height: 34px;
  min-height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  color: #1e293b;
  transition: all 0.15s ease;
  font-family: inherit;
}

.sheet-input:focus,
.sheet-select:focus {
  border-color: #059669;
  outline: none;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15);
  background: #ffffff;
}

.sheet-input.text-right {
  text-align: right;
}

.sheet-input.text-center {
  text-align: center;
}

.btn-sheet-del {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #ef4444;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-sheet-del:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

.pi-table-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-top: none;
  border-radius: 0 0 8px 8px;
  gap: 12px;
}

.btn-table-add-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: #ecfdf5;
  color: #047857;
  border: 1.5px dashed #059669;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-table-add-row:hover {
  background: #d1fae5;
  color: #065f46;
}

.pi-table-hint {
  font-size: 12px;
  color: #64748b;
}

@media (max-width: 1024px) {
  .pi-split-layout {
    flex-direction: column;
  }
  .pi-sidebar-panel {
    width: 100%;
    min-width: 0;
    position: static;
  }
}

/* 총 매입 합계 바 */
.pi-total-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  margin-top: 8px;
}
.pi-total-label {
  font-size: 16px;
  font-weight: 800;
  color: #065f46;
}
.pi-total-amount {
  font-size: 22px;
  font-weight: 900;
  color: #059669;
  font-family: monospace;
}

/* 연동 옵션 체크박스 */
.pi-options-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.pi-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.pi-checkbox-label:hover {
  background: #f1f5f9;
}
.pi-checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: #059669;
  cursor: pointer;
}
.checkbox-text strong {
  display: block;
  font-size: 14.5px;
  color: #1e293b;
  margin-bottom: 2px;
}
.checkbox-text p {
  margin: 0;
  font-size: 12.5px;
  color: #64748b;
}

.pi-notes-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pi-notes-field label {
  font-size: 13.5px;
  font-weight: 750;
  color: #334155;
}
.pi-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
}

/* 하단 제출 바 */
.pi-submit-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
}
.btn-pi-cancel {
  display: inline-grid;
  place-items: center;
  min-height: 48px;
  padding: 0 20px;
  background: #f1f5f9;
  color: #475569 !important;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 750;
  text-decoration: none;
}
.btn-pi-cancel:hover {
  background: #e2e8f0;
}
.btn-pi-submit {
  min-height: 48px;
  padding: 0 28px;
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
  transition: background 0.15s, transform 0.1s;
}
.btn-pi-submit:hover {
  background: #047857;
  transform: translateY(-1px);
}

/* ==========================================================================
   매입 전표 (Purchase Invoices) 모바일 반응형 최적화
   ========================================================================== */
.pi-mobile-list {
  display: none;
}

@media (max-width: 680px) {
  /* 매입 전표 목록 툴바 및 액션 */
  .pi-action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .pi-action-bar .pi-search-form {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .pi-btn-group.desktop-only {
    display: none !important;
  }
  .pi-btn-group.mobile-only {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .pi-btn-group.mobile-only .btn-pi-manual {
    grid-column: 1 / -1;
  }
  .btn-pi-camera, .btn-pi-upload, .btn-pi-manual {
    width: 100%;
    justify-content: center;
    padding: 0 10px;
    font-size: 14px;
    min-height: 46px;
    box-sizing: border-box;
    text-align: center;
  }
  .month-selector-group {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
  }
  .month-selector-group .pi-date-input {
    flex: 1;
    min-width: 130px;
  }
  .month-selector-group .month-nav-btn {
    padding: 0 10px;
    min-height: 38px;
  }

  /* 데스크탑 테이블 숨김, 모바일 카드 뷰 노출 */
  .returns-table-wrap.desktop-only {
    display: none !important;
  }
  .pi-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .pi-mobile-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .pi-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
  }
  .pi-mobile-num {
    font-size: 13px;
    font-weight: 800;
    color: #059669;
  }
  .pi-mobile-supplier {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .pi-mobile-supplier strong {
    font-size: 16px;
    color: #1e293b;
  }
  .pi-mobile-items {
    font-size: 14px;
    color: #475569;
    line-height: 1.45;
  }
  .pi-mobile-amount {
    font-size: 19px;
    font-weight: 900;
    color: #059669;
    text-align: right;
    margin-top: 4px;
  }
  .pi-mobile-footer {
    display: flex;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
  }
  .pi-mobile-footer a {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    min-height: 42px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 750;
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
  }
  .btn-pi-thumb-view {
    background: #f8fafc;
    color: #334155 !important;
    border: 1px solid #cbd5e1;
    text-decoration: none;
  }

  /* 2분할 폼 화면 모바일 최적화 */
  .pi-form-wrapper {
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
  }
  .pi-split-workspace {
    flex-direction: column;
    gap: 16px;
  }
  .pi-receipt-column {
    width: 100%;
    height: 380px;
    min-height: auto;
    position: static;
  }
  .pi-top-info-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  /* 모바일 상단 접이식 뷰어 최적화 */
  .pi-receipt-toggle-header {
    padding: 10px 14px;
  }
  .pi-viewer-controls-bar {
    padding: 8px 10px;
  }
  .viewer-ctrl-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }
  .viewer-ctrl-group .btn-tool {
    padding: 6px 4px;
    font-size: 12px;
    text-align: center;
    min-height: 36px;
    display: grid;
    place-items: center;
  }
  .viewer-save-group {
    width: 100%;
    margin-top: 4px;
  }
  .viewer-save-group .btn-tool-save {
    width: 100%;
    padding: 10px 0;
    text-align: center;
    justify-content: center;
    display: flex;
    font-size: 14px;
  }
  .pi-viewer-interactive-body {
    height: 280px;
  }
  .pi-img-pan-wrapper img {
    max-height: 260px;
  }
  .pi-section-card {
    padding: 16px 14px;
  }
  .pi-card-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .btn-add-item-row {
    width: 100%;
    min-height: 44px;
    display: grid;
    place-items: center;
    font-size: 14.5px;
    font-weight: 800;
    border-radius: 9px;
  }

  /* 모바일 2단 스마트 카드 반응형 최적화 */
  .pi-item-row-card {
    padding: 12px 10px;
    gap: 10px;
    background: #f8fafc;
  }
  .item-card-row-top {
    grid-template-columns: auto 1fr auto;
    gap: 8px 10px;
  }
  .item-card-row-top .item-badge-wrap {
    grid-column: 1;
    grid-row: 1;
    padding-bottom: 0;
  }
  .item-card-row-top .item-del-wrap {
    grid-column: 3;
    grid-row: 1;
  }
  .item-card-row-top .field-raw-name {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .item-card-row-top .field-product-select {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .item-card-row-bottom {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .item-card-row-bottom .field-qty {
    grid-column: 1;
  }
  .item-card-row-bottom .field-unit {
    grid-column: 2;
  }
  .item-card-row-bottom .field-multiplier {
    grid-column: 1 / -1;
  }
  .item-card-row-bottom .field-price {
    grid-column: 1;
  }
  .item-card-row-bottom .field-total {
    grid-column: 2;
  }
  .item-field-wrap .pi-input,
  .item-field-wrap .pi-select {
    height: 42px;
    min-height: 42px;
    font-size: 15px;
  }

  /* 테이블을 모바일 전용 카드 리스트로 전면 변환 (가로 스크롤 제거) */
  .pi-table-responsive {
    overflow: visible !important;
    border: none !important;
    margin: 0 0 12px !important;
  }
  .pi-items-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .pi-items-table thead {
    display: none !important;
  }
  .pi-items-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    width: 100% !important;
  }
  .pi-items-table tr {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px 8px !important;
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    padding: 14px 12px !important;
    position: relative !important;
    box-sizing: border-box !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  }
  .pi-items-table td {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
    padding: 0 !important;
    border: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* No. 뱃지 */
  .pi-items-table td:nth-child(1) {
    grid-column: 1 !important;
    flex-direction: row !important;
    align-items: center !important;
    font-size: 14.5px !important;
    font-weight: 900 !important;
    color: #059669 !important;
    height: 32px !important;
  }
  .pi-items-table td:nth-child(1)::before {
    content: "품목 #";
  }

  /* 행 삭제 버튼 (9번째 td) */
  .pi-items-table td:nth-child(9) {
    grid-column: 2 !important;
    align-items: flex-end !important;
    justify-content: center !important;
    height: 32px !important;
  }
  .btn-row-del {
    width: auto !important;
    min-width: 68px !important;
    height: 32px !important;
    padding: 0 10px !important;
    font-size: 12.5px !important;
    border-radius: 7px !important;
  }
  .btn-row-del::after {
    content: " 삭제";
  }

  /* 영수증 표기 원문 */
  .pi-items-table td:nth-child(2) {
    grid-column: 1 / -1 !important;
  }
  .pi-items-table td:nth-child(2)::before {
    content: "영수증 표기 품목명 *";
    font-size: 12.5px;
    font-weight: 750;
    color: #334155;
  }

  /* 우리 상품 매칭 (카탈로그) */
  .pi-items-table td:nth-child(3) {
    grid-column: 1 / -1 !important;
  }
  .pi-items-table td:nth-child(3)::before {
    content: "우리 등록 상품 매칭 (카탈로그)";
    font-size: 12.5px;
    font-weight: 750;
    color: #334155;
  }

  /* 수량 */
  .pi-items-table td:nth-child(4) {
    grid-column: 1 !important;
  }
  .pi-items-table td:nth-child(4)::before {
    content: "영수증 수량";
    font-size: 12px;
    font-weight: 750;
    color: #475569;
  }

  /* 단위 */
  .pi-items-table td:nth-child(5) {
    grid-column: 2 !important;
  }
  .pi-items-table td:nth-child(5)::before {
    content: "영수증 단위";
    font-size: 12px;
    font-weight: 750;
    color: #475569;
  }

  /* 단위 환산 (입수량 배수) */
  .pi-items-table td:nth-child(6) {
    grid-column: 1 / -1 !important;
  }
  .pi-items-table td:nth-child(6)::before {
    content: "단위 환산 (1단위당 입수량/배수)";
    font-size: 12px;
    font-weight: 750;
    color: #059669;
  }

  /* 매입단가 */
  .pi-items-table td:nth-child(7) {
    grid-column: 1 !important;
  }
  .pi-items-table td:nth-child(7)::before {
    content: "매입단가 (원)";
    font-size: 12px;
    font-weight: 750;
    color: #475569;
  }

  /* 공급금액 */
  .pi-items-table td:nth-child(8) {
    grid-column: 2 !important;
  }
  .pi-items-table td:nth-child(8)::before {
    content: "공급금액 (원)";
    font-size: 12px;
    font-weight: 750;
    color: #475569;
  }
    font-weight: 750;
    color: #475569;
  }

  .pi-cell-input, .pi-cell-select {
    min-height: 44px;
    font-size: 15px;
    border-radius: 8px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    width: 100%;
    box-sizing: border-box;
  }

  /* 총 합계 바 */
  .pi-total-bar {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 10px;
    padding: 14px 16px !important;
    background: #f0fdf4 !important;
    border: 1.5px solid #86efac !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    margin-top: 10px !important;
  }
  .pi-total-label {
    font-size: 15px !important;
    font-weight: 800 !important;
    color: #166534 !important;
    white-space: nowrap;
  }
  .pi-total-amount {
    font-size: 21px !important;
    font-weight: 900 !important;
    color: #15803d !important;
    white-space: nowrap;
  }

  /* 하단 제출 바 */
  .pi-submit-bar {
    flex-direction: column-reverse;
    gap: 10px;
    padding-top: 6px;
  }
  .btn-pi-cancel, .btn-pi-submit {
    width: 100%;
    min-height: 50px;
    box-sizing: border-box;
    display: grid;
    place-items: center;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .pi-btn-group {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   매입 전표 고도화: 미등록 품목 뱃지, 빠른 품목 등록 모달, 부가세(VAT) 분할 계산
   ========================================================================== */
.product-match-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.badge-unmatched {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 800;
}
.btn-quick-reg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-quick-reg:hover {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
}

/* AI 엔진 정보 뱃지 */
.pi-engine-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
}

/* VAT 분할 합계 카드 */
.pi-total-breakdown-card {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pi-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  color: #475569;
}
.pi-sub-label {
  font-weight: 650;
}
.pi-sub-amount {
  font-weight: 800;
  font-family: monospace, sans-serif;
  font-size: 14.5px;
}
.text-vat {
  color: #d97706;
}

/* 신규 품목 빠른 등록 모달 팝업 */
.pi-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.pi-modal-content {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  animation: piModalFadeIn 0.18s ease-out;
}
@keyframes piModalFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.pi-modal-header {
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pi-modal-title {
  font-size: 16.5px;
  font-weight: 850;
  color: #0f172a;
}
.btn-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.btn-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.pi-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-notice {
  margin: 0;
  font-size: 12.5px;
  color: #64748b;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 6px;
}
.qp-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}
.qp-form-group label {
  font-size: 12.5px;
  font-weight: 750;
  color: #334155;
}
.qp-form-row {
  display: flex;
  gap: 12px;
}
.qp-hint {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}
.pi-modal-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-modal-cancel {
  padding: 9px 16px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 650;
  color: #475569;
  cursor: pointer;
}
.btn-modal-submit {
  padding: 9px 18px;
  background: #059669;
  border: 1px solid #047857;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn-modal-submit:hover {
  background: #047857;
}

/* ==========================================================================
   품목 일괄 저장 액션 바 (Catalog Batch Actions Bar)
   ========================================================================== */
.catalog-batch-actions-bar {
  position: sticky;
  bottom: 20px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  padding: 12px 20px;
  margin: 18px 0 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.catalog-batch-actions-bar.has-modifications {
  border-color: #10b981;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  box-shadow: 0 12px 28px -4px rgba(16, 185, 129, 0.25), 0 6px 12px -4px rgba(16, 185, 129, 0.15);
}

.batch-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.batch-status-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1;
}

.batch-bar-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.batch-bar-title {
  font-size: 14px;
  font-weight: 750;
  color: #1e293b;
}

.batch-bar-desc {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-bar-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 9999px;
  background: #dcfce7;
  color: #15803d;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  border: 1px solid #86efac;
  animation: pulse-soft 2s infinite;
}

.batch-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-batch-reset {
  padding: 9px 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 650;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-batch-reset:hover {
  background: #f1f5f9;
  color: #334155;
  border-color: #94a3b8;
}

.btn-batch-save {
  padding: 9px 20px;
  background: #059669;
  border: 1px solid #047857;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 5px rgba(5, 150, 105, 0.3);
  transition: all 0.15s ease;
}

.btn-batch-save:hover:not(:disabled) {
  background: #047857;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.4);
}

.btn-batch-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-batch-save.is-highlight {
  background: #059669;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25), 0 4px 12px rgba(5, 150, 105, 0.35);
}

/* 행 수정 하이라이트 */
.catalog-record.is-row-modified {
  background: #f0fdf4 !important;
  border-left: 4px solid #10b981 !important;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.catalog-record.is-row-modified input,
.catalog-record.is-row-modified select {
  border-color: #86efac !important;
  background-color: #ffffff !important;
}

/* 플로팅 토스트 알림 */
.batch-save-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 9999;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.batch-save-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.03); }
}

@media (max-width: 768px) {
  .catalog-batch-actions-bar {
    bottom: calc(72px + env(safe-area-inset-bottom));
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    border-radius: 12px;
  }
  .batch-bar-left {
    justify-content: space-between;
    width: 100%;
  }
  .batch-bar-right {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
  }
  .btn-batch-save {
    justify-content: center;
  }
}

/* ==========================================================================
   기본 마진 계산 설정 버튼 및 모달 (Default Margin Pricing Settings)
   ========================================================================== */
.catalog-create-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.catalog-create-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-default-margin-settings {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 9px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-default-margin-settings:hover {
  background: #ffffff;
  border-color: #059669;
  color: #059669;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.15);
}

.margin-active-badge {
  display: inline-block;
  background: #dcfce7;
  color: #15803d;
  font-size: 11.5px;
  font-weight: 750;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid #86efac;
  margin-left: 4px;
}

.field-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.calc-active-tag {
  font-size: 11px;
  font-weight: 750;
  padding: 1.5px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.calc-active-tag.is-auto {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.calc-active-tag.is-manual {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

/* WOH 모달 스타일 */
.woh-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.woh-modal-dialog {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-fade-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.default-margin-modal-dialog {
  max-width: 760px;
}

@keyframes modal-fade-up {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.woh-modal-header {
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.woh-modal-header .modal-title-box h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #1e293b;
}

.woh-modal-header .modal-kicker {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #059669;
  margin-bottom: 2px;
}

.woh-modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.woh-modal-close:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.woh-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(85vh - 130px);
  overflow-y: auto;
}

.modal-subtext {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
  margin: 0;
  background: #f0fdf4;
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 4px solid #059669;
}

.modal-rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.default-tax-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.field-section-title {
  font-size: 13px;
  font-weight: 750;
  color: #1e293b;
}

.woh-modal-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 680px) {
  .mobile-hide-desc {
    display: none !important;
  }
  .woh-modal-dialog {
    width: calc(100vw - 20px) !important;
    max-width: 480px !important;
    margin: 8px auto !important;
    max-height: 94dvh !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    overflow: hidden;
  }
  .woh-modal-dialog * {
    box-sizing: border-box;
  }
  .woh-modal-header {
    padding: 9px 12px;
  }
  .woh-modal-header h3 {
    font-size: 14px;
  }
  .woh-modal-close {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }
  .woh-modal-body {
    padding: 8px 10px;
    gap: 7px;
  }
  .modal-rules-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .calc-rule-card {
    padding: 6px 8px;
    border-radius: 8px;
  }
  .rule-card-header {
    margin-bottom: 5px;
    padding-bottom: 4px;
  }
  .rule-flow-badge {
    font-size: 10.5px;
    padding: 1px 5px;
  }
  .rule-toggle-switch .toggle-text {
    font-size: 10.5px;
  }
  .rule-card-body {
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }
  .rule-card-body .rule-field {
    min-width: 0;
  }
  .rule-card-body .rule-field:first-child {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #f8fafc;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
  }
  .rule-card-body .rule-field:first-child .rule-label {
    margin: 0;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 750;
    color: #1e293b;
  }
  .rule-card-body .rule-field:first-child .input-with-unit {
    width: 95px;
    flex-shrink: 0;
  }
  .rule-card-body .rule-field:first-child .input-with-unit input {
    height: 26px;
    font-size: 12px;
    padding: 0 18px 0 6px;
  }
  .rule-label {
    font-size: 10.5px;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .rule-field select,
  .input-with-unit input {
    height: 28px;
    font-size: 11.5px;
    padding: 0 4px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }
  .default-tax-box {
    padding: 5px 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    background: #f8fafc;
    border-radius: 8px;
  }
  .default-tax-box .field-section-title {
    font-size: 11px;
    margin: 0;
    white-space: nowrap;
  }
  .tax-segmented-control {
    display: flex;
    gap: 2px;
  }
  .tax-seg-btn {
    padding: 2px 7px;
    font-size: 11px;
    min-height: 26px;
    display: grid;
    place-items: center;
  }
  .batch-margin-box {
    padding: 5px 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    background: #f8fafc;
    border-radius: 8px;
  }
  .batch-margin-text strong {
    font-size: 11px;
    margin: 0;
    white-space: nowrap;
  }
  .btn-open-batch-confirm {
    padding: 4px 8px;
    font-size: 10.5px;
    height: 26px;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .woh-modal-footer {
    padding: 7px 10px;
    gap: 6px;
  }
  .btn-modal-cancel {
    height: 32px;
    font-size: 11.5px;
    padding: 0 10px;
  }
  .btn-modal-submit {
    height: 32px;
    font-size: 11.5px;
    padding: 0 12px;
    flex: 1;
  }
  /* 일괄 적용 확인 모달 모바일 컴팩트 */
  .batch-alert-callout {
    padding: 6px 8px;
    font-size: 11.5px;
  }
  .batch-alert-callout strong {
    font-size: 11.5px;
  }
  .batch-alert-sub {
    font-size: 10.5px;
    margin-top: 3px;
  }
  .batch-applying-rule-strip {
    padding: 5px 8px;
    font-size: 11px;
  }
  .batch-stat-grid {
    gap: 4px;
  }
  .batch-stat-card {
    padding: 5px 6px;
  }
  .batch-stat-card .stat-label {
    font-size: 10px;
  }
  .batch-stat-card .stat-val {
    font-size: 13px;
  }
  .batch-confirm-question {
    font-size: 11px;
    margin: 3px 0 0 0;
  }
  .batch-confirm-footer .btn-modal-danger-submit {
    height: 32px;
    font-size: 11.5px;
    padding: 0 10px;
  }
}

/* 기본 마진 일괄 적용 박스 & 경고 모달 */
.batch-margin-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.batch-margin-text strong {
  display: block;
  font-size: 13.5px;
  color: #1e293b;
  margin-bottom: 2px;
}

.batch-margin-text p {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.btn-open-batch-confirm {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-open-batch-confirm:hover {
  background: #fde68a;
  color: #78350f;
  transform: translateY(-1px);
}

.batch-confirm-dialog {
  max-width: 520px;
  border-top: 5px solid #ef4444;
}

.batch-confirm-header {
  background: #fef2f2;
}

.batch-confirm-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.batch-confirm-title-wrap h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #991b1b;
}

.batch-warn-icon {
  font-size: 20px;
}

.batch-alert-callout {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  padding: 14px;
}

.batch-alert-callout strong {
  display: block;
  font-size: 14px;
  color: #be123c;
  margin-bottom: 6px;
}

.batch-alert-callout p {
  margin: 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}

.batch-alert-callout .batch-alert-sub {
  margin-top: 6px;
  font-size: 12px;
  color: #e11d48;
  font-weight: 600;
}

.batch-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.batch-stat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.batch-stat-card.is-protected {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.batch-stat-card.is-target {
  background: #fef2f2;
  border-color: #fecdd3;
}

.batch-stat-card .stat-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.batch-stat-card .stat-val {
  font-size: 17px;
  font-weight: 800;
  color: #1e293b;
}

.batch-stat-card .text-success {
  color: #15803d;
}

.batch-stat-card .text-danger {
  color: #b91c1c;
}

.batch-confirm-question {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: #334155;
  text-align: center;
  padding: 4px 0;
}

.btn-modal-danger-submit {
  background: #dc2626;
  color: #ffffff;
  border: none;
  font-size: 13px;
  font-weight: 750;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-modal-danger-submit:hover:not(:disabled) {
  background: #b91c1c;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}

.btn-modal-danger-submit:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .batch-margin-box {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-open-batch-confirm {
    text-align: center;
  }
  .batch-stat-grid {
    grid-template-columns: 1fr;
  }
}

.batch-applying-rule-strip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.batch-applying-rule-strip .rule-strip-label {
  color: #64748b;
  font-weight: 600;
}

.batch-applying-rule-strip .rule-strip-val {
  color: #0f766e;
  font-weight: 750;
}

/* ==========================================================================
   규격 작성 가이드 물음표 버튼 & 모달 UI
   ========================================================================== */
.spec-guide-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  vertical-align: middle;
  transition: all 0.15s ease;
}

.spec-guide-help-btn:hover {
  background: #257650;
  color: #ffffff;
  border-color: #1f6f4a;
  transform: scale(1.1);
}

.spec-guide-help-btn.is-th {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}

.spec-guide-help-btn.is-sm {
  width: 15px;
  height: 15px;
  font-size: 10px;
}

.spec-guide-modal-dialog {
  max-width: 520px;
  border-top: 4px solid #059669;
}

.spec-guide-modal-body {
  gap: 12px;
  padding: 14px 16px;
}

/* 1. 단위 vs 규격 초간결 2열 카드 */
.guide-compact-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.guide-compact-col {
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guide-compact-col.is-unit {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

.guide-compact-col.is-spec {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.guide-col-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  width: fit-content;
}

.guide-compact-col.is-unit .guide-col-badge {
  background: #e0e7ff;
  color: #3730a3;
}

.guide-compact-col.is-spec .guide-col-badge {
  background: #d1fae5;
  color: #065f46;
}

.guide-col-desc {
  margin: 0;
  font-size: 12px;
  color: #334155;
  line-height: 1.35;
}

.guide-example-pill {
  font-size: 11px;
  color: #475569;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  padding: 3px 6px;
  margin-top: 2px;
  font-weight: 500;
}

/* 2 & 3. 컴팩트 카드 섹션 */
.guide-compact-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-card-heading {
  font-size: 12.5px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 5px;
}

.guide-formula-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.guide-formula-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.guide-formula-item .item-tag {
  font-size: 11px;
  font-weight: 750;
  color: #0369a1;
}

.guide-formula-item .item-formula code {
  display: block;
  font-size: 11px;
  color: #047857;
  font-weight: 750;
  background: #f1f5f9;
  padding: 2px 4px;
  border-radius: 4px;
}

.guide-formula-item .item-ex {
  font-size: 11px;
  color: #475569;
  line-height: 1.3;
}

/* 하이라이트 (다중 규격 팁) */
.guide-compact-card.is-highlight {
  background: #fffbeb;
  border: 1px solid #fde68a;
  gap: 6px;
}

.guide-card-header-line {
  display: flex;
  align-items: center;
  gap: 4px;
}

.guide-warn-symbol {
  font-size: 13px;
}

.guide-compact-card.is-highlight .guide-card-heading {
  color: #92400e;
}

.guide-caution-text {
  margin: 0;
  font-size: 12px;
  color: #78350f;
  line-height: 1.35;
}

.guide-caution-text code {
  color: #dc2626;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.1);
  padding: 1px 4px;
  border-radius: 3px;
}

.guide-mini-compare {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #ffffff;
  border: 1px solid #fef3c7;
  border-radius: 8px;
  padding: 7px 10px;
}

.mini-compare-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #334155;
}

.mini-compare-row .mini-prod {
  font-weight: 750;
  color: #0f172a;
  min-width: 85px;
}

.mini-compare-row .mini-spec {
  color: #047857;
  font-weight: 600;
}

.mini-compare-row .mini-unit {
  color: #4338ca;
  font-weight: 600;
}

.guide-bottom-tip {
  margin: 0;
  font-size: 11px;
  color: #b45309;
  line-height: 1.35;
}

/* ==========================================================================
   품목 관리: 모바일 초슬림 1행 리스트 뷰 & 터치 펼침 (Compact Mobile List View)
   ========================================================================== */
.mobile-item-summary-bar {
  display: none;
}

@media (max-width: 680px) {
  .catalog-column-head {
    display: none !important;
  }

  .catalog-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #e2e8e4;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
  }

  .catalog-record {
    padding: 0 !important;
    border-bottom: 1px solid #eef2ef !important;
    background: #ffffff;
    transition: background 0.15s ease;
  }

  .catalog-record:last-child {
    border-bottom: none !important;
  }

  /* 52px 초슬림 요약 행 */
  .mobile-item-summary-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    min-height: 52px;
    cursor: pointer;
    user-select: none;
    background: #ffffff;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-item-summary-bar:active {
    background: #f1f5f3;
  }

  .catalog-record.is-expanded .mobile-item-summary-bar {
    background: #f0fdf4;
    border-bottom: 1px solid #bbf7d0;
  }

  .m-summary-left {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 10px;
  }

  .m-summary-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .m-product-name {
    font-size: 14.5px;
    font-weight: 750;
    color: #172b1e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-tax-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .m-tax-badge.is-taxable { background: #eff6ff; color: #1d4ed8; }
  .m-tax-badge.is-exempt { background: #f0fdf4; color: #15803d; }
  .m-tax-badge.is-unset { background: #f1f5f9; color: #64748b; }

  .m-summary-spec-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-product-code {
    font-family: ui-monospace, monospace;
    font-size: 10.5px;
    color: #94a3b8;
  }

  .m-spec-unit {
    color: #475569;
    font-weight: 600;
  }

  .m-summary-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .m-price-box {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
  }

  .m-sale-price {
    font-size: 14.5px;
    font-weight: 800;
    color: #15803d;
    white-space: nowrap;
  }

  .m-cost-price {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
  }

  .m-expand-caret {
    font-size: 13px;
    color: #94a3b8;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .catalog-record.is-expanded .m-expand-caret {
    transform: rotate(180deg);
    color: #15803d;
  }

  /* 펼침 영역 */
  .catalog-record-collapsible {
    display: none;
    padding: 14px 12px;
    background: #fafdfb;
    border-top: 1px dashed #e2ede5;
    animation: expandRowAnim 0.18s ease-out;
  }

  .catalog-record.is-expanded .catalog-record-collapsible {
    display: block;
  }

  .catalog-record-collapsible .catalog-inline-edit {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 10px;
  }

  .catalog-record-collapsible .catalog-name {
    grid-column: 1 / -1 !important;
  }

  .catalog-record-collapsible .catalog-inline-edit > button {
    grid-column: auto;
    align-self: end;
    height: 42px;
  }
}

@keyframes expandRowAnim {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   초소형 모바일 (370px 이하) 전 페이지 반응형 전면 최적화
   ========================================================================== */
@media (max-width: 375px) {
  /* 탑바 */
  .topbar {
    padding: 12px 10px !important;
    gap: 6px !important;
  }
  .topbar h1 {
    font-size: 17px !important;
  }

  /* 하단 네비게이션 탭 글씨 겹침 방지 */
  .mobile-bottom-nav a,
  .mobile-bottom-nav-btn {
    padding: 2px 1px !important;
  }
  .mobile-bottom-nav a span,
  .mobile-bottom-nav-btn span {
    font-size: 17px !important;
  }
  .mobile-bottom-nav a small,
  .mobile-bottom-nav-btn small {
    font-size: 10px !important;
    transform: scale(0.95);
  }

  /* 품목 등록 폼 레이블/인풋 정돈 */
  .catalog-create {
    padding: 12px 10px !important;
  }
  .catalog-create-heading h2 {
    font-size: 17px !important;
  }
  .catalog-create-form-2row input,
  .catalog-create-form-2row select {
    height: 38px !important;
    font-size: 13px !important;
    padding: 0 8px !important;
  }
  .catalog-create-row-1 {
    gap: 6px !important;
  }
  .calc-active-tag {
    font-size: 9.5px !important;
    padding: 1px 4px !important;
  }

  /* 품목 슬림 요약 행 */
  .mobile-item-summary-bar {
    padding: 9px 10px !important;
  }
  .m-product-name {
    font-size: 13.5px !important;
  }
  .m-sale-price {
    font-size: 13.5px !important;
  }

  /* 주문 요약 통계 금액 줄바꿈 방지 */
  .orders-summary-item.amount-item strong {
    font-size: 11.5px !important;
    font-variant-numeric: tabular-nums;
  }

  /* 가이드 모달 (370px 이하) */
  .guide-formula-grid {
    grid-template-columns: 1fr !important;
  }
  .guide-compact-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px !important;
  }
  .guide-compact-col {
    padding: 8px 10px !important;
  }
  .guide-example-pill {
    font-size: 10px !important;
    padding: 2px 4px !important;
  }
  .mini-compare-row {
    flex-wrap: wrap;
    gap: 4px 8px !important;
  }

  /* 전 페이지 모바일 공통 초슬림 여백 & 다이얼로그 최적화 */
  .panel {
    padding: 12px 10px !important;
    margin-bottom: 10px !important;
  }
  .panel-head {
    margin-bottom: 8px !important;
  }
  .panel-head h2 {
    font-size: 16px !important;
  }
  .section-kicker {
    font-size: 10px !important;
    margin-bottom: 2px !important;
  }
  .partner-create-panel,
  .unit-create-panel {
    padding: 10px !important;
  }
  .partner-create-heading h2,
  .unit-create-heading h2 {
    font-size: 15px !important;
  }
  .orders-action-strip {
    padding: 8px 10px !important;
    gap: 6px !important;
  }
  .action-strip-title {
    font-size: 13px !important;
  }
  .batch-print-btn, .batch-print-all-btn {
    padding: 6px 10px !important;
    font-size: 11.5px !important;
  }
  dialog.link-product-dialog {
    width: calc(100vw - 20px) !important;
    max-width: 440px !important;
    padding: 12px 14px !important;
    border-radius: 12px !important;
  }
  dialog.link-product-dialog .link-product-select {
    font-size: 12px !important;
    max-height: 140px !important;
  }
}

/* 전체 주문표 빠른 조회 필터 (PC 더블클릭, 모바일 탭) */
.quick-filter-partner,
.quick-filter-product {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease, text-decoration 0.15s ease;
}

.quick-filter-partner:hover,
.quick-filter-product:hover,
.quick-filter-partner:hover strong,
.quick-filter-product:hover strong {
  color: #15803d !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 768px) {
  .quick-filter-partner:active,
  .quick-filter-product:active,
  .quick-filter-partner:active strong,
  .quick-filter-product:active strong {
    color: #16a34a !important;
    text-decoration: underline;
  }
}

/* 2단계: 거래처 단가 등급 & 품목 등급별 단가 관리 스타일 */
.partner-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.partner-grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 6px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.partner-grade-badge.grade-a {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.partner-grade-badge.grade-b {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.partner-grade-badge.grade-c {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

.partner-grade-badge.grade-d,
.partner-grade-badge.grade-e,
.partner-grade-badge.grade-f {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.partner-group-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

.partner-grade-select {
  height: 38px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid #cfdad3;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.partner-list-grade-select {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 6px;
  font-size: 11.5px;
  font-weight: 800;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  outline: none;
  transition: all 0.15s ease;
  font-family: inherit;
}

.partner-list-grade-select.grade-a {
  background: #dcfce7;
  color: #15803d;
  border-color: #bbf7d0;
}

.partner-list-grade-select.grade-b {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.partner-list-grade-select.grade-c {
  background: #f3e8ff;
  color: #7e22ce;
  border-color: #e9d5ff;
}

.partner-list-grade-select:hover {
  filter: brightness(0.96);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* 등록 폼 등급별 마진율 태그 */
.grade-margin-tag {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10.5px;
  font-weight: 800;
  border-radius: 4px;
  margin-left: 4px;
  letter-spacing: -0.02em;
}

.grade-margin-tag.profit {
  background: #dcfce7;
  color: #15803d;
}

.grade-margin-tag.loss {
  background: #fee2e2;
  color: #dc2626;
}

.grade-margin-tag.neutral {
  background: #f1f5f9;
  color: #64748b;
}

/* 품목 상세 등급별 단가 관리 그리드 */
.grade-prices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.grade-price-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grade-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: 8px;
}

.grade-card-header .grade-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: #1e293b;
}

.grade-card-header .grade-subtext {
  font-size: 11px;
  color: #64748b;
}

.grade-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grade-price-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.grade-price-field span {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
}

.grade-price-field input.grade-input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  font-size: 14.5px;
  font-weight: 750;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-sizing: border-box;
}

.catalog-sale-a-input {
  color: #15803d !important;
  border-color: #86efac !important;
  background-color: #f0fdf4 !important;
}
.catalog-sale-a-input:focus {
  outline: 2px solid #16a34a !important;
  border-color: #16a34a !important;
}

.catalog-sale-b-input {
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
  background-color: #eff6ff !important;
}
.catalog-sale-b-input:focus {
  outline: 2px solid #2563eb !important;
  border-color: #2563eb !important;
}
.catalog-sale-b-input::placeholder {
  color: #93c5fd;
  font-size: 12px;
  font-weight: normal;
}

.catalog-sale-c-input {
  color: #7e22ce !important;
  border-color: #d8b4fe !important;
  background-color: #faf5ff !important;
}
.catalog-sale-c-input:focus {
  outline: 2px solid #9333ea !important;
  border-color: #9333ea !important;
}
.catalog-sale-c-input::placeholder {
  color: #d8b4fe;
  font-size: 12px;
  font-weight: normal;
}

@media (max-width: 760px) {
  .grade-prices-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.grade-margin-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
  padding-top: 4px;
}

/* 등급별 마진 자동 계산 그룹 박스 (A등급 기본 / B, C... 차등 등급) */
.pricing-grade-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pricing-grade-group.group-a {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.pricing-grade-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.pricing-group-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pricing-group-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #1e293b;
}

.pricing-group-desc {
  font-size: 11.5px;
  color: #64748b;
}

.group-a .pricing-group-desc {
  color: #15803d;
}

.pricing-grade-group .calc-rule-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

@media (max-width: 680px) {
  .pricing-grade-group {
    padding: 10px;
    gap: 8px;
  }
  .pricing-group-desc {
    display: none;
  }
}

/* 전체 주문표 등급 및 판매가A/B/C UI 스타일 */
.sheet-partner-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sheet-price-grade {
  margin-right: 6px;
  font-size: 11.5px;
  font-weight: 850;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.mobile-grade-badge {
  margin-left: 4px;
  font-size: 10.5px;
  padding: 0 4px;
}
.mobile-price-grade {
  font-size: 10.5px;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  margin-left: 3px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.inline-grade-quick-picker {
  position: absolute;
  bottom: calc(100% + 4px);
  right: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  padding: 4px 6px;
  display: flex;
  gap: 4px;
  z-index: 1000;
  white-space: nowrap;
}
.grade-quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}
.grade-quick-chip:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}
.grade-quick-chip.grade-a {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #15803d;
}
.grade-quick-chip.grade-b {
  background: #dbeafe;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.grade-quick-chip.grade-c {
  background: #f3e8ff;
  border-color: #e9d5ff;
  color: #7e22ce;
}
.grade-quick-chip .chip-grade {
  font-weight: 800;
}
.grade-quick-chip .chip-price {
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0.9;
}

/* ==========================================================================
   재고 관리 우측 Split View 사이드 드로어 & 컴포넌트 정밀 디자인
   ========================================================================== */
body.has-inventory-drawer main {
  margin-right: 500px;
  transition: margin-right 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.inventory-side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 500px;
  height: 100vh;
  background: var(--canvas, #ffffff);
  border-left: 1px solid #cbd5e1;
  box-shadow: -6px 0 24px rgba(15, 23, 42, 0.08);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
}

.inventory-side-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.inventory-side-backdrop {
  display: none;
}

/* 헤더 */
.inventory-side-drawer .side-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.inventory-side-drawer .side-drawer-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.inventory-side-drawer .side-drawer-kicker {
  font-size: 11px;
  font-weight: 800;
  color: #059669;
  letter-spacing: 0.5px;
}

.inventory-side-drawer .side-drawer-title {
  font-size: 17px;
  font-weight: 850;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
}

.inventory-side-drawer .drawer-code-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  font-family: monospace;
}

.inventory-side-drawer .side-drawer-close {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.inventory-side-drawer .side-drawer-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* 본문 스크롤 영역 */
.inventory-side-drawer .inventory-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
}

.drawer-content-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

/* 로딩 스피너 */
.drawer-loading-box {
  padding: 40px 20px;
  text-align: center;
  color: #64748b;
}

.drawer-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #059669;
  border-radius: 50%;
  animation: drawerSpin 0.8s linear infinite;
  margin: 0 auto 12px auto;
}

@keyframes drawerSpin {
  to { transform: rotate(360deg); }
}

/* 1. 재고 현황 KPI 박스 */
.inventory-side-drawer .inventory-summary-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.summary-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px dashed #e2e8f0;
  margin-bottom: 12px;
}

.summary-qty-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-label {
  font-size: 11.5px;
  font-weight: 750;
  color: #64748b;
}

.summary-qty-num {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.summary-qty-num strong {
  font-size: 26px;
  font-weight: 900;
  color: #0f172a;
  line-height: 1;
}

.summary-unit {
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
}

.summary-status-box .stock-badge {
  font-size: 12.5px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
}

.summary-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.summary-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 12px;
}

.summary-cell .cell-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.summary-cell strong {
  font-size: 14px;
  font-weight: 850;
  color: #1e293b;
}

.summary-cell strong.text-green {
  color: #059669;
}

/* 2 & 3. 섹션 카드 */
.drawer-section-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.drawer-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.drawer-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 5px;
}

.drawer-badge.badge-green {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.drawer-badge.badge-slate {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.drawer-badge.badge-blue {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.drawer-card-header h4 {
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

/* 입고/출고/실사 라디오 탭 */
.adjust-type-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 9px;
}

.adjust-tab-label {
  cursor: pointer;
  text-align: center;
  margin: 0;
  display: block;
}

.adjust-tab-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.adjust-tab-label span {
  display: block;
  padding: 7px 4px;
  font-size: 12.5px;
  font-weight: 800;
  border-radius: 7px;
  color: #64748b;
  transition: all 0.15s ease;
  user-select: none;
}

.adjust-tab-label input:checked + span {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.adjust-tab-label.tab-in input:checked + span {
  color: #059669;
  font-weight: 850;
}

.adjust-tab-label.tab-out input:checked + span {
  color: #ef4444;
  font-weight: 850;
}

.adjust-tab-label.tab-set input:checked + span {
  color: #2563eb;
  font-weight: 850;
}

/* 폼 필드 그리드 */
.inventory-side-drawer .drawer-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.inventory-side-drawer .drawer-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inventory-side-drawer .drawer-field.field-full {
  grid-column: 1 / -1;
}

.inventory-side-drawer .drawer-field label {
  font-size: 11.5px;
  font-weight: 750;
  color: #475569;
}

.drawer-input {
  box-sizing: border-box;
  width: 100%;
  height: 38px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
  background: #ffffff;
  color: #1e293b;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.drawer-input:focus {
  border-color: #059669;
  outline: none;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15);
}

/* 수량 + 단위 인풋 그룹 */
.input-unit-group {
  display: flex;
  align-items: stretch;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  height: 38px;
}

.input-unit-group .drawer-input {
  border: none;
  border-radius: 0;
  flex: 1;
  min-width: 0;
  height: 100%;
}

.input-unit-group .drawer-input:focus {
  box-shadow: none;
}

.input-unit-group:focus-within {
  border-color: #059669;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15);
}

.input-unit-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  background: #f8fafc;
  border-left: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

/* 제출 버튼 */
.btn-drawer-submit {
  width: 100%;
  height: 40px;
  min-height: 40px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.btn-in-submit {
  background: #059669;
  color: #ffffff;
}

.btn-in-submit:hover {
  background: #047857;
}

.btn-out-submit {
  background: #ef4444;
  color: #ffffff;
}

.btn-out-submit:hover {
  background: #dc2626;
}

.btn-set-submit {
  background: #2563eb;
  color: #ffffff;
}

.btn-set-submit:hover {
  background: #1d4ed8;
}

.btn-save-settings {
  background: #334155;
  color: #ffffff;
}

.btn-save-settings:hover {
  background: #1e293b;
}

/* 최근 입출고 이력 테이블 */
.drawer-log-table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.drawer-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

.drawer-log-table th {
  background: #f8fafc;
  padding: 8px 6px;
  font-weight: 800;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11.5px;
  text-align: left;
}

.drawer-log-table td {
  padding: 7px 6px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

.drawer-log-table tr:last-child td {
  border-bottom: none;
}

.drawer-empty-hint {
  padding: 24px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  margin: 0;
}

/* 입출고 이력 태그 & 수량 스타일 */
.log-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.log-tag.tag-in {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.log-tag.tag-out {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.log-tag.tag-set {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.log-qty-plus {
  color: #059669 !important;
}
.log-qty-minus {
  color: #dc2626 !important;
}

/* 반응형 (1024px 이하) */
@media (max-width: 1024px) {
  body.has-inventory-drawer main {
    margin-right: 0 !important;
  }
  .inventory-side-drawer {
    width: 95vw;
    max-width: 480px;
    z-index: 1050;
    border-radius: 16px 0 0 16px;
  }
  body.has-inventory-drawer .inventory-side-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1040;
  }
}

/* 다크모드 대응 */
html[data-theme="dark"] .inventory-side-drawer {
  background: var(--canvas, #0f172a);
  border-color: var(--line, #334155);
}
html[data-theme="dark"] .inventory-side-drawer .side-drawer-header {
  background: var(--panel, #1e293b);
  border-color: var(--line, #334155);
}
html[data-theme="dark"] .inventory-side-drawer .side-drawer-title {
  color: #f8fafc;
}
html[data-theme="dark"] .inventory-side-drawer .side-drawer-close {
  background: var(--panel, #1e293b);
  border-color: var(--line, #334155);
  color: #f8fafc;
}
html[data-theme="dark"] .inventory-side-drawer .inventory-summary-card,
html[data-theme="dark"] .drawer-section-card {
  background: var(--panel, #1e293b);
  border-color: var(--line, #334155);
}
html[data-theme="dark"] .summary-cell {
  background: #0f172a;
  border-color: #334155;
}
html[data-theme="dark"] .summary-cell strong {
  color: #f8fafc;
}
html[data-theme="dark"] .drawer-card-header h4 {
  color: #f8fafc;
}
html[data-theme="dark"] .drawer-input {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}
html[data-theme="dark"] .input-unit-group {
  background: #0f172a;
  border-color: #334155;
}
html[data-theme="dark"] .input-unit-tag {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}
html[data-theme="dark"] .adjust-type-tabs {
  background: #0f172a;
}
html[data-theme="dark"] .adjust-tab-label input:checked + span {
  background: #1e293b;
}
html[data-theme="dark"] .drawer-log-table-wrap {
  background: var(--panel, #1e293b);
  border-color: #334155;
}
html[data-theme="dark"] .drawer-log-table th {
  background: #0f172a;
  color: #94a3b8;
  border-color: #334155;
}
html[data-theme="dark"] .drawer-log-table td {
  border-color: #334155;
  color: #e2e8f0;
}

/* ==========================================================================
   실사 재고 & 오차(차이) 분석 스타일
   ========================================================================== */
.inventory-table .counted-cell,
.inventory-sheet-table .counted-cell {
  background-color: #fdfbf7;
}
.inventory-table .counted-cell:hover,
.inventory-sheet-table .counted-cell:hover {
  background-color: #fef9ee !important;
  box-shadow: inset 0 0 0 1.5px #f59e0b;
}

.counted-qty-text {
  color: #b45309;
  font-weight: 850;
}

.diff-cell {
  white-space: nowrap;
}

.diff-action-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.diff-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  line-height: 1.2;
}

.badge-diff-zero {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-diff-minus {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.badge-diff-plus {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.btn-reconcile-mini {
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.15s ease;
}

.btn-reconcile-mini:hover {
  background: #047857;
  transform: scale(1.05);
}

.diff-none-text {
  color: #94a3b8;
  font-size: 13px;
}

/* 사이드 패널 실사/차이 요약 스타일 */
.counted-diff-summary-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.diff-tag-inline {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.drawer-reconcile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 10px 12px;
}

.reconcile-info-text {
  font-size: 12.5px;
  color: #065f46;
  font-weight: 750;
}

.reconcile-info-text strong {
  color: #047857;
  font-size: 13.5px;
}

.btn-drawer-reconcile {
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-drawer-reconcile:hover {
  background: #047857;
}

/* 다크모드 대응 */
html[data-theme="dark"] .inventory-table .counted-cell,
html[data-theme="dark"] .inventory-sheet-table .counted-cell {
  background-color: #1e2621;
}
html[data-theme="dark"] .counted-qty-text {
  color: #fcd34d;
}
html[data-theme="dark"] .drawer-reconcile-bar {
  background: #064e3b;
  border-color: #059669;
}
html[data-theme="dark"] .reconcile-info-text {
  color: #a7f3d0;
}
html[data-theme="dark"] .reconcile-info-text strong {
  color: #ffffff;
}

/* ==========================================================================
   지출 관리 (Expenses) Split View 사이드 패널 & 지출 장부 대시보드 UI
   ========================================================================== */

/* Split View: 사이드 드로어가 열릴 때 메인 화면 축소 (520px) */
body.has-expense-drawer main {
  margin-right: 520px;
  transition: margin-right 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.expense-page-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* 1. 상단 툴바 */
.expense-top-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #ffffff;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.toolbar-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toolbar-heading-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-main-title {
  margin: 0;
  font-size: 20px;
  font-weight: 850;
  color: #0f172a;
  letter-spacing: -0.3px;
}

.toolbar-date-badge {
  display: inline-block;
  background: #f1f5f9;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
}

.toolbar-subtitle {
  margin: 0;
  font-size: 13.5px;
  color: #64748b;
}

.toolbar-subtitle strong {
  color: #0f172a;
}

.toolbar-actions-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* 월 네비게이션 */
.month-nav-box {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 2px 4px;
  gap: 2px;
}

.month-arrow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #475569;
  text-decoration: none;
  border-radius: 6px;
  font-size: 11px;
  transition: all 0.15s ease;
}

.month-arrow-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.month-select-form input[type="month"] {
  height: 28px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  padding: 0 4px;
  cursor: pointer;
}

.month-select-form input[type="month"]:focus {
  outline: none;
}

.month-today-btn {
  font-size: 11.5px;
  font-weight: 700;
  color: #2563eb;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 5px;
  background: #eff6ff;
  transition: all 0.15s ease;
}

.month-today-btn:hover {
  background: #dbeafe;
}

/* 툴바 트리거 버튼들 */
.toolbar-drawer-triggers {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-drawer-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.16s ease;
  border: 1px solid transparent;
  position: relative;
}

.btn-drawer-action .btn-icon {
  font-size: 13px;
}

.btn-add-expense {
  background: #1e7e48;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(30, 126, 72, 0.25);
}

.btn-add-expense:hover {
  background: #166534;
  box-shadow: 0 2px 6px rgba(30, 126, 72, 0.35);
}

.btn-fixed-manage {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.btn-fixed-manage:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.alert-badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e11d48;
  color: #ffffff;
  font-size: 11px;
  font-weight: 850;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  line-height: 1;
}

.btn-analytics {
  background: #f8fafc;
  color: #475569;
  border-color: #e2e8f0;
}

.btn-analytics:hover {
  background: #f1f5f9;
  color: #1e293b;
}

/* 되돌리기 알림 */
.expense-restore-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  font-size: 13px;
}

.btn-restore {
  padding: 4px 10px;
  font-size: 12px;
  background: #ffffff;
  border: 1px solid #f87171;
  color: #b91c1c;
  border-radius: 5px;
  cursor: pointer;
}

/* 2. KPI 요약 카드 그리드 */
.expense-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.expense-kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.expense-kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.kpi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #64748b;
}

.kpi-icon {
  font-size: 16px;
}

.kpi-card-value {
  margin-bottom: 6px;
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.kpi-card-value strong {
  font-size: 21px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.kpi-unit {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

.kpi-card-footer {
  font-size: 11.5px;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-card-footer strong {
  color: #1e293b;
}

.kpi-sub-percent {
  color: #94a3b8;
  font-weight: 600;
}

.kpi-unapplied.has-unapplied {
  background: #fffbeb;
  border-color: #fde68a;
}

.kpi-unapplied .text-unapplied {
  color: #d97706;
}

.unapplied-amount {
  font-size: 11.5px;
  font-weight: 600;
  color: #b45309;
  margin-left: 4px;
}

.text-applied-ok {
  color: #16a34a;
}

.btn-kpi-apply {
  background: #d97706;
  color: #ffffff;
  border: none;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-kpi-apply:hover {
  background: #b45309;
}

.text-all-applied {
  color: #16a34a;
  font-weight: 700;
  font-size: 11px;
}

/* 3. 스마트 미반영 알림 배너 */
.expense-smart-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 12px 18px;
  gap: 16px;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.08);
}

.alert-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-icon {
  font-size: 20px;
}

.alert-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.alert-text strong {
  font-size: 13.5px;
  color: #92400e;
}

.alert-sub {
  font-size: 12px;
  color: #b45309;
}

.alert-sub strong {
  color: #78350f;
}

.alert-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-banner-apply {
  background: #d97706;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.btn-banner-apply:hover {
  background: #b45309;
}

.btn-banner-manage {
  background: #ffffff;
  color: #78350f;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-banner-manage:hover {
  background: #fef3c7;
}

/* 4. 메인 지출 장부 (스프레드시트 뷰) */
.expense-ledger-panel {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

.ledger-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  flex-wrap: wrap;
  gap: 12px;
}

.ledger-title-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ledger-title {
  margin: 0;
  font-size: 16px;
  font-weight: 850;
  color: #0f172a;
}

.ledger-count-badge {
  background: #e2e8f0;
  color: #334155;
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
}

.ledger-filter-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ledger-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.ledger-search-box .search-icon {
  position: absolute;
  left: 10px;
  font-size: 12px;
  color: #94a3b8;
  pointer-events: none;
}

.ledger-search-box input {
  height: 34px;
  padding-left: 30px;
  padding-right: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
  width: 180px;
  transition: all 0.15s ease;
}

.ledger-search-box input:focus {
  border-color: #2563eb;
  width: 220px;
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.ledger-select-filter {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  background-color: #ffffff;
  cursor: pointer;
}

.ledger-table-wrap {
  overflow-x: auto;
  min-height: 240px;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.ledger-table thead th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
  padding: 10px 14px;
  border-bottom: 1.5px solid #cbd5e1;
  white-space: nowrap;
  font-size: 12.5px;
}

.ledger-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
  color: #1e293b;
  background: #ffffff;
  transition: background-color 0.12s ease;
}

.expense-row-item {
  cursor: pointer;
}

.expense-row-item:hover td {
  background-color: #f8fafc;
}

.expense-row-item.is-active-row td {
  background-color: #eff6ff !important;
  border-bottom-color: #bfdbfe;
}

/* 테이블 컬럼 너비 및 스타일 */
.col-exp-date {
  width: 110px;
  white-space: nowrap;
}

.date-text {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.col-exp-type {
  width: 85px;
  white-space: nowrap;
}

.exp-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.exp-badge.badge-fixed {
  background: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.exp-badge.badge-variable {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.col-exp-cat {
  width: 140px;
}

.cat-text {
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
}

.col-exp-desc {
  max-width: 320px;
}

.desc-text {
  color: #64748b;
  font-size: 12.5px;
  word-break: break-word;
}

.col-exp-amount {
  width: 140px;
  text-align: right;
  white-space: nowrap;
}

.amount-text {
  font-size: 14.5px;
  font-weight: 850;
  color: #0f172a;
  letter-spacing: -0.3px;
}

.col-exp-action {
  width: 120px;
  text-align: right;
  white-space: nowrap;
}

.row-action-btns {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-row-edit {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 750;
  background: #f1f5f9;
  color: #2563eb;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-row-edit:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.inline-del-form {
  display: inline;
  margin: 0;
}

.btn-row-del {
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  color: #94a3b8;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-row-del:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fecaca;
}

/* 빈 상태 */
.ledger-empty-row td {
  padding: 48px 20px;
  text-align: center;
  background: #fafafa;
}

.ledger-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ledger-empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: 4px;
}

.ledger-empty-state p {
  margin: 0;
  color: #334155;
  font-size: 14.5px;
}

.ledger-empty-state .empty-sub {
  font-size: 13px;
  color: #64748b;
}

.empty-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-empty-add {
  background: #1e7e48;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.btn-empty-fixed {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.ledger-no-result {
  padding: 28px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}

/* ==========================================================================
   우측 사이드 패널 (Drawer) 스타일 (PC 520px Split Workspace)
   ========================================================================== */
.expense-side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  height: 100vh;
  background: #ffffff;
  border-left: 1.5px solid #d2e2d8;
  box-shadow: -8px 0 32px rgba(18, 48, 30, 0.12);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
}

.expense-side-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

/* 데스크톱에서는 백드롭 미표시 (좌측 화면 자유 조작) */
.expense-side-backdrop {
  display: none;
}

/* 드로어 헤더 */
.expense-side-drawer .side-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: #ffffff;
  border-bottom: 1.5px solid #e2e8f0;
  flex-shrink: 0;
}

.expense-side-drawer .side-drawer-kicker {
  font-size: 11.5px;
  font-weight: 850;
  color: #1e7e48;
  letter-spacing: 0.5px;
}

.expense-side-drawer .side-drawer-title {
  font-size: 18px;
  font-weight: 850;
  color: #0f172a;
  margin: 2px 0 0 0;
}

.expense-side-drawer .side-drawer-close {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  font-size: 15px;
  transition: all 0.15s ease;
}

.expense-side-drawer .side-drawer-close:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fecaca;
}

/* 세그먼트 알약형 탭 네비게이션 (거래처 관리와 통일된 디자인) */
.expense-side-drawer .drawer-mode-nav {
  display: flex;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin: 16px 20px 0 20px;
  flex-shrink: 0;
}

.expense-side-drawer .drawer-mode-btn {
  flex: 1;
  height: 38px;
  padding: 0 8px;
  background: transparent;
  border: none;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 800;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.expense-side-drawer .drawer-mode-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.expense-side-drawer .drawer-mode-btn.active {
  background: #ffffff;
  color: #1e7e48;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 850;
}

.expense-side-drawer .drawer-badge-count {
  background: #e11d48;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 10px;
  line-height: 1;
}

/* 본문 스크롤 영역 */
.expense-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px 40px 22px;
  background: #ffffff;
}

.drawer-tab-pane {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.drawer-tab-pane.active {
  display: flex;
}

/* 탭 1: 지출 등록/수정 폼 */
.form-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: 10px;
  padding: 12px 16px;
}

.form-mode-banner.is-edit-mode {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.mode-text-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-icon {
  font-size: 16px;
}

.mode-label {
  font-size: 14px;
  font-weight: 850;
  color: #166534;
}

.form-mode-banner.is-edit-mode .mode-label {
  color: #1e40af;
}

.btn-reset-mode {
  background: #ffffff;
  border: 1px solid #93c5fd;
  color: #2563eb;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-reset-mode:hover {
  background: #eff6ff;
}

.drawer-expense-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-form-group label {
  font-size: 13.5px;
  font-weight: 750;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 4px;
}

.drawer-label-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-label-between label {
  font-size: 13.5px;
  font-weight: 750;
  color: #334155;
}

.req-star {
  color: #ef4444;
}

.drawer-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14.5px;
  color: #0f172a;
  background: #ffffff;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.drawer-input:focus {
  border-color: #10b981;
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.drawer-textarea {
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  color: #0f172a;
  resize: vertical;
  background: #ffffff;
  line-height: 1.45;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.drawer-textarea:focus {
  border-color: #10b981;
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* 카테고리 칩 (24인치 모니터 가독성 13px+) */
.quick-category-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.chip-label {
  font-size: 13px;
  color: #64748b;
  font-weight: 750;
}

.quick-cat-chip {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  color: #334155;
  border-radius: 8px;
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all 0.12s ease;
}

.quick-cat-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

.amount-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.amount-input-wrap input.amount-input {
  width: 100%;
  padding-right: 36px;
  font-weight: 850;
  font-size: 17px;
  letter-spacing: 0.5px;
  text-align: right;
  color: #047857;
}

.amount-input-wrap .unit-text {
  position: absolute;
  right: 14px;
  font-size: 14px;
  font-weight: 750;
  color: #64748b;
  pointer-events: none;
}

/* 빠른 금액 증감 칩 */
.quick-amount-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.quick-amt-chip {
  flex: 1;
  height: 34px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.12s ease;
}

.quick-amt-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.quick-amt-chip.reset {
  flex: 0.8;
  color: #e11d48;
  background: #fff1f2;
  border-color: #fecdd3;
}

.quick-amt-chip.reset:hover {
  color: #be123c;
  background: #ffe4e6;
  border-color: #fda4af;
}

.btn-drawer-primary {
  width: 100%;
  height: 46px;
  background: #10b981;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 850;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 6px;
}

.btn-drawer-primary:hover {
  background: #059669;
}

.drawer-delete-wrap {
  margin-top: 10px;
}

.drawer-divider {
  border: none;
  border-top: 1px dashed #e2e8f0;
  margin: 16px 0;
}

.btn-drawer-delete {
  width: 100%;
  height: 42px;
  background: #fff1f2;
  color: #e11d48;
  border: 1.5px solid #fecdd3;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-drawer-delete:hover {
  background: #ffe4e6;
  color: #be123c;
  border-color: #fda4af;
}

/* 탭 2: 고정비 관리 패널 */
.fixed-pane-intro {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pane-help-text {
  margin: 0;
  font-size: 13.5px;
  color: #475569;
  line-height: 1.5;
}

.pane-help-text strong {
  color: #1e293b;
}

.btn-fixed-apply-all {
  width: 100%;
  background: #d97706;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-fixed-apply-all:hover {
  background: #b45309;
}

.fixed-create-disclosure {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
}

.fixed-create-summary {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 850;
  color: #1e7e48;
  cursor: pointer;
  user-select: none;
}

.fixed-create-summary:hover {
  background: #f1f5f9;
}

.fixed-create-form-body {
  padding: 16px 18px 18px 18px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #ffffff;
}

.fixed-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fixed-field-group label {
  font-size: 13.5px;
  font-weight: 750;
  color: #334155;
}

.fixed-field-row {
  display: flex;
  gap: 12px;
}

.fixed-field-row .col-day {
  width: 160px;
}

.fixed-field-row .col-amt {
  flex: 1;
}

.day-input-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: #475569;
  font-weight: 750;
}

.drawer-input-inline {
  width: 64px;
  height: 42px;
  text-align: center;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 850;
}

.btn-fixed-create-submit {
  width: 100%;
  height: 44px;
  background: #10b981;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 850;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s ease;
}

.btn-fixed-create-submit:hover {
  background: #059669;
}

.fixed-items-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fixed-list-title {
  margin: 8px 0 2px 0;
  font-size: 14.5px;
  font-weight: 850;
  color: #0f172a;
}

.fixed-item-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.15s ease;
}

.fixed-item-card.is-unapplied {
  border-color: #fde68a;
  background: #fffdf7;
}

.fixed-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fixed-info-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fixed-day-chip {
  background: #e2e8f0;
  color: #334155;
  font-size: 12.5px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
}

.fixed-cat-name {
  font-size: 15px;
  font-weight: 850;
  color: #0f172a;
}

.fixed-status-pill.applied {
  font-size: 12.5px;
  font-weight: 800;
  color: #16a34a;
  background: #dcfce7;
  padding: 4px 10px;
  border-radius: 12px;
}

.btn-single-apply {
  background: #d97706;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.12s ease;
}

.btn-single-apply:hover {
  background: #b45309;
}

.fixed-card-desc {
  font-size: 13px;
  color: #64748b;
}

.fixed-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
  gap: 10px;
}

.fixed-inline-amount-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  flex: 1;
}

.price-label {
  font-size: 13px;
  color: #475569;
  font-weight: 750;
  white-space: nowrap;
}

.fixed-price-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fixed-price-input {
  width: 110px;
  height: 36px;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 14px;
  font-weight: 850;
  text-align: right;
  color: #0f172a;
}

.fixed-price-input:focus {
  border-color: #10b981;
  outline: none;
}

.unit-won {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}

.btn-fixed-price-save {
  height: 36px;
  padding: 0 12px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-fixed-price-save:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-fixed-card-del {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
}

.btn-fixed-card-del:hover {
  background: #fee2e2;
  color: #ef4444;
}

.fixed-empty-state {
  text-align: center;
  padding: 30px 18px;
  background: #f8fafc;
  border-radius: 12px;
  color: #64748b;
  font-size: 13.5px;
}

/* 탭 3: 지출 분석 패널 */
.analytics-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.analytics-section-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.analytics-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 850;
  color: #0f172a;
}

.type-ratio-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.type-ratio-bar {
  display: flex;
  height: 18px;
  border-radius: 9px;
  overflow: hidden;
  background: #f1f5f9;
}

.ratio-bar-fixed {
  background: #8b5cf6;
  transition: width 0.3s ease;
}

.ratio-bar-variable {
  background: #3b82f6;
  transition: width 0.3s ease;
}

.type-ratio-legend {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 700;
  color: #475569;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot-fixed {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8b5cf6;
}

.dot-variable {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3b82f6;
}

.category-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-item-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cat-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.cat-name {
  color: #1e293b;
  font-weight: 800;
}

.cat-val-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cat-amount {
  color: #0f172a;
  font-weight: 850;
  font-size: 14.5px;
}

.cat-pct {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.cat-progress-track {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}

.cat-progress-fill {
  height: 100%;
  background: #10b981;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.analytics-tip-card {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.tip-icon {
  font-size: 20px;
  line-height: 1.2;
}

.tip-text strong {
  font-size: 13.5px;
  font-weight: 850;
  color: #166534;
  display: block;
}

.tip-text p {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: #15803d;
  line-height: 1.5;
}

/* ==========================================================================
   반응형 (1024px 이하 모바일 & 태블릿)
   ========================================================================== */
@media (max-width: 1024px) {
  body.has-expense-drawer main {
    margin-right: 0;
  }

  .expense-side-drawer {
    width: 100%;
    max-width: 440px;
  }

  .expense-side-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 999;
  }

  body.has-expense-drawer .expense-side-backdrop {
    display: block;
  }

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

@media (max-width: 640px) {
  .expense-top-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .month-nav-box {
    justify-content: center;
  }

  .toolbar-drawer-triggers {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .btn-analytics {
    grid-column: span 2;
  }

  .expense-kpi-grid {
    grid-template-columns: 1fr;
  }

  .expense-smart-alert {
    flex-direction: column;
    align-items: stretch;
  }

  .alert-right {
    justify-content: stretch;
  }

  .alert-right form {
    flex: 1;
  }

  .btn-banner-apply {
    width: 100%;
  }

  .ledger-header-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .ledger-filter-area {
    flex-direction: column;
  }

  .ledger-search-box input {
    width: 100%;
  }

  .ledger-search-box input:focus {
    width: 100%;
  }

  .expense-side-drawer {
    max-width: 100%;
  }
}

/* ================= 마이너스 주문 및 차감 거래 스타일 ================= */
.sheet-row-negative,
tr.row-negative-item {
  background-color: #fff8f8 !important;
}
tr.row-negative-item:hover {
  background-color: #fee2e2 !important;
}
.editable-cell.is-negative-qty,
.quantity.is-negative-qty,
.is-negative-qty {
  color: #dc2626 !important;
  font-weight: 800 !important;
}
.line-total-val.is-negative-total,
.is-negative-total {
  color: #dc2626 !important;
  font-weight: 800 !important;
}
.negative-qty-tag {
  display: inline-block;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 800;
  color: #dc2626;
  background-color: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: middle;
  line-height: 1.2;
}
.negative-num {
  color: #dc2626;
  font-weight: 800;
}

/* ================= 주문 품목 직접 추가 모달 스타일 ================= */
.btn-sm-add-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: #15543a;
  background-color: #e5f4eb;
  border: 1px solid #b8e2c8;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-sm-add-item:hover {
  background-color: #1f6f4a;
  color: #ffffff;
  border-color: #1f6f4a;
}
.add-item-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
  width: 90%;
  max-width: 480px;
  margin: auto;
}
.add-item-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.add-item-modal-inner {
  padding: 24px;
}
.add-item-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.add-item-modal-header h3 {
  margin: 0;
  font-size: 17px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.add-item-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.add-item-modal-close:hover {
  background: #f1f5f9;
  color: var(--ink);
}
.add-item-form-group {
  margin-bottom: 14px;
}
.add-item-form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 5px;
}
.add-item-form-group input,
.add-item-form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}
.add-item-form-group input:focus,
.add-item-form-group select:focus {
  border-color: var(--green);
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 111, 74, 0.15);
}
.add-item-tip {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 4px;
  line-height: 1.4;
}
.add-item-tip strong {
  color: #dc2626;
}
.add-item-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

@keyframes kpiHighlightPulse {
  0% { transform: scale(1); }
  25% { transform: scale(1.12); color: #16a34a !important; text-shadow: 0 0 10px rgba(22, 163, 74, 0.25); }
  100% { transform: scale(1); }
}
.kpi-pulse {
  display: inline-block;
  animation: kpiHighlightPulse 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   거래처 관리 전폭 메인 목록 & 독립 사이드 드로어 (Full-Width Main & Independent Side Drawer)
   ========================================================================== */
.partner-split-workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.partner-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 18px;
  background: var(--bg-panel, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.partner-toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.partner-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.partner-title-group h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 850;
  color: var(--text, #0f172a);
}

.partner-badge-total {
  font-size: 13px;
  color: #1e293b;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.partner-grade-summary {
  display: flex;
  gap: 6px;
  align-items: center;
}

.grade-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.grade-pill.grade-a { background: #e0e7ff; color: #3730a3; }
.grade-pill.grade-b { background: #dbeafe; color: #1e40af; }
.grade-pill.grade-c { background: #fef3c7; color: #92400e; }

.partner-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.partner-toolbar-right button,
.partner-toolbar-right a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13.5px;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}

/* [메인 패널: 전체 너비 시원한 거래처 목록] */
.partner-main-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-panel, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  min-height: 600px;
  width: 100%;
  box-sizing: border-box;
}

.partner-search-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.partner-search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 280px;
}

.partner-search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.partner-search-input,
.partner-search-box input.partner-search-input,
input.partner-search-input {
  width: 100% !important;
  height: 42px !important;
  min-height: 42px !important;
  padding-left: 38px !important;
  padding-right: 36px !important;
  font-size: 14px !important;
  border: 1.5px solid var(--border, #cbd5e1) !important;
  border-radius: 9px !important;
  background: var(--bg-canvas, #f8fafc) !important;
  transition: border-color 0.15s, background 0.15s !important;
  box-sizing: border-box !important;
}

.partner-search-input:focus,
.partner-search-box input.partner-search-input:focus {
  border-color: #1f6f4a !important;
  background: #ffffff !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(31, 111, 74, 0.12) !important;
}

.search-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 18px;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
  z-index: 2;
}

/* 탭 필터 */
.partner-filter-tabs {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
  overflow-x: auto;
}

.filter-tab {
  background: none;
  border: none;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-tab:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text, #1e293b);
}

.filter-tab.active {
  background: #ffffff;
  color: #1f6f4a;
  font-weight: 850;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* 보기 모드 전환 버튼 그룹 (1줄씩 보기 / 카드로 보기) */
.partner-view-toggle-group {
  display: inline-flex;
  gap: 3px;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  margin-left: auto;
}

.view-toggle-btn {
  background: none;
  border: none;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.view-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text, #1e293b);
}

.view-toggle-btn.active {
  background: #ffffff;
  color: #1f6f4a;
  font-weight: 850;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.view-toggle-btn svg {
  flex-shrink: 0;
}

/* 1줄씩 보기 모드 전용 테이블 헤더 (선택 체크박스 + 7개 열 정렬) */
.partner-list-table-header {
  display: grid;
  grid-template-columns: 36px 40px minmax(140px, 1.3fr) 80px 115px minmax(220px, 2fr) minmax(130px, 1.4fr) minmax(110px, 1fr);
  gap: 10px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 850;
  color: #334155;
  align-items: center;
  margin-bottom: 4px;
}

.partner-list-table-header .col-head-chk,
.partner-list-table-header .col-head-no {
  text-align: center;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   거래처 목록 컨테이너 (1줄씩 보기: view-mode-list / 카드로 보기: view-mode-card)
   ========================================================================== */
.partner-card-list {
  max-height: calc(100vh - 250px);
  min-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

/* --------------------------------------------------------------------------
   [1] 1줄씩 보기 모드 (view-mode-list - 기본값, 8열 테이블 행 레이아웃)
   -------------------------------------------------------------------------- */
.partner-card-list.view-mode-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.partner-card-list.view-mode-list .partner-card-item {
  display: grid;
  grid-template-columns: 36px 40px minmax(140px, 1.3fr) 80px 115px minmax(220px, 2fr) minmax(130px, 1.4fr) minmax(110px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  min-height: 52px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.partner-card-list.view-mode-list .partner-card-item:hover {
  border-color: #21764e;
  background: #f9fcfb;
  box-shadow: 0 2px 8px rgba(33, 118, 78, 0.08);
}

.partner-card-list.view-mode-list .partner-card-item.active {
  border-color: #21764e;
  background: #f2f9f5;
  box-shadow: 0 2px 10px rgba(33, 118, 78, 0.12);
  border-left: 4px solid #21764e;
}

.partner-card-list.view-mode-list .card-only-sub {
  display: none !important;
}

.partner-card-list.view-mode-list .list-only-col {
  display: flex !important;
  align-items: center;
}

.partner-col-no {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: #64748b;
  display: flex;
  justify-content: center;
}

.partner-idx-num {
  font-variant-numeric: tabular-nums;
}

.partner-name-text {
  font-size: 14.5px;
  font-weight: 850;
  color: #0f172a;
}

.partner-grade-badge {
  font-size: 11.5px;
  font-weight: 850;
  padding: 2px 7px;
  border-radius: 4px;
}

.cell-val {
  font-size: 13.5px;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-bizno {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: #475569;
  letter-spacing: -0.02em;
}

.partner-col-phones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.phone-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: #eef5f1;
  border: 1px solid #d0e4d7;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
  color: #1a422d;
  white-space: nowrap;
}

.phone-chip .phone-icon {
  font-size: 12px;
}

.phone-chip .phone-digits {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.phone-chip .phone-lbl {
  font-size: 11px;
  font-weight: 800;
  color: #166534;
  background: #ffffff;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid #c7ded0;
}

.phone-empty-val {
  color: #94a3b8;
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   [2] 카드로 보기 모드 (view-mode-card)
   -------------------------------------------------------------------------- */
.partner-card-list.view-mode-card {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  align-content: start;
}

.partner-card-list.view-mode-card .list-only-col {
  display: none !important;
}

.partner-card-list.view-mode-card .card-only-sub {
  display: flex !important;
}

.partner-card-list.view-mode-card .partner-card-item {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  gap: 8px;
}

.partner-card-list.view-mode-card .partner-card-item:hover {
  border-color: #21764e;
  box-shadow: 0 4px 14px rgba(33, 118, 78, 0.1);
  transform: translateY(-1px);
}

.partner-card-list.view-mode-card .partner-card-item.active {
  border-color: #21764e;
  background: #f5fbf7;
  box-shadow: 0 4px 16px rgba(33, 118, 78, 0.16);
}

.partner-card-list.view-mode-card .partner-card-item.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: -1px;
  bottom: -1px;
  width: 5px;
  background: #1f6f4a;
  border-top-left-radius: 9px;
  border-bottom-left-radius: 9px;
}

.partner-card-list.view-mode-card .partner-col-address,
.partner-card-list.view-mode-card .partner-col-notes {
  padding-top: 6px;
  border-top: 1px dashed var(--border, #f1f5f9);
}

/* --------------------------------------------------------------------------
   공통 카드/행 내부 구성 요소
   -------------------------------------------------------------------------- */
.partner-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* 순번 넘버링 배지 (숫자로 명확하게 표기) */
.partner-idx-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 5px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 800;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.col-head-no {
  display: inline-block;
  min-width: 26px;
  color: #64748b;
  font-weight: 850;
  margin-right: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.partner-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.partner-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #e2f0e6;
  color: #1f6f4a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 850;
  flex-shrink: 0;
}

.partner-card-main {
  flex: 1;
  min-width: 0;
}

.partner-card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.partner-card-name {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text, #0f172a);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.partner-grade-badge.grade-a { background: #e0e7ff; color: #3730a3; }
.partner-grade-badge.grade-b { background: #dbeafe; color: #1e40af; }
.partner-grade-badge.grade-c { background: #fef3c7; color: #92400e; }

.partner-card-sub {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-top: 3px;
  flex-wrap: wrap;
}

.partner-card-phones {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.partner-phone-chip {
  font-size: 11.5px;
  font-weight: 600;
  color: #1e293b;
  background: #f1f5f9;
  padding: 2.5px 7px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.partner-phone-chip small {
  color: #64748b;
}

.partner-phone-none {
  font-size: 11.5px;
  color: #94a3b8;
  font-style: italic;
}

.partner-empty-notice {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted, #64748b);
}

.partner-empty-notice .empty-icon {
  font-size: 42px;
  display: block;
  margin-bottom: 12px;
}

.partner-empty-notice h4 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--text, #1e293b);
}

.partner-empty-notice p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
}

/* 컨트롤 바 */
.partner-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 0 8px;
}

.partner-search-box {
  position: relative;
  flex: 1 1 260px;
  max-width: 380px;
  min-width: 200px;
}

.partner-search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

.partner-search-input {
  width: 100%;
  height: 40px;
  padding: 0 32px 0 36px;
  font-size: 13.5px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.partner-search-input:focus {
  border-color: #21764e;
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 118, 78, 0.12);
}

.search-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: #94a3b8;
  padding: 2px 6px;
}

.partner-filter-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  padding: 3px 4px;
  border-radius: 8px;
}

.partner-filter-tabs .filter-tab {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.partner-filter-tabs .filter-tab:hover {
  color: #0f172a;
}

.partner-filter-tabs .filter-tab.active {
  background: #ffffff;
  color: #1e7e48;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 850;
}

.partner-filter-tabs .tab-count {
  font-weight: 850;
  margin-left: 2px;
}

.partner-view-toggle-group {
  display: flex;
  background: #f1f5f9;
  padding: 3px 4px;
  border-radius: 8px;
  gap: 4px;
}

.view-toggle-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.view-toggle-btn:hover {
  color: #0f172a;
}

.view-toggle-btn.active {
  background: #ffffff;
  color: #1e7e48;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 850;
}

/* ==========================================================================
   거래처 관리 화면 분할 레이아웃 (Split Drawer: 품목 관리와 동일한 520px Drawer)
   ========================================================================== */

/* 사이드 패널 열릴 때 메인 화면 우측 여백 확보 (520px) */
body.has-partner-drawer main {
  margin-right: 520px;
  transition: margin-right 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 사이드 드로어 열렸을 때 테이블 컬럼 스마트 축소 */
body.has-partner-drawer .partner-list-table-header,
body.has-partner-drawer .partner-card-list.view-mode-list .partner-card-item {
  grid-template-columns: 32px 36px minmax(120px, 1.2fr) 70px 105px minmax(180px, 1.8fr) minmax(110px, 1.2fr) minmax(90px, 0.9fr);
  gap: 8px;
  padding: 9px 12px;
}

.partner-split-workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.partner-main-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-panel, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 20px 22px;
  box-sizing: border-box;
}

/* [우측 사이드 패널: 520px 슬라이드 드로어] */
.partner-side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  height: 100vh;
  background: #ffffff;
  border-left: 1.5px solid #d2e2d8;
  box-shadow: -8px 0 32px rgba(18, 48, 30, 0.12);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
}

.partner-side-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

/* 데스크톱에서는 백드롭 절대 안 뜸 (좌측 화면 100% 클릭 및 조작 가능, 블러 없음) */
.partner-drawer-backdrop {
  display: none !important;
}

/* 패널 상단 헤더 */
.partner-side-drawer .detail-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.detail-panel-kicker {
  font-size: 11px;
  font-weight: 800;
  color: #1e7e48;
  letter-spacing: 0.5px;
}

.detail-panel-title {
  font-size: 16.5px;
  font-weight: 850;
  color: #0f172a;
  margin: 2px 0 0 0;
}

.panel-close-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  font-size: 14px;
  transition: all 0.15s ease;
}

.panel-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fecaca;
}

/* 드로어 서브 모드 전환 탭 (세련된 세그먼트 컨트롤) */
.drawer-mode-nav {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 16px;
  gap: 6px;
  flex-shrink: 0;
}

.drawer-mode-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 750;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.drawer-mode-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}

.drawer-mode-btn.active {
  color: #1e7e48;
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 850;
}

/* 패널 본문 (독립 스크롤) */
.partner-side-drawer .detail-panel-body {
  padding: 16px 20px;
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f7faf8;
}

.panel-tab-pane {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.panel-tab-pane.active {
  display: flex;
}

.panel-profile-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #dce8e0;
  border-radius: 10px;
}

.panel-profile-banner .detail-avatar {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: #21764e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 850;
  box-shadow: 0 2px 6px rgba(33, 118, 78, 0.2);
  flex-shrink: 0;
}

.detail-profile-info {
  flex: 1;
  min-width: 0;
}

/* 폼 스타일 */
.partner-panel-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.partner-panel-form .form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.partner-panel-form .form-grid-full {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.partner-panel-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.partner-panel-form label span {
  font-size: 13.5px !important;
  font-weight: 750 !important;
  color: #334155 !important;
  margin-bottom: 2px;
}

.partner-panel-form input,
.partner-panel-form select,
.partner-panel-form textarea {
  height: 40px !important;
  padding: 0 12px !important;
  font-size: 14px !important;
  border: 1px solid #cedcd3 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  box-sizing: border-box !important;
}

.partner-panel-form textarea {
  height: auto !important;
  padding: 10px 12px !important;
  font-family: inherit;
  resize: vertical;
}

.partner-panel-form input:focus,
.partner-panel-form select:focus,
.partner-panel-form textarea:focus {
  border-color: #21764e !important;
  background: #ffffff !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 118, 78, 0.12) !important;
}

/* 전화번호 다중 관리 영역 */
.partner-phones-manager {
  background: #ffffff;
  border: 1px solid #dce8e0;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.phones-manager-head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}

.phones-manager-head small {
  color: #64748b;
  font-size: 11.5px;
}

.detail-phone-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-phone-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8faf9;
  border: 1px solid #dce8e0;
  border-radius: 7px;
}

.phone-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.phone-num {
  font-size: 14px;
  font-weight: 750;
  color: #1e293b;
  font-variant-numeric: tabular-nums;
}

.phone-label-badge {
  font-size: 11.5px;
  background: #e2ece5;
  color: #1e6b43;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 750;
}

.phone-del-btn {
  background: none;
  border: none;
  font-size: 16px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.phone-del-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

.add-phone-inline-form {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 8px;
  margin-top: 4px;
}

.add-phone-inline-form input {
  height: 38px;
  padding: 0 10px;
  font-size: 13px;
  border: 1px solid #cedcd3;
  border-radius: 6px;
}

.add-phone-inline-form button {
  font-size: 12px;
  border-radius: 6px;
}

/* 사이드 드로어 및 공통 위험 작업 영역 (거래처/품목 통일 스타일) */
.drawer-danger-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: #fff5f5;
  border: 1.5px solid #fecaca;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.danger-box-desc {
  font-size: 13px;
  color: #991b1b;
  line-height: 1.45;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.danger-box-desc strong {
  color: #7f1d1d;
}

.btn-drawer-danger {
  width: 100% !important;
  height: 42px !important;
  min-height: 42px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  border-radius: 8px !important;
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border: 1.5px solid #f87171 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  box-sizing: border-box !important;
  padding: 0 16px !important;
}

.btn-drawer-danger:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.25) !important;
}

.btn-drawer-danger:active {
  transform: translateY(0);
}

/* 품목 목록 인라인 행 삭제 버튼 */
.catalog-row-actions .btn-row-delete {
  min-height: 43px;
  height: 43px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 750;
  border-radius: 8px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #fff1f2;
  color: #be123c;
  border: 1.5px solid #fecdd3;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.catalog-row-actions .btn-row-delete:hover {
  background: #e11d48;
  color: #ffffff;
  border-color: #be123c;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.2);
}


/* ==========================================================================
   모바일 / 태블릿 반응형 미디어 쿼리
   ========================================================================== */
@media (max-width: 1024px) {
  body.has-partner-drawer main {
    margin-right: 0 !important;
  }

  .partner-side-drawer {
    width: 92vw;
    max-width: 480px;
    z-index: 1060;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.22);
  }

  .partner-drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1055;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  body.has-partner-drawer .partner-drawer-backdrop {
    display: block !important;
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 680px) {
  .partner-list-table-header {
    display: none !important;
  }

  .partner-card-list.view-mode-list .partner-card-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 14px 16px !important;
  }

  .partner-card-list.view-mode-list .card-only-sub {
    display: flex !important;
  }

  .partner-card-list.view-mode-list .list-only-col {
    display: none !important;
  }

  .partner-card-list.view-mode-list .partner-col-address,
  .partner-card-list.view-mode-list .partner-col-notes {
    padding-top: 6px;
    border-top: 1px dashed var(--border, #f1f5f9);
  }

  .partner-side-drawer {
    width: 100vw;
  }
}

/* ==========================================================================
   거래처 가져오기 팝업 모달 (불투명 배경 & 세련된 백드롭)
   ========================================================================== */
dialog.partner-import-modal,
.partner-import-modal {
  border: 1px solid #cbd5e1 !important;
  border-radius: 14px !important;
  padding: 0 !important;
  max-width: 540px !important;
  width: 90vw !important;
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  margin: 0 !important;
  z-index: 9999 !important;
  overflow: hidden !important;
}

dialog.partner-import-modal::backdrop,
.partner-import-modal::backdrop {
  background: rgba(15, 23, 42, 0.55) !important;
  backdrop-filter: blur(3px) !important;
}

.partner-import-modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.partner-import-modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}

.partner-import-modal-body {
  padding: 20px 24px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ==========================================================================
   🔗 거래처 그룹핑 관리 모달 & 하단 플로팅 일괄 액션 바 (Group Workspace UX)
   ========================================================================== */
.partner-group-overview-modal {
  width: 90vw;
  max-width: 680px;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  padding: 0;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  z-index: 9999;
  overflow: hidden;
}

.partner-group-overview-modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}

.partner-group-overview-modal-head {
  padding: 16px 22px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.partner-group-overview-modal-body {
  padding: 20px 22px;
  max-height: 70vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.partner-group-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  background: #ffffff;
  transition: all 0.15s ease;
}

.partner-group-card:hover {
  border-color: #6366f1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

.partner-group-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.partner-group-name-title {
  font-size: 15px;
  font-weight: 800;
  color: #1e1b4b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.partner-group-count-badge {
  background: #e0e7ff;
  color: #3730a3;
  font-size: 13px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
}

.partner-group-members-list {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.5;
  margin: 0 0 10px;
  word-break: break-all;
}

.partner-group-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.btn-group-filter-view {
  font-size: 13px;
  font-weight: 750;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #4338ca;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-group-filter-view:hover {
  background: #e0e7ff;
  color: #312e81;
}

/* 하단 플로팅 일괄 그룹핑 액션 바 (선택 시 활성화) */
.partner-batch-group-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 8000;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.partner-batch-group-bar.is-visible {
  transform: translateX(-50%) translateY(0);
}

.partner-batch-count-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.partner-batch-count-pill {
  background: #22c55e;
  color: #0f172a;
  padding: 2px 9px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 13px;
}

.partner-batch-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.partner-batch-group-input {
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  min-width: 220px;
}

.partner-batch-group-input:focus {
  outline: none;
  border-color: #6366f1;
  background: #0f172a;
}

.btn-batch-apply {
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  border: none;
  background: #6366f1;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.btn-batch-apply:hover {
  background: #4f46e5;
}

.btn-batch-ungroup {
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #475569;
  background: transparent;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-batch-ungroup:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: #ef4444;
}

.btn-batch-cancel {
  height: 38px;
  padding: 0 12px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-batch-cancel:hover {
  color: #f8fafc;
}

/* 체크박스 정렬 셀 */
.partner-col-chk {
  display: flex;
  align-items: center;
  justify-content: center;
}

.partner-chk-input {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: #21764e;
}

/* 빠른 그룹 필터 셀렉트 드롭다운 */
.partner-group-quick-select-wrap {
  display: flex;
  align-items: center;
}

.partner-group-select-dropdown {
  height: 42px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1.5px solid #c7d2fe;
  background: #f5f3ff;
  color: #3730a3;
  font-size: 13.5px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.partner-group-select-dropdown:hover {
  background: #ede9fe;
  border-color: #818cf8;
}

.partner-group-select-dropdown:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn-clear-group-field:hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border-color: #f87171 !important;
}

/* ==========================================================================
   거래처 입금 & 미수금 관리 화면 분할 레이아웃 (Deposit Split Drawer: 520px PC Drawer)
   ========================================================================== */

/* 사이드 패널 열릴 때 메인 화면 우측 여백 확보 (520px) - PC 분할 화면 */
body.has-deposit-drawer main {
  margin-right: 520px;
  transition: margin-right 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 정산 테이블 행 커서 및 마우스오버 효과 (행 전체 클릭으로 우측 드로어 즉시 전환) */
.deposits-table tbody tr.deposit-partner-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.deposits-table tbody tr.deposit-partner-row:hover:not(.is-drawer-active) {
  background-color: #f8fafc !important;
}

.deposits-table tbody tr.deposit-partner-row a,
.deposits-table tbody tr.deposit-partner-row button,
.deposits-table tbody tr.deposit-partner-row details {
  cursor: pointer;
}

/* 정산 테이블 활성 행 하이라이트 (내가 작업 중인 거래처 즉각 인지) */
.deposits-table tbody tr.deposit-partner-row.is-drawer-active {
  background-color: #ecfdf5 !important;
  box-shadow: inset 4px 0 0 #10b981;
}

.partner-settle-card {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.partner-settle-card:hover:not(.is-drawer-active) {
  border-color: #cbd5e1;
}

.partner-settle-card.is-drawer-active {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25) !important;
}

/* [우측 사이드 패널: 520px 슬라이드 드로어] */
.deposit-side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  height: 100vh;
  background: #ffffff;
  border-left: 1.5px solid #d2e2d8;
  box-shadow: -8px 0 32px rgba(18, 48, 30, 0.12);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  visibility: hidden;
}

.deposit-side-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

/* 데스크톱에서는 백드롭 절대 안 뜸 (좌측 화면 100% 클릭 및 조작 가능, 블러 없음) */
.deposit-drawer-backdrop {
  display: none !important;
}

/* 드로어 본문 */
.deposit-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #ffffff;
}

/* 거래처 요약 정보 카드 (미수금 잔액 및 원클릭 채우기) */
.deposit-partner-summary-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dpsc-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dpsc-name-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dpsc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #e0f2fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.dpsc-info {
  display: flex;
  flex-direction: column;
}

.dpsc-name {
  margin: 0;
  font-size: 16.5px;
  font-weight: 850;
  color: #0f172a;
  line-height: 1.25;
}

.dpsc-phone {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
  margin-top: 3px;
}

.dpsc-receivable-wrap {
  text-align: right;
}

.dpsc-receivable-lbl {
  font-size: 12.5px;
  font-weight: 700;
  color: #64748b;
  display: block;
  margin-bottom: 2px;
}

.dpsc-receivable-val {
  font-size: 17px;
  font-weight: 850;
}

.dpsc-receivable-val.text-danger {
  color: #dc2626;
}

.dpsc-receivable-val.text-success {
  color: #16a34a;
}

.dpsc-receivable-val.text-info {
  color: #0284c7;
}

.dpsc-action-row {
  border-top: 1px dashed #cbd5e1;
  padding-top: 10px;
}

.dpsc-fill-btn {
  width: 100%;
  padding: 9px 14px;
  background: #ecfdf5;
  border: 1.5px solid #a7f3d0;
  border-radius: 8px;
  color: #065f46;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  display: block;
}

.dpsc-fill-btn:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

/* 드로어 폼 스타일 (24인치 모니터 가독성 표준 13.5~15px) */
.deposit-drawer-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-title {
  font-size: 13.5px;
  font-weight: 750;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-title .req {
  color: #ef4444;
}

.field-title-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14.5px;
  color: #0f172a;
  background: #ffffff;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.drawer-input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.drawer-input.amount-input {
  font-size: 17px;
  font-weight: 850;
  letter-spacing: 0.5px;
  text-align: right;
  padding-right: 16px;
  color: #047857;
}

/* 빠른 금액 증감 칩 */
.quick-amount-chips {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.q-chip {
  flex: 1;
  height: 32px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
  color: #334155;
  cursor: pointer;
  transition: all 0.12s ease;
}

.q-chip:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}

.q-chip-reset {
  flex: 0.7;
  background: #fff1f2;
  border-color: #fecdd3;
  color: #e11d48;
}

.q-chip-reset:hover {
  background: #ffe4e6;
  border-color: #fda4af;
}

/* 결제 수단 토글 버튼 (14px 볼드 버튼) */
.deposit-drawer-form .payment-method-toggle-group {
  display: flex;
  gap: 8px;
}

.deposit-drawer-form .pay-toggle-btn {
  flex: 1;
  height: 40px;
  font-size: 13.5px;
  font-weight: 750;
}

/* 하단 고정 액션 바 */
.deposit-drawer-footer {
  padding: 16px 22px;
  background: #ffffff;
  border-top: 1.5px solid #e2e8f0;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.drawer-btn-cancel {
  flex: 1;
  height: 46px;
  font-size: 14.5px;
  font-weight: 750;
}

.drawer-btn-submit {
  flex: 2;
  height: 46px;
  font-size: 15px;
  font-weight: 850;
  background: #10b981 !important;
  border: none !important;
  color: #ffffff !important;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.drawer-btn-submit:hover {
  background: #059669 !important;
}

/* ==========================================================================
   입금 관리 모바일 / 태블릿 반응형 미디어 쿼리
   ========================================================================== */
@media (max-width: 1024px) {
  body.has-deposit-drawer main {
    margin-right: 0 !important;
  }

  .deposit-side-drawer {
    width: 92vw;
    max-width: 480px;
    z-index: 1060;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.22);
  }

  .deposit-drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1055;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  body.has-deposit-drawer .deposit-drawer-backdrop {
    display: block !important;
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 768px) {
  .deposit-side-drawer {
    width: 100vw;
  }
}

/* ==========================================================================
   매입 전표 관리: PC 520px 우측 사이드 드로어 & Searchable Combobox & 마이너스 스타일
   ========================================================================== */

/* 24인치 모니터 및 모바일 가독성: 텍스트 최소 13px+ */
.pi-form-wrapper {
  transition: margin-right 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

body.has-product-drawer main {
  margin-right: 520px !important;
}

/* 신규 품목 빠른 등록 사이드 드로어 (우측 520px 고정) */
.quick-product-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  background: #ffffff;
  border-left: 1.5px solid #cbd5e1;
  box-shadow: -8px 0 30px rgba(15, 23, 42, 0.12);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

body.has-product-drawer .quick-product-drawer {
  transform: translateX(0);
}

.quick-product-drawer .drawer-header {
  padding: 18px 22px;
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.quick-product-drawer .drawer-title {
  font-size: 18px;
  font-weight: 850;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-product-drawer .drawer-subtitle {
  font-size: 13px;
  color: #64748b;
  margin-top: 3px;
  display: block;
}

.quick-product-drawer .drawer-close-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 16px;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.quick-product-drawer .drawer-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.quick-product-drawer .drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.quick-product-drawer .drawer-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quick-product-drawer .drawer-form-label {
  font-size: 14px;
  font-weight: 750;
  color: #1e293b;
}

.quick-product-drawer .drawer-form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.quick-product-drawer .drawer-input,
.quick-product-drawer .drawer-select {
  height: 44px;
  padding: 0 14px;
  font-size: 14.5px;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.quick-product-drawer .drawer-input:focus,
.quick-product-drawer .drawer-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.quick-product-drawer .drawer-footer {
  padding: 16px 22px;
  background: #f8fafc;
  border-top: 1.5px solid #e2e8f0;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.quick-product-drawer .drawer-btn-cancel {
  flex: 1;
  height: 46px;
  font-size: 14.5px;
  font-weight: 700;
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  color: #475569;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-product-drawer .drawer-btn-cancel:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.quick-product-drawer .drawer-btn-submit {
  flex: 2;
  height: 46px;
  font-size: 15px;
  font-weight: 800;
  background: #10b981;
  border: none;
  color: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.quick-product-drawer .drawer-btn-submit:hover {
  background: #059669;
}

/* 드로어 백드롭 (태블릿/모바일) */
.quick-product-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 1045;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

@media (max-width: 1024px) {
  body.has-product-drawer main {
    margin-right: 0 !important;
  }
  .quick-product-drawer {
    width: 92vw;
    max-width: 480px;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.22);
  }
  body.has-product-drawer .quick-product-backdrop {
    display: block !important;
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 768px) {
  .quick-product-drawer {
    width: 100vw;
  }
}

/* ==========================================================================
   우리 상품 Searchable Combobox & 검색 팝오버 스타일
   ========================================================================== */
.product-match-cell-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.btn-combobox-trigger {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  text-align: left;
  font-size: 13.5px;
  color: #0f172a;
  transition: all 0.15s ease;
}

.btn-combobox-trigger:hover {
  border-color: #3b82f6;
  background: #f8fafc;
}

.btn-combobox-trigger.is-unmatched {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #b45309;
}

.btn-combobox-trigger.is-matched {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #0f172a;
}

.combobox-name-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.combobox-arrow {
  color: #64748b;
  font-size: 11px;
  flex-shrink: 0;
}

/* 공용 검색 팝오버 */
.product-search-popover {
  position: fixed;
  z-index: 1080;
  width: 380px;
  max-width: calc(100vw - 24px);
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18), 0 4px 10px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  max-height: 480px;
  overflow: hidden;
  animation: popoverFadeIn 0.15s ease-out;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.popover-header {
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.popover-search-box {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  height: 38px;
  gap: 8px;
}

.popover-search-box:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.popover-search-box .search-icon {
  font-size: 14px;
  color: #64748b;
}

.popover-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  background: transparent;
}

.popover-search-input::placeholder {
  color: #94a3b8;
  font-weight: normal;
}

.btn-clear-search {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
}

.btn-clear-search:hover {
  color: #0f172a;
}

.popover-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.popover-recommends {
  background: #f0fdf4;
  border-bottom: 1.5px solid #bbf7d0;
  padding: 8px 12px;
}

.popover-section-title {
  font-size: 12.5px;
  font-weight: 750;
  color: #15803d;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.popover-section:not(.popover-recommends) .popover-section-title {
  font-size: 12.5px;
  color: #64748b;
  padding: 8px 12px 4px 12px;
}

.popover-recommend-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.popover-product-list {
  flex: 1;
  overflow-y: auto;
  max-height: 260px;
  padding: 4px 8px;
}

.popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
  font-size: 13.5px;
  border: 1px solid transparent;
}

.popover-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.popover-item.is-selected {
  background: #dbeafe;
  border-color: #93c5fd;
  font-weight: 750;
}

.popover-item-rec {
  background: #ffffff;
  border: 1.5px solid #86efac;
}

.popover-item-rec:hover {
  background: #dcfce7;
  border-color: #4ade80;
}

.item-left {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.item-name {
  font-weight: 750;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-spec-badge {
  font-size: 11.5px;
  padding: 1px 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  color: #475569;
  white-space: nowrap;
}

.item-rec-badge {
  font-size: 11.5px;
  padding: 1px 6px;
  background: #22c55e;
  color: #ffffff;
  border-radius: 4px;
  font-weight: 750;
  white-space: nowrap;
}

.item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 12.5px;
  color: #64748b;
}

.item-unit-tag {
  color: #3b82f6;
  font-weight: 600;
}

.item-price-tag {
  font-weight: 700;
  color: #0f172a;
}

.popover-empty {
  padding: 18px 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 13.5px;
}

.popover-footer {
  padding: 8px 12px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.btn-popover-quick-new {
  width: 100%;
  height: 36px;
  background: #ffffff;
  border: 1.5px dashed #3b82f6;
  color: #2563eb;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 750;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-popover-quick-new:hover {
  background: #eff6ff;
  border-color: #2563eb;
}

/* ==========================================================================
   마이너스(-) 수량/금액 스타일 하이라이트
   ========================================================================== */
.text-negative {
  color: #ef4444 !important;
  font-weight: 850 !important;
}

input.text-negative {
  background-color: #fef2f2 !important;
  border-color: #fca5a5 !important;
}

/* ==========================================================================
   전역 인쇄(@media print) 스타일: 사이드바, 헤더, 마스터 배너 완전 격리 및 셸 해제
   ========================================================================== */
@media print {
  .sidebar,
  #appSidebar,
  aside,
  .app-sidebar,
  .impersonation-banner,
  .topbar,
  header.topbar,
  .mobile-bottom-nav,
  .mobile-menu-backdrop,
  .toolbar,
  .notice,
  .screen-only,
  nav {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
  }

  html, body {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    overflow: visible !important;
  }

  .shell,
  .app-layout,
  main,
  .content {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: white !important;
    box-shadow: none !important;
    float: none !important;
  }
}

/* ==========================================================================
   도매상 셀프 가입 & 마스터 승인 대기 심사 스타일
   ========================================================================== */
.admin-org-tabs {
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.admin-org-tabs::-webkit-scrollbar {
  height: 4px;
}

.admin-org-tabs::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.org-status-badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  line-height: 1.3;
}

@media (max-width: 480px) {
  .admin-org-tabs a.tab-item {
    padding: 9px 14px !important;
    font-size: 13.5px !important;
  }
}

/* ==========================================================================
   스마트 AI 헬퍼 & 스포트라이트 (Spotlight Focus Ring & QR Modal)
   ========================================================================== */
@keyframes helperPulseRing {
  0% {
    border-color: rgba(16, 185, 129, 0.85);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4), 0 0 20px rgba(16, 185, 129, 0.45);
  }
  50% {
    border-color: rgba(52, 211, 153, 1);
    box-shadow: 0 0 0 7px rgba(16, 185, 129, 0.25), 0 0 35px rgba(16, 185, 129, 0.85);
  }
  100% {
    border-color: rgba(16, 185, 129, 0.85);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4), 0 0 20px rgba(16, 185, 129, 0.45);
  }
}

.helper-spotlight-backdrop {
  display: none !important; /* 화면 글씨와 메뉴가 100% 선명하고 또렷하게 보이도록 어두운 딤/블러 오버레이 완전 제거 */
}

.helper-spotlight-ring {
  position: absolute;
  border: 3.5px solid #10b981;
  pointer-events: none;
  z-index: 99998;
  animation: helperPulseRing 1.4s ease-in-out infinite;
  transition: opacity 0.25s ease-out;
  box-sizing: border-box;
}

@keyframes helperPulseRing {
  0% {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.45), 0 0 24px rgba(16, 185, 129, 0.65);
  }
  50% {
    border-color: #34d399;
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.25), 0 0 38px rgba(16, 185, 129, 0.95);
  }
  100% {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.45), 0 0 24px rgba(16, 185, 129, 0.65);
  }
}

.helper-spotlight-tip {
  position: absolute;
  background: #0f172a;
  color: #34d399;
  font-weight: 800;
  font-size: 14.5px;
  line-height: 1.4;
  padding: 8px 18px;
  border-radius: 9999px;
  border: 2px solid #34d399;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(16, 185, 129, 0.4);
  white-space: nowrap;
  text-align: center;
  pointer-events: none;
  z-index: 99999;
  box-sizing: border-box;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: auto;
}

/* 툴팁 상단 배치 시 화살표 (아래쪽을 향함) */
.helper-spotlight-tip.tip-pos-top::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: var(--tip-arrow-x, 50%);
  transform: translateX(-50%);
  border-width: 7px 7px 0;
  border-style: solid;
  border-color: #34d399 transparent transparent transparent;
}

/* 툴팁 하단 배치 시 화살표 (위쪽을 향함) */
.helper-spotlight-tip.tip-pos-bottom::after {
  content: '';
  position: absolute;
  top: -7px;
  left: var(--tip-arrow-x, 50%);
  transform: translateX(-50%);
  border-width: 0 7px 7px;
  border-style: solid;
  border-color: transparent transparent #34d399 transparent;
}

/* 📱 모바일 QR 매직 로그인 모달 */
.mobile-qr-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s, visibility 0.22s;
}
.mobile-qr-modal.active {
  opacity: 1;
  visibility: visible;
}
.mobile-qr-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(10px);
}
.mobile-qr-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 35px rgba(16, 185, 129, 0.2);
  padding: 28px 24px;
  text-align: center;
  color: #f8fafc;
  box-sizing: border-box;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
.mobile-qr-modal.active .mobile-qr-card {
  transform: translateY(0) scale(1);
}
.mobile-qr-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 50%;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}
.mobile-qr-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}
.mobile-qr-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 9999px;
  margin-bottom: 12px;
}
.mobile-qr-title {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 800;
  color: #f8fafc;
  word-break: keep-all;
}
.mobile-qr-desc {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: #94a3b8;
  line-height: 1.55;
  word-break: keep-all;
}
.mobile-qr-desc strong {
  color: #a7f3d0;
}
.mobile-qr-code-box {
  background: #ffffff;
  border-radius: 18px;
  padding: 16px;
  width: 220px;
  height: 220px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}
.mobile-qr-code-box svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
.mobile-qr-loading {
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}
.mobile-qr-timer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13.5px;
  color: #cbd5e1;
  margin-bottom: 20px;
}
.mobile-qr-timer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}
.mobile-qr-timer-row strong {
  color: #34d399;
  font-variant-numeric: tabular-nums;
  font-size: 14.5px;
}
.mobile-qr-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  gap: 6px;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
}
.step-item span {
  width: 18px;
  height: 18px;
  background: #10b981;
  color: #ffffff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.step-arrow {
  color: #64748b;
  font-size: 12px;
}
.mobile-qr-expired,
.mobile-qr-success,
.mobile-qr-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%;
}
.expired-icon, .success-icon {
  font-size: 38px;
  margin-bottom: 8px;
}
.mobile-qr-expired p,
.mobile-qr-success p {
  font-size: 13.5px;
  color: #334155;
  margin: 0 0 10px;
  font-weight: 600;
  word-break: keep-all;
}
.mobile-qr-success h4 {
  margin: 0 0 4px;
  font-size: 16px;
  color: #059669;
  font-weight: 800;
}
.btn-qr-reload {
  padding: 8px 16px;
  background: #10b981;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-qr-reload:hover {
  background: #059669;
}

/* ==========================================================================
   🌙 프리미엄 딥 슬레이트 & 옵시디언 다크 테마 마스터 (전수 개혁)
   - 타겟: 50~70대 도매상 사장님 시인성 극대화 (WCAG AAA 고대비)
   - 칙칙함 완전 해소: 옵시디언 블랙 & 네이비 슬레이트 베이스
   - 형광 네온 컬러 시스템: 에메랄드(#34d399), 스카이블루(#60a5fa), 코랄레드(#f87171)
   ========================================================================== */
html[data-theme="dark"] {
  color-scheme: dark;
}

/* 1. 기본 레이아웃 & 텍스트 */
html[data-theme="dark"] body {
  background: var(--canvas) !important;
  color: var(--ink) !important;
}
html[data-theme="dark"] .shell {
  background: var(--canvas) !important;
}
html[data-theme="dark"] .topbar {
  background: rgba(11, 15, 25, 0.92) !important;
  border-bottom: 1px solid var(--line) !important;
  color: var(--ink) !important;
}
html[data-theme="dark"] .topbar h1 {
  color: #f8fafc !important;
}
html[data-theme="dark"] .sidebar {
  background: #0d1420 !important;
  border-right: 1px solid var(--line) !important;
}
html[data-theme="dark"] .sidebar nav a {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .sidebar nav a:hover,
html[data-theme="dark"] .sidebar nav a.active {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08) !important;
}
html[data-theme="dark"] .sidebar nav a.active {
  box-shadow: inset 3px 0 #10b981 !important;
}
html[data-theme="dark"] .sidebar-foot {
  background: rgba(0, 0, 0, 0.35) !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .account-summary strong {
  color: #f8fafc !important;
}
html[data-theme="dark"] .account-email {
  color: #94a3b8 !important;
}

/* 2. 전역 카드, 패널 및 컨테이너 */
html[data-theme="dark"] :is(
  .panel,
  .stat-card,
  .order-card,
  .partner-order-card,
  .dev-card,
  .tg-bot-panel,
  .tg-step-card,
  .expense-kpi-card,
  .expense-ledger-panel,
  .expense-structure-card,
  .kpi-card,
  .analytics-card,
  .orders-nav-box,
  .partner-view-header-strip,
  .catalog-record,
  .detail-props-panel,
  .settings-card,
  .connection-device,
  .orders-control-row .partner-order-filter,
  .deposits-table-container,
  .inventory-side-drawer,
  .bookmark-side-drawer,
  .deposit-side-drawer,
  .expense-side-drawer,
  .catalog-side-drawer
) {
  background: var(--panel) !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] :is(
  .panel-head,
  .dev-card-header,
  .daily-order-sheet-head,
  .order-card > header,
  .purchase-toolbar,
  .side-drawer-header,
  .modal-header,
  .modal-footer
) {
  background: var(--panel) !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] :is(
  .panel-head h2,
  .form-panel h2,
  .order-card header h2,
  .daily-order-sheet-head h2,
  .purchase-toolbar h2,
  .partner-view-header-title strong,
  .stat-card strong,
  .sheet-count strong,
  .settings-card h2,
  .tg-bot-name,
  .modal-header h3,
  .side-drawer-title
) {
  color: #f8fafc !important;
}

html[data-theme="dark"] :is(
  .panel-copy,
  .orders-head > p,
  .purchase-toolbar p,
  .settings-card p,
  .sheet-count,
  .partner-view-header-title span,
  .help-text,
  .form-desc,
  .stat-card span
) {
  color: #94a3b8 !important;
}

/* 3. 모든 폼 컨트롤 & 인풋 */
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #131d2b !important;
  color: #f8fafc !important;
  border: 1px solid #33465e !important;
}
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25) !important;
  outline: none !important;
}
html[data-theme="dark"] select option {
  background: #151e2e !important;
  color: #f8fafc !important;
}
html[data-theme="dark"] input[type="checkbox"],
html[data-theme="dark"] input[type="radio"] {
  accent-color: #10b981 !important;
}

/* 4. 테이블 전수 개혁 (주문, 입금, 사입, 재고, 지출, 거래처) */
html[data-theme="dark"] table {
  border-color: var(--line) !important;
}
html[data-theme="dark"] :is(
  th,
  .daily-order-sheet th,
  .mobile-sheet-table th,
  .deposits-table th,
  .inventory-table th,
  .inventory-sheet-table th,
  .ledger-table th,
  .purchase-header,
  .rank-table th,
  .drawer-log-table th
) {
  background: #182334 !important;
  color: #cbd5e1 !important;
  border-color: #243447 !important;
}
html[data-theme="dark"] :is(
  td,
  .daily-order-sheet td,
  .mobile-sheet-table td,
  .deposits-table td,
  .inventory-table td,
  .inventory-sheet-table td,
  .ledger-table td,
  .rank-table td,
  .drawer-log-table td
) {
  background: #131c2b !important;
  color: #f1f5f9 !important;
  border-color: #202c3b !important;
}
html[data-theme="dark"] :is(
  tbody tr:hover td,
  .daily-order-sheet tbody tr:hover td,
  .deposits-table tbody tr:hover td,
  .inventory-table tbody tr:hover td,
  .inventory-sheet-table tbody tr:hover td,
  .ledger-table tbody tr:hover td,
  .rank-table tbody tr:hover td
) {
  background: #1e2b3e !important;
}

/* 테이블 특수 행 상태 */
html[data-theme="dark"] .daily-order-sheet .sheet-row-review td {
  background: rgba(251, 191, 36, 0.12) !important;
}
html[data-theme="dark"] .daily-order-sheet .sheet-row-review:hover td {
  background: rgba(251, 191, 36, 0.2) !important;
}
html[data-theme="dark"] .daily-order-sheet .sheet-row-muted td {
  background: #0f1622 !important;
  color: #64748b !important;
}
html[data-theme="dark"] .daily-order-sheet tfoot td {
  background: #162637 !important;
  color: #34d399 !important;
  border-top: 2px solid #10b981 !important;
}
html[data-theme="dark"] .deposits-table .row-unpaid td {
  background: rgba(248, 113, 113, 0.08) !important;
}
html[data-theme="dark"] .deposits-table .row-unpaid:hover td {
  background: rgba(248, 113, 113, 0.16) !important;
}
html[data-theme="dark"] .deposits-table th,
html[data-theme="dark"] .deposits-table th.th-sortable {
  background: #182334 !important;
  border-bottom: 2px solid #243447 !important;
}
html[data-theme="dark"] .deposits-table th.th-sortable:hover {
  background: #24344c !important;
  color: #f8fafc !important;
}
html[data-theme="dark"] .deposits-table th.th-sortable .th-label-text {
  color: #cbd5e1 !important;
}
html[data-theme="dark"] .deposits-table th.th-sortable.is-sorted {
  background: rgba(16, 185, 129, 0.18) !important;
  border-bottom: 2px solid #10b981 !important;
}
html[data-theme="dark"] .deposits-table th.th-sortable.is-sorted .th-label-text {
  color: #34d399 !important;
}
html[data-theme="dark"] .deposits-table th.th-sortable .sort-indicator {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #cbd5e1 !important;
}
html[data-theme="dark"] .inventory-table tr.stock-row-out td {
  background: rgba(248, 113, 113, 0.1) !important;
}
html[data-theme="dark"] .inventory-table tr.stock-row-low td {
  background: rgba(251, 191, 36, 0.1) !important;
}
html[data-theme="dark"] .inventory-product-meta strong {
  color: #f8fafc !important;
}
html[data-theme="dark"] .inventory-product-meta .spec-text {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .partner-row-item {
  background: #151e2e !important;
  border-color: #243447 !important;
}
html[data-theme="dark"] .partner-row-item:hover {
  background: #1e2b3e !important;
}
html[data-theme="dark"] .partner-name-cell strong {
  color: #f8fafc !important;
}
html[data-theme="dark"] .purchase-row {
  border-color: #243447 !important;
}
html[data-theme="dark"] .purchase-foot {
  background: #151e2e !important;
  border-color: #243447 !important;
  color: #cbd5e1 !important;
}

/* 5. 탭, 필터, 네비게이션 & 액션 버튼 */
html[data-theme="dark"] :is(
  .date-step,
  .order-period-picker .date-step
) {
  background: #1a2638 !important;
  border: 1px solid #2a3d54 !important;
  color: #f8fafc !important;
}
html[data-theme="dark"] :is(
  .date-step:hover,
  .order-period-picker .date-step:hover
) {
  background: #24364e !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .quick-date-links {
  background: #121924 !important;
  border: 1px solid #243447 !important;
}
html[data-theme="dark"] .quick-date-links a {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .quick-date-links a:hover {
  color: #ffffff !important;
  background: #1e2b3e !important;
}
html[data-theme="dark"] .quick-date-links a.active {
  color: #ffffff !important;
  background: #10b981 !important;
}
html[data-theme="dark"] :is(
  .orders-view-tabs a,
  .period-toggle-tabs a,
  .order-status-filter a,
  .bookmark-tabs a
) {
  background: #182334 !important;
  border: 1px solid #2a3d54 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] :is(
  .orders-view-tabs a:hover,
  .period-toggle-tabs a:hover,
  .order-status-filter a:hover,
  .bookmark-tabs a:hover
) {
  color: #ffffff !important;
  border-color: #3b506b !important;
  background: #1e2b3e !important;
}
html[data-theme="dark"] :is(
  .orders-view-tabs a.active,
  .period-toggle-tabs a.active,
  .bookmark-tabs a.active
) {
  background: #10b981 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important;
}
html[data-theme="dark"] .order-status-filter a.active {
  background: #2563eb !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .order-status-filter a.active.review {
  background: #dc2626 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .order-status-filter a.active.duplicate {
  background: #d97706 !important;
  border-color: #f59e0b !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .order-status-filter a.active.ready {
  background: #059669 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .order-status-filter a.active.confirmed {
  background: #475569 !important;
  border-color: #64748b !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .batch-print-all-btn {
  background: #15291f !important;
  border-color: #1a4f32 !important;
  color: #34d399 !important;
}
html[data-theme="dark"] .batch-print-all-btn:hover {
  background: #1c382a !important;
  color: #6ee7b7 !important;
}
html[data-theme="dark"] .statement-link {
  background: #15291f !important;
  border-color: #1a4f32 !important;
  color: #34d399 !important;
}
html[data-theme="dark"] button.ghost,
html[data-theme="dark"] .button-link.ghost {
  background: #1a2638 !important;
  border: 1px solid #2a3d54 !important;
  color: #cbd5e1 !important;
}
html[data-theme="dark"] button.ghost:hover,
html[data-theme="dark"] .button-link.ghost:hover {
  background: #24364e !important;
  color: #ffffff !important;
}

/* 6. 지표 & 금액 텍스트 초고대비 네온 강조 */
html[data-theme="dark"] .orders-summary-item {
  border-left-color: #243447 !important;
}
html[data-theme="dark"] .orders-summary-item span {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .orders-summary-item strong {
  color: #f8fafc !important;
}
html[data-theme="dark"] .orders-summary-item.total strong,
html[data-theme="dark"] #kpiTotalAmount {
  color: #60a5fa !important;
  text-shadow: 0 0 12px rgba(96, 165, 250, 0.25);
}
html[data-theme="dark"] .orders-summary-item.confirmed strong,
html[data-theme="dark"] #kpiConfirmedAmount {
  color: #34d399 !important;
  text-shadow: 0 0 12px rgba(52, 211, 153, 0.25);
}
html[data-theme="dark"] .orders-summary-item.needs-attention strong {
  color: #f87171 !important;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.25);
}
html[data-theme="dark"] .daily-order-sheet .quantity-cell {
  color: #34d399 !important;
}
html[data-theme="dark"] .daily-order-sheet .amount-cell {
  color: #60a5fa !important;
  font-weight: 850;
}
html[data-theme="dark"] .final-quantity {
  color: #34d399 !important;
}
html[data-theme="dark"] .review-quantity {
  color: #fbbf24 !important;
}

/* 마진 뱃지 다크 보정 */
html[data-theme="dark"] .margin-badge.profit {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}
html[data-theme="dark"] .margin-badge.loss {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}
html[data-theme="dark"] .margin-badge.neutral {
  background: rgba(148, 163, 184, 0.15) !important;
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

/* 7. 툴팁 & 도움말 말풍선 다크 보정 */
html[data-theme="dark"] .help-tooltip-btn {
  background: #1e293b !important;
  border-color: #475569 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .help-tooltip-btn:hover,
html[data-theme="dark"] .help-tooltip-wrap.is-open .help-tooltip-btn {
  background: #2563eb !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .help-tooltip-bubble {
  background: #1e293b !important;
  border: 1.5px solid #3b82f6 !important;
  color: #f8fafc !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6) !important;
}
html[data-theme="dark"] .amount-item.confirmed .help-tooltip-bubble {
  border-color: #10b981 !important;
}
html[data-theme="dark"] .help-tooltip-bubble .bubble-title {
  color: #60a5fa !important;
}
html[data-theme="dark"] .amount-item.confirmed .help-tooltip-bubble .bubble-title {
  color: #34d399 !important;
}
html[data-theme="dark"] .help-tooltip-bubble .bubble-desc {
  color: #cbd5e1 !important;
}
html[data-theme="dark"] .help-tooltip-bubble .bubble-desc strong {
  color: #ffffff !important;
}
html[data-theme="dark"] .help-tooltip-bubble .bubble-list {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .help-tooltip-bubble::before {
  border-color: #3b82f6 transparent transparent transparent !important;
}
html[data-theme="dark"] .amount-item.confirmed .help-tooltip-bubble::before {
  border-color: #10b981 transparent transparent transparent !important;
}
html[data-theme="dark"] .help-tooltip-bubble::after {
  border-color: #1e293b transparent transparent transparent !important;
}

/* 8. 주문 파싱 카드, 메시지 박스, OCR */
html[data-theme="dark"] .message-box {
  background: #131f2f !important;
  border-left: 3.5px solid #10b981 !important;
}
html[data-theme="dark"] .message-box p {
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .message-box small {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .parsed-row {
  border-bottom-color: #243447 !important;
}
html[data-theme="dark"] .parsed-row strong {
  color: #f8fafc !important;
}
html[data-theme="dark"] .parsed-row small {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .unmatched-item {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}
html[data-theme="dark"] .excluded-item {
  background: rgba(148, 163, 184, 0.08) !important;
}
html[data-theme="dark"] .source-chip {
  background: #192638 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .partner-bizno-cell code {
  background: #192638 !important;
  border-color: #2c3e56 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .bot-usage {
  background: #142130 !important;
  color: #cbd5e1 !important;
}
html[data-theme="dark"] .bot-usage code {
  background: #1e2d40 !important;
  color: #34d399 !important;
}

/* 9. 결산 & KPI 대시보드 (analytics.html 완전 통합) */
html[data-theme="dark"] .analytics-container,
html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .analytics-card {
  background: #151e2e !important;
  border-color: #243447 !important;
  color: #f8fafc !important;
}
html[data-theme="dark"] .kpi-title,
html[data-theme="dark"] .kpi-sub-desc,
html[data-theme="dark"] .card-help-text,
html[data-theme="dark"] .toolbar-title-group p,
html[data-theme="dark"] .chip-label {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .kpi-main-number {
  color: #f8fafc !important;
}
html[data-theme="dark"] .pnl-pipeline-grid,
html[data-theme="dark"] .fixed-vs-variable,
html[data-theme="dark"] .price-chip {
  background: #0f172a !important;
  border-color: #243447 !important;
}
html[data-theme="dark"] .pnl-node {
  background: #182334 !important;
  border-color: #293a4e !important;
}
html[data-theme="dark"] .pnl-node-title {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .pnl-node-amt {
  color: #f8fafc !important;
}
html[data-theme="dark"] .pnl-operator {
  color: #64748b !important;
}
html[data-theme="dark"] .pnl-bar-track,
html[data-theme="dark"] .fvv-bar {
  background: #0b0f19 !important;
}
html[data-theme="dark"] .legend-chip {
  color: #cbd5e1 !important;
}
html[data-theme="dark"] .legend-chip strong {
  color: #f8fafc !important;
}
html[data-theme="dark"] .fvv-labels {
  color: #f8fafc !important;
}
html[data-theme="dark"] .fvv-pct {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .hero-net {
  background: linear-gradient(135deg, #152238 0%, #064e3b 100%) !important;
  border-color: #059669 !important;
}
html[data-theme="dark"] .hero-net .text-net {
  color: #34d399 !important;
}
html[data-theme="dark"] .btn-table-action {
  background: #1e2b3e !important;
  color: #cbd5e1 !important;
  border: 1px solid #2d3f56 !important;
}
html[data-theme="dark"] .btn-table-action:hover {
  background: #283950 !important;
  color: #ffffff !important;
}

/* 10. 모달 & 사이드 드로어 */
html[data-theme="dark"] .modal-target-summary {
  background: #152132 !important;
  border: 1px solid #243447 !important;
}
html[data-theme="dark"] .target-org-badge {
  background: #1e2b3e !important;
  border-color: #33465e !important;
  color: #f8fafc !important;
}
html[data-theme="dark"] .group-preset-chip {
  background: #182436 !important;
  border-color: #2a3d54 !important;
  color: #cbd5e1 !important;
}
html[data-theme="dark"] .side-drawer-close,
html[data-theme="dark"] .modal-close-btn {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .side-drawer-close:hover,
html[data-theme="dark"] .modal-close-btn:hover {
  color: #ffffff !important;
  background: #1e2b3e !important;
}
html[data-theme="dark"] .drawer-section-card {
  background: #151e2e !important;
  border-color: #243447 !important;
}

/* 11. 품목 관리 디테일 */
html[data-theme="dark"] .catalog-record-details > summary {
  background: #182334 !important;
  border-color: #2a3d54 !important;
  color: #f8fafc !important;
}
html[data-theme="dark"] .catalog-record-details .product-detail-body {
  background: #121a27 !important;
  border-color: #243447 !important;
}

/* 12. 설정 화면 테마 버튼 */
html[data-theme="dark"] .theme-options button {
  background: #151e2e !important;
  color: #cbd5e1 !important;
  border-color: #243447 !important;
}
html[data-theme="dark"] .theme-options button:hover {
  background: #1e2b3e !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .theme-options button[aria-pressed="true"] {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  font-weight: 800 !important;
}

/* 13. 핸드폰 연결 화면 (devices.html) */
html[data-theme="dark"] .device-compact-list {
  border-top-color: #243447 !important;
}
html[data-theme="dark"] .device-compact-item {
  background: #151e2e !important;
  border-bottom-color: #243447 !important;
}
html[data-theme="dark"] .device-compact-item:hover {
  background: #1e2b3e !important;
}
html[data-theme="dark"] .device-compact-item.is-active {
  background: #162820 !important;
  border-left: 3.5px solid #10b981 !important;
}
html[data-theme="dark"] :is(.device-title-text, .dev-card-title) {
  color: #f8fafc !important;
}
html[data-theme="dark"] .dev-card-badge {
  background: rgba(16, 185, 129, 0.18) !important;
  color: #34d399 !important;
}

/* 14. 텔레그램 연결 화면 (telegram.html) */
html[data-theme="dark"] :is(.tg-accounts-panel, .tg-account-card) {
  background: #151e2e !important;
  border-color: #243447 !important;
}
html[data-theme="dark"] .tg-account-card:hover {
  border-color: #10b981 !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15) !important;
}
html[data-theme="dark"] :is(.tg-account-name, .tg-accounts-title) {
  color: #f8fafc !important;
}
html[data-theme="dark"] .tg-guide-box {
  background: #131d2b !important;
  border-color: #243447 !important;
  color: #cbd5e1 !important;
}
html[data-theme="dark"] .tg-bot-desc {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .tg-meta-id {
  background: #1a2638 !important;
  color: #cbd5e1 !important;
}
html[data-theme="dark"] .tg-avatar {
  background: #1a2638 !important;
  border-color: #2a3d54 !important;
}
html[data-theme="dark"] .tg-accounts-header {
  border-bottom-color: #243447 !important;
}

/* 15. 거래명세표 & 정산서 화면 (statement.html / batch_statements.html) */
html[data-theme="dark"] .batch-statements-workspace {
  background: #0b0f19 !important;
}
html[data-theme="dark"] .batch-statements-workspace .toolbar {
  background: #151e2e !important;
  border-color: #243447 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}
html[data-theme="dark"] .batch-statements-workspace .toolbar :is(a, button):not(.print) {
  background: #1c293c !important;
  color: #f8fafc !important;
  border-color: #2d4056 !important;
}
html[data-theme="dark"] .batch-statements-workspace .toolbar :is(a, button):not(.print):hover {
  background: #24364e !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .batch-statements-workspace .field span {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .batch-statements-workspace .field :is(input, select) {
  background: #131d2b !important;
  color: #f8fafc !important;
  border-color: #33465e !important;
}
html[data-theme="dark"] .batch-statements-workspace .switch-container {
  background: #1c293c !important;
  border-color: #2d4056 !important;
  color: #cbd5e1 !important;
}

/* ==========================================================================
   📸 스크린샷·사진 품목 AI 일괄 등록 (Vision OCR) 스타일
   ========================================================================== */
.catalog-top-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* 우측 상단 은은한 스텔스 버튼 (잘 보이지 않고 숨겨진 기능 느낌) */
.btn-stealth-vision {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 700;
  color: #64748b;
  background: rgba(100, 116, 139, 0.08);
  border: 1px dashed #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-stealth-vision:hover {
  color: #0f172a;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid #10b981;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
  transform: translateY(-1px);
}
.btn-stealth-vision .stealth-icon {
  font-size: 15px;
  opacity: 0.8;
}

/* 모달 다이얼로그 (24인치 & 모바일 최적화 대형 와이드 모달) */
.catalog-vision-modal-dialog {
  width: 95vw;
  max-width: 1340px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.vision-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 드롭존 */
.vision-dropzone {
  border: 2px dashed #94a3b8;
  border-radius: 14px;
  background: #f8fafc;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.vision-dropzone:hover,
.vision-dropzone.drag-over {
  border-color: #10b981;
  background: #f0fdf4;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}
.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.dropzone-icon {
  font-size: 34px;
  margin-bottom: 2px;
}
.dropzone-title {
  font-size: 16px;
  font-weight: 800;
  color: #1e293b;
}
.dropzone-desc {
  font-size: 13.5px;
  color: #64748b;
  margin: 0;
}
.dropzone-tags {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.drop-tag {
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
}

/* 프로그레스 카드 */
.vision-progress-card {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.progress-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.progress-title-row strong {
  font-size: 14.5px;
  color: #1e40af;
}
.progress-pct {
  font-size: 15px;
  font-weight: 850;
  color: #2563eb;
}
.spinner-pulse {
  width: 14px;
  height: 14px;
  border: 2.5px solid #60a5fa;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spinVision 0.8s linear infinite;
  display: inline-block;
}
@keyframes spinVision {
  to { transform: rotate(360deg); }
}
.progress-bar-track {
  height: 8px;
  background: #dbeafe;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.progress-sub {
  font-size: 13px;
  color: #64748b;
  margin: 8px 0 0;
}

/* 결과 툴바 */
.vision-result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  flex-wrap: wrap;
}
.result-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}
.result-stats strong {
  font-size: 15px;
  color: #0f172a;
}
.stat-pill {
  font-size: 13px;
  font-weight: 750;
  padding: 3px 8px;
  border-radius: 6px;
}
.stat-pill.new-pill {
  background: #dcfce7;
  color: #15803d;
}
.stat-pill.dup-pill {
  background: #fef3c7;
  color: #b45309;
}
.result-actions-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-tool-sm {
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 750;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-tool-sm:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.btn-tool-primary {
  border-color: #10b981;
  color: #059669;
  background: #f0fdf4;
}
.btn-tool-primary:hover {
  background: #dcfce7;
}
.btn-tool-add {
  color: #2563eb;
  border-color: #bfdbfe;
  background: #eff6ff;
}
.btn-tool-danger {
  color: #dc2626;
  border-color: #fecaca;
}
.btn-tool-danger:hover {
  background: #fee2e2;
}
.dup-action-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.dup-label {
  color: #64748b;
  font-weight: 700;
}
.dup-select {
  height: 36px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
}
.vision-filter-input {
  height: 36px;
  width: 170px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

/* 결과 테이블 */
.vision-table-scroll {
  width: 100%;
  max-height: 480px;
  overflow: auto;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
}
.vision-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
.vision-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 42px;
  padding: 0 10px;
  background: #f1f5f9;
  color: #334155;
  font-weight: 800;
  text-align: left;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
}
.vision-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
  background: #ffffff;
}
.vision-table tbody tr:hover td {
  background: #f8fafc;
}
.vision-row-dup td {
  background: #fffbeb;
}
.vision-row-dup:hover td {
  background: #fef3c7;
}

/* 셀 내부 인풋 */
.cell-input {
  width: 100%;
  height: 36px;
  padding: 0 8px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
}
.cell-input:focus {
  border-color: #10b981;
  outline: none;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}
.cell-select {
  height: 36px;
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  min-width: 70px;
}
.price-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  max-width: 100px;
}
.price-sale {
  color: #059669;
}
.badge-new {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: #dcfce7;
  color: #166534;
  white-space: nowrap;
}
.badge-dup {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  white-space: nowrap;
  cursor: help;
}
.btn-cell-del {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  border-radius: 6px;
}
.btn-cell-del:hover {
  color: #dc2626;
  background: #fee2e2;
}

/* 모달 푸터 */
.vision-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.footer-hint {
  font-size: 13.5px;
  color: #64748b;
  font-weight: 600;
}
.footer-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}
.btn-vision-submit {
  min-height: 44px;
  padding: 0 24px;
  font-size: 15px;
  font-weight: 850;
  background: #10b981;
  color: #ffffff;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.btn-vision-submit:hover:not(:disabled) {
  background: #059669;
  transform: translateY(-1px);
}
.btn-vision-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* ==========================================================================
   🌙 다크 모드 지원 (옵시디언 슬레이트)
   ========================================================================== */
html[data-theme="dark"] .btn-stealth-vision {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.08);
  border-color: #33465e;
}
html[data-theme="dark"] .btn-stealth-vision:hover {
  color: #f8fafc;
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
}
html[data-theme="dark"] .catalog-vision-modal-dialog {
  background: #151e2e;
  border: 1px solid #243447;
  color: #f8fafc;
}
html[data-theme="dark"] .vision-dropzone {
  border-color: #33465e;
  background: #0f172a;
}
html[data-theme="dark"] .vision-dropzone:hover,
html[data-theme="dark"] .vision-dropzone.drag-over {
  border-color: #10b981;
  background: #132e24;
}
html[data-theme="dark"] .dropzone-title {
  color: #f8fafc;
}
html[data-theme="dark"] .dropzone-desc {
  color: #94a3b8;
}
html[data-theme="dark"] .drop-tag {
  background: #1e2b3e;
  border-color: #33465e;
  color: #cbd5e1;
}
html[data-theme="dark"] .vision-progress-card {
  background: #172554;
  border-color: #1e40af;
}
html[data-theme="dark"] .progress-title-row strong {
  color: #93c5fd;
}
html[data-theme="dark"] .progress-pct {
  color: #60a5fa;
}
html[data-theme="dark"] .progress-bar-track {
  background: #1e3a8a;
}
html[data-theme="dark"] .progress-sub {
  color: #bfdbfe;
}
html[data-theme="dark"] .vision-result-toolbar {
  background: #111a28;
  border-color: #243447;
}
html[data-theme="dark"] .result-stats strong {
  color: #f8fafc;
}
html[data-theme="dark"] .btn-tool-sm {
  background: #1e2b3e;
  border-color: #33465e;
  color: #cbd5e1;
}
html[data-theme="dark"] .btn-tool-sm:hover {
  background: #24364e;
  color: #ffffff;
}
html[data-theme="dark"] .btn-tool-primary {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  color: #34d399;
}
html[data-theme="dark"] .dup-label {
  color: #94a3b8;
}
html[data-theme="dark"] .dup-select {
  background: #131d2b;
  border-color: #33465e;
  color: #f8fafc;
}
html[data-theme="dark"] .vision-filter-input {
  background: #131d2b;
  border-color: #33465e;
  color: #f8fafc;
}
html[data-theme="dark"] .vision-table-scroll {
  border-color: #243447;
}
html[data-theme="dark"] .vision-table th {
  background: #182334;
  color: #cbd5e1;
  border-bottom-color: #243447;
}
html[data-theme="dark"] .vision-table td {
  background: #131c2b;
  border-bottom-color: #202c3b;
  color: #f1f5f9;
}
html[data-theme="dark"] .vision-table tbody tr:hover td {
  background: #1e2b3e;
}
html[data-theme="dark"] .vision-row-dup td {
  background: rgba(251, 191, 36, 0.12);
}
html[data-theme="dark"] .vision-row-dup:hover td {
  background: rgba(251, 191, 36, 0.2);
}
html[data-theme="dark"] .cell-input {
  background: #152234;
  border-color: #2c3e56;
  color: #f8fafc;
}
html[data-theme="dark"] .cell-input:focus {
  border-color: #10b981;
}
html[data-theme="dark"] .cell-select {
  background: #152234;
  border-color: #2c3e56;
  color: #f8fafc;
}
html[data-theme="dark"] .price-sale {
  color: #34d399;
}
html[data-theme="dark"] .vision-modal-footer {
  background: #111a28;
  border-top-color: #243447;
}
html[data-theme="dark"] .footer-hint {
  color: #94a3b8;
}

/* ==========================================================================
   🎙️ 인터랙티브 음성 도슨트 투어 리모컨 바 (Audio Tour Bar)
   ========================================================================== */
.audio-tour-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 580px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 30px rgba(16, 185, 129, 0.25);
  padding: 16px 20px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  animation: tourBarSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tourBarSlideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 40px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.tour-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tour-bar-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.tour-bar-title {
  color: #f8fafc;
  font-size: 16px;
  font-weight: 750;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tour-bar-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.tour-bar-close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.tour-bar-caption {
  color: #f1f5f9;
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.5;
  word-break: keep-all;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.tour-bar-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 2px;
}

.tour-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.18s ease;
  min-height: 38px;
}
.tour-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}
.tour-ctrl-btn:active {
  transform: translateY(0);
}

.tour-ctrl-btn.tour-ctrl-play {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(52, 211, 153, 0.6);
  color: #34d399;
}
.tour-ctrl-btn.tour-ctrl-play:hover {
  background: rgba(16, 185, 129, 0.4);
  color: #ffffff;
  border-color: #34d399;
}

/* 모바일 반응형 */
@media (max-width: 680px) {
  .audio-tour-bar {
    bottom: 74px; /* 모바일 바텀 네비게이션 위에 안착 */
    width: calc(100% - 20px);
    padding: 14px 16px;
    border-radius: 16px;
  }
  .tour-bar-title {
    font-size: 15px;
  }
  .tour-bar-caption {
    font-size: 13px;
    max-height: 60px;
  }
  .tour-ctrl-btn {
    padding: 6px 14px;
    font-size: 13px;
    min-height: 36px;
  }
}

/* ==========================================================================
   ⚡ [입금 관리 업그레이드] 승인 대기 워크스페이스 & 입금자명 자동화 설정
   ========================================================================== */

/* 1. 최상단 승인 대기 워크스페이스 */
.pending-deposits-workspace {
  margin-bottom: 22px;
  background: #fffbeb;
  border: 2px solid #f59e0b;
  border-radius: 14px;
  padding: 18px 22px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12);
}

.pdw-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px dashed #fcd34d;
}

.pdw-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pdw-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f59e0b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.pdw-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pdw-heading {
  margin: 0;
  font-size: 17.5px;
  font-weight: 850;
  color: #92400e;
}

.pdw-counter-pill {
  display: inline-flex;
  align-items: center;
  background: #d97706;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
}

.pdw-desc {
  margin: 4px 0 0 0;
  font-size: 13.5px;
  color: #78350f;
  line-height: 1.45;
}

.btn-pdw-approve-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #16a34a;
  color: #ffffff;
  border: 1px solid #15803d;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}

.btn-pdw-approve-all:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.pdw-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.pending-item-card {
  background: #ffffff;
  border: 1.5px solid #fde68a;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.08);
  transition: all 0.2s ease;
}

.pending-item-card:hover {
  border-color: #f59e0b;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.pic-left-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 280px;
}

.pic-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.pic-date {
  color: #64748b;
  font-weight: 600;
}

.pic-bank-tag {
  background: #f1f5f9;
  color: #475569;
  padding: 2px 8px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 13px;
}

.badge-pending-chip {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
}

.pic-core-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.pic-sub-label {
  display: block;
  font-size: 13px;
  color: #64748b;
  margin-bottom: 2px;
}

.pic-depositor-name {
  font-size: 16px;
  font-weight: 850;
  color: #0f172a;
}

.pic-arrow {
  color: #94a3b8;
  font-size: 16px;
  font-weight: bold;
}

.pic-partner-name {
  font-size: 16px;
  font-weight: 850;
}

.pic-partner-phone {
  font-size: 13.5px;
  color: #64748b;
  margin-left: 4px;
}

.pic-amount-box {
  margin-left: auto;
  text-align: right;
}

.pic-amount-val {
  font-size: 19px;
  font-weight: 850;
}

.pic-memo-line {
  font-size: 13px;
  color: #64748b;
  background: #f8fafc;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}

.pic-memo-lbl {
  font-weight: 700;
  color: #475569;
}

/* 우측 초간편 액션 버튼 3총사 */
.pic-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.btn-act-yes {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #16a34a;
  color: #ffffff;
  border: 1px solid #15803d;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
  white-space: nowrap;
}

.btn-act-yes:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.btn-act-relink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #1d4ed8;
  padding: 9px 15px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-act-relink:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-act-no {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 750;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-act-no:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* 인라인 거래처 빠른 변경 드롭박스 패널 */
.pic-relink-panel {
  width: 100%;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 10px;
}

.relink-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.relink-prompt {
  font-size: 13.5px;
  font-weight: 750;
  color: #1e293b;
}

.relink-filter-input {
  height: 38px;
  font-size: 14px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  min-width: 250px;
}

.relink-partner-options {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 10px 0;
  border-bottom: 1px solid #e2e8f0;
}

.relink-opt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.12s ease;
}

.relink-opt-btn:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  transform: translateY(-1px);
}

.relink-opt-btn .ro-phone {
  font-size: 13px;
  color: #64748b;
}

.relink-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.relink-chk-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: #334155;
  cursor: pointer;
}

.pdw-all-done-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #ecfdf5;
  border: 1.5px solid #6ee7b7;
  border-radius: 10px;
  padding: 16px 20px;
}

.padb-icon {
  font-size: 26px;
}

.padb-text strong {
  font-size: 15px;
  color: #065f46;
  display: block;
}

.padb-text p {
  margin: 3px 0 0 0;
  font-size: 13.5px;
  color: #047857;
}

/* ==========================================================================
   2. 세련된 입금자명 매핑 & 자동화 설정 (rules 탭)
   ========================================================================== */

/* 콤팩트 전체 자동화 상태 바 */
.rules-header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 18px;
  border: 1.5px solid;
}

.rules-header-card.is-auto-active {
  background: #f0fdf4;
  border-color: #86efac;
}

.rules-header-card.is-auto-paused {
  background: #fffbeb;
  border-color: #fde68a;
}

.rhc-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.rhc-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.is-auto-active .rhc-icon-badge {
  background: #10b981;
  color: #ffffff;
}

.is-auto-paused .rhc-icon-badge {
  background: #f59e0b;
  color: #ffffff;
}

.rhc-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rhc-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 850;
  color: #0f172a;
}

.badge-status-on {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  font-size: 13px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 20px;
}

.badge-status-off {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
  font-size: 13px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 20px;
}

.rhc-desc {
  margin: 3px 0 0 0;
  font-size: 13.5px;
  color: #475569;
  line-height: 1.4;
}

/* 상단 전체 자동화 토글 박스 */
.global-toggle-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  padding: 8px 16px;
  border-radius: 30px;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.gtb-desc-label {
  font-size: 14px;
  font-weight: 800;
  color: #334155;
}

/* ==========================================================================
   범용 UI 토글 스위치 컴포넌트 (iOS / Modern Toggle Switch)
   ========================================================================== */
.ui-toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  font-weight: 750;
  color: #334155;
}

.ui-toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.ui-toggle-slider {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background-color: #94a3b8;
  border-radius: 24px;
  transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
  flex-shrink: 0;
}

.ui-toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ui-toggle-switch input[type="checkbox"]:checked + .ui-toggle-slider {
  background-color: #16a34a;
}

.ui-toggle-switch input[type="checkbox"]:checked + .ui-toggle-slider::before {
  transform: translateX(20px);
}

.ui-toggle-switch:hover .ui-toggle-slider {
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.ui-toggle-label {
  font-size: 13.5px;
  font-weight: 750;
  color: #1e293b;
  white-space: nowrap;
}

/* 대형 토글 (상단 전체 자동화용) */
.ui-toggle-lg .ui-toggle-slider {
  width: 52px;
  height: 28px;
  border-radius: 28px;
}

.ui-toggle-lg .ui-toggle-slider::before {
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
}

.ui-toggle-lg input[type="checkbox"]:checked + .ui-toggle-slider::before {
  transform: translateX(24px);
}

.ui-toggle-lg .ui-toggle-label {
  font-size: 14.5px;
  font-weight: 850;
  color: #0f172a;
}

/* 폼 인라인용 토글 박스 */
.ui-toggle-form {
  height: 42px;
  padding: 0 14px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ui-toggle-form:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* 1줄 인라인 신규 등록 툴바 */
.rule-quick-add-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.rqc-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.rqc-title {
  font-size: 15.5px;
  font-weight: 850;
  color: #0f172a;
}

.rqc-sub {
  font-size: 13px;
  color: #64748b;
}

.rqc-form-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.rqc-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rqc-label {
  font-size: 13px;
  font-weight: 750;
  color: #475569;
}

.rqc-field-name {
  flex: 1.2;
  min-width: 180px;
}

.rqc-field-arrow {
  padding-bottom: 10px;
}

.rqc-arrow-icon {
  font-size: 18px;
  color: #94a3b8;
  font-weight: bold;
}

.rqc-field-partner {
  flex: 1.5;
  min-width: 220px;
}

.rqc-field-mode {
  flex: 1.1;
  min-width: 170px;
}

.rqc-toggle-wrap {
  display: flex;
  align-items: center;
}

.rqc-field-btn {
  padding-bottom: 0;
}

.rqc-input,
.rqc-select {
  height: 42px;
  font-size: 14px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
}

.rqc-btn-submit {
  height: 42px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

/* 입금자명 테이블 내 스타일 */
.rule-keyword-badge {
  font-size: 14.5px;
  color: #0f172a;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.badge-pending-cell {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
  font-size: 13px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
}

/* 모달 힌트 옵션 */
.hint-option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hint-sub-option-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 13px;
  color: #92400e;
  cursor: pointer;
}

/* 토스트 알림 */
.deposit-hub-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 750;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s ease;
}

.deposit-hub-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.deposit-hub-toast.toast-success {
  background: #15803d;
}

.deposit-hub-toast.toast-error {
  background: #b91c1c;
}

.deposit-hub-toast.toast-info {
  background: #1e293b;
}

/* ==========================================================================
   🌙 다크 모드 (html[data-theme="dark"]) 호환 스타일
   ========================================================================== */
html[data-theme="dark"] .pending-deposits-workspace {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
}

html[data-theme="dark"] .pdw-heading {
  color: #fde68a !important;
}

html[data-theme="dark"] .pdw-desc {
  color: #fcd34d !important;
}

html[data-theme="dark"] .pending-item-card {
  background: #1e293b !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

html[data-theme="dark"] .pending-item-card:hover {
  border-color: #f59e0b !important;
}

html[data-theme="dark"] .pic-depositor-name {
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .pic-memo-line {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

html[data-theme="dark"] .pic-memo-lbl {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .pic-relink-panel {
  background: #0f172a !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .relink-prompt {
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .relink-filter-input {
  background: #1e293b !important;
  border-color: #475569 !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .relink-opt-btn {
  background: #1e293b !important;
  border-color: #475569 !important;
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .relink-opt-btn:hover {
  background: #1e3a8a !important;
  border-color: #3b82f6 !important;
}

html[data-theme="dark"] .btn-act-no {
  background: #334155 !important;
  color: #cbd5e1 !important;
  border-color: #475569 !important;
}

html[data-theme="dark"] .rules-header-card.is-auto-active {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

html[data-theme="dark"] .rules-header-card.is-auto-paused {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
}

html[data-theme="dark"] .rhc-title {
  color: #f8fafc !important;
}

html[data-theme="dark"] .rhc-desc {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .global-toggle-box {
  background: #1e293b !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .gtb-desc-label {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .ui-toggle-slider {
  background-color: #475569 !important;
}

html[data-theme="dark"] .ui-toggle-switch input[type="checkbox"]:checked + .ui-toggle-slider {
  background-color: #10b981 !important;
}

html[data-theme="dark"] .ui-toggle-label {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui-toggle-lg .ui-toggle-label {
  color: #f8fafc !important;
}

html[data-theme="dark"] .ui-toggle-form {
  background: #0f172a !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .ui-toggle-form:hover {
  background: #1e293b !important;
  border-color: #475569 !important;
}

html[data-theme="dark"] .rule-quick-add-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .rqc-title {
  color: #f8fafc !important;
}

html[data-theme="dark"] .rqc-sub {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .rqc-label {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .rqc-input,
html[data-theme="dark"] .rqc-select {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .rule-keyword-badge {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .hint-sub-option-box {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #fde68a !important;
}

html[data-theme="dark"] .import-mode-card {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}

html[data-theme="dark"] .import-mode-card.is-overwrite-mode {
  background: rgba(168, 85, 247, 0.12) !important;
  border-color: rgba(168, 85, 247, 0.4) !important;
}

html[data-theme="dark"] .imc-title {
  color: #f8fafc !important;
}

html[data-theme="dark"] .imc-desc {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .preview-mode-banner.is-safe {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #86efac !important;
}

html[data-theme="dark"] .preview-mode-banner.is-overwrite {
  background: rgba(168, 85, 247, 0.12) !important;
  border-color: rgba(168, 85, 247, 0.4) !important;
  color: #d8b4fe !important;
}

html[data-theme="dark"] .stat-badge.update {
  background: rgba(168, 85, 247, 0.2) !important;
  color: #d8b4fe !important;
  border-color: rgba(168, 85, 247, 0.4) !important;
}

html[data-theme="dark"] .badge-update {
  background: rgba(168, 85, 247, 0.2) !important;
  color: #d8b4fe !important;
  border-color: rgba(168, 85, 247, 0.4) !important;
}

@media (max-width: 768px) {
  .pdw-header {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-pdw-approve-all {
    width: 100%;
    justify-content: center;
  }
  .pending-item-card {
    flex-direction: column;
    align-items: stretch;
  }
  .pic-amount-box {
    margin-left: 0;
    text-align: left;
  }
  .pic-actions {
    width: 100%;
  }
  .btn-act-yes,
  .btn-act-relink,
  .btn-act-no {
    flex: 1;
    justify-content: center;
  }
  .rqc-form-row {
    flex-direction: column;
    align-items: stretch;
  }
  .rqc-field-arrow {
    display: none;
  }
  .rqc-btn-submit {
    width: 100%;
  }
}

/* ==========================================================================
   개별 품목 비고(메모) 버튼 및 모달 다이얼로그 (24인치 모니터 & 모바일 표준 준수)
   ========================================================================== */

/* 1. 전체 주문표(sheet view) 비고 버튼 */
.daily-order-sheet th.col-note {
  width: 90px;
  min-width: 80px;
  text-align: center;
}
.daily-order-sheet td.note-cell {
  text-align: center;
  padding: 4px 6px;
  vertical-align: middle;
}
.btn-item-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  max-width: 130px;
  box-sizing: border-box;
}
.btn-item-note:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
  color: #1e293b;
}
.btn-item-note.has-note {
  border-color: #86efac;
  background: #f0fdf4;
  color: #15803d;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(22, 101, 52, 0.08);
}
.btn-item-note.has-note:hover {
  border-color: #4ade80;
  background: #dcfce7;
}
.note-text-preview {
  display: inline-block;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.note-text-placeholder {
  font-size: 13px;
}

/* 2. 모바일 주문표(mobile sheet) 비고 버튼 */
.mobile-sheet-note-wrap {
  margin-top: 5px;
}
.btn-item-note-mobile {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  min-height: 24px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  max-width: 100%;
}
.btn-item-note-mobile.has-note {
  border-color: #86efac;
  background: #f0fdf4;
  color: #15803d;
  font-weight: 700;
}
.note-mobile-text {
  font-size: 13px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 3. 주문별 보기(flat) & 거래처별 보기(partner) 품목 행 비고 버튼 */
.flat-note-wrap {
  margin-top: 4px;
}
.btn-item-note-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  min-height: 26px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-item-note-inline:hover {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}
.btn-item-note-inline.has-note {
  border-color: #86efac;
  background: #f0fdf4;
  color: #15803d;
  font-weight: 700;
}
.note-inline-text {
  font-size: 13px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-inline-placeholder {
  font-size: 13px;
}

/* 4. 비고 입력/수정 팝업 다이얼로그 (itemNoteDialog) */
dialog.item-note-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 440px;
  background: #ffffff;
  overflow: hidden;
}
dialog.item-note-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.item-note-dialog-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.note-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 10px;
}
.note-dialog-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.note-dialog-badge {
  display: inline-block;
  padding: 2px 7px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
}
.note-dialog-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
  color: #1e293b;
}
.note-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.note-field-group label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.note-field-group label strong {
  font-size: 14px;
  color: #1e293b;
}
.note-tip-text {
  font-size: 13px;
  color: #64748b;
  line-height: 1.4;
}
.item-note-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: #1e293b;
  background: #ffffff;
  resize: vertical;
  min-height: 85px;
}
.item-note-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.item-note-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  gap: 8px;
}
.btn-clear-note {
  color: #ef4444 !important;
  font-size: 13px !important;
  min-height: 36px !important;
  padding: 0 10px !important;
}
.btn-clear-note:hover {
  background: #fef2f2 !important;
}

/* 5. 거래명세서 품목 테이블 비고 셀 스타일 */
.items td.note-cell-text {
  text-align: left;
  padding: 3px 6px;
  font-size: 11px;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}
body.dual-print-mode .items td.note-cell-text {
  font-size: 9.5px !important;
  padding: 2px 4px !important;
  max-width: 80px !important;
}
@media print {
  .items td.note-cell-text {
    font-size: 9.5px !important;
    white-space: normal !important;
    word-break: break-all !important;
    line-height: 1.2 !important;
  }
}

/* ==========================================================================
   다중 영수증 일괄 검수 네비게이터 & 배치 툴바 (24인치 모니터 & 모바일 표준 최적화)
   ========================================================================== */
.badge-multi-upload {
  display: inline-block;
  background: rgba(255, 255, 255, 0.25);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  margin-left: 4px;
}
html[data-theme="dark"] .badge-multi-upload {
  background: rgba(255, 255, 255, 0.15);
}

.pi-batch-nav-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(22, 101, 52, 0.08);
  margin-bottom: 4px;
  flex-wrap: wrap;
}
html[data-theme="dark"] .pi-batch-nav-toolbar {
  background: #064e3b;
  border-color: #059669;
}

.batch-nav-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-batch-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 14px;
  background: #ffffff;
  border: 1.5px solid #16a34a;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: #166534;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-batch-nav:hover:not(:disabled) {
  background: #dcfce7;
  border-color: #15803d;
}
.btn-batch-nav:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: #cbd5e1;
  color: #94a3b8;
}
html[data-theme="dark"] .btn-batch-nav {
  background: #0f172a;
  border-color: #10b981;
  color: #86efac;
}

.batch-counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #dcfce7;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 850;
  color: #14532d;
  white-space: nowrap;
}
html[data-theme="dark"] .batch-counter-badge {
  background: #022c22;
  color: #6ee7b7;
}
.batch-current-num {
  font-size: 16px;
  color: #15803d;
  font-weight: 900;
}
.batch-slash {
  color: #86efac;
}
.batch-total-num {
  font-size: 15px;
}
.batch-label {
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
  margin-left: 2px;
}
html[data-theme="dark"] .batch-label {
  color: #9ca3af;
}

.batch-dots-scroll-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  max-width: 450px;
  padding: 4px 2px;
  scrollbar-width: thin;
}
.batch-receipt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.batch-receipt-chip:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.batch-receipt-chip.active {
  background: #15803d;
  border-color: #15803d;
  color: #ffffff;
  font-weight: 850;
  box-shadow: 0 2px 6px rgba(21, 128, 61, 0.25);
}
.batch-receipt-chip .chip-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  font-size: 11px;
}
.batch-receipt-chip.active .chip-num {
  background: rgba(255, 255, 255, 0.3);
}

.batch-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-batch-exclude {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 12px;
  background: #ffffff;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 750;
  color: #b91c1c;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-batch-exclude:hover {
  background: #fef2f2;
  border-color: #ef4444;
}
html[data-theme="dark"] .btn-batch-exclude {
  background: #1c1917;
  border-color: #7f1d1d;
  color: #fca5a5;
}

.btn-batch-all-approve {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  background: #16a34a;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 850;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
  white-space: nowrap;
}
.btn-batch-all-approve:hover {
  background: #15803d;
  transform: translateY(-1px);
}
/* 전표 저장 및 검수 버튼 영역 (좌우 2분할 레이아웃) */
.pi-card-submit-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  width: 100%;
}

.pi-save-buttons-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}

.pi-save-buttons-row.is-batch-mode {
  grid-template-columns: 1fr 1fr;
}

.pi-save-buttons-row .btn-pi-submit {
  width: 100%;
  min-height: 48px;
  padding: 0 10px;
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 850;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.pi-save-buttons-row .btn-pi-submit:hover {
  background: #047857;
  transform: translateY(-1px);
}

.pi-save-buttons-row .btn-pi-batch-save-next {
  width: 100%;
  min-height: 48px;
  padding: 0 10px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 850;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.pi-save-buttons-row .btn-pi-batch-save-next:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.pi-card-submit-group .btn-pi-cancel {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  color: #475569 !important;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
  transition: background 0.15s;
}

.pi-card-submit-group .btn-pi-cancel:hover {
  background: #e2e8f0;
  color: #1e293b !important;
}

/* 모바일 좁은 화면: 두 버튼이 줄바꿈되지 않도록 또는 적절히 조절 */
@media (max-width: 480px) {
  .pi-save-buttons-row.is-batch-mode {
    grid-template-columns: 1fr;
  }
}

/* 배치 업로드 진행률 바 */
.pi-batch-progress-box {
  margin-top: 16px;
  text-align: left;
}
.pi-batch-progress-track {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.pi-batch-progress-fill {
  height: 100%;
  background: #10b981;
  border-radius: 999px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.pi-batch-progress-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 750;
  color: #475569;
}
html[data-theme="dark"] .pi-batch-progress-track {
  background: #1e293b;
}
html[data-theme="dark"] .pi-batch-progress-stats {
  color: #94a3b8;
}
