:root {
  --ink: #15221f;
  --muted: #687571;
  --paper: #f5f3ec;
  --panel: #fffef9;
  --white: #ffffff;
  --forest: #17483a;
  --forest-2: #286650;
  --lime: #d9f178;
  --line: #dfe3dc;
  --soft-green: #edf4ed;
  --danger: #a53737;
  --soft-danger: #fbe8e6;
  --shadow: 0 18px 50px rgba(18, 37, 31, .12);
}

* { box-sizing: border-box; }
html { min-height: 100%; overflow-x: hidden; background: var(--paper); }
body {
  min-height: 100%;
  width: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 0%, rgba(217, 241, 120, .30), transparent 24rem),
    var(--paper);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.app { width: min(820px, calc(100% - 36px)); margin: 0 auto; padding: 26px 0 42px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark, .auth-logo {
  display: grid;
  place-items: center;
  width: 47px;
  height: 47px;
  border-radius: 15px;
  background: var(--forest);
  color: var(--lime);
  font-family: Georgia, serif;
  font-size: 27px;
  font-style: italic;
  font-weight: 900;
  box-shadow: 0 9px 20px rgba(23, 72, 58, .18);
}
.eyebrow {
  margin: 0;
  color: var(--forest-2);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .18em;
}
.brand h1 { margin: 3px 0 0; font-family: Georgia, "Noto Serif KR", serif; font-size: 22px; }
.top-actions { display: flex; align-items: center; gap: 11px; }
.sync-status { color: var(--muted); font-size: 12px; }
.sync-status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #6fa375; vertical-align: 1px; }
.text-button { border: 0; background: transparent; color: var(--forest-2); font-size: 12px; font-weight: 800; padding: 7px 2px; }
.text-button:hover { color: var(--forest); }
.text-button.subtle { color: var(--muted); font-weight: 700; }

.quick-add { display: flex; align-items: flex-end; gap: 9px; margin: 16px 0 25px; padding: 7px 8px 7px 16px; border: 1px solid rgba(23,72,58,.12); border-radius: 17px; background: var(--panel); box-shadow: var(--shadow); }
.quick-add input, .quick-add textarea { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; line-height: 1.5; }
.quick-add textarea { min-height: 82px; max-height: 150px; padding: 6px 0; resize: vertical; }
.quick-add input::placeholder, .quick-add textarea::placeholder { color: #9aa59e; }
.quick-kind-actions { display: flex; flex: 0 0 88px; flex-direction: column; gap: 6px; }
.quick-kind-button { width: 88px; min-height: 42px; border: 1px solid transparent; border-radius: 11px; color: white; padding: 0 8px; font-size: 12px; font-weight: 900; }
.quick-kind-button.bug { background: #d96758; box-shadow: inset 0 -2px 0 rgba(116, 35, 27, .18); }
.quick-kind-button.feature { background: #5f89ba; box-shadow: inset 0 -2px 0 rgba(35, 67, 105, .18); }
.quick-kind-button:hover { filter: brightness(1.05); }
.quick-kind-button:disabled { cursor: wait; opacity: .55; }
.quick-kind-button:active { transform: translateY(1px); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.filter-tabs { display: flex; gap: 18px; }
.filter-tab { position: relative; border: 0; background: transparent; color: var(--muted); padding: 0 0 12px; font-size: 13px; font-weight: 800; }
.filter-tab.active { color: var(--forest); }
.filter-tab.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--forest); content: ""; }
.filter-tab b { display: inline-grid; place-items: center; min-width: 19px; height: 19px; margin-left: 3px; border-radius: 7px; background: var(--soft-green); color: var(--forest-2); font-size: 10px; }
.sort-control { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.sort-control select { border: 1px solid var(--line); border-radius: 9px; background: var(--white); color: var(--ink); padding: 7px 27px 7px 9px; outline: 0; font-size: 12px; font-weight: 700; }
.list-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin: 25px 1px 12px; }
.list-heading h2 { margin: 0; font-family: Georgia, "Noto Serif KR", serif; font-size: 24px; }
.list-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }

.task-list { display: flex; flex-direction: column; gap: 9px; }
.task-card { display: flex; align-items: flex-start; gap: 13px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,254,249,.88); box-shadow: 0 5px 17px rgba(18,37,31,.04); user-select: none; touch-action: pan-y; transition: border-color .16s, transform .16s, opacity .16s; }
.task-card:hover { border-color: #a8bab0; transform: translateY(-1px); }
.task-card.dragging { border: 2px solid var(--forest); background: var(--lime); box-shadow: 0 16px 34px rgba(23,72,58,.25), 0 0 0 4px rgba(217,241,120,.45); color: var(--forest); cursor: grabbing; opacity: 1; transform: scale(1.02) rotate(.4deg); }
.task-card.dragging .kind { border-color: rgba(23,72,58,.25); background: rgba(255,255,255,.48); color: var(--forest); }
.task-card.drag-over { border-color: var(--forest-2); background: #f2f8d9; box-shadow: inset 0 0 0 3px rgba(40,102,80,.22), 0 -5px 0 -2px var(--forest-2); }
.task-card.completed { background: rgba(249,250,246,.72); opacity: .64; }
.task-card.completed.dragging { background: var(--lime); color: var(--forest); opacity: 1; }
.task-card.completing, .task-card.reopening { pointer-events: none; animation: task-filter-exit .38s cubic-bezier(.22,.8,.32,1) both; }
.task-card.reopening { animation-duration: .28s; }
.task-card.completing .check-button { border-color: var(--forest); background: var(--forest); color: var(--lime); animation: check-complete .38s cubic-bezier(.22,.8,.32,1) both; }
.task-card.completing .check-button::after { content: "✓"; font-size: 15px; font-weight: 900; line-height: 19px; }
@keyframes task-filter-exit {
  0% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
  28% { opacity: 1; transform: translateY(-2px) scale(1.01); }
  100% { opacity: 0; transform: translateY(-6px) scale(.96); filter: blur(1px); }
}
@keyframes check-complete {
  0% { transform: scale(1); }
  42% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
.check-button { flex: 0 0 25px; width: 25px; height: 25px; margin-top: 1px; padding: 0; border: 2px solid #abbab0; border-radius: 50%; background: transparent; color: var(--forest); }
.check-button:hover { border-color: var(--forest-2); background: var(--soft-green); }
.completed .check-button { border-color: var(--forest); background: var(--forest); color: var(--lime); }
.check-button::after { display: block; content: ""; }
.completed .check-button::after { content: "✓"; font-size: 15px; font-weight: 900; line-height: 19px; }
.task-content { min-width: 0; flex: 1; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 5px; }
.kind { display: inline-flex; align-items: center; min-height: 20px; border-radius: 6px; padding: 3px 7px; font-size: 10px; font-weight: 900; }
.kind.bug { background: #fae7e3; color: #a23d31; }
.kind.feature { background: #e4f0ff; color: #36618d; }
.kind.idea { background: #f1e9ff; color: #72519a; }
.task-title { margin: 0; overflow-wrap: anywhere; font-size: 15px; font-weight: 800; line-height: 1.45; }
.completed .task-title { text-decoration: line-through; text-decoration-thickness: 1px; }
.task-details { display: -webkit-box; overflow: hidden; margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.task-time { display: block; margin-top: 7px; color: #98a29d; font-size: 10px; }
.task-actions { display: flex; flex: 0 0 auto; align-items: flex-start; gap: 5px; }
.mini-button { border: 0; border-radius: 8px; background: transparent; color: #83908a; padding: 5px 6px; font-size: 16px; line-height: 1; }
.mini-button:hover { background: var(--soft-green); color: var(--forest); }
.drag-handle { display: grid; place-items: center; width: 31px; height: 31px; margin-top: -3px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: #82918a; touch-action: none; -webkit-touch-callout: none; user-select: none; }
.drag-handle:hover, .drag-handle.active { background: var(--soft-green); color: var(--forest); }
.drag-handle.active { background: var(--lime); }
.drag-grip { display: flex; flex-direction: column; gap: 3px; width: 16px; }
.drag-grip i { display: block; width: 16px; height: 2px; border-radius: 2px; background: currentColor; }
.empty-state { padding: 48px 22px; border: 1px dashed #bec9c2; border-radius: 18px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 15px; background: var(--lime); color: var(--forest); font-size: 26px; }
.empty-state h3 { margin: 0 0 5px; font-family: Georgia, "Noto Serif KR", serif; font-size: 20px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.footer-note { margin: 28px 0 0; color: #9aa59e; text-align: center; font-size: 11px; }

.auth-view { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(circle at 18% 8%, #507a61 0, #1c3d32 32%, #0c1815 75%); }
.auth-card { width: min(430px, 100%); padding: 38px; border-radius: 28px; background: var(--panel); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.auth-logo { width: 58px; height: 58px; font-size: 32px; }
.auth-card .eyebrow { margin: 23px 0 8px; }
.auth-card h1 { margin: 0 0 10px; font-family: Georgia, "Noto Serif KR", serif; font-size: 31px; }
.auth-card > p:not(.eyebrow):not(.error-text) { color: var(--muted); line-height: 1.6; }
.auth-card label, .form-row label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.auth-card input, .form-row input, .form-row select, .form-row textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--white); padding: 13px; color: var(--ink); outline: 0; }
.auth-card input:focus, .form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(35,101,80,.12); }
.auth-card button { width: 100%; margin-top: 12px; border: 0; border-radius: 13px; background: var(--forest); color: white; padding: 14px; font-weight: 800; }
.error-text { min-height: 20px; color: var(--danger); font-size: 13px; }

dialog { width: min(560px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 24px; box-shadow: 0 30px 90px rgba(0,0,0,.4); }
dialog::backdrop { background: rgba(7,18,15,.55); backdrop-filter: blur(3px); }
#taskForm { padding: 25px; }
.dialog-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dialog-title small { color: var(--forest-2); font-size: 11px; font-weight: 800; }
.dialog-title h2 { margin: 4px 0 0; font-family: Georgia, "Noto Serif KR", serif; }
.icon-button { border: 0; border-radius: 10px; background: #f0f2ed; color: var(--muted); padding: 8px 12px; font-size: 21px; line-height: 1; }
.form-row { margin-bottom: 13px; }
.form-row label span { color: #9aa59e; font-weight: 500; }
.form-row textarea { min-height: 100px; resize: vertical; }
.kind-buttons { display: flex; gap: 7px; }
.kind-button { flex: 1; min-height: 42px; border: 1px solid transparent; border-radius: 11px; padding: 0 12px; font-size: 12px; font-weight: 900; }
.kind-button.bug { border-color: #f1c9c3; background: #fae7e3; color: #a23d31; }
.kind-button.feature { border-color: #c9dcf4; background: #e4f0ff; color: #36618d; }
.kind-button.active { color: white; box-shadow: inset 0 -2px 0 rgba(0,0,0,.16), 0 0 0 2px rgba(23,72,58,.12); }
.kind-button.bug.active { border-color: #b34b3e; background: #d96758; }
.kind-button.feature.active { border-color: #476f9f; background: #5f89ba; }
.dialog-actions { display: flex; align-items: center; gap: 8px; margin-top: 20px; }
.dialog-actions span { flex: 1; }
.dialog-actions button { border: 0; border-radius: 11px; padding: 11px 15px; font-weight: 800; }
.save { background: var(--forest); color: white; }
.ghost { background: #edf0ec; color: var(--ink); }
.danger { background: var(--soft-danger); color: var(--danger); }
.toast { position: fixed; z-index: 20; right: 18px; bottom: 22px; left: 18px; width: fit-content; max-width: calc(100% - 36px); margin: auto; border-radius: 12px; background: #10241e; color: white; padding: 12px 18px; box-shadow: var(--shadow); font-size: 13px; text-align: center; }

@media (max-width: 600px) {
  .app { width: min(100% - 24px, 820px); padding: 14px 0 calc(28px + env(safe-area-inset-bottom)); }
  .topbar { margin-bottom: 15px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 13px; font-size: 23px; }
  .brand h1 { font-size: 19px; }
  .sync-status { display: none; }
  .quick-add { margin: 12px 0 21px; padding-left: 12px; }
  .quick-add textarea { min-height: 82px; font-size: 14px; }
  .quick-kind-actions, .quick-kind-button { width: 82px; flex-basis: 82px; }
  .quick-kind-button { min-height: 40px; }
  .toolbar { align-items: flex-end; }
  .filter-tabs { gap: 14px; }
  .sort-control { flex-direction: column; align-items: flex-end; gap: 3px; padding-bottom: 7px; }
  .list-heading { align-items: center; margin-top: 20px; }
  .list-heading h2 { font-size: 22px; }
  .list-heading p { font-size: 11px; }
  .task-card { padding: 14px 12px; gap: 11px; }
  .task-actions .mini-button { padding-right: 2px; padding-left: 2px; }
  .auth-card { padding: 30px 24px; }
  #taskForm { padding: 22px 18px; }
  .dialog-actions button { padding: 10px 12px; }
}
