:root{--bg:#f5f7fb;--card:#fff;--line:#e3e8f0;--text:#172033;--muted:#718096;--blue:#2864dc;--green:#16805f;--red:#c83e4d}
*{box-sizing:border-box}body{margin:0;background:var(--bg);font-family:Inter,"Pretendard","Noto Sans KR","Malgun Gothic",sans-serif;color:var(--text)}
.wrap{max-width:1500px;margin:0 auto;padding:34px}header{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px}.eyebrow{font-size:12px;font-weight:800;color:var(--blue);letter-spacing:.11em}h1{font-size:28px;margin:5px 0}header p{margin:0;color:var(--muted);font-size:13px}.badge{background:#eaf1ff;color:#235cca;border-radius:999px;padding:9px 13px;font-size:12px;font-weight:800}
.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:20px;box-shadow:0 10px 32px rgba(26,38,68,.06);margin-bottom:18px}.query{display:flex;gap:20px;align-items:end}.field{min-width:360px;flex:1}label{display:block;font-weight:800;font-size:13px;margin-bottom:7px}input{width:100%;padding:11px 13px;border:1px solid #d7deea;border-radius:9px;font-size:19px;font-weight:750}small{display:block;color:var(--muted);margin-top:7px}
button{border:0;border-radius:9px;padding:11px 16px;font-weight:800;cursor:pointer}.primary{background:var(--blue);color:#fff}.secondary{background:#edf1f7;color:#344056}.secondary:disabled{opacity:.45;cursor:not-allowed}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:18px}.stat{background:#fff;border:1px solid var(--line);border-radius:14px;padding:16px 19px}.stat span{display:block;color:var(--muted);font-size:12px}.stat strong{display:block;margin-top:4px;font-size:20px}.head{display:flex;justify-content:space-between;align-items:center}.head h2{font-size:16px;margin:0}.head span{color:var(--muted);font-size:12px}
.table-wrap{overflow:auto;max-height:520px;margin-top:14px;border:1px solid var(--line);border-radius:10px}.table-wrap.short{max-height:300px}table{border-collapse:collapse;width:100%;font-size:12px;white-space:nowrap}th,td{padding:9px 10px;border-bottom:1px solid #edf0f4;text-align:left}th{position:sticky;top:0;background:#f7f9fc;z-index:1}tr.clickable{cursor:pointer}tr.clickable:hover{background:#f6f9ff}.st-queued{color:#7a5b00}.st-claimed,.st-running{color:#235cca}.st-done{color:#107457}.st-error{color:#b42e40}
#toast{position:fixed;right:24px;bottom:24px;background:#172033;color:#fff;padding:12px 15px;border-radius:10px;opacity:0;transition:.2s;pointer-events:none}#toast.show{opacity:1}
@media(max-width:760px){.wrap{padding:18px}.query{flex-direction:column;align-items:stretch}.field{min-width:0}.stats{grid-template-columns:1fr}header{align-items:flex-start;gap:15px}}
.header-right{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.badge.agent-online{background:#e9f8f1;color:#107457}
.badge.agent-offline{background:#fff0f2;color:#b42e40}

.head-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.head-actions select{padding:8px 10px;border:1px solid #d7dce3;border-radius:8px;background:#fff}
.error-box{margin:0 0 12px;padding:12px 14px;border:1px solid #efb7bd;border-radius:10px;background:#fff4f5;color:#9f2635;white-space:pre-wrap;word-break:break-word}
tr.is-error td{background:#fff8f8}
.retry-note{font-size:12px;color:#6d7480}

.top-tabs{display:flex;gap:8px;margin:14px 0 18px}
.tab-btn{border:1px solid #d7dce3;background:#fff;border-radius:10px;padding:10px 16px;font-weight:700;cursor:pointer}
.tab-btn.active{background:#151a22;color:#fff;border-color:#151a22}
.tab-panel{display:none}
.tab-panel.active{display:block}
.material-toolbar{display:grid;grid-template-columns:minmax(260px,1fr) 160px 150px auto;gap:10px;margin:14px 0}
.material-toolbar input,.material-toolbar select,.form-grid input,.form-grid select,.form-grid textarea{width:100%;box-sizing:border-box;border:1px solid #d7dce3;border-radius:8px;padding:9px 10px;background:#fff}
.material-summary{margin:8px 0 10px;color:#667085}
#materials td,#materials th{white-space:nowrap}
#materials tr.clickable:hover td{background:#f7f9fc}
.type-inout{font-weight:700;color:#165d42}
.type-outbound{font-weight:700;color:#475467}
.modal-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.38);display:flex;align-items:center;justify-content:center;padding:20px;z-index:1000}
.modal-backdrop[hidden]{display:none}
.modal{width:min(760px,96vw);max-height:90vh;overflow:auto;background:#fff;border-radius:16px;box-shadow:0 22px 60px rgba(0,0,0,.24);padding:20px}
.modal-head,.modal-actions{display:flex;align-items:center;gap:10px}
.modal-head{justify-content:space-between;margin-bottom:16px}
.icon-btn{border:0;background:transparent;font-size:28px;cursor:pointer;line-height:1}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.form-grid label{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:700}
.form-grid .span2{grid-column:1 / -1}
.modal-actions{margin-top:18px}
.modal-actions .spacer{flex:1}
.danger{border:1px solid #d92d20;background:#fff;color:#b42318;border-radius:8px;padding:9px 14px;font-weight:700;cursor:pointer}
@media(max-width:800px){
  .material-toolbar{grid-template-columns:1fr 1fr}
  .form-grid{grid-template-columns:1fr}
  .form-grid .span2{grid-column:auto}
}

[hidden]{display:none!important}

.match-stats{grid-template-columns:repeat(5,minmax(130px,1fr));margin:14px 0}
.match-ok{border-left:4px solid #32a071}
.match-warn{border-left:4px solid #e39a27}
.match-danger{border-left:4px solid #d04b5b}
.matching-toolbar{grid-template-columns:minmax(280px,1fr) 160px 160px auto}
.match-notice{margin:6px 0 12px;color:#667085;font-size:13px}
.match-badge{display:inline-block;padding:4px 8px;border-radius:999px;font-size:12px;font-weight:800;white-space:nowrap}
.match-badge.matched{background:#e9f8f1;color:#107457}
.match-badge.unregistered{background:#fff7e8;color:#9a5b00}
.match-badge.duplicate{background:#fff0f2;color:#b42e40}
.match-badge.no_edi{background:#f2f4f7;color:#475467}
#matchingTable tr.row-unregistered td{background:#fffdf7}
#matchingTable tr.row-duplicate td{background:#fff8f8}
#matchingTable tr.row-no_edi td{background:#f9fafb}
.candidate-list{font-size:12px;line-height:1.5;white-space:normal;min-width:220px}
@media(max-width:1000px){.match-stats{grid-template-columns:repeat(2,1fr)}.matching-toolbar{grid-template-columns:1fr 1fr}}

.patient-match-layout{display:grid;grid-template-columns:280px minmax(0,1fr);gap:14px;align-items:start}
.patient-list-card,.patient-material-card{border:1px solid #e4e7ec;border-radius:12px;background:#fff}
.patient-list-card{overflow:hidden;position:sticky;top:10px}
.patient-list-head{display:flex;justify-content:space-between;align-items:center;padding:13px 14px;border-bottom:1px solid #eef0f3}
.patient-search{width:calc(100% - 20px);margin:10px;box-sizing:border-box;border:1px solid #d7dce3;border-radius:8px;padding:9px 10px}
.patient-list{max-height:620px;overflow:auto}
.patient-item{width:100%;border:0;border-top:1px solid #f0f2f5;background:#fff;text-align:left;padding:12px 14px;cursor:pointer}
.patient-item:hover{background:#f7f9fc}
.patient-item.active{background:#eef5ff}
.patient-item strong{display:block;margin-bottom:4px}
.patient-item .meta{font-size:12px;color:#667085;line-height:1.45}
.patient-material-card{padding:14px}
.selected-patient-head{display:flex;align-items:center;justify-content:space-between;padding:2px 2px 12px}
.selected-patient-head strong{font-size:17px}
#selectedPatientMeta{font-size:12px;color:#667085;margin-top:5px}
.match-badge.excluded{background:#f2f4f7;color:#475467}
#matchingTable tr.row-excluded td{background:#f8f9fb;color:#667085}
.price-source{font-size:11px;color:#667085;white-space:nowrap}
@media(max-width:980px){
  .patient-match-layout{grid-template-columns:1fr}
  .patient-list-card{position:static}
  .patient-list{max-height:280px}
}

.reconcile-stats{grid-template-columns:repeat(6,minmax(130px,1fr));margin:14px 0}
.reconcile-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.reconcile-box{border:1px solid #dfe3e8;border-radius:12px;background:#fff;overflow:hidden}
.reconcile-title{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;background:#f7f9fc;border-bottom:1px solid #e9edf2}
.reconcile-title span{font-size:12px;color:#667085}
.reconcile-table-wrap{max-height:500px}
.reconcile-edit{min-width:90px;border:0;background:transparent;padding:5px;width:100%;box-sizing:border-box}
.reconcile-edit:focus{outline:2px solid #84adff;background:#fff}
.reconcile-check{width:18px;height:18px}
.inner-card{margin-top:14px;box-shadow:none}
.cmp-ok td{background:#edf9f3}
.cmp-diff td{background:#fff1f2}
.diff-zero{color:#107457;font-weight:700}
.diff-nonzero{color:#b42318;font-weight:800}
@media(max-width:1200px){
  .reconcile-grid{grid-template-columns:1fr}
  .reconcile-stats{grid-template-columns:repeat(3,1fr)}
}

/* v1.9 wide layout */
html,body{overflow-x:hidden}
.wrap{max-width:none;width:100%;padding:20px 24px}
.card{padding:16px;margin-bottom:14px}
.table-wrap{max-width:100%}
.no-x-scroll{overflow-x:hidden}
.no-x-scroll table{table-layout:fixed;white-space:normal;width:100%}
.no-x-scroll th,.no-x-scroll td{white-space:normal;overflow-wrap:anywhere;word-break:keep-all;padding:7px 8px}
#jobs,#results,#materials,#smartaComparison{white-space:normal;table-layout:auto}
#results td,#materials td{white-space:normal;overflow-wrap:anywhere}

.dashboard-head{display:flex;align-items:center;justify-content:space-between;gap:20px}
.dashboard-head h2{margin:4px 0;font-size:24px}.dashboard-head p{margin:0;color:#667085}
.month-control{display:flex;align-items:center;gap:7px}.month-control input{font-size:15px;width:165px;padding:8px 10px}
.month-control.compact input{width:145px;font-size:13px}
.dashboard-stats{display:grid;grid-template-columns:repeat(7,minmax(120px,1fr));gap:10px;margin-bottom:14px}
.dash-stat{background:#fff;border:1px solid var(--line);border-radius:12px;padding:13px 14px;min-width:0}
.dash-stat span{font-size:11px;color:#667085}.dash-stat strong{font-size:18px;display:block;margin-top:4px;overflow-wrap:anywhere}.dash-stat.warn{border-left:4px solid #e39a27}
.dashboard-layout{display:grid;grid-template-columns:minmax(520px,1.05fr) minmax(520px,.95fr);gap:14px}
.month-calendar{display:grid;grid-template-columns:repeat(7,1fr);gap:5px;margin-top:12px}
.cal-head{text-align:center;color:#667085;font-size:11px;font-weight:800;padding:4px}
.cal-day{min-width:0;border:1px solid #e4e7ec;border-radius:9px;background:#fff;padding:6px;text-align:left;min-height:54px;cursor:default}
.cal-day.has-data{cursor:pointer;background:#f7faff;border-color:#bfd2fa}.cal-day.has-data:hover{background:#edf4ff}.cal-day.selected{outline:2px solid #2864dc;background:#eaf1ff}
.cal-day.empty{border-color:transparent;background:transparent}.cal-date{font-weight:800;font-size:12px}.cal-meta{font-size:10px;color:#667085;margin-top:4px;line-height:1.35}.cal-issue{color:#b42318;font-weight:800}
.month-calendar.large .cal-day{min-height:88px;padding:8px}.month-calendar.large .cal-date{font-size:13px}.month-calendar.large .cal-meta{font-size:11px}

.matching-month-head{display:grid;grid-template-columns:minmax(0,1fr) 420px;gap:18px;align-items:start}
.matching-month-head h2{margin:0 0 5px}.matching-month-head>div:first-child>span{font-size:12px;color:#667085}
.matching-calendar-side{border:1px solid #d8dee8;border-radius:14px;padding:12px;background:#f8fafc}
.matching-calendar-card{box-shadow:0 1px 2px rgba(16,24,40,.04)}
.matching-calendar-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.matching-calendar-mainnav{display:flex;align-items:center;gap:8px}
.matching-calendar-mainnav strong{font-size:16px;min-width:88px;text-align:center;color:#344054}
.matching-calendar-selects{display:flex;align-items:center;gap:8px}
.matching-calendar-selects select{padding:7px 9px;border:1px solid #d0d5dd;border-radius:8px;background:#fff;font-size:13px}
.icon-btn{min-width:34px;padding:7px 10px}
.matching-week-head{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;margin-top:12px;margin-bottom:4px}
.matching-week-head span{text-align:center;font-size:12px;font-weight:800;color:#667085;padding:4px 0}
.matching-grid-calendar{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}
.mini-cal-day{min-width:0;min-height:72px;border:1px solid #d9dee7;border-radius:0;background:#fff;text-align:left;padding:6px 7px;display:flex;flex-direction:column;justify-content:space-between;cursor:pointer;transition:.12s ease;background-clip:padding-box}
.mini-cal-day:hover{background:#f7faff;border-color:#bfd2fa}
.mini-cal-day.selected{outline:2px solid #2e6bdb;background:#eaf1ff;position:relative;z-index:1}
.mini-cal-day.has-data .mini-date{color:#175cd3;font-weight:800}
.mini-cal-day.other-month{background:#f8fafc;color:#c1c7d0}
.mini-cal-day.other-month .mini-date{color:#c1c7d0}
.mini-date{font-size:15px;font-weight:700;color:#101828}
.mini-flags{display:flex;align-items:center;justify-content:flex-end;gap:4px;min-height:18px;flex-wrap:wrap}
.mini-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:999px;font-size:10px;font-weight:800}
.mini-badge.count{background:#dbeafe;color:#175cd3}
.mini-badge.issue{background:#fee4e2;color:#b42318}
.patient-match-layout.v19{grid-template-columns:240px minmax(0,1fr);gap:12px}.matching-detail{min-width:0;display:flex;flex-direction:column;gap:12px}
.detail-section{border:1px solid #e4e7ec;border-radius:12px;background:#fff;padding:12px;min-width:0}.section-title-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:7px}.section-title-row h3{font-size:14px;margin:0}.section-title-row span{font-size:11px;color:#667085}
.match-raw-wrap{max-height:340px}.match-raw-wrap table th:nth-child(1),.match-raw-wrap table th:nth-child(2){width:68px}.match-raw-wrap table th:nth-child(3){width:72px}.match-raw-wrap table th:nth-child(5){width:75px}.match-raw-wrap table th:nth-child(6){width:92px}.match-raw-wrap table th:nth-child(7){width:90px}
.manual-check{width:17px;height:17px;vertical-align:middle}.manual-check-cell{text-align:center}.auto-supplied{background:#edf9f3}.manual-supplied{background:#fff8e8}
#matchingSuppliedTable th:nth-child(1){width:95px}#matchingSuppliedTable th:nth-child(2){width:90px}#matchingSuppliedTable th:nth-child(4){width:90px}#matchingSuppliedTable th:nth-child(6){width:80px}#matchingSuppliedTable th:nth-child(7){width:55px}#matchingSuppliedTable th:nth-child(9),#matchingSuppliedTable th:nth-child(10){width:90px}
.scan-actions{display:flex;gap:5px;align-items:center;flex-wrap:wrap}.scan-actions button{padding:7px 10px}.scan-thumbs{display:flex;gap:7px;overflow-x:auto;padding:4px 0 9px}.scan-thumb{width:72px;height:54px;object-fit:cover;border:2px solid transparent;border-radius:7px;cursor:pointer;background:#f2f4f7}.scan-thumb.active{border-color:#2864dc}.scan-empty{padding:35px;text-align:center;color:#98a2b3;border:1px dashed #d0d5dd;border-radius:10px}
.scan-viewport{height:620px;overflow:hidden;border:1px solid #d0d5dd;border-radius:10px;background:#20242b;position:relative;cursor:grab;user-select:none}.scan-viewport.dragging{cursor:grabbing}.scan-viewport img{position:absolute;left:50%;top:50%;max-width:none;max-height:none;transform-origin:center center;will-change:transform;user-select:none;-webkit-user-drag:none}
@media(max-width:1350px){.dashboard-stats{grid-template-columns:repeat(4,1fr)}.dashboard-layout{grid-template-columns:1fr}.matching-month-head{grid-template-columns:1fr 380px}.patient-match-layout.v19{grid-template-columns:215px minmax(0,1fr)}}
@media(max-width:980px){.wrap{padding:12px}.dashboard-stats{grid-template-columns:repeat(2,1fr)}.matching-month-head{grid-template-columns:1fr}.matching-calendar-side{width:100%}.matching-calendar-toolbar{align-items:flex-start}.matching-calendar-mainnav{width:100%;justify-content:space-between}.matching-calendar-selects{width:100%;justify-content:flex-end}.mini-cal-day{min-height:58px;padding:5px}.patient-match-layout.v19{grid-template-columns:1fr}.scan-viewport{height:500px}}

/* v2.0.3: compact matching calendar */
.matching-month-head{grid-template-columns:minmax(0,1fr) 300px!important;gap:12px!important}
.matching-calendar-side{padding:8px!important;border-radius:10px!important}
.matching-calendar-toolbar{gap:5px!important}
.matching-calendar-mainnav{gap:4px!important}
.matching-calendar-mainnav strong{font-size:13px!important;min-width:68px!important}
.matching-calendar-mainnav button{padding:5px 7px!important;font-size:11px!important;min-width:auto!important}
.matching-calendar-selects{gap:4px!important}
.matching-calendar-selects select{padding:4px 5px!important;font-size:11px!important}
.matching-week-head{gap:1px!important;margin-top:6px!important;margin-bottom:1px!important}
.matching-week-head span{font-size:10px!important;padding:2px 0!important}
.matching-grid-calendar{gap:1px!important}
.mini-cal-day{min-height:38px!important;padding:3px 4px!important;border-radius:2px!important}
.mini-date{font-size:11px!important}
.mini-flags{gap:2px!important;min-height:12px!important}
.mini-badge{height:13px!important;min-width:13px!important;padding:0 3px!important;font-size:8px!important}
@media(max-width:1350px){.matching-month-head{grid-template-columns:minmax(0,1fr) 290px!important}}
@media(max-width:980px){.matching-month-head{grid-template-columns:1fr!important}.matching-calendar-side{max-width:310px}}

/* v2.0.6 horizontal monthly date strip */
.matching-month-head.horizontal-mode{
  display:block!important;
  width:100%;
}
.matching-title-area{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:8px;
}
.matching-title-area h2{margin:0 0 4px}
.matching-title-area span{font-size:12px;color:#667085}
.matching-query-bar{
  width:100%;
  border:1px solid #d8dee8;
  border-radius:10px;
  padding:8px 10px;
  background:#fafbfc;
  box-sizing:border-box;
}
.matching-query-date{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  margin-bottom:6px;
}
.matching-query-date strong{
  font-size:12px;
  color:#475467;
}
.matching-query-date button{padding:6px 10px;font-size:11px}
.matching-calendar-toolbar.horizontal{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:5px;
  margin-bottom:6px;
}
.matching-calendar-toolbar.horizontal strong{
  font-size:13px;
  min-width:66px;
  text-align:center;
}
.matching-calendar-toolbar.horizontal button{
  padding:4px 7px;
  font-size:11px;
}
.matching-calendar-selects{
  display:flex;
  gap:4px;
}
.matching-calendar-selects select{
  padding:4px 6px!important;
  font-size:11px!important;
  border:1px solid #d0d5dd;
  border-radius:6px;
  background:#fff;
}
.horizontal-day-calendar{
  display:grid;
  grid-template-columns:repeat(31,minmax(0,1fr));
  gap:1px;
  width:100%;
}
.horizontal-day-calendar .day-cell{
  min-width:0;
  height:34px;
  border:1px solid #e4e7ec;
  background:#fff;
  padding:0;
  border-radius:3px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:10px;
  font-weight:700;
  color:#344054;
}
.horizontal-day-calendar .day-cell:hover{
  background:#f2f6ff;
  border-color:#b7c9ee;
}
.horizontal-day-calendar .day-cell.selected{
  background:#e8f0ff;
  outline:2px solid #2e6bdb;
  position:relative;
  z-index:1;
}
.horizontal-day-calendar .day-cell.sat{
  color:#175cd3;
}
.horizontal-day-calendar .day-cell.sun,
.horizontal-day-calendar .day-cell.holiday{
  color:#d92d20;
}
.horizontal-day-calendar .day-cell.disabled{
  visibility:hidden;
  pointer-events:none;
}
@media(max-width:1100px){
  .horizontal-day-calendar .day-cell{font-size:9px;height:32px}
}
.legacy-query-panel{display:none!important}

/* v2.0.8 matching detail + SmartA history */
.patient-meta-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin-top:7px}
.patient-meta-grid>div{border:1px solid #e4e7ec;border-radius:7px;padding:6px 8px;background:#f9fafb;min-width:0}
.patient-meta-grid span{display:block;font-size:9px;color:#667085;margin-bottom:2px}
.patient-meta-grid strong{display:block;font-size:11px;color:#344054;overflow-wrap:anywhere}
#matchingRawTable{font-size:10px;table-layout:fixed;width:100%}
#matchingRawTable th,#matchingRawTable td{padding:5px 4px;white-space:normal;overflow-wrap:anywhere;vertical-align:top}
#matchingRawTable th:nth-child(1),#matchingRawTable th:nth-child(2){width:48px}
#matchingRawTable th:nth-child(3){width:94px}
#matchingRawTable th:nth-child(4){width:72px}
#matchingRawTable th:nth-child(6){width:46px}
#matchingRawTable th:nth-child(7){width:72px}
#matchingRawTable th:nth-child(8){width:78px}
#matchingRawTable th:nth-child(9){width:54px}
#matchingRawTable th:nth-child(10){width:88px}
#matchingRawTable th:nth-child(11){width:150px}
.manual-code{width:100%;min-width:0;box-sizing:border-box;padding:5px 6px;font-size:10px;border:1px solid #cfd6e1;border-radius:5px}
.manual-code:disabled{background:#f2f4f7;color:#98a2b3}
.code-help{font-size:8px;color:#98a2b3;margin-top:2px;line-height:1.2}
.smarta-info strong{display:block;font-size:9px;color:#344054}.smarta-info div{font-size:8px;color:#667085;margin-top:2px}
.match-badge.history_matched{background:#e0f2fe;color:#0369a1}.match-badge.manual{background:#fff1c2;color:#8a6100}
#matchingSuppliedTable{font-size:10px;table-layout:auto;width:100%}
#matchingSuppliedTable th,#matchingSuppliedTable td{padding:5px 4px;white-space:normal;overflow-wrap:anywhere}
@media(max-width:1100px){.patient-meta-grid{grid-template-columns:repeat(2,minmax(0,1fr))}#matchingRawTable{font-size:9px}}


/* v2.0.18 matching UI refinements */
.patient-item-top{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}
.patient-item-top strong{margin-bottom:4px}
.patient-total{font-size:12px;font-weight:800;color:#175cd3;white-space:nowrap}
#matchingSuppliedTable th.supplied-sortable{cursor:pointer;user-select:none}
#matchingSuppliedTable th.supplied-sortable:hover{background:#eef4ff}
#matchingSuppliedTable th.supplied-sortable.active{background:#e7f0ff;color:#175cd3}
.sort-arrow{font-size:9px;margin-left:3px}


/* v2.0.19 SmartA candidate picker */
.smarta-reason{margin-top:4px;font-size:11px;color:#475467}
.candidate-box{margin-top:8px;display:flex;flex-direction:column;gap:5px;min-width:300px}
.candidate-title{font-size:11px;font-weight:800;color:#344054;display:flex;justify-content:space-between;gap:8px}
.candidate-title span{font-weight:500;color:#667085}
.smarta-candidate{width:100%;text-align:left;border:1px solid #d0d5dd;background:#fff;border-radius:8px;padding:7px 8px;cursor:pointer}
.smarta-candidate:hover{border-color:#84adff;background:#f5f8ff}
.candidate-main{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}
.candidate-main strong{font-size:12px;color:#101828}
.candidate-score{font-size:10px;font-weight:800;color:#175cd3;background:#eff4ff;border-radius:10px;padding:2px 6px;white-space:nowrap}
.candidate-sub{font-size:10px;color:#667085;margin-top:2px}
.candidate-reasons{display:flex;flex-wrap:wrap;gap:3px;margin-top:5px}
.candidate-reasons span{font-size:9px;color:#344054;background:#f2f4f7;border-radius:9px;padding:2px 5px}
.candidate-history{display:flex;flex-direction:column;gap:1px;margin-top:4px;font-size:9px;color:#667085}


/* v2.0.20 SmartA candidate compact/popup UI */
.candidate-box.single{min-width:300px}
.candidate-box.collapsed{min-width:260px}
.candidate-summary{width:100%;display:flex;align-items:center;gap:7px;border:1px solid #d0d5dd;background:#fff;border-radius:8px;padding:8px 9px;cursor:pointer;text-align:left}
.candidate-summary:hover{border-color:#84adff;background:#f5f8ff}
.candidate-summary-name{min-width:0;flex:1;font-size:12px;font-weight:700;color:#101828;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.candidate-summary-more{font-size:11px;font-weight:800;color:#175cd3;background:#eff4ff;border-radius:11px;padding:2px 7px;white-space:nowrap}
.candidate-summary-arrow{font-size:20px;line-height:1;color:#667085}
.candidate-modal[hidden]{display:none}
.candidate-modal{position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;padding:20px}
.candidate-modal-backdrop{position:absolute;inset:0;background:rgba(16,24,40,.48)}
.candidate-modal-panel{position:relative;width:min(760px,calc(100vw - 32px));max-height:min(760px,calc(100vh - 40px));display:flex;flex-direction:column;background:#fff;border-radius:14px;box-shadow:0 24px 48px rgba(16,24,40,.24);overflow:hidden}
.candidate-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:18px 20px;border-bottom:1px solid #eaecf0}
.candidate-modal-head h3{margin:0;font-size:17px;color:#101828}
.candidate-modal-head p{margin:4px 0 0;font-size:11px;color:#667085}
.candidate-modal-close{border:0;background:transparent;font-size:26px;line-height:1;color:#667085;cursor:pointer;padding:0 2px}
.candidate-modal-body{padding:14px;overflow:auto;display:flex;flex-direction:column;gap:9px}
.candidate-modal-item{display:grid;grid-template-columns:28px 1fr;align-items:start;gap:8px}
.candidate-rank{width:26px;height:26px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:#f2f4f7;color:#475467;font-size:11px;font-weight:800;margin-top:7px}
.candidate-modal-item .smarta-candidate{margin:0}


/* v2.0.21 match cancel / block controls */
.match-actions{display:flex;flex-wrap:wrap;gap:4px;margin-top:8px}
.match-action{border:1px solid #d0d5dd;background:#fff;border-radius:6px;padding:4px 7px;font-size:10px;cursor:pointer}
.match-action:hover{background:#f9fafb}
.match-action.change{color:#175cd3;border-color:#b2ccff}
.match-action.exclude{color:#b54708;border-color:#fedf89}
.match-action.block{color:#b42318;border-color:#fecdca}
.match-action.reset{color:#344054}
.row-manual_excluded{background:#fff8f6}

/* v2.0.22 specification-aware SmartA matching */
.smarta-candidate.spec-exact{border-color:#75e0a7;background:#f6fef9}
.spec-match-tag{display:inline-block;margin-left:5px;padding:1px 5px;border-radius:9px;background:#dcfae6;color:#067647;font-size:9px;font-weight:800;vertical-align:1px}


/* v2.0.24 material quick filters */
.material-quick-filter{display:flex;align-items:center;gap:6px;margin:12px 0 8px}
.material-filter-btn{border:1px solid #d0d5dd;background:#fff;color:#344054;border-radius:8px;padding:7px 12px;font-size:12px;font-weight:700;cursor:pointer}
.material-filter-btn:hover{background:#f9fafb}
.material-filter-btn.active{background:#eff4ff;border-color:#84adff;color:#175cd3}
.material-filter-label{display:inline-flex;align-items:center;margin-left:8px;padding:2px 7px;border-radius:10px;background:#f2f4f7;color:#475467;font-size:11px;font-weight:700}

/* v2.0.27 SAW BLADE supplier-based matching */
.saw-auto-reason{margin-top:5px;padding:4px 6px;border-radius:6px;background:#eef4ff;color:#175cd3;font-weight:700}


/* v2.0.30 compact chrome + sticky calendar */
header{
  position:sticky;
  top:0;
  z-index:120;
  padding:8px 14px !important;
  min-height:auto !important;
  background:var(--bg,#f5f7fb);
}
header h1{font-size:20px !important;line-height:1.15;margin:0 !important}
header .header-right{gap:6px}
header .badge{font-size:10px;padding:5px 8px}

.top-tabs{
  position:sticky;
  top:47px;
  z-index:119;
  padding:5px 0 7px;
  margin:0 0 8px !important;
  background:var(--bg,#f5f7fb);
}
.top-tabs .tab-btn{
  padding:7px 12px !important;
  min-height:32px !important;
  font-size:12px !important;
  border-radius:8px !important;
}

.dashboard-head{padding:12px 14px !important}
.dashboard-head .eyebrow{font-size:9px !important;margin-bottom:2px}
.dashboard-head h2{font-size:19px !important;margin:2px 0 !important}
.dashboard-head p{font-size:11px !important}
.card .head h2,.detail-section h3,.reconcile-title strong{font-size:13px !important}
.card .head span,.reconcile-title span{font-size:10px !important}

#matchingTab .matching-month-head{
  position:sticky;
  top:86px;
  z-index:110;
  background:var(--bg,#f5f7fb);
  padding:8px 0 9px;
  box-shadow:0 8px 12px rgba(16,24,40,.04);
}
#matchingTab .matching-title-area h2{font-size:16px !important;margin-bottom:2px !important}
#matchingTab .matching-title-area>span{font-size:10px !important}
#matchingTab .horizontal-day-calendar{background:#fff}

.reconcile-table-wrap table{table-layout:fixed;width:100%}
#reconcilePurchase th:nth-child(1){width:16%}
#reconcilePurchase th:nth-child(2){width:30%}
#reconcilePurchase th:nth-child(3){width:30%}
#reconcilePurchase th:nth-child(4){width:24%}
#reconcileSale th:nth-child(1){width:20%}
#reconcileSale th:nth-child(2){width:50%}
#reconcileSale th:nth-child(3){width:30%}
.reconcile-edit.amount{text-align:right}


/* v2.0.31 reliable sticky header/tab/calendar */
html,body{overflow-x:hidden}
.wrap{overflow:visible!important}

.app-sticky-header{
  position:sticky!important;
  top:0!important;
  z-index:500!important;
  background:var(--bg);
  padding-top:4px;
  margin:0 -2px 8px;
  box-shadow:0 8px 16px rgba(16,24,40,.05);
}
.app-sticky-header header{
  position:static!important;
  margin:0!important;
  padding:6px 2px 5px!important;
  background:var(--bg)!important;
}
.app-sticky-header .top-tabs{
  position:static!important;
  margin:0!important;
  padding:4px 2px 7px!important;
  background:var(--bg)!important;
}

/* Matching page: keep its month/day strip directly under the sticky app bar. */
#matchingTab .matching-month-head{
  position:sticky!important;
  top:76px!important;
  z-index:450!important;
  background:var(--bg)!important;
  padding:6px 0 8px!important;
  margin-bottom:8px;
  box-shadow:0 8px 14px rgba(16,24,40,.05);
}

/* Patient list should not slide underneath the two fixed rows. */
#matchingTab .patient-list-card{
  top:162px!important;
}

@media(max-width:760px){
  #matchingTab .matching-month-head{top:72px!important}
  #matchingTab .patient-list-card{top:auto!important}
}


/* v2.0.32 fixed top chrome: use fixed, not sticky */
html,body{overflow-x:hidden!important}
.wrap{
  overflow:visible!important;
  padding-top:112px!important;
}
.app-sticky-header{
  position:fixed!important;
  top:0!important;
  left:50%!important;
  right:auto!important;
  transform:translateX(-50%)!important;
  width:min(1500px,calc(100vw - 40px))!important;
  z-index:5000!important;
  background:var(--bg)!important;
  padding:6px 0 5px!important;
  margin:0!important;
  box-shadow:0 8px 16px rgba(16,24,40,.08)!important;
}
.app-sticky-header header{
  position:static!important;
  padding:4px 0!important;
  margin:0!important;
}
.app-sticky-header .top-tabs{
  position:static!important;
  padding:4px 0 2px!important;
  margin:0!important;
}
.version-badge{background:#172033!important;color:#fff!important}

/* Matching month/day calendar is fixed below the app header. */
#matchingTab .matching-month-head{
  position:fixed!important;
  top:90px!important;
  left:50%!important;
  transform:translateX(-50%)!important;
  width:min(1500px,calc(100vw - 40px))!important;
  z-index:4800!important;
  background:var(--bg)!important;
  padding:6px 0 8px!important;
  margin:0!important;
  box-shadow:0 8px 14px rgba(16,24,40,.08)!important;
}
#matchingTab .matching-shell{
  padding-top:128px!important;
}
#matchingTab .patient-list-card{top:228px!important}

/* Dashboard categorized flow summary */
.dashboard-overview{display:flex;flex-direction:column;gap:10px;margin-bottom:14px}
.dashboard-basic-stats{display:grid;grid-template-columns:repeat(5,minmax(110px,1fr));gap:8px}
.dashboard-flow-groups{display:grid;grid-template-columns:2fr 3fr;gap:10px}
.flow-group{background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px}
.flow-title{font-size:12px;font-weight:900;margin-bottom:7px}
.flow-group.inbound .flow-title{color:#175cd3}
.flow-group.outbound .flow-title{color:#067647}
.flow-cards{display:grid;grid-template-columns:repeat(2,1fr);gap:7px}
.flow-cards.three{grid-template-columns:repeat(3,1fr)}
.flow-group .dash-stat{box-shadow:none;padding:9px 11px}
.flow-group .dash-stat strong{font-size:16px}

/* Reconcile typography: date and all row fields use the same size */
#reconcilePurchase td,#reconcileSale td,
#reconcilePurchase input,#reconcileSale input{
  font-size:12px!important;
  line-height:1.35!important;
}
#reconcilePurchase input,#reconcileSale input{
  padding:3px 4px!important;
  font-weight:400!important;
}

#reconcileMonth{width:145px;font-size:12px;padding:7px 9px}

@media(max-width:900px){
  .wrap{padding-top:118px!important}
  .app-sticky-header{width:calc(100vw - 20px)!important}
  #matchingTab .matching-month-head{width:calc(100vw - 20px)!important;top:96px!important}
  .dashboard-basic-stats{grid-template-columns:repeat(2,1fr)}
  .dashboard-flow-groups{grid-template-columns:1fr}
  .flow-cards.three{grid-template-columns:1fr 1fr}
}


/* v2.0.33 full-width fixed top area */
.app-sticky-header{
  left:0!important;
  right:0!important;
  width:100%!important;
  max-width:none!important;
  transform:none!important;
  padding:6px 18px 5px!important;
  border-radius:0!important;
}

.app-sticky-header header,
.app-sticky-header .top-tabs{
  width:100%!important;
  max-width:none!important;
}

#matchingTab .matching-month-head{
  left:0!important;
  right:0!important;
  width:100%!important;
  max-width:none!important;
  transform:none!important;
  padding-left:18px!important;
  padding-right:18px!important;
}

@media(max-width:900px){
  .app-sticky-header{
    width:100%!important;
    padding-left:10px!important;
    padding-right:10px!important;
  }
  #matchingTab .matching-month-head{
    width:100%!important;
    padding-left:10px!important;
    padding-right:10px!important;
  }
}


/* v2.0.35 special match rules */
.special-rule-card{margin-top:14px}
.special-rule-toolbar{display:grid;grid-template-columns:minmax(320px,1fr) 160px;gap:10px;margin:14px 0 8px}
.special-rule-toolbar input,.special-rule-toolbar select{
  width:100%;border:1px solid #d7dce3;border-radius:8px;padding:9px 10px;background:#fff;font-size:13px
}
#specialRules td,#specialRules th{white-space:nowrap}
#specialRules tr.clickable:hover td{background:#f7f9fc}
.special-rule-help{
  margin-top:12px;padding:10px 12px;border-radius:9px;background:#f7f9fc;
  color:#475467;font-size:12px;line-height:1.5
}
@media(max-width:800px){
  .special-rule-toolbar{grid-template-columns:1fr}
}


/* v2.0.36 same-patient surgery merge + doctor labels */
.doctor-summary{font-weight:800;color:#344054}
.doctor-material-tag{
  display:inline-flex;
  align-items:center;
  margin-left:5px;
  padding:2px 6px;
  border-radius:999px;
  background:#eef4ff;
  color:#175cd3;
  font-size:10px;
  font-weight:800;
  white-space:nowrap;
}
.supplied-hospital-material{font-weight:700}


/* v2.0.37 transaction-statement reconciliation redesign */
.reconcile-new{padding:16px!important}
.reconcile-main-head{margin-bottom:10px}
.statement-direction-block{
  margin-top:14px;
  border:1px solid #dfe3e8;
  border-radius:14px;
  background:#f9fafb;
  padding:12px;
}
.statement-direction-title{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:2px 2px 10px;
}
.statement-direction-title>div{display:flex;align-items:center;gap:8px}
.statement-direction-title strong{font-size:15px}
.direction-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:46px;
  padding:5px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
}
.direction-pill.inbound{background:#eaf2ff;color:#175cd3}
.direction-pill.outbound{background:#eaf8f1;color:#067647}
.statement-grand-total{font-size:18px!important}
.statement-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.statement-box{
  border:1px solid #e1e5eb;
  border-radius:11px;
  background:#fff;
  overflow:hidden;
}
.statement-other-box{margin-top:12px}
.statement-box-title{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-bottom:1px solid #eef0f3;
  background:#f7f9fc;
}
.statement-box-title>div:first-child{display:flex;align-items:baseline;gap:8px;min-width:0}
.statement-box-title strong{font-size:13px}
.statement-box-title span{font-size:10px;color:#667085}
.statement-title-actions{display:flex!important;align-items:center!important;gap:8px!important}
.statement-title-actions strong{font-size:13px}
.statement-add-btn{padding:5px 9px!important;font-size:11px!important;min-height:26px!important}
.statement-table-wrap{margin-top:0!important;max-height:430px;border:0!important;border-radius:0!important}
.statement-table-wrap table{table-layout:auto}
.statement-table-wrap th,
.statement-table-wrap td{
  font-size:12px!important;
  padding:7px 8px!important;
  vertical-align:middle;
}
.statement-table-wrap th{background:#fff}
.statement-money{text-align:right;font-weight:800}
.statement-empty{text-align:center!important;color:#98a2b3;padding:20px!important}
.statement-input{
  width:100%!important;
  min-width:90px;
  height:30px;
  padding:4px 6px!important;
  border:1px solid #d7dce3!important;
  border-radius:6px!important;
  background:#fff!important;
  font-size:12px!important;
  font-weight:400!important;
}
.statement-date{min-width:125px}
.statement-money-input{text-align:right;min-width:100px}
.statement-remove{
  border:0;
  background:#fff0f2;
  color:#b42318;
  border-radius:6px;
  padding:5px 8px;
  font-size:11px;
  font-weight:800;
}
#statementMaterialPurchase th:nth-child(1),
#statementMaterialSale th:nth-child(1){width:115px}
#statementMaterialPurchase th:last-child,
#statementMaterialSale th:last-child{width:120px;text-align:right}
#statementPurchaseConsumables th:last-child,
#statementSaleConsumables th:last-child,
#statementOtherTrades th:last-child{width:54px}
#reconcileNotice{margin:8px 0 0}
@media(max-width:1100px){
  .statement-grid{grid-template-columns:1fr}
}


/* v2.0.39 multiple surgeries: show each scan set separately */
.scan-thumbs{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:8px;
}
.scan-surgery-group{
  border:1px solid #e1e6ed;
  border-radius:9px;
  background:#fff;
  padding:7px 8px;
}
.scan-surgery-label{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-bottom:6px;
  font-size:11px;
  color:#475467;
}
.scan-surgery-label strong{font-size:11px;color:#344054}
.scan-surgery-label span{
  padding:1px 6px;
  border-radius:999px;
  background:#f2f4f7;
  font-size:10px;
}
.scan-surgery-thumbs{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
}
.scan-surgery-empty{
  color:#98a2b3;
  font-size:11px;
  padding:5px 2px;
}


/* v2.0.40 reconcile speed + autosave */
.autosave-status{
  display:inline-flex;
  align-items:center;
  min-height:34px;
  padding:0 11px;
  border-radius:8px;
  font-size:11px;
  font-weight:800;
  border:1px solid #d0d5dd;
  background:#fff;
  white-space:nowrap;
}
.autosave-status.saved{color:#067647;background:#ecfdf3;border-color:#abefc6}
.autosave-status.saving{color:#175cd3;background:#eff8ff;border-color:#b2ddff}
.autosave-status.dirty{color:#b54708;background:#fffaeb;border-color:#fedf89}
.autosave-status.error{color:#b42318;background:#fef3f2;border-color:#fecdca}


/* v2.0.41 continuous blank-row data entry */
.statement-table-wrap tbody tr:last-child .statement-input{
  background:#fcfcfd!important;
  border-style:dashed!important;
}
.statement-table-wrap tbody tr:last-child .statement-input:focus{
  background:#fff!important;
  border-style:solid!important;
}


/* v2.0.42 supplier monthly purchase detail popup */
.supplier-detail-link{
  appearance:none;
  border:0;
  background:transparent;
  padding:0;
  color:#175cd3;
  font:inherit;
  font-weight:800;
  cursor:pointer;
  text-decoration:underline;
  text-decoration-thickness:1px;
  text-underline-offset:3px;
}
.supplier-detail-link:hover{color:#004eeb}
.supplier-detail-modal{
  width:min(1180px,calc(100vw - 48px))!important;
  max-width:1180px!important;
}
.supplier-detail-meta{
  margin-top:3px;
  font-size:11px;
  color:#667085;
}
.supplier-detail-table-wrap{
  max-height:min(68vh,700px);
  margin-top:10px;
  border:1px solid #e4e7ec;
  border-radius:9px;
}
#supplierPurchaseDetailTable th{
  position:sticky;
  top:0;
  z-index:2;
  background:#f9fafb;
  white-space:nowrap;
}
#supplierPurchaseDetailTable th,
#supplierPurchaseDetailTable td{
  padding:8px 9px!important;
  font-size:12px!important;
}
#supplierPurchaseDetailTable td:nth-child(1){white-space:nowrap}
#supplierPurchaseDetailTable td:nth-child(3){white-space:nowrap}
.supplier-detail-qty{text-align:right}
.supplier-detail-footer{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:14px;
  padding:10px 2px 0;
  font-size:12px;
  color:#667085;
}
.supplier-detail-footer strong{
  font-size:15px;
  color:#101828;
}


/* v2.0.43 기타거래처: 거래처 + 비고 */
#statementOtherTrades .statement-note-input{min-width:150px}
#statementOtherTrades th:nth-child(2){min-width:130px}
#statementOtherTrades th:nth-child(6){min-width:150px}


/* v2.0.44 monthly reconcile vs SmartA dashboard */
.dashboard-compare-head{margin-bottom:10px}
.dashboard-compare-notice{margin-bottom:10px}
.dashboard-compare-summary{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
  margin-bottom:12px;
}
.dashboard-compare-summary-card{
  background:#fff;
  border:1px solid #e4e7ec;
  border-radius:12px;
  padding:13px 14px;
  min-width:0;
}
.dashboard-compare-summary-card>span{
  display:block;
  color:#667085;
  font-size:11px;
  font-weight:800;
  margin-bottom:6px;
}
.dashboard-compare-summary-card>strong{
  display:block;
  font-size:21px;
  color:#101828;
  line-height:1.15;
}
.dashboard-compare-summary-card>small{
  display:block;
  margin-top:6px;
  color:#667085;
  font-size:11px;
}
.dashboard-compare-summary-card>small b{color:#344054}
.dashboard-compare-summary-card.difference-card strong{font-size:24px}
.dashboard-compare-grid{
  display:grid;
  grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);
  gap:12px;
}
.dashboard-compare-card{min-width:0}
.dashboard-other-trade-card{margin-top:12px}
.dashboard-compare-table-wrap{max-height:520px}
.dashboard-compare-table-wrap table{width:100%}
.dashboard-compare-table-wrap th{
  position:sticky;
  top:0;
  z-index:2;
  background:#f9fafb;
  white-space:nowrap;
}
.dashboard-compare-table-wrap th,
.dashboard-compare-table-wrap td{
  padding:8px 10px!important;
  font-size:12px!important;
}
.dashboard-compare-table-wrap tr.compare-diff td{
  background:#fff1f0!important;
}
.dashboard-compare-table-wrap tr.compare-ok td{
  background:#f6fef9!important;
}
.compare-status{
  display:inline-flex;
  min-width:48px;
  justify-content:center;
  padding:3px 7px;
  border-radius:999px;
  font-size:10px;
  font-weight:900;
}
.compare-status.ok{background:#dcfae6;color:#067647}
.compare-status.diff{background:#fee4e2;color:#b42318}
.compare-difference{font-weight:900}
.compare-diff .compare-difference{color:#b42318}
.compare-ok .compare-difference{color:#067647}
.dashboard-code{color:#667085;font-size:11px!important;white-space:nowrap}
.dashboard-total-diff{
  display:inline-flex;
  padding:4px 8px;
  border-radius:8px;
  font-size:11px!important;
  background:#f2f4f7;
  color:#475467;
}
.dashboard-total-diff.diff{background:#fee4e2;color:#b42318}
.dashboard-total-diff.ok{background:#dcfae6;color:#067647}
.dashboard-unmapped-notice{
  margin-top:12px;
  padding:10px 12px;
  border:1px solid #fedf89;
  border-radius:10px;
  background:#fffaeb;
  color:#93370d;
  font-size:11px;
  line-height:1.55;
}
.dashboard-unmapped-notice strong{font-size:12px}
.dashboard-unmapped-notice span{color:#b54708}
@media(max-width:1200px){
  .dashboard-compare-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
  .dashboard-compare-grid{grid-template-columns:1fr}
}
@media(max-width:720px){
  .dashboard-compare-summary{grid-template-columns:1fr}
}


/* v2.0.46 number input UX + larger text */
.formatted-number-input,
.statement-money-input{
  text-align:right;
  font-variant-numeric:tabular-nums;
}

/* Direct-entry / statement area: +3px */
.statement-table-wrap th,
.statement-table-wrap td{
  font-size:15px!important;
}
.statement-input{
  font-size:15px!important;
  height:34px;
}
.statement-box-title strong{font-size:16px}
.statement-box-title span{font-size:13px}
.statement-remove{font-size:14px}
.statement-grand-total{font-size:21px!important}
.autosave-status{font-size:14px}

/* Dashboard comparison: +3px */
.dashboard-compare-table-wrap th,
.dashboard-compare-table-wrap td{
  font-size:15px!important;
}
.dashboard-compare-summary-card>span{font-size:14px}
.dashboard-compare-summary-card>strong{font-size:24px}
.dashboard-compare-summary-card>small{font-size:14px}
.compare-status{font-size:13px}
.dashboard-total-diff{font-size:14px!important}

/* Supplier detail popup: +3px */
.supplier-detail-meta{font-size:14px}
#supplierPurchaseDetailTable th,
#supplierPurchaseDetailTable td{
  font-size:15px!important;
}
.supplier-detail-footer{font-size:15px}
.supplier-detail-footer strong{font-size:18px}

/* Modal form inputs and labels: slightly larger */
.modal label{font-size:15px!important}
.modal input,
.modal select,
.modal textarea{
  font-size:15px!important;
}


/* v2.0.49 Korean IME-safe entry + dashboard mismatch detail */
.compare-status-btn{
  border:0;
  cursor:pointer;
  font-family:inherit;
}
.compare-status-btn:hover{
  filter:brightness(.96);
  text-decoration:underline;
  text-underline-offset:2px;
}
.dashboard-mismatch-modal{
  width:min(1480px,calc(100vw - 40px))!important;
  max-width:1480px!important;
}
.dashboard-mismatch-meta{
  margin-top:3px;
  color:#667085;
  font-size:14px;
}
.dashboard-mismatch-totals{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin:10px 0 12px;
}
.dashboard-mismatch-totals>div{
  border:1px solid #e4e7ec;
  border-radius:10px;
  padding:10px 12px;
  background:#f9fafb;
}
.dashboard-mismatch-totals span{
  display:block;
  color:#667085;
  font-size:13px;
  margin-bottom:4px;
}
.dashboard-mismatch-totals strong{
  font-size:20px;
  color:#101828;
}
.dashboard-mismatch-totals .diff{
  background:#fff1f0;
  border-color:#fecdca;
}
.dashboard-mismatch-totals .diff strong{color:#b42318}
.dashboard-mismatch-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.dashboard-mismatch-grid h3{
  margin:0 0 7px;
  font-size:16px;
}
.dashboard-mismatch-table-wrap{
  max-height:58vh;
  border:1px solid #e4e7ec;
  border-radius:9px;
}
.dashboard-mismatch-table-wrap th{
  position:sticky;
  top:0;
  z-index:2;
  background:#f9fafb;
  white-space:nowrap;
}
.dashboard-mismatch-table-wrap th,
.dashboard-mismatch-table-wrap td{
  font-size:14px!important;
  padding:7px 8px!important;
}
.dashboard-detail-code{
  display:inline-block;
  margin-left:4px;
  color:#667085;
  font-size:11px;
}
@media(max-width:1000px){
  .dashboard-mismatch-grid{grid-template-columns:1fr}
}


/* v2.0.50 continuous-entry delete button + no-clipping */
#statementPurchaseConsumables th:last-child,
#statementSaleConsumables th:last-child,
#statementOtherTrades th:last-child{
  width:68px!important;
  min-width:68px!important;
}
#statementPurchaseConsumables td:last-child,
#statementSaleConsumables td:last-child,
#statementOtherTrades td:last-child{
  width:68px!important;
  min-width:68px!important;
  text-align:center;
  overflow:visible!important;
}
.statement-remove{
  display:inline-flex!important;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
  min-width:48px;
}
.dashboard-mismatch-table-wrap td:nth-child(2){
  white-space:nowrap;
}


/* v2.0.51 dashboard mismatch popup: daily inbound/outbound totals */
.daily-total-modal{
  width:min(1250px,calc(100vw - 40px))!important;
  max-width:1250px!important;
}
.daily-total-table-wrap{
  max-height:68vh;
}
#dashboardMismatchDailyTable th,
#dashboardMismatchDailyTable td{
  font-size:15px!important;
  padding:9px 10px!important;
}
#dashboardMismatchDailyTable th{
  position:sticky;
  top:0;
  z-index:2;
  background:#f9fafb;
  white-space:nowrap;
}
#dashboardMismatchDailyTable td:first-child{
  white-space:nowrap;
}
#dashboardMismatchDailyTable .daily-diff-cell{
  background:#fee4e2!important;
  color:#b42318!important;
  font-weight:900;
}
#dashboardMismatchDailyTable .daily-ok-cell{
  background:#ecfdf3!important;
  color:#067647!important;
  font-weight:800;
}
.dashboard-daily-legend{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  margin-top:10px;
  color:#667085;
  font-size:13px;
}


/* v2.0.52 matching date reset */
.matching-query-date .matching-reset-btn{
  min-height:34px;
  padding:7px 11px;
  white-space:nowrap;
  font-weight:800;
}


/* v2.0.53 dashboard daily breakdown by inbound category / outbound department */
.dashboard-breakdown-section + .dashboard-breakdown-section{
  margin-top:16px;
}
.dashboard-breakdown-title{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  margin:2px 0 7px;
}
.dashboard-breakdown-title strong{
  font-size:16px;
  color:#101828;
}
.dashboard-breakdown-title span{
  font-size:12px;
  color:#667085;
  text-align:right;
}
#dashboardMismatchInboundTable th,
#dashboardMismatchInboundTable td,
#dashboardMismatchOutboundTable th,
#dashboardMismatchOutboundTable td{
  font-size:15px!important;
  padding:9px 10px!important;
}
#dashboardMismatchInboundTable th,
#dashboardMismatchOutboundTable th{
  position:sticky;
  top:0;
  z-index:2;
  background:#f9fafb;
  white-space:nowrap;
}


/* v2.0.54 targeted mismatch popup */
.targeted-mismatch-modal{
  width:min(860px,calc(100vw - 40px))!important;
  max-width:860px!important;
}
.targeted-mismatch-table-wrap{max-height:68vh}
#dashboardMismatchTargetTable th,
#dashboardMismatchTargetTable td{
  font-size:15px!important;
  padding:10px 12px!important;
}
#dashboardMismatchTargetTable th{
  position:sticky;
  top:0;
  z-index:2;
  background:#f9fafb;
  white-space:nowrap;
}
#dashboardMismatchTargetTable td:first-child{white-space:nowrap}


/* v2.0.55 reconcile sorting / day-only entry / customer master */
.statement-sort-head{
  width:100%;
  border:0;
  background:transparent;
  padding:0;
  font:inherit;
  font-weight:800;
  color:inherit;
  cursor:pointer;
  text-align:inherit;
  white-space:nowrap;
}
.statement-sort-head span{
  margin-left:4px;
  color:#98a2b3;
  font-size:11px;
}
.statement-sort-head:hover{color:#175cd3}
.statement-day-input{
  min-width:58px!important;
  max-width:70px!important;
  text-align:center;
}
.statement-day-input.day-invalid,
.customer-name-input.customer-invalid{
  border-color:#d92d20!important;
  box-shadow:0 0 0 2px rgba(217,45,32,.12)!important;
  background:#fff6f5!important;
}
.statement-input:disabled,
.statement-input.statement-disabled{
  background:#f2f4f7!important;
  color:#98a2b3!important;
  cursor:not-allowed;
}
.patient-copy-link{
  border:0;
  background:transparent;
  padding:0;
  color:#175cd3;
  font:inherit;
  font-weight:800;
  cursor:pointer;
  text-decoration:underline;
  text-underline-offset:3px;
}
.patient-copy-link:hover{color:#004eeb}
.customer-master-card{margin-top:12px}
.customer-master-wrap{max-height:470px}
.customer-info-cell{
  font-size:12px!important;
  color:#667085;
  line-height:1.45;
}
.customer-autocomplete{
  position:fixed;
  z-index:10000;
  max-height:280px;
  overflow:auto;
  background:#fff;
  border:1px solid #d0d5dd;
  border-radius:8px;
  box-shadow:0 12px 28px rgba(16,24,40,.18);
  padding:4px;
}
.customer-autocomplete button{
  width:100%;
  border:0;
  background:#fff;
  padding:8px 9px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  text-align:left;
  cursor:pointer;
  border-radius:6px;
  font-size:14px;
}
.customer-autocomplete button:hover,
.customer-autocomplete button:focus{background:#eff8ff}
.customer-autocomplete button strong{color:#101828}
.customer-autocomplete button span{color:#667085;font-size:12px}


/* v2.0.58 header shared month / neutral patient / material date status */
header{
  align-items:center;
}
.header-main-row{
  display:flex;
  align-items:center;
  gap:18px;
  flex-wrap:wrap;
  min-width:0;
}
.header-main-row h1{
  margin:0;
  white-space:nowrap;
}
.global-month-control{
  display:flex;
  align-items:center;
  gap:6px;
}
.global-month-control input[type="month"]{
  min-width:150px;
  height:34px;
}
.patient-copy-text{
  color:#101828;
  font:inherit;
  font-weight:400;
  text-decoration:none;
  cursor:pointer;
}
.patient-copy-text:hover{
  color:#101828;
  text-decoration:none;
}
.horizontal-day-calendar .day-cell{
  position:relative;
}
.day-data-check{
  position:absolute;
  top:3px;
  right:4px;
  font-size:11px;
  font-weight:900;
  line-height:1;
  pointer-events:none;
}
.day-data-check.ok{color:#12b76a}
.day-data-check.missing{color:#d92d20}
.day-number{
  display:inline-block;
}
@media(max-width:900px){
  .header-main-row{
    gap:8px;
  }
  .header-main-row h1{
    width:100%;
  }
}


/* v2.0.60 authentication / external users / admin audit */
.auth-overlay{
  position:fixed;inset:0;z-index:50000;display:flex;align-items:center;justify-content:center;
  padding:24px;background:linear-gradient(135deg,#f2f4f7,#eaf2ff);
}
.auth-overlay[hidden]{display:none!important}
.auth-card{width:min(430px,100%);background:#fff;border:1px solid #e4e7ec;border-radius:18px;padding:28px;box-shadow:0 24px 70px rgba(16,24,40,.18)}
.auth-brand h1{margin:0 0 6px;font-size:25px}.auth-brand p{margin:0 0 22px;color:#667085}
.auth-form{display:grid;gap:14px}.auth-form[hidden]{display:none!important}.auth-form label{display:grid;gap:6px;font-size:13px;font-weight:700;color:#344054}
.auth-form input{height:42px;border:1px solid #d0d5dd;border-radius:8px;padding:0 11px;font:inherit}
.auth-info{padding:10px 12px;border-radius:8px;background:#eff8ff;color:#175cd3;font-size:13px;line-height:1.5}
.auth-message{min-height:22px;margin-top:12px;font-size:13px;color:#475467}.auth-message.error{color:#d92d20}
.user-badge{white-space:nowrap}.compact-header-btn{padding:5px 9px!important;font-size:12px!important}
.viewer-mode .statement-remove,.viewer-mode #matchingResetBtn,.viewer-mode #matchingQueryBtn,.viewer-mode #materialAdd,.viewer-mode #materialImportBtn,.viewer-mode #specialRuleAdd{opacity:.45;pointer-events:none}
.admin-card{margin-bottom:14px}.admin-user-create{display:grid;grid-template-columns:1fr 1fr 160px 1fr auto;gap:8px;margin-bottom:12px}
.admin-user-create input,.admin-user-create select,.admin-audit-toolbar input,.admin-audit-toolbar select{height:38px;border:1px solid #d0d5dd;border-radius:7px;padding:0 9px;font:inherit;background:#fff}
.admin-table-wrap{max-height:380px}.admin-actions{white-space:nowrap}.admin-actions button{margin-right:4px}
.admin-audit-toolbar{display:flex;gap:8px;margin-bottom:10px}.admin-audit-toolbar input{flex:1}.admin-audit-wrap{max-height:500px}
#adminAuditTable small{display:block;color:#98a2b3;font-size:11px}.admin-audit-detail{margin-top:12px;max-height:340px;overflow:auto;padding:12px;background:#101828;color:#f2f4f7;border-radius:8px;font-size:12px;white-space:pre-wrap}
@media(max-width:900px){.admin-user-create{grid-template-columns:1fr 1fr}.admin-user-create button{grid-column:1/-1}.admin-audit-toolbar{flex-direction:column}}


/* v2.0.61 LAN IP auto-auth / external account login */
body.local-auto-auth #currentUserBadge{font-weight:700}
#adminLoginBtn{white-space:nowrap}
