/* 세 사이트(판매·공급·팜 관리자) 공용 화면 부품 — 사이트·페이지 CSS 에 같은 규칙을 다시 쓰지 말고 여기 것을 쓴다.
   PC 화면용. 색 토큰·글꼴·태그·알림은 base.css(PC·모바일 공통), 모바일 화면 부품은 m.css.
   판매·공급은 /assets/…, 팜은 /ui/… 로 받는다(lib/static.php). 사이트 site.css 에는 그 사이트에만 있는 것만.
   색 뜻(한 번 정한 뜻은 어디서나 그대로):
     네이비 --brand 뼈대(로고·잔액 카드·로그인 면)
     블루 --primary 주 버튼·선택됨·진행 중  초록 --green 성공·완료
     주황 --amber 사람이 봐야 함(경고)      빨강 --red   오류·실패·위험한 동작
     회색 tag-info 대기·분류·꺼짐
   부품: 틀(.shell .side .nav .top .page · .shell.hd 머리 있는 틀 .hdr .logo .hnav .hdr-end) · 제목 줄(.head h1 .actions) · .card(.cardtitle/.cardhead 머리 띠 · .card-foot 버튼 띠) .row .c4~c12 · 입력(label .field .hint label.check)
         · .stat(.hero 파스텔 큰 숫자) · .btn(.line .sm .danger) · .link .link-danger · .stat(s) · table.t(.scroll-x .wide td.wrap tr.grp)
         · .tabs .pager .kv · .filter .range(날짜 조회 줄) · .quick(빠른 값 버튼) · dialog.box(.ask 확인창 — app.js ask()) · .bar · .code .mono */
