:root {
  --bg: #F3F5F9; --card: #fff; --line: #ECEEF3; --line2: #DADEE6;
  --ink: #1F2430; --sub: #6B7280; --muted: #A3AAB7;
  --accent: #4F6BED; --accent-d: #3B55D9; --accent-s: #EEF1FE; --chip: #E7ECFD; --chip-ink: #2E43B5;
  --hover: #F3F5F9; --track: #EDF0F4;
  --sun: #E5484D; --sat: #3E7BFA; --danger: #E5484D; --danger-s: #FDEEEE;
  --green: #1F9D63; --green-s: #E4F5EC;
  --orange: #F08C00; --orange-s: #FFF1DC; --orange-ink: #B25E00;
  --shadow: 0 3px 26px rgba(30, 42, 74, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 "Pretendard", "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--sub); }

/* buttons */
.btn { border: 0; background: transparent; border-radius: 8px; height: 34px; padding: 0 14px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { background: var(--hover); }
.btn.icon { width: 34px; padding: 0; color: var(--sub); font-size: 18px; font-weight: 400; }
.btn.icon:hover { background: #E8EBF1; color: var(--ink); }
.btn.pill { background: #fff; border: 1px solid var(--line2); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-d); }
.btn.soft { background: var(--accent-s); color: var(--accent); }
.btn.soft:hover { background: var(--chip); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-text { color: var(--danger); }
.btn.danger-text:hover { background: var(--danger-s); }
.btn.wide { width: 100%; height: 40px; }
.chip { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 15px; font-size: 12px; font-weight: 600; border: 0; white-space: nowrap; }
.chip.accent { background: var(--accent-s); color: var(--accent); }
.chip.danger { background: var(--danger-s); color: var(--danger); cursor: pointer; }

/* login */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 36px 32px 30px; width: 100%; max-width: 360px; text-align: center; }
.login-card h1 { margin: 14px 0 0; font-size: 22px; }
.login-card p { margin: 2px 0 22px; }
.login-card label { display: block; text-align: left; font-size: 12px; font-weight: 600; color: var(--sub); margin-bottom: 12px; }
.login-card input { display: block; width: 100%; margin-top: 6px; height: 42px; border: 1px solid var(--line2); border-radius: 10px; padding: 0 12px; outline: none; }
.login-card input:focus { border-color: var(--accent); }
.error { color: var(--danger); font-size: 12.5px; min-height: 20px; margin: 4px 0 8px; }
.logo { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.logo.big { width: 52px; height: 52px; border-radius: 16px; font-size: 24px; margin: 0 auto; }

/* top bar */
.top { display: flex; align-items: center; gap: 16px; padding: 14px 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-size: 15px; }
.brand small { display: block; font-size: 11px; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 4px; margin-left: 28px; }
.nav h2 { margin: 0 0 0 10px; font-size: 21px; }
.right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 40px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(30,42,74,.16); padding: 6px; min-width: 190px; z-index: 30; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 7px; cursor: pointer; }
.menu button:hover { background: var(--hover); }
.menu-head { padding: 8px 12px 10px; font-size: 12px; color: var(--sub); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.danger-text { color: var(--danger) !important; }

/* layout */
.main { display: grid; grid-template-columns: 1fr 400px; gap: 20px; padding: 0 20px 20px; height: calc(100vh - 66px); min-height: 560px; }
.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); }

/* calendar */
.cal { padding: 2px 10px 10px; display: flex; flex-direction: column; min-height: 0; }
.dow { display: grid; grid-template-columns: repeat(7, 1fr); height: 40px; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.dow span { padding-left: 14px; }
.dow .sun { color: var(--sun); } .dow .sat { color: var(--sat); }
.grid { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(6, 1fr); min-height: 0; }
.cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 3px; min-width: 0; min-height: 0; overflow: hidden; cursor: pointer; }
.cell:nth-child(7n) { border-right: 0; }
.cell:nth-last-child(-n+7) { border-bottom: 0; }
.cell .in { height: 100%; border-radius: 10px; padding: 4px 5px; overflow: hidden; border: 1.5px solid transparent; }
.cell:hover .in { background: #F7F8FB; }
.cell.sel .in { background: var(--accent-s); border-color: var(--accent); }
.cell .hd { display: flex; align-items: center; justify-content: space-between; height: 26px; }
.cell .n { font-size: 12.5px; font-weight: 600; padding-left: 7px; }
.cell.today .n { background: var(--accent); color: #fff; border-radius: 12px; min-width: 25px; height: 25px; padding: 0 7px; display: grid; place-items: center; font-weight: 700; }
.cell.sun .n { color: var(--sun); } .cell.sat .n { color: var(--sat); }
.cell.out .n { color: var(--muted); }
.cell.out .chips { opacity: .5; }
.cell.today .n { color: #fff; }
.cnt { font-size: 11px; font-weight: 600; color: var(--muted); padding: 1px 6px; border-radius: 9px; }
.cnt.all { background: var(--green-s); color: var(--green); }
.chips { margin-top: 3px; }
.c { display: flex; gap: 4px; align-items: center; font-size: 11.5px; padding: 2px 6px; margin-top: 2px; border-radius: 5px; white-space: nowrap; overflow: hidden; }
.c .t { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.c .k { font-size: 10.5px; opacity: .8; font-weight: 600; }
.c.todo { background: var(--chip); color: var(--chip-ink); border-left: 3px solid var(--accent); font-weight: 500; }
.c.doing { background: var(--orange-s); color: var(--orange-ink); border-left: 3px solid var(--orange); font-weight: 500; }
.c.done { color: var(--muted); text-decoration: line-through; }
.c.done::before { content: "✓"; color: var(--green); text-decoration: none; display: inline-block; margin-right: 2px; }
.more { font-size: 11px; font-weight: 600; color: var(--sub); padding: 3px 0 0 7px; }

/* day panel */
.panel { padding: 20px 22px 18px; display: flex; flex-direction: column; min-height: 0; }
.day-head { display: flex; align-items: center; gap: 14px; }
.day-num { font-size: 48px; font-weight: 700; line-height: 1; }
.day-meta b { font-size: 17px; }
.day-meta small { display: block; color: var(--sub); font-size: 12.5px; margin-top: 3px; }
.tag { display: inline-block; margin-left: 9px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 10px; background: var(--track); color: var(--sub); vertical-align: 2px; }
.tag.now { background: var(--accent); color: #fff; }
.progress { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.track { flex: 1; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.fill { height: 100%; border-radius: 4px; background: var(--accent); width: 0; transition: width .25s; }
.fill.all { background: var(--green); }
.progress small { color: var(--sub); font-size: 12px; white-space: nowrap; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--track); border-radius: 10px; padding: 3px; margin: 18px 0 12px; }
.seg button { border: 0; background: none; padding: 7px; border-radius: 8px; font-weight: 600; color: var(--sub); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.badge { background: var(--danger); color: #fff; font-size: 10.5px; border-radius: 8px; padding: 0 6px; margin-left: 6px; }
.list { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -6px; padding: 0 6px; }
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; }
.empty-ico { width: 68px; height: 68px; border-radius: 34px; background: var(--accent-s); color: var(--accent); display: grid; place-items: center; font-size: 26px; margin-bottom: 10px; }
.empty small { color: var(--sub); white-space: pre-line; }

/* task row */
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 0 12px; padding: 10px 6px 10px 10px; border-radius: 10px; margin-bottom: 2px; }
.row:hover { background: var(--hover); }
.st { width: 22px; height: 22px; border: 0; padding: 0; background: none; cursor: pointer; }
.st svg { display: block; }
.title-row { display: flex; gap: 8px; align-items: flex-start; }
.title { font-size: 14px; flex: 1; word-break: break-word; }
.row.done .title { color: var(--muted); text-decoration: line-through; }
.pill-doing { background: var(--orange-s); color: var(--orange-ink); font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 9px; white-space: nowrap; }
.memo { font-size: 12px; color: var(--sub); margin-top: 3px; white-space: pre-line; max-height: 36px; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.meta .late { color: var(--danger); }
.toggle { cursor: pointer; font-weight: 600; color: var(--sub); border-radius: 6px; padding: 1px 6px; margin-left: -6px; }
.toggle:hover { background: var(--track); }
.row.doing .toggle { color: var(--orange-ink); }
.row.done .toggle { color: var(--green); }
.acts { display: flex; gap: 2px; visibility: hidden; align-self: start; margin-top: -4px; }
.row:hover .acts { visibility: visible; }
.acts .btn.icon { width: 30px; height: 30px; font-size: 14px; }
.subs { grid-column: 2 / 4; margin-top: 6px; }
.sub { display: flex; align-items: flex-start; gap: 8px; padding: 2px 0; }
.sub input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 17px; height: 17px; margin: 1px 0 0; border: 1.5px solid #C3C9D5; border-radius: 50%; cursor: pointer; flex: none; display: grid; place-items: center; background: #fff; }
.sub input[type=checkbox]:checked { background: var(--green); border-color: var(--green); }
.sub input[type=checkbox]:checked::after { content: "✓"; color: #fff; font-size: 10px; font-weight: 700; }
.sub span { flex: 1; font-size: 13px; word-break: break-word; }
.sub.done span { color: var(--muted); text-decoration: line-through; }
.sub .x { visibility: hidden; border: 0; background: none; color: var(--sub); cursor: pointer; border-radius: 6px; width: 24px; height: 22px; }
.sub:hover .x { visibility: visible; }
.sub .x:hover { background: var(--line); }
.subadd { width: 100%; border: 0; background: #F6F7FA; border-radius: 8px; height: 30px; padding: 0 10px; margin-top: 4px; outline: none; font-size: 12.5px; }
.subadd:focus { box-shadow: 0 0 0 1.5px var(--accent) inset; }

.addbar { display: flex; align-items: center; gap: 4px; margin-top: 12px; background: #F6F7FA; border: 1px solid var(--line); border-radius: 12px; padding: 5px 5px 5px 12px; }
.addbar .plus { color: var(--accent); font-weight: 700; }
.addbar input { flex: 1; border: 0; background: none; outline: none; height: 34px; font-size: 13.5px; min-width: 0; }
.overbar { margin-top: 12px; }

/* modal */
.backdrop { position: fixed; inset: 0; background: rgba(20, 26, 40, .28); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(20,26,40,.22); width: 100%; max-width: 480px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 4px; }
.modal header h3 { margin: 0; font-size: 18px; }
.modal .body { padding: 0 24px; overflow-y: auto; }
.modal footer { display: flex; justify-content: space-between; gap: 8px; padding: 22px 24px 20px; }
.modal footer .r { display: flex; gap: 8px; margin-left: auto; }
.field { font-size: 12px; font-weight: 600; color: var(--sub); margin: 16px 0 7px; }
.inp { width: 100%; border: 1px solid var(--line2); border-radius: 10px; height: 38px; padding: 0 12px; outline: none; background: #fff; }
.inp:focus { border-color: var(--accent); }
textarea.inp { height: 76px; padding: 8px 12px; resize: vertical; }
.chiprow { display: flex; flex-wrap: wrap; gap: 6px; }
.choice { border: 1px solid var(--line2); background: #fff; border-radius: 15px; height: 30px; padding: 0 13px; font-size: 12.5px; font-weight: 600; color: var(--sub); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.choice.on { background: var(--accent-s); border-color: var(--accent); color: var(--accent); }
.quick { display: flex; gap: 6px; margin-top: 8px; }
.quick .btn { height: 28px; font-size: 12px; }
.subedit { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.subedit .inp { height: 34px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #262B36; color: #F5F7FB; padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.2); }

/* mobile */
@media (max-width: 900px) {
  .top { padding: 12px 14px 8px; gap: 8px; }
  .brand small { display: none; }
  .nav { margin-left: 0; order: 3; width: 100%; }
  .nav h2 { font-size: 19px; }
  .right .chip.accent { display: none; }
  .main { grid-template-columns: 1fr; height: auto; padding: 0 12px 16px; gap: 12px; }
  .cal { height: 330px; }
  .cell .chips, .cell .more, .cell .cnt { display: none; }
  .cell .hd { flex-direction: column; height: auto; gap: 2px; padding-top: 2px; }
  .cell .n { padding-left: 0; }
  .cell .dots { display: flex; gap: 3px; justify-content: center; margin-top: 2px; }
  .panel { min-height: 60vh; }
  .acts { visibility: visible; }
  .sub .x { visibility: visible; }
}
@media (min-width: 901px) { .cell .dots { display: none; } }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); display: block; }
.dots i.doing { background: var(--orange); }
.dots i.done { background: var(--muted); }
