: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 { 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 { 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; }
.colors input { position: absolute; opacity: 0; }
.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); }
