[hidden] { display: none !important; }
:root {
  /* 밝은 테마 (PC) — 블랙 & 골드 */
  --bg: #f5f4f1;
  --card: #ffffff;
  --sub: #f0eee9;        /* 표 머리·태그·옅은 칸 */
  --sub-2: #faf9f6;      /* 마우스 올림·보조 바탕 */
  --ink: #17171a;
  --label: #3e3b36;
  --muted: #6e6a62;
  --line: #e4e1da;
  --line-2: #d3cfc6;     /* 입력칸·진한 테두리 */
  --top: #111113;        /* 상단 메뉴줄 */
  --top-ink: #c9c4ba;
  --gold: #e8a317;       /* 채우는 골드 (버튼·선택) */
  --gold-hover: #d4930f;
  --accent: #8a5a00;     /* 밝은 바탕 위 골드 글씨·링크 */
  --accent-ink: #111113; /* 골드 위 글씨 */
  --accent-soft: #fbefd2;
  --accent-soft-2: #fff9ec;
  --accent-line: #ebcb82;
  --ok: #1d7a4a;
  --ok-soft: #e2f2e8;
  --ok-line: #b9e0c8;
  --warn: #a8530a;
  --warn-soft: #fdf0dc;
  --danger: #b4262f;
  --danger-soft: #fbe6e7;
  --danger-line: #efc4c7;
  --ai: #5b3fb3;
  --ai-soft: #f6f2ff;
  --ai-line: #d9ccf5;
  --radius: 8px;
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: .2rem 0 .8rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.r { text-align: right; }
.c { text-align: center; }
.nowrap { white-space: nowrap; }
.neg, .neg b { color: var(--danger); }
.warn-text { color: var(--warn); font-weight: 600; }
.inline { display: inline; }

/* ── 상단 */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  background: var(--top); color: #fff; padding: 0 1rem; height: 52px; }
.brand { color: #fff; font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: .2rem; flex: 1; }
.nav a { color: var(--top-ink); padding: .45rem .7rem; border-radius: 6px; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(232,163,23,.14); color: var(--gold); font-weight: 600; }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: .3rem; }
.linkbtn { background: none; border: 0; color: var(--top-ink); font: inherit; cursor: pointer; padding: .45rem .5rem; }
.linkbtn:hover { color: #fff; }
.menu-btn { display: none; margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }
.modebar { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: .85rem; padding: .3rem 1rem; }

.page { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1rem 5rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .1rem; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.head-row h1, .head-row h2 { margin: 0; }
.meta { margin: -.3rem 0 .8rem; color: var(--muted); }
.meta b { color: var(--ink); }

/* ── 카드, 버튼 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.card.narrow { max-width: 460px; }
.card.hint { background: var(--accent-soft); border-color: var(--accent-line); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; min-height: 38px; padding: .4rem .9rem;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 6px; font: inherit; font-size: .92rem;
  cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--line-2); text-decoration: none; background: var(--sub-2); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { min-height: 30px; padding: .2rem .6rem; font-size: .84rem; }
.btn.big { min-height: 46px; padding: .5rem 1.4rem; font-size: 1rem; }
.btn.wide { width: 100%; }
.btn-group { display: flex; gap: .4rem; flex-wrap: wrap; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.actions.sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 1rem 0 .6rem; z-index: 5; }
.danger-zone { margin-top: 2rem; padding-top: 1rem; border-top: 1px dashed var(--line); }

/* ── 폼 */
.input, input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: 38px; padding: .4rem .6rem; border: 1px solid var(--line-2); border-radius: 6px; background: var(--card);
  font: inherit; font-size: .95rem; color: var(--ink); }
textarea { min-height: 70px; resize: vertical; }
.input:focus, input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-line); outline-offset: 0; border-color: var(--accent); }
input.money, input.qty { text-align: right; font-variant-numeric: tabular-nums; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem 1rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .25rem; color: var(--label); }
.field.full { grid-column: 1 / -1; }
.field.check { display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; }
.field.check label { display: flex; align-items: center; gap: .45rem; font-weight: 500; font-size: .95rem; cursor: pointer; min-height: 38px; }
.field.check input { width: 18px; height: 18px; }
.help { display: block; color: var(--muted); margin-top: .2rem; font-size: .78rem; }
.err { display: block; color: var(--danger); margin-top: .2rem; font-size: .8rem; }
.req { color: var(--danger); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters .input { width: auto; flex: 1 1 220px; }
.filters select.input { flex: 0 1 240px; }
.row-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.row-form select { width: auto; flex: 1 1 220px; }
.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--card); }
.seg a { padding: .45rem .8rem; color: var(--ink); border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--gold); color: var(--accent-ink); }
.seg a:hover { text-decoration: none; }

