:root {
  --sidebar-w:  220px;
  /* 모두의CSO 톤 */
  --cream:      #F2EDE4;
  --cream-deep: #EAE3D8;
  --brown:      #3D2B1F;
  --brown2:     #5C3D2E;
  --brown3:     #7A5544;
  --gold:       #C4956A;
  --gold-lt:    #D4A87A;
  --gold-bg:    #FBF7F2;
  /* 시스템 색상 유지 (기능용) */
  --blue:       #C4956A;   /* 액션컬러 → 골드로 */
  --blue-lt:    #D4A87A;
  --blue-bg:    #FBF7F2;
  --accent:     #C4956A;
  --white:      #ffffff;
  --gray-50:    #FAF8F5;
  --gray-100:   #F2EDE4;
  --gray-200:   #E0D6C8;
  --gray-400:   #A89880;
  --gray-600:   #6B5744;
  --gray-800:   #1e293b;
  --red:        #C0392B;
  --green:      #2E7D52;
  --radius:     12px;
  --shadow:     0 2px 8px rgba(61,43,31,.07), 0 4px 20px rgba(61,43,31,.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow-x: hidden; }
body {
  font-family: 'Pretendard', 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  font-size: 17px;
  background: var(--cream);
  color: var(--brown);
  display: flex;
}
input, select, textarea, button { font-family: inherit; }
a { color: var(--gold); text-decoration: none; }

/* ══ LAYOUT ══════════════════════════════ */
#app { display: flex; width: 100%; min-height: 100vh; overflow-x: hidden; }

/* ── Sidebar ─────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--brown);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  box-shadow: 2px 0 16px rgba(0,0,0,.18);
  overflow: hidden;
}
.sidebar-logo {
  padding: 32px 24px 22px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .brand {
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -.3px;
  line-height: 1.2;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
}
.sidebar-logo .brand span { color: var(--gold); font-style: normal; }
.sidebar-logo .sub {
  font-size: 13px;
  color: rgba(255,255,255,.6);
  font-weight: 600;
  margin-top: 5px;
  letter-spacing: .5px;
}
.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 16px 12px;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 16px 12px 6px;
  opacity: 0.75;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 17px;
  font-weight: 500;
  color: rgba(255,255,255,.88);
  transition: all .15s;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.10); color: var(--white); }
.nav-item.active {
  background: var(--gold);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(196,149,106,.45);
}
.nav-item .nav-icon { width: 20px; height: 20px; text-align: center; flex-shrink: 0; display:flex; align-items:center; justify-content:center; }
/* 아코디언 그룹 없이 최상위에 단독으로 붙는 메뉴 — 그룹 헤더처럼 골드로 (active시엔 .nav-item.active가 우선 적용됨) */
.nav-item-gold-label { color: var(--gold); font-weight: 700; font-size: 16px; padding: 12px 14px 8px; }
.nav-divider { height: 1px; background: rgba(255,255,255,.10); margin: 10px 12px; }
.nav-accordion {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: none; cursor: pointer;
  font-size: 16px; font-weight: 700; color: var(--gold);
  letter-spacing: 0.5px;
  padding: 12px 14px 8px; opacity: 0.9;
  transition: opacity .15s;
}
.nav-accordion:hover { opacity: 1; }
.nav-accordion .acc-arrow { transition: transform .25s; flex-shrink:0; }
.nav-accordion.open .acc-arrow { transform: rotate(180deg); }
.nav-acc-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height .28s ease;
}
.nav-acc-body.open { max-height: 400px; }
.sidebar-footer {
  padding: 16px 24px;
  font-size: 13px;
  color: rgba(255,255,255,.35);
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ── Main Area ───────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100%;
}
.topbar {
  background: var(--brown);
  border-bottom: 1px solid rgba(255,255,255,.08);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar-logo {
  display: none;
  flex-direction: column;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1.2;
  user-select: none;
}
.topbar-logo-brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--white);
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
  letter-spacing: -.3px;
}
.topbar-logo-brand span { color: var(--gold); }
.topbar-logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,.45);
  font-weight: 500;
  letter-spacing: .6px;
  text-transform: uppercase;
}
.topbar-slogan {
  flex: 1;
  text-align: center;
  font-size: 15px;
  color: rgba(255,255,255,.7);
  font-style: normal;
  letter-spacing: .5px;
  white-space: nowrap;
  font-weight: 600;
}
.topbar-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--brown);
  flex: 1;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
  letter-spacing: -.3px;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.topbar-actions .reset-btn { color: rgba(255,255,255,.6); border-color: rgba(255,255,255,.2); background: transparent; }
.topbar-actions .reset-btn:hover { background: rgba(255,255,255,.1); color: var(--white); }

.wrap { padding: 32px 36px; flex: 1; overflow-x: hidden; max-width: 100%; box-sizing: border-box; }

/* ══ CARDS ════════════════════════════ */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(61,43,31,.06);
}
.section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--brown);
  margin-bottom: 16px;
  padding-bottom: 10px;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
  border-bottom: 2px solid var(--gold-bg);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .title-icon { font-size: 18px; }

/* ══ FORM ══════════════════════════════ */
.form-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; max-width: 780px; }
#view-input .form-grid { grid-template-columns: repeat(3,1fr); max-width: 100%; }
.field label { font-size: 14px; color: var(--brown3); display: block; margin-bottom: 6px; font-weight: 700; letter-spacing: .2px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 17px;
  background: var(--white);
  color: var(--gray-800);
  transition: border-color .15s, box-shadow .15s;
}
.field input, .field select { height: 44px; }
.field textarea { padding: 10px 12px; resize: vertical; min-height: 68px; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196,149,106,.15);
}
.required { color: var(--red); }

/* ══ BUTTONS ════════════════════════ */
.btn {
  height: 38px;
  padding: 0 18px;
  border: 1.5px solid var(--gray-200);
  border-radius: 100px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  background: var(--white);
  color: var(--brown);
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:hover { background: var(--gray-100); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--gold); color: var(--white); border-color: var(--gold); border-radius: 100px; }
.btn-primary:hover:not(:disabled) { background: var(--brown3); border-color: var(--brown3); }
.btn-sm { height: 32px; padding: 0 14px; font-size: 14px; border-radius: 100px; }
.btn-danger { color: var(--red); border-color: #fecaca; }
.btn-danger:hover:not(:disabled) { background: #fef2f2; }
.btn-success { background: var(--green); color: var(--white); border-color: var(--green); }
.btn-success:hover:not(:disabled) { background: #059669; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }
.reset-btn { color: #b85c5c; border-color: #f5c6c6; background: #fdf2f2; border-radius: 100px; }
.reset-btn:hover { background: #fee2e2; }

/* ══ OCR ZONE ═══════════════════════ */
.ocr-zone { border: 1.5px solid var(--gray-200); border-radius: var(--radius); padding: 18px; background: var(--gray-50); }
.ocr-drop {
  border: 2px dashed var(--gray-200);
  border-radius: 8px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--white);
  transition: all .15s;
  user-select: none;
}
.ocr-drop:hover, .ocr-drop.dragover { background: var(--gold-bg); border-color: var(--gold); }
.ocr-drop input[type=file] { display: none; }
.ocr-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: flex-start; }
.ocr-preview-item { position: relative; }
.ocr-preview-item img { height: 80px; border-radius: 6px; border: 1.5px solid var(--gray-200); display: block; cursor: pointer; }
.ocr-preview-item .file-badge { height: 80px; width: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: var(--gray-100); border: 1.5px solid var(--gray-200); border-radius: 6px; font-size: 12px; color: var(--gray-600); text-align: center; padding: 4px; word-break: break-all; cursor: pointer; }
.ocr-btns { display: flex; gap: 8px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.ocr-result { margin-top: 12px; padding: 12px 14px; background: var(--white); border: 1.5px solid var(--gray-200); border-radius: 8px; font-size: 15px; color: var(--gray-600); min-height: 44px; white-space: pre-wrap; line-height: 1.7; }
.ocr-loading { display: none; font-size: 15px; color: var(--gold); padding: 6px 0; align-items: center; gap: 6px; }
.ocr-loading.show { display: flex; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--gray-200); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ══ PROGRESS ════════════════════════ */
.progress-wrap { display: none; margin-top: 8px; }
.progress-wrap.show { display: block; }
.progress-bar-bg { height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--gold); border-radius: 3px; transition: width .3s; width: 0%; }
.progress-text { font-size: 13px; color: var(--gray-400); margin-top: 4px; }

/* ══ OCR SEP PANEL ═══════════════════ */
.ocr-sep-panel { margin-top: 12px; padding: 14px 16px; background: var(--gold-bg); border: 1.5px solid var(--gray-200); border-radius: 12px; display: none; }
.ocr-sep-panel.show { display: block; }
.sep-summary { font-size: 15px; line-height: 2; white-space: pre-wrap; background: var(--white); padding: 10px 12px; border-radius: 6px; border: 1.5px solid var(--gray-200); }
.sep-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--white); border: 1.5px solid var(--gray-200); border-radius: 6px; margin-bottom: 4px; font-size: 15px; flex-wrap: wrap; }
.sep-actions { margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ══ TABLE ═══════════════════════════ */
.tbl-wrap { overflow-x: auto; border-radius: 8px; border: 1.5px solid var(--gray-200); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 700px; }
th { background: var(--gray-50); font-weight: 700; padding: 12px 10px; border-bottom: 2px solid var(--gray-200); text-align: center; white-space: nowrap; color: var(--gray-600); font-size: 15px; letter-spacing: .3px; }
td { padding: 9px 6px; border-bottom: 1px solid var(--gray-100); text-align: center; vertical-align: middle; color: var(--gray-800); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gold-bg); }
td input { width: 100%; border: 1.5px solid transparent; border-radius: 6px; padding: 4px 8px; font-size: 15px; text-align: center; background: transparent; transition: all .15s; }
td input:focus { outline: none; border-color: var(--gold); background: var(--white); box-shadow: 0 0 0 2px rgba(196,149,106,.15); }
td select { border: 1.5px solid transparent; border-radius: 6px; padding: 4px 6px; font-size: 14px; background: transparent; cursor: pointer; }
td select:focus { outline: none; border-color: var(--gold); background: var(--white); }
.td-note { font-size: 14px; color: var(--gray-400); }
.td-verify-ok { color: var(--green); font-size: 13px; font-weight: 700; }
.td-verify-fail { color: var(--red); font-size: 13px; font-weight: 700; }

/* ══ STATUS BAR ══════════════════════ */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  font-size: 15px;
  color: var(--gray-600);
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  bottom: 0;
  z-index: 50;
}
.footer-btns { display: flex; gap: 8px; }
.status { font-size: 15px; color: var(--gray-400); }

