:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --text: #1c1c1e;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-text: #ffffff;
  --user-bubble: #4f46e5;
  --bot-bubble: #f1f2f6;
  --danger: #dc2626;
  --high: #ef4444;
  --medium: #f59e0b;
  --low: #10b981;
  --today: #4f46e5;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f12;
    --panel: #18181c;
    --text: #ececf1;
    --muted: #9ca3af;
    --line: #2a2a31;
    --accent: #818cf8;
    --accent-soft: #23233a;
    --accent-text: #0f0f12;
    --user-bubble: #6366f1;
    --bot-bubble: #23232a;
    --danger: #f87171;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  font-size: 15px;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
}
.topbar h1 { font-size: 18px; margin: 0; }
.badge { font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); padding: 2px 8px; border-radius: 99px; }
.badge.warn { color: var(--danger); border-color: var(--danger); }
.spacer { flex: 1; }

/* ---------- 수정 창 ---------- */
dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0;
  background: var(--panel); color: var(--text);
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 40px);
}
dialog::backdrop { background: rgb(0 0 0 / .45); }
#dialog-form { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
#dialog-form h3 { margin: 0 0 4px; font-size: 17px; }
#dialog-form h4 { margin: 0 0 8px; font-size: 14px; }
#dialog-form section { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
#dialog-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 1; min-width: 0; }
#dialog-form label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
#dialog-form input:not([type=checkbox]), #dialog-form select, #dialog-form textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; background: var(--bg); color: var(--text); font-size: 15px; outline: none; width: 100%;
}
#dialog-form input:focus, #dialog-form select:focus, #dialog-form textarea:focus { border-color: var(--accent); }
#dialog-form textarea { resize: vertical; }
#dialog-form input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
#dialog-form .row { display: flex; gap: 10px; }
.repeat-opts { display: flex; flex-direction: column; gap: 10px; }
.repeat-opts[hidden], .weekdays-pick[hidden] { display: none; }
.weekdays-pick { display: flex; gap: 4px; }
.weekdays-pick label { flex: 1; align-items: center; }
.weekdays-pick input { position: absolute; opacity: 0; pointer-events: none; }
.weekdays-pick span {
  display: block; width: 100%; text-align: center; padding: 7px 0; border-radius: 8px;
  border: 1px solid var(--line); color: var(--text); font-size: 14px; cursor: pointer;
}
.weekdays-pick input:checked + span { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.weekdays-pick input:focus-visible + span { outline: 2px solid var(--accent); }
#dialog-form .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
#dialog-form button, .row-btns button {
  border: 1px solid var(--line); background: none; border-radius: 10px; padding: 9px 14px; font-weight: 600;
}
#dialog-form button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
#dialog-form button.danger { color: var(--danger); }
#dialog-form button.link { border: none; padding: 0; color: var(--accent); font-weight: 500; align-self: flex-start; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.list li.clickable, #todo-list .main { cursor: pointer; }
.list li.clickable:hover { background: var(--accent-soft); }
.ghost-btn { background: none !important; color: var(--accent) !important; border: 1px solid var(--line) !important; font-weight: 500 !important; }

/* ---------- 로그인 ---------- */
.login { position: fixed; inset: 0; z-index: 10; background: var(--bg); display: grid; place-items: center; padding: 16px; }
.login[hidden] { display: none; }
.login-box {
  width: 100%; max-width: 320px; display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 22px;
}
.login-box img { border-radius: 14px; }
.login-box h2 { margin: 0 0 6px; font-size: 18px; }
.login-box input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: var(--bg); outline: none; }
.login-box input:focus { border-color: var(--accent); }
.login-box button { width: 100%; background: var(--accent); color: var(--accent-text); border: none; border-radius: 10px; padding: 11px; font-weight: 600; }
.login-error { margin: 0; min-height: 1.2em; font-size: 13px; color: var(--danger); }

/* ---------- 앱 뼈대: 왼쪽 메뉴 + 오른쪽 화면 ---------- */
.app { flex: 1; min-height: 0; display: flex; }
.nav {
  width: 200px; flex: none; display: flex; flex-direction: column; gap: 2px;
  padding: 16px 10px; border-right: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 16px; }
.brand img { border-radius: 8px; }
.nav button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: none; background: none; border-radius: 10px; padding: 10px 12px;
  font-size: 15px; font-weight: 600; color: var(--muted); text-align: left;
}
.nav button i { font-style: normal; font-size: 17px; width: 22px; text-align: center; }
.nav button:hover { background: var(--bg); color: var(--text); }
.nav button.active { background: var(--accent-soft); color: var(--accent); }
.nav-count { margin-left: auto; font-size: 12px; background: var(--accent); color: var(--accent-text); border-radius: 99px; padding: 0 7px; line-height: 18px; }
.nav-count:empty { display: none; }
.nav-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-bottom .badge { align-self: flex-start; margin: 0 12px 6px; }
.nav button.nav-plain { font-weight: 500; font-size: 14px; }

