/* 업무 관리 — 블로그(hansolyou.com)와 같은 담백한 분위기 */
:root {
  --text: #222;
  --muted: #999;
  --line: #ececec;
  --rule: #222;   /* 구역 위쪽에만 들어가는 진한 선 */
  --soft: #f6f6f5;
  --accent: #222;
  --warn: #c2410c;
  --ok: #3f7d4e;
}

* { box-sizing: border-box; border-radius: 0; }

body {
  max-width: 880px;
  margin: 0 auto;
  padding: 36px 20px 80px;
  font-family: -apple-system, "Apple SD Gothic Neo", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
h1 { font-size: 26px; margin: 0 0 24px; letter-spacing: -0.02em; }
.today-title { display: flex; align-items: baseline; gap: 10px; }
.today-title .label { font-size: 15px; font-weight: 500; color: var(--muted); }
.today-title .date { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0; }
h2 { font-size: 15px; margin: 36px 0 10px; color: var(--muted); font-weight: 600; }
h2:first-child { margin-top: 0; }
main > section { margin-top: 40px; border-top: 1px solid var(--rule); padding-top: 14px; }
main > section.cards { border-top: 0; padding-top: 0; }
main > section > h2 { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* 상단 */
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 48px; }
.logo { font-weight: 700; text-decoration: none; font-size: 18px; }
.top nav { display: flex; gap: 18px; font-size: 15px; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover, .top nav a.active { color: var(--text); }

/* 제목 줄 + 버튼 */
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.head h1 { margin: 0; }

/* 버튼, 입력칸 */
button, .btn {
  font: inherit; font-size: 14px; cursor: pointer;
  border: 1px solid var(--text); background: var(--text); color: #fff;
  padding: 7px 14px; border-radius: 0; text-decoration: none; display: inline-block; line-height: 1.4;
}
button.ghost, .btn.ghost { background: #fff; color: var(--text); border-color: #d6d6d6; }
button.ghost:hover, .btn.ghost:hover { border-color: var(--text); }
button.danger { background: #fff; color: var(--warn); border-color: #f0c9b5; }
button.link { border: 0; background: none; color: var(--muted); padding: 0 4px; }
button.link:hover { color: var(--text); }
button:disabled { opacity: .5; cursor: default; }

input, select, textarea {
  font: inherit; font-size: 15px; color: var(--text);
  border: 1px solid #dcdcdc; border-radius: 0; padding: 7px 10px; background: #fff; width: 100%;
}
input:not([type=checkbox]), select { height: 40px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); }
textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
/* 체크박스·선택칸도 각지게 (브라우저 기본 모양 대신) */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 17px; height: 17px; margin: 0; flex-shrink: 0; cursor: pointer;
  border: 1.5px solid #bbb; background: #fff; display: inline-grid; place-content: center; padding: 0;
}
input[type="checkbox"]:hover { border-color: var(--text); }
input[type="checkbox"]:checked { background: var(--text); border-color: var(--text); }
input[type="checkbox"]:checked::after {
  content: ""; width: 8px; height: 4px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-1px) rotate(-45deg);
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E") no-repeat right 11px center;
}

.form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form .wide { grid-column: 1 / -1; }
.form .two { grid-column: span 2; }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.actions .spacer { flex: 1; }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .meta { font-size: 13px; color: var(--muted); white-space: nowrap; }
.list .meta a { color: var(--muted); text-decoration: none; }
.list .meta a:hover { color: var(--text); }
.list li.done .title { color: var(--muted); text-decoration: line-through; }
.list li.deadline .title { font-weight: 600; }
.list .title[contenteditable] { outline: none; border-radius: 0; }
.list .title[contenteditable]:focus { box-shadow: inset 0 -1px 0 var(--rule); }

.group-overdue h2 { color: var(--warn); }
.badge { font-size: 12px; padding: 1px 6px; border-radius: 0; background: transparent; color: #777; white-space: nowrap; font-weight: 500; }
.badge.progress { background: #222; color: #fff; }
.badge.quote, .badge.sent { color: #a06400; }
.badge.done, .badge.accepted { color: var(--ok); }
.badge.hold, .badge.rejected { color: #aaa; }
.dday { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dday.soon { color: var(--warn); }

/* 할 일 빠른 추가 */
.quick { display: grid; grid-template-columns: 1fr 180px 150px auto; gap: 8px; margin-bottom: 8px; }
.quick.preset { grid-template-columns: 1fr 150px auto; }

/* 표 */
table { width: 100%; border-collapse: collapse; font-size: 15px; border-top: 1px solid var(--rule); }
th { text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid #ddd; white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.date { font-variant-numeric: tabular-nums; white-space: nowrap; color: #555; font-size: 14px; }
tr.click { cursor: pointer; }
tr.click:hover a { text-decoration: underline; }
.table-wrap { overflow-x: auto; }

.tabs { display: flex; gap: 14px; margin-bottom: 16px; font-size: 14px; flex-wrap: wrap; }
.tabs a { color: var(--muted); text-decoration: none; }
.tabs a.active { color: var(--text); font-weight: 600; }

/* 견적 편집 */
.items td { padding: 6px 4px; }
.items input { padding: 6px 8px; }
.items .period { width: 120px; }
.items .amount { width: 150px; }
.items td:last-child { width: 30px; text-align: center; }
.calc { border-top: 1px solid var(--rule); padding: 14px 0 0; margin-top: 28px; font-size: 15px; }
.calc .row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.calc .row span:last-child { font-variant-numeric: tabular-nums; }
.calc .total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; font-weight: 700; font-size: 17px; }

.empty { color: var(--muted); font-size: 15px; padding: 12px 0; margin: 0; }

/* 알림 */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #222; color: #fff; padding: 9px 16px; border-radius: 0; font-size: 14px;
  opacity: 0; transition: .2s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--warn); }

/* 견적서 (인쇄용) */
.doc { max-width: 720px; margin: 0 auto; }
.doc-title { font-size: 30px; letter-spacing: 0.3em; text-align: center; margin: 8px 0 36px; }
.doc-info { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; font-size: 15px; }
.doc-info dl { margin: 0; align-content: start; display: grid; grid-template-columns: 72px 1fr; gap: 4px 12px; }
.doc-info dt { color: var(--muted); }
.doc-info dd { margin: 0; }
.doc-sum { margin: 24px 0 0 auto; width: 300px; font-size: 15px; }
.doc-sum .row { display: flex; justify-content: space-between; padding: 4px 0; }
.doc-sum .row span:last-child { font-variant-numeric: tabular-nums; }
.doc-sum .total { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 18px; }
.doc-note { margin-top: 36px; font-size: 14px; color: #555; white-space: pre-wrap; border-top: 1px solid var(--line); padding-top: 16px; }
.doc .detail { font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.print-bar { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 32px; }

@media print {
  body { padding: 0; max-width: none; }
  .top, .print-bar, #toast { display: none !important; }
  @page { margin: 18mm 16mm; }
}

/* 홈: 프로젝트 카드 */
.cards { margin-top: 8px; }
.card { border-top: 1px solid var(--rule); padding: 0 0 6px; margin-bottom: 40px; }
.card-head { display: flex; gap: 16px; align-items: center; padding: 16px 0 14px; min-height: 80px; }
.card-head .grow { flex: 1; min-width: 0; }
.card-client { font-size: 13px; color: var(--muted); line-height: 1.4; margin-bottom: 4px; }
.card-title { font-size: 19px; font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
a.card-title:hover { text-decoration: underline; }
.card-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.card-dates { font-size: 13px; color: var(--muted); white-space: nowrap; }
.card .list li { padding: 8px 0; }
.card .list li:last-child { border-bottom: 0; }
.card .empty { padding: 6px 0; }
.card.loose .card-title { color: #555; }
.card.loose .card-head { min-height: 0; }
.list li.overdue .inline-date { color: var(--warn); }

/* 카드 안 할 일 추가 칸: 평소엔 조용하게 */
.quick.compact { grid-template-columns: 1fr 140px auto; gap: 6px; margin: 4px 0 4px; border-top: 1px solid var(--line); padding-top: 8px; }
.quick.compact input { height: 34px; font-size: 14px; border-color: transparent; padding: 4px 6px; }
.quick.compact input:hover { border-color: #e4e4e4; }
.quick.compact input:focus { border-color: var(--text); }
.quick.compact input[type=date] { color: var(--muted); }
.quick.compact button { font-size: 13px; padding: 4px 12px; background: #fff; color: var(--text); border-color: #d6d6d6; }
.quick.compact button:hover { border-color: var(--text); }

.done-today { margin-top: 24px; }
.done-today summary { cursor: pointer; color: var(--muted); font-size: 14px; }

/* 달력 */
.cal { margin-bottom: 32px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cal-head strong { font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.cal-nav { padding: 3px 10px; font-size: 13px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 14px 8px; }
.cal-dow { font-size: 12px; color: var(--muted); padding: 0; margin-bottom: -6px; }
.cal-day { min-height: 74px; padding: 6px 0 0; border-top: 1px solid var(--rule); font-size: 12px; min-width: 0; }
.cal-day.other { border-top-color: #d8d8d8; }
.cal-day.other .cal-num { color: #ccc; }
.cal-num { display: inline-block; min-width: 22px; height: 20px; line-height: 20px; text-align: left; padding: 0 2px; border-radius: 0; font-variant-numeric: tabular-nums; color: #333; font-weight: 600; }
.cal-dow.sun, .cal-day.sun .cal-num { color: #c75a3a; }
.cal-day.today .cal-num { background: var(--text); color: #fff; text-align: center; }
.ev { display: block; font-size: 11.5px; line-height: 1.4; padding: 1px 4px 1px 2px; margin-top: 2px; border-radius: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.ev-due { background: var(--text); color: #fff; }
.ev-done { color: #aaa; text-decoration: line-through; }
.ev-due { padding-left: 4px; }
.ev-task { color: #333; }
.ev-task.late { color: var(--warn); }
.ev-more { font-size: 11px; color: var(--muted); padding-left: 5px; }
.cal-legend { display: flex; gap: 8px; margin: 8px 0 0; }
.cal-legend .ev { display: inline-block; margin: 0; }

/* 모바일 */
@media (max-width: 640px) {
  body { padding: 24px 16px 60px; }
  .top { margin-bottom: 32px; }
  .top nav { gap: 14px; }
  .form { grid-template-columns: 1fr 1fr; }
  .form .two { grid-column: 1 / -1; }
  .quick { grid-template-columns: 1fr 1fr; }
  .quick input[name="title"] { grid-column: 1 / -1; }
  .quick button { grid-column: 1 / -1; }
  .quick.preset { grid-template-columns: 1fr 1fr; }
  .quick.compact { grid-template-columns: 1fr auto auto; }
  .quick.compact input[type=date] { width: 120px; }
  .quick.compact input[name=title] { grid-column: auto; }
  .card { margin-bottom: 32px; }
  .card-head { padding: 12px 0 10px; align-items: flex-start; text-align: left; min-height: 0; }
  .card-head .grow { width: 100%; }
  .card-head { flex-direction: column; gap: 6px; }
  .card-side { flex-direction: row; align-items: center; gap: 8px; }
  .cal-grid { gap: 10px 4px; }
  .cal-day { min-height: 44px; padding: 4px 0 0; }
  .cal-day .ev { display: inline-block; font-size: 0; width: 7px; height: 7px; padding: 0; margin: 1px; border-radius: 0; vertical-align: middle; }
  .cal-day .ev-done { background: #ddd; }
  .cal-day .ev-more { display: none; }
  .cal-num { display: block; width: 22px; margin: 0 0 2px; }
  .cal-day .ev-task { background: #bbb; }
  .cal-day .ev-task.late { background: var(--warn); }
  .list .inline-date { width: 104px; font-size: 12px; padding: 2px 2px; }
  .quick.compact input[type=date] { width: 112px; }
  .quick.preset button { grid-column: auto; }
  .hide-m { display: none; }
  .doc-info { grid-template-columns: 1fr; }
  .doc-sum { width: 100%; }
}

/* 할 일 줄의 날짜 칸: 평소엔 글자처럼, 누르면 달력 */
.inline-date {
  height: auto !important; width: 132px; flex-shrink: 0; border: 1px solid transparent; background: transparent;
  font-size: 13px; color: var(--muted); padding: 2px 6px; font-variant-numeric: tabular-nums;
}
.inline-date:hover, .inline-date:focus { border-color: #dcdcdc; color: var(--text); }
.group-overdue .inline-date { color: var(--warn); }
details summary::-webkit-details-marker { color: var(--muted); }

/* 날짜 칸: 26.10.22.목 형식으로 보이게 (실제 달력은 브라우저 기본) */
.date-field {
  position: relative; display: flex; align-items: center; width: 100%; height: 40px; padding: 0 28px 0 10px;
  border: 1px solid #dcdcdc; background: #fff; font-size: 15px; font-variant-numeric: tabular-nums; cursor: pointer; color: var(--text);
}
.date-field:hover, .date-field:focus-within { border-color: var(--text); }
.date-field input { position: absolute; inset: 0; width: 100%; height: 100% !important; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.date-field.empty .date-text { color: #aaa; }
.date-clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); z-index: 1; border: 0; background: none; color: #bbb; padding: 0 4px; font-size: 14px; line-height: 1; }
.date-clear:hover { color: var(--text); }
.date-field.empty .date-clear { display: none; }

/* 할 일 줄 안의 날짜: 글자처럼 */
.date-field.inline { width: 120px; flex-shrink: 0; height: 26px; border-color: transparent; font-size: 13px; color: var(--muted); padding: 0 22px 0 6px; }
.date-field.inline:hover { border-color: #dcdcdc; color: var(--text); }
.date-field.inline.empty .date-text { color: #ccc; }
.list li.overdue .date-field.inline { color: var(--warn); }
.quick.compact .date-field { height: 34px; font-size: 14px; border-color: transparent; color: var(--muted); }
.quick.compact .date-field:hover, .quick.compact .date-field:focus-within { border-color: #dcdcdc; }
@media (max-width: 640px) {
  .date-field.inline { width: 100px; font-size: 12px; padding: 0 18px 0 2px; }
}
/* 할 일 줄·추가 칸의 날짜 지우기(×)는 날짜에 마우스를 올렸을 때만 */
.date-field.inline .date-clear, .quick.compact .date-clear { visibility: hidden; }
.date-field.inline:hover .date-clear, .quick.compact .date-field:hover .date-clear { visibility: visible; }
@media (hover: none) { .date-field.inline .date-clear { display: none; } }

/* 로그인 화면 */
body.logged-out .top nav { visibility: hidden; }
.login { max-width: 320px; margin: 80px auto 0; border-top: 1px solid var(--rule); padding-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 22px; margin: 0; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.login button { align-self: flex-start; }
.login-msg { color: var(--warn); margin: 0; min-height: 1.4em; }

/* 달력: 할 일 앞 클라이언트·프로젝트 짧은 이름 */
.ev-tag { display: block; font-size: 10.5px; line-height: 1.3; color: var(--muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.ev.ev-task, .ev.ev-done { margin-top: 4px; }
.ev-done .ev-tag { color: #c4c4c4; }

/* 할 일 수정 칸 */
.list li .link.small { font-size: 12px; color: #bbb; }
.list li .link.small:hover { color: var(--text); }
.list li.editing { padding: 8px 0; }
.task-edit { display: grid; grid-template-columns: 1fr 200px 130px auto auto; gap: 6px; width: 100%; }
.task-edit input, .task-edit select { height: 34px; font-size: 14px; padding: 4px 8px; }
.task-edit select { padding-right: 26px; }
.task-edit .date-field { height: 34px; font-size: 14px; }
.task-edit button { font-size: 13px; padding: 4px 12px; }

/* 프로젝트: 클라이언트 */
td.client { color: #555; white-space: nowrap; }
.page-client { margin: 0 0 2px; font-size: 14px; color: var(--muted); }

@media (max-width: 640px) {
  .task-edit { grid-template-columns: 1fr 1fr; }
  .task-edit input[name=title] { grid-column: 1 / -1; }
}
