/* 법인카드 정산 — 데이터유니버스 홈페이지 색 체계(main1 #C01F25 · black1 #252525 · gray 계열) */
:root {
  --brand: #C01F25;
  --brand-2: #DB485B;
  --brand-dark: #95181D;
  --brand-light: #FEF6F8;
  --brand-light-2: #F9DCE4;
  --ink: #252525;
  --ink-2: #3D3D3D;
  --ink-3: #636363;
  --ink-4: #999999;
  --line: #EDEDED;
  --line-2: #DBDBDB;
  --bg: #FFFFFF;
  --bg-2: #FAFAFA;
  --bg-3: #F4F4F4;
  --warn: #9A5B00;
  --warn-bg: #FFF4E0;
  --ok: #1E7A4C;
  --ok-bg: #E9F6EF;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(37, 37, 37, .04), 0 6px 24px rgba(37, 37, 37, .05);
  --font: 'Noto Sans KR Variable', 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.faint { color: var(--ink-4); }
.hidden { display: none !important; }

/* ── 머리말 ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: 1180px; margin: 0 auto; height: 64px; padding: 0 24px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand img { width: 30px; height: auto; display: block; }
.brand b { font-size: 16px; font-weight: 700; letter-spacing: -0.03em; }
.nav { display: flex; gap: 4px; height: 100%; overflow-x: auto; scrollbar-width: none; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 0 12px;
  text-decoration: none; color: var(--ink-3); font-weight: 500; white-space: nowrap;
}
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); font-weight: 700; }
.nav a.on::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); }
.nav .sep { width: 1px; background: var(--line); margin: 20px 6px; }
.nav .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-3); flex: none; }
.who b { color: var(--ink); font-weight: 600; }

/* ── 본문 ── */
main { max-width: 1180px; margin: 0 auto; padding: 32px 24px 96px; }
main.narrow { max-width: 640px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.04em; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 14px; letter-spacing: -0.03em; }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 10px; }

.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card.flat { box-shadow: none; }
.section { margin-top: 28px; }
.grid { display: grid; gap: 16px; }
.grid.k4 { grid-template-columns: repeat(4, 1fr); }
.grid.c2 { grid-template-columns: 1.4fr 1fr; }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-4); }

/* ── 숫자 카드 ── */
.kpi { padding: 20px 22px; }
.kpi .l { font-size: 13px; color: var(--ink-3); }
.kpi .v { margin-top: 6px; font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.kpi .v small { font-size: 15px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.kpi .s { margin-top: 2px; font-size: 12.5px; color: var(--ink-4); }
.kpi.alert { border-color: var(--brand-light-2); background: var(--brand-light); }
.kpi.alert .v { color: var(--brand); }

/* ── 단추 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--bg); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--bg-2); border-color: #c9c9c9; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-3); }
.btn.ghost:hover { background: var(--bg-3); color: var(--ink); }
.btn.danger { color: var(--brand); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 52px; font-size: 16px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── 입력 ── */
label.f { display: block; margin-bottom: 18px; }
label.f > span, .f-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.f-label em { font-style: normal; font-weight: 700; color: var(--brand); }
.input, select.input, textarea.input {
  width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--bg); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 120px; padding: 12px 14px; resize: vertical; font-size: 13px; }
.input:focus, .chipbox:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(37, 37, 37, .06); }
.input.sm { height: 36px; font-size: 13px; padding: 0 10px; border-radius: 8px; }
select.input.sm { padding-right: 32px; background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.hint { font-size: 12.5px; color: var(--ink-4); margin-top: 6px; }
.hint:empty { display: none; }
.input.bad { border-color: var(--brand); }
.with-btn .input { padding-right: 46px; }
.field-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; }
.field-btn:hover { background: var(--bg-3); color: var(--ink); }
.field-btn svg { width: 20px; height: 20px; }
.err { color: var(--brand); font-size: 13px; margin-top: 8px; min-height: 1em; }

/* 용도 단추 */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  height: 38px; padding: 0 16px; border-radius: 19px; border: 1px solid var(--line-2); background: var(--bg);
  font-size: 14px; font-weight: 500; cursor: pointer; color: var(--ink-2); transition: all .15s;
}
.pill:hover { border-color: var(--ink-4); }
.pill.on { background: var(--brand-light); border-color: var(--brand); color: var(--brand); font-weight: 700; }

