/* =====================================================================
 *  admin 테마 — EzOMS 관리 화면(ezoms.co.kr/app)에서 뽑은 관리자 디자인 시스템
 *  1부: 토큰·셸·공통 컴포넌트 (clobe.css)   2부: 앱 보조 스타일 (app/app.css 에서 공통 부분만)
 * ===================================================================== */

/* ==========================================================
 *  관리자 디자인 시스템 — clobe-design-kit 기반
 *
 *  페이지들은 Tailwind 유틸리티로 짜여 있다. 색·모서리·그림자는
 *  _head.php 의 tailwind.config 에서 이 토큰으로 재정의하고,
 *  여기에는 셸(사이드바·툴바)과 Tailwind 로 표현이 안 되는 것만 둔다.
 * ========================================================== */
/* 원본은 Tailwind preflight 가 넣어 주던 것 — 없으면 width:100% 입력칸이 여백만큼 넘친다 */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --font-ui: "Pretendard Variable", Pretendard, "Malgun Gothic", "맑은 고딕", -apple-system, BlinkMacSystemFont, Helvetica, "Apple SD Gothic Neo", sans-serif;
  --surface: #fff;
  --sidebar-surface: #f6f6f6;
  --ink: #1d2225;
  --text-secondary: #4c5053;
  --text-muted: #686b6d;
  --border: #e4e4e5;
  --surface-subtle: rgb(29 34 37 / 4%);
  --nav-selected: rgb(29 34 37 / 7%);
  --blue: #0f73e5;
  --blue-light: #e6f2ff;
  --red: #da2333;
  --red-tint: rgb(238 60 75 / 12%);
  --sidebar-width: 240px;
  --radius-sm: 8px;
  --radius-button: 10px;
  --radius-card: 12px;
  --radius-floating: 20px;
  --shadow-floating: 0 0 0 .5px rgb(29 34 37 / 22%), 0 8px 8px rgb(29 34 37 / 4%), 0 12px 32px rgb(29 34 37 / 12%);
  --ease: 150ms ease;
}

/* ---------- 기본 ---------- */
html body { margin: 0; background: var(--surface); color: var(--ink); font-family: var(--font-ui); font-size: 14px; line-height: 20px; letter-spacing: -.02em; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; letter-spacing: inherit; }
table { font-variant-numeric: tabular-nums; }
.font-mono { letter-spacing: 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
::selection { background: var(--blue-light); }
a, button { transition: background-color var(--ease), color var(--ease), border-color var(--ease), box-shadow var(--ease); }

/* 주요 버튼: 검정 → hover 더 검게. (cyan-700 은 링크용 파랑이라 버튼 hover 만 따로 잡는다) */
html .hover\:bg-cyan-700:hover { background-color: #000; }
html .hover\:bg-emerald-700:hover { filter: brightness(.94); }

/* 입력 요소 — 포커스는 2px 파란 외곽선 하나로 통일 */
html input:not([type=checkbox]):not([type=radio]):focus,
html select:focus, html textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgb(15 115 229 / 14%); }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); }

/* 표 머리 — 작은 회색 라벨 */
html thead th { font-weight: 500; color: var(--text-muted); }