/* ══ ATTACH FILES ═════════════════════ */
.attach-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.attach-controls { display: flex; gap: 8px; align-items: center; }
.attach-list { display: flex; gap: 10px; flex-wrap: wrap; min-height: 56px; align-items: flex-start; padding: 4px 0; }
.attach-item { display: flex; flex-direction: column; align-items: center; gap: 5px; background: var(--gray-50); border: 1.5px solid var(--gray-200); padding: 8px; border-radius: 8px; font-size: 13px; position: relative; max-width: 110px; text-align: center; }
.attach-item img { max-width: 90px; max-height: 70px; border-radius: 4px; cursor: pointer; border: 1px solid var(--gray-200); display: block; }
.attach-item a { color: inherit; text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.attach-item a:hover .attach-name { text-decoration: underline; color: var(--gold); }
.attach-file-icon { font-size: 30px; line-height: 1; }
.attach-name { font-size: 12px; color: var(--gray-600); word-break: break-all; display: block; max-width: 96px; }
.attach-type-badge { font-size: 12px; color: var(--gray-600); background: var(--gray-100); padding: 1px 6px; border-radius: 4px; }
.attach-remove { position: absolute; top: 2px; right: 4px; cursor: pointer; color: var(--red); font-size: 18px; line-height: 1; background: rgba(255,255,255,.9); border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.attach-empty { font-size: 14px; color: var(--gray-400); }
.attach-icon-badge { font-size: 15px; opacity: .7; cursor: default; }
.hide-mobile { display: table-cell; }
.show-mobile { display: none; }

/* ══ LIST VIEW ════════════════════════ */
.list-view-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.list-tab { padding: 7px 18px; border: 1.5px solid var(--gray-200); border-radius: 20px; cursor: pointer; font-size: 15px; font-weight: 600; background: var(--white); color: var(--gray-600); transition: all .15s; }
.list-tab:hover { background: var(--gray-100); }
.list-tab.active { background: var(--gold); color: var(--white); border-color: var(--gold); }
.list-group { margin-bottom: 16px; }
.list-group-title { font-size: 15px; font-weight: 700; color: var(--brown2); margin-bottom: 8px; background: var(--gold-bg); padding: 8px 12px; border-radius: 8px; display: flex; align-items: center; gap: 6px; }
.list-row { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; border: 1.5px solid var(--gray-200); border-radius: 10px; margin-bottom: 8px; background: var(--white); transition: border-color .15s; }
.list-row:hover { border-color: var(--gold-lt); }
.list-row-top { display: flex; align-items: center; gap: 8px; }
.list-row-top label { display: flex; align-items: center; gap: 6px; font-size: 15px; cursor: pointer; }
.list-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 13px; color: var(--gray-400); }
.list-row-date { font-size: 12px; color: var(--gray-400); }
.meta-dot { color: var(--gray-200); }
.list-row .meta { font-size: 13px; color: var(--gray-400); }
.list-row .list-btns { display: flex; gap: 6px; flex-shrink: 0; margin-left: auto; }
.export-bar { display: flex; gap: 8px; align-items: center; padding-top: 12px; border-top: 1px solid var(--gray-200); margin-top: 12px; flex-wrap: wrap; }

/* ══ DRUG DROP ═════════════════════════ */
.drug-drop-item.active { background: #f5f0e8 !important; }
/* ══ TOAST ════════════════════════════ */
#toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  background: var(--brown);
  color: #fff;
  padding: 20px 40px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  white-space: pre-line;
  max-width: 80vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 9999;
  box-shadow: 0 8px 40px rgba(0,0,0,.35);
  letter-spacing: -0.3px;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
/* ══ MASTER VIEW ══════════════════════ */
.master-tbl td:first-child { text-align: left; font-weight: 500; }
.master-add-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px; background: var(--gray-50); border-radius: 8px; margin-bottom: 12px; border: 1.5px solid var(--gray-200); }
.master-add-row input { height: 38px; border: 1.5px solid var(--gray-200); border-radius: 8px; padding: 0 12px; font-size: 15px; flex: 1; min-width: 140px; }
.master-add-row input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(196,149,106,.15); }
.master-sections { display: flex; flex-direction: column; gap: 0; }
.master-form-area { margin-top: 20px; padding: 20px; background: var(--gray-50); border-radius: 12px; border: 1.5px solid var(--gray-200); }
.master-form-title { font-size: 15px; font-weight: 700; color: var(--brown2); margin-bottom: 14px; }
.master-form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.master-form-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.empty-tip { text-align: center; color: var(--gray-400); font-size: 15px; padding: 24px 0; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: var(--gray-100); color: var(--gray-600); }
.codes-cell { font-size: 13px; color: var(--gray-400); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ══ MODAL ════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--white);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,.22);
  border-top: 3px solid var(--gold);
  width: 90%;
  max-width: 860px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header { padding: 20px 24px; border-bottom: 2px solid var(--gray-100); background: var(--cream); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 18px; font-weight: 700; color: var(--brown); }
.modal-close { width: 32px; height: 32px; border: none; background: var(--gray-100); border-radius: 8px; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; color: var(--gray-600); transition: all .15s; }
.modal-close:hover { background: var(--gray-200); }
.modal-body { flex: 1; overflow-y: auto; padding: 0; }

/* ══ GALLERY MODAL ════════════════════ */
.gallery-modal { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.7); backdrop-filter: blur(6px); z-index: 1100; align-items: center; justify-content: center; padding: 20px; }
.contract-content-area { overflow-x: hidden !important; word-break: keep-all; border: 2px solid #3D2B1F; border-radius: 8px; }
.contract-content-area table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.contract-content-area td, .contract-content-area th { word-break: break-all; overflow-wrap: break-word; }
.gallery-modal.show, .gallery-modal[style*="flex"] { display: flex !important; }
.gallery-box { background: var(--white); border-radius: 14px; width: 100%; max-width: 900px; max-height: 88vh; overflow-y: auto; padding: 24px; box-shadow: 0 24px 64px rgba(0,0,0,.3); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-top: 16px; }
.gallery-item { border: 1.5px solid var(--gray-200); border-radius: 10px; overflow: hidden; background: var(--gray-50); }
.gallery-item img { width: 100%; height: 140px; object-fit: cover; display: block; }
.gallery-label { padding: 8px 10px; font-size: 13px; color: var(--gray-600); line-height: 1.5; }
.gallery-empty { text-align: center; padding: 40px; color: var(--gray-400); font-size: 16px; }

/* ══ LOADING OVERLAY ══════════════════ */
.loading-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.4); backdrop-filter: blur(2px); z-index: 2000; align-items: center; justify-content: center; }
.loading-overlay.active { display: flex; }
.loading-box { background: var(--white); border-radius: 14px; padding: 28px 36px; display: flex; align-items: center; gap: 14px; box-shadow: 0 16px 48px rgba(0,0,0,.2); font-size: 17px; font-weight: 600; color: var(--gray-800); }
.loading-spinner { width: 28px; height: 28px; border: 3px solid var(--gray-200); border-top-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite; }