/* ── 메시지 */
.messages { margin-bottom: 1rem; }
.msg { padding: .7rem .9rem; border-radius: 6px; margin-bottom: .5rem; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.msg.success { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.msg.error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.msg.warning { background: var(--warn-soft); border-color: var(--accent-line); color: var(--warn); }

/* ── 요약 숫자 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; }
.stat span { display: block; font-size: .78rem; color: var(--muted); }
.stat b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat small { color: var(--muted); }
.stat.warn { border-color: var(--accent-line); background: var(--accent-soft-2); }
.stat.warn b { color: var(--warn); }

/* ── 표 */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { background: var(--sub); text-align: left; font-weight: 600; font-size: .8rem; color: var(--label); padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.r { text-align: right; }
.tbl td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tfoot td { background: var(--sub-2); border-top: 1px solid var(--line); }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--accent-soft-2); }
.tbl tr.inactive td { color: var(--muted); }
.empty { color: var(--muted); padding: 1rem; text-align: center; }

.tag { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .76rem; background: var(--sub); color: var(--label); white-space: nowrap; vertical-align: middle; }
.tag.ok, .tag.inv-issued, .tag.st-ongoing { background: var(--ok-soft); color: var(--ok); }
.tag.warn, .tag.inv-draft, .tag.st-estimate { background: var(--warn-soft); color: var(--warn); }
.tag.inv-failed { background: var(--danger-soft); color: var(--danger); }
.tag.st-done { background: color-mix(in srgb, var(--t-purple) 13%, var(--card)); color: var(--t-purple); }
.tag.k-client { background: var(--accent-soft); color: var(--accent); }
.tag.c-material { background: color-mix(in srgb, var(--t-blue) 12%, var(--card)); color: var(--t-blue); }
.tag.c-labor { background: color-mix(in srgb, var(--t-orange) 13%, var(--card)); color: var(--t-orange); }
.tag.c-process { background: color-mix(in srgb, var(--t-green) 13%, var(--card)); color: var(--t-green); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: .2rem .7rem; font-size: .85rem; }

.tabs { position: sticky; top: 52px; z-index: 10; display: flex; gap: .2rem; background: var(--bg); padding: .5rem 0; margin: .5rem 0 .5rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: .45rem .9rem; border-radius: 6px; color: var(--ink); white-space: nowrap; }
.tabs a:hover { background: var(--sub); text-decoration: none; }
.tabs a span { color: var(--muted); font-size: .8rem; }
.section { padding-top: 1rem; scroll-margin-top: 110px; }

dl.kv { margin: 0; display: grid; gap: .3rem; }
dl.kv div { display: grid; grid-template-columns: 90px 1fr; gap: .5rem; }
dl.kv.row { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
dl.kv dt { color: var(--muted); font-size: .85rem; }
dl.kv dd { margin: 0; }
.grand-line { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); font-size: 1.05rem; }
.grand-line b { font-size: 1.3rem; }

/* ── 견적/세금계산서 품목 입력 */
.tbl.items td { padding: .35rem .3rem; }
.tbl.items input, .tbl.items select { min-height: 34px; font-size: .9rem; padding: .3rem .4rem; }
.tbl.items .w-unit { width: 70px; }
.tbl.items .w-qty { width: 90px; }
.tbl.items .w-money { width: 120px; }
.tbl.items .w-date { width: 140px; }
.tbl.items td.amount { font-weight: 600; white-space: nowrap; padding-right: .6rem; }
.tbl.items tr.deleted td { opacity: .35; text-decoration: line-through; }
.del { cursor: pointer; color: var(--muted); padding: .3rem; display: inline-block; }
.del:hover { color: var(--danger); }
.del input { display: none; }
.rownum { color: var(--muted); font-size: .8rem; }
.totals { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .4rem 1.6rem; margin-top: .4rem; font-variant-numeric: tabular-nums; }
.totals div { display: flex; flex-direction: column; align-items: flex-end; }
.totals span { font-size: .78rem; color: var(--muted); }
.totals b { font-size: 1.05rem; }
.totals .grand b { font-size: 1.35rem; color: var(--accent); }

.picker { border: 1px solid var(--accent-line); background: var(--accent-soft-2); border-radius: var(--radius); padding: .7rem; margin-bottom: .8rem; }
.picker-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .5rem; }
.picker-bar .input { width: auto; flex: 1 1 200px; }
.picker-bar select.input { flex: 0 1 200px; }
.picker-results { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.picker-results li { padding: .5rem .7rem; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; gap: .5rem; align-items: center; }
.picker-results li:hover { background: var(--accent-soft); }
.picker-results li .price { margin-left: auto; font-weight: 600; white-space: nowrap; }
.picker-results li.none { color: var(--muted); cursor: default; }
.est-list li { cursor: default; padding: 0; }
.est-list label { display: flex; gap: .5rem; align-items: center; padding: .5rem .7rem; width: 100%; cursor: pointer; flex-wrap: wrap; }
.est-list label b { margin-left: auto; }
.check-all { display: flex; align-items: center; gap: .3rem; cursor: pointer; }

.vat-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; }