main.main { flex: 1; min-width: 0; min-height: 0; display: flex; }
.page { display: none; flex: 1; min-width: 0; min-height: 0; gap: 14px; padding: 16px; }
body[data-view=chat] #page-chat,
body[data-view=calendar] #page-calendar,
body[data-view=todos] #page-todos,
body[data-view=notes] #page-notes,
body[data-view=memory] #page-memory,
body[data-view=meetings] #page-meetings,
body[data-view=dashboard] #page-dashboard,
body[data-view=reflections] #page-reflections,
body[data-view=ledger] #page-ledger { display: flex; }
.page.narrow { justify-content: center; }
.page.narrow > .panel { width: 100%; max-width: 760px; }
#page-calendar .cal-main { flex: 1; }
#page-calendar .day-detail { width: 340px; flex: none; }
#page-calendar .grid { flex: 1; grid-auto-rows: minmax(64px, 1fr); }
#page-calendar .day { min-height: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel-head h2 { font-size: 18px; margin: 0; flex: 1; }
.cal-main .panel-head h2 { flex: 0 0 auto; text-align: center; min-width: 120px; }
.cal-main .panel-head #today-btn { margin-left: auto; }
.count { color: var(--muted); font-size: 13px; margin-left: auto; }
.only-narrow { display: none !important; }

button.ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
button.ghost:hover { background: var(--accent-soft); }
button.small { font-size: 13px; }
button.icon { width: 32px; height: 32px; padding: 0; font-size: 20px; line-height: 1; }
.link-btn { border: none; background: none; color: var(--accent); font-size: 13px; padding: 4px 0; align-self: flex-start; }

/* 기억 화면 */
.memory-form { display: flex; gap: 6px; margin: 12px 0 16px; }
.memory-form select, .memory-form input { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; background: var(--bg); outline: none; }
.memory-form input { flex: 1; min-width: 0; }
.memory-form button { background: var(--accent); color: var(--accent-text); border: none; border-radius: 10px; padding: 9px 14px; font-weight: 600; }
.memory-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.memory-list h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.memory-list .mem-list button { border: none; background: none; color: var(--muted); padding: 2px 6px; }
.empty-mem { text-align: center; margin-top: 30px; }

