:root {
  --ink: #172033;
  --muted: #64748b;
  --line: #d9e2ee;
  --surface: #fff;
  --page: #f5f7fb;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-pale: #eaf1ff;
  --red: #b42318;
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; background: var(--page); }

button, input, select, textarea { font: inherit; }

.app-shell { max-width: 860px; margin: 0 auto; padding: 24px 20px 48px; }
.app-navigation { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.view-nav { display: flex; gap: 5px; padding: 4px; background: #e8edf5; border-radius: 9px; }
.view-nav a { padding: 6px 9px; color: #53647a; border-radius: 6px; font-size: .78rem; font-weight: 800; text-decoration: none; }
.view-nav a.active { color: #174ea8; background: #fff; box-shadow: 0 1px 3px rgb(22 46 85 / 14%); }
.account-nav { display: flex; justify-content: flex-end; align-items: center; gap: 10px; color: var(--muted); font-size: .78rem; }
.account-nav a, .account-nav button { padding: 0; color: #40516a; border: 0; background: none; cursor: pointer; font: inherit; text-decoration: underline; }
.account-nav form { margin: 0; }

.topbar, .editor-topbar { margin: 4px 0 24px; }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: .75rem; font-weight: 800; letter-spacing: .08em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(1.55rem, 6vw, 2rem); letter-spacing: -.045em; }
h2 { margin-bottom: 6px; font-size: 1.45rem; letter-spacing: -.035em; }
h3 { margin-bottom: 5px; font-size: 1.03rem; letter-spacing: -.025em; }
.subtitle, .work-header p, .empty-state p { color: var(--muted); line-height: 1.55; margin-bottom: 0; }

.category-panel { padding: 17px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 14px rgb(34 55 90 / 4%); }
.category-row-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #53647a; font-size: .9rem; font-weight: 800; }
.sub-row { margin-top: 17px; padding-top: 15px; border-top: 1px solid #edf0f5; }
.category-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.category-button { display: inline-block; padding: 10px 14px; border: 1px solid #d3dde9; border-radius: 9px; color: #304058; background: #f6f8fb; font-size: .95rem; font-weight: 750; text-decoration: none; transition: .15s ease; }
.category-button:hover { background: #e9f0ff; border-color: #a7c3f7; }
.category-button.selected { color: #fff; background: var(--blue); border-color: var(--blue); }
.category-button.subcategory { background: #fff; }
.category-button.subcategory.selected { background: #0f766e; border-color: #0f766e; }
.sortable-category-buttons { min-height: 43px; touch-action: none; }
.sortable-category-buttons .category-button { cursor: grab; user-select: none; -webkit-user-select: none; }
.sortable-category-buttons .category-button:active { cursor: grabbing; }
.sortable-category-buttons .category-button.is-dragging { opacity: .42; transform: scale(.96); }
.sortable-category-buttons.is-drag-over { outline: 2px dashed #89aef1; outline-offset: 4px; border-radius: 10px; }
.category-sort-help { margin: 9px 0 0; color: var(--muted); font-size: .76rem; }

.inline-details summary { color: var(--blue); cursor: pointer; font-size: .85rem; font-weight: 750; list-style: none; }
.inline-details summary::-webkit-details-marker { display: none; }
.compact-form { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; width: min(100%, 365px); margin-top: 10px; padding: 10px; background: #f5f8fd; border: 1px solid #dce6f5; border-radius: 9px; }
.compact-form label { width: 100%; color: var(--muted); font-size: .78rem; font-weight: 700; }
.compact-form input { flex: 1 1 180px; min-width: 0; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 15px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-weight: 800; font-size: .93rem; text-decoration: none; }
.button.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { color: #40516a; background: #fff; border-color: #cad5e3; }
.button.small { min-height: 35px; padding: 7px 11px; font-size: .84rem; }
.text-button { padding: 4px; border: 0; background: transparent; cursor: pointer; font: inherit; color: var(--muted); font-size: .82rem; }
.danger { color: var(--red); }

.empty-state { margin-top: 22px; padding: 40px 24px; text-align: center; background: var(--surface); border: 1px dashed #cbd7e6; border-radius: 14px; }
.empty-icon { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 auto 11px; color: var(--blue); background: var(--blue-pale); border-radius: 50%; font-weight: 800; }
.empty-state h2 { font-size: 1.18rem; }
.task-empty { margin-top: 10px; }

.work-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 26px 0 12px; }
.root-overview-header { margin-bottom: 9px; }
.task-category-group { margin-top: 25px; padding-top: 19px; border-top: 1px solid #dfe7f1; }
.task-category-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 13px; margin-bottom: 11px; }
.task-category-heading h2 { margin-bottom: 4px; font-size: 1.15rem; }
.task-category-heading p { margin: 0; color: var(--muted); font-size: .85rem; }
.task-category-heading .button { flex: 0 0 auto; white-space: nowrap; }
.task-category-empty { margin: 0; padding: 13px; color: var(--muted); background: #f8fafc; border: 1px dashed #d7e0ec; border-radius: 9px; font-size: .86rem; }
.page-header { margin: 4px 0 22px; }
.summary-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.summary-strip span { padding: 7px 9px; color: #53647a; background: #eaf0f8; border-radius: 7px; font-size: .82rem; }
.summary-strip strong { color: #1d4ed8; }
.work-header .button { white-space: nowrap; }
.category-manage, .manage-actions { display: flex; align-items: center; gap: 15px; }
.category-manage { margin: 0 0 10px; }
.manage-details .compact-form { margin-top: 7px; }

.task-list { display: grid; gap: 11px; }
.task-card { position: relative; padding: 16px 16px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 2px 9px rgb(34 55 90 / 3%); }
.clickable-card { cursor: pointer; transition: transform .14s ease, box-shadow .14s ease; }
.clickable-card:hover, .clickable-card:focus { transform: translateY(-1px); box-shadow: 0 6px 17px rgb(34 55 90 / 10%); outline: none; }
.task-card.done { background: #fbfcfd; opacity: .68; }
.task-card.done h3 { text-decoration: line-through; }
.task-card-top { display: grid; grid-template-columns: 27px minmax(0, 1fr) auto; align-items: start; gap: 9px; }
.check-button { display: grid; place-items: center; width: 23px; height: 23px; padding: 0; color: #fff; background: #fff; border: 2px solid #9aaac1; border-radius: 50%; cursor: pointer; font-weight: 900; }
.done .check-button { background: #16a34a; border-color: #16a34a; }
.task-title-area { min-width: 0; }
.task-title-area h3 { word-break: break-word; }
.task-title-link { color: inherit; text-decoration: none; }
.task-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .79rem; }
.priority { padding: 2px 6px; border-radius: 4px; background: #eef2f7; font-weight: 750; }
.priority.높음 { color: #b42318; background: #fff0ef; }
.priority.보통 { color: #1d4ed8; background: #eaf1ff; }
.priority.낮음 { color: #3f6c38; background: #edf8e9; }
.edit-link { color: var(--blue); font-size: .85rem; font-weight: 800; text-decoration: none; }
.task-description { margin: 13px 0 0 36px; color: #53647a; font-size: .91rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.shortcut-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0 36px; }
.shortcut-list a, .copy-link { padding: 6px 8px; color: #245fc4; background: #edf4ff; border: 0; border-radius: 6px; cursor: pointer; font-size: .8rem; font-weight: 750; text-decoration: none; }
.delete-task { position: absolute; right: 14px; bottom: 8px; }
.all-task-card { display: block; padding: 15px; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 9px rgb(34 55 90 / 3%); text-decoration: none; transition: transform .14s ease, box-shadow .14s ease; }
.all-task-card:hover { transform: translateY(-1px); box-shadow: 0 6px 17px rgb(34 55 90 / 10%); }
.all-task-card.done { opacity: .65; }
.all-task-card.done h2 { text-decoration: line-through; }
.all-task-card-top { display: flex; justify-content: space-between; gap: 12px; }
.all-task-card h2 { margin: 0 0 8px; font-size: 1.02rem; }
.task-path { margin-bottom: 5px; color: #3561a7; font-size: .77rem; font-weight: 800; }
.detail-arrow { color: #7891b2; font-size: 1.75rem; line-height: 1; }
.all-task-description { margin: 11px 0 0; color: #53647a; font-size: .88rem; line-height: 1.5; white-space: pre-wrap; }

.calendar-header { margin-bottom: 17px; }
.month-navigation { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 8px; text-align: center; }
.month-navigation h1 { margin-bottom: 4px; }
.month-button { display: grid; place-items: center; width: 40px; height: 40px; color: #32517d; background: #fff; border: 1px solid #ccd8e8; border-radius: 9px; font-size: 1.7rem; text-decoration: none; }
.calendar-wrap { overflow-x: auto; padding: 1px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(105px, 1fr)); min-width: 735px; }
.weekdays { color: #607089; font-size: .78rem; font-weight: 800; text-align: center; }
.weekdays span { padding: 8px 2px; }
.weekdays span:first-child { color: #dc2626; }
.weekdays span:last-child { color: #2563eb; }
.month-grid { border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: #fff; }
.calendar-day { min-height: 126px; padding: 7px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calendar-day.other-month { background: #fafbfd; }
.calendar-day.other-month .day-number { color: #aeb9c8; }
.day-number { display: grid; place-items: center; width: 24px; height: 24px; margin-bottom: 4px; color: #52637b; border-radius: 50%; font-size: .79rem; font-weight: 800; }
.day-number.today { color: #fff; background: var(--blue); }
.calendar-day:nth-child(7n + 1) .day-number:not(.today) { color: #dc2626; }
.calendar-day:nth-child(7n) .day-number:not(.today) { color: #2563eb; }
.calendar-task-list { display: grid; gap: 4px; }
.calendar-task { overflow: hidden; padding: 4px 5px; color: #315485; background: #eaf1ff; border-radius: 4px; font-size: .71rem; font-weight: 700; line-height: 1.3; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.calendar-task span { color: #0f766e; }
.calendar-task.done { color: #7a8798; background: #edf0f4; text-decoration: line-through; }
.calendar-help { margin: 13px 0 0; color: var(--muted); font-size: .82rem; text-align: center; }
.calendar-help a { color: var(--blue); font-weight: 800; }

.detail-header { margin-bottom: 19px; }
.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.detail-title-row h1 { word-break: break-word; }
.completed-title { color: #64748b; text-decoration: line-through; }
.detail-meta { margin-top: 6px; }
.detail-card { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 13px; }
.detail-section { padding: 19px; border-bottom: 1px solid #e8edf4; }
.detail-section:last-child { border-bottom: 0; }
.detail-section h2 { margin-bottom: 10px; color: #52637b; font-size: .85rem; }
.detail-description { margin: 0; color: #26364d; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.detail-empty { margin: 0; color: #94a3b8; font-size: .9rem; }
.path-value { display: block; overflow-wrap: anywhere; padding: 9px; color: #3e4f66; background: #f5f7fa; border-radius: 7px; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; line-height: 1.5; }
.detail-copy { margin-top: 9px; }
.project-link { display: block; overflow-wrap: anywhere; color: #1f5fc0; font-size: .91rem; line-height: 1.5; }

.back-link { display: inline-block; margin-bottom: 18px; color: #40516a; font-size: .9rem; font-weight: 750; text-decoration: none; }
.login-card { max-width: 420px; margin: 12vh auto 0; padding: 27px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 10px 30px rgb(34 55 90 / 8%); }
.login-form { margin-top: 25px; }
.login-form label { display: block; margin: 18px 0 7px; color: #314158; font-size: .9rem; font-weight: 800; }
.login-button { width: 100%; margin-top: 25px; }
.task-form { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 11px; margin: 20px 0 7px; }
.task-form .field-label-row label { margin: 0; }
.field-label-row.title-field-label { margin-top: 0; }
.field-voice-button { flex: 0 0 auto; min-height: 32px; padding: 6px 9px; color: #1e4fa6; background: #edf4ff; border: 1px solid #aec8f5; border-radius: 7px; cursor: pointer; font-size: .79rem; font-weight: 800; }
.field-voice-button.is-listening { color: #fff; background: #c0262d; border-color: #c0262d; animation: voice-pulse 1.25s infinite; }
.field-voice-button:disabled { color: #64748b; background: #e7edf6; border-color: #d6deea; cursor: not-allowed; animation: none; }
.voice-status { min-height: 1.2rem; margin: 7px 0 0; color: #4d607b; font-size: .78rem; }
@keyframes voice-pulse { 50% { box-shadow: 0 0 0 5px rgb(192 38 45 / 15%); } }
.scan-panel { margin: 0 0 23px; padding: 13px; background: #f8f7ff; border: 1px solid #ddd9fb; border-radius: 10px; }
.scan-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scan-heading span { color: #5b3fc8; font-size: .91rem; font-weight: 850; }
.scan-heading p { margin: 3px 0 0; color: #665f84; font-size: .78rem; line-height: 1.4; }
.scan-trigger { flex: 0 0 auto; min-height: 36px; padding: 7px 10px; font-size: .83rem; white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.scan-result { display: flex; gap: 10px; align-items: flex-start; margin-top: 11px; }
.note-preview { width: 74px; height: 58px; object-fit: cover; border: 1px solid #ccc7f0; border-radius: 7px; }
.scan-status { min-height: 1.2rem; margin: 1px 0 0; color: #5d567a; font-size: .78rem; line-height: 1.45; }
.task-form label { display: block; margin: 20px 0 7px; color: #314158; font-size: .9rem; font-weight: 800; }
.task-form > label:first-of-type { margin-top: 0; }
input, textarea, select { width: 100%; padding: 11px 12px; color: var(--ink); background: #fff; border: 1px solid #bcc9d9; border-radius: 8px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: #5488e9; box-shadow: 0 0 0 3px rgb(37 99 235 / 12%); }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid label { margin-top: 20px; }
.link-fields { margin-top: 27px; padding-top: 3px; border-top: 1px solid #e9eef5; }
.link-section-title { margin-top: 20px; }
.link-section-title span { font-weight: 850; }
.link-section-title p, .field-help { margin: 4px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.field-help { margin-top: 6px; }
.field-error, .validation-summary { color: var(--red); font-size: .79rem; }
.success-message { margin: 0 0 18px; padding: 11px; color: #176b3a; background: #ebf8ef; border-radius: 8px; font-size: .9rem; font-weight: 700; }
.field-error:empty, .validation-summary:empty { display: none; }
.validation-summary ul { margin: 0 0 12px; padding-left: 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 28px; }

@media (max-width: 560px) {
  .app-shell { padding: 19px 14px 38px; }
  .app-navigation { align-items: flex-start; flex-direction: column-reverse; gap: 8px; }
  .account-nav { width: 100%; justify-content: flex-end; }
  .category-panel { padding: 14px; border-radius: 12px; }
  .category-button { padding: 9px 11px; font-size: .9rem; }
  .work-header { align-items: flex-start; }
  .work-header .button { padding: 10px 11px; font-size: .86rem; }
  .task-card { padding: 14px 13px 13px; }
  .task-description, .shortcut-list { margin-left: 0; }
  .delete-task { position: static; margin: 11px 0 0 35px; }
  .all-task-card { padding: 13px; }
  .calendar-wrap { overflow-x: hidden; margin-right: -14px; margin-left: -14px; padding: 0 14px 5px; }
  .calendar-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 0; width: 100%; }
  .weekdays { font-size: .7rem; }
  .weekdays span { padding: 6px 0; }
  .calendar-day { min-height: 76px; padding: 3px 2px; }
  .day-number { width: 20px; height: 20px; margin: 0 auto 2px; font-size: .7rem; }
  .calendar-task-list { gap: 2px; }
  .calendar-task { padding: 3px 2px; font-size: .58rem; line-height: 1.2; }
  .calendar-task span { display: none; }
  .detail-title-row .button { padding: 9px 11px; font-size: .85rem; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .form-grid label { margin-top: 18px; }
  .field-voice-button { padding: 6px 8px; font-size: .76rem; }
  .scan-heading { align-items: flex-start; }
  .scan-trigger { padding: 7px 8px; font-size: .78rem; }
}
