/* MAELO Console — 명품 공급사 내부 운영 도구. SENO 디자인과 독립. */
:root {
  --bg: #FAF8F4; --surface: #FFFFFF; --surface-2: #F3EFE8; --text: #16130F; --muted: #6E665B;
  --border: #E6E0D6; --accent: #8A6A3B; --accent-ink: #FFFFFF; --accent-soft: #F1E8DA;
  --ok: #2F6B4F; --ok-soft: #E3EFE8; --warn: #9A6A12; --warn-soft: #F6ECD9; --danger: #9B2C2C; --danger-soft: #F6E1E1;
  --info: #3D5A80; --info-soft: #E3EAF3; --focus: #8A6A3B;
  --radius: 6px; --font: "Pretendard", system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14120F; --surface: #1D1A16; --surface-2: #25211C; --text: #F2EEE7; --muted: #A79E91;
    --border: #2E2A24; --accent: #C9A66B; --accent-ink: #14120F; --accent-soft: #332A1E;
    --ok: #7DBE9C; --ok-soft: #1E2C25; --warn: #E0B35C; --warn-soft: #33291A; --danger: #E68A8A; --danger-soft: #3A2222;
    --info: #9DB7DA; --info-soft: #1F2733; --focus: #C9A66B; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14120F; --surface: #1D1A16; --surface-2: #25211C; --text: #F2EEE7; --muted: #A79E91;
  --border: #2E2A24; --accent: #C9A66B; --accent-ink: #14120F; --accent-soft: #332A1E;
  --ok: #7DBE9C; --ok-soft: #1E2C25; --warn: #E0B35C; --warn-soft: #33291A; --danger: #E68A8A; --danger-soft: #3A2222;
  --info: #9DB7DA; --info-soft: #1F2733; --focus: #C9A66B; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border: 1px solid var(--border); z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12.5px; }
.boot { min-height: 100vh; display: grid; place-content: center; gap: 8px; text-align: center; }

/* 워드마크: 텍스트 기반(공식 로고 미확정) */
.wordmark { font-family: var(--serif); font-weight: 600; letter-spacing: .32em; font-size: 22px; color: var(--text); }
.wordmark-sub { font-size: 10px; letter-spacing: .18em; color: var(--muted); text-transform: uppercase; }

/* 레이아웃 */
.shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--border); background: var(--surface); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; flex-direction: column; gap: 2px; padding: 0 8px 18px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: var(--radius); color: var(--text); }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .count { font-size: 11px; min-width: 20px; text-align: center; border-radius: 10px; padding: 0 6px; background: var(--accent); color: var(--accent-ink); }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar .who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; }
.content { padding: 24px 28px 64px; max-width: 1240px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
h1 { font-family: var(--serif); font-weight: 600; font-size: 28px; letter-spacing: .01em; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* 카드 · 그리드 */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: 1.4fr 1fr; }
.kpi .value { font-size: 28px; font-variant-numeric: tabular-nums; font-weight: 600; margin-top: 4px; }
.kpi .label { color: var(--muted); font-size: 12.5px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
dl.meta { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; overflow-wrap: anywhere; }

/* 표 */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.diff td.before { color: var(--muted); text-decoration: line-through; }
.diff td.after { color: var(--text); font-weight: 600; }

/* 배지 */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid transparent; white-space: nowrap; }
.b-neutral { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-accent { background: var(--accent-soft); color: var(--accent); }
.lock { color: var(--warn); }

/* 버튼 · 입력 */
button, .btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { filter: brightness(1.06); }
button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
button.ghost { border-color: transparent; background: transparent; }
button.small { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
button:disabled { opacity: .55; cursor: not-allowed; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
label > span.req::after { content: " *"; color: var(--danger); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; min-height: 38px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input.num { text-align: right; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); }
.error-box { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius); padding: 10px 12px; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: 10px 12px; }
.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.loading { padding: 36px; text-align: center; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; min-height: 38px; white-space: nowrap; }
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }

/* 상태 단계 */
.steps { display: flex; gap: 0; overflow-x: auto; padding-bottom: 4px; }
.steps li { list-style: none; flex: 1; min-width: 86px; font-size: 11.5px; color: var(--muted); border-top: 2px solid var(--border); padding-top: 6px; margin-right: 4px; }
.steps li.done { border-color: var(--accent); color: var(--text); }
.steps li.current { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.steps { margin: 0; padding-left: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* 모달 · 토스트 */
.backdrop { position: fixed; inset: 0; background: rgba(20, 18, 15, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: min(520px, 100%); max-height: 90vh; overflow-y: auto; padding: 20px; }
.modal h2 { font-size: 17px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--radius); z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast.error { background: var(--danger); color: #fff; }
.secret-box { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); border: 1px dashed var(--border); padding: 10px; border-radius: var(--radius); overflow-wrap: anywhere; user-select: all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }

/* 로그인 */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: min(380px, 100%); padding: 28px; }
.auth .brand { align-items: center; border: 0; padding-bottom: 8px; }
.auth form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

/* 이미지 */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius); }

/* 모바일 (360px 포함) */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .18s ease; z-index: 40; box-shadow: none; }
  .side.open { transform: none; border-right: 1px solid var(--border); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .topbar .org-name { display: none; }
  .content { padding: 16px 16px 56px; }
  .table-wrap table { min-width: 620px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .grid.two { grid-template-columns: 1fr; }
  dl.meta { grid-template-columns: 1fr; gap: 2px; }
  dl.meta dd { margin-bottom: 8px; }
  h1 { font-size: 23px; }
}
@media (max-width: 400px) {
  .grid.kpi { grid-template-columns: 1fr 1fr; }
  .kpi .value { font-size: 22px; }
  .card { padding: 14px; }
  th, td { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.mt { margin-top: 14px; }
.boot-help { max-width: 560px; margin: 12vh auto; padding: 28px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.boot-help h1 { font-size: 22px; margin: 14px 0 10px; }
.boot-help pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; overflow-x: auto; user-select: all; }
.tnum { font-variant-numeric: tabular-nums; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin: 0; font: 13px/1.5 var(--font); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin: 0; } legend { font-size: 12.5px; color: var(--muted); padding: 0 4px; }
/* 체크박스: 전역 input 규칙(폭 100%·최소 높이) 제외, 라벨과 가로 정렬 */
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; flex: 0 0 auto; accent-color: var(--accent); margin: 2px 0 0; }
label.row { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--text); font-size: 13.5px; }

/* P2-2 주문 관리 · 알림 · 승인 진행 */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: .75rem; margin-bottom: .75rem; }
.filter-grid label { min-width: 0; }
.filter-grid input, .filter-grid select { width: 100%; min-width: 0; }
.row.center { justify-content: center; margin: 1rem 0; }
.bell { position: relative; text-decoration: none; padding: .25rem .4rem; border-radius: 6px; }
.bell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bell .count { position: absolute; top: -4px; right: -8px; }
.notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.notif a { display: grid; gap: .2rem; padding: .85rem 1rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface, transparent); color: inherit; text-decoration: none; }
.notif a:hover, .notif a:focus-visible { border-color: var(--accent); outline: none; }
.notif.unread a { border-left: 3px solid var(--accent); }
.notif-title { font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent); flex: none; }
.approver-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .75rem; }
.approver-steps .step { display: grid; gap: .3rem; padding: .75rem 1rem; border: 1px solid var(--border); border-radius: 6px; }
.approver-steps .s-approved { border-color: var(--ok, #3c7a4d); }
.approver-steps .s-rejected { border-color: var(--danger, #a33); }
.step-name { font-weight: 600; }

/* P2-2: 좁은 표에서 한글이 글자 단위로 줄바꿈되지 않게(가로 스크롤로 처리) */
.table-wrap th, .table-wrap td { word-break: keep-all; overflow-wrap: normal; }
.table-wrap td .mono, .table-wrap td .badge { white-space: nowrap; }