/* ---------- 앱 셸 ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100dvh; }

.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; background: var(--sidebar-surface); border-right: 1px solid var(--border); }
.sidebar-brand { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 16px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -.3px; }
.brand-sub { margin-left: auto; font-size: 11px; color: var(--text-muted); }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px 12px 12px; }
.quick-actions .btn { font-size: 13px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav-group + .nav-group { margin-top: 14px; }
.nav-group-title { padding: 6px 10px 4px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.nav-item { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 8px 0 10px; border-radius: var(--radius-sm); color: var(--text-secondary); text-decoration: none; }
.nav-item svg { flex: none; width: 16px; height: 16px; stroke-width: 1.6; }
.nav-item:hover { background: var(--surface-subtle); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--nav-selected); color: var(--ink); font-weight: 500; }
.nav-badge { margin-left: auto; min-width: 18px; padding: 0 5px; border-radius: 999px; font-size: 11px; line-height: 18px; text-align: center; font-weight: 500; }
.nav-badge.is-alert { background: var(--red-tint); color: var(--red); }
.nav-badge.is-muted { background: var(--nav-selected); color: var(--text-secondary); }
.nav-badge.is-warn  { background: rgb(245 158 11 / 16%); color: #b45309; }

.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; }
.avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; background: #fff; border: 1px solid var(--border); font-size: 12px; font-weight: 600; }
.sidebar-foot .who { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; }
.page-toolbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; min-height: 65px; padding: 12px 20px; background: rgb(255 255 255 / 92%); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); }
.page-title { margin: 0; font-size: 18px; font-weight: 600; line-height: 25px; letter-spacing: -.36px; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; }
.page-body { flex: 1; padding: 20px; }

.btn.menu-toggle { display: none; }
.sidebar-scrim { display: none; }

/* ---------- 공통 컴포넌트 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 32px; padding: 6px 10px; border: 0; border-radius: var(--radius-button); background: transparent; color: var(--ink); font-size: 14px; line-height: 20px; letter-spacing: -.28px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-subtle); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-outline { background: #fff; border: 1px solid var(--border); }
.btn-outline:hover { background: #fafafa; }
.btn-panel { width: 100%; height: 42px; padding: 0 16px; border-radius: 12px; font-size: 16px; line-height: 24px; letter-spacing: -.32px; }
.btn-icon { width: 32px; padding: 0; }
.btn svg { width: 16px; height: 16px; }

.banner { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 16px; padding: 12px 14px; border-radius: var(--radius-card); border: 1px solid var(--border); font-size: 14px; }
.banner::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: 7px; border-radius: 999px; background: currentColor; }
.banner.is-ok   { background: #effaf4; border-color: #cdeedb; color: #0f6b3c; }
.banner.is-err  { background: #fdf0f1; border-color: #f7d3d7; color: #b3182a; }

/* ---------- 목록 화면 (customer/list.php 가 기준) ---------- */
.list-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.list-head .spacer { flex: 1; }
.list-count { color: var(--text-muted); font-size: 13px; }
.list-count b { color: var(--ink); font-weight: 600; }

