[hidden] { display: none !important; }
:root {
  --bg: #f3f5f8; --card: #fff; --text: #1b2230; --muted: #6b7280; --line: #e2e6ec;
  --brand: #1f5fbf; --brand-dark: #174a96; --brand-soft: #e8f0fc;
  --side: #17223a; --side-text: #b9c4d8; --side-on: #2a3a5e;
  --ok: #127a46; --ok-bg: #e5f5ec; --warn: #b45309; --warn-bg: #fdf1e1;
  --danger: #c0392b; --danger-bg: #fdecea; --off: #6b7280; --off-bg: #eceef2;
  --side-w: 232px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; }
a { color: var(--brand); }
h1 { font-size: 1.4rem; margin: 0 0 16px; }
h2 { font-size: 1.12rem; margin: 26px 0 10px; }
h3 { font-size: 1.02rem; margin: 22px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- 앱 틀: 왼쪽 메뉴 + 오른쪽 본문 ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); color: var(--side-text);
  overflow-y: auto; z-index: 30; padding-bottom: 30px; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700;
  text-decoration: none; font-size: 1.02rem; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand);
  color: #fff; font-weight: 800; font-size: .95rem; }
.side nav { display: flex; flex-direction: column; padding: 0 10px; }
.side .group { font-size: .74rem; letter-spacing: .06em; color: #7f8ba3; margin: 16px 10px 4px; }
.side .item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px; color: var(--side-text);
  text-decoration: none; font-size: .93rem; }
