/* 지픽 앱. 목업(mockup/index.html) 장부형 디자인을 그대로 옮김. Layout: 장부(ledger). 위 글자 탭 + 큰 숫자 제목 + 가는 줄 표, 상세는 세로 줄 하나로 나뉜 오른쪽 칸.
   선점은 형광펜, 수신거부는 빨간 펜 줄. 의도적으로 밝은 종이 테마 하나만 쓴다. */
:root {
  --paper: #ffffff;
  --ink: #111521;
  --muted: #687083;
  --faint: #a3a9b6;
  --rule: #e3e6ec;
  --tint: #f6f7f9;
  --cobalt: #174eca;
  --marker: #d8f34a;
  --pen: #d92d20;
  --done: #13a35a;
  --quote: #d98e04;
  --idle: #b8bec9;
  --font-ko: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-num: "Archivo", "Noto Sans KR", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-ko); font-size: 15px; line-height: 1.55; letter-spacing: -0.01em; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: 0; }

/* 상단 */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--paper); border-bottom: 1px solid var(--rule); display: flex; align-items: stretch; gap: 40px; padding-inline: 32px; }
.mark { font-family: var(--font-num); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; display: flex; align-items: center; }
.tabs { min-width: 0; display: flex; align-items: stretch; overflow-x: auto; scrollbar-width: none; }
.tabs button { position: relative; padding: 20px 22px; color: var(--ink); white-space: nowrap; }
.tabs button + button::before { content: ""; position: absolute; left: 0; top: 50%; height: 16px; margin-top: -8px; width: 1px; background: var(--rule); }
.tabs button[aria-current="page"] { color: var(--cobalt); font-weight: 700; }
.tabs button[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; background: var(--cobalt); }
.who-am-i { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.who-am-i b { color: var(--ink); font-weight: 500; }
.note { padding: 8px 32px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--rule); }

/* 화면 틀 */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr); min-height: calc(100vh - 100px); }
.split.wide { grid-template-columns: minmax(0, 1fr) minmax(300px, 0.3fr); }
.pane { padding: 40px 32px 64px; min-width: 0; }
.pane + .pane { border-left: 1px solid var(--rule); }
.pane.side { position: sticky; top: 64px; align-self: start; max-height: calc(100vh - 64px); overflow-y: auto; }
.single { padding: 40px 32px 64px; }