/* ══ BADGES ═══════════════════════════ */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 13px; font-weight: 700; vertical-align: middle; }
.badge-bio { background: #d4edda; color: #1a5c35; border: 1px solid #8bc4a0; }
.badge-price-ok { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.badge-price-down { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }
.disease-codes-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 16px; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
.disease-label { font-size: 14px; color: var(--gray-600); font-weight: 700; margin-right: 4px; }
.disease-info { font-size: 12px; color: var(--gray-400, #9ca3af); font-weight: 400; cursor: pointer; padding: 2px; }
.disease-info-bubble { position: fixed; z-index: 3000; max-width: 240px; background: var(--gray-800, #1f2937); color: #fff; font-size: 12px; line-height: 1.4; padding: 8px 10px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.disease-tag { font-size: 14px; padding: 2px 10px; border-radius: 12px; background: var(--gray-100); color: var(--gray-600); }
.disease-tag.disease-primary { background: var(--gold-bg); color: var(--brown2); font-weight: 700; }

@media (max-width: 768px) {
  /* ── 기존 사이드바 완전 숨김 (모바일에선 슬라이드 패널로 대체) ── */
  .sidebar { display: none !important; }

  /* ── 더보기 버튼 모바일에서만 표시 ── */
  #btn-more-menu { display: inline-flex !important; }

  /* ── 메인 영역 ── */
  .main-area {
    margin-left: 0 !important;
    padding-bottom: 64px;
  }
  .topbar {
    padding: 0 14px;
    height: 52px;
    gap: 8px;
  }
  .topbar-logo { display: flex !important; }
  .topbar-logo-brand { font-size: 16px; }
  .topbar-slogan { font-size: 11px; }
  .topbar-title { font-size: 17px; }
  .wrap { padding: 14px 14px; }

  /* ── 폼 그리드: 1열 ── */
  .form-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
  .form-grid .field { width: 100%; }

  /* ── 카드 ── */
  .card { padding: 16px 14px; border-radius: 12px; }

  /* ── 테이블 ── */
  .tbl-wrap { border-radius: 6px; overflow-x: auto; }
  table { font-size: 12px; min-width: unset; width: 100%; }
  th { padding: 7px 4px; font-size: 11px; white-space: nowrap; }
  td { padding: 6px 3px; font-size: 12px; }
  td input { font-size: 12px; padding: 3px 4px; }
  td select { font-size: 11px; padding: 2px 2px; }
  /* 처방입력 테이블 모바일 최적화 */
  #view-input .tbl-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  #view-input .tbl-wrap table { min-width: 700px !important; table-layout: fixed !important; }
  #view-input th { padding: 6px 3px; font-size: 10px; white-space: nowrap; }
  #view-input td { padding: 5px 3px; font-size: 11px; white-space: nowrap; }
  #view-input td input { font-size: 11px; padding: 2px 2px; box-sizing: border-box; }
  #view-input td select { font-size: 10px; }
  #view-input .del-btn { font-size: 9px !important; padding: 2px 5px !important; height: 22px !important; min-width: 0 !important; border-radius: 10px !important; }
  #edi-foot td { font-size: 11px !important; padding: 6px 3px !important; white-space: nowrap; }

  /* ── OCR 영역 ── */
  .ocr-drop { padding: 18px 12px; }
  .ocr-btns { flex-wrap: wrap; }
  .ocr-btns .btn { flex: 1; min-width: 100px; }

  /* ── 상태바 ── */
  .status-bar {
    padding: 10px 14px;
    font-size: 14px;
    flex-wrap: wrap;
  }
  .footer-btns { width: 100%; justify-content: flex-end; }

  /* ── 저장목록 ── */
  .list-row { padding: 10px 12px; }
  .list-row-top label { font-size: 14px; }
  .list-view-tabs { flex-wrap: wrap; }

  /* ── 마스터관리 ── */
  .master-add-row { flex-direction: column; }
  .master-add-row input { width: 100%; min-width: unset; }

  /* ── 버튼 크기 ── */
  .btn { font-size: 14px; height: 40px; padding: 0 14px; }
  .btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }

  /* ── 첨부파일 ── */
  .attach-header { flex-direction: column; align-items: flex-start; }
  .attach-controls { width: 100%; justify-content: flex-end; }

  /* ── 갤러리 ── */
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .gallery-box { padding: 16px; }

  /* ── topbar 초기화 버튼 ── */
  .topbar-actions .reset-btn { font-size: 13px; padding: 0 10px; height: 34px; }

  /* ── 섹션 타이틀 ── */
  .section-title { font-size: 15px; }
}

@media (max-width: 400px) {
  .nav-item { font-size: 9px; min-width: 52px; }
  .wrap { padding: 10px 10px; max-width: 100vw; }
  .main-area { max-width: 100vw; }
  /* 대시보드 하단 1열 */
  #view-dashboard > div:last-child { grid-template-columns: 1fr !important; }
  /* 수수료관리 알림박스 */
  .alert { white-space: normal !important; overflow-wrap: break-word; word-break: keep-all; max-width: 100%; }
  /* upload-zone */
  .upload-zone, .upload-card { max-width: 100%; overflow: hidden; }
  /* field input 넘침 */
  .field input, .field select, .field textarea { max-width: 100%; box-sizing: border-box; }
  /* 카드 */
  .card { max-width: 100%; overflow: hidden; }
  table { min-width: 620px; }
}

/* ── 로그인 화면 ── */
#login-screen {
  position: fixed; inset: 0; background: var(--cream);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.login-box {
  background: var(--white); border-radius: 16px;
  padding: 48px 40px; width: 360px;
  box-shadow: 0 8px 40px rgba(61,43,31,.12);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand .brand-name { font-size: 26px; font-weight: 800; color: var(--brown); }
.login-brand .brand-name span { color: var(--gold); }
.login-brand .brand-sub { font-size: 13px; color: var(--gray-400); margin-top: 4px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.login-field input {
  width: 100%; box-sizing: border-box;
  padding: 10px 14px; border: 1.5px solid var(--gray-200);
  border-radius: 8px; font-size: 15px; outline: none;
  transition: border-color .15s;
}
.login-field input:focus { border-color: var(--gold); }
.login-btn {
  width: 100%; padding: 12px; background: var(--brown);
  color: #fff; border: none; border-radius: 8px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  margin-top: 8px; transition: background .15s;
}
.login-btn:hover { background: var(--brown2); }
.login-error { color: #e53e3e; font-size: 13px; text-align: center; margin-top: 10px; min-height: 20px; }



/* ══ 모바일 네비게이션 CSS ══════════════════════════════════════ */
.mnav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 14px; border: none; border-radius: 10px;
  background: transparent; color: rgba(255,255,255,.65);
  font-size: 15px; font-weight: 500; cursor: pointer;
  text-align: left; transition: all .15s;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
}
.mnav-item:hover, .mnav-item:active { background: rgba(255,255,255,.1); color: #fff; }
.mnav-item.active { background: var(--gold); color: #fff; }
.mnav-item.mnav-sub { padding-left: 28px; font-size: 14px; }
/* 아코디언 그룹 없이 단독으로 붙는 모바일 메뉴 — 그룹헤더처럼 골드로 */
.mnav-item-gold-label { color: var(--gold); font-weight: 700; font-size: 16px; padding: 10px 12px 8px; }
.mnav-accordion {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: none; cursor: pointer;
  font-size: 16px; font-weight: 700; color: var(--gold);
  letter-spacing: 0.5px;
  padding: 10px 12px 8px; opacity: 0.9;
}
.mnav-accordion:hover { opacity: 1; }
.mnav-accordion .macc-arrow { transition: transform .25s; flex-shrink: 0; }
.mnav-accordion.open .macc-arrow { transform: rotate(180deg); }
.mnav-acc-body { overflow: hidden; max-height: 0; transition: max-height .28s ease; }
.mnav-acc-body.open { max-height: 400px; }
#mobile-nav nav::-webkit-scrollbar { display: none; }

.mtab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; border: none; background: transparent;
  color: rgba(255,255,255,.45); font-size: 10px; font-weight: 600;
  cursor: pointer; transition: all .15s; padding: 6px 0 4px;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
}
.mtab-item:active { background: rgba(255,255,255,.08); }
.mtab-item.active { color: var(--gold-lt); }
.mtab-item.active i { color: var(--gold-lt); }
.mtab-item span { font-size: 10px; }

/* 모바일에서만 탭바 표시 */
@media (max-width: 768px) {
  #mobile-tabbar { display: flex !important; }
}


/* ══ 탭/테이블 공용 CSS ════════════════════════════════════════════ */
.stl-tab-btn {
  padding: 10px 18px; border: none; background: transparent;
  font-size: 14px; font-weight: 600; color: var(--gray-400);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s;
  font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
}
.stl-tab-btn:hover { color: var(--brown); }
.stl-tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }
.stl-tbl { width:100%; border-collapse:collapse; font-size:13px; }
.stl-tbl th { background:var(--gray-50); font-weight:700; padding:10px 14px; border-bottom:2px solid var(--gray-200); text-align:left; color:var(--gray-600); font-size:14px; white-space:nowrap; }
.stl-tbl td { padding:10px 14px; border-bottom:1px solid var(--gray-100); color:var(--gray-800); vertical-align:middle; font-size:15px; }
.stl-tbl tr:last-child td { border-bottom:none; }
.stl-tbl tr:hover td { background:var(--gold-bg); }
.stl-tbl .num { text-align:right; font-variant-numeric:tabular-nums; }
.stl-tbl .total-row td { font-weight:700; background:var(--gold-bg); color:var(--brown); border-top:2px solid var(--gold-lt); }
/* ══ 탭/테이블 공용 CSS 끝 ══════════════════════════════════════════ */
/* ══ 검수 뷰 CSS ════════════════════════════════════════════════ */
.review-split { display:flex; gap:16px; align-items:stretch; }
.review-left  { flex:1; min-width:0; }
.review-right { flex:1; min-width:0; overflow-y:auto; max-height:calc(100vh - 160px); }
@media (max-width:900px) {
  .review-split { flex-direction:row; gap:8px; }
  .review-left  { flex:0 0 42%; }
  .review-right { flex:1; }
}
@media (max-width:600px) {
  .review-split { flex-direction:column; gap:12px; }
  .review-left  { flex:none; min-height:280px; }
  .review-right { flex:none; max-height:none; overflow-y:visible; }
}
#rev-img-wrap.grabbing { cursor:grabbing; }
#rev-img.high-contrast { filter: contrast(1.8) brightness(1.1); }
#rev-img.grayscale { filter: grayscale(1) contrast(1.5); }
#rev-img.high-contrast.grayscale { filter: grayscale(1) contrast(2.2) brightness(1.1); }
/* ══ 모바일 네비게이션 CSS 끝 ════════════════════════════════════ */

/* ══ 체크메이트 통합 CSS ══════════════════════════════════════════ */
:root {
  --surface:   #ffffff;
  --surface2:  #FAF8F5;
  --border:    #E0D6C8;
  --muted:     #A89880;
  --warm:      #C4956A;
  --ok:        #2E7D52;
  --ok-bg:     #f0fdf4;
  --cok:       #0891b2;
  --yellow:    #d97706;
  --yellow-bg: #fffbeb;
  --red-bg:    #fef2f2;
  --purple:    #7c3aed;
  --radius-sm: 8px;
}
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
@media (max-width:768px) { .grid-2 { grid-template-columns:1fr; } }
.card-header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; margin-bottom:16px; padding-bottom:10px; border-bottom:2px solid var(--gold-bg); }
.card-title { font-size:15px; font-weight:700; color:var(--brown); display:flex; align-items:center; gap:6px; }
.card-actions { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.form-group { margin-bottom:14px; }
.form-label { display:block; font-size:13px; font-weight:700; color:var(--brown3); margin-bottom:6px; }
.form-control { width:100%; border:1.5px solid var(--gray-200); border-radius:8px; padding:0 12px; height:40px; font-size:15px; background:var(--white); color:var(--gray-800); transition:border-color .15s,box-shadow .15s; box-sizing:border-box; }
.form-control:focus { outline:none; border-color:var(--gold); box-shadow:0 0 0 3px rgba(196,149,106,.15); }
.form-control-sm { height:34px; font-size:14px; padding:0 10px; }
select.form-control { cursor:pointer; }
textarea.form-control { height:auto; padding:10px 12px; resize:vertical; line-height:1.6; }
.form-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; }
.form-actions { display:flex; gap:8px; align-items:center; margin-top:16px; flex-wrap:wrap; }
.inline-label { font-size:12px; font-weight:700; color:var(--gray-400); background:var(--gray-100); padding:2px 8px; border-radius:4px; white-space:nowrap; margin-right:4px; }
.upload-zone { border:2px dashed var(--gray-200); border-radius:10px; padding:36px 20px; text-align:center; cursor:pointer; background:var(--gray-50); transition:all .15s; }
.upload-zone:hover,.upload-zone.drag-over { border-color:var(--gold); background:var(--gold-bg); }
.upload-zone-icon { font-size:36px; margin-bottom:10px; }
.upload-zone-text { font-size:16px; font-weight:600; color:var(--gray-600); margin-bottom:4px; }
.upload-zone-hint { font-size:13px; color:var(--gray-400); }
.kpi-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:10px; margin-bottom:16px; }
.kpi-card { background:var(--white); border:1.5px solid var(--gray-200); border-radius:12px; padding:14px 16px; cursor:pointer; transition:all .15s; text-align:center; }
.kpi-card:hover { border-color:var(--gold-lt); box-shadow:0 2px 8px rgba(196,149,106,.12); }
.kpi-card.active { border-color:var(--gold); background:var(--gold-bg); }
.kpi-label { font-size:12px; color:var(--gray-400); font-weight:600; margin-bottom:6px; }
.kpi-value { font-size:22px; font-weight:800; color:var(--brown); line-height:1; }
.kpi-sub { font-size:11px; color:var(--gray-400); margin-top:4px; }
.sep-org-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:12px; margin-bottom:16px; }
.sep-org-card { background:var(--white); border:1.5px solid var(--gray-200); border-radius:12px; padding:16px 18px; transition:box-shadow .15s; }
.sep-org-card:hover { box-shadow:0 4px 16px rgba(196,149,106,.12); }
.sep-org-name { font-size:15px; font-weight:700; color:var(--brown); margin-bottom:6px; }
.sep-org-stats { font-size:13px; color:var(--gray-400); }
.sep-org-amount { font-size:16px; font-weight:700; color:var(--gold); margin-top:4px; }
.progress-bar { height:6px; background:var(--gray-200); border-radius:3px; overflow:hidden; margin-top:6px; }
.progress-fill { height:100%; border-radius:3px; transition:width .3s; background:var(--gold); }
.chart-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px; }
@media (max-width:768px) { .chart-grid { grid-template-columns:1fr; } }
.chart-card { background:var(--white); border:1.5px solid var(--gray-200); border-radius:12px; padding:16px 18px; }
.chart-title { font-size:13px; font-weight:700; color:var(--gray-600); margin-bottom:10px; }
.chart-wrap { position:relative; }
.inner-tabs { display:flex; gap:8px; margin-bottom:16px; flex-wrap:wrap; }
.inner-tab-btn { padding:7px 18px; border:1.5px solid var(--gray-200); border-radius:20px; cursor:pointer; font-size:14px; font-weight:600; background:var(--white); color:var(--gray-600); transition:all .15s; }
.inner-tab-btn:hover { background:var(--gray-100); }
.inner-tab-btn.active { background:var(--gold); color:var(--white); border-color:var(--gold); }
.badge-blue   { background:#dbeafe; color:#1e40af; border:1px solid #93c5fd; }
.badge-green  { background:#d1fae5; color:#065f46; border:1px solid #6ee7b7; }
.badge-gray   { background:var(--gray-100); color:var(--gray-600); border:1px solid var(--gray-200); }
.badge-yellow { background:#fef3c7; color:#92400e; border:1px solid #fcd34d; }
.badge-red    { background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; }
.status-ok    { background:#d1fae5; color:#065f46; border:1px solid #6ee7b7; }
.status-cok   { background:#dbeafe; color:#1e40af; border:1px solid #93c5fd; }
.status-check { background:#fef3c7; color:#92400e; border:1px solid #fcd34d; }
.status-fail  { background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; }
.status-qty   { background:#ede9fe; color:#5b21b6; border:1px solid #c4b5fd; }
.status-amt   { background:#ffedd5; color:#9a3412; border:1px solid #fdba74; }
.filter-chips { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:12px; }
.chip { padding:4px 12px; border:1.5px solid var(--gray-200); border-radius:20px; font-size:13px; font-weight:600; cursor:pointer; background:var(--white); color:var(--gray-600); transition:all .15s; }
.chip:hover { background:var(--gray-100); }
.chip.active { background:var(--gold); color:var(--white); border-color:var(--gold); }
.table-wrap { overflow-x:auto; border-radius:8px; border:1.5px solid var(--gray-200); }
.tbl { width:100%; border-collapse:collapse; font-size:14px; }
.tbl th { background:var(--gray-50); font-weight:700; padding:10px; border-bottom:2px solid var(--gray-200); text-align:left; color:var(--gray-600); font-size:13px; white-space:nowrap; }
.tbl td { padding:8px 10px; border-bottom:1px solid var(--gray-100); color:var(--gray-800); vertical-align:middle; font-size:13px; }
.tbl tr:last-child td { border-bottom:none; }
.tbl tr:hover td { background:var(--gold-bg); }
.mono { font-family:'Courier New',monospace; font-size:13px; }
.compare-row { display:grid; grid-template-columns:1fr auto 1fr; gap:16px; margin-bottom:12px; }
.compare-label { font-size:12px; font-weight:700; color:var(--gray-400); margin-bottom:8px; text-transform:uppercase; letter-spacing:.5px; }
.compare-field { font-size:13px; color:var(--gray-700); margin-bottom:4px; }
.compare-diff { color:var(--gray-400); font-size:20px; align-self:center; text-align:center; }
.empty-state { text-align:center; padding:40px 20px; color:var(--gray-400); }
.empty-state-icon { font-size:36px; margin-bottom:10px; }
.empty-state-text { font-size:15px; font-weight:600; color:var(--gray-600); }
.empty-state-hint { font-size:13px; margin-top:6px; }
.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.section-title { font-size:15px; font-weight:700; color:var(--brown); }
.btn-xs { height:26px; padding:0 10px; font-size:12px; border-radius:20px; }
#cso-drawer { position:fixed; top:0; right:-440px; width:440px; height:100vh; background:var(--white); z-index:1500; box-shadow:-4px 0 24px rgba(0,0,0,.15); transition:right .3s cubic-bezier(.4,0,.2,1); overflow-y:auto; padding:24px; }
#cso-drawer.open { right:0; }
#cso-drawer-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.35); z-index:1400; backdrop-filter:blur(2px); }
#cso-drawer-overlay.show { display:block; }
@media (max-width:768px) {
  #cso-drawer { width:100%; right:-100%; }
  .kpi-grid { grid-template-columns:repeat(3,1fr); }
  .sep-org-grid { grid-template-columns:1fr 1fr; }
  .chart-grid { grid-template-columns:1fr; }
}
/* ══ 체크메이트 CSS 끝 ══════════════════════════════════════════ */

/* ══ 바텀시트 ══════════════════════════════════════════════════ */
.bs-overlay {
  display:none;position:fixed;inset:0;background:rgba(0,0,0,0.45);z-index:9998;
  opacity:0;transition:opacity 0.2s;
}
.bs-overlay.bs-show { display:block;opacity:1; }
.bs-sheet {
  position:fixed;bottom:0;left:0;right:0;background:#fff;z-index:9999;
  border-radius:16px 16px 0 0;max-height:70vh;display:flex;flex-direction:column;
  transform:translateY(100%);transition:transform 0.25s cubic-bezier(0.32,0.72,0,1);
}
.bs-sheet.bs-show { transform:translateY(0); }
.bs-handle {
  width:36px;height:4px;background:#d0d0d0;border-radius:2px;
  margin:12px auto 0;flex-shrink:0;
}
.bs-title {
  font-size:15px;font-weight:600;color:#222;padding:12px 20px 8px;
  flex-shrink:0;border-bottom:1px solid #f0f0f0;
}
.bs-list {
  overflow-y:auto;padding:8px 0 env(safe-area-inset-bottom,16px);
}
.bs-item {
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 20px;font-size:15px;color:#333;cursor:pointer;
  transition:background 0.1s;
}
.bs-item:active { background:#f5f5f5; }
.bs-item.bs-selected { color:var(--primary,#2563eb);font-weight:600; }
.bs-item.bs-selected::after {
  content:'✓';font-size:16px;color:var(--primary,#2563eb);
}
@media (min-width:769px) {
  .bs-overlay,.bs-sheet { display:none !important; }
}
/* ══ 바텀시트 끝 ════════════════════════════════════════════════ */
@media print {
  body * { visibility: hidden; }
  #contract-print-area, #contract-print-area * { visibility: visible; }
  #contract-print-area {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    padding: 40px;
    background: #fff;
    color: #000;
    font-size: 14px;
    line-height: 1.8;
    box-sizing: border-box;
  }
}

/* ── 저장목록 리뉴얼 (AB 조합) ───────────────── */
.sl-group { background:var(--white); border:1.5px solid var(--gray-200); border-radius:12px; overflow:hidden; margin-bottom:10px; transition:border-color .15s; }
.sl-group:hover { border-color:var(--gold-lt); }
.sl-head { display:flex; align-items:center; gap:14px; padding:14px 16px; cursor:pointer; user-select:none; }
.sl-head-ico { width:40px; height:40px; flex-shrink:0; border-radius:10px; background:var(--gold-bg); border:1px solid var(--gold-lt); display:flex; align-items:center; justify-content:center; color:var(--gold); font-size:18px; }
.sl-head-title { font-size:17px; font-weight:700; color:var(--brown); }
.sl-head-sub { font-size:13px; color:var(--gray-400); margin-top:2px; }
.sl-head-num { font-size:21px; font-weight:700; color:var(--brown); line-height:1.1; }
.sl-head-num small { font-size:13px; color:var(--gray-400); font-weight:400; }
.sl-head-numsub { font-size:13px; color:var(--gray-400); text-align:right; }
.sl-prog-wrap { display:flex; flex-direction:column; align-items:flex-end; gap:4px; min-width:96px; }
.sl-prog-label { font-size:12px; font-weight:600; }
.sl-prog-bar { width:96px; height:6px; background:var(--gray-200); border-radius:100px; overflow:hidden; }
.sl-prog-fill { height:100%; background:var(--gold); border-radius:100px; }
.sl-chev { color:var(--gray-400); transition:transform .2s; font-size:16px; display:inline-block; }
.sl-body { padding:0 12px 10px; }
.sl-card { background:var(--white); border:1.5px solid var(--gray-200); border-radius:10px; padding:12px 14px; margin-bottom:8px; transition:border-color .15s; }
.sl-card:hover { border-color:var(--gold-lt); }
.sl-card-row { display:flex; align-items:flex-start; gap:10px; }
.sl-card-name { font-size:16px; font-weight:700; color:var(--brown); margin-bottom:6px; }
.sl-chips { display:flex; flex-wrap:wrap; gap:6px; }
.sl-chip { font-size:12px; padding:2px 9px; border-radius:100px; background:var(--cream); color:var(--brown); white-space:nowrap; }
.sl-chip-mut { background:var(--cream); color:var(--gray-400); }
.sl-chip-att { background:#fef3f2; color:#993c1d; }
.sl-chip-ok { background:#d1fae5; color:#065f46; font-weight:600; }
.sl-chip-wait { background:#fef3c7; color:#92400e; font-weight:600; }
.sl-card-date { font-size:12px; color:var(--gray-400); margin-top:7px; }
.sl-acts { display:flex; gap:5px; flex-shrink:0; }
.sl-act-btn { width:30px; height:30px; padding:0; display:flex; align-items:center; justify-content:center; border:1.5px solid var(--gray-200); border-radius:8px; background:var(--white); cursor:pointer; color:var(--brown); transition:all .15s; }
.sl-act-btn:hover { border-color:var(--gold-lt); background:var(--gold-bg); }
.sl-act-btn.danger { color:#c0392b; }
.sl-act-btn:disabled { opacity:.35; cursor:not-allowed; }
@media (max-width:600px){
  .sl-head { gap:10px; padding:12px; }
  .sl-prog-wrap { min-width:70px; }
  .sl-prog-bar { width:70px; }
  .sl-head-ico { width:34px; height:34px; font-size:15px; }
}

/* 저장목록 소그룹 아코디언 (2/3차) */
.sl-sub2 { display:flex; align-items:center; gap:8px; cursor:pointer; user-select:none; padding:9px 12px; margin:6px 0; background:var(--gold-bg); border:1px solid var(--gold-lt); border-radius:8px; font-size:14px; font-weight:700; color:var(--brown); transition:background .15s; }
.sl-sub2:hover { background:var(--cream); }
.sl-sub3 { display:flex; align-items:center; gap:7px; cursor:pointer; user-select:none; padding:7px 10px; margin:5px 0 5px 14px; background:var(--white); border:1px solid var(--gray-200); border-radius:7px; font-size:13px; font-weight:600; color:var(--gray-400); transition:border-color .15s; }
.sl-sub3:hover { border-color:var(--gold-lt); }
.sl-sub-cnt { font-size:12px; font-weight:400; color:var(--gray-400); }
.sl-sub-chev { transition:transform .2s; display:inline-block; }
.sl-sub-body { padding-left:2px; }
.sl-sub-body.lv3 { padding-left:14px; }

/* ══════════════════════════════════════════════
   대시보드 개편 (v213) — 액션/배너/비중/순위
   ══════════════════════════════════════════════ */
.db-act-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:16px; }
.db-act { border-radius:14px; padding:15px 16px 14px; cursor:pointer; border:1.5px solid var(--gray-200);
  background:var(--white); transition:transform .14s, box-shadow .14s, border-color .14s;
  display:flex; flex-direction:column; min-height:112px; }
.db-act:hover { transform:translateY(-2px); box-shadow:0 6px 18px rgba(61,43,31,.10); }
.db-act.red { background:var(--red-bg,#FCF1EF); border-color:#EDC9C2; }
.db-act.amber { background:#FBF3E4; border-color:#E9D4A8; }
.db-act-top { display:flex; align-items:center; justify-content:space-between; }
.db-act-ic { width:30px; height:30px; border-radius:9px; display:flex; align-items:center; justify-content:center; }
.db-act.red .db-act-ic { background:rgba(192,57,43,.10); }
.db-act.amber .db-act-ic { background:rgba(183,121,31,.12); }
.db-act-num { font-size:30px; font-weight:800; line-height:1; margin-top:auto; letter-spacing:-1px; font-variant-numeric:tabular-nums; }
.db-act.red .db-act-num { color:var(--red); }
.db-act.amber .db-act-num { color:#B7791F; }
.db-act-label { font-size:13.5px; font-weight:700; color:var(--brown2); margin-top:5px; }
.db-act-sub { font-size:11.5px; color:var(--gray-400); margin-top:2px; font-weight:500; }

.db-money { background:linear-gradient(135deg,#5C3D2E 0%,#7A5544 100%); border:none; color:#fff; }
.db-money .section-title { color:#fff; border-bottom-color:rgba(255,255,255,.14); }
.db-money-row { display:flex; align-items:flex-end; justify-content:space-between; flex-wrap:wrap; gap:10px; }
.db-money-big { font-size:32px; font-weight:800; letter-spacing:-1px; line-height:1; font-variant-numeric:tabular-nums; }
.db-money-big small { font-size:17px; font-weight:700; opacity:.75; margin-left:2px; }
.db-money-delta { font-size:12.5px; font-weight:600; display:flex; align-items:center; gap:3px; }
.db-money-delta.up { color:#D9F2E0; } .db-money-delta.down { color:#F2C9C3; } .db-money-delta.flat { color:rgba(255,255,255,.6); }
.db-money-sub { display:flex; gap:22px; margin-top:14px; padding-top:14px; border-top:1px solid rgba(255,255,255,.14); }
.db-money-sub .k { font-size:11px; opacity:.6; font-weight:600; }
.db-money-sub .v { font-size:16px; font-weight:800; margin-top:3px; font-variant-numeric:tabular-nums; }

.db-bar-row { display:flex; align-items:center; gap:10px; margin-bottom:11px; }
.db-bar-row:last-child { margin-bottom:0; }
.db-bar-nm { font-size:13px; font-weight:600; color:var(--gray-700); width:82px; flex:0 0 auto; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.db-bar-track { flex:1; height:22px; background:var(--gray-100); border-radius:6px; overflow:hidden; }
.db-bar-fill { height:100%; border-radius:6px; display:flex; align-items:center; justify-content:flex-end; padding-right:8px; min-width:26px; box-sizing:border-box; }
.db-bar-fill span { font-size:11px; font-weight:800; color:#fff; }
.db-bar-amt { font-size:12px; font-weight:700; color:var(--gray-600); width:66px; text-align:right; flex:0 0 auto; font-variant-numeric:tabular-nums; }
.db-risk { margin-top:14px; padding:9px 12px; background:#FBF3E4; border:1px solid #E9D4A8; border-radius:9px; font-size:12px; color:#B7791F; font-weight:600; display:flex; align-items:center; gap:7px; line-height:1.4; }

.db-rank-row { display:flex; align-items:center; gap:12px; padding:11px 4px; border-bottom:1px solid var(--gray-100); }
.db-rank-row:last-child { border-bottom:none; }
.db-rank-badge { width:24px; height:24px; border-radius:7px; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:800; flex:0 0 auto; background:var(--gray-100); color:var(--gray-600); }
.db-rank-row.top1 .db-rank-badge { background:var(--gold); color:#fff; }
.db-rank-row.top2 .db-rank-badge { background:var(--gold-lt); color:#fff; }
.db-rank-name { font-size:14px; font-weight:700; color:var(--brown2); }
.db-rank-meta { font-size:11.5px; color:var(--gray-400); margin-top:1px; }
.db-rank-amt { margin-left:auto; text-align:right; }
.db-rank-amt .a { font-size:15px; font-weight:800; color:var(--gold); font-variant-numeric:tabular-nums; }
.db-rank-amt .d { font-size:11px; font-weight:600; margin-top:1px; }
.db-rank-amt .d.up { color:var(--green); } .db-rank-amt .d.down { color:var(--red); } .db-rank-amt .d.flat { color:var(--gray-400); }

.db-mini-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-bottom:16px; }
.db-mini { background:var(--white); border:1px solid var(--gray-200); border-radius:14px; padding:15px 10px; text-align:center; }
.db-mini-num { font-size:25px; font-weight:800; line-height:1; font-variant-numeric:tabular-nums; letter-spacing:-0.5px; }
.db-mini-label { font-size:12.5px; color:var(--gray-600); margin-top:7px; font-weight:600; }

.db-hosp { display:flex; align-items:center; gap:9px; padding:9px 12px; border-radius:9px; background:var(--red-bg,#FCF1EF); margin-bottom:5px; }
.db-hosp .dot { width:6px; height:6px; border-radius:50%; background:var(--red); flex:0 0 auto; }
.db-hosp .nm { font-size:14px; color:var(--gray-700); font-weight:600; }
.db-done-toggle { margin-top:12px; padding-top:12px; border-top:1px solid var(--gray-100); font-size:12.5px; color:var(--gray-400); font-weight:600; }
.db-done-toggle summary { cursor:pointer; list-style:none; display:flex; align-items:center; gap:5px; }
.db-done-toggle summary::-webkit-details-marker { display:none; }
.db-done-item { display:flex; align-items:center; gap:8px; padding:6px 10px; border-radius:6px; background:#f0faf4; margin-top:4px; font-size:13.5px; color:var(--gray-700); font-weight:600; }

@media (max-width:560px) {
  .db-money-big { font-size:27px; }
  .db-bar-nm { width:66px; } .db-bar-amt { width:54px; font-size:11px; }
}