/* 이름 박스 입력 */
.chipbox {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 52px;
  padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--bg); cursor: text;
}
.chipbox input { flex: 1; min-width: 90px; border: 0; outline: 0; height: 32px; padding: 0 4px; background: transparent; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 6px 0 12px; border-radius: 8px;
  background: var(--bg-3); font-size: 14px; font-weight: 500;
}
.chip.dup { background: var(--warn-bg); color: var(--warn); }
.chip button { width: 22px; height: 22px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-4); cursor: pointer; font-size: 15px; line-height: 1; }
.chip button:hover { background: var(--line-2); color: var(--ink); }
.suggest {
  position: absolute; left: -1px; right: -1px; top: calc(100% + 6px); z-index: 30; max-height: 260px; overflow: auto;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(0, 0, 0, .1); padding: 6px;
}
.suggest button { display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 8px; text-align: left; cursor: pointer; }
.suggest button:hover, .suggest button.act { background: var(--bg-3); }
.suggest button small { color: var(--ink-4); }
.anchor { position: relative; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick button { height: 28px; padding: 0 10px; border-radius: 14px; border: 1px dashed var(--line-2); background: var(--bg); font-size: 12.5px; color: var(--ink-3); cursor: pointer; }
.quick button:hover { border-color: var(--ink-4); color: var(--ink); }

/* ── 상태 표시 ── */
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--bg-3); color: var(--ink-3); }
.tag.bad { background: var(--brand-light-2); color: var(--brand-dark); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.brand { background: var(--brand-light); color: var(--brand); }
.tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* ── 표 ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { position: sticky; top: 0; background: var(--bg-2); color: var(--ink-3); font-weight: 600; font-size: 12.5px; text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #fcfcfc; }
table.t .r { text-align: right; }
table.t tfoot td { background: var(--bg-2); font-weight: 700; border-top: 1px solid var(--line); }
table.t tr.over td { background: #fffafb; }
table.t td.over { color: var(--brand); font-weight: 700; }
.click { cursor: pointer; }

/* 막대 */
.bars { display: grid; gap: 12px; }
.bar { display: grid; grid-template-columns: 84px 1fr 104px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar .track { height: 10px; border-radius: 5px; background: var(--bg-3); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 5px; background: var(--brand); }
.bar .fill.alt { background: var(--ink-4); }
.bar .amt { text-align: right; font-variant-numeric: tabular-nums; }
.trend { display: flex; align-items: flex-end; gap: 10px; height: 120px; padding-top: 8px; }
.trend .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend .stick { width: 100%; max-width: 36px; border-radius: 6px 6px 2px 2px; background: var(--line-2); }
.trend .col.cur .stick { background: var(--brand); }
.trend .col span { font-size: 11.5px; color: var(--ink-4); }

/* 목록(사용자 기록) */
.day { margin-top: 22px; }
.day-h { font-size: 13px; font-weight: 700; color: var(--ink-3); margin: 0 0 8px 2px; }
.item { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.item + .item { margin-top: 8px; }
.item .main { flex: 1; min-width: 0; }
.item .t1 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.item .t2 { font-size: 13.5px; color: var(--ink-3); margin-top: 3px; }
.item .amt { text-align: right; font-weight: 700; white-space: nowrap; }
.item .amt small { display: block; font-weight: 500; font-size: 12px; color: var(--ink-4); }
.item.bad { border-color: var(--brand-light-2); background: var(--brand-light); }
.item.click:hover { border-color: var(--line-2); }

/* 업로드 */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 36px 20px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--bg-2); text-align: center; cursor: pointer; transition: all .15s; }
.drop:hover, .drop.on { border-color: var(--brand); background: var(--brand-light); }
.drop b { font-size: 15px; }
.stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat > div { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--bg-2); }
.stat .l { font-size: 12.5px; color: var(--ink-3); }
.stat .v { font-size: 18px; font-weight: 700; margin-top: 2px; }

/* 탭 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { position: relative; height: 44px; padding: 0 14px; border: 0; background: none; color: var(--ink-3); font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--ink); }
.tabs button.on::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--ink); border-radius: 2px; }

/* 대화상자 */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(20, 20, 20, .36); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow: auto; background: var(--bg); border-radius: 18px; padding: 26px; box-shadow: 0 24px 64px rgba(0, 0, 0, .2); }
.modal h2 { margin-bottom: 18px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

#toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px); z-index: 60; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--brand); }

/* 로그인 */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, var(--brand-light) 0%, var(--bg) 46%); }
.auth .box { width: 100%; max-width: 400px; }
.auth .logo { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 28px; text-align: center; }
.auth .logo img { width: 52px; }
.auth .logo h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.04em; }
.auth .logo p { margin: 0; color: var(--ink-3); font-size: 14px; }
.auth .switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--ink-3); }
.auth .switch button { border: 0; background: none; color: var(--brand); font-weight: 600; cursor: pointer; }
.foot-note { text-align: center; color: var(--ink-4); font-size: 12px; margin-top: 28px; }