/* 큰 숫자 제목 */
.figure { display: flex; align-items: flex-end; gap: 22px; margin-bottom: 32px; flex-wrap: wrap; }
.figure .big { font-family: var(--font-num); font-weight: 800; font-size: clamp(64px, 9vw, 112px); line-height: .82; letter-spacing: -0.04em; }
.figure .cap { min-width: 0; flex: 1 1 220px; }
.figure .cap b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -0.03em; }
.figure .cap span { color: var(--muted); font-size: 14px; }
.figure .act { margin-left: auto; }
.figure .acts { display: flex; gap: 28px; align-items: baseline; flex-wrap: wrap; }
.imp-map { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
@media (max-width: 520px) { .imp-map { grid-template-columns: 1fr; } }
h2 { font-size: 28px; font-weight: 900; letter-spacing: -0.03em; margin: 0 0 24px; }

/* 텍스트 동작: 밑줄 링크 */
.link { color: var(--cobalt); font-weight: 700; border-bottom: 2px solid transparent; padding-bottom: 3px; white-space: nowrap; transition: border-color .15s; }
.link:hover, .link.primary { border-bottom-color: currentColor; }
.link.arrow { border-bottom: 0; }
.link.arrow::after { content: " →"; transition: margin .15s; }
.link.arrow:hover::after { margin-left: 4px; }
.link[disabled] { color: var(--faint); cursor: not-allowed; }

/* 장부 표 */
.ledger-wrap { overflow-x: auto; }
.ledger { width: 100%; border-collapse: collapse; }
.ledger { border-top: 2px solid var(--ink); }
.ledger th { text-align: left; font-weight: 500; font-size: 13px; letter-spacing: 0.06em; color: var(--muted); padding: 14px 16px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.ledger td { padding: 18px 16px; border-bottom: 1px solid #eef0f3; vertical-align: baseline; white-space: nowrap; }
.ledger td:first-child, .ledger th:first-child { padding-left: 4px; }
.ledger td:last-child, .ledger th:last-child { padding-right: 4px; }
.ledger-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; padding: 14px 4px 0; color: var(--muted); font-size: 13px; }
.ledger td.wrap { white-space: normal; }
.ledger tbody tr { cursor: pointer; }
.ledger tbody tr:hover td { background: var(--tint); }
.ledger tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--cobalt); padding-left: 16px; }
.ledger tr.locked td { color: var(--faint); }
.ledger .r { text-align: right; }
.firm { font-weight: 700; }
.sub { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.aside-meta { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 10px; }
.time { font-family: var(--font-num); font-weight: 700; font-size: 34px; line-height: 1; letter-spacing: -0.02em; }
.dday { font-family: var(--font-num); font-weight: 700; font-size: 20px; }

/* 상태: 작은 네모 + 글자 */
.st { display: inline-flex; align-items: center; gap: 8px; }
.st::before { content: ""; width: 11px; height: 11px; background: var(--idle); flex: none; }
.st.관심::before { background: var(--cobalt); }
.st.견적::before { background: var(--quote); }
.st.계약::before { background: var(--done); }
.st.거절::before { background: var(--ink); }
.st.수신거부::before { background: var(--pen); }
.warn { color: var(--pen); font-weight: 500; }
.lock { display: inline-block; width: 11px; height: 12px; margin-right: 8px; vertical-align: -1px; position: relative; }
.lock::before { content: ""; position: absolute; left: 2px; top: 0; width: 7px; height: 7px; border: 1.6px solid currentColor; border-bottom: 0; border-radius: 4px 4px 0 0; }
.lock::after { content: ""; position: absolute; left: 0; bottom: 0; width: 11px; height: 7px; background: currentColor; }

/* 형광펜과 빨간 펜 */
.hl { position: relative; isolation: isolate; display: inline; }
.hl::before { content: ""; position: absolute; z-index: -1; left: -0.18em; right: -0.22em; top: 46%; bottom: -0.06em; background: var(--marker); transform: rotate(-0.8deg); border-radius: 1px 3px 2px 4px; }
.strike { position: relative; display: inline-block; }
.strike::after { content: ""; position: absolute; left: -4px; right: -6px; top: 55%; height: 1.5px; background: var(--pen); transform: rotate(-1.2deg); }

/* 상세 */
.title-xl { font-size: clamp(30px, 3.4vw, 46px); font-weight: 900; letter-spacing: -0.04em; line-height: 1.15; margin: 0 0 14px; }
.claim-line { font-size: 19px; font-weight: 500; margin: 0 0 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 32px; padding-bottom: 28px; border-bottom: 1px solid var(--rule); margin-bottom: 24px; }
.facts { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px 20px; margin: 0 0 28px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.script { border-left: 4px solid var(--cobalt); padding: 4px 0 4px 20px; margin: 0 0 36px; }
.script small { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.h3 { font-size: 22px; font-weight: 900; letter-spacing: -0.03em; margin: 0 0 16px; }
.numbered { list-style: none; margin: 0 0 36px; padding: 0; }
.numbered li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.numbered li > span:first-child:empty { display: none; }
.numbered li:has(> span:first-child:empty) { grid-template-columns: minmax(0, 1fr); }
.numbered li > span:first-child { font-family: var(--font-num); font-weight: 700; }
.numbered .meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.numbered p { margin: 0; overflow-wrap: anywhere; }
.comment { padding: 0 0 18px; }
.comment .meta { color: var(--muted); font-size: 13px; }
.comment .meta b { color: var(--ink); font-weight: 500; margin-right: 10px; }
.comment p { margin: 4px 0 0; overflow-wrap: anywhere; }
.mention { color: var(--cobalt); font-weight: 500; }
.reply { display: flex; gap: 16px; align-items: center; border-bottom: 1.5px solid var(--ink); padding: 10px 0; }
.reply input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 4px 0; }
.hint { color: var(--muted); font-size: 13px; }

/* 필터·검색 줄 */
.filters { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: center; margin-bottom: 20px; }
.search { flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--faint); padding: 8px 0; }
.search:focus-within { border-bottom-color: var(--ink); }
.search i { width: 14px; height: 14px; border: 1.8px solid var(--muted); border-radius: 50%; position: relative; flex: none; }
.search i::after { content: ""; position: absolute; width: 6px; height: 1.8px; background: var(--muted); right: -5px; bottom: -2px; transform: rotate(45deg); }
.filters input { border: 0; padding: 0; min-width: 0; flex: 1; outline: 0; background: none; }
.filters button { color: var(--muted); padding: 4px 0; }
.filters button[aria-pressed="true"] { color: var(--ink); font-weight: 700; box-shadow: inset 0 -2px 0 var(--cobalt); }

/* 팀 오늘 */
.team li { grid-template-columns: 28px minmax(0, 1fr) 72px 1px 56px; align-items: center; }
.team .name { font-size: 18px; font-weight: 700; }
.team .n { text-align: center; }
.team .n b { display: block; font-family: var(--font-num); font-weight: 700; font-size: 30px; line-height: 1; }
.team .n small { color: var(--muted); font-size: 12px; }
.team .bar { width: 1px; height: 36px; background: var(--rule); }
.team .track { grid-column: 2 / -1; height: 3px; background: #eef0f3; margin-top: 10px; }
.team .track i { display: block; height: 100%; background: var(--cobalt); }

/* 관리 */
.setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 24px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.setting b { font-weight: 700; }
.setting span { grid-column: 1; color: var(--muted); font-size: 13px; }
.setting .acts { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 20px; color: inherit; font-size: inherit; }
.setting .sw { grid-row: 1 / span 2; grid-column: 2; }
.sw { appearance: none; width: 46px; height: 24px; border: 1.5px solid var(--ink); background: var(--paper); position: relative; cursor: pointer; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; background: var(--ink); transition: left .15s; }
.sw:checked { background: var(--cobalt); border-color: var(--cobalt); }
.sw:checked::after { left: 24px; background: var(--paper); }
.sw:disabled { opacity: .55; cursor: not-allowed; }

/* 업체 등록 시트 */
.sheet-bg { position: fixed; inset: 0; background: rgba(17, 21, 33, .28); z-index: 10; }
.sheet { position: fixed; z-index: 11; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--paper); border-left: 1px solid var(--ink); padding: calc(36px + env(safe-area-inset-top, 0px)) 32px calc(32px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; display: flex; flex-direction: column; gap: 22px; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; }
.sheet h3 { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: -0.03em; }
.field label { display: block; color: var(--muted); font-size: 13px; }
.field input { width: 100%; border: 0; border-bottom: 1.5px solid var(--ink); padding: 8px 0; outline: 0; background: none; font-size: 18px; }
.field input:focus { border-bottom-color: var(--cobalt); }
.verdict { border-left: 4px solid var(--idle); padding: 6px 0 6px 18px; }
.verdict b { display: block; font-size: 17px; }
.verdict span { color: var(--muted); }
.verdict.no { border-color: var(--pen); }
.verdict.no b { color: var(--pen); }
.verdict.dup { border-color: var(--quote); }
.verdict.ok { border-color: var(--done); }
.sheet-foot { display: flex; justify-content: flex-end; gap: 28px; align-items: center; margin-top: auto; padding-top: 12px; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px; font-size: 14px; max-width: calc(100% - 32px); }

@media (max-width: 1000px) {
  .split, .split.wide { grid-template-columns: minmax(0, 1fr); }
  .pane + .pane { border-left: 0; border-top: 1px solid var(--rule); }
  .pane.side { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .top { gap: 16px; padding-inline: 16px; }
  .who-am-i { display: none; }
  .tabs button { padding: 18px 14px; }
  .note, .pane, .single { padding-inline: 16px; }
  .sheet { padding-inline: 16px; }
  .facts { grid-template-columns: 80px minmax(0, 1fr); }
  .figure .act { margin-left: 0; }
}
@media (max-width: 640px) {
  .ledger thead { display: none; }
  .ledger, .ledger tbody, .ledger tr, .ledger td { display: block; width: 100%; }
  .ledger tr { padding: 14px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .ledger td { padding: 0; border: 0; white-space: normal; }
  .ledger td:first-child { grid-column: 1; }
  .ledger td.r { grid-column: 2; grid-row: 1; text-align: right; }
  .ledger td:not(:first-child):not(.r) { grid-column: 1 / -1; font-size: 14px; }
  .ledger tbody tr:hover td, .ledger tbody tr[aria-selected="true"] td { background: none; }
  .ledger tbody tr[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--cobalt); padding-left: 12px; }
  .time { font-size: 28px; }
  .filters input { flex-basis: 100%; }
  .figure .big { font-size: 64px; }
  .team li { grid-template-columns: 22px minmax(0, 1fr) 56px 1px 48px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ───── 앱 추가 ───── */
[hidden] { display: none !important; }
.boot { padding: 40px 32px; color: var(--muted); }

/* 로그인·가입: 왼쪽 큰 글자, 오른쪽 입력 */
.gate { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); min-height: 100vh; }
.gate-side { padding: 48px 48px 64px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--rule); }
.mark img { display: block; height: 26px; width: auto; }
.gate-side .mark img { height: 36px; }
.gate-side h1 { font-size: clamp(40px, 6vw, 84px); font-weight: 900; letter-spacing: -0.05em; line-height: 1.02; margin: 0; }
.gate-side p { color: var(--muted); margin: 18px 0 0; max-width: 34em; }
.gate-form { padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.gate-form h2 { margin: 0; }
.gate-form .link { align-self: flex-start; }
.err { color: var(--pen); font-size: 14px; min-height: 1.4em; margin: 0; }
.okmsg { color: var(--done); font-size: 14px; margin: 0; }

/* 입력 */
.field select, .field textarea { width: 100%; border: 0; border-bottom: 1.5px solid var(--ink); padding: 8px 0; outline: 0; background: none; font-size: 17px; border-radius: 0; }
.field textarea { resize: vertical; min-height: 84px; font-size: 15px; }
.field select:focus, .field textarea:focus { border-bottom-color: var(--cobalt); }
.field small { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
.choices { display: flex; flex-wrap: wrap; gap: 10px 22px; padding-top: 10px; }
.choices label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.choices input { accent-color: var(--cobalt); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.link.danger { color: var(--pen); }
.link:disabled { color: var(--faint); cursor: not-allowed; }
.tel { font-family: var(--font-num); font-weight: 700; font-size: 22px; color: var(--ink); }
.tel a { color: inherit; text-decoration: none; border-bottom: 2px solid var(--marker); }
.copybox { display: flex; gap: 12px; align-items: center; border: 1px solid var(--rule); padding: 10px 12px; background: var(--tint); font-family: var(--font-num); font-size: 13px; word-break: break-all; }
.copybox span { flex: 1; min-width: 0; }
.qr { width: 180px; height: 180px; border: 1px solid var(--rule); }
.qr img { width: 100%; height: 100%; display: block; }
.mini { font-size: 13px; color: var(--muted); }
.roles select { border: 0; border-bottom: 1px solid var(--faint); background: none; padding: 2px 0; }

@media (max-width: 800px) {
  .gate { grid-template-columns: minmax(0, 1fr); }
  .gate-side { border-right: 0; border-bottom: 1px solid var(--rule); padding: 32px 16px; gap: 28px; }
  .gate-form { padding: 32px 16px 48px; justify-content: flex-start; }
  .row2 { grid-template-columns: 1fr; }
}