/* ── 세금계산서 상세 */
.ti { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.ti-party { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.ti-party:first-child { border-top: 3px solid #c0392b; }
.ti-party:last-child { border-top: 3px solid var(--accent); }
.ti-party h3 a { font-weight: 400; margin-left: .4rem; }
.issue-box { border-color: var(--accent-line); }
.problems { margin: 0; padding-left: 1.2rem; color: var(--danger); }

/* ── 첨부 */
.attachments { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.att { border: 1px solid var(--line); border-radius: 6px; padding: .5rem; display: flex; flex-direction: column; gap: .4rem; }
.att img { width: 100%; height: 110px; object-fit: cover; border-radius: 4px; background: var(--sub); }
.file-icon { display: flex; align-items: center; justify-content: center; height: 110px; font-size: 2.5rem; background: var(--sub); border-radius: 4px; }
.att-actions { display: flex; gap: .3rem; }

.login { max-width: 380px; margin: 10vh auto 0; }
.login h1 { text-align: center; }
.login label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .8rem; }
.login .input { margin-top: .25rem; }

/* ── 휴대폰 */

/* ── 물량산출 */
.split { display: grid; grid-template-columns: minmax(320px, 42%) 1fr; gap: 1rem; align-items: start; }
.split.wide-right { grid-template-columns: 1fr 300px; }
.ref-panel { position: sticky; top: 64px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; }
.ref-tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .5rem; }
.ref-btn.on { background: var(--gold); color: var(--accent-ink); border-color: var(--accent); }
.ref-view { height: calc(100vh - 190px); min-height: 360px; background: var(--sub); border-radius: 6px; overflow: auto; }
.ref-view iframe { width: 100%; height: 100%; border: 0; }
.ref-view img { width: 100%; display: block; }
.ref-foot { margin-top: .4rem; display: flex; gap: .3rem; flex-wrap: wrap; }
.danger-link { color: var(--danger); font-size: .78rem; padding: .1rem .3rem; }
.group h2 small { font-weight: 400; font-size: .8rem; }
.result-line { display: flex; flex-wrap: wrap; gap: .5rem 1.6rem; padding: .6rem .8rem; background: var(--accent-soft); border-radius: 6px; margin-bottom: .6rem; }
.result-line div { display: flex; flex-direction: column; }
.result-line span { font-size: .75rem; color: var(--muted); }
.result-line b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.result-line div:first-child b { color: var(--accent); font-size: 1.25rem; }
details { margin-top: .5rem; }
details summary { cursor: pointer; font-weight: 600; font-size: .9rem; padding: .3rem 0; color: var(--label); }
.pattern-box { border-top: 1px solid var(--line); padding-top: .3rem; }
.bar-row { display: flex; align-items: center; gap: .6rem; margin: .35rem 0; }
.bar-count { width: 46px; text-align: right; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.bar { flex: 1; display: flex; height: 26px; border: 1px solid var(--line-2); border-radius: 3px; overflow: hidden; background: var(--card); }
.seg-piece { background: var(--accent-soft); border-right: 2px solid var(--card); font-size: .72rem; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; min-width: 0; color: var(--ink); }
.seg-rest { background: repeating-linear-gradient(45deg, var(--sub), var(--sub) 4px, var(--line) 4px, var(--line) 8px); font-size: .68rem; color: var(--muted); display: flex; align-items: center; justify-content: center; overflow: hidden; min-width: 0; }
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; margin-top: .4rem; }
.sheet-svg { width: 100%; height: auto; border: 1px solid var(--line-2); border-radius: 3px; }
.sheet-bg { fill: repeating-linear-gradient(45deg, #eee, #ddd); fill: #eef1f4; }
.sheet-piece { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 6; }
.sheet-fig { margin: 0; }
.sheet-fig figcaption { text-align: center; font-weight: 700; font-size: .85rem; margin-top: .2rem; }
.tbl.compact td, .tbl.compact th { padding: .3rem .5rem; font-size: .85rem; }
.add-group { border-style: dashed; }
.checks ul { list-style: none; padding: 0; margin: .2rem 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.checks label { display: flex; align-items: center; gap: .35rem; font-weight: 500; cursor: pointer; }
code { background: var(--sub); padding: 0 .3rem; border-radius: 3px; font-size: .85em; }

/* ── 계약서 */
textarea.mono { font-family: "D2Coding", "Consolas", "Malgun Gothic", monospace; font-size: .9rem; line-height: 1.6; }
.ph-panel { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
.ph-list { list-style: none; padding: 0; margin: .4rem 0; }
.ph-list li { margin-bottom: .25rem; }
.ph { border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent); border-radius: 4px; font: inherit; font-size: .8rem; padding: .1rem .4rem; cursor: pointer; }
.ph:hover { background: var(--accent-soft); }
.contract-body { line-height: 1.75; font-size: .92rem; max-height: 520px; overflow: auto; }
.contract-body h4.clause { margin: .9rem 0 .2rem; font-size: .95rem; }
.contract-body p { margin: 0; }
.tag.ct-sent { background: var(--warn-soft); color: var(--warn); }
.tag.ct-signed { background: var(--ok-soft); color: var(--ok); }
.tag.ct-canceled { background: var(--danger-soft); color: var(--danger); }

@media (max-width: 760px) {
  .split, .split.wide-right { grid-template-columns: 1fr; }
  .ref-panel, .ph-panel { position: static; max-height: none; }
  .ref-view { height: 60vh; }
  body { font-size: 16px; }
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 52px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--top); padding: .5rem; box-shadow: 0 6px 16px rgba(0,0,0,.2); }
  body.nav-open .nav { display: flex; }
  .nav a { padding: .7rem .8rem; }
  .nav-user { margin: .3rem 0 0; border-top: 1px solid rgba(255,255,255,.1); padding-top: .3rem; justify-content: space-between; }
  .page { padding: .9rem .8rem 5rem; }
  h1 { font-size: 1.25rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat b { font-size: 1.05rem; }
  .ti { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .tabs { top: 52px; }

  /* 표 → 카드 */
  .table-wrap { background: transparent; border: 0; overflow: visible; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td, .tbl tfoot { display: block; width: 100%; }
  .tbl tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .5rem; padding: .4rem .7rem; }
  .tbl td { border: 0; padding: .2rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; flex-shrink: 0; }
  .tbl td[data-label=""]::before, .tbl td:not([data-label])::before { content: none; }
  .tbl td:empty { display: none; }
  .tbl tfoot tr { background: var(--sub-2); }
  .tbl tfoot td { border: 0; justify-content: flex-end; }

  .tbl.items tr { position: relative; padding: .6rem .7rem; }
  .tbl.items td { align-items: center; padding: .25rem 0; }
  .tbl.items td input, .tbl.items td select { width: 62%; flex: 0 0 62%; }
  .tbl.items .w-unit, .tbl.items .w-qty, .tbl.items .w-money, .tbl.items .w-date { width: 100%; }
  .tbl.items td.c:last-child { position: absolute; top: .3rem; right: .4rem; width: auto; }
  .tbl.items td.c:first-child { justify-content: flex-start; }
  .totals { justify-content: space-between; }
  .actions.sticky { padding-bottom: .8rem; }
  .actions.sticky .btn { flex: 1; }
}
@media print {
  .topbar, .modebar, .actions, .danger-zone, .tabs, .btn { display: none !important; }
  body { background: var(--card); }
}

/* ── 인건비 */
.crew-list { display: flex; flex-wrap: wrap; gap: .3rem .8rem; }
.crew { display: flex; align-items: center; gap: .3rem; padding: .3rem .5rem; background: var(--card); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
#grade-totals:empty { display: none; }
.extra-box .head-row { margin: 0; }

/* ── 금액 칸: 콤마 + 원 */
.money-field { position: relative; display: block; }
.money-field input { padding-right: 1.9rem !important; text-align: right; font-variant-numeric: tabular-nums; }
.money-field .won-unit { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }
.tbl.items .money-field input { padding-right: 1.6rem !important; }
.tbl.items .money-field .won-unit { right: .45rem; font-size: .8rem; }
@media (max-width: 760px) {
  .tbl.items td .money-field { width: 62%; flex: 0 0 62%; }
  .tbl.items td .money-field input { width: 100%; }
}

/* ── 견적 구분 제목 줄 */
.tbl.items tr.section-row td { background: var(--accent-soft-2); }
.tbl.items tr.section-row td.item-only > * { visibility: hidden; }
.tbl.items tr.section-row .name-cell { position: relative; }
.tbl.items tr.section-row .name-cell input { font-weight: 700; padding-left: 1.5rem; border-color: var(--accent-line); }
.tbl.items tr.section-row .name-cell::before { content: "◆"; position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: .8rem; z-index: 1; }
.tbl.items tr.section-row .rownum { color: var(--accent); }
.tbl.items tr.excluded-row .amount, .tbl.items tr.excluded-row .w-money input { text-decoration: line-through; color: var(--danger); }
.excl { display: flex; align-items: center; gap: .25rem; font-size: .72rem; color: var(--muted); margin-top: .2rem; cursor: pointer; white-space: nowrap; }
.excl input { width: 13px !important; height: 13px; min-height: 0 !important; flex: none !important; }
.ctl { white-space: nowrap; }
.mv { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .7rem; padding: .2rem .15rem; }
.mv:hover { color: var(--accent); }
@media (max-width: 760px) {
  .tbl.items tr.section-row td.item-only { display: none; }
  .tbl.items tr.section-row { border-color: var(--accent-line); background: var(--accent-soft-2); }
  .tbl.items td.ctl { position: absolute; top: .3rem; right: .4rem; width: auto; }
  .remark-cell { flex-wrap: wrap; }
}
.tbl tr.sec-row td { background: var(--accent-soft-2); }
.tbl tr.ex-row td { color: var(--muted); }
.tbl tr.ex-row td.r { text-decoration: line-through; color: var(--danger); }
@media (max-width: 760px) { .tbl tr.sec-row td:first-child { display: none; } }
.tbl.items tr.section-row td.amount { color: transparent; }

/* ── 세금계산서 분리 */
.split-box { border-color: var(--accent-line); background: var(--accent-soft-2); }
.split-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; margin: .6rem 0; }
.split-card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .6rem .7rem; }
.split-card ul { margin: .3rem 0; padding-left: 1rem; font-size: .85rem; }
.split-card li span { float: right; font-variant-numeric: tabular-nums; }
.base-load { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin-top: .9rem; padding: .7rem .8rem; background: var(--accent-soft); border-radius: 6px; }
.base-load small { flex-basis: 100%; }

/* ── 단가표 저장 */
.save-price { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 4px; font: inherit; font-size: .7rem; padding: .15rem .35rem; margin-right: .2rem; cursor: pointer; white-space: nowrap; }
.save-price:hover { color: var(--accent); border-color: var(--accent-line); }
.save-price.saved { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.tbl.items tr.section-row .save-price { display: none; }
.save-prices-opt { display: flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--label); margin-right: auto; cursor: pointer; }
.save-prices-opt input { width: 16px; height: 16px; }
@media (max-width: 760px) { .save-prices-opt { flex-basis: 100%; } }
.tbl.items td.item-only select { min-width: 66px; }

/* ── 공사 화면 최종 금액 */
.stat-main { grid-column: span 2; border-color: var(--accent-line); background: var(--accent-soft-2); }
.stat-main b { font-size: 1.9rem; color: var(--accent); line-height: 1.25; }
.stat-breakdown { list-style: none; margin: .45rem 0 0; padding: .4rem 0 0; border-top: 1px dashed var(--accent-line); font-size: .82rem; }
.stat-breakdown li { display: flex; justify-content: space-between; gap: .6rem; font-variant-numeric: tabular-nums; }
.stat-breakdown li.warn-text { font-weight: 600; }
@media (max-width: 760px) { .stat-main b { font-size: 1.5rem; } }
input.money.is-auto { background: var(--sub); color: var(--label); }

/* ── 비용처리 체크 */
.pay-toggle { border: 1px solid var(--accent-line); background: var(--warn-soft); color: var(--warn); border-radius: 99px; font: inherit; font-size: .76rem; padding: .1rem .55rem; cursor: pointer; white-space: nowrap; }
.pay-toggle.on { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); }
.pay-toggle:hover { filter: brightness(.96); }

/* ── 지출 통계 */
.stats-filter .grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.date-range { display: flex; gap: .4rem; align-items: center; }
.date-range .input { flex: 1; min-width: 0; }
.period-seg a { flex: 1; text-align: center; padding: .45rem .3rem; }
.share { position: relative; height: 18px; background: var(--sub); border-radius: 4px; overflow: hidden; }
.share span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-line); border-radius: 4px; }
.share em { position: relative; font-style: normal; font-size: .75rem; padding-left: .4rem; line-height: 18px; color: var(--ink); }
.date-tbl td.muted { color: var(--muted); }
@media (max-width: 760px) { .bar-cell { display: none !important; } .share { width: 60%; } }
@media (max-width: 760px) { .date-tbl td.muted { display: none !important; } .stats .stat-main { grid-column: 1 / -1; } }

/* ── 공사 요약 카드 (한 장씩 넘겨보기) */
.deck { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 1rem; overflow: hidden; outline: none; }
.deck:focus-visible { box-shadow: 0 0 0 3px var(--accent-line); }
.deck-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem .7rem .2rem; flex-wrap: wrap; }
.deck-tabs { display: flex; gap: .2rem; flex-wrap: wrap; }
.deck-tabs button { border: 0; background: none; font: inherit; font-size: .85rem; color: var(--muted); padding: .35rem .7rem; border-radius: 99px; cursor: pointer; position: relative; }
.deck-tabs button:hover { background: var(--sub); color: var(--ink); }
.deck-tabs button.on { background: var(--gold); color: var(--accent-ink); }
.deck-tabs button.dot-warn::after, .deck-tabs button.dot-neg::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.deck-tabs button.dot-neg::after { background: var(--danger); }
.deck-nav { display: flex; align-items: center; gap: .3rem; }
.deck-arrow { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 1.5rem; line-height: 1; color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; padding-bottom: 3px; }
.deck-arrow:hover { border-color: var(--accent); color: var(--accent); }
.deck-count { font-size: .85rem; color: var(--muted); min-width: 3rem; text-align: center; font-variant-numeric: tabular-nums; }
.deck-count b { color: var(--ink); }
.deck-track { display: flex; transition: transform .35s ease; will-change: transform; }
.deck-card { flex: 0 0 100%; min-width: 100%; padding: 1rem 1.4rem 1.1rem; box-sizing: border-box; }
.deck-card.is-warn { background: linear-gradient(180deg, var(--accent-soft-2), var(--card) 70%); }
.deck-card.is-neg { background: linear-gradient(180deg, var(--danger-soft), var(--card) 70%); }
.deck-label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .15rem; }
.deck-num { display: block; font-size: 2.7rem; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.deck-num small { font-size: 1.1rem; font-weight: 600; margin-left: .2rem; color: var(--muted); }
.deck-num.accent { color: var(--accent); }
.deck-num.warn { color: var(--warn); }
.deck-num.neg, .deck-list .neg { color: var(--danger); }
.deck-sub { margin: .2rem 0 .6rem; color: var(--muted); font-size: .9rem; }
.deck-list { list-style: none; margin: 0; padding: .5rem 0 0; border-top: 1px dashed var(--line); max-width: 520px; }
.deck-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .18rem 0; font-variant-numeric: tabular-nums; }
.deck-list li.warn-text { font-weight: 600; }
.deck-meter { height: 8px; background: var(--sub); border-radius: 99px; overflow: hidden; max-width: 520px; margin-bottom: .6rem; }
.deck-meter span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.deck-meter.ok span { background: var(--ok); }
.deck-link { display: inline-block; margin-top: .6rem; font-size: .85rem; }
.deck-dots { display: flex; justify-content: center; gap: .35rem; padding: 0 0 .7rem; }
.deck-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); cursor: pointer; transition: width .2s; }
.deck-dots span.on { background: var(--accent); width: 20px; border-radius: 99px; }
@media (max-width: 760px) {
  .deck-head { padding: .5rem .5rem 0; }
  .deck-tabs { display: none; }
  .deck-nav { width: 100%; justify-content: space-between; }
  .deck-card { padding: .6rem 1rem 1rem; }
  .deck-num { font-size: 2.1rem; }
}

