/* 고객 계약 관리: 조용한 업무 화면 + '확인 필요'만 형광펜으로 */
:root {
  --ink: #1C2A39;
  --slate: #5E6C7B;
  --paper: #F2F4F6;
  --sheet: #FFFFFF;
  --line: #D8DDE3;
  --mark: #FFE15A;
  --act: #0E6B63;
  --act-dark: #0A524C;
  --bad: #B3261E;
  --radius-s: 6px;
  --radius-l: 12px;
  --font: 'SUIT Variable', 'SUIT', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.55 var(--font); font-feature-settings: 'tnum' 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--act); outline-offset: 2px; }
.boot { padding: 40px; color: var(--slate); }
.muted { color: var(--slate); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }
.error { color: var(--bad); min-height: 1.2em; margin: 4px 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- 버튼, 입력 ---------- */
button { cursor: pointer; border-radius: var(--radius-s); border: 1px solid transparent; padding: 9px 16px; min-height: 40px; }
button:disabled { opacity: .5; cursor: progress; }
.primary { background: var(--act); color: #fff; font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--act-dark); }
.secondary { background: var(--sheet); border-color: var(--line); }
.secondary:hover:not(:disabled) { border-color: var(--slate); }
.secondary.small, button.small { min-height: 34px; padding: 5px 12px; font-size: 14px; }
.link { background: none; border: 0; padding: 6px 0; color: var(--act); text-decoration: underline; text-underline-offset: 3px; min-height: 0; }
input, select, textarea {
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 8px 10px; min-height: 40px; width: 100%;
}
textarea { resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--act); }
label { font-weight: 600; font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; white-space: nowrap; }

/* ---------- 로그인 ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 32px 28px; }
.auth-card .brand { margin: 0 0 4px; color: var(--slate); font-size: 14px; }
.auth-card h1 { margin: 0 0 20px; font-size: 26px; line-height: 1.25; letter-spacing: -.01em; }
.auth-card form { display: grid; gap: 6px; }
.auth-card form label { margin-top: 8px; }
.auth-card .primary { margin-top: 12px; }
.auth-card .hint { margin: 20px 0 0; color: var(--slate); font-size: 14px; }
.steps { padding-left: 20px; margin: 0 0 16px; }
.steps li { margin-bottom: 4px; }
.qr { display: block; width: 180px; height: 180px; margin: 0 auto 12px; background: #fff; }
details { margin-bottom: 12px; font-size: 14px; }

/* ---------- 상단, 메뉴 ---------- */
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px clamp(16px, 3vw, 32px); background: var(--ink); color: #fff;
}
.top .who { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.top .who strong { font-size: 17px; }
.top .who span { opacity: .75; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .link { color: #fff; }
.tabs {
  display: flex; gap: 2px; padding: 0 clamp(8px, 3vw, 28px); background: var(--sheet);
  border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.tab { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 12px 14px; white-space: nowrap; color: var(--slate); }
.tab.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 700; }
.body { padding: 20px clamp(16px, 3vw, 32px) 48px; max-width: 1480px; }

/* ---------- 조회 조건 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters > select, .filters > input[type=search] { width: auto; min-width: 150px; flex: 0 1 220px; }
.filters .range { display: flex; align-items: center; gap: 6px; }
.filters .range input { width: 150px; }
.fixed-store { font-weight: 700; padding: 0 6px; }
.count { margin: 0 0 8px; color: var(--slate); font-size: 14px; }

/* ---------- 표 ---------- */
.grid { width: 100%; border-collapse: collapse; background: var(--sheet); border: 1px solid var(--line); }
.grid th { text-align: left; font-size: 13px; font-weight: 600; color: var(--slate); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--paper); white-space: nowrap; }
.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tbody tr[tabindex] { cursor: pointer; }
.grid tbody tr[tabindex]:hover { background: #F7F9FA; }
.grid td.name { font-weight: 600; }
.grid tr.total td { font-weight: 700; background: var(--paper); }
.grid tr.inactive td { color: var(--slate); }
.grid.users td { vertical-align: middle; }
.grid.users input[type=text], .grid.users select { min-width: 120px; }
.detail-cell { font-size: 13px; color: var(--slate); word-break: break-all; }
.late { color: var(--bad); font-weight: 600; }

/* 형광펜: AI가 확실하지 않은 칸 */
td.mark span {
  background: linear-gradient(transparent 38%, var(--mark) 38%, var(--mark) 88%, transparent 88%);
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
  padding: 0 3px; margin: 0 -3px;
}
td.mark span:empty::after { content: '확인 필요'; color: var(--slate); font-size: 13px; }
.mark-field input, .mark-field select, .mark-field textarea {
  background: linear-gradient(transparent 55%, color-mix(in srgb, var(--mark) 70%, white) 55%) var(--sheet);
  border-color: #C9A900;
}
.reason { margin: 4px 0 0; font-size: 13px; color: #6B5600; }

.kind { font-size: 13px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.k-m { color: var(--ink); }
.k-w { color: var(--act); }
.st { font-size: 13px; color: var(--slate); }
.st.done { color: var(--act); font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
.empty { background: var(--sheet); border: 1px dashed var(--line); border-radius: var(--radius-l); padding: 40px 24px; text-align: center; }
.empty p { margin: 4px 0; }
.note { background: var(--sheet); border-left: 4px solid var(--act); padding: 12px 16px; margin-bottom: 16px; }
.note p { margin: 2px 0; }
.notices { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.notices li { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 16px; }
.notices p { margin: 0 0 2px; }

/* ---------- 상세(검수) 서랍 ---------- */
dialog.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(560px, 100vw); max-width: 100vw;
  border: 0; padding: 0; background: var(--sheet); color: var(--ink); display: flex; flex-direction: column;
}
dialog.drawer:not([open]) { display: none; }
dialog.drawer::backdrop { background: rgba(28, 42, 57, .45); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 24px 12px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 22px; line-height: 1.3; }
.drawer-head p { margin: 2px 0 0; font-size: 14px; }
.banner { margin: 12px 24px 0; padding: 10px 12px; background: color-mix(in srgb, var(--mark) 45%, white); border-radius: var(--radius-s); font-size: 14px; }
.source { display: inline-block; margin: 12px 24px 0; font-weight: 600; color: var(--act); }
form.detail { padding: 8px 24px 24px; overflow-y: auto; flex: 1; display: grid; gap: 12px; align-content: start; }
.field { display: grid; gap: 4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 12px 12px; display: grid; gap: 8px; }
legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.acct-edit { display: grid; gap: 8px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 24px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--sheet); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--radius-s); z-index: 1000; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); }

/* ---------- 휴대폰 ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .filters > * { flex: 1 1 100%; }
  .filters .range input { width: 100%; }
  .filters .range { flex: 1 1 100%; }
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: 100%; }
  .grid thead { display: none; }
  .grid { border: 0; background: none; }
  .grid tr { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-s); margin-bottom: 8px; padding: 8px 12px; }
  .grid td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; }
  .grid td::before { content: attr(data-label); color: var(--slate); font-size: 13px; flex: none; }
  .grid td:not([data-label])::before, .grid td[data-label='']::before { content: none; }
  .grid td.name { font-size: 17px; order: -1; }
  .grid td:not(.mark):has(> span:empty), .grid td:not(.mark):empty { display: none; }
  .grid tr { display: flex; flex-direction: column; }
  dialog.drawer { width: 100vw; }
  .two { grid-template-columns: 1fr; }
  .drawer-foot button { flex: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  dialog.drawer[open] { animation: slide .18s ease-out; }
  @keyframes slide { from { transform: translateX(24px); opacity: .6; } }
}
@media (max-width: 760px) and (prefers-reduced-motion: no-preference) {
  @keyframes slide { from { transform: translateY(24px); opacity: .6; } }
}
