:root {
  --bg: #f6f6f8; --surface: #fff; --text: #111; --muted: #888; --line: #eee;
  --track: #eee; --accent: #111; --accent-text: #fff; --danger: #d63031;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; font-size: 15px;
}
a { color: inherit; text-decoration: none; }
.page { max-width: 720px; margin: 0 auto; padding: 12px 16px 96px; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar .inner { max-width: 720px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.topbar b { font-size: 16px; }
.topbar .nav { min-width: 32px; font-size: 20px; text-align: center; }
.topbar .nav.off { visibility: hidden; }
.muted { color: var(--muted); font-size: 13px; }
.tile { background: var(--surface); border-radius: 14px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 2px #0001; border: 2px solid transparent; display: block; }
.tile.sel { border-color: var(--sel, #ff9f43); }
.tile.dim { opacity: .45; }
.big { font-size: 24px; font-weight: 700; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.track { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.fill { height: 100%; border-radius: 4px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: 8px 0; background: var(--track); }
.li { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid #f0f0f0; }
.li:last-child { border-bottom: 0; }
.li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day { font-size: 12px; color: var(--muted); margin: 12px 0 2px; }
.pill { font-size: 11px; background: var(--accent); color: var(--accent-text); border-radius: 8px; padding: 1px 6px; margin-left: 4px; }
.fab {
  position: fixed; right: max(16px, calc(50vw - 344px)); bottom: 20px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text); font-size: 30px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px #0003;
}
.empty { text-align: center; color: var(--muted); padding: 18px 0; }
.links { display: flex; gap: 14px; justify-content: center; margin-top: 18px; }
.links a, .links button { color: var(--muted); font-size: 13px; background: none; border: 0; padding: 0; font: inherit; font-size: 13px; cursor: pointer; }

/* 폼 */
.form label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.form input, .form select, .form textarea {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font-size: 16px; border: 1px solid #ddd; border-radius: 10px;
  background: var(--surface); color: var(--text);
}
.form .check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
.form .check input { width: auto; margin: 0; }
button.primary, .button.primary {
  display: block; width: 100%; padding: 14px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-text);
  font-size: 16px; font-weight: 700; cursor: pointer;
}
button.danger { background: none; border: 0; color: var(--danger); font-size: 14px; cursor: pointer; padding: 10px 0; }
.notice { background: var(--surface); border-radius: 10px; padding: 10px 12px; }
.notice.error { color: var(--danger); }
.login h1 { text-align: center; margin: 40px 0 20px; }

/* 쓰기 */
.seg { display: flex; background: #e8e8ee; border-radius: 10px; padding: 3px; gap: 2px; }
.seg a, .seg label { flex: 1; text-align: center; padding: 8px 0; border-radius: 8px; font-size: 14px; position: relative; }
.seg .on { background: var(--surface); font-weight: 700; }
.seg input[type=date] { position: absolute; inset: 0; opacity: 0; width: 100%; }
.sec { font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips form { margin: 0; }
.chip {
  background: var(--surface); border: 1px solid #e3e3ea; border-radius: 12px; padding: 8px 11px; font-size: 14px; line-height: 1.25;
  text-align: left; color: var(--text); cursor: pointer; font-family: inherit;
}
.chip small { display: block; color: var(--muted); font-size: 12px; }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chip.on small { color: #ccc; }
.amount input { font-size: 28px; font-weight: 800; text-align: right; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; width: min(688px, calc(100% - 32px));
  background: #333; color: #fff; border-radius: 12px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; z-index: 10;
}
.toast button { background: none; border: 0; color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
.toast.hide { display: none; }
.err { color: var(--danger); font-size: 13px; margin: 4px 0 0; }
table.plain { width: 100%; border-collapse: collapse; }
table.plain td { padding: 8px 4px; border-bottom: 1px solid #f0f0f0; }
.inline { display: flex; gap: 6px; align-items: center; }
.inline input { width: auto; flex: 1; margin: 0; }
.inline button { width: auto; padding: 10px 12px; }
