:root {
  /* docs/mockups 의 색 */
  --bg: #f4f5f3;
  --surface: #ffffff;
  --ink: #1c2420;
  --muted: #69726d;
  --line: #e1e5e1;
  --accent: #1f5f4a;
  --accent-ink: #ffffff;
  --late: #b42318;
  --late-bg: #fdecea;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--ink); }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.who { display: flex; gap: 12px; align-items: center; margin: 0; color: var(--muted); }

main { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }
section { margin-bottom: 20px; }

button, .button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-block; padding: 6px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink); cursor: pointer;
}
button:hover, .button:hover { border-color: var(--muted); text-decoration: none; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
input, select, textarea {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink);
  max-width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 8px 12px; border-radius: 6px; background: #e6f2ee; border: 1px solid #b9d8cf; }
.messages li.error { background: var(--late-bg); border-color: #f3b8b2; }
.error { color: var(--late); }

.count {
  display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 11px;
  background: var(--line); font-size: 12px; font-weight: 600; text-align: center; vertical-align: middle;
}

/* 오늘 처리할 것 */
.todo { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.todo ul { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; gap: 10px; align-items: baseline; padding: 5px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.todo li:first-child { border-top: 0; }
.todo p { margin: 0; }

/* 목록 */
.listhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.filters { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 160px; min-width: 100px; }
.filters select { flex: 0 1 auto; min-width: 0; }
.filters button, .filters a { flex: none; white-space: nowrap; }

.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.projects { width: 100%; border-collapse: collapse; }
.projects th, .projects td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.projects th { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.projects tbody tr:last-child td { border-bottom: 0; }
.projects tbody tr:hover { background: #faf9f6; }
.projects tr.done td, .projects tr.done a { color: var(--muted); }
.empty { padding: 32px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* 상태 표시 */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; background: #eceae4; color: #44403c; }
.badge.s-inquiry { background: #e8eefc; color: #1e3a8a; }
.badge.s-quoting { background: #e6f0fa; color: #0c4a6e; }
.badge.s-waiting_client { background: #fdf0d5; color: #7a4a00; }
.badge.s-revision { background: #fde5d0; color: #8a3c00; }
.badge.s-nearly { background: #e3f3e3; color: #1b5e20; }
.badge.s-open_for_booking { background: #e6f2ee; color: #1f5f5b; }
.badge.s-confirmed { background: #1f5f5b; color: #ffffff; }
.badge.s-in_travel { background: #4a3f8f; color: #ffffff; }
.badge.s-closed, .badge.s-cancelled { background: #eceae4; color: #6b7280; }
.badge.s-cancelled { text-decoration: line-through; }
.badge.late { background: var(--late-bg); color: var(--late); font-weight: 600; }
.latetext { color: var(--late); font-weight: 600; }

/* 상세 상단 요약 */
.summary {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.summaryhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.summaryhead p { margin: 0; font-size: 12px; }
.summaryhead h1 { overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 14px 0; }
.facts .wide { grid-column: span 2; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; }
.quick { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.quick label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.quick .grow { flex: 1; min-width: 200px; }
.quick .grow input { width: 100%; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { padding: 6px 12px; border-radius: 6px; color: var(--ink); }
.tabs a:hover { background: var(--line); text-decoration: none; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; scroll-margin-top: 240px; }
.panel p { margin: 0; }
.twocol { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { padding: 4px 0; border-top: 1px solid var(--line); }
.events li:first-child { border-top: 0; }
.details { margin: 0; }
.details dt { font-size: 12px; color: var(--muted); margin-top: 8px; }
.details dt:first-child { margin-top: 0; }
.details dd { margin: 0; }

/* 입력 화면 */
.formpage { max-width: 860px; }
.formpage > p { margin: 4px 0 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 0 0 16px; padding: 12px 16px 16px; }
legend { padding: 0 6px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; }
.field.check { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.field.check label { order: 2; margin: 0; font-size: 14px; color: var(--ink); }
.field.check .help { order: 3; flex-basis: 100%; }
.field .help, .field .error { margin: 2px 0 0; font-size: 12px; }
.field .help { color: var(--muted); }
.field.haserror input, .field.haserror select { border-color: var(--late); }
.grid + .field { margin-top: 12px; }
.actions { display: flex; gap: 16px; align-items: center; }

.login { max-width: 320px; margin: 60px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.login label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }

@media (max-width: 720px) {
  main { padding: 16px; }
  .topbar { padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
  .summary { position: static; }
  .twocol { grid-template-columns: 1fr; }
  .filters { flex-wrap: wrap; }
  .facts .wide { grid-column: auto; }
}

/* 코테이션 */
.panelhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.panelhead h2 { margin: 0; }
.r { text-align: right !important; }
table.plain { width: 100%; border-collapse: collapse; }
.plain th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; padding: 4px 8px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.plain td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.plain tbody tr:last-child td { border-bottom: 0; }
.badge.q-draft { background: #fdf0d5; color: #7a4a00; }
.badge.q-sent { background: #e6f0fa; color: #0c4a6e; }
.badge.q-confirmed { background: #1f5f5b; color: #fff; }
.badge.q-superseded { background: #eceae4; color: #6b7280; }

.quotebar h1 .badge { vertical-align: middle; font-weight: 400; }
.buttons { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.small { padding: 3px 10px; font-size: 12px; }
.totals { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 0; }
.total { min-width: 200px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: #faf9f6; }
.total p { margin: 0; font-size: 12px; }
.total .big { font-size: 20px; font-weight: 700; margin: 2px 0; }
.total.blocked { border-color: #f3b8b2; background: var(--late-bg); }
.total.blocked .big { color: var(--late); }
.total form { margin: 6px 0 0; }
.total .links { margin-top: 6px; }
.checks { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.checks li { padding: 2px 0 2px 18px; position: relative; }
.checks li::before { content: "●"; position: absolute; left: 2px; font-size: 10px; top: 5px; }
.checks .block { color: var(--late); }
.checks .warn { color: #8a5a00; }
.flow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.flow form { margin: 0; display: flex; gap: 6px; }
.flow .skeleton { margin-left: auto; }
.flow .skeleton input { width: 150px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.danger { color: var(--late); }

fieldset.quote { border: 0; padding: 0; margin: 0; background: none; min-width: 0; }
.tablescroll { overflow-x: auto; }
.edit td { padding: 3px 4px; }
.edit input, .edit select, .edit textarea { width: 100%; min-width: 70px; padding: 4px 6px; }
.edit input[type=checkbox] { width: auto; min-width: 0; }
.edit input.narrow, .edit td.c-start_day input, .edit td.c-end_day input, .edit td.c-quantity input { width: 62px; min-width: 62px; }
.edit td.c-unit_price input, .edit td.c-breakfast_price input { min-width: 100px; text-align: right; }
.edit td.c-client_label input, .edit td.c-supplier_text input, .edit td.c-note input { min-width: 150px; }
.edit td.wide { width: 60%; }
.edit tr.newrow td { background: #faf9f6; }
.edit tr.haserror input, .edit tr.haserror select { border-color: var(--late); }
.edit tr.errorrow td { color: var(--late); font-size: 12px; padding: 0 8px 6px; }
fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background: #f3f2ee; color: var(--ink); }
.choice { display: block; padding: 6px 0; }
fieldset h3 { font-size: 12px; color: var(--muted); margin: 14px 0 2px; }
.panel .help { margin-top: 8px; font-size: 12px; color: var(--muted); }
.panel .grid { margin-bottom: 12px; }

.summary.static { position: static; }
.savebar {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
  padding: 10px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.edit td:has(> input[name$="-day_no"]) { width: 80px; }
.edit input[name$="-day_no"] { width: 62px; min-width: 62px; }

/* 홈: 프로젝트 목록 (docs/mockups/jigi-home-mockup.html) */
main.wide { max-width: 1400px; }
.brand { color: var(--accent); font-size: 16px; }
.years { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.yr { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 14px; font-size: 13px; }
.yr.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.filterform { margin: 0; }
.filterform .filters { flex-wrap: wrap; }
.filterform .filters input[type=search] { flex: 1 1 220px; min-width: 200px; }
.filterform input, .filterform select { border-radius: 8px; padding: 7px 10px; }
.listcount { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
table.projects { min-width: 1050px; }
.projects th { padding: 10px 12px; background: #fafbf9; }
.projects td { padding: 11px 12px; white-space: nowrap; vertical-align: middle; }
.projects tbody tr[data-href] { cursor: pointer; }
.projects tbody tr:hover td { background: #f7faf8; }
.projects .no a { font-weight: 600; color: var(--ink); }
.projects .no b { color: var(--accent); }
.projects .nexttodo { font-size: 13px; white-space: normal; }
.projects .nexttodo.hot { color: var(--late); font-weight: 600; }
.projects .nexttodo .when { color: var(--muted); font-weight: 400; }
.projects .nexttodo.hot .when { color: var(--late); }
.emptycell { padding: 40px !important; text-align: center; color: var(--muted); }
.badge { font-weight: 600; padding: 2px 10px; border-radius: 999px; }

/* 상품 목록 */
.lead { margin: 0 0 12px; }
.newproduct { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.newproduct input[type=text] { flex: 1 1 200px; }
.newproduct input[type=number] { width: 90px; }
.newproduct input, .newproduct select { border-radius: 8px; padding: 7px 10px; }

/* 화면 언어 전환 */
html.i18n-wait body { visibility: hidden; }
.langs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-right: 12px; }
.langs button { border: 0; border-radius: 0; background: none; padding: 3px 10px; font-size: 12px; color: var(--muted); cursor: pointer; }
.langs button.on { background: var(--accent); color: #fff; }