/* ── 틀: 어두운 옆 메뉴(--side-*) + 흰 위 줄 + 회색 바탕(--pc-page) 위 흰 카드. 모바일은 옆 메뉴가 위 가로 메뉴가 된다 ── */
:root { --page: var(--pc-page); }
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.side { padding: 14px 8px; background: var(--side-bg); color: var(--side-ink); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 800; font-size: 17px; color: #fff; }
.brand i { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; }
.brand svg { width: 20px; height: 20px; fill: none; stroke: var(--on-primary); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.nav a { display: flex; align-items: center; gap: 10px; height: 40px; margin: 2px 0; padding: 0 12px; border-radius: 4px; color: var(--side-ink); }
.nav a svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav a.on svg { opacity: 1; color: var(--primary); }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.on { background: rgba(255, 255, 255, .1); color: #fff; font-weight: 600; box-shadow: 3px 0 0 var(--primary) inset; }
/* 머리 있는 틀(.shell.hd): 위 전체 폭 흰 머리(.hdr = .logo + .hnav 안내 메뉴 + .hdr-end) + 아래 어두운 옆 메뉴 */
.shell.hd { grid-template-rows: 60px 1fr; grid-template-areas: "hdr hdr" "side main"; }
.shell.hd > .side { grid-area: side; position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; padding-top: 12px; }
.shell.hd > .main { grid-area: main; }
.hdr { grid-area: hdr; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; height: 60px; background: var(--surface); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; width: 210px; height: 100%; padding: 0 22px; font-size: 23px; color: var(--logo-ink); }
.hnav { display: flex; align-items: center; height: 100%; margin-left: 8px; }
.hnav a { display: flex; align-items: center; height: 100%; padding: 0 16px; font-size: 15px; font-weight: 600; color: var(--ink2); }
.hnav a:hover { color: var(--ink); }
.hnav a.on { color: var(--ink); box-shadow: 0 -3px 0 var(--primary) inset; }
.hdr-end { display: flex; align-items: center; gap: 16px; margin-left: auto; padding-right: 20px; font-size: 14px; color: var(--ink2); }
.hdr-end b { color: var(--ink); font-weight: 700; }
.navgroup { margin: 16px 12px 6px; font-size: 12px; font-weight: 700; letter-spacing: .4px; color: rgba(255, 255, 255, .45); }
.main { min-width: 0; }
.top { height: 48px; border-bottom: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 0 20px; }
.top .where { margin-right: auto; display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink2); font-size: 14px; font-weight: 600; }
.top .where a:hover { color: var(--ink); }
.top .where .sep { color: var(--ink3); font-weight: 400; }
.chip { border: 1px solid var(--line); padding: 4px 4px 4px 12px; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.chip b { font-weight: 600; }
.chip a {
  display: inline-flex; align-items: center; justify-content: center; height: 26px; line-height: 26px;
  padding: 0 11px; font-size: 14px; font-weight: 700; letter-spacing: -0.1px;
  background: var(--primary); color: #fff; border-radius: 2px;
}
.page { padding: 22px 20px 40px; max-width: 1200px; }

/* ── 제목 줄: 버튼이 있든 없든 높이 40px 로 같아서 아래 카드 시작선이 화면마다 같다 ── */
h1 { margin: 0 0 18px; font-size: 22px; line-height: 40px; font-weight: 600; letter-spacing: -0.5px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; min-height: 40px; margin-bottom: 18px; }
.head h1 { margin: 0; }
.head.tools { justify-content: flex-end; }
.head.sm { min-height: 0; margin-bottom: 12px; }
.head.sm .cardtitle { margin: 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cardtitle { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
/* 카드 머리 띠: 카드 맨 위의 제목 줄은 회색 띠로, 맨 아래 .card-foot 는 버튼 띠로 */
.card > .cardtitle:first-child, .card > .cardhead:first-child, .card > .head.sm:first-child { margin: -22px -22px 18px; padding: 13px 22px; min-height: 0; background: var(--hover); border-bottom: 1px solid var(--line); }
.card > .cardhead:first-child { align-items: center; }
.card > .cardhead:first-child .cardtitle { margin: 0; font-size: 15px; }
.card > .cardtitle:first-child { font-size: 15px; }
.card-foot { display: flex; gap: 8px; align-items: center; margin: 18px -22px -22px; padding: 14px 22px; background: var(--hover); border-top: 1px solid var(--line); }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cardhead a { color: var(--primary); font-weight: 600; font-size: 14px; }
.cardhead .inline { flex: 1 1 auto; justify-content: flex-end; }

/* ── 카드·격자 ── */
.card { border: 1px solid var(--line); border-radius: 4px; padding: 22px; background: var(--surface); }
.row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c6 { grid-column: span 6; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
.gap { margin-bottom: 16px; }

/* ── 입력 ── */
label { display: block; margin: 0 0 6px; font-weight: 600; font-size: 14px; }
label .req { color: var(--red); margin-right: 3px; }
.field { margin-bottom: 18px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 0; box-shadow: 0 0 0 1px var(--field) inset; border-radius: 2px; padding: 0 12px; height: 38px; outline: none; }
textarea { height: auto; padding: 8px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 1px var(--primary) inset; }
input[readonly] { background: var(--soft); }
::placeholder { color: var(--ink3); }
.hint { margin-top: 4px; font-size: 14px; color: var(--ink2); }
/* 체크박스·라디오 + 글자. 입력칸 옆 줄에 놓이면 .tall 로 입력칸 높이(38px)에 맞춘다 */
label.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; font-size: 14px; cursor: pointer; }
label.check.tall { display: flex; height: 38px; }
label.check input { width: 16px; height: 16px; min-width: 0; margin: 0; padding: 0; box-shadow: none; accent-color: var(--primary); }

/* ── 버튼·글자 버튼 ── */
/* body 는 antialiased — 색 면 위 흰 글자(맥 13~14px)는 auto 가 덜 얇게 보이는 경우가 많다 */
.btn:not(.line), .chip a, .tabs a.on, .pager span.cur {
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}
.btn { display: inline-block; height: 40px; padding: 0 18px; border: 0; border-radius: 2px; background: var(--primary); color: #fff; font: inherit; font-weight: 600; line-height: 40px; text-align: center; white-space: nowrap; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.line { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--field) inset; }
.btn.sm { height: 32px; line-height: 32px; padding: 0 12px; font-size: 14px; }
.btn.danger { background: var(--red); color: #fff; }
.btn.line.danger { background: var(--surface); color: var(--red); box-shadow: 0 0 0 1px var(--red-soft) inset; }
.btns { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.link, .link-danger { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--primary); cursor: pointer; white-space: nowrap; }
.link-danger { color: var(--red); }
.link:hover, .link-danger:hover { text-decoration: underline; }
.link:disabled, .link-danger:disabled { opacity: .5; cursor: default; text-decoration: none; }
.plain { color: var(--ink2); font-size: 14px; }
.plain:hover { color: var(--ink); }

/* ── 숫자 칸 ── */
.stat { border: 1px solid var(--line); border-radius: 4px; padding: 16px 20px; background: var(--surface); }
a.stat { color: inherit; text-decoration: none; } a.stat:hover { border-color: var(--primary-line); }
.stat small { display: block; font-size: 14px; color: var(--ink2); }
.stat strong { display: block; margin-top: 4px; font-size: 20px; font-weight: 600; }
.stat.hero { border-color: transparent; background: linear-gradient(135deg, var(--hero-from) 0%, var(--hero-to) 100%); color: var(--hero-ink); }
.stat.hero small { color: var(--hero-sub); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stats.three { grid-template-columns: repeat(3, 1fr); }

/* ── 표: 넓으면 .scroll-x 로 감싸 옆으로 민다 ── */
.scroll-x { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t.wide { min-width: 1000px; }
table.t th { text-align: left; padding: 10px 12px; font-size: 14px; font-weight: 600; color: var(--ink2); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
table.t tr:last-child td { border-bottom: 0; }
table.t .r { text-align: right; } table.t .n { white-space: nowrap; }
table.t td.wrap { min-width: 160px; word-break: break-all; }
table.t tr.grp th { padding-top: 18px; background: var(--soft, transparent); color: var(--ink); font-size: 14px; font-weight: 700; }   /* 표 안 묶음 머리 줄 */
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--hover); }
table.t tr.sum td { font-weight: 600; background: var(--hover); }
table.t td.zero { color: var(--ink3); font-weight: 400; }
.sub { display: block; font-size: 14px; color: var(--ink3); }
.sub.inl { display: inline; }
td.sub, th.sub { display: table-cell; }
.empty { padding: 28px 0; text-align: center; color: var(--ink2); }

/* ── 탭·쪽 번호·키-값 ── */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { height: 32px; line-height: 30px; padding: 0 12px; font-size: 14px; border-radius: 2px; box-shadow: 0 0 0 1px var(--field) inset; background: var(--surface); }
.tabs a.on { background: var(--primary); color: #fff; box-shadow: none; font-weight: 600; }
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 14px; font-size: 14px; color: var(--ink2); }
.pager a, .pager span.cur { min-width: 32px; height: 32px; line-height: 30px; text-align: center; border-radius: 2px; box-shadow: 0 0 0 1px var(--field) inset; padding: 0 8px; }
.pager span.cur { background: var(--primary); color: #fff; box-shadow: none; font-weight: 600; }
.kv { display: grid; grid-template-columns: 140px 1fr 140px 1fr; border: 1px solid var(--line); background: var(--surface); }
.kv > * { padding: 11px 14px; border-bottom: 1px solid var(--line); }
.kv > dt { background: var(--hover); font-weight: 600; font-size: 14px; color: var(--ink2); margin: 0; }
.kv > dd { margin: 0; word-break: break-all; }
.kv label { margin: 0; }
.kv input, .kv select { width: auto; min-width: 240px; max-width: 100%; }

/* ── 거르기 줄(.filter: 검색·고르기·날짜 + 버튼, 높이 38) · 카드 머리의 작은 날짜 조회(.range, 높이 32) ── */
form.inline, .filter, .range { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline input, form.inline select { width: auto; min-width: 160px; }
form.inline label.check input { width: 16px; min-width: 0; }   /* 거르기 줄의 체크박스가 160px 로 늘어나지 않게 */
.filter { margin-bottom: 14px; }
.filter input[type=search] { min-width: 240px; }
.filter input[type=date] { min-width: 0; width: 150px; }
.filter select { min-width: 140px; }
.range input[type=date] { min-width: 0; width: 140px; height: 32px; }

/* ── 빠른 버튼 묶음(충전 금액·빠른 명령): 칸 폭이 같은 격자. 글자가 짧으면 .cols5 로 5칸 고정 ── */
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin-top: 8px; }
.quick.cols5 { grid-template-columns: repeat(5, 1fr); }
.quick .btn { min-width: 0; padding: 0 4px; }

/* ── 대화상자 ── */
dialog.box { border: 1px solid var(--line); border-radius: 2px; padding: 22px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; color: var(--ink); }
dialog.box.wide { width: min(680px, calc(100vw - 32px)); }
dialog.box.lg { width: min(820px, calc(100vw - 32px)); }
dialog.box.xl { width: min(1000px, calc(100vw - 32px)); }
dialog.box.ask { width: min(420px, calc(100vw - 32px)); background: var(--surface); }
dialog.box.ask p { color: var(--ink2); }
dialog.box::backdrop { background: rgba(0, 0, 0, .35); }
dialog.box h2 { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
dialog.box p { margin: 0 0 10px; }
dialog.box .field { margin-bottom: 14px; }
dialog.box .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ── 기타 ── */
.bar { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.bar i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.code { background: var(--soft); border: 1px solid var(--line); padding: 10px 12px; font: 500 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-x: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ── 모바일 ── */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .shell.hd { grid-template-rows: auto; grid-template-areas: "hdr" "side" "main"; }
  .shell.hd > .side { position: static; height: auto; }
  .hnav, .hdr-end > span { display: none; }
  .logo { width: auto; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px 0; }
  .brand { padding: 0 4px 8px; font-size: 16px; }
  .brand i { width: 26px; height: 26px; }
  .nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; height: 38px; line-height: 38px; margin: 0; padding: 0 10px; border-radius: 0; font-size: 14px; }
  .nav a.on { background: none; box-shadow: 0 -2px 0 var(--primary) inset; }
  .top { height: 44px; padding: 0 12px; gap: 10px; }
  .page { padding: 18px 12px 32px; }
  .card { padding: 14px; }
  .c3, .c4, .c6, .c8 { grid-column: span 12; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats.three { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
  .scroll-x table.t td { white-space: nowrap; }
  .filter input[type=search] { flex-basis: 100%; min-width: 0; }
  .filter input[type=date] { flex: 1; width: 0; }
  .head.sm .range { flex: 1 1 100%; flex-wrap: nowrap; }
  .range input[type=date] { flex: 1; width: 0; }
}
