:root { font-family: "Pretendard", "Malgun Gothic", system-ui, sans-serif; color: #192d25; background: #f3f6f3; font-size: 14px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header { min-height: 68px; padding: 0 max(5vw, 20px); display: flex; align-items: center; justify-content: space-between; background: #142e24; color: white; }
.brand { color: inherit; text-decoration: none; font-size: 19px; font-weight: 850; letter-spacing: .06em; }
.brand span { color: #bed4c8; font-size: 13px; margin-left: 10px; font-weight: 500; letter-spacing: 0; }
main { max-width: 1400px; margin: auto; padding: 40px max(4vw, 16px); }
.heading, .toolbar, .dialog-top, .actions, .search { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { margin: 3px 0 0; font-size: clamp(26px, 4vw, 38px); letter-spacing: -.055em; }
h2 { margin: 0; font-size: 21px; }
.eyebrow { margin: 0; color: #357358; font-size: 11px; letter-spacing: .16em; font-weight: 800; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; padding: 9px 13px; border: 1px solid #d7e1d9; border-radius: 8px; background: #fff; color: #20382b; white-space: nowrap; }
button:hover { background: #edf4ee; }
button:disabled { opacity: .55; cursor: wait; }
.primary { background: #176644; border-color: #176644; color: white; font-weight: 700; padding: 11px 16px; }
.primary span { margin-right: 3px; }
.primary:hover { background: #105538; }
.danger { border-color: #a43b35; background: #a43b35; color: #fff; font-weight: 700; }
.danger:hover { background: #832d29; }
.quiet { background: transparent; color: inherit; }
header button { border-color: #6d887a; }
header button:hover { background: #274437; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 24px 0; }
.stats div, .panel, #login { background: white; border: 1px solid #dfe7df; border-radius: 14px; }
.stats div { padding: 19px; display: grid; gap: 6px; }
.stats span { color: #536b5e; }
.stats strong { font-size: clamp(18px, 3vw, 28px); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.workspace-layout { position: relative; }
.workspace-sidebar { position: fixed; z-index: 5; top: 92px; left: 18px; width: clamp(280px, calc((100vw - 1288px) / 2 - 24px), 590px); max-height: calc(100vh - 32px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.calculator-sidebar { position: fixed; z-index: 5; top: 92px; right: 18px; width: clamp(300px, calc((100vw - 1288px) / 2 - 12px), 720px); max-height: calc(100vh - 32px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.workspace-main { min-width: 0; }
.memo-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; max-height: 100%; margin: 0; padding: 12px; }
.memo-heading { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; gap: 6px; margin-bottom: 10px; }
.memo-heading h2 { font-size: 17px; white-space: nowrap; }
.memo-heading [id^="memo-status-"] { display: none; }
.memo-panel textarea { flex: 1; display: block; width: 100%; min-height: 0; resize: vertical; }
.calculator-panel { display: flex; flex-direction: column; height: 100%; min-height: 300px; max-height: 100%; margin: 0; padding: 14px; }
.calculator-panel.drop-target { outline: 3px dashed #176644; outline-offset: -5px; background: #f2f8f3; }
.calculator-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.calculator-heading h2 { font-size: 17px; }
.calculator-title { flex: 1; min-width: 0; padding: 7px 8px; border-color: #ccd9cf; background: #fff; font-size: 15px; font-weight: 700; ime-mode: active; }
.calculator-title:focus { border-color: #176644; background: #fff; outline: 2px solid #17664420; }
.calculator-heading button { padding: 7px 9px; font-size: 12px; }
.calculator-actions { display: flex; align-items: center; gap: 4px; }
.calculator-actions button { white-space: nowrap; }
.calculator-table-wrap { flex: 1; min-height: 0; overflow: auto; }
.calculator-table { width: 100%; table-layout: fixed; font-size: 12px; }
.calculator-table th, .calculator-table td { padding: 5px 3px; }
.calculator-table th:first-child { width: 40%; }
.calculator-table th:nth-child(2) { width: 42%; }
.calculator-table th:last-child, .calculator-table td:last-child { width: 18%; min-width: 24px; }
.calculator-table-dated th:first-child { width: 35%; }
.calculator-table-dated th:nth-child(2) { width: 27%; }
.calculator-table-dated th:nth-child(3) { width: 29%; }
.calculator-table-dated th:last-child, .calculator-table-dated td:last-child { width: 9%; min-width: 22px; }
.calculator-table-dated .calc-date-control { position: relative; display: block; width: 100%; }
.calculator-table-dated .calc-date { width: 100%; padding: 6px 17px 6px 2px; font-size: 12px; }
.calculator-table-dated .calc-date-native { position: absolute; top: 50%; right: 1px; width: 18px; height: 22px; padding: 0; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer; }
.calculator-table-dated .calc-date-native::-webkit-datetime-edit { display: none; }
.calculator-table-dated .calc-date-native::-webkit-calendar-picker-indicator { width: 14px; height: 14px; margin: 0; padding: 0; cursor: pointer; }
.calculator-table .calc-sort-date { width: 100%; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; font-size: inherit; }
.calculator-table input { padding: 7px 6px; font-size: 12px; }
.calculator-table .calc-amount { text-align: right; }
.calculator-table .calc-remove { padding: 4px 6px; color: #7a514b; }
.calculator-total { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid #e5ece5; }
.calculator-total span { color: #536b5e; }
.calculator-total strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.calculator-panel [id^="calculator-status-"] { min-height: 0; margin: 6px 0 0; color: #536b5e; font-size: 11px; }
.calculator-panel [id^="calculator-status-"]:empty { display: none; }
@media (max-width: 1871px) {
  .workspace-sidebar, .calculator-sidebar { position: static; width: auto; height: auto !important; max-height: none; margin-top: 18px; }
  .workspace-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calculator-sidebar { grid-template-columns: minmax(0, 1fr); }
  .memo-panel { height: 330px; min-height: 0; max-height: none; margin-top: 0; padding: 12px; }
  .memo-panel textarea { min-height: 0; }
  .calculator-panel { height: 420px; min-height: 320px; }
}
@media (max-width: 1500px) {
  .calculator-panel { height: 380px; }
}
.toolbar { padding: 14px; border-bottom: 1px solid #e5ece5; flex-wrap: wrap; }
.calendar-panel { overflow: hidden; }
.calendar-toolbar { min-height: 62px; padding: 12px 16px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #e5ece5; }
.calendar-toolbar h2 { min-width: 150px; text-align: center; }
.calendar-toolbar #today-month { margin-left: auto; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekday { padding: 10px; text-align: center; color: #536b5e; font-size: 12px; border-bottom: 1px solid #e5ece5; }
.calendar-day { min-height: 112px; padding: 5px; border-right: 1px solid #e9efea; border-bottom: 1px solid #e9efea; overflow: hidden; }
.calendar-day[role="button"] { cursor: pointer; }
.calendar-day[role="button"]:hover { background: #f4f8f4; }
.calendar-day.drop-target { background: #e4f1e8; outline: 2px dashed #176644; outline-offset: -3px; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside-month { background: #f8faf8; }
.calendar-date { display: block; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; text-align: center; }
.calendar-date.is-today { color: #176644; font-weight: 800; }
.calendar-date.is-selected { background: #176644; color: white; }
.calendar-event { display: block; width: 100%; margin-top: 4px; padding: 5px 6px; border: 0; border-radius: 5px; background: #e4f1e8; color: #174f34; text-align: left; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 650; }
.calendar-event:hover { background: #d4e8da; }
.calendar-event.payment-complete { opacity: .58; }
.calendar-event.payment-complete:hover { opacity: .78; }
.calendar-event.no-work { background: #eee5fa; color: #653a91; }
.calendar-event.no-work:hover { background: #e3d2f5; }
.calendar-event.payment-pending { background: #f8e1e7; color: #87384b; }
.calendar-event.payment-pending:hover { background: #f2d1da; }
.records-panel { margin-top: 18px; overflow: hidden; }
.records-panel .toolbar h2 { margin: 0; font-size: 17px; white-space: nowrap; }
.records-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
#search-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#search-balance { color: #176b4b; font-size: 13px; font-weight: 700; white-space: nowrap; }
nav { display: flex; flex-wrap: wrap; gap: 5px; }
nav button { border-color: transparent; }
nav button[aria-pressed=true] { color: #165336; background: #e3f1e8; font-weight: 700; }
input, textarea, select { padding: 10px; border: 1px solid #ccd9cf; border-radius: 7px; width: 100%; background: white; color: inherit; }
textarea { resize: vertical; }
.search { min-width: min(315px, 100%); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead th:last-child, tbody td:last-child { width: 218px; min-width: 218px; }
.records-table { table-layout: fixed; font-size: 12px; }
.records-table th, .records-table td { padding: 8px 6px; }
.records-table th:nth-child(1) { width: 11%; }
.records-table th:nth-child(2) { width: 10%; }
.records-table th:nth-child(3) { width: 24%; }
.records-table th:nth-child(4) { width: 9%; }
.records-table th:nth-child(5) { width: 9%; }
.records-table th:nth-child(6) { width: 9%; }
.records-table th:last-child, .records-table td:last-child { width: 18%; min-width: 190px; }
.records-table.search-results th:nth-child(1) { width: 14%; }
.records-table.search-results th:nth-child(2) { width: 12%; }
.records-table.search-results th:nth-child(3) { width: 12%; }
.records-table.search-results th:nth-child(4) { width: 30%; }
.records-table.search-results th:nth-child(5) { width: 15%; }
.records-table.search-results th:last-child, .records-table.search-results td:last-child { width: 17%; min-width: 150px; }
.records-table.search-results td:nth-child(4) { line-height: 1.45; white-space: pre-line; }
.records-table td:nth-child(1), .records-table td:nth-child(2), .records-table td:nth-child(3),
.records-table td:nth-child(4), .records-table td:nth-child(5), .records-table td:nth-child(6),
.records-table td:nth-child(7) { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.records-table td:nth-child(3) { line-height: 1.45; white-space: pre-line; }
th, td { padding: 13px; border-bottom: 1px solid #e9efea; vertical-align: middle; }
th { color: #526559; font-size: 12px; white-space: nowrap; }
td:first-child { min-width: 135px; }
td:nth-child(2) { min-width: 155px; max-width: 290px; white-space: pre-wrap; overflow-wrap: anywhere; }
td:nth-child(n+3) { white-space: nowrap; }
td small { display: block; padding-top: 4px; color: #566b5d; white-space: normal; overflow-wrap: anywhere; }
td button + button { margin-left: 5px; }
.row-actions { display: flex; align-items: center; justify-content: flex-start; white-space: nowrap; }
.row-actions button { min-width: 58px; margin: 0; padding: 7px 10px; font-size: 12px; }
.editor-actions { justify-content: flex-start; }
.editor-actions #delete-current { margin-right: auto; }
.car-select { width: auto; max-width: 100%; border: 0; padding: 0; background: transparent; color: #174f34; font-weight: 700; text-align: left; white-space: normal; }
.car-select:hover { background: transparent; text-decoration: underline; }
.badge { display: inline-block; padding: 5px 8px; background: #ebf2ed; color: #315e47; border-radius: 12px; font-size: 12px; }
.form-error { color: #9c382a; }
#empty { margin: 34px 12px; text-align: center; color: #536b5e; }
#notice { padding: 12px 15px; margin: 0 0 18px; border-radius: 8px; background: #e4efe7; }
#notice.toast { position: fixed; z-index: 30; right: 20px; bottom: 20px; margin: 0; box-shadow: 0 5px 22px #142e2430; }
#login { width: min(440px, 100%); margin: 35px auto; padding: 26px; }
#login form { display: grid; gap: 14px; margin-top: 20px; }
label { display: grid; gap: 5px; font-weight: 600; }
fieldset.task-fields { min-width: 0; padding: 12px; border: 1px solid #dfe7df; border-radius: 9px; display: grid; grid-template-columns: minmax(0, 2fr) minmax(120px, 1fr); gap: 12px; }
fieldset.task-fields legend { padding: 0 5px; font-weight: 700; }
.coating-option { display: flex; align-items: center; justify-content: space-between; }
.check-label { display: flex; align-items: center; gap: 7px; font-weight: 500; }
.check-label input { width: auto; }
.coating-actions { display: flex; align-items: end; gap: 8px; }
.coating-actions > label { flex: 1; }
.coating-actions > button { padding: 7px 10px; font-size: 12px; }
dialog { width: min(650px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 22px; border: 1px solid #d7e1d9; border-radius: 15px; color: inherit; }
dialog::backdrop { background: #13261f99; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 16px 0; }
.wide { grid-column: 1 / -1; }
.job-payment-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid #dfe7df; border-radius: 9px; background: #f8faf8; }
.job-payment-summary div { display: grid; gap: 4px; min-width: 0; }
.job-payment-summary strong { font-size: 13px; }
.job-payment-summary span { color: #536b5e; font-size: 12px; overflow-wrap: anywhere; }
.job-payment-summary.is-paid { background: #f1f4f1; color: #657168; }
.job-payment-summary.is-paid span { color: #657168; }
.actions { justify-content: flex-end; }
#ledger { padding: 0; list-style: none; }
#payment-note { color: #536b5e; font-size: 12px; }
#ledger li { padding: 8px 0; border-bottom: 1px solid #e5ece5; overflow-wrap: anywhere; }
@media (max-width: 590px) {
  main { padding-top: 26px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .stats div { padding: 10px; }
  .stats span { font-size: 11px; }
  .search { width: 100%; }
  .calendar-day { min-height: 78px; padding: 3px; }
  .calendar-event { padding: 4px 3px; font-size: 10px; }
  .calendar-toolbar { gap: 3px; padding: 8px; }
  .calendar-toolbar h2 { min-width: 105px; font-size: 17px; }
  thead { display: none; }
  table, tbody { display: block; }
  tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 13px; border-top: 1px solid #e5ece5; }
  td, td:first-child, td:nth-child(2), td:nth-child(n+3) { display: block; min-width: 0; max-width: none; white-space: normal; border: 0; padding: 6px; overflow-wrap: anywhere; }
  td::before { content: attr(data-label); display: block; color: #536b5e; font-size: 11px; }
  td:last-child { grid-column: 1 / -1; }
  .row-actions { justify-content: flex-start; }
  td:last-child::before { display: none; }
}
@media (max-width: 1200px) {
  .calculator-panel { height: 340px; min-height: 280px; }
}
@media (max-width: 760px) {
  .workspace-sidebar, .calculator-sidebar { grid-template-columns: minmax(0, 1fr); }
  .memo-panel { height: 260px; }
  .calculator-panel { height: 360px; }
  .calculator-table { display: table; }
  .calculator-table thead { display: table-header-group; }
  .calculator-table tbody { display: table-row-group; }
  .calculator-table tr { display: table-row; padding: 0; border: 0; }
  .calculator-table th, .calculator-table td { display: table-cell; padding: 5px 3px; }
  .calculator-table td::before { display: none; }
}
