:root {
  --bg: #f6f5f2; --card: #ffffff; --line: rgba(0, 0, 0, .09); --line-strong: rgba(0, 0, 0, .18);
  --text: #1f1e1c; --muted: #6b6a66; --accent: #1f5fbf; --on-accent: #fff;
  --new-bg: #e6f0fb; --new-tx: #0c447c; --due-bg: #faeeda; --due-tx: #633806; --ok-bg: #eaf3de; --ok-tx: #27500a;
  --bad-bg: #fcebeb; --bad-tx: #791f1f; --neu-bg: #f1efe8; --neu-tx: #444441;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615; --card: #201f1e; --line: rgba(255, 255, 255, .1); --line-strong: rgba(255, 255, 255, .22);
    --text: #f1efe8; --muted: #a8a69f; --accent: #5b9be6; --on-accent: #0b0b0b;
    --new-bg: #0c2a4d; --new-tx: #b5d4f4; --due-bg: #412402; --due-tx: #fac775; --ok-bg: #173404; --ok-tx: #c0dd97;
    --bad-bg: #501313; --bad-tx: #f7c1c1; --neu-bg: #2c2c2a; --neu-tx: #d3d1c7;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif; }
.wrap { max-width: 640px; margin: 0 auto; padding: 14px 16px 64px; }
h1 { font-size: 20px; font-weight: 600; margin: 0; }
.muted, .sub, .help { color: var(--muted); font-size: 13px; }
button, .btn { font: inherit; font-size: 14px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
button.primary, .btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; font-size: 13px; }
input, textarea { font: inherit; width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 10px; background: var(--card); color: var(--text); }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tabs { display: flex; background: var(--neu-bg); border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.tabs a { flex: 1; text-align: center; padding: 7px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; }
.tabs a.on { background: var(--card); color: var(--text); font-weight: 600; }
.banner { border-radius: 8px; padding: 9px 12px; font-size: 13px; margin: 8px 0; display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.banner.ok { background: var(--ok-bg); color: var(--ok-tx); } .banner.bad { background: var(--bad-bg); color: var(--bad-tx); }
.banner.neutral { background: var(--neu-bg); color: var(--neu-tx); }
.next { display: block; border: 2px solid var(--accent); border-radius: 12px; padding: 10px 12px; margin: 8px 0 12px; color: inherit; text-decoration: none; }
.next.none { border: 0; background: var(--neu-bg); color: var(--muted); font-size: 13px; }
.next-label { font-size: 12px; color: var(--accent); } .next .btn { white-space: nowrap; flex: none; } .next-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 4px; }
.leads { list-style: none; margin: 0; padding: 0; }
.lead { border-top: 1px solid var(--line); }
.lead.open { border: 2px solid var(--accent); border-radius: 12px; margin: 6px 0; background: var(--card); }
.pin-label { font-size: 11px; color: var(--accent); padding: 8px 12px 0; }
.swipe { position: relative; overflow: hidden; }
.swipe-actions { position: absolute; inset: 0 0 0 auto; display: flex; }
.swipe-actions button { border: 0; border-radius: 0; width: 64px; font-size: 13px; }
.swipe-actions .act-call { background: var(--accent); color: var(--on-accent); } .swipe-actions .act-sms { background: var(--neu-bg); }
.swipe-body { position: relative; background: var(--bg); transition: transform .18s ease; touch-action: pan-y; }
.lead.open .swipe-body { background: var(--card); } .lead.open .swipe-actions { display: none; }
.row-main { display: flex; align-items: center; gap: 8px; padding: 11px 4px; cursor: pointer; }
.lead.open .row-main { padding: 11px 12px 4px; }
.row-text { flex: 1; min-width: 0; }
.row-title { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.name { font-weight: 600; font-size: 15px; }
.row-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead.open .row-sub { display: none; }
.chev::after { content: "›"; color: var(--muted); font-size: 18px; display: inline-block; transform: rotate(90deg); }
.lead.open .chev::after { transform: rotate(-90deg); }
.pill { font-size: 11px; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.t-new { background: var(--new-bg); color: var(--new-tx); } .t-due { background: var(--due-bg); color: var(--due-tx); }
.t-ok { background: var(--ok-bg); color: var(--ok-tx); } .t-bad { background: var(--bad-bg); color: var(--bad-tx); }
.t-neu { background: var(--neu-bg); color: var(--neu-tx); }
.detail { display: none; padding: 0 12px 12px; }
.lead.open .detail { display: block; }
.facts { display: grid; gap: 4px; font-size: 13px; justify-items: start; }
.facts .note { justify-self: stretch; }
.note { font-size: 12.5px; padding: 6px 8px; border-radius: 8px; } .note.due { background: var(--due-bg); color: var(--due-tx); } .note.bad { background: var(--bad-bg); color: var(--bad-tx); }
.phone-row { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; }
.phone { flex: 1; font-size: 16px; font-variant-numeric: tabular-nums; }
.label { font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; font-size: 13px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); cursor: pointer; }
.chip input:checked + span { background: var(--new-bg); color: var(--new-tx); border-color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { margin-top: 8px; resize: vertical; }
.just-called { font-size: 12.5px; background: var(--new-bg); color: var(--new-tx); border-radius: 8px; padding: 6px 8px; margin-top: 10px; }
.memo-last { margin-top: 10px; font-size: 13px; } .memo-last p { margin: 2px 0 6px; white-space: pre-wrap; }
.memo-dms { display: flex; gap: 10px; align-items: center; }
.actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 10px; }
.actions.end { justify-content: flex-end; }
.check { display: flex; gap: 6px; align-items: center; font-size: 14px; } .check input { width: auto; }
.err { color: var(--bad-tx); font-size: 13px; }
.more { margin-top: 10px; font-size: 13px; } .more summary { color: var(--muted); cursor: pointer; text-align: center; }
.survey { display: grid; gap: 6px; margin: 8px 0; } .survey dt { color: var(--muted); font-size: 12px; } .survey dd { margin: 0; }
.memo-all p { white-space: pre-wrap; margin: 2px 0 10px; }
.folded { margin-top: 14px; background: var(--neu-bg); border-radius: 12px; padding: 10px 12px; }
.folded > summary { cursor: pointer; display: grid; gap: 2px; } .folded .lead { border-color: var(--line-strong); }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }
.login { display: grid; gap: 10px; margin-top: 18px; } .login .link { font-size: 13px; color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 13px; }
@media (hover: hover) and (pointer: fine) {
  .lead:not(.open) .swipe-actions { display: none; }
  .lead:not(.open):hover .swipe-actions { display: flex; }
  .lead:not(.open):hover .swipe-body { transform: translateX(-128px); }
}