.side a.item:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a.item.on { background: var(--side-on); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #5b9bff; }
.side .item.soon { color: #5f6b82; cursor: default; }
.side .item.soon small { margin-left: auto; font-size: .7rem; border: 1px solid #3d4a64; border-radius: 4px; padding: 0 5px; }
.side-dim { display: none; }

.main-col { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: 58px; padding: 0 22px;
  background: #fff; border-bottom: 1px solid var(--line); }
.menu-btn { display: none; border: 0; background: none; font-size: 1.4rem; cursor: pointer; padding: 4px 6px; }
.page-title { color: var(--muted); font-size: .9rem; }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .88rem; }
.userbox .who { display: flex; flex-direction: column; line-height: 1.2; }
.userbox .who small { color: var(--muted); font-size: .76rem; }
.userbox a { color: var(--muted); text-decoration: none; }
.userbox a:hover { color: var(--brand); }
main { width: 100%; max-width: 1240px; padding: 24px 24px 60px; }

.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.photo-md { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; }
.photo-lg { width: 120px; height: 150px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); flex: none; }
.initial { display: inline-grid; place-items: center; background: #d9e4f7; color: #2c4f8a; font-weight: 700; }
.photo-md.initial { font-size: 1.3rem; }
.photo-lg.initial { font-size: 2.4rem; }

/* ---------- 로그인 ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh;
  background: linear-gradient(135deg, #17223a 0%, #1f3a6e 100%); padding: 16px; }
.login-box { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 30px 28px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 800; margin-bottom: 6px; }

/* ---------- 공통 부품 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.card-title { margin: 0 0 14px; font-size: 1.02rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.narrow-card { max-width: 680px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; margin-top: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .9rem; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin: 0 12px 0 0; }
input, select, textarea { font: inherit; }
label input:not([type=checkbox]):not([type=file]), label select { display: block; width: 100%; margin-top: 5px; font-weight: 400; }
input:not([type=checkbox]):not([type=file]), select { padding: 8px 10px; border: 1px solid #cfd5de; border-radius: 7px; background: #fff; min-height: 38px; }
input:focus, select:focus { outline: 2px solid #9cc0f5; border-color: var(--brand); }
input:disabled, select:disabled { background: #f1f3f6; color: #555; }
input.tiny { width: 76px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.switch-row { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-top: 12px; }

.btn { display: inline-block; border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 8px;
  padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 6px 12px; font-size: .86rem; }
.btn.wide { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.delete-form { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }

.flash { background: var(--ok-bg); color: var(--ok); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.error { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.notice { background: var(--warn-bg); color: #7a3d00; border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.notice .btn { margin-left: 8px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--brand); border-color: var(--brand); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--brand); }
.stat .label { color: var(--muted); font-size: .84rem; }
.stat .value { font-size: 1.35rem; font-weight: 700; }
.stat small { font-size: .84rem; color: var(--muted); font-weight: 500; }
.warn { color: var(--warn); }

.welcome { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.welcome > div { flex: 1; min-width: 200px; }
.welcome .hello { font-size: 1.12rem; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list a { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.mini-list a:hover { background: #f8fafc; }
.mini-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.module { display: flex; flex-direction: column; gap: 4px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 12px; font-weight: 600; font-size: .9rem; text-decoration: none; color: var(--text); }
.module .ico { font-size: 1.3rem; }
a.module:hover { border-color: var(--brand); color: var(--brand); background: #fff; }
.module.off { color: #9aa1ad; }
.module small { font-weight: 400; font-size: .76rem; }

.bulk { background: var(--brand-soft); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
table.list th, table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.list thead th { background: #f1f3f7; font-size: .84rem; color: #444; white-space: nowrap; }
table.list tfoot th { background: #f7f8fa; }
table.list tr.grp td { background: #f7f8fa; font-weight: 700; font-size: .82rem; color: var(--muted); }
.card table.list { border: 0; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.empty { text-align: center; color: var(--muted); padding: 30px; }
tr.is-paid td { background: #fafbfc; }
tr.is-off td { opacity: .55; }
.tag { display: inline-block; border-radius: 4px; padding: 2px 7px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.tag.paid { background: var(--ok-bg); color: var(--ok); }
.tag.wait { background: var(--warn-bg); color: var(--warn); }
.tag.off { background: var(--off-bg); color: var(--off); }

/* 사용자 화면 */
.user-form { display: grid; grid-template-columns: 170px 1fr; gap: 24px; max-width: 900px; }
.user-form .card-title { margin-top: 4px; }
.photo-col { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.filebtn { margin: 0; cursor: pointer; border: 1px solid var(--brand); color: var(--brand); border-radius: 8px; padding: 6px 12px; font-size: .86rem; }
.filebtn input { display: none; }
.profile { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.profile dl { display: grid; grid-template-columns: 80px 1fr; gap: 6px 10px; margin: 0; flex: 1; }
.profile dt { color: var(--muted); }
.profile dd { margin: 0; font-weight: 600; }
.profile p { width: 100%; margin: 0; }

/* 경비 입력 */
.receipt-box { border: 1px dashed #c6ccd6; border-radius: 8px; padding: 12px; margin-bottom: 14px; }
.receipt-box .label { font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.receipt-box .preview { display: block; max-width: 220px; max-height: 260px; margin-top: 10px; border-radius: 6px; border: 1px solid var(--line); }
fieldset.paybox { border: 1px solid #f0d9a8; background: #fffaf0; border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; }
fieldset.paybox legend { font-weight: 700; font-size: .9rem; padding: 0 6px; }
fieldset.paybox label:not(.inline) { margin-top: 10px; }
ul.log { list-style: none; padding: 0; font-size: .88rem; }
ul.log li { padding: 5px 0; border-bottom: 1px solid var(--line); }

.report h1 { margin-bottom: 4px; }
.user-detail { break-inside: avoid-page; }

/* ---------- 휴대폰·태블릿 ---------- */
@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .2s; }
  body.side-open .side { transform: none; box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  body.side-open .side-dim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .main-col { margin-left: 0; }
  .menu-btn { display: block; }
  .topbar { padding: 0 12px; }
  .page-title { display: none; }
  main { padding: 18px 14px 50px; }
}
@media (max-width: 720px) {
  .userbox .who small { display: none; }
  .row2, .user-form { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .filters > * { flex: 1 1 140px; }
  table.list:not(.report-table) thead { display: none; }
  table.list:not(.report-table), table.list:not(.report-table) tbody,
  table.list:not(.report-table) tr, table.list:not(.report-table) td { display: block; width: 100%; }
  table.list:not(.report-table) tr { border-bottom: 2px solid var(--line); padding: 6px 0; }
  table.list:not(.report-table) td { border: 0; padding: 3px 10px; text-align: left !important; }
  table.list:not(.report-table) td[data-l]::before { content: attr(data-l); display: inline-block; width: 74px; color: var(--muted); font-size: .82rem; }
}

/* ---------- 인쇄 (A4) ---------- */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .side, .side-dim, .topbar, .no-print, .flash { display: none !important; }
  .main-col { margin: 0; display: block; }
  main { padding: 0; max-width: none; }
  table.list { border: 1px solid #999; }
  table.list th, table.list td { border-bottom: 1px solid #bbb; padding: 4px 6px; }
  a { color: inherit; text-decoration: none; }
  .tag { padding: 0; background: none !important; }
  .user-detail { break-before: page; }
}

/* ===== 영수증 모음 (A4) ===== */
.a4-sheets { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.sheet { box-sizing: content-box; width: 182mm; height: 268mm; padding: 14mm; background: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.18); display: flex; flex-direction: column; overflow: hidden; }
.sheet-list { height: auto; min-height: 120mm; }
.sheet-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  border-bottom: 1.5px solid #333; padding-bottom: 2mm; margin-bottom: 3mm; font-size: 10pt; }
.sheet-head span { color: #555; font-size: 9pt; }
.sheet-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr); gap: 3mm 4mm; }
.slot { margin: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid #c9ced6; border-radius: 2mm; padding: 2mm; }
.slot .pic { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.slot .pic img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.slot .nopic { text-align: center; color: #666; font-size: 9pt; }
.slot figcaption { border-top: 1px dashed #c9ced6; margin-top: 1.5mm; padding-top: 1.2mm; font-size: 8.5pt; line-height: 1.3; }
.slot .cap-top { display: block; }
.slot .cap-memo { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: #333; }
.slot .no { display: inline-block; background: #1d2a44; color: #fff; border-radius: 2px; padding: 0 3px; font-size: 7.5pt; }
@media print {
  .a4-sheets { display: block; gap: 0; }
  .sheet { padding: 0; box-shadow: none; break-after: page; page-break-after: always; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
  .slot { break-inside: avoid; }
}
@media screen and (max-width: 820px) {
  .a4-sheets { zoom: .5; }
}

/* ---------- 파이썬 버전 추가 ---------- */
.inline-form { display: inline; margin: 0; }
.linkbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.linkbtn:hover { color: var(--brand); }

/* 운행일지 자동 계산 */
.calc-box { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; background: var(--brand-soft); border-radius: 10px;
  padding: 12px 14px; margin: 4px 0 8px; }
.calc-box .label { display: block; color: var(--muted); font-size: .8rem; }
.calc-box b { font-size: 1.02rem; }
.calc-box b.big { font-size: 1.2rem; color: var(--brand-dark); }
@media (max-width: 720px) { .calc-box { grid-template-columns: 1fr 1fr; } }
.trip-type { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.trip-type .label { font-weight: 600; font-size: .9rem; margin-right: 6px; }
.trip-type label.seg { margin: 0; font-weight: 500; position: relative; }
.trip-type label.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.trip-type label.seg span { display: inline-block; padding: 7px 14px; border: 1px solid #cfd5de; border-radius: 8px; cursor: pointer; background: #fff; }
.trip-type label.seg input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.trip-type label.seg input:focus-visible + span { outline: 2px solid #9cc0f5; }

/* ===== 프로젝트 ===== */
textarea { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid #cfd5de; border-radius: 7px; margin-top: 5px; font-weight: 400; }
.phase-영업 { --ph: #6b7bd6; } .phase-견적 { --ph: #2f8fd8; } .phase-계약 { --ph: #127a8a; } .phase-시공 { --ph: #c97a10; }
.phase-준공 { --ph: #8a5cc7; } .phase-정산 { --ph: #127a46; } .phase-종료 { --ph: #6b7280; } .phase-none { --ph: #9aa1ad; }
.stage-board { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-bottom: 16px; }
.sb { display: flex; flex-direction: column; gap: 2px; padding: 8px 9px; border-radius: 9px; background: #fff; border: 1px solid var(--line);
  border-top: 3px solid var(--ph); text-decoration: none; color: var(--text); min-width: 0; }
.sb .no { font-size: .72rem; color: var(--muted); }
.sb .nm { font-size: .78rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb b { font-size: 1.15rem; color: var(--ph); }
.sb.on { background: var(--brand-soft); border-color: var(--brand); }
.stage-tag { display: inline-block; border-radius: 5px; padding: 2px 8px; font-size: .8rem; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--ph, #888) 14%, white); color: var(--ph, #555); }
.tracker { display: grid; grid-template-columns: repeat(16, 1fr); gap: 2px; margin: 6px 0 6px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 8px 10px; }
.tk { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; position: relative; min-width: 0; }
.tk::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: #e2e6ec; z-index: 0; }
.tk:first-child::before { display: none; }
.tk.done::before { background: var(--ph); }
.tk .dot { position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem;
  font-weight: 700; background: #fff; border: 2px solid #d5dae2; color: #9aa1ad; }
.tk.done .dot { background: var(--ph); border-color: var(--ph); color: #fff; }
.tk.current .dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ph) 30%, white); transform: scale(1.12); }
.tk .nm { font-size: .68rem; line-height: 1.2; color: var(--muted); word-break: keep-all; }
.tk.current .nm { color: var(--text); font-weight: 700; }
dl.info { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 0; }
dl.info dt { color: var(--muted); font-size: .88rem; }
dl.info dd { margin: 0; }
.memo { background: #f8fafc; border-radius: 8px; padding: 10px 12px; margin: 12px 0 0; font-size: .92rem; }
.next-picks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; font-size: .9rem; font-weight: 600; }
ol.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); margin-left: 8px; }
ol.timeline li { position: relative; padding: 2px 0 16px 18px; }
ol.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--ph, var(--brand)); border: 2px solid #fff; }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tl-head .amt { color: var(--brand-dark); }
.tl-body { margin-top: 6px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: .93rem; }
.tl-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.tl-files img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.tl-files a.file { background: #f1f3f7; border-radius: 6px; padding: 5px 9px; font-size: .86rem; text-decoration: none; }
@media (max-width: 900px) {
  .stage-board { grid-template-columns: repeat(4, 1fr); }
  .tracker { grid-template-columns: repeat(8, 1fr); row-gap: 12px; }
  .tk:nth-child(9)::before { display: none; }
}
@media (max-width: 520px) { .tracker .nm { display: none; } .tracker { padding: 10px 4px; } }
/* 프로젝트 2차: 금액·일수·하도급·단계별 파일 */
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
h3.form-sec { font-size: .95rem; margin: 18px 0 8px; padding-top: 10px; border-top: 1px solid var(--line); }
h3.form-sec:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.card h3.form-sec { margin-top: 14px; }
.card.desc { margin-bottom: 14px; } .card.desc div { margin-top: 4px; white-space: normal; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.tier { background: #eef1fb; color: #3f51b5; }
.neg { color: #c62828; } .pos { color: #127a46; }
.tk .dd { font-size: .66rem; color: var(--ph, var(--muted)); font-weight: 700; }
.phase-bar { display: flex; gap: 3px; margin-bottom: 12px; border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.phase-bar span { background: var(--ph); color: #fff; font-size: .78rem; padding: 6px 8px; white-space: nowrap; min-width: 64px; }
table.days-table td, table.days-table th { padding: 6px 10px; }
.party-tree { display: grid; gap: 8px; margin-bottom: 8px; }
.party { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.party.tier-0 { border-left: 4px solid #127a8a; }
.party.tier-1 { border-left: 4px solid #c97a10; margin-left: 18px; }
.party.tier-2 { border-left: 4px solid #8a5cc7; margin-left: 36px; }
.party-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.party-head .amt { margin-left: auto; }
.party-body { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 5px; color: var(--muted); }
.stage-files .sf-row { display: grid; grid-template-columns: 210px 50px 1fr; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.stage-files .sf-row:last-child { border-bottom: 0; }
.sf-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sf-list img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.sf-list a.file { background: #f1f3f7; border-radius: 6px; padding: 4px 8px; font-size: .84rem; text-decoration: none; }
@media (max-width: 640px) {
  .row3 { grid-template-columns: 1fr; }
  .stage-files .sf-row { grid-template-columns: 1fr auto; }
  .stage-files .sf-list { grid-column: 1 / -1; }
  .party.tier-1 { margin-left: 8px; } .party.tier-2 { margin-left: 16px; }
  .party-head .amt { margin-left: 0; }
}
@media (max-width: 520px) { .tk .dd { font-size: .6rem; } }
@media (max-width: 640px) { table.days-table .hide-m { display: none; } table.days-table td, table.days-table th { padding: 6px; } }
/* 프로젝트명 고르기 (경비·운행일지) */
.proj-pick { position: relative; }
.proj-hint { margin: -6px 0 10px; min-height: 1em; color: var(--brand-dark); }
.proj-list { position: absolute; z-index: 30; left: 0; right: 0; top: 66px; max-height: 300px; overflow-y: auto; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(20, 30, 60, .14); padding: 4px; }
.proj-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; background: none;
  border: 0; border-radius: 7px; padding: 8px 10px; cursor: pointer; font: inherit; color: var(--text); }
.proj-opt span { font-size: .8rem; color: var(--muted); }
.proj-opt:hover, .proj-opt.on { background: #eef3fd; }
.proj-opt.kind-internal b { color: #127a46; }
.proj-opt.kind-free span { font-style: italic; }
.proj-empty { padding: 8px 10px; }
.proj-hint { color: var(--brand-dark); }
.proj-hint.bad { color: #c62828; font-weight: 600; }
.proj-new { display: block; margin: 4px; padding: 10px; border-top: 1px dashed var(--line); text-decoration: none; font-weight: 700; color: var(--brand); }
.proj-new span { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
.proj-new.off { font-weight: 400; font-size: .85rem; color: var(--muted); }
.proj-new:hover { background: #eef3fd; border-radius: 7px; }
.proj-empty { padding: 8px 10px; color: #c62828; }
/* 업무일지 */
.phase-장애 { --ph: #c62828; }
.tag.st-done { background: var(--ok-bg); color: var(--ok); }
.tag.st-continue { background: #e8f0fe; color: #1a56c4; }
.tag.st-postponed { background: var(--warn-bg); color: var(--warn); }
.tag.st-canceled { background: var(--off-bg); color: var(--off); text-decoration: line-through; }
.status-pick { margin-bottom: 14px; }
.status-pick .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.status-pick label.seg { display: inline-block; margin: 0 4px 4px 0; }
.trouble-box { background: #fff5f5; border: 1px solid #f3c7c7; border-radius: 10px; padding: 10px 12px 0; margin-bottom: 14px; }
.trouble-box label { color: #a01f1f; }
.time-sync { margin: -6px 0 12px; min-height: 1.2em; color: var(--muted); }
.time-sync .ok { color: #127a46; } .time-sync .bad { color: #c62828; font-weight: 600; }
.md-editor { margin-bottom: 14px; }
.md-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 5px; font-size: .9rem; }
.md-tools { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.md-tools button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 8px; font-size: .8rem; cursor: pointer; }
.md-tools button:hover { background: #eef3fd; }
.md-tabs { margin-left: 8px; display: inline-flex; }
.md-tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
textarea.md-input { font-family: ui-monospace, Consolas, "D2Coding", monospace; font-size: .92rem; line-height: 1.55; }
.md-preview { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; background: #fff; }
.md-body { line-height: 1.65; }
.md-body h1, .md-body h2, .md-body h3 { margin: .8em 0 .4em; font-size: 1.1rem; } .md-body h1 { font-size: 1.25rem; }
.md-body > :first-child { margin-top: 0; } .md-body > :last-child { margin-bottom: 0; }
.md-body ul, .md-body ol { padding-left: 1.4em; margin: .3em 0; }
.md-body table { border-collapse: collapse; margin: .5em 0; } .md-body th, .md-body td { border: 1px solid var(--line); padding: 4px 10px; }
.md-body th { background: #f1f3f7; }
.md-body code { background: #f1f3f7; border-radius: 4px; padding: 1px 5px; font-size: .9em; }
.md-body pre { background: #1e2433; color: #e8ecf3; border-radius: 8px; padding: 10px 12px; overflow-x: auto; } .md-body pre code { background: none; color: inherit; }
.md-body blockquote { border-left: 3px solid var(--line); margin: .5em 0; padding: 2px 12px; color: var(--muted); }
.card.md-body.trouble { border-left: 4px solid #c62828; }
.wl-table td { vertical-align: top; }
.status-pick label.seg { font-weight: 500; position: relative; }
.status-pick label.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.status-pick label.seg span { display: inline-block; padding: 7px 14px; border: 1px solid #cfd5de; border-radius: 8px; cursor: pointer; background: #fff; }
.status-pick label.seg input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.status-pick label.st-postponed input:checked + span { background: #c97a10; border-color: #c97a10; }
.status-pick label.st-canceled input:checked + span { background: #6b7280; border-color: #6b7280; }
.status-pick label.st-done input:checked + span { background: #127a46; border-color: #127a46; }
.wl-table td:first-child, .wl-table td:nth-child(2) { white-space: nowrap; }
.wl-table .muted { display: block; }
.me-photo { width: 190px; } .me-photo p { font-size: .78rem; }
/* 필수 입력 칸: 주황 테두리 (모든 화면 공통) */
:root { --req: #e0912f; }
input:required:not([type=checkbox]):not([type=radio]):not([type=file]):not(:disabled),
select:required:not(:disabled), textarea:required:not(:disabled) {
  border-color: var(--req); box-shadow: inset 3px 0 0 var(--req);
}
input:required:not([type=checkbox]):not([type=radio]):not([type=file]):not(:disabled):focus,
select:required:not(:disabled):focus, textarea:required:not(:disabled):focus { border-color: var(--brand); }
.req-legend { font-size: .8rem; color: var(--muted); margin: -4px 0 12px; }
.req-legend i { display: inline-block; width: 18px; height: 12px; border: 1px solid var(--req); box-shadow: inset 3px 0 0 var(--req); border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.phase-사내 { --ph: #127a46; }
select.flash-pick { animation: flashpick .9s; }
@keyframes flashpick { 0%, 60% { background: #fff3c4; } 100% { background: #fff; } }
/* 시간 고르기: [오전/오후][시][분] */
.tp-field { margin-bottom: 14px; }
.tp-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.tp { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.tp select { width: 100%; }
.tp .tp-ap { font-weight: 600; }
/* 업무일지 첨부 */
.file-box { border: 1px dashed #cfd5de; border-radius: 10px; padding: 12px 12px 4px; margin-bottom: 14px; }
.wl-files { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 12px; }
.wl-file { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 120px; text-decoration: none; color: var(--text); font-weight: 400; margin: 0; }
.wl-file img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.wl-file .ficon { width: 120px; height: 90px; display: grid; place-items: center; font-size: 2rem; background: #f1f3f7; border-radius: 8px; }
.wl-file .fname { font-size: .78rem; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
/* 업무일지 내역: 첨부 '아이콘 파일명' */
.wl-atts { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.wl-att { font-size: .82rem; color: #445; text-decoration: none; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-att:hover { text-decoration: underline; }

/* ---------------- 일정관리 ---------------- */
.cal-wrap { padding: 0; overflow: hidden; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { padding: 8px 4px; font-size: .85rem; background: #f6f8fb; border-bottom: 1px solid var(--line); }
.cal th.wd0, .cal td.wd0 .cal-day a, .cal td.wd0 .cal-day { color: #c0392b; }
.cal th.wd6, .cal td.wd6 .cal-day a, .cal td.wd6 .cal-day { color: #1f5fbf; }
.cal td { vertical-align: top; height: 96px; padding: 4px; border: 1px solid var(--line); overflow: hidden; }
.cal td.out { background: #fafbfc; }
.cal td.out .cal-day { opacity: .45; }
.cal td.today { background: #fff9e6; }
.cal td.today .cal-day a, .cal td.today .cal-day { font-weight: 700; }
.cal-day { font-size: .82rem; margin-bottom: 3px; }
.cal-day a { text-decoration: none; color: var(--text); padding: 0 4px; border-radius: 4px; }
.cal-day a:hover { background: var(--brand-soft); }
.cal-ev { display: block; font-size: .76rem; line-height: 1.35; padding: 1px 4px; margin-bottom: 2px; border-radius: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; color: #1b2230;
  background: hsl(var(--h) 70% 93%); border-left: 3px solid hsl(var(--h) 55% 45%); }
.cal-ev.allday { background: hsl(var(--h) 55% 45%); color: #fff; }
.cal-ev .t { color: #555; margin-right: 3px; }
.cal-ev b { font-weight: 600; }
.agenda { padding: 6px 12px; }
.ag-row { display: grid; grid-template-columns: 92px 92px 70px 1fr auto; gap: 8px; align-items: baseline; padding: 7px 0;
  border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); border-left: 3px solid hsl(var(--h) 55% 45%); padding-left: 8px; }
.ag-row:last-child { border-bottom: 0; }
.ag-row:hover { background: #f6f8fb; }
.ag-date, .ag-time { font-size: .85rem; color: #555; white-space: nowrap; }
.ag-who { font-weight: 600; font-size: .88rem; }
.ag-flag .ok { color: #1e7e34; } .ag-flag .bad { color: #c0392b; }
.who-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: hsl(var(--h) 55% 45%); margin-right: 4px; }
.sc-memo { white-space: pre-wrap; }
.sc-check { display: flex; align-items: center; gap: 6px; font-weight: normal; }
.sc-check input { width: auto; margin: 0; }
@media (max-width: 720px) {
  .cal td { height: 64px; padding: 2px; }
  .cal-ev { font-size: 0; height: 6px; padding: 0; margin-bottom: 2px; border-left: 0; background: hsl(var(--h) 55% 45%); }
  .ag-row { display: flex; flex-wrap: wrap; gap: 2px 8px; }
  .ag-title { flex-basis: 100%; }
}
/* 업무일지 쓰기: 그날 일정 참조 */
.sched-ref { border: 1px dashed #b9cbe8; background: #f5f8fe; border-radius: 10px; padding: 8px 12px; margin: 4px 0 14px; font-size: .88rem; }
.sched-ref .sr-head { font-weight: 600; margin-bottom: 4px; }
.sched-ref .sr-item { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 3px 0; }
.sched-ref .sr-item.on { background: #e3f0ff; border-radius: 6px; padding: 3px 6px; }
.sched-ref .sr-time { color: #555; white-space: nowrap; }
dl.info .ok { color: #1e7e34; } dl.info .bad { color: #c0392b; }

/* ---------------- 공통 첨부 칸: 끌어다 놓기 (templates/_dropzone.html + app.js) ---------------- */
.dropzone { position: relative; margin: 6px 0 12px; }
.dropzone.dz-on { border: 2px dashed #b9c4d4; border-radius: 10px; background: #fafbfd; padding: 14px 12px; cursor: pointer;
  transition: background .15s, border-color .15s; }
.dropzone.dz-on:hover, .dropzone.dz-on:focus { border-color: var(--brand); background: var(--brand-soft); outline: none; }
.dropzone.dz-over { border-color: var(--brand); background: #dde9fb; }
.dropzone.dz-has { border-style: solid; border-color: #9cc0f5; }
.dropzone .dz-face { display: none; text-align: center; color: #445; }
.dropzone.dz-on .dz-face { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.dropzone .dz-face b { font-weight: 600; font-size: .92rem; }
.dropzone .dz-face span { font-size: .8rem; color: var(--muted); }
/* 상자가 켜지면 원래 파일 칸은 숨김 (상자를 누르면 열림). 자바스크립트가 없으면 원래 칸이 보임 */
.dropzone.dz-on .dz-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dz-list { list-style: none; margin: 10px 0 0; padding: 0; font-size: .85rem; cursor: default; text-align: left; }
.dz-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; word-break: break-all; }
.dz-list li.dz-head { font-weight: 600; color: #334; }
.dz-list li.ok { color: #1e7e34; }
.dz-list li.bad { color: #c0392b; font-weight: 600; }
.dz-list .dz-name { flex: 1; }
.dz-x { border: 0; background: #e9edf3; color: #445; border-radius: 50%; width: 24px; height: 24px; line-height: 24px; padding: 0;
  font-size: .8rem; cursor: pointer; flex: none; }
.dz-x:hover { background: #f8d7da; color: #c0392b; }
.photo-col .dropzone { width: 100%; }
/* 일정 달력: 볼 직원 여러 명 고르기 */
.who-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 12px; }
.who-pick .wp-label { font-weight: 600; font-size: .88rem; }
.wp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.who-chip { display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; font-size: .86rem; font-weight: 500; color: #889; user-select: none; }
.who-chip input { width: 16px; height: 16px; margin: 0; accent-color: hsl(var(--h) 55% 45%); }
.who-chip.on, .who-chip:has(input:checked) { color: var(--text); border-color: hsl(var(--h) 55% 45%); background: hsl(var(--h) 70% 96%); }
.who-dot.gray { background: #9aa3af; }
.wp-state { margin-left: 4px; }
@media (max-width: 720px) {
  .who-pick { gap: 6px; }
  .wp-chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .who-chip { flex: none; padding: 8px 12px; }   /* 손가락으로 누르기 쉽게 */
  .wp-state { width: 100%; margin: 0; }
}

/* ---------------- 공통 날짜+시간 칸 "yy-mm-dd hh:mm" (templates/_datetime.html) ---------------- */
.dt-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.dt-label { font-size: .9rem; font-weight: 600; }
.dt-box { position: relative; display: flex; align-items: stretch; }
.dt-box .dt-input { flex: 1; min-width: 0; margin: 0; font-variant-numeric: tabular-nums; letter-spacing: .02em; padding-right: 44px; }
.dt-box .dt-cal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent;
  font-size: 1.1rem; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.dt-box .dt-cal:hover { background: var(--brand-soft); }
.dt-box .dt-native { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.dt-field.dt-bad .dt-input { border-color: #c0392b; outline-color: #f1a7a0; }
.dt-msg { color: #c0392b; min-height: 0; }
.dt-msg:empty { display: none; }
.btn.btn-new { font-weight: 700; padding: 9px 16px; box-shadow: 0 2px 6px rgba(31,95,191,.25); }

/* 프로젝트 단계: 눌러서 바꾸기·건너뜀·이력 */
button.tk { border: 0; background: transparent; padding: 0; font: inherit; color: inherit; cursor: pointer; }
button.tk:hover .dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ph) 25%, white); }
button.tk.current { cursor: default; }
.tk.skipped::before { background: var(--ph); opacity: .45; }
.tk.skipped .dot { background: color-mix(in srgb, var(--ph) 25%, white); border-color: var(--ph); color: var(--ph); }
.tk.beyond .dot { border-style: dashed; }
.stage-dlg { border: 0; border-radius: 12px; padding: 20px; width: min(420px, 92vw); max-height: 90vh; overflow-x: hidden; box-sizing: border-box; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.stage-dlg::backdrop { background: rgba(20, 30, 50, .35); }
.stage-dlg h3 { margin: 0 0 6px; }
.stage-log tr.rb td { background: #fff6f5; }

/* ---------------- 계산서 관리 ---------------- */
.inv-dir { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 16px; }
.inv-dir-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px; border: 2px solid var(--line);
  border-radius: 12px; cursor: pointer; background: #fff; font-weight: normal; margin: 0; text-align: center; }
.inv-dir-btn input { position: absolute; opacity: 0; pointer-events: none; }
.inv-dir-btn b { font-size: 1.1rem; }
.inv-dir-btn span { font-size: .8rem; color: var(--muted); }
.inv-dir-btn.sales:has(input:checked) { border-color: #1f5fbf; background: #e8f0fc; color: #174a96; }
.inv-dir-btn.purchase:has(input:checked) { border-color: #b4540a; background: #fff1e6; color: #8a3f06; }
.inv-wait { opacity: .45; pointer-events: none; }
.inv-partner { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 2px; margin: 0 0 12px; }
.inv-partner legend { font-weight: 600; font-size: .9rem; padding: 0 4px; }
.inv-paid { display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.tag.inv-sales { background: #e8f0fc; color: #174a96; }
.tag.inv-purchase { background: #fff1e6; color: #8a3f06; }
.inv-card .actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 720px) { .inv-money.row3 { grid-template-columns: 1fr 1fr; } }
/* 홈: 위쪽 제목을 누르면 홈 (왼쪽 메뉴에 '홈' 없음). 휴대폰은 위쪽 줄에 로고+이름 */
.top-home { display: none; align-items: center; gap: 6px; text-decoration: none; color: var(--text); font-weight: 700; font-size: .95rem; }
.side .brand.on .logo { box-shadow: 0 0 0 2px #5b9bff; }
@media (max-width: 900px) {
  .top-home { display: inline-flex; }
  .topbar .page-title { display: none; }
}
@media (max-width: 420px) { .top-home-name { display: none; } }
/* 홈: 일정·계산서 카드 */
.hs-sub { font-weight: 600; font-size: .86rem; margin: 12px 0 2px; }
.hs-sub:first-of-type { margin-top: 0; }
.hs-time { white-space: nowrap; min-width: 86px; }
.home-sched .mini-list a .who-dot { flex: none; }
.warn-text { color: #b4540a; }
.hi-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.hi-stats > * { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  text-decoration: none; color: inherit; }
.hi-stats a:hover { background: #f8fafc; }
.hi-stats .label { font-size: .78rem; color: var(--muted); }
.tag.late { background: #fdecea; color: #c0392b; }
.grid-2 > * { min-width: 0; }   /* 긴 글자가 카드를 화면 밖으로 밀지 않게 */

/* ---------------- 경비 결제 주체: 개인(주황) / 회사(파랑) ---------------- */
.tag.payer-personal { background: #fff1e6; color: #b4540a; border: 1px solid #f5c79d; font-weight: 700; }
.tag.payer-company { background: #e8f0fc; color: #174a96; border: 1px solid #a9c4ef; font-weight: 700; }
.tag.na { background: #f1f3f7; color: #889; }
.payer-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 16px; }
.payer-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px; border: 2px solid var(--line);
  border-radius: 12px; cursor: pointer; background: #fff; font-weight: normal; margin: 0; text-align: center; position: relative; }
.payer-btn input { position: absolute; opacity: 0; pointer-events: none; }
.payer-btn b { font-size: 1.15rem; }
.payer-btn span { font-size: .8rem; color: var(--muted); }
.payer-btn.personal:has(input:checked) { border-color: #e07b24; background: #fff1e6; color: #8a3f06; }
.payer-btn.company:has(input:checked) { border-color: #1f5fbf; background: #e8f0fc; color: #174a96; }
@media print { .tag.payer-personal, .tag.payer-company { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---------------- AI 메모함 ---------------- */
.memo-box { margin: 16px 0 0; }
.memo-box .memo-text { width: 100%; font-size: 1.05rem; min-height: 96px; }
.memo-box .memo-send { min-width: 140px; }
.home-memo { margin-top: 16px; }
.tag.memo-new { background: #f1f3f7; color: #556; }
.tag.memo-suggested { background: #e8f0fc; color: #174a96; }
.tag.memo-applied { background: #e6f4ea; color: #1e7e34; }
.tag.memo-pending { background: #fff1e6; color: #b4540a; }
.tag.memo-kept { background: #f3eefc; color: #5b3a9a; }
.memo-text-view { font-size: 1.02rem; line-height: 1.6; margin-bottom: 8px; white-space: normal; }
.kind-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.kind-pick .off { opacity: .45; }
.memo-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 720px) {
  .home-memo { order: -1; }
  .memo-box .memo-text { min-height: 130px; font-size: 1.1rem; }
  .memo-box .memo-send { width: 100%; padding: 14px; font-size: 1.05rem; }
}

/* ---------------- 오른쪽 위 AI 사용량 아이콘 ---------------- */
.ai-usage { position: relative; }
.ai-usage summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 3px;
  border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: .95rem; user-select: none; }
.ai-usage summary::-webkit-details-marker { display: none; }
.ai-usage .au-badge { font-size: .74rem; font-weight: 700; color: #1e7e34; }
.ai-usage.lv-warn .au-badge { color: #b4540a; } .ai-usage.lv-warn summary { border-color: #f5c79d; background: #fff6ee; }
.ai-usage.lv-over .au-badge { color: #c0392b; } .ai-usage.lv-over summary { border-color: #f1a7a0; background: #fdecea; }
.ai-usage.lv-nokey .au-badge { color: #889; }
.ai-usage .au-pop { display: none; position: absolute; right: 0; top: calc(100% + 6px); width: 300px; max-width: 90vw; z-index: 50;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.15);
  font-size: .86rem; color: var(--text); }
.ai-usage[open] .au-pop { display: block; }
@media (hover: hover) { .ai-usage:hover .au-pop { display: block; } }
.ai-usage dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 8px 0; }
.ai-usage dt { color: var(--muted); }
.ai-usage dd { margin: 0; }
@media (max-width: 420px) { .ai-usage .au-badge { font-size: .68rem; } }
@media (max-width: 720px) {   /* 휴대폰: 아이콘 위치와 상관없이 화면 안에 */
  .ai-usage .au-pop { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; max-width: none; }
}

/* ---------------- AI 사용량 캐릭터 '동글이' (core/_ai_mascot.svg) ---------------- */
.mascot { display: block; overflow: visible; --m: #2fa36b; --m-dark: #1d7a4d; }
.ai-usage.lv-warn .mascot { --m: #f0902f; --m-dark: #b4540a; }
.ai-usage.lv-over .mascot { --m: #e0483b; --m-dark: #a5281e; }
.ai-usage.lv-nokey .mascot { --m: #a3abb8; --m-dark: #6b7280; }
.mascot .m-body { fill: var(--m); stroke: var(--m-dark); stroke-width: 1.4; }
.mascot .m-ant { stroke: var(--m-dark); }
.mascot .m-ant-ball { fill: #ffd24a; stroke: var(--m-dark); stroke-width: 1; }
.ai-usage.lv-nokey .mascot .m-ant-ball { fill: #d6dae1; }
.mascot .m-cheek { fill: #ff9bb0; opacity: .55; }
.mascot .m-eye { fill: #fff; }
.mascot .m-pupil { fill: #1b2230; }
.mascot .m-shine { fill: #fff; }
.mascot .m-brows, .mascot .m-eyes-x, .mascot .m-eyes-sleep, .mascot .m-mouth[stroke-width] { stroke: #1b2230; }
.mascot .m-oh { fill: #1b2230; }
.mascot .m-sweat { fill: #7cc6ff; stroke: #3a8ccc; stroke-width: .6; }
.mascot .m-z { fill: var(--m-dark); font-family: sans-serif; }
/* 상태별로 보일 부분만 */
.mascot .m-brows, .mascot .m-eyes-x, .mascot .m-sweat, .mascot .m-eyes-sleep, .mascot .m-z,
.mascot .m-worry, .mascot .m-oh, .mascot .m-flat { display: none; }
.ai-usage.lv-warn .mascot .m-brows, .ai-usage.lv-warn .mascot .m-worry { display: inline; }
.ai-usage.lv-warn .mascot .m-smile { display: none; }
.ai-usage.lv-over .mascot .m-eyes-open, .ai-usage.lv-over .mascot .m-smile { display: none; }
.ai-usage.lv-over .mascot .m-eyes-x, .ai-usage.lv-over .mascot .m-sweat, .ai-usage.lv-over .mascot .m-oh { display: inline; }
.ai-usage.lv-nokey .mascot .m-eyes-open, .ai-usage.lv-nokey .mascot .m-smile, .ai-usage.lv-nokey .mascot .m-cheek { display: none; }
.ai-usage.lv-nokey .mascot .m-eyes-sleep, .ai-usage.lv-nokey .mascot .m-z, .ai-usage.lv-nokey .mascot .m-flat { display: inline; }
/* 마우스 올리면 통통 (움직임 줄이기 설정이면 안 함) */
@keyframes mascot-bounce { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(-3px) scale(1.04, .97); } 60% { transform: translateY(0) scale(.98, 1.03); } }
@media (prefers-reduced-motion: no-preference) {
  .ai-usage summary:hover .mascot, .ai-usage summary:focus-visible .mascot { animation: mascot-bounce .6s ease-in-out 2; transform-origin: 50% 90%; }
}
/* 이 프로그램은 밝은 화면만 씀 — 캐릭터는 색·테두리를 직접 정해 두어 어두운 배경에서도 보임 */

/* ---------------- 홈 '할 일' 카드 ---------------- */
.home-todo { margin-top: 16px; }
.todo-add { display: flex; gap: 8px; margin-bottom: 8px; }
.todo-add input { flex: 1; min-width: 0; margin: 0; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.todo input[type=checkbox] { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--brand); }
.todo-text { flex: 1; min-width: 0; word-break: break-all; cursor: text; border-radius: 4px; padding: 2px 4px; }
.todo-text[contenteditable=true] { outline: 2px solid #9cc0f5; background: #fff; }
.todo.is-done .todo-text { text-decoration: line-through; color: var(--muted); opacity: .7; }
.todo-x { border: 0; background: none; color: #99a; cursor: pointer; font-size: .9rem; padding: 4px 6px; border-radius: 6px; flex: none; }
.todo-x:hover { background: #fdecea; color: #c0392b; }
.todo[draggable=true] { cursor: grab; }
.todo.dragging { opacity: .45; }
.todo-done-box { margin-top: 8px; }
.todo-done-box summary { cursor: pointer; color: var(--muted); }
@media (max-width: 720px) {
  .todo { padding: 11px 2px; }   /* 손가락으로 누르기 쉽게 */
  .todo input[type=checkbox] { width: 24px; height: 24px; }
  .todo-add .btn { padding: 10px 14px; }
}