/* 확인 요청 */
.pair { display: grid; grid-template-columns: 1fr 24px 1fr; gap: 10px; align-items: center; }
.pair .side { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-2); font-size: 13.5px; }
.pair .side b { display: block; font-size: 14px; }
.pair .arrow { text-align: center; color: var(--ink-4); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }

/* ── 휴대폰 ── */
.me-link { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 20px; text-decoration: none; transition: background .15s; }
.me-link:hover, .me-link.on { background: var(--bg-3); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-light); color: var(--brand); font-weight: 700; font-size: 13px; display: grid; place-items: center; flex: none; }
.me-name { font-weight: 600; color: var(--ink); }
.me-team { color: var(--ink-4); font-size: 12px; }
.tabbar { display: none; }
@media (max-width: 1080px) { .me-team { display: none; } .topbar-in { gap: 16px; } }
@media (max-width: 640px) { .me-name { display: none; } .me-link { padding: 2px; } }
.grid > * { min-width: 0; }
@media (max-width: 860px) {
  .grid.k4 { grid-template-columns: repeat(2, 1fr); }
  .grid.c2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .topbar-in { height: auto; min-height: 56px; padding: 8px 16px; gap: 0 12px; flex-wrap: wrap; }
  .topbar .nav.user-nav { display: none; }
  .topbar .nav { order: 3; width: calc(100% + 32px); margin: 4px -16px -8px; padding: 0 8px; height: 44px; border-top: 1px solid var(--line); }
  .nav a { padding: 0 10px; font-size: 14px; }
  .nav a.on::after { left: 10px; right: 10px; }
  .nav .sep { margin: 12px 4px; }
  .who { gap: 4px; }
  .who .name { display: none; }
  .page-head { margin-bottom: 18px; }
  .page-head > .row { width: 100%; }
  .kpi { padding: 16px; }
  .kpi .l { font-size: 12.5px; }
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 18px 18px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 92vh; }

  /* 표 → 한 줄씩 카드 */
  .table-wrap { border: 0; overflow: visible; }
  table.t.stack thead { display: none; }
  table.t.stack, table.t.stack tbody, table.t.stack tfoot { display: block; }
  table.t.stack tr { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--bg); }
  table.t.stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 3px 0; border: 0; text-align: right; min-height: 26px; }
  table.t.stack td::before { content: attr(data-label); flex: none; color: var(--ink-4); font-size: 12px; font-weight: 500; text-align: left; }
  table.t.stack td[data-label=""]::before { display: none; }
  table.t.stack td:empty, table.t.stack td.blank { display: none; }
  table.t.stack tbody td:first-child { justify-content: flex-start; gap: 8px; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-weight: 600; text-align: left; }
  table.t.stack tbody td:first-child::before { display: none; }
  table.t.stack tbody td:first-child > div { margin: 0; }
  table.t.stack tfoot tr { background: var(--bg-2); }
  table.t.stack tfoot td { background: none; border: 0; }
  table.t.stack tr.over { border-color: var(--brand-light-2); }
  table.t.stack tbody tr:hover td { background: none; }
  main { padding: 20px 16px 110px; }
  .page-head h1 { font-size: 22px; }
  .card { padding: 18px; }
  .kpi .v { font-size: 21px; }
  .bar { grid-template-columns: 70px 1fr 88px; }
  .pair { grid-template-columns: 1fr; }
  .pair .arrow { transform: rotate(90deg); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; text-decoration: none; font-size: 11.5px; color: var(--ink-4); font-weight: 500; position: relative; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--brand); font-weight: 700; }
  .tabbar .badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
}

/* OTP (11-26) */
.otp-code { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.otp-steps { margin: 0 0 16px; padding-left: 20px; line-height: 1.7; }
.otp-steps li { margin-bottom: 10px; }
.otp-key { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; padding: 12px 14px; border-radius: 12px; background: var(--brand-light); border: 1px solid var(--brand-light-2); }
.otp-key span { flex: 1; min-width: 0; font-size: 17px; font-weight: 700; letter-spacing: .06em; word-break: keep-all; overflow-wrap: anywhere; }
.otp-key.small span { font-size: 14px; font-weight: 600; letter-spacing: 0; }