/* ---------- 대화 목록 ---------- */
.threads { display: flex; flex-direction: column; min-height: 0; gap: 8px; }
.new-chat {
  border: 1px solid var(--line); background: var(--panel); border-radius: 12px;
  padding: 11px 14px; font-weight: 600; text-align: left;
}
.new-chat:hover { background: var(--accent-soft); }
.thread-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.thread-group { font-size: 12px; color: var(--muted); padding: 12px 10px 4px; font-weight: 600; }
.thread { display: flex; align-items: center; gap: 2px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.thread:hover { background: var(--panel); }
.thread.active { background: var(--accent-soft); }
.thread-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.thread-act { border: none; background: none; padding: 2px 4px; font-size: 13px; opacity: 0; color: var(--muted); }
.thread:hover .thread-act, .thread.active .thread-act { opacity: .7; }
.thread-act:hover { opacity: 1 !important; }
.thread-empty { color: var(--muted); font-size: 13px; padding: 10px; }
.threads-backdrop { display: none; }

/* ---------- 채팅 ---------- */
.panel.chat { padding: 0; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-head h2 { flex: 1; margin: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.messages {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
  padding: 20px max(16px, calc((100% - 760px) / 2)) 12px;
}
.msg-row { display: flex; flex-direction: column; gap: 6px; }
.msg-row.user { align-items: flex-end; }
.msg { line-height: 1.65; word-break: break-word; }
.msg.user { max-width: 85%; background: var(--user-bubble); color: #fff; padding: 10px 14px; border-radius: 18px; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.assistant { max-width: 100%; }
.msg.assistant > :first-child { margin-top: 0; }
.msg.assistant > :last-child { margin-bottom: 0; }
.msg.assistant p { margin: 0 0 10px; }
.msg.assistant ul, .msg.assistant ol { margin: 0 0 10px; padding-left: 22px; }
.msg.assistant li { margin: 3px 0; }
.msg.assistant h1, .msg.assistant h2, .msg.assistant h3 { font-size: 16px; margin: 16px 0 8px; }
.msg.assistant code { background: var(--bot-bubble); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.msg.assistant pre { background: var(--bot-bubble); padding: 12px 14px; border-radius: 10px; overflow-x: auto; }
.msg.assistant pre code { background: none; padding: 0; }
.msg.assistant table { border-collapse: collapse; margin: 0 0 10px; display: block; overflow-x: auto; }
.msg.assistant th, .msg.assistant td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.msg.assistant th { background: var(--bot-bubble); }
.msg.assistant blockquote { margin: 0 0 10px; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.msg.assistant a { color: var(--accent); }
.msg.error { align-self: center; color: var(--danger); font-size: 13px; text-align: center; }
.typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.msg-tools { display: flex; gap: 4px; }
.msg-tools button { border: none; background: none; color: var(--muted); font-size: 12px; padding: 3px 6px; border-radius: 6px; }
.msg-tools button:hover { background: var(--bot-bubble); color: var(--text); }
.changes { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; }
.chip b { color: var(--accent); font-weight: 600; margin-right: 4px; }
.chip.memory { border-style: dashed; }

.empty-chat { margin: auto; text-align: center; color: var(--muted); line-height: 1.6; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-chat img { border-radius: 12px; margin-bottom: 4px; }
.empty-chat strong { color: var(--text); font-size: 20px; }
.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; width: 100%; max-width: 560px; }
.suggestions button {
  font-size: 13px; text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; color: var(--text); line-height: 1.4;
}
.suggestions button:hover { background: var(--accent-soft); }

.composer {
  display: flex; gap: 8px; align-items: flex-end;
  margin: 0 max(16px, calc((100% - 760px) / 2)); padding: 8px 8px 8px 14px;
  border: 1px solid var(--line); border-radius: 22px; background: var(--bg);
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea { flex: 1; resize: none; max-height: 200px; border: none; background: none; padding: 7px 0; outline: none; line-height: 1.5; }
.composer button {
  width: 36px; height: 36px; flex: none; border-radius: 50%; border: none;
  background: var(--accent); color: var(--accent-text); font-size: 17px; font-weight: 700;
}
.composer button.stop { background: var(--text); color: var(--panel); font-size: 12px; }
.composer-hint { margin: 6px 0 10px; text-align: center; font-size: 11px; color: var(--muted); }
.inline-form button {
  background: var(--accent); color: var(--accent-text); border: none; border-radius: 10px; padding: 10px 14px; font-weight: 600; white-space: nowrap;
}


/* ---------- 기억 창 ---------- */
#dialog-form h3 small { font-size: 13px; color: var(--muted); font-weight: 500; }
.mem-scroll { max-height: 45dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.mem-scroll section { border-top: none !important; padding-top: 0 !important; }
.mem-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mem-list li { display: flex; align-items: center; gap: 4px; padding: 7px 10px; background: var(--bg); border-radius: 8px; font-size: 14px; }
.mem-list li span { flex: 1; }
#dialog-form .mem-list button { border: none; padding: 2px 6px; color: var(--muted); font-weight: 400; }

/* ---------- 캘린더 ---------- */
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.weekdays span { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 6px; }
.weekdays span:first-child { color: var(--high); }
.grid { gap: 3px; }
.day {
  border: none; background: none; border-radius: 8px;
  min-height: 58px; padding: 4px; text-align: left; vertical-align: top;
  display: flex; flex-direction: column; gap: 2px; overflow: hidden;
}
.day:hover { background: var(--accent-soft); }
.day.other { opacity: .35; }
.day.selected { background: var(--accent-soft); outline: 1.5px solid var(--accent); }
.day .num { font-size: 12px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.day.sun .num { color: var(--high); }
.day.today .num { background: var(--today); color: #fff; font-weight: 700; }
.day .ev { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.day .more { font-size: 10px; color: var(--muted); }

.day-detail { overflow-y: auto; }
.day-detail h3 { margin: 0 0 8px; font-size: 14px; }

/* ---------- 목록 공통 ---------- */
.list { list-style: none; margin: 0 0 10px; padding: 0; overflow-y: auto; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.list .main { flex: 1; min-width: 0; }
.list .title { word-break: break-word; }
.list .sub { font-size: 12px; color: var(--muted); }
.list .time { font-size: 13px; font-weight: 600; color: var(--accent); min-width: 44px; }
.list .del { background: none; border: none; color: var(--muted); font-size: 16px; padding: 2px 6px; opacity: .5; }
.list .del:hover { color: var(--danger); opacity: 1; }
.list .empty { color: var(--muted); font-size: 13px; border: none; justify-content: center; }
.list input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.list li.done .title { text-decoration: line-through; color: var(--muted); }
.pri { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pri.high { background: var(--high); } .pri.medium { background: var(--medium); } .pri.low { background: var(--low); }
.overdue { color: var(--danger) !important; }

.inline-form { display: flex; gap: 6px; margin-bottom: 10px; }
.inline-form input { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg); outline: none; }
.inline-form input[name=title] { flex: 1; }
.inline-form input:focus { border-color: var(--accent); }
.inline-form button { padding: 8px 12px; }
#todo-list { flex: 1; }

/* ---------- 메모 ---------- */
.notes { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.note { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.note summary { cursor: pointer; display: flex; align-items: center; gap: 8px; list-style: none; }
.note summary::-webkit-details-marker { display: none; }
.note summary .title { flex: 1; font-weight: 600; }
.note summary .date { font-size: 12px; color: var(--muted); }
.note .body { font-size: 14px; line-height: 1.6; margin-top: 8px; }
.note .body h1, .note .body h2, .note .body h3 { font-size: 14px; margin: 10px 0 4px; }
.note .body ul { margin: 4px 0; padding-left: 20px; }
.note .body p { margin: 4px 0; }
.note .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.note .tags span { font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 1px 6px; }
.note .del { background: none; border: none; color: var(--muted); font-size: 12px; margin-top: 8px; padding: 0; }
.note .del:hover { color: var(--danger); }
.notes .empty { color: var(--muted); font-size: 13px; text-align: center; margin-top: 20px; line-height: 1.6; }

/* ---------- 좁은 화면: 한 번에 한 패널 ---------- */
/* 대화 화면 안쪽: 대화 목록 + 채팅 */
#page-chat { padding: 16px 16px 16px 0; gap: 0; }
#page-chat .threads { width: 250px; flex: none; padding: 0 12px 0 14px; }
#page-chat .panel.chat { flex: 1; }

@media (max-width: 899px) {
  .app { flex-direction: column-reverse; }
  /* 메뉴 → 아래 탭 바 */
  .nav {
    width: auto; flex-direction: row; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--line); gap: 0;
  }
  .brand, .nav-bottom .badge { display: none; }
  .nav button { flex-direction: column; gap: 2px; padding: 6px 0; font-size: 11px; text-align: center; position: relative; }
  .nav button i { font-size: 19px; width: auto; }
  .nav button.active { background: none; }
  .nav-count { position: absolute; top: 2px; left: 55%; margin: 0; font-size: 10px; padding: 0 5px; line-height: 15px; }
  .nav > button, .nav-bottom { flex: 1 1 0; min-width: 0; }
  .nav-bottom { margin-top: 0; flex-direction: row; }
  .nav-bottom button { flex: 1 1 0; min-width: 0; }
  #logout, .me-chip { display: none !important; }

  .page { padding: 10px; }
  #page-chat { padding: 10px; }
  #page-calendar { flex-direction: column; overflow-y: auto; }
  #page-calendar .cal-main { flex: none; }
  #page-calendar .grid { flex: none; grid-auto-rows: auto; }
  #page-calendar .day { min-height: 54px; }
  #page-calendar .day-detail { width: auto; flex: none; overflow: visible; }
  .only-narrow { display: inline-flex !important; align-items: center; justify-content: center; }

  /* 대화 목록은 왼쪽에서 밀려나오는 서랍 */
  #page-chat .threads {
    position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; width: min(300px, 82vw);
    background: var(--bg); padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
    transform: translateX(-105%); transition: transform .2s ease; box-shadow: 4px 0 20px rgb(0 0 0 / .15);
  }
  body.drawer-open #page-chat .threads { transform: none; }
  body.drawer-open .threads-backdrop { display: block; position: fixed; inset: 0; z-index: 19; background: rgb(0 0 0 / .35); }
  .thread-act { opacity: .6; }
  .composer-hint { display: none; }
  .composer { margin-bottom: 10px; }
}
@media (max-width: 480px) {
  .page, #page-chat { padding: 8px; }
  .panel { padding: 12px; border-radius: 12px; }
  .panel.chat { padding: 0; }
  .messages { padding: 16px 12px 10px; }
  .composer { margin: 0 8px 8px; }
  .suggestions { grid-template-columns: 1fr; }
  .day { min-height: 46px; padding: 2px; }
  .day .ev { font-size: 10px; padding: 0 2px; }
  #todo-form input[name=due] { width: 120px; }
  .memory-form { flex-wrap: wrap; }
  .memory-form input { flex-basis: 100%; order: -1; }
}

/* ---------- 가족 계정 · 공유 ---------- */
.login-sub { margin: -4px 0 4px; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.5; }
.login-fields { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.login-box .link-btn { align-self: center; width: auto; background: none; color: var(--accent); padding: 4px 0; font-weight: 500; }
.login-box button:disabled { opacity: .6; }
.me-chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 14px; font-weight: 600; }
.me-chip:empty { display: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.who {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; vertical-align: middle;
  padding: 1px 7px; border-radius: 99px; color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent);
}
.who.shared { --c: var(--accent); }
.day .ev.other { background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); }
.share-toggle { display: flex; align-items: center; cursor: pointer; }
.share-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.share-toggle span { padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; filter: grayscale(1); opacity: .55; }
.share-toggle input:checked + span { filter: none; opacity: 1; border-color: var(--accent); background: var(--accent-soft); }
.share-toggle input:focus-visible + span { outline: 2px solid var(--accent); }
#dialog-form small { color: var(--muted); font-size: 12px; }
.colors { display: flex; gap: 8px; }
.colors label { flex: none !important; position: relative; }
.colors input { position: absolute; opacity: 0; width: 1px !important; height: 1px; pointer-events: none; }
.colors span { display: block; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; }
.colors input:checked + span { border-color: var(--text); }
.colors input:focus-visible + span { outline: 2px solid var(--accent); }
.pw-change { font-size: 14px; }
.pw-change summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.pw-change[open] { display: flex; flex-direction: column; gap: 8px; }
.family { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.family li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.invite { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg); border-radius: 10px; flex-wrap: wrap; }
.invite b { font-family: ui-monospace, monospace; font-size: 15px; letter-spacing: 1px; }
.invite small { flex: 1; }
#dialog-form .invite button { padding: 5px 10px; font-size: 13px; }
.note-actions { display: flex; gap: 14px; margin-top: 8px; }
.note .note-actions button { background: none; border: none; color: var(--muted); font-size: 12px; padding: 0; margin: 0; }
.note .note-actions .share { color: var(--accent); }

/* ---------- 📋 회의록 ---------- */
.mobile-only { display: none !important; }
#page-meetings .meet-list { width: 300px; flex: none; }
#page-meetings .meet-editor { flex: 1; min-width: 0; padding: 0; }
.new-meet { border: none; background: var(--accent); color: var(--accent-text); border-radius: 10px; padding: 6px 12px; font-weight: 600; font-size: 13px; }
.meet-search { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg); outline: none; margin-bottom: 8px; }
#meet-list { flex: 1; overflow-y: auto; }
#meet-list li.active { background: var(--accent-soft); }
#meet-list li { border-radius: 10px; padding: 9px 10px; }
.meet-empty { margin: auto; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 8px; padding: 30px; line-height: 1.6; }
.meet-empty div { font-size: 38px; }
.meet-empty strong { color: var(--text); font-size: 17px; }
.meet-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.meet-head input { border: 1px solid transparent; background: none; border-radius: 8px; padding: 6px 8px; outline: none; color: var(--text); }
.meet-head input:hover, .meet-head input:focus { border-color: var(--line); background: var(--bg); }
.meet-head input[name=title] { flex: 1; min-width: 0; font-size: 17px; font-weight: 700; }
.save-state { font-size: 12px; color: var(--muted); white-space: nowrap; }
.danger-text { color: var(--danger) !important; }
.meet-tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.meet-tabs button { border: none; background: none; padding: 9px 12px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.meet-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.meet-tabs small { background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 0 6px; font-size: 11px; }
.meet-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.memo-wrap { overflow-x: auto; }
.memo-table { width: 100%; min-width: 640px; border-collapse: collapse; }
.memo-table th { font-size: 12px; color: var(--muted); text-align: left; padding: 6px; border-bottom: 1px solid var(--line); }
.memo-table td { padding: 2px; border-bottom: 1px solid var(--line); }
.memo-table td:last-child { width: 30px; }
.memo-table input { width: 100%; border: 1px solid transparent; background: none; padding: 7px 6px; border-radius: 6px; outline: none; color: var(--text); }
.memo-table input:focus { border-color: var(--accent); background: var(--bg); }
.memo-table .del { background: none; border: none; color: var(--muted); opacity: .5; }
.add-row { align-self: flex-start; border: 1px dashed var(--line); background: none; border-radius: 10px; padding: 8px 14px; color: var(--accent); font-weight: 600; }
.meet-text { flex: 1; min-height: 300px; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg); outline: none; line-height: 1.6; color: var(--text); }
.meet-text:focus { border-color: var(--accent); }
.final-empty { margin: 30px auto; text-align: center; display: flex; flex-direction: column; gap: 10px; max-width: 460px; }
.primary-btn { background: var(--accent); color: var(--accent-text); border: none; border-radius: 12px; padding: 11px 16px; font-weight: 700; }
.primary-btn:disabled { opacity: .5; }
.final-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.final-actions button:not(.primary-btn) { border: 1px solid var(--line); background: none; border-radius: 10px; padding: 8px 12px; }
.final-md { max-width: 820px; }
.action-pick { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 45dvh; overflow-y: auto; }
.action-pick li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--bg); border-radius: 8px; }
.action-pick label { flex: 1; }
#dialog-form .action-pick input[type=date] { width: 150px; flex: none; padding: 5px 6px; font-size: 13px; }
.more-menu { display: flex; flex-direction: column; gap: 6px; }
#dialog-form .more-menu button { text-align: left; padding: 13px 14px; font-size: 15px; display: flex; flex-direction: column; gap: 2px; }
#dialog-form .more-menu small { font-weight: 400; }

@media (max-width: 899px) {
  .desk-only { display: none !important; }
  .mobile-only { display: flex !important; }
  #page-meetings .meet-list { width: auto; flex: 1; }
  #page-meetings .meet-editor { display: none; }
  body.meet-open #page-meetings .meet-list { display: none; }
  body.meet-open #page-meetings .meet-editor { display: flex; }
  .meet-head { padding: 10px; flex-wrap: wrap; }
  .meet-head input[type=date] { order: 5; }
  .meet-head input[name=title] { flex-basis: calc(100% - 50px); order: 2; }
  .meet-body { padding: 12px; }
}
.meet-tabs, .memo-wrap { scrollbar-width: thin; }
.meet-head .save-state, .meet-head [data-act=delete] { order: 6; }

/* 녹음 · 받아쓰기 */
.audio-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: var(--bg); border-radius: 12px; }
.audio-tools.busy { color: var(--accent); font-weight: 600; }
.audio-tools.busy small { color: var(--muted); font-weight: 400; }
.audio-tools.recording { color: var(--danger); font-weight: 600; }
.audio-tools.recording b { font-variant-numeric: tabular-nums; }
.audio-tools button:not(.primary-btn) { border: 1px solid var(--line); background: none; border-radius: 10px; padding: 9px 12px; }
.file-btn { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-weight: 600; cursor: pointer; }
.file-btn:hover { background: var(--accent-soft); }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
.spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-text { color: var(--danger); font-size: 13px; margin: 0; }

/* ---------- MyWork 기능 (대시보드 · 할 일 기록 · 회의 · 면담) ---------- */
.panel.scroll { overflow-y: auto; }
.page.narrow.wide > .panel { max-width: 1100px; }
.panel-head .sub, .todo-head .sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.todo-head { flex-wrap: wrap; align-items: flex-start; }
.todo-head > div:first-child { flex: 1; }
.date-nav { display: flex; align-items: center; gap: 4px; }
.date-nav input { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--bg); color: var(--text); }
.empty-panel { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty-panel div { font-size: 34px; }
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--panel); }
.task-card.open { border-color: var(--accent); box-shadow: 0 2px 10px rgb(0 0 0 / .06); }
.task-card.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-head { display: flex; align-items: center; gap: 8px; }
.task-head input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--accent); flex: none; }
.task-title { flex: 1; min-width: 0; border: none; background: none; font-size: 15px; font-weight: 600; padding: 4px; outline: none; color: var(--text); border-radius: 6px; }
.task-title:focus { background: var(--bg); }
.task-timing { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); margin: 4px 0 0 35px; align-items: center; }
.late { color: var(--danger); }
.ok { color: #10b981; }
.task-timing .carried { color: var(--accent); }
.link-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--c, var(--line)); border-radius: 99px; padding: 1px 8px; font-size: 12px; cursor: pointer; color: var(--text); }
.link-chip .del { border: none; background: none; color: var(--muted); padding: 0 2px; }
.task-body { margin-top: 10px; display: flex; flex-direction: column; gap: 12px; }
.task-field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; align-self: flex-start; }
.field-label.plan { background: color-mix(in srgb, #0ea5e9 15%, transparent); color: #0ea5e9; }
.field-label.actual { background: color-mix(in srgb, #10b981 15%, transparent); color: #10b981; }
.field-label.log { background: color-mix(in srgb, #f59e0b 15%, transparent); color: #d97706; }
.task-log-head { display: flex; align-items: center; justify-content: space-between; }
.log-entry { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; }
.log-time { font-size: 11px; color: var(--muted); white-space: nowrap; padding-top: 8px; min-width: 120px; }
.log-text { flex: 1; min-height: 38px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: var(--bg); color: var(--text); outline: none; }
.log-entry .del, .task-card .del { border: none; background: none; color: var(--muted); }
.task-meta-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.task-meta-row label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.task-meta-row label.check { flex-direction: row; align-items: center; color: var(--text); font-size: 13px; }
.task-meta-row input, .task-meta-row select, .link-row select, .md-toprow select, .md-toprow input[type=date] {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--bg); color: var(--text); }
.link-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* 서식 있는 글 편집기 */
.rich { border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.rich:focus-within { border-color: var(--accent); }
.rich-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); }
.rich-bar button { border: none; background: none; border-radius: 6px; padding: 3px 8px; font-size: 13px; color: var(--muted); }
.rich-bar button:hover { background: var(--accent-soft); color: var(--text); }
.rich-body { min-height: 70px; padding: 10px 12px; outline: none; line-height: 1.6; word-break: break-word; }
.rich-body:empty::before { content: attr(data-placeholder); color: var(--muted); }
.rich-body img { max-width: 100%; border-radius: 8px; }
.rich-body h3 { font-size: 16px; margin: 8px 0 4px; }
.rich-body blockquote { margin: 4px 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.rich-body ul, .rich-body ol { padding-left: 22px; margin: 4px 0; }
.rich-body p { margin: 0 0 4px; }

/* 회의 · 면담 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { border: 1px solid var(--c, var(--line)); background: none; border-radius: 99px; padding: 4px 11px; font-size: 13px; color: var(--text); }
.chip.on { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); color: #fff; }
.wide-btn { width: 100%; margin-bottom: 8px; padding: 9px; }
#page-reflections .meet-list { width: 300px; flex: none; }
#page-reflections .meet-editor, #page-meetings .meet-editor { flex: 1; min-width: 0; padding: 16px 20px; display: block; }
.md-toprow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.md-title { width: 100%; border: none; background: none; font-size: 22px; font-weight: 800; padding: 6px 0; outline: none; color: var(--text); }
.md-section { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; }
.section-head { display: flex; align-items: center; gap: 8px; }
.section-head h3 { margin: 0; font-size: 15px; flex: 1; }
.notes-summary { border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; }
.md { line-height: 1.6; }
.md > :first-child { margin-top: 0; }
.linked-tasks { display: flex; flex-direction: column; gap: 4px; }
.linked-task { display: flex; gap: 8px; align-items: center; padding: 7px 10px; background: var(--bg); border-radius: 8px; cursor: pointer; font-size: 14px; }
.linked-task .lt-title { flex: 1; }
.linked-task .sub { font-size: 12px; color: var(--muted); }
.rec-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.rec-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.rec-head .del { border: none; background: none; color: var(--muted); }
.rec-card audio { width: 100%; height: 36px; }
.rec-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.rec-actions button, .rec-tabs button { border: 1px solid var(--line); background: none; border-radius: 8px; padding: 6px 10px; font-size: 13px; color: var(--text); }
.rec-actions button:disabled { opacity: .45; }
.rec-tabs { display: flex; gap: 4px; align-items: center; }
.rec-tabs button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.rec-content { max-height: 420px; overflow-y: auto; white-space: pre-wrap; background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 14px; line-height: 1.65; }
.rec-content.md { white-space: normal; }
.refl-q { margin-bottom: 14px; }
.refl-q-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; line-height: 1.5; }
.refl-num { display: inline-block; background: var(--accent); color: var(--accent-text); border-radius: 6px; padding: 0 7px; font-size: 12px; margin-right: 4px; }
.refl-num.last { background: #64748b; }
.refl-num.report { background: #0ea5e9; }
.refl-num.task { background: #10b981; }
.refl-answer { width: 100%; min-height: 72px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: var(--bg); color: var(--text); outline: none; line-height: 1.55; }
.refl-answer:focus { border-color: var(--accent); }
.refl-task { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.cat-list { display: flex; flex-direction: column; gap: 6px; }
.cat-row { display: flex; gap: 6px; align-items: center; }
#dialog-form .cat-row input:not([type=color]) { flex: 1; }
#dialog-form .cat-row input.short { flex: 0 0 90px; }
#dialog-form .cat-row input[type=color] { width: 40px; height: 36px; padding: 2px; flex: none; }

/* 대시보드 */
.banner { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); cursor: pointer; margin-bottom: 12px; font-size: 14px; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--bg); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.stat b { font-size: 26px; }
.stat span { font-size: 13px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.dash-grid h3 { font-size: 15px; margin: 6px 0 8px; }
.dash-grid h3 small { color: var(--muted); font-weight: 500; }
.dash-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.dash-item:hover { background: var(--bg); }
.dash-item .main { flex: 1; min-width: 0; }
.dash-item .title { font-size: 14px; font-weight: 600; }
.dash-item .sub { font-size: 12px; color: var(--muted); }
.dash-item input { width: 18px; height: 18px; accent-color: var(--accent); }
.dash-item.done .title { color: var(--muted); }
.dash-item .time { font-size: 13px; font-weight: 600; color: var(--accent); min-width: 44px; }

@media (max-width: 899px) {
  #page-reflections .meet-list { width: auto; flex: 1; }
  #page-reflections .meet-editor { display: none; }
  body.refl-open #page-reflections .meet-list { display: none; }
  body.refl-open #page-reflections .meet-editor { display: block; }
  #page-meetings .meet-editor, #page-reflections .meet-editor { padding: 12px; }
  body.meet-open #page-meetings .meet-editor { display: block; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .task-timing { margin-left: 0; }
  .log-entry { flex-wrap: wrap; }
  .log-time { min-width: 0; padding-top: 0; }
  .md-title { font-size: 19px; }
}

/* ---------- 회의 전체 요약 · 묶음 할 일 · AI 비용 ---------- */
.ai-sum { border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--panel)); border-radius: 14px; padding: 14px 16px; }
.ai-sum .hint { margin: 0; }
.sum-md { line-height: 1.7; }
.sum-md h3 { font-size: 15px; margin: 14px 0 6px; }
.sum-md ul { padding-left: 20px; margin: 4px 0; }
.sum-actions { border-top: 1px dashed var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.sum-actions h4 { margin: 0; font-size: 14px; flex: 1; }
.sum-actions h4 small { color: var(--muted); font-weight: 500; }
.small-btn { padding: 7px 12px !important; font-size: 13px; border-radius: 10px; }
.action-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.action-list li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; background: var(--panel); border-radius: 10px; font-size: 14px; }
.action-list li.reg { opacity: .6; }
.action-list .bullet { color: var(--accent); font-weight: 700; }
.action-list .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.section-head h3 small { font-weight: 400; }

.mode-pick { display: flex; gap: 8px; }
.mode-pick label { flex: 1; display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; color: var(--text) !important; flex-direction: row !important; font-size: 14px !important; }
.mode-pick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode-pick input { width: auto !important; margin-top: 3px; accent-color: var(--accent); }
.action-pick.edit li { align-items: flex-start; }
.action-pick.edit input[type=checkbox] { width: 18px; height: 18px; margin-top: 9px; flex: none; accent-color: var(--accent); }
.ap-main { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#dialog-form .ap-title { font-weight: 600; }
.ap-meta { display: flex; gap: 6px; }
#dialog-form .ap-meta input { padding: 5px 8px; font-size: 13px; }
#dialog-form .ap-owner { flex: 1; }
#dialog-form .ap-meta input[type=date] { width: 150px; flex: none; }

.subtasks { list-style: none; margin: 8px 0 0 35px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.subtasks li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.subtasks li input[type=checkbox] { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.subtasks li div { flex: 1; display: flex; flex-direction: column; }
.subtasks li small { font-size: 11px; color: var(--muted); }
.subtasks li.done span { text-decoration: line-through; color: var(--muted); }
.subtasks .sub-add input { width: 100%; border: 1px dashed var(--line); background: none; border-radius: 8px; padding: 6px 8px; color: var(--text); outline: none; }
.subtasks .sub-add input:focus { border-color: var(--accent); border-style: solid; }

.usage-total { background: var(--bg); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.usage-total div { display: flex; align-items: baseline; gap: 10px; }
.usage-total b { font-size: 30px; }
.usage-total span { font-size: 17px; color: var(--muted); font-weight: 600; }
.usage-total small { color: var(--muted); }
.ubar { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.ubar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; align-items: center; }
.ubar-top small { color: var(--muted); font-weight: 500; }
.ubar-track { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.ubar-track div { height: 100%; background: var(--accent); border-radius: 99px; }
.uday { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.uday div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.uday span { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; }
.uday small { font-size: 9px; color: var(--muted); height: 12px; }
@media (max-width: 899px) {
  .subtasks { margin-left: 0; }
  .mode-pick { flex-direction: column; }
}

.scan-btn { align-self: flex-start; margin-bottom: 8px; }

/* ---------- 💰 가계부 ---------- */
#ledger > *, #lg-body > * { flex-shrink: 0; }
:root { --inc: #059669; --exp: #e11d48; }
@media (prefers-color-scheme: dark) { :root { --inc: #34d399; --exp: #fb7185; } }
.inc { color: var(--inc); }
.exp { color: var(--exp); }
.lg-head { flex-wrap: wrap; }
.lg-head > div:first-child { flex: 1; min-width: 140px; }
.lg-month { min-width: 96px; text-align: center; font-size: 15px; }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 10px; }
.seg button, .seg label { flex: 1; border: none; background: none; border-radius: 9px; padding: 7px 4px; font-size: 14px; color: var(--muted); font-weight: 600; text-align: center; cursor: pointer; }
.seg button.on, .seg label:has(input:checked) { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
#dialog-form .seg.small label { flex-direction: row; justify-content: center; color: var(--muted); font-size: 14px; }
#dialog-form .seg.small label:has(input:checked) { color: var(--text); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.lg-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.lg-tabs button { border: none; background: none; padding: 8px 14px; font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.lg-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.lg-sum { display: grid; grid-template-columns: repeat(3, 1fr) 1.6fr; gap: 10px; margin-bottom: 14px; }
.lg-sum > div { background: var(--bg); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lg-sum span { font-size: 13px; color: var(--muted); }
.lg-sum b { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-budget-mini { cursor: pointer; }
.lg-budget-mini small { font-size: 12px; color: var(--muted); }
.lg-quick { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-end; }
.lg-quick textarea { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg); color: var(--text); font: inherit; font-size: 15px; resize: none; outline: none; min-height: 42px; }
.lg-quick textarea:focus { border-color: var(--accent); }
.lg-quick button { padding: 10px 14px; white-space: nowrap; }
.lg-filter .meet-search { width: 100%; }
.lg-day { margin-bottom: 10px; }
.lg-day-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 6px 4px 2px; border-bottom: 1px solid var(--line); }
.lg-day-head b { color: var(--text); font-weight: 600; }
.lg-tx { cursor: pointer; }
.lg-tx:hover, .lg-fixed li:hover { background: var(--accent-soft); }
.lg-tx > b, .lg-fixed li > b { white-space: nowrap; font-size: 15px; }
.lg-ic { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 17px; background: color-mix(in srgb, var(--c) 18%, transparent); }
.lg-empty { text-align: center; padding: 30px 0; }
.ubar.click { cursor: pointer; }
.ubar.click:hover .ubar-top span { color: var(--accent); }
.lg-report { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.lg-report h3, .lg-budget h3, .lg-h { font-size: 15px; margin: 0 0 10px; }
.lg-report h3 small, .lg-budget h3 small, .lg-h small, .lg-group small { color: var(--muted); font-weight: 500; font-size: 13px; }
.lg-trend { display: flex; gap: 8px; height: 150px; align-items: stretch; }
.lg-trend > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.lg-trend .bars { flex: 1; width: 100%; display: flex; gap: 3px; align-items: flex-end; justify-content: center; }
.lg-trend .bars span { width: 40%; max-width: 18px; border-radius: 4px 4px 0 0; min-height: 1px; }
.lg-trend .i, .lg-key.i { background: var(--inc); }
.lg-trend .e, .lg-key.e { background: var(--exp); }
.lg-trend small { font-size: 11px; color: var(--muted); }
.lg-trend small.v { font-size: 10px; }
.lg-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-left: 6px; }
.lg-budget { display: flex; flex-direction: column; gap: 8px; margin-bottom: 26px; }
.lg-budget input { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg); color: var(--text); font-size: 15px; outline: none; width: 140px; text-align: right; }
.lg-budget input:focus { border-color: var(--accent); }
.lg-bt, .lg-bcat label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; }
.lg-bcats { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 22px; margin-top: 6px; }
.lg-bcat { display: flex; flex-direction: column; gap: 4px; }
.lg-bcat label { font-size: 14px; }
.lg-bcat input { width: 120px; padding: 6px 8px; font-size: 14px; }
.lg-fixed li { cursor: pointer; flex-wrap: wrap; }
.lg-fixed li.off { opacity: .5; }
.lg-fixed li button { font-size: 12px; }
.lg-group { font-size: 14px; margin: 14px 0 8px; }
.lg-assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.lg-asset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.lg-asset:hover { border-color: var(--accent); }
.lg-asset .top { display: flex; align-items: center; gap: 6px; }
.lg-asset .sub { font-size: 12px; color: var(--muted); }
.lg-hist, .lg-legacy { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
#dialog-form .lg-legacy select { width: auto; flex: 1; min-width: 120px; padding: 6px 8px; font-size: 14px; }
dialog.wide { width: min(900px, calc(100vw - 24px)); }
.pv-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; }
.pv-row { display: grid; grid-template-columns: 20px 132px minmax(100px, 1fr) 72px 104px 124px 110px; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
#dialog-form .pv-row input:not([type=checkbox]), #dialog-form .pv-row select { padding: 6px 7px; font-size: 13px; border-radius: 8px; }
#dialog-form .pv-row input[name^=amount] { text-align: right; }
#dialog-form .pv-row input.neg { color: var(--exp); }
.pv-memo { grid-column: 3 / -1; font-size: 12px; color: var(--muted); }
.lg-busy { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 0; }
.lg-busy p { margin: 0; color: var(--muted); }
.spin { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: lgspin .8s linear infinite; }
@keyframes lgspin { to { transform: rotate(360deg); } }
.lg-toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: var(--text); color: var(--panel); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  white-space: pre-line; max-width: min(460px, calc(100vw - 32px)); opacity: 0; pointer-events: none; transition: .2s; z-index: 50; box-shadow: 0 6px 20px rgb(0 0 0 / .2); }
.lg-toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 899px) {
  .lg-sum { grid-template-columns: repeat(3, 1fr); }
  .lg-sum .lg-budget-mini { grid-column: 1 / -1; }
  .lg-sum b { font-size: 15px; }
  .lg-sum > div { padding: 10px; }
  .pv-row { grid-template-columns: 20px 1fr 1fr; }
  .pv-row > input[type=checkbox] { grid-row: span 3; align-self: start; margin-top: 8px; }
  .pv-memo { grid-column: 2 / -1; }
  .lg-head .date-nav { order: 3; width: 100%; justify-content: center; }
  .lg-budget input { width: 120px; }
  .lg-fixed li .main { min-width: 150px; }
  .lg-fixed li > button { margin-left: 44px; }
}

/* ---------- 👨‍👩‍👧 공유 대상 · 가족 그룹 ---------- */
.share-pick { display: flex; flex-direction: column; gap: 8px; }
.sp-title { font-size: 14px; font-weight: 600; }
.sp-title small { color: var(--muted); font-weight: 400; }
.sp-opts { display: flex; flex-wrap: wrap; gap: 6px; }
#dialog-form label.sp { flex: none; flex-direction: row; }
.sp input { position: absolute; opacity: 0; pointer-events: none; }
.sp span { display: inline-block; border: 1px solid var(--c); color: var(--text); border-radius: 99px; padding: 5px 12px; font-size: 14px; cursor: pointer; }
.sp input:checked + span { background: var(--c); color: #fff; }
.sp input:focus-visible + span { outline: 2px solid var(--accent); }
.grp { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.grp small { color: var(--muted); }
#dialog-form .grp button { padding: 5px 10px; font-size: 13px; }
.invite-new { align-items: center; }
#dialog-form .invite-new select { flex: 1; }