/* ── 발주처 입력 */
.ok-text { color: var(--ok) !important; font-weight: 600; }
.new-client { margin-top: .8rem; padding: .8rem .9rem; border: 1px dashed var(--accent-line); background: var(--accent-soft-2); border-radius: 8px; }
.new-client .head-row { margin-bottom: .5rem; justify-content: flex-start; }
.temp-client form { margin-left: .4rem; }

/* ── 지출 일괄 지급 */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; padding: .5rem .7rem; margin-bottom: .5rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.bulk-bar.active { border-color: var(--accent-line); background: var(--accent-soft-2); }
.bulk-all { display: flex; align-items: center; gap: .3rem; font-size: .88rem; cursor: pointer; }
.bulk-all input, .pay-chk { width: 17px; height: 17px; cursor: pointer; }
.bulk-actions { display: flex; gap: .4rem; align-items: center; margin-left: auto; }
.bulk-actions .input { width: auto; min-height: 30px; padding: .2rem .4rem; font-size: .85rem; }
.bulk-bar:not(.active) .bulk-actions button { opacity: .5; pointer-events: none; }
.tbl th.chk-col, .tbl td.chk-col { width: 34px; }
@media (max-width: 760px) {
  .bulk-actions { margin-left: 0; width: 100%; }
  .bulk-actions .input { flex: 1; }
  .tbl td.chk-col { justify-content: flex-start; }
}

