/* 맘스홀릭 도서 판매 관리 시스템 공통 스타일
   로고의 녹색 계열(#2c8c0c, #74b008)을 포인트 색상으로 사용한다. */
:root {
  --brand: #2c8c0c;
  --brand-dark: #23700a;
  --brand-light: #74b008;
  --brand-soft: #f0f7ea;
  --brand-border: #d5e8c8;
  --text: #333a40;
  --muted: #6b747c;
  --line: #e3e7ea;
  --bg: #f6f8f7;
  --sidebar-width: 220px;
  --topbar-height: 56px;
  --bs-primary: #2c8c0c;
  --bs-primary-rgb: 44, 140, 12;
  --bs-link-color: #23700a;
  --bs-link-color-rgb: 35, 112, 10;
  --bs-link-hover-color: #1a5407;
  --bs-link-hover-color-rgb: 26, 84, 7;
  --bs-body-color: #333a40;
  --bs-body-font-size: 0.925rem;
  --bs-body-font-family: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

body { background: var(--bg); color: var(--text); }

/* ── 버튼 ── */
.btn { --bs-btn-font-size: 0.9rem; }
.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-bg: #8fbf7c; --bs-btn-disabled-border-color: #8fbf7c;
}
.btn-outline-primary {
  --bs-btn-color: var(--brand-dark); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--brand-light); box-shadow: 0 0 0 .2rem rgba(116, 176, 8, .2);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.page-link { color: var(--brand-dark); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ── 상단 바 ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-height); z-index: 1030;
  background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
  display: flex; align-items: center; padding: 0 1rem; gap: .75rem;
}
.topbar .brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); min-width: 0; }
.topbar .brand img { height: 40px; width: 40px; flex: none; }
.topbar .brand .name { font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumb { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .86rem; padding-left: .9rem; margin-left: .2rem; border-left: 1px solid var(--line); white-space: nowrap; }
.topbar .crumb a { color: var(--muted); }
.topbar .crumb .sep { font-size: .65rem; }
.topbar .crumb .here { color: var(--brand-dark); font-weight: 700; }
.user-menu { margin-left: auto; }
.user-button { display: flex; align-items: center; gap: .55rem; background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: .25rem .7rem .25rem .3rem; color: var(--text); line-height: 1.15; }
.user-button:hover, .user-button[aria-expanded=true] { background: var(--brand-soft); border-color: var(--brand-border); }
.user-button .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; flex: none; }
.user-button .who { text-align: left; }
.user-button .who strong { display: block; font-size: .86rem; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-button .who small { display: block; color: var(--muted); font-size: .74rem; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .dropdown-menu { min-width: 230px; border-color: var(--line); border-radius: 12px; padding: .4rem; }
.user-menu .user-info { padding: .5rem .7rem .3rem; }
.user-menu .dropdown-item { border-radius: 8px; padding: .5rem .7rem; display: flex; align-items: center; gap: .55rem; }
.user-menu .dropdown-item:hover, .user-menu .dropdown-item:focus { background: var(--brand-soft); color: var(--brand-dark); }
.user-menu .dropdown-item:active { background: var(--brand); color: #fff; }
.role-badge { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid var(--brand-border);
  border-radius: 999px; padding: .1rem .55rem; font-size: .76rem; font-weight: 700; white-space: nowrap; }

/* ── 좌측 메뉴 ── */
.sidebar {
  position: fixed; top: var(--topbar-height); bottom: 0; left: 0; width: var(--sidebar-width);
  background: #fff; border-right: 1px solid var(--line); overflow-y: auto; padding: .75rem .5rem; z-index: 1020;
}
.sidebar a {
  display: flex; align-items: center; gap: .65rem; padding: .62rem .8rem; margin-bottom: 2px;
  border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; border-left: 3px solid transparent;
}
.sidebar a i { font-size: 1.05rem; color: var(--muted); width: 1.2rem; text-align: center; }
.sidebar a:hover { background: var(--brand-soft); }
.sidebar a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; border-left-color: var(--brand); }
.sidebar a.active i { color: var(--brand); }

.main { margin-left: var(--sidebar-width); padding-top: var(--topbar-height); min-height: 100vh; display: flex; flex-direction: column; }
.content { flex: 1 0 auto; padding: 1.25rem 1.5rem 1.5rem; min-width: 0; }

/* ── 푸터 ── */
.app-footer { flex: none; padding: .9rem 1.5rem; border-top: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: .8rem; display: flex; flex-wrap: wrap; gap: .25rem .6rem; justify-content: center; text-align: center; }
.app-footer .dot { color: #c9cfd4; }
.app-footer .ver { font-weight: 700; color: var(--brand-dark); }
/* ── 본문 공통 ── */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.3rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--muted); font-size: .86rem; margin-top: .2rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.alert { border-radius: 12px; }
.alert > i:first-child { margin-right: .3rem; }
.modal-content { border-radius: 14px; border: 0; }
.modal-header { border-bottom-color: var(--line); }
.modal-footer { border-top-color: var(--line); }
.btn { border-radius: 8px; font-weight: 500; }
.btn-sm { border-radius: 7px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.panel > h2 { font-size: 1rem; font-weight: 700; margin: 0 0 .75rem; }
.search-panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1rem; }
.search-panel label { font-size: .8rem; color: var(--muted); margin-bottom: .15rem; }

.table { --bs-table-hover-bg: var(--brand-soft); margin-bottom: 0; }
.table thead th { background: #f3f6f4; color: #48515a; font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--line); font-size: .86rem; }
.table td, .table th { padding: .55rem .7rem; vertical-align: middle; }
.table tfoot td { background: var(--brand-soft); font-weight: 700; border-top: 2px solid var(--brand-border); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 2rem 0 !important; }
.req::after { content: " *"; color: #d63384; font-weight: 700; }

.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1.1rem; height: 100%; }
.stat-card .label { color: var(--muted); font-size: .84rem; }
.stat-card .value { font-size: 1.4rem; font-weight: 700; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.stat-card .hint { color: var(--muted); font-size: .8rem; }
.stat-card.accent { border-color: var(--brand-border); background: var(--brand-soft); }

.badge-on { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid var(--brand-border); }
.badge-off { background: #f1f3f5; color: #6b747c; border: 1px solid #dde1e4; }
.badge-cancel { background: #fdecec; color: #b42318; border: 1px solid #f6c9c5; }
.badge-on, .badge-off, .badge-cancel { border-radius: 999px; padding: .12rem .55rem; font-size: .78rem; font-weight: 600; white-space: nowrap; }

.nav-tabs .nav-link { color: var(--muted); font-weight: 600; }
.nav-tabs .nav-link.active { color: var(--brand-dark); border-bottom-color: #fff; }
.calc-box { background: var(--brand-soft); border: 1px solid var(--brand-border); border-radius: 10px; padding: 1rem 1.1rem; }
.calc-box dl { display: grid; grid-template-columns: 1fr auto; gap: .35rem .75rem; margin: 0; }
.calc-box dt { font-weight: 500; color: #48515a; }
.calc-box dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.calc-box .total { border-top: 1px solid var(--brand-border); padding-top: .45rem; font-size: 1.08rem; }
.detail-grid { display: grid; grid-template-columns: 150px 1fr; gap: .45rem 1rem; margin: 0; }
.detail-grid dt { color: var(--muted); font-weight: 500; }
.detail-grid dd { margin: 0; }
.log-json { font-size: .78rem; max-width: 340px; white-space: pre-wrap; word-break: break-all; margin: 0; color: #48515a; }

/* ── 대시보드 ── */
.kpi { display: flex; align-items: flex-start; gap: .85rem; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 1rem 1.1rem; height: 100%; color: var(--text); text-decoration: none; position: relative; }
a.kpi { transition: border-color .12s ease, box-shadow .12s ease; }
a.kpi:hover, a.kpi:focus-visible { border-color: var(--brand-light); box-shadow: 0 4px 14px rgba(44, 140, 12, .1); color: var(--text); }
a.kpi::after { content: "\F285"; font-family: "bootstrap-icons"; position: absolute; right: .9rem; top: .9rem; font-size: .75rem; color: #b6bdc3; }
.kpi .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 1.35rem; flex: none; }
.kpi .body { min-width: 0; }
.kpi .label { color: var(--muted); font-size: .84rem; font-weight: 500; }
.kpi .value { font-size: 1.55rem; font-weight: 800; line-height: 1.25; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .value .unit { font-size: .95rem; font-weight: 600; margin-left: .15rem; color: #48515a; }
.kpi .basis { color: var(--muted); font-size: .77rem; margin-top: .1rem; }
.kpi.warn .ico { background: #fff4e5; color: #c96a00; }
.kpi.sm { padding: .8rem 1rem; border-radius: 12px; }
.kpi.sm .value { font-size: 1.25rem; }
.kpi.sm .ico { width: 38px; height: 38px; font-size: 1.15rem; border-radius: 10px; }
.section-title { font-size: .95rem; font-weight: 700; margin: 1.25rem 0 .6rem; display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.section-title .basis { font-size: .78rem; font-weight: 400; color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: .6rem; }
.quick a { flex: 1 1 150px; max-width: 320px; display: flex; align-items: center; gap: .6rem; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  color: var(--text); text-decoration: none; font-weight: 600; }
.quick a i { color: var(--brand); font-size: 1.15rem; }
.quick a:hover { border-color: var(--brand-light); background: var(--brand-soft); color: var(--brand-dark); }
.quick a.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.quick a.primary i { color: #fff; }
.quick a.primary:hover { background: var(--brand-dark); color: #fff; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid #eef1f2; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .when { color: var(--muted); font-size: .8rem; white-space: nowrap; width: 5.4rem; flex: none; }
.mini-list .what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list .what small { color: var(--muted); }
.mini-list .amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mini-list a { text-decoration: none; }
.panel .more { font-size: .8rem; font-weight: 400; margin-left: auto; text-decoration: none; }
.panel > h2 { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.panel > h2 .basis { font-size: .78rem; font-weight: 400; color: var(--muted); }
.bar-list { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem .75rem; align-items: center; }
.bar-list .bar { height: 10px; border-radius: 999px; background: #eef1f2; overflow: hidden; }
.bar-list .bar span { display: block; height: 100%; border-radius: 999px; background: var(--brand-light); }
.bar-list .k { white-space: nowrap; font-size: .86rem; }
.bar-list .v { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .88rem; text-align: right; }

/* ── 데이터 없음 안내 ── */
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty-state i { display: block; font-size: 2rem; color: #c3cbd0; margin-bottom: .4rem; }
.empty-state .t { font-weight: 600; color: #48515a; }
.empty-state .d { font-size: .84rem; margin-top: .15rem; }
.empty-state .btn { margin-top: .8rem; }
td.empty { padding: 0 !important; }

/* ── 로그인/간결 화면 ── */
.plain-wrap { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.plain-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.plain-wrap .app-footer { background: transparent; border-top: 0; }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 2rem 1.9rem; box-shadow: 0 6px 24px rgba(0, 0, 0, .05); }
.login-card .logo { display: block; width: 120px; height: 120px; margin: 0 auto .6rem; }
.login-card h1 { font-size: 1.12rem; font-weight: 700; text-align: center; margin-bottom: 1.4rem; }
.login-card .guide { color: var(--muted); font-size: .8rem; text-align: center; margin-top: 1rem; }

/* ── 반응형 ── */
.menu-toggle { display: none; }
@media (max-width: 991.98px) {
  .menu-toggle { display: inline-flex; font-size: 1.15rem; border: 1px solid var(--line); }
  .sidebar { transform: translateX(-100%); transition: transform .15s ease; box-shadow: none; width: 240px; }
  body.menu-open .sidebar { transform: none; box-shadow: 4px 0 18px rgba(0, 0, 0, .12); }
  body.menu-open .backdrop { display: block; }
  .main { margin-left: 0; }
  .content { padding: .9rem .8rem 1.25rem; }
  .topbar { padding: 0 .6rem; gap: .5rem; }
  .topbar .crumb { display: none; }
  .topbar .brand img { height: 34px; width: 34px; }
  .topbar .brand .name { font-size: .9rem; }
  .user-button .who, .user-button .role-badge { display: none; }
  .user-button { padding: .2rem; border-radius: 50%; }
  .user-button.dropdown-toggle::after { display: none; }
  .detail-grid { grid-template-columns: 110px 1fr; }
  .kpi { padding: .8rem .85rem; gap: .6rem; }
  .kpi .ico { width: 36px; height: 36px; font-size: 1.1rem; border-radius: 10px; }
  .kpi .value { font-size: 1.25rem; }
  a.kpi::after { display: none; }
  .page-head h1 { font-size: 1.15rem; }
  .app-footer { padding: .8rem; font-size: .74rem; }
  .app-footer .dot { display: none; }
  /* 모바일: 표는 좌우로 밀어서 보고, 셀 안에서 글자가 세로로 쪼개지지 않게 한다 */
  .table-responsive td, .table-responsive th { white-space: nowrap; }
}
@media (max-width: 575.98px) {
  .topbar .brand .name { max-width: 46vw; }
  .kpi:not(.sm) { flex-direction: column; gap: .45rem; }
  .kpi .label { font-size: .8rem; }
  .quick a { flex-basis: calc(50% - .3rem); max-width: none; }
  .modal-dialog { margin: .6rem; }
}
.backdrop { display: none; position: fixed; inset: var(--topbar-height) 0 0 0; background: rgba(0, 0, 0, .25); z-index: 1010; }
@media print { .sidebar, .topbar, .search-panel, .btn, .app-footer { display: none !important; } .main { margin: 0; padding: 0; } }

/* ── v1.2: 메인 환영 영역, 요약 목록, 로그인 일러스트 ── */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: 1.1rem 1.5rem;
  border: 1px solid var(--brand-border); border-radius: 16px; background: linear-gradient(100deg, #f4faef 0%, #e9f4df 100%); overflow: hidden; }
.hero-text { min-width: 0; }
.hero-date { color: var(--brand-dark); font-size: .82rem; font-weight: 600; }
.hero h1 { font-size: 1.35rem; font-weight: 800; margin: .15rem 0 .2rem; letter-spacing: -.02em; }
.hero p { color: #55606a; margin: 0; font-size: .9rem; }
.hero-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .85rem; }
.hero-actions .btn { padding: .5rem 1.1rem; font-weight: 600; }
.hero-actions .btn-light { background: #fff; border-color: var(--brand-border); color: var(--brand-dark); }
.hero-actions .btn-light:hover { background: var(--brand-soft); }
.hero-art { height: 128px; width: auto; flex: none; margin: -.2rem 0; }
.sum-list { display: grid; grid-template-columns: 1fr auto; gap: .7rem 1rem; margin: .2rem 0 0; }
.sum-list dt { font-weight: 500; color: #48515a; }
.sum-list dt small { display: block; color: var(--muted); font-weight: 400; font-size: .78rem; }
.sum-list dd { margin: 0; text-align: right; font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; align-self: center; }
.sum-list .total { border-top: 1px solid var(--line); padding-top: .7rem; font-size: 1.15rem; color: var(--brand-dark); font-weight: 800; }
.settle-list { display: flex; flex-direction: column; gap: .5rem; }
.settle-row { display: flex; align-items: center; gap: .8rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; }
.settle-row:hover { border-color: var(--brand-light); background: var(--brand-soft); color: var(--text); }
.settle-row .ico { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 1.15rem; flex: none; }
.settle-row.warn .ico { background: #fff4e5; color: #c96a00; }
.settle-row .name { flex: 1; min-width: 0; font-weight: 600; }
.settle-row .name small { display: block; color: var(--muted); font-weight: 400; font-size: .78rem; }
.settle-row .amt { font-weight: 800; font-size: 1.08rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.settle-row .go { color: #b6bdc3; font-size: .75rem; }
.mini-list .amt.sub { color: var(--muted); font-weight: 400; width: 7rem; text-align: right; }
.empty-state img { display: block; margin: 0 auto .5rem; opacity: .95; }
.login-shell { display: flex; align-items: center; gap: 3rem; }
.login-art { text-align: center; }
.login-art img { width: 320px; max-width: 100%; height: auto; }
.login-art p { color: var(--brand-dark); font-weight: 600; margin: .4rem 0 0; }
@media (max-width: 991.98px) {
  .login-shell { flex-direction: column; gap: 1rem; width: 100%; }
  .login-art img { width: 170px; }
  .login-art p { display: none; }
  .hero { padding: 1rem 1.1rem; }
  .hero h1 { font-size: 1.15rem; }
}
@media (max-width: 575.98px) {
  .hero-art { display: none; }
  .hero-actions .btn { flex: 1 1 auto; }
}