/* y 메모 — 남색·화이트 톤 (y-case / y-timeline과 같은 계열) */
:root{
  --navy:#0A3668;
  --navy-2:#124A85;
  --ink:#16233A;
  --muted:#66788F;
  --bg:#EEF1F6;
  --card:#FFFFFF;
  --line:#E2E8F1;
  --soft:#F6F8FC;
  --blue:#2563EB;
  --ok:#0F766E;
  --danger:#B42318;
  --r:14px;
  --shadow:0 1px 2px rgba(16,32,56,.06), 0 6px 18px rgba(16,32,56,.05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", "Noto Sans Mono CJK KR", monospace;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg);
  color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo","Noto Sans KR","Malgun Gothic",system-ui,"Segoe UI",sans-serif;
  -webkit-text-size-adjust:100%;
  -webkit-font-smoothing:antialiased;
  font-size:16px;
}
body.noscroll{overflow:hidden}
[hidden]{display:none!important}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent}
button[disabled]{opacity:.45;cursor:default}
h1,h2,h3,p{margin:0}
a{color:var(--navy)}

/* ---------- 최상단 앱 바로가기 ---------- */
.topfix{position:sticky;top:0;z-index:40}
.appbar{
  display:flex;align-items:center;
  padding:calc(7px + env(safe-area-inset-top)) 10px 7px;
  background:var(--navy);
  overflow-x:auto;overflow-y:hidden;
  scrollbar-width:none;
  -webkit-overflow-scrolling:touch;
}
.abar-in{display:flex;align-items:center;gap:7px;margin:0 auto;padding:0 1px}
.appbar::-webkit-scrollbar{display:none}
.achip{
  flex:0 0 auto;
  display:inline-flex;align-items:center;gap:6px;
  padding:5px 10px 5px 6px;
  border-radius:999px;
  background:rgba(255,255,255,.13);
  border:1px solid rgba(255,255,255,.16);
  color:#fff;text-decoration:none;
  font-size:12.5px;font-weight:700;letter-spacing:-.01em;
  min-height:34px;
  transition:background .12s;
}
.achip .ab{
  width:22px;height:22px;border-radius:7px;
  display:grid;place-items:center;
  background:#fff;color:var(--navy);
  font-size:10.5px;font-weight:800;letter-spacing:-.02em;
}
.achip.on{background:#fff;border-color:#fff;color:var(--navy)}
.achip.on .ab{background:var(--navy);color:#fff}
@media (hover:hover){
  .achip:hover{background:rgba(255,255,255,.24)}
  .achip.on:hover{background:#fff}
}

/* ---------- 헤더 ---------- */
.hdr{
  padding:9px 14px;
  background:rgba(255,255,255,.97);
  border-bottom:1px solid var(--line);
  backdrop-filter:saturate(140%) blur(8px);
  -webkit-backdrop-filter:saturate(140%) blur(8px);
}
.hdr-in{display:flex;align-items:center;gap:10px;max-width:780px;margin:0 auto;width:100%}
.brand{display:flex;align-items:baseline;gap:7px}
.ylogo{font-size:19px;font-weight:800;color:var(--navy);letter-spacing:-.03em;line-height:1}
.bt{font-size:17px;font-weight:800;letter-spacing:-.03em}
.hdr-r{margin-left:auto;display:flex;align-items:center;gap:7px}
.syncpill{
  display:inline-flex;align-items:center;gap:6px;
  border:1px solid var(--line);background:#fff;border-radius:999px;
  padding:6px 10px;font-size:12px;font-weight:700;color:var(--muted);
  min-height:32px;
}
.syncpill::before{content:"";width:7px;height:7px;border-radius:50%;background:#9AA8BC;flex:0 0 auto}
.syncpill.ok{color:var(--ok);border-color:#CDE9E3;background:#F1FAF8}
.syncpill.ok::before{background:#12A594}
.syncpill.err{color:var(--danger);border-color:#F6D3CE;background:#FEF4F2}
.syncpill.err::before{background:#E05252}
.syncpill.sync{color:#1D4ED8;border-color:#D6E2FA;background:#F3F7FF}
.syncpill.sync::before{background:#2563EB;animation:pulse 1.1s ease-in-out infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.25}}
.iconbtn{
  display:grid;place-items:center;
  width:38px;height:38px;border-radius:11px;
  color:#3A4C66;
  border:1px solid transparent;
}
@media (hover:hover){.iconbtn:hover{background:#F1F4F9;border-color:var(--line)}}

/* ---------- 본문 ---------- */
.wrap{max-width:780px;margin:0 auto;padding:14px 12px 46px}
body.selecting .wrap{padding-bottom:110px}
.toolbar{display:flex;align-items:center;gap:8px;margin:0 2px 10px}
.tcount{font-size:13px;color:var(--muted);font-weight:700;letter-spacing:-.01em}
.tcount b{color:var(--ink);font-weight:800}
.tspacer{flex:1}
.primary{
  background:var(--navy);color:#fff;border:1px solid var(--navy);
  border-radius:11px;padding:9px 14px;font-weight:800;font-size:14px;
  min-height:42px;letter-spacing:-.01em;
  box-shadow:0 1px 2px rgba(10,54,104,.18);
}
.primary:active{transform:translateY(1px)}
.primary[disabled]{opacity:.45;box-shadow:none}
.ghost{
  background:#fff;border:1px solid var(--line);border-radius:11px;
  padding:9px 13px;font-weight:700;font-size:13.5px;min-height:42px;
  color:#2B3B52;
}
@media (hover:hover){.ghost:hover{background:#F7F9FD}}
.danger{background:var(--danger);border:1px solid var(--danger);color:#fff;border-radius:11px;padding:9px 14px;font-weight:800;font-size:14px;min-height:42px}
.danger[disabled]{opacity:.4}
.danger-t{color:var(--danger)}
.danger-t.ghost{border-color:#F0D2CE;background:#FFF7F6}
.chipbtn{
  border:1px solid var(--line);background:#fff;border-radius:999px;
  padding:7px 12px;font-size:13px;font-weight:700;color:#44566F;min-height:36px;
}
.chipbtn.on{background:var(--navy);color:#fff;border-color:var(--navy)}
.sm{padding:7px 11px;min-height:38px;font-size:13px}

/* ---------- 목록 ---------- */
.list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.note{
  display:flex;align-items:flex-start;gap:10px;
  background:var(--card);border:1px solid var(--line);border-radius:var(--r);
  padding:11px 10px 11px 11px;
  box-shadow:var(--shadow);
  transition:background .12s,border-color .12s;
}
.nchk{
  flex:0 0 auto;display:grid;place-items:center;
  width:30px;height:30px;margin-top:0;cursor:pointer;
}
.nchk input{width:21px;height:21px;margin:0;accent-color:var(--navy);cursor:pointer}
.ntitle{
  flex:1 1 auto;min-width:0;text-align:left;
  padding:3px 0;font-size:15px;line-height:1.52;font-weight:700;
  letter-spacing:-.012em;
  white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;
  color:var(--ink);
}
.ntitle:active{opacity:.7}
.ncopy{
  flex:0 0 auto;align-self:flex-start;
  display:inline-flex;align-items:center;gap:4px;
  border:1px solid #D9E3F2;background:#F4F8FF;color:var(--navy);
  border-radius:10px;padding:7px 10px;font-size:12.5px;font-weight:800;
  min-height:36px;margin-top:0;
}
@media (hover:hover){.ncopy:hover{background:#E9F1FF}}

/* 완료(체크) 메모: 취소선 + 연한 회색, 목록 아래쪽 */
.note.done{background:#FAFBFD}
.note.done .ntitle{
  text-decoration:line-through;
  text-decoration-thickness:1.5px;
  text-decoration-color:#9AA8BC;
  color:#8A98AC;
  font-weight:600;
}
.note.done .ncopy{opacity:.75}

/* 완료 구역 구분 */
.donesep{
  display:flex;align-items:center;gap:8px;
  margin:12px 2px 2px;color:var(--muted);
  font-size:11.5px;font-weight:800;letter-spacing:.02em;
}
.donesep::before,.donesep::after{content:"";height:1px;background:#DCE3EE;flex:1}

/* 선택 모드 */
.note.selmode{cursor:pointer}
.note.sel{border-color:#8FB3E8;background:#F3F8FF;box-shadow:0 0 0 2px rgba(37,99,235,.10)}
.selbox{
  flex:0 0 auto;width:24px;height:24px;margin-top:2px;
  border:2px solid #C3CEDD;border-radius:8px;background:#fff;
  display:grid;place-items:center;color:#fff;font-size:13px;font-weight:900;
}
.note.sel .selbox{background:var(--navy);border-color:var(--navy)}
.note.sel .selbox::after{content:"✓"}
body.selecting .ncopy{display:none}
body.selecting .nchk{display:none}

.selbar{
  position:fixed;left:0;right:0;bottom:0;z-index:60;
  display:flex;align-items:center;gap:10px;
  padding:10px 12px calc(10px + env(safe-area-inset-bottom));
  background:rgba(255,255,255,.98);
  border-top:1px solid var(--line);
  box-shadow:0 -6px 24px rgba(10,25,45,.10);
}
.selcnt{margin-left:auto;font-size:13px;font-weight:700;color:var(--muted)}

/* ---------- 빈 상태 ---------- */
.emptycard{
  background:var(--card);border:1px solid var(--line);border-radius:18px;
  padding:22px 18px;box-shadow:var(--shadow);
}
.emptycard .eico{font-size:26px;line-height:1}
.emptycard h2{margin:8px 0 6px;font-size:17.5px;letter-spacing:-.02em}
.emptycard p{font-size:13.5px;line-height:1.65;color:#4A5B73}
.howto{margin:12px 0 0;padding-left:18px;font-size:13px;line-height:1.7;color:#4A5B73}
.howto b{color:var(--ink)}
.emptybtns{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}
.smallcard{
  background:#fff;border:1px dashed #D5DEEA;border-radius:14px;
  padding:16px;text-align:center;color:var(--muted);font-size:13.5px;
}

.footnote{margin:16px 4px 0;text-align:center;font-size:11.5px;line-height:1.6;color:#93A1B5}
.footnote b{color:#7A8CA3}

/* ---------- 모달 ---------- */
.modal{position:fixed;inset:0;z-index:80;display:flex;align-items:flex-end;justify-content:center}
.backdrop{position:absolute;inset:0;background:rgba(10,25,45,.44);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
.sheet{
  position:relative;width:100%;max-width:760px;
  max-height:92dvh;
  display:flex;flex-direction:column;
  background:#fff;border-radius:18px 18px 0 0;
  box-shadow:0 -10px 40px rgba(10,25,45,.28);
  padding-bottom:env(safe-area-inset-bottom);
  animation:sheetup .18s ease-out;
}
@keyframes sheetup{from{transform:translateY(16px);opacity:.55}to{transform:none;opacity:1}}
@media (min-width:761px){
  .modal{align-items:center;padding:24px}
  .sheet{border-radius:18px;max-height:86vh}
}
.sh-hd{
  display:flex;align-items:flex-start;gap:10px;
  padding:14px 12px 10px 16px;border-bottom:1px solid #EEF2F8;
}
.d-title{
  flex:1 1 auto;min-width:0;
  font-size:16.5px;line-height:1.45;font-weight:800;letter-spacing:-.02em;
  white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;
}
.d-title.is-done{text-decoration:line-through;text-decoration-thickness:1.5px;text-decoration-color:#9AA8BC;color:#8A98AC;font-weight:700}
.xbtn{flex:0 0 auto;width:34px;height:34px;border-radius:10px;color:#65758C;font-size:15px}
@media (hover:hover){.xbtn:hover{background:#F1F4F9}}
.d-meta{padding:9px 16px 2px;font-size:11.5px;color:var(--muted);line-height:1.5}
.d-body{flex:1 1 auto;overflow:auto;padding:6px 16px 12px;-webkit-overflow-scrolling:touch}
.notebody{
  margin:0;
  white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;
  font-family:var(--mono);
  font-size:13px;line-height:1.75;
  background:var(--soft);
  border:1px solid #E8EEF7;border-radius:12px;
  padding:13px 14px;
  tab-size:2;
  color:#1C2B44;
}
.sh-ft{
  display:flex;flex-direction:column;gap:8px;
  padding:10px 14px 12px;border-top:1px solid var(--line);background:#fff;
}
.sh-ft .wide{flex:1 1 auto}
.ftrow{display:flex;gap:8px}
.ftrow>*{flex:1 1 0}
@media (min-width:561px){
  .sh-ft{flex-direction:row;align-items:center}
  .ftrow{flex:0 0 auto;min-width:270px}
}

/* 추가·수정 */
.ed-form{flex:1 1 auto;overflow:auto;padding:6px 16px 8px;display:flex;flex-direction:column;min-height:0}
.fl{font-size:12.5px;font-weight:800;color:#41536B;margin:8px 0 6px}
.fhint{font-weight:600;color:#93A1B5;font-size:11.5px;margin-left:4px}
.ed-title,.ed-body{
  width:100%;border:1px solid var(--line);border-radius:11px;
  padding:11px 12px;font:inherit;background:#fff;color:var(--ink);
  line-height:1.55;
}
.ed-title{font-size:16px;font-weight:700;min-height:54px;resize:none;letter-spacing:-.01em}
.ed-body{
  flex:1 1 auto;min-height:230px;max-height:46vh;resize:vertical;
  font-family:var(--mono);font-size:13px;line-height:1.7;background:var(--soft);
}
.ed-title:focus,.ed-body:focus{outline:2px solid #C9DAF5;border-color:#8FB3E8}

/* 설정 */
.setbody{flex:1 1 auto;overflow:auto;padding:12px 14px 18px;display:flex;flex-direction:column;gap:12px;-webkit-overflow-scrolling:touch}
.card2{background:#FBFCFE;border:1px solid var(--line);border-radius:14px;padding:14px}
.card2 h3{margin:0 0 9px;font-size:14px;letter-spacing:-.01em}
.frow{display:flex;flex-direction:column;gap:5px;margin-bottom:10px}
.frow label{font-size:12.5px;font-weight:700;color:#41536B}
.frow input{
  width:100%;border:1px solid var(--line);border-radius:10px;
  padding:11px 12px;font-size:16px;background:#fff;color:var(--ink);min-height:46px;
}
.frow input:focus{outline:2px solid #C9DAF5;border-color:#8FB3E8}
.chkline{display:flex;align-items:center;gap:8px;font-size:13px;color:#34455C;margin:2px 0 12px;cursor:pointer;font-weight:600}
.chkline input{width:19px;height:19px;accent-color:var(--navy);margin:0}
.btnrow{display:flex;gap:8px;flex-wrap:wrap}
.btnrow>*{flex:1 1 130px}
.hint{font-size:11.5px;line-height:1.6;color:var(--muted);margin:9px 0 0}
.hint b{color:#33445C}
.msg{font-size:12.5px;margin-top:9px;line-height:1.5;font-weight:600}
.msg.err{color:var(--danger)}
.msg.ok{color:var(--ok)}
.acctline{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.acctwho{font-size:14px;font-weight:800;overflow-wrap:anywhere}
.acctbadge{font-size:10.5px;font-weight:800;color:var(--ok);background:#E8F7F3;border:1px solid #CDE9E3;border-radius:999px;padding:3px 8px}
.acctbadge.off{color:var(--danger);background:#FEF4F2;border-color:#F6D3CE}

/* ---------- 토스트 ---------- */
.toast{
  position:fixed;left:50%;z-index:120;
  bottom:calc(18px + env(safe-area-inset-bottom));
  transform:translateX(-50%) translateY(10px);
  display:flex;align-items:center;gap:12px;
  max-width:calc(100vw - 24px);
  background:#13233B;color:#fff;
  padding:11px 14px;border-radius:12px;
  font-size:13.5px;font-weight:700;line-height:1.4;
  box-shadow:0 10px 30px rgba(10,25,45,.32);
  opacity:0;transition:opacity .18s,transform .18s;
  pointer-events:none;
}
.toast.show{opacity:1;transform:translateX(-50%);pointer-events:auto}
.toast button{background:transparent;border:1px solid rgba(255,255,255,.36);border-radius:8px;color:#fff;font-weight:800;font-size:12.5px;padding:6px 9px;white-space:nowrap}
body.selecting .toast{bottom:calc(78px + env(safe-area-inset-bottom))}

/* 좁은 폰 */
@media (max-width:360px){
  .achip{font-size:11.5px;padding-right:8px}
  .achip .ab{width:20px;height:20px;font-size:10px}
  .addbtn{padding:8px 10px;font-size:13px}
  .ntitle{font-size:14.5px}
}