/* ── 단가 한꺼번에 입력 */
.paste-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.paste-row .input { width: auto; flex: 1 1 220px; }
.inline-price { display: inline-block; width: 140px; }
.inline-price input { min-height: 32px; padding: .2rem 1.6rem .2rem .4rem !important; border-color: transparent; background: transparent; }
.inline-price input:hover { border-color: var(--line); background: var(--card); }
.inline-price input:focus { background: var(--card); }
.saved-flash { background: var(--ok-soft) !important; transition: background .3s; }
@media (max-width: 760px) { .inline-price { width: 60%; } }
.tax-periods a { flex: 1 1 auto; white-space: nowrap; }
.ext-card { border-color: var(--accent-line); background: var(--accent-soft-2); }

/* ── AI 입력 */
.ai-btn { border-color: var(--ai-line); color: var(--ai); background: var(--ai-soft); }
.ai-btn:hover { background: var(--ai-soft); border-color: var(--ai-line); }
.paste-label { display: block; font-weight: 600; margin-bottom: .4rem; }
.paste-tbl td { padding: .3rem .25rem; vertical-align: top; }
.paste-tbl .input { min-height: 34px; font-size: .88rem; padding: .3rem .4rem; }
.paste-tbl td small.warn-text { display: block; font-size: .72rem; margin-top: .15rem; }
.paste-tbl tr.off td { opacity: .4; }
.paste-tbl tr.has-warn td { background: var(--accent-soft-2); }
.paste-tbl input[type=checkbox] { width: 18px; height: 18px; margin-top: .45rem; }
@media (min-width: 761px) {
  .paste-tbl .w-cat select { min-width: 112px; }
  .paste-tbl .w-desc input { min-width: 170px; }
  .paste-tbl .w-money .money-field { min-width: 118px; display: block; }
  .paste-tbl .vatmode { min-width: 104px; }
  .paste-tbl td[data-label="거래처"] select { min-width: 100px; }
  .paste-tbl .w-ev select { min-width: 104px; }
  .paste-tbl .w-memo input { min-width: 70px; }
  .paste-tbl .w-date { width: 132px; }
}

