/* 물푸미 웹 콘솔. 홈페이지(apps/web)와 같은 색을 쓴다 */
:root {
  --bg: #f6faf8; --surface: #ffffff; --ink: #14261f; --muted: #55695f; --line: #d9e6df;
  --brand: #1c5a4c; --brand-2: #3fa48b; --on-brand: #ffffff; --danger: #b3261e; --warn-bg: #fff3cd; --warn-ink: #5c4500;
  --ok-bg: #d7f2e6; --info-bg: #dbeafe; --err-bg: #fde2e0;
}
/* 화면 모드: 기본은 시스템 설정, 버튼으로 라이트 · 다크를 고르면 <html data-theme> 로 고정 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0f1a16; --surface: #16241f; --ink: #e9f3ee; --muted: #a3b8ae; --line: #27392f; --brand: #8fe3c9; --on-brand: #0f1a16; --danger: #ffb4ab;
    --warn-bg: #4a3b00; --warn-ink: #ffe08a; --ok-bg: #12382c; --info-bg: #17304f; --err-bg: #4a1512; }
}
:root[data-theme="dark"] { --bg: #0f1a16; --surface: #16241f; --ink: #e9f3ee; --muted: #a3b8ae; --line: #27392f; --brand: #8fe3c9; --on-brand: #0f1a16; --danger: #ffb4ab;
    --warn-bg: #4a3b00; --warn-ink: #ffe08a; --ok-bg: #12382c; --info-bg: #17304f; --err-bg: #4a1512; color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Segoe UI", Roboto, sans-serif; word-break: keep-all; overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }
.boot { padding: 40px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--brand-2); }
.btn.primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 14px; }
.btn.icon { min-width: 32px; padding: 0; }
.btn:disabled { opacity: 0.5; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 4px; }
.err { color: var(--danger); font-size: 14px; margin-top: 4px; }
.muted { color: var(--muted); }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(420px, 100%); }
.login h1 { font-size: 26px; margin: 12px 0 2px; }
.login .logo { width: 72px; height: 72px; border-radius: 17px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 18px 0 4px; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }

/* 틀 */
.shell { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
header.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
header.top .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
header.top .brand img { width: 32px; height: 32px; border-radius: 8px; }
header.top .space { font-weight: 700; }
nav.side { border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; }
nav.side button { text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; min-height: 44px; }
nav.side button:hover { background: var(--line); }
nav.side button[aria-current=page] { background: color-mix(in srgb, var(--brand-2) 24%, transparent); }
main.content { padding: 22px 24px 60px; min-width: 0; }
main.content h1 { font-size: 24px; margin: 0 0 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { width: 260px; }
.toolbar select { width: auto; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
td.wrap { white-space: normal; min-width: 160px; }
th { font-size: 13px; color: var(--muted); font-weight: 700; background: color-mix(in srgb, var(--brand-2) 8%, transparent); }
th button { all: unset; cursor: pointer; font: inherit; color: inherit; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.qty { display: inline-flex; align-items: center; gap: 6px; }
.qty b { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--line); }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); }
.tag.bad { background: var(--err-bg); color: var(--danger); }
.tag.ok { background: var(--ok-bg); }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cards .card { padding: 18px; }
.cards h3 { margin: 0 0 4px; font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.stat { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 14px 0; }
.stat .card { padding: 16px; }
.stat .n { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.code { font-size: 44px; font-weight: 800; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; margin: 10px 0; }
.banner { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-weight: 600; }

dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
dialog h2 { margin: 0; padding: 18px 20px 6px; font-size: 20px; }
dialog .body { padding: 0 20px 8px; overflow-y: auto; }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* 알림 (화면 위 카드, 5초 뒤 닫힘) */
#notice { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 50; width: min(520px, calc(100vw - 28px)); pointer-events: none; }
#notice .n { pointer-events: auto; border-radius: 12px; padding: 14px 16px; font-weight: 700; font-size: 17px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); cursor: pointer; border: 1px solid var(--line); }
#notice .n.success { background: var(--ok-bg); } #notice .n.info { background: var(--info-bg); } #notice .n.warning { background: var(--warn-bg); color: var(--warn-ink); } #notice .n.error { background: var(--err-bg); }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  nav.side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; }
  nav.side button { white-space: nowrap; }
  main.content { padding: 16px 14px 60px; }
  .toolbar input[type=search] { width: 100%; }
  .two { grid-template-columns: 1fr; }
}
.btn.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary.danger { color: #3b0a07; } }
:root[data-theme="dark"] .btn.primary.danger { color: #3b0a07; }
select.lang { width: auto; min-height: 32px; font-size: 14px; font-weight: 600; }
/* 콤보: 기본 화살표를 지우고 직접 그린다 — 화살표 오른쪽 여백이 글자 왼쪽 여백(10px)과 같다 */
select { appearance: none; -webkit-appearance: none; padding: 0 30px 0 10px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2355695f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px 8px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23a3b8ae' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); } }
:root[data-theme="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23a3b8ae' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.btn svg { flex: none; }