.search-field { display: flex; align-items: center; gap: 8px; width: 320px; max-width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-button); background: #fff; }
.search-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(15 115 229 / 14%); }
.search-field svg { flex: none; width: 16px; height: 16px; color: var(--text-muted); }
html .search-field input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; color: var(--ink); font-size: 14px; }
html .search-field input:focus { box-shadow: none; }
.search-field input::placeholder { color: #9b9d9f; }
.search-clear { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 999px; color: var(--text-muted); text-decoration: none; }
.search-clear:hover { background: var(--nav-selected); color: var(--ink); }

.table-card { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-card); background: #fff; }
.table-scroll { position: relative; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { height: 38px; padding: 0 14px; background: #fafafa; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 13px; font-weight: 500; text-align: left; white-space: nowrap; }
.data-table td { height: 52px; padding: 8px 14px; border-bottom: 1px solid #efeff0; color: var(--text-secondary); vertical-align: middle; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--surface-subtle); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .mono { font-variant-numeric: tabular-nums; letter-spacing: 0; white-space: nowrap; }
.data-table .actions { width: 1%; text-align: right; white-space: nowrap; }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); font-weight: 500; text-decoration: none; }
.cell-main:hover .cell-title { text-decoration: underline; text-underline-offset: 3px; }
.cell-sub { display: block; margin-top: 1px; color: var(--text-muted); font-size: 12px; font-weight: 400; }
.initial { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--nav-selected); color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.dim { color: #b5b7b9; }

.btn-sm { min-height: 28px; padding: 4px 8px; border-radius: var(--radius-sm); font-size: 13px; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-tint); }
.row-actions { display: inline-flex; align-items: center; gap: 2px; }
.row-actions form { display: inline; margin: 0; }

.empty-state { padding: 64px 16px; text-align: center; color: var(--text-muted); }
.empty-state .btn { margin-top: 12px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 13px; }
.pager-pages { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-button); background: var(--surface-subtle); }
.pager-pages a, .pager-pages span { display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 7px; color: var(--text-secondary); text-decoration: none; font-variant-numeric: tabular-nums; }
.pager-pages a:hover { color: var(--ink); background: rgb(255 255 255 / 60%); }
.pager-pages [aria-current="page"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 0 0 .5px rgb(29 34 37 / 12%), 0 1px 2px rgb(29 34 37 / 6%); }

@media (max-width: 640px) {
  .list-head form { flex: 1 1 100%; }
  .search-field { width: 100%; }
  .list-head .spacer { flex: 1; display: block; }
}

/* ---------- 공용 블록 (모든 화면) ---------- */
/* 세그먼트 전환 — 상태 탭 등. 링크면 aria-current, 버튼이면 aria-selected */
.segments { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--radius-button); background: var(--surface-subtle); }
.segment { display: inline-flex; align-items: center; gap: 4px; min-height: 26px; padding: 3px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary); font-size: 13px; text-decoration: none; white-space: nowrap; cursor: pointer; }
.segment:hover { color: var(--ink); }
.segment[aria-current="page"], .segment[aria-selected="true"] { background: #fff; color: var(--ink); font-weight: 500; box-shadow: 0 0 0 .5px rgb(29 34 37 / 12%), 0 1px 2px rgb(29 34 37 / 6%); }
.segment .count { padding: 0 5px; border-radius: 999px; background: var(--red-tint); color: var(--red); font-size: 11px; line-height: 16px; }

/* 카드 — 그림자 없이 1px 선 */
.panel { position: relative; border: 1px solid var(--border); border-radius: var(--radius-card); background: #fff; }
.panel-head { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.panel-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.3px; color: var(--ink); }
.panel-head .more { margin-left: auto; font-size: 13px; color: var(--text-muted); text-decoration: none; }
.panel-head .more:hover { color: var(--ink); }
.panel-body { padding: 16px; }
.panel-body.is-form { display: grid; gap: 22px; padding: 20px; }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 13px; }
.panel.is-subtle { background: var(--surface-subtle); }
.stack { display: grid; gap: 16px; align-content: start; }

/* 지표 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat { display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-card); background: #fff; color: inherit; text-decoration: none; }
a.stat:hover { background: #fcfcfc; border-color: #d3d4d5; }
.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-value { margin-top: 6px; font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.stat-value small { margin-left: 2px; font-size: 14px; font-weight: 500; color: var(--text-muted); }
.stat-sub { margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.stat.is-alert .stat-value { color: var(--red); }
.stat.is-warn  .stat-value { color: #b45309; }

/* 배지 — 상태 표시. 색 + 글자 둘 다로 의미 전달 */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--nav-selected); color: var(--text-secondary); }
.badge.is-blue  { background: var(--blue-light); color: #0b5cb8; }
.badge.is-green { background: #e7f6ee; color: #0f6b3c; }
.badge.is-amber { background: #fdf3e2; color: #a35a05; }
.badge.is-red   { background: var(--red-tint); color: var(--red); }

/* 폼 화면 하단 저장 줄 — 스크롤해도 바닥에 붙는다 */
.form-actions { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 16px -20px -20px; padding: 12px 20px; background: rgb(255 255 255 / 94%); backdrop-filter: blur(6px); border-top: 1px solid var(--border); }
.form-actions .btn { height: 38px; min-width: 84px; }
.form-actions .left { margin-right: auto; color: var(--text-muted); font-size: 13px; }
select.input { padding-right: 28px; }
.input:disabled, .input[readonly] { background: var(--surface-subtle); color: var(--text-secondary); }

/* 정보 안내 */
.note { padding: 12px 14px; border-radius: var(--radius-card); background: var(--surface-subtle); border: 1px solid var(--border); color: var(--text-secondary); font-size: 13px; }
.note.is-blue { background: var(--blue-light); border-color: #cce4ff; color: #0b4f9e; }
.note.is-amber { background: #fdf6e9; border-color: #f5dfb5; color: #8a4b04; }

/* 정의 목록 (상세 화면) */
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 1024px) { .form-actions { margin: 16px -16px -16px; padding: 12px 16px; } }

/* ---------- 우측 드로어 (오른쪽 → 왼쪽으로 열린다) ----------
 * <dialog class="drawer"> 를 showModal() 로 연다. 포커스 가두기·Esc·배경 비활성은 브라우저가 맡는다.
 * 닫을 때는 .is-closing 을 붙여 밀려 나가는 애니메이션이 끝난 뒤 close() 한다 */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(480px, 100vw); max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: #fff; color: var(--ink); box-shadow: var(--shadow-floating); overflow: hidden; }
.drawer[open] { display: flex; flex-direction: column; animation: drawer-in 220ms cubic-bezier(.2, .8, .2, 1); }
.drawer.is-closing { animation: drawer-out 180ms ease-in forwards; }
.drawer::backdrop { background: rgb(29 34 37 / 28%); animation: fade-in 220ms ease; }
.drawer.is-closing::backdrop { animation: fade-out 180ms ease forwards; }
@keyframes drawer-in  { from { transform: translateX(100%); } to { transform: none; } }
@keyframes drawer-out { from { transform: none; } to { transform: translateX(100%); } }
@keyframes fade-in  { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .drawer[open], .drawer.is-closing, .drawer::backdrop { animation-duration: 1ms; } }

.drawer form { display: flex; flex-direction: column; flex: 1; min-height: 0; margin: 0; }
.drawer-head { display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--border); }
.drawer-head .page-title { flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 20px; display: grid; align-content: start; gap: 22px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 16px; border-top: 1px solid var(--border); background: #fff; }
.drawer-foot .btn { min-width: 84px; height: 40px; }

.fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; padding: 0; border: 0; }
.fieldset legend { grid-column: 1 / -1; float: left; width: 100%; margin-bottom: 2px; font-size: 13px; font-weight: 600; color: var(--ink); }
.field { display: grid; gap: 6px; min-width: 0; }
.field.is-wide { grid-column: 1 / -1; }
.field-label { font-size: 13px; color: var(--text-secondary); }
.field-label .req { color: var(--red); margin-left: 2px; }
.field-label .hint { color: var(--text-muted); font-size: 12px; margin-left: 4px; }
.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--border); border-radius: var(--radius-button); background: #fff; color: var(--ink); font-size: 14px; }
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 20px; }
.input.mono { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.input::placeholder { color: #9b9d9f; }
.input:user-invalid { border-color: var(--red); }
.field-error { font-size: 12px; color: var(--red); }
@media (max-width: 480px) { .fieldset { grid-template-columns: 1fr; } }

/* ---------- 반응형 ---------- */
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(280px, 86vw); transform: translateX(-100%); transition: transform 180ms ease; box-shadow: var(--shadow-floating); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgb(29 34 37 / 28%); }
  .btn.menu-toggle { display: inline-flex; margin-left: -6px; }
  .page-toolbar { padding: 10px 16px; min-height: 56px; }
  .page-body { padding: 16px; }
  .toolbar-date { display: none; }
}

/* 인쇄 시 셸은 숨긴다 */
@media print {
  .sidebar, .page-toolbar { display: none !important; }
  .app-shell { display: block; }
  .page-body { padding: 0; }
}


/* =====================================================================
 *  2부 — 앱 보조 스타일
 * ===================================================================== */

/* ---------- 공통 보조 (필터·일괄 작업 줄·토스트·글자) ---------- */
@media (prefers-reduced-motion: reduce) { .otp-wrap, .otp-box.is-err { animation: none; } }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.filters .input { width: auto; height: 32px; }
.filters input[type=date].input { width: 140px; }
.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; min-height: 32px; }
.bulkbar .sel { color: var(--text-muted); font-size: 13px; margin-right: 6px; }
.data-table td.wrap { white-space: normal; min-width: 220px; }
.data-table tr.is-bundle-start td { border-top: 1px solid var(--border); }
.data-table tr.is-bundled td:first-child { box-shadow: inset 3px 0 0 var(--blue-light); }
.data-table .chk { width: 1%; }
.data-table tbody tr { cursor: default; }
.data-table tbody tr.clickable { cursor: pointer; }
.err-text { color: var(--red); font-size: 12px; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.code { width: 100%; min-height: 360px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; line-height: 18px; letter-spacing: 0; }
.qa { white-space: pre-wrap; padding: 12px 14px; border-radius: var(--radius-card); background: var(--surface-subtle); border: 1px solid var(--border); font-size: 14px; line-height: 22px; }
.qa.is-answer { background: var(--blue-light); border-color: #cce4ff; }
.inv-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 170px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid #efeff0; }
.inv-row .input { height: 34px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: var(--shadow-floating); transition: opacity 150ms ease, transform 150ms ease; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-err { background: var(--red); }
.loading { padding: 48px 16px; text-align: center; color: var(--text-muted); }
@media (max-width: 640px) {
  .inv-row { grid-template-columns: 1fr 1fr; }
  .inv-row > :first-child { grid-column: 1 / -1; }
}
[hidden] { display: none !important; }
.drawer-body > .table-card { min-height: max-content; overflow-x: auto; }


/* ---------- 목록 표 FreeGrid 테마 ---------- */
/* ---- 목록 표: FreeGrid (grid.js) — clobe 톤에 맞춘 테마 ---- */
.fg-theme-ezoms {
  --fg-font: var(--font-ui); --fg-font-size: 14px; --fg-radius: var(--radius-card); --fg-cell-px: 14px;
  --fg-bg: #fff; --fg-fg: var(--text-secondary); --fg-muted: var(--text-muted);
  --fg-header-bg: #fafafa; --fg-header-fg: var(--text-muted); --fg-header-weight: 500;
  --fg-border: var(--border); --fg-row-border: #efeff0;
  --fg-row-odd: #fff; --fg-row-hover: #f7f7f8; --fg-row-selected: var(--blue-light);
  --fg-accent: var(--blue); --fg-accent-fg: #fff; --fg-focus: var(--blue);
  --fg-popup-bg: #fff; --fg-input-bg: #fff; --fg-shadow: var(--shadow-floating);
}
.fg-theme-ezoms .fg-header-cell { font-size: 13px; }
.table-card > .fg-host > .fg-root, .panel > .fg-host > .fg-root { border: 0; border-radius: 0; }
.panel > .fg-host { border-top: 1px solid var(--border); }
.fg-host.is-clickable .fg-body .fg-cell { cursor: pointer; }
.fgc { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.4; }
.fgc .cell-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fgc .cell-main:not(:has(.initial)) { display: block; }
.fgc .cell-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fgc.is-wrap, .fgc.is-wrap .cell-main, .fgc.is-wrap .cell-sub { white-space: normal; }
.fgc .input { height: 32px; }
.fg-cell .fgc .row-actions { gap: 2px; }


/* ---------- 자리표시(스켈레톤) ---------- */
/* ---------- 자리표시(스켈레톤) — 데이터가 오기 전에 화면 모양을 먼저 ---------- */
@keyframes sk-shine { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.sk { border-radius: 8px; background: linear-gradient(90deg, #eef0f2 25%, #f7f8f9 45%, #eef0f2 65%) 0 0 / 200% 100%; animation: sk-shine 1.4s ease-in-out infinite; }
.sk-line { height: 12px; margin: 8px 4px; }
.sk-nav { height: 30px; margin: 6px 0; }
.sk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.sk-card { height: 92px; border-radius: 12px; }
.sk-panel { margin-top: 16px; padding: 18px; border: 1px solid #ececed; border-radius: 12px; }
.sk-row { height: 38px; margin-top: 8px; }
.sk-row:nth-child(odd) { opacity: .7; }
.sk-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .sk-grid2 { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }


/* ---------- 빈 표 안내 ---------- */
/* 자료가 없는 표: 높이를 확보하고 가운데에 안내 문구 */
.fg-host.is-empty .fg-overlay { position: absolute; left: 0; right: 0; bottom: 0; display: grid; place-items: center; padding: 24px; color: var(--text-muted); font-size: 13.5px; text-align: center; background: transparent; }
.fg-host.is-empty .fg-overlay::before { content: ''; display: block; width: 36px; height: 36px; margin: 0 auto 10px; border-radius: 10px; background: #f2f3f5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa0a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M4 12h16M4 17h10'/%3E%3C/svg%3E") center / 20px no-repeat; }


/* ---------- 사이드 메뉴 [사용자 | 전체 관리자] 전환 ---------- */
/* 전체 관리자: 사이드 메뉴 전환 [내 회사 | 전체 관리자] */
.nav-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin: 4px 12px 8px; padding: 3px; border-radius: 10px; background: #e9eaec; }
.nav-mode button { height: 30px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.nav-mode button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 12%); }
.nav-mode button[data-navmode="admin"][aria-selected="true"] { background: #1d2225; color: #fff; }


/* ---------- 상태 카드 ---------- */
.status-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
/* 단계 카드 위에 겹쳐 보이는 보류·요청 표시 (누르면 그 단계에서 생긴 건만) */
.status-card .sc-flags { position: absolute; top: 9px; right: 9px; display: flex; gap: 4px; }
.status-card .sc-flags i { padding: 1px 7px; border-radius: 999px; font-size: 11px; font-style: normal; font-weight: 600; line-height: 18px; cursor: pointer; }
.status-card .sc-flags .is-hold { background: #eef2f6; color: #475569; } .status-card .sc-flags .is-ask { background: #fdecec; color: var(--red); }
.status-card .sc-flags i:hover { filter: brightness(.94); }
.stage-filter { display: flex; align-items: center; gap: 8px; margin: -6px 0 12px; font-size: 13px; color: var(--text-secondary); }
.status-card { --tone: var(--blue); position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding: 14px 16px 13px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; text-align: left; cursor: pointer; overflow: hidden; transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease); }
.status-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tone); opacity: .55; }
.status-card:hover { border-color: color-mix(in srgb, var(--tone) 45%, var(--border)); box-shadow: 0 4px 14px rgb(15 23 42 / 6%); transform: translateY(-1px); }
.status-card[aria-selected="true"] { border-color: var(--tone); background: color-mix(in srgb, var(--tone) 7%, #fff); box-shadow: 0 0 0 1px var(--tone) inset; }
.status-card[aria-selected="true"]::before { opacity: 1; }
.status-card .sc-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.status-card[aria-selected="true"] .sc-label { color: var(--tone); }
.status-card .sc-num { font-size: 24px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.status-card .sc-num small { margin-left: 2px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.status-card .sc-sub { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.status-card.is-amber { --tone: #d97706; } .status-card.is-violet { --tone: #7c3aed; } .status-card.is-green { --tone: #16a34a; }
.status-card.is-red { --tone: var(--red); } .status-card.is-gray { --tone: #64748b; } .status-card.is-teal { --tone: #0d9488; } .status-card.is-sky { --tone: #0284c7; }
@media (max-width: 1500px) { .status-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 640px) { .status-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .status-card .sc-num { font-size: 20px; } }

/* ---------- 그리드 No 열 · 페이지 행 수 ---------- */
/* 그리드 No 열 */
.fg-no { color: var(--text-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
/* 페이지 목록: 한 화면 행 수 */
.pager-size { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.pager-size select { height: 30px; padding: 0 26px 0 10px; font-size: 13px; }
.pager-wrap { display: inline-flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }


/* ---------- 어두운 사이드 메뉴 · 메뉴 배지 ---------- */
/* 사이드 메뉴: 어두운 배경 */
.app-shell .sidebar { --sb-bg: #16191d; --sb-fg: #a9b0b8; --sb-muted: #6c747d; --sb-line: rgb(255 255 255 / 7%); --sb-hover: rgb(255 255 255 / 6%); --sb-sel: rgb(255 255 255 / 11%);
  background: var(--sb-bg); border-right-color: var(--sb-bg); color: var(--sb-fg); color-scheme: dark; }
.app-shell .sidebar .sidebar-brand, .app-shell .sidebar .brand-name { color: #fff; }
.app-shell .sidebar .brand-sub { color: var(--sb-muted); }
.app-shell .sidebar .nav-group-title { color: var(--sb-muted); }
.app-shell .sidebar .nav-item { color: var(--sb-fg); }
.app-shell .sidebar .nav-item:hover { background: var(--sb-hover); color: #fff; }
.app-shell .sidebar .nav-item[aria-current="page"] { background: var(--sb-sel); color: #fff; box-shadow: inset 2px 0 0 #4c9bff; }
.app-shell .sidebar .nav-badge.is-muted { background: var(--sb-sel); color: var(--sb-fg); }
.app-shell .sidebar .nav-mode { background: rgb(255 255 255 / 7%); }
.app-shell .sidebar .nav-mode button { color: var(--sb-muted); }
.app-shell .sidebar .nav-mode button[aria-selected="true"] { background: #fff; color: #16191d; box-shadow: none; }
.app-shell .sidebar .nav-mode button[data-navmode="admin"][aria-selected="true"] { background: #0f73e5; color: #fff; }
.app-shell .sidebar .sidebar-foot { border-top-color: var(--sb-line); }
.app-shell .sidebar .sidebar-foot .who { color: #e6e9ec; }
.app-shell .sidebar .sidebar-foot .cell-sub { color: var(--sb-muted); }
.app-shell .sidebar .sidebar-foot .avatar { background: rgb(255 255 255 / 10%); color: #fff; }
.app-shell .sidebar .sidebar-foot .btn { background: transparent; border-color: rgb(255 255 255 / 16%); color: var(--sb-fg); }
.app-shell .sidebar .sidebar-foot .btn:hover { background: var(--sb-hover); color: #fff; }
.app-shell .sidebar .sidebar-nav { scrollbar-color: rgb(255 255 255 / 18%) transparent; }

/* 대시보드 판매 분석 */
.dash-sales .panel-head { flex-wrap: wrap; gap: 8px; }
.sales-range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; font-size: 13px; color: var(--text-muted); }
.sales-range .input { height: 30px; width: 136px; font-size: 13px; }
.sales-range .btn.is-on { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.sales-chart-head { margin: 18px 0 6px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.sales-chart-head .dim { margin-left: 6px; font-weight: 400; }
/* 어두운 사이드 메뉴: 로고 반전, 숫자 뱃지는 진한 단색 */
.app-shell .sidebar .brand-mark { background: #fff; color: #16191d; }
.app-shell .sidebar .nav-badge { min-width: 20px; padding: 0 6px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 18px; }
.app-shell .sidebar .nav-badge.is-alert { background: #e5484d; color: #fff; }
.app-shell .sidebar .nav-badge.is-warn { background: #f0a020; color: #1d1404; }
.app-shell .sidebar .nav-badge.is-muted { background: rgb(255 255 255 / 14%); color: #e6e9ec; }
.app-shell .sidebar .nav-badge.is-info { background: #3b82f6; color: #fff; }
/* [사용자 | 전체 관리자] 반대쪽 메뉴에 처리할 건이 있으면 점 */
.nav-mode button.has-dot { position: relative; }
.nav-mode button.has-dot::after { content: ""; position: absolute; top: 5px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: #e5484d; }

/* ---------- 가운데 모달 ---------- */
/* 가운데 모달 (openModal) */
.drawer.is-modal { inset: 0; margin: auto; width: min(520px, calc(100vw - 32px)); height: fit-content; max-height: min(720px, calc(100dvh - 48px)); border-radius: 16px; }
.drawer.is-modal[open] { animation: modal-in 200ms cubic-bezier(.2, .8, .2, 1); }
.drawer.is-modal.is-closing { animation: modal-out 160ms ease-in forwards; }
.drawer.is-modal .drawer-foot { border-radius: 0 0 16px 16px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ---------- 고칠 수 있는 칸(연노랑) · 넓은 모달 ---------- */

/* 고칠 수 있는 칸: 연한 노란색 (사이트 전체, grid 의 editable 열) */
.fg-theme-ezoms .fg-cell.is-editable { background-color: #fff6d5; }
.fg-theme-ezoms .fg-row:hover .fg-cell.is-editable { background-color: #ffefb8; }
.fg-theme-ezoms .fg-cell.is-editable:focus-within, .fg-theme-ezoms .fg-cell.is-editable.fg-focus { box-shadow: inset 0 0 0 2px #f2c94c; }

/* 넓은 모달 (재고 입출고 내역·대량 등록) */
.drawer.is-modal.is-wide { width: min(1180px, calc(100vw - 32px)); }

/* ---------- 모달 안 필터 · 일괄 작업 구분선 · 표가 든 모달 ---------- */

/* 모달 안 검색 조건은 한 줄로 */
.drawer .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.drawer .filters .input { width: auto; }
.drawer .filters .search-field input { width: 100%; }

.bulkbar .bulk-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.btn.is-alert { border-color: var(--red); color: var(--red); }
/* 표가 들어간 모달: 본문은 스크롤하지 않고 표 안에서만 (이중 스크롤 방지) */
.drawer.is-modal.has-grid .drawer-body { overflow: hidden; }

/* ---------- 로고 이미지 ---------- */
.brand-mark img { width: 74%; height: 74%; object-fit: contain; }

/* ---- 관리 화면 규칙 (2026-10) ---- */
/* 작은 안내(note small)는 아래 내용과 붙지 않게 */
.note.small { margin-bottom: 12px; }
/* 표는 한 칸 한 줄 — 넘치면 말줄임, 전체 글은 툴팁 */
.data-table td, .data-table th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 작업 칸: 버튼 하나 = 칸 하나, 가운데 정렬 */
.data-table th.act, .data-table td.act { width: 1%; text-align: center; }
/* 표 행 높이: 한 칸 한 줄이라 36px (머리글 36px) — grid.js 기본값 */
/* 표 안 버튼은 버튼처럼: 흰 바탕 + 테두리, 위험 동작은 빨간 테두리 */
.fg-cell .fgc > .btn:not(.btn-primary):not(.btn-danger) { border: 1px solid var(--border); background: #fff; }
.fg-cell .fgc > .btn:not(.btn-primary):not(.btn-danger):hover { border-color: var(--text-muted); background: var(--surface-subtle); }
.fg-cell .fgc > .btn-sm { min-height: 26px; padding: 2px 10px; }
.fg-cell .fgc > .btn-danger { border: 1px solid #f3c6c4; background: #fff; }
.fg-cell .fgc > .btn-danger:hover { border-color: var(--red); background: #fdf3f2; }
.fg-cell .fgc > a.btn { text-decoration: none; }
.data-table td.act .btn:not(.btn-primary) { border: 1px solid var(--border); background: #fff; }
/* 표 위 저장 줄 (노란 칸을 고치면 나타남) + 저장 전 고친 칸 — grid.js opts.saveBar */
.edit-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff8e1; border-bottom: 1px solid #f3dfa2; font-size: 13px; }
.edit-bar[hidden] { display: none; }
.edit-bar .edit-count { margin-right: auto; color: #8a5a00; }
/* 저장 전 고친 칸: FreeGrid 변경 표시(.fg-cell-dirty, 오른쪽 위 삼각형) + 진한 노랑. 노란 칸은 background-color 로만 칠해야 삼각형이 보인다 */
.fg-cell.is-editable.fg-cell-dirty { background-color: #ffe9a8 !important; }
/* 날짜 칸: 눌러서 날짜 고르기 (모달) */
.date-pick { cursor: pointer; border-bottom: 1px dashed currentColor; }
.date-pick:hover { color: var(--blue); }
/* 내역처럼 칸이 많은 모달: 더 넓게 (.drawer.is-modal.is-wide.is-xwide) */
.drawer.is-modal.is-wide.is-xwide { width: min(1480px, calc(100vw - 32px)); }
/* 불러오는 중 (loadingHtml()) */
.loading-box { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 160px; color: var(--text-muted); font-size: 13px; border: 1px solid var(--border); border-radius: var(--radius-card); }
.spinner { width: 18px; height: 18px; border: 2px solid #d9dce1; border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 서랍 폼 묶음: 제목 + 칸들 */
.form-sec + .form-sec { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-sec-title { display: flex; align-items: center; gap: 4px; margin: 0 0 10px; font-size: 13px; font-weight: 650; color: var(--text-secondary); }
.input.is-static { display: flex; align-items: center; background: var(--surface-subtle); }
.check-input { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check-input input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
/* 설명 말풍선 '!' — 마우스를 올리거나 포커스하면 보인다 */
.tip { position: relative; display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 4px; border-radius: 50%; border: 1px solid var(--text-muted); color: var(--text-muted); font-size: 10px; font-weight: 700; line-height: 1; cursor: help; vertical-align: 1px; flex: none; }
.tip:hover, .tip:focus { border-color: var(--blue); color: var(--blue); outline: none; }
.tip-pop { position: fixed; inset: auto; margin: 0; max-width: 280px; padding: 8px 10px; border: 0; border-radius: 8px; background: #1d2225; color: #fff; font-size: 12px; line-height: 1.5; text-align: left; box-shadow: 0 6px 18px rgb(0 0 0 / 18%); pointer-events: none; overflow: visible; }
/* 입력칸은 단순하게: 34px · 모서리 6px · 옅은 테두리, 포커스는 파란 테두리 + 옅은 링 하나 */
.input { height: 34px; padding: 0 10px; border: 1px solid #dcdde0; border-radius: 6px; background-color: #fff; box-shadow: none; transition: border-color .12s, box-shadow .12s; }
.input:hover:not(:disabled):not([readonly]) { border-color: #c3c5c9; }
.input:focus, .input:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgb(15 115 229 / 12%); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a8d91' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
textarea.input { padding: 8px 10px; }
.input[type="date"] { padding-right: 6px; }
.check-input { height: 34px; }
.field { gap: 5px; }
/* 목록 위 탭(list-head .segments): 소제목 탭처럼 크게 — 밑줄로 지금 탭 표시 */
.list-head { margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.list-head .segments { gap: 2px; padding: 0; border-radius: 0; background: none; }
.list-head .segment { min-height: 42px; padding: 8px 16px; border-radius: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 15px; color: var(--text-secondary); box-shadow: none; }
.list-head .segment:hover { color: var(--ink); background: var(--surface-subtle); }
.list-head .segment[aria-current="page"], .list-head .segment[aria-selected="true"] { background: none; box-shadow: none; color: var(--ink); font-weight: 650; border-bottom-color: var(--ink); }
.list-head .segment .count { font-size: 12px; line-height: 18px; padding: 0 6px; }
/* 표 하나만 있는 모달도 화면이 작아 넘치면 본문이 스크롤 (잘리지 않게) */
.drawer.is-modal.has-grid .drawer-body { overflow: auto; }

/* 값 자리표시: 정해진 글자는 바로 그리고 서버 값 자리만 반짝이 막대 (ph()) */
.ph { display: inline-block; height: .9em; min-width: 1.5em; vertical-align: -0.1em; border-radius: 4px; background: linear-gradient(90deg, #eef0f2 0%, #f6f7f8 50%, #eef0f2 100%); background-size: 200% 100%; animation: ph-shine 1.2s ease-in-out infinite; }
@keyframes ph-shine { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