/* ── 프리랜서 계약서 */
.subtabs { position: static; margin-top: 0; }
.subtabs a.on, .tabs a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.info { background: var(--ai-soft); color: var(--ai); }
.btn.small { padding: .25rem .6rem; min-height: 30px; font-size: .82rem; }
.sub-h { margin: 1.2rem 0 .5rem; font-size: 1rem; }
.contract-preview { line-height: 1.75; font-size: .92rem; white-space: normal; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: .8rem; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline-form .input { width: auto; flex: 1 1 220px; }

/* ── 가격 규칙 */
.rule-chip { display: inline-block; font-size: .8rem; padding: .15rem .5rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.rule-add { font-size: .8rem; color: var(--muted); }
.rule-add:hover { color: var(--accent); }
.rule-item { font-size: 1.02rem; margin: -.3rem 0 .6rem; }
.ai-card { border-color: var(--ai-line); background: var(--ai-soft); }
.ai-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.ai-row > .input { flex: 1 1 260px; }
.file-pick { font-size: .85rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.rule-tbl { max-width: 520px; margin-bottom: .5rem; }
.rule-tbl .input { min-height: 34px; }
.rule-over { margin-top: .8rem; max-width: 620px; }
.rule-grid th { white-space: nowrap; font-size: .82rem; }
.rule-grid td .input { min-width: 92px; min-height: 34px; text-align: right; }
.ok-text { color: var(--ok); }
.picker-results li { flex-wrap: wrap; }
.picker-results li .dims-box { flex-basis: 100%; width: 100%; margin-top: .4rem; padding: .5rem; background: var(--sub-2); border-radius: 6px; cursor: default; }
.dims-row { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.dims-row .input { width: 96px; min-height: 34px; padding: .3rem .45rem; }
.dims-row .d-q { width: 60px; }

/* ── 폰 웹앱 */
@media (max-width: 760px) {
  /* 아이폰: 입력칸을 누를 때 화면이 확대되지 않도록 16px 이상 */
  input.input, select.input, textarea.input, .input { font-size: 16px; }
  .topbar { padding-top: env(safe-area-inset-top); }
  .actions.sticky { padding-bottom: calc(.6rem + env(safe-area-inset-bottom)); }
}
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
}

/* ── 매입 세금계산서 */
.ti-badge { text-decoration: none; font-size: .95rem; margin-right: .15rem; }
.ti-badge:hover { filter: brightness(1.2); text-decoration: none; }
.nav-badge { display: inline-block; min-width: 18px; padding: 0 .35rem; border-radius: 9px; background: #e5484d; color: #fff; font-size: .72rem; line-height: 18px; text-align: center; margin-left: .15rem; }
ul.cand { list-style: none; padding: 0; margin: .3rem 0 .8rem; }
ul.cand li { padding: .45rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* ── 회사 자료 */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .8rem; margin-bottom: .8rem; }
.stat-row .stat { display: flex; flex-direction: column; gap: .25rem; margin: 0; }
.stat-row .stat > b { font-size: 1.35rem; }
.up-list { list-style: none; padding: 0; margin: .2rem 0 0; font-size: .9rem; }
.up-list li { padding: .15rem 0; }
.rec-tbl .mono, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; }
.rec-tbl td { vertical-align: top; }

/* ── 팝업 공통 */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 35, .45); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-box { background: var(--card); border-radius: 12px; width: min(460px, 100%); max-height: 88vh; overflow: auto; padding: 1.2rem 1.3rem 1rem; position: relative; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.modal-box h2 { margin: 0 2rem .1rem 0; }
.modal-x { position: absolute; top: .6rem; right: .7rem; border: 0; background: none; font-size: 1.2rem; cursor: pointer; color: var(--muted); }
.modal-box .btn-group { margin-top: .8rem; flex-wrap: wrap; }
a.partner-pop { color: inherit; text-decoration: underline dotted var(--line-2); text-underline-offset: 3px; }
a.partner-pop:hover { color: var(--accent); }

/* ── 요약 카드 + 현장 사진 */
.sum-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: .8rem; margin-bottom: 1rem; align-items: stretch; }
.sum-wrap .deck { margin-bottom: 0; }
.photo-panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7rem; display: flex; flex-direction: column; gap: .5rem; min-height: 0; }
.pp-head { display: flex; align-items: center; gap: .4rem; }
.pp-up { margin-left: auto; cursor: pointer; }
.pp-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 64px; gap: 4px; flex: 1; }
.pp-cell { display: block; overflow: hidden; border-radius: 6px; background: var(--sub); }
.pp-cell.big { grid-column: 1 / -1; grid-row: span 3; }
.pp-cell img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.pp-cell:hover img { transform: scale(1.04); }
.pp-all { font-size: .85rem; text-align: right; }
.pp-empty { flex: 1; min-height: 180px; border: 2px dashed var(--line-2); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; color: var(--ink); }
.pp-empty:hover { border-color: var(--accent); background: var(--sub-2); }
.pp-progress { height: 22px; background: var(--sub); border-radius: 99px; position: relative; overflow: hidden; }
.pp-progress span { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent-line); transition: width .3s; }
.pp-progress small { position: relative; display: block; text-align: center; line-height: 22px; font-size: .78rem; }
@media (max-width: 900px) { .sum-wrap { grid-template-columns: 1fr; } }
.photo-day h3 { margin: 1rem 0 .4rem; font-size: .95rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.photo-item { margin: 0; cursor: pointer; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.photo-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photo-item figcaption { font-size: .78rem; padding: .3rem .4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; } .photo-item figcaption { display: none; } }
.tag.ph-before { background: color-mix(in srgb, var(--t-blue) 12%, var(--card)); color: var(--t-blue); } .tag.ph-done { background: var(--ok-soft); color: var(--ok); }
.tag.ph-issue { background: var(--danger-soft); color: var(--danger); } .tag.ph-progress { background: var(--accent-soft); color: var(--accent); }
.input.sm { min-height: 32px; padding: .2rem .45rem; font-size: .85rem; width: auto; }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(8, 12, 18, .92); display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 94vw; max-height: calc(100vh - 120px); object-fit: contain; }
.lb-close { position: absolute; top: .6rem; right: .8rem; background: none; border: 0; color: #fff; font-size: 1.6rem; cursor: pointer; }
.lb-nav { position: absolute; top: 45%; background: rgba(255,255,255,.12); border: 0; color: #fff; font-size: 2.4rem; width: 52px; height: 72px; border-radius: 8px; cursor: pointer; }
.lb-nav.prev { left: .6rem; } .lb-nav.next { right: .6rem; }
.lb-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; padding: .6rem; background: rgba(0,0,0,.55); padding-bottom: calc(.6rem + env(safe-area-inset-bottom)); }
.lb-bar .lb-memo { flex: 1 1 220px; max-width: 420px; }
@media (max-width: 760px) { .lb-nav { display: none; } }
.up-list b { display: inline; font-size: .95rem; margin-right: .2rem; }
.up-list .tag { display: inline-block; width: auto; }
td[data-label="견적번호"], td[data-label="발행일자"] { white-space: nowrap; }

/* ── 폰 앱 모드 */
.app-tabbar { display: none; }
body.app-mode .app-tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(0,0,0,.05); }
.app-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: .35rem 0 .3rem; font-size: .72rem; color: var(--muted); text-decoration: none; position: relative; }
.app-tabbar a span { font-size: 1.25rem; line-height: 1.2; }
.app-tabbar a.on { color: var(--accent); font-weight: 700; }
.app-tabbar a i { position: absolute; top: 2px; left: 55%; font-style: normal; background: #e5484d; color: #fff; border-radius: 9px; font-size: .65rem; padding: 0 .3rem; line-height: 15px; }
body.app-mode .page { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
body.app-mode .actions.sticky { bottom: calc(58px + env(safe-area-inset-bottom)); }
body.app-mode .lightbox { z-index: 80; }
@media (min-width: 900px) { body.app-mode .app-tabbar { max-width: 520px; margin: 0 auto; border-radius: 14px 14px 0 0; } }
.app-home { max-width: 560px; margin: 0 auto; }
.app-proj { display: block; margin-bottom: .8rem; }
.app-proj span { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .2rem; }
.app-proj select { font-size: 1.05rem; font-weight: 600; min-height: 48px; }
.app-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  font-weight: 700; color: var(--ink); text-decoration: none; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.03); -webkit-tap-highlight-color: transparent; }
.tile span { font-size: 1.8rem; }
.tile:active { transform: scale(.98); background: var(--sub-2); }
.tile.ai { background: var(--ai-soft); border-color: var(--ai-line); }
.tile.wide { grid-column: 1 / -1; min-height: 56px; flex-direction: row; }
.tile.wide span { font-size: 1.3rem; }
.app-cards { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.app-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.app-card b { font-size: 1.15rem; }
.app-card small { color: var(--muted); }
.app-card.warn b { color: var(--warn); }
.app-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.app-list a { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .65rem .8rem; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
p.c { text-align: center; }

/* AI 견적 — 참고 견적서 */
.ref-box { border: 1px dashed var(--line); border-radius: 10px; padding: .8rem .9rem; margin: .4rem 0 1rem; background: var(--sub-2); }
.ref-picked { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .6rem; }
.ref-chip { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; background: var(--accent-soft); border-radius: 8px; padding: .35rem .6rem; font-size: .88rem; }
.ref-chip .x { margin-left: auto; border: 0; background: transparent; cursor: pointer; font-size: 1rem; color: var(--muted); }
.ref-chip .x:hover { color: var(--danger); }
.ref-search { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.ref-search .input { flex: 1 1 240px; }
.ref-results { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.ref-row { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-bottom: 1px solid var(--line); }
.ref-row:last-child { border-bottom: 0; }
.ref-row.on { background: var(--accent-soft-2); }
.ref-main { flex: 1; min-width: 0; }
.ref-main > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-results > .small { padding: .7rem; }
@media (max-width: 640px) { .ref-main > div { white-space: normal; } }
.login-logo { display: block; width: 72px; height: 72px; margin: 0 auto .6rem; border-radius: 18px; }

/* ── PC 화면: 글씨·버튼 한 단계 작게 (v30) — 폰(760px 이하)은 그대로 */
@media (min-width: 761px) {
  html { font-size: 14.5px; }
  body { font-size: 13.5px; }
  .topbar { height: 46px; }
  .tabs { top: 46px; }
  .brand { font-size: 1.05rem; }
  .nav a { padding: .35rem .6rem; }
  .btn { min-height: 33px; padding: .3rem .8rem; }
  .btn.sm, .btn.small { min-height: 27px; }
  .btn.big { min-height: 40px; }
  input.input, select.input, textarea.input, .input { min-height: 33px; }
  textarea.input { min-height: 64px; }
  .field.check label { min-height: 33px; }
  .tbl.items input, .tbl.items select, .paste-tbl .input, .rule-tbl .input { min-height: 30px; }
  .deck-arrow { width: 34px; height: 34px; }
}

/* ── 일정 (v30) */
:root { --k-meeting: #2563b8; --k-measure: #7a4fc4; --k-construct: #1d8a52; --k-repair: #c4562a; --k-etc: #6e6a62;
  --t-blue: #2563b8; --t-orange: #b4500f; --t-green: #1d7a4a; --t-purple: #5b3fb3; }
.tag.k-meeting { background: color-mix(in srgb, var(--k-meeting) 13%, var(--card)); color: var(--k-meeting); }
.tag.k-measure { background: color-mix(in srgb, var(--k-measure) 13%, var(--card)); color: var(--k-measure); }
.tag.k-construct { background: color-mix(in srgb, var(--k-construct) 13%, var(--card)); color: var(--k-construct); }
.tag.k-repair { background: color-mix(in srgb, var(--k-repair) 13%, var(--card)); color: var(--k-repair); }
.tag.k-etc { background: var(--sub); color: var(--k-etc); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .3rem; vertical-align: middle; }
.dot.k-meeting, .ev.k-meeting, .wk-ev.k-meeting { --kc: var(--k-meeting); }
.dot.k-measure, .ev.k-measure, .wk-ev.k-measure { --kc: var(--k-measure); }
.dot.k-construct, .ev.k-construct, .wk-ev.k-construct { --kc: var(--k-construct); }
.dot.k-repair, .ev.k-repair, .wk-ev.k-repair { --kc: var(--k-repair); }
.dot.k-etc, .ev.k-etc, .wk-ev.k-etc { --kc: var(--k-etc); }
.dot { background: var(--kc); }
.d-block { display: block; }
.sun { color: var(--danger); } .sat { color: var(--k-meeting); }

.cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: .5rem; }
.cal-nav { display: flex; align-items: center; gap: .3rem; }
.cal-title { font-size: 1.15rem; margin: 0 .3rem 0 .5rem; }
.cal-filter { display: flex; gap: .4rem; margin-left: auto; }
.cal-filter .input { width: auto; max-width: 220px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-bottom: .6rem; color: var(--ink); }

.cal-month { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: .4rem; text-align: center; font-size: .82rem; font-weight: 600; background: var(--sub); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 112px; padding: .25rem .3rem .4rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-week:last-child .cal-day { border-bottom: 0; }
.cal-day:hover { background: var(--sub-2); }
.cal-day.other { background: var(--sub-2); }
.cal-day.other .cal-num { color: var(--muted); }
.cal-num { font-size: .82rem; font-weight: 600; width: 1.7em; height: 1.7em; line-height: 1.7em; text-align: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--gold); color: var(--accent-ink); }
.ev { display: block; font-size: .76rem; line-height: 1.35; padding: .08rem .35rem; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #fff; background: var(--kc); }
.ev:hover { text-decoration: none; filter: brightness(1.08); }
.ev b { font-weight: 700; }
.ev.done, .wk-ev.done { opacity: .5; text-decoration: line-through; }
.ev-more { font-size: .74rem; color: var(--muted); padding-left: .3rem; }

.cal-wk { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.wk-head, .wk-allday, .wk-body { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); }
.wk-head > div { padding: .4rem; text-align: center; font-weight: 600; border-bottom: 1px solid var(--line); background: var(--sub); }
.wk-head > div a { color: inherit; }
.wk-head .today a { background: var(--gold); color: var(--accent-ink); padding: .1rem .5rem; border-radius: 99px; }
.wk-allday { border-bottom: 1px solid var(--line); min-height: 30px; }
.wk-allday > div:first-child { padding: .3rem; text-align: right; }
.wk-cell { padding: 3px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-width: 0; }
.wk-body { position: relative; }
.wk-hours div { height: var(--hour); font-size: .72rem; color: var(--muted); text-align: right; padding-right: .4rem; transform: translateY(-.5em); }
.wk-hours div:first-child { transform: none; }
.wk-col { position: relative; border-left: 1px solid var(--line); cursor: pointer;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour) - 1px), var(--sub) calc(var(--hour) - 1px), var(--sub) var(--hour)); }
.wk-col.today { background-color: var(--accent-soft-2); }
.wk-col:hover { background-color: var(--sub-2); }
.wk-ev { position: absolute; overflow: hidden; font-size: .74rem; line-height: 1.3; padding: .15rem .3rem; border-radius: 5px; color: #fff;
  background: var(--kc); border-left: 3px solid rgba(0,0,0,.18); }
.wk-ev:hover { text-decoration: none; filter: brightness(1.08); z-index: 2; }

.agenda { display: flex; flex-direction: column; gap: .5rem; }
.ag-day { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .8rem; }
.ag-day.today { border-color: var(--accent); }
.ag-date { margin-bottom: .3rem; }
.ag-items { display: flex; flex-direction: column; }
.ag-item { display: flex; align-items: flex-start; gap: .55rem; padding: .4rem 0; border-top: 1px solid var(--line); color: var(--ink); }
.ag-item:first-child { border-top: 0; }
.ag-item:hover { text-decoration: none; background: var(--sub-2); }
.ag-item.done .ag-main { color: var(--muted); text-decoration: line-through; }
.ag-time { min-width: 6.4em; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .88rem; padding-top: .05rem; }
.ag-main { flex: 1; min-width: 0; }

.kind-pick { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.kind-pick label { cursor: pointer; }
.kind-pick input { position: absolute; opacity: 0; pointer-events: none; }
.kind-pick span { display: inline-block; padding: .35rem 1rem; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-weight: 600; }
.kind-pick label.k-meeting { --kc: var(--k-meeting); } .kind-pick label.k-measure { --kc: var(--k-measure); }
.kind-pick label.k-construct { --kc: var(--k-construct); } .kind-pick label.k-repair { --kc: var(--k-repair); } .kind-pick label.k-etc { --kc: var(--k-etc); }
.kind-pick span { color: var(--kc); border-color: color-mix(in srgb, var(--kc) 35%, var(--card)); }
.kind-pick input:checked + span { background: var(--kc); color: #fff; border-color: var(--kc); }
.kind-pick input:focus-visible + span { outline: 2px solid var(--kc); outline-offset: 2px; }
.time-pair { display: flex; align-items: center; gap: .4rem; }
.time-pair .input { flex: 1; }

.history { list-style: none; margin: 0 0 .8rem; padding: 0 0 0 .2rem; border-left: 2px solid var(--line); }
.history li { position: relative; display: flex; align-items: baseline; flex-wrap: wrap; gap: .2rem .6rem; padding: .35rem 0 .35rem 1rem; }
.history li::before { content: ""; position: absolute; left: -7px; top: .75rem; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--line-2); }
.history li.now::before { background: var(--accent); border-color: var(--accent); }
.history li.future::before { border-color: var(--warn); }
.history li.past.done::before { background: var(--ok); border-color: var(--ok); }
.history .h-date { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 8.6em; }
.history .h-time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 3em; }
.history .h-text { color: var(--ink); flex: 1; min-width: 12em; }
.history li.past .h-date { color: var(--muted); }
.quick-sch { display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem; background: var(--sub); border-radius: 8px; }
.quick-sch .input { width: auto; }
.quick-sch .q-title { flex: 1 1 220px; }

.upcoming { margin-bottom: 1rem; }
.upcoming .head-row { margin-bottom: .3rem; }
.upcoming h3 { margin: 0; }
.up-ev { list-style: none; margin: 0; padding: 0; }
.up-ev a { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; color: var(--ink); border-top: 1px solid var(--line); }
.up-ev li:first-child a { border-top: 0; }
.up-ev a:hover { text-decoration: none; background: var(--sub-2); }
.up-d { min-width: 5.6em; font-weight: 600; font-variant-numeric: tabular-nums; }
.up-d.is-today { color: var(--accent); }
.up-t { min-width: 3em; color: var(--muted); font-variant-numeric: tabular-nums; }
.up-x { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 760px) {
  .cal-filter { margin-left: 0; width: 100%; }
  .cal-filter .input { flex: 1; max-width: none; }
  .cal-day { min-height: 64px; padding: .15rem; }
  .cal-day .ev { font-size: 0; height: 6px; padding: 0; border-radius: 3px; }
  .cal-day .ev b { display: none; }
  .ev-more { font-size: .66rem; padding: 0; }
  .wk-head, .wk-allday, .wk-body { grid-template-columns: 34px repeat(7, minmax(0, 1fr)); }
  .wk-head > div { padding: .3rem 0; font-size: .8rem; }
  .wk-head small { display: none; }
  .wk-ev { font-size: .62rem; padding: .1rem; }
  .wk-hours div { font-size: .6rem; padding-right: .15rem; }
  .history .h-date { min-width: 0; }
  .quick-sch .input { flex: 1 1 40%; }
}
.hint-m { display: none; }
@media (max-width: 760px) { .hint-pc { display: none; } .hint-m { display: inline; } .cal-day .ev { pointer-events: none; } }


/* ── 폰 앱 = 블랙 테마 (v32) */
body.app-mode {
  color-scheme: dark;
  --bg: #111113; --card: #1a1a1e; --sub: #24242a; --sub-2: #1f1f23;
  --ink: #f3efe6; --label: #d6d1c7; --muted: #a19c92; --line: #2e2e34; --line-2: #3e3e45;
  --top: #0b0b0c; --accent: #e8a317; --accent-soft: #3a2a08; --accent-soft-2: #221a0c; --accent-line: #5a4316;
  --ok: #4cc488; --ok-soft: #14301f; --ok-line: #245a3b; --warn: #f0a040; --warn-soft: #33240e;
  --danger: #f07264; --danger-soft: #3a1a17; --danger-line: #6a2a25;
  --ai: #b79bea; --ai-soft: #251d38; --ai-line: #4a3a70;
  --k-meeting: #7fb2f0; --k-measure: #b79bea; --k-construct: #5fcb92; --k-repair: #ee8a6a; --k-etc: #a19c92;
  --t-blue: #7fb2f0; --t-orange: #f0a070; --t-green: #5fcb92; --t-purple: #b79bea;
}
body.app-mode input, body.app-mode select, body.app-mode textarea { color: var(--ink); }
body.app-mode .ev, body.app-mode .wk-ev, body.app-mode .kind-pick input:checked + span { color: #111113; }
body.app-mode .modal { background: rgba(0, 0, 0, .6); }
body.app-mode .app-tabbar { background: #0b0b0c; box-shadow: none; }
body.app-mode .tile:active { background: var(--sub); }

/* ── 실루엣 아이콘 (v32) */
.ic { display: inline-block; width: 1.1em; height: 1.1em; fill: currentColor; vertical-align: -.17em; flex: none; }
.h-ic { color: var(--accent); vertical-align: -.12em; }
.ai-ic { color: var(--ai); }
.btn .ic { width: 1.05em; height: 1.05em; }
.menu-btn .ic { width: 26px; height: 26px; vertical-align: middle; }
.app-tabbar a .ic { width: 22px; height: 22px; margin-bottom: 2px; }
.tile .ic { width: 28px; height: 28px; color: var(--accent); }
.file-icon .ic { width: 40px; height: 40px; color: var(--muted); }
.ti-badge { color: var(--accent); }
.clip, .clip .ic { color: var(--muted); }
body.app-mode .tile.ai { background: var(--card); border-color: var(--line); }
input[type=checkbox], input[type=radio] { accent-color: var(--gold); }
