:root{
  --bg:#f5f7f4; --surface:#ffffff; --ink:#18241c; --muted:#5d6b61; --line:#d9e0da;
  --green:#1f6b45; --green-soft:#e3f0e8; --amber:#a35a00; --amber-soft:#fbefdc; --red:#b42318; --red-soft:#fbe5e3;
  --on-green:#ffffff;
  --body:"Noto Sans KR","Malgun Gothic","Apple SD Gothic Neo",sans-serif;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --bg:#121815; --surface:#1a221d; --ink:#e6ece7; --muted:#9fb0a4; --line:#2c3830;
  --green:#5cc28d; --green-soft:#1d3327; --amber:#f0a94b; --amber-soft:#3a2a14; --red:#f2857a; --red-soft:#3d1f1c;
  --on-green:#0d1a12; color-scheme:dark }}
*{box-sizing:border-box}
body{background:var(--bg);color:var(--ink);font-family:var(--body);font-size:16px;line-height:1.6;margin:0}
h1,h2,h3,p{margin:0}
button,input,textarea{font:inherit;color:inherit}
:focus-visible{outline:3px solid var(--green);outline-offset:2px}
/* 넓은 화면: 왼쪽 고객 목록, 오른쪽 프로필. 폰: 목록 → 프로필로 넘어간다. */
.app{display:grid;grid-template-columns:minmax(300px,360px) minmax(0,1fr);gap:24px;max-width:1180px;margin:0 auto;padding:16px max(16px,env(safe-area-inset-right,0px)) 64px max(16px,env(safe-area-inset-left,0px));align-items:start}
.side{display:grid;gap:12px;min-width:0;position:sticky;top:16px;max-height:calc(100vh - 32px);grid-template-rows:auto auto auto auto minmax(0,1fr)}
.side .list{overflow:auto;align-content:start;padding-right:2px}
.main{min-width:0}
.back{display:none}
@media (max-width:860px){
  .app{grid-template-columns:minmax(0,1fr);padding-bottom:96px}
  .app.focus .side{display:none}
  .app:not(.focus) .main{display:none}
  .side{position:static;max-height:none;grid-template-rows:none}
  .side .list{overflow:visible}
  .back{display:inline-block}
  .phone{grid-template-columns:minmax(0,1fr)}
  .phone [data-act=copy]{display:none}
  /* 폰: 오른쪽 아래 작은 고객 등록 버튼 */
  .primary.add{position:fixed;right:max(16px,env(safe-area-inset-right,0px));bottom:max(20px,env(safe-area-inset-bottom,0px));width:auto;min-height:0;border-radius:999px;padding:9px 16px;font-size:.92rem;box-shadow:0 2px 8px rgba(0,0,0,.25);z-index:5}
}
.wrap{display:grid;gap:12px;min-width:0}
.row[aria-current="true"]{border-color:var(--green);box-shadow:inset 3px 0 0 var(--green)}
.row:hover,.ghost:hover{border-color:var(--green)}
.phone{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}
.facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px;margin:0}
.facts dt{font-size:.82rem;color:var(--muted)}
.facts dd{margin:0;font-weight:700}
.msg:empty{display:none}
.top{display:flex;gap:8px;align-items:center;justify-content:space-between;min-height:44px}
.top h1{font-size:1.2rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.top .acts{display:flex;gap:6px;flex:none}
.ghost{cursor:pointer;border:1px solid var(--line);background:var(--surface);border-radius:8px;padding:8px 12px;min-height:40px}
.primary{cursor:pointer;border:0;background:var(--green);color:var(--on-green);border-radius:8px;padding:12px 16px;font-weight:700;min-height:46px;width:100%}
.danger{color:var(--red)}
.call{display:block;text-align:center;text-decoration:none;background:var(--green);color:var(--on-green);border-radius:10px;padding:14px;font-size:1.2rem;font-weight:700}
.tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:4px}
.tabs button{cursor:pointer;border:0;background:none;border-radius:9px;padding:7px 2px;color:var(--muted)}
.tabs button[aria-pressed="true"]{background:var(--green);color:var(--on-green);font-weight:700}
.inp{padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:var(--surface);width:100%;font-size:1rem}
textarea.inp{min-height:88px;resize:vertical}
label.f{display:grid;gap:4px;font-size:.88rem;color:var(--muted)}
.chk{display:flex;gap:8px;align-items:flex-start;font-size:.95rem}
.chk input{width:20px;height:20px;margin-top:3px;flex:none}
.card{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:16px;display:grid;gap:12px;min-width:0}
.card h2{font-size:1rem}
.list{display:grid;gap:6px}
.row{cursor:pointer;text-align:left;border:1px solid var(--line);background:var(--surface);border-radius:9px;padding:10px 12px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 10px;width:100%;align-items:center}
.row .nm{font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.row .meta{font-size:.82rem;color:var(--muted);grid-column:1}
.row .due{grid-row:1/3;grid-column:2;font-size:.82rem;color:var(--muted)}
.late{color:var(--red);font-weight:700}
.today{color:var(--green);font-weight:700}
.muted{color:var(--muted);font-size:.9rem}
.empty{color:var(--muted);font-size:.95rem;padding:20px;border:1px dashed var(--line);border-radius:9px;text-align:center}
.pill{display:inline-block;border-radius:999px;padding:0 8px;font-size:.78rem;font-weight:700;background:var(--amber-soft);color:var(--amber)}
.pill.no{background:var(--red-soft);color:var(--red)}
.results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.results button{cursor:pointer;border:1px solid var(--line);background:var(--surface);border-radius:8px;padding:10px 4px;min-height:46px}
.results button[aria-pressed="true"]{border-color:var(--green);background:var(--green-soft);font-weight:700}
.levels{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;color:var(--ink)}
.levels button{cursor:pointer;border:1px solid var(--line);background:var(--surface);border-radius:8px;padding:8px 2px;display:grid;justify-items:center;gap:0;min-height:54px}
.levels b{font-weight:500;white-space:nowrap}
.levels small{font-size:.76rem;color:var(--muted)}
.levels button[aria-pressed="true"]{border-color:var(--green);background:var(--green-soft)}
.levels button[aria-pressed="true"] b{font-weight:700}
.script{white-space:pre-wrap;word-break:break-word;font-size:1.05rem;line-height:1.75}
.hist{display:grid;gap:8px;margin:0;padding:0;list-style:none}
.hist li{border-top:1px solid var(--line);padding-top:8px;word-break:break-word}
.hist b{font-weight:700;white-space:nowrap}
.hist .hm{display:block;white-space:pre-wrap}
.hist li[hidden]{display:none !important}
.hist.recent li{border-top:0;padding-top:0;color:var(--ink);font-size:1rem}
/* 컴퓨터는 메모를 옆에, 폰은 아래에 */
@media (min-width:861px){
  .hist li{display:grid;grid-template-columns:150px minmax(0,1fr);gap:12px}
}
.msg{font-weight:700;color:var(--green)}
.msg.err{color:var(--red)}
.note{background:var(--amber-soft);border-radius:8px;padding:10px 12px;font-size:.9rem}
.btns{display:flex;flex-wrap:wrap;gap:8px}
