:root {
  /* 회색 · 진회색 · 흰색 기반 */
  --bg: #f1f2f4; --card: #fff; --line: #dfe1e5; --line2: #eceef1;
  --text: #1f2124; --muted: #6e737b; --primary: #2e3136; --primary-weak: #e6e7ea;
  --dark: #2e3136; --dark2: #3c4046; --dark-text: #c9ccd1;
  --danger: #d4343f; --danger-weak: #fdecee; --warn: #c77700; --warn-weak: #fff4e0;
  --ok: #138a52; --ok-weak: #e3f6ec;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --side: 240px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
h2 .count { color: var(--muted); font-weight: 500; font-size: 14px; }
h2 .more { margin-left: auto; font-size: 13px; font-weight: 500; }
small, .muted { color: var(--muted); }
input, select, textarea, button { font: inherit; color: inherit; }

/* ---------- layout */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--dark); color: var(--dark-text);
  display: flex; flex-direction: column; padding: 20px 12px; z-index: 20;
}
.brand { display: flex; flex-direction: column; gap: 6px; padding: 4px 10px 20px; margin-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { width: 170px; height: auto; }
.logo-inv { filter: invert(1); }
.brand b { display: block; color: #fff; font-size: 13px; font-weight: 600; letter-spacing: .2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px;
  color: var(--dark-text); margin-bottom: 2px;
}
.sidebar nav a i { font-style: normal; width: 18px; text-align: center; opacity: .8; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); }
.sidebar nav a.active { background: #fff; color: var(--dark); font-weight: 700; }
.nbadge:not(:empty) { margin-left: auto; background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 800; padding: 1px 7px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #9a9ea5; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #9a9ea5; display: inline-block; }
.live.on { color: #7fd6a4; }
.live.on i { background: #33c46f; box-shadow: 0 0 0 3px rgba(51,196,111,.2); }
.dot-on { width: 8px; height: 8px; border-radius: 50%; background: #33c46f; display: inline-block; margin-right: 4px; }
.me { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.me b { color: #fff; }
.me button { margin-top: 8px; }
.topbar, .tabbar { display: none; }
main { margin-left: var(--side); padding: 24px 28px 60px; max-width: 1400px; }
.loading { padding: 60px; text-align: center; color: var(--muted); }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 9px;
  cursor: pointer; font-weight: 600; white-space: nowrap; color: var(--text); min-height: 38px;
}
.btn:hover { border-color: #c4c7cc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.lg { min-height: 50px; font-size: 16px; }

.form-sec { margin-bottom: 18px; }
.form-sec > h3 { font-size: 14px; margin: 0 0 10px; color: var(--primary); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 14px; }
.fields.two { grid-template-columns: 1fr 1fr; }
body:not(.is-admin) .admin-only { display: none !important; }
.t-mob { display: none; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label { font-size: 13px; font-weight: 600; color: #3f4349; }
.field > label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid #d3d6db; background: #fff; border-radius: 9px; padding: 9px 11px; min-height: 40px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
textarea.input { min-height: 90px; resize: vertical; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > .input { flex: 1; }
.seg { display: inline-flex; border: 1px solid #d3d6db; border-radius: 9px; overflow: hidden; background: #fff; flex-wrap: wrap; }
.seg label { padding: 8px 14px; cursor: pointer; border-right: 1px solid #e1e3e6; user-select: none; }
.seg label:last-child { border-right: 0; }
.seg input { display: none; }
.seg input:checked + span { color: var(--primary); font-weight: 700; }
.seg label:has(input:checked) { background: var(--primary-weak); }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--danger); }

/* ---------- badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #eceef0; color: #50555c; }
.s-new { background: #e6e7ea; color: #50555c; }
.s-check { background: #ebe9fd; color: #5a3fd1; }
.s-repair { background: #e3edff; color: #1f4fd1; }
.s-wait { background: var(--warn-weak); color: var(--warn); }
.s-ext { background: #f6e8fb; color: #8a2fae; }
.s-done { background: var(--ok-weak); color: var(--ok); }
.s-closed { background: #dff3f1; color: #0d7466; }
.s-hold { background: #eceef1; color: #6b7486; }
.s-scrap { background: #3a3f4b; color: #fff; }
.pr-urgent { background: var(--danger); color: #fff; }
.pr-high { background: var(--danger-weak); color: var(--danger); }
.pr-low { background: #eceef0; color: var(--muted); }
.tag-unusable { background: var(--danger-weak); color: var(--danger); }
.tag-long { background: var(--warn-weak); color: var(--warn); }
.tag-overdue { background: #fff0f0; color: #b3261e; border: 1px solid #f5c2c2; }

/* ---------- dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); color: var(--text); display: block; }
.kpi:hover { border-color: #c4c7cc; }
.kpi .k-label { font-size: 13px; color: var(--muted); }
.kpi .k-val { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.kpi .k-val small { font-size: 14px; font-weight: 600; margin-left: 2px; }
.kpi.red .k-val { color: var(--danger); }
.kpi.orange .k-val { color: var(--warn); }
.kpi.blue .k-val { color: var(--primary); }
.kpi.green .k-val { color: var(--ok); }
.pipeline { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.pipe { flex: 1 1 90px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); text-align: center; }
.pipe b { display: block; font-size: 20px; }
.pipe:hover { border-color: var(--primary); }
.pipe.zero { opacity: .5; }

.mini-list { display: flex; flex-direction: column; }
.mini { display: flex; gap: 10px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--line2); color: var(--text); }
.mini:last-child { border-bottom: 0; }
.mini:hover { background: #f7f8f9; }
.mini .m-main { flex: 1; min-width: 0; }
.mini .m-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .m-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .m-right { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.dday { font-weight: 800; font-size: 13px; }
.dday.hot { color: var(--danger); }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* ---------- board */
.board-group { margin-bottom: 22px; }
.board-group h3 { margin: 0 0 10px; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.board-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.bcard { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--danger); border-radius: 10px; padding: 12px 14px; color: var(--text); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.bcard.done { border-left-color: var(--ok); }
.bcard .b-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.bcard .b-name { font-weight: 700; font-size: 15px; }
.bcard .b-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.bcard .b-sym { font-size: 13px; color: #3f4349; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.tv main { margin-left: 0; max-width: none; }
body.tv .sidebar { display: none; }

/* ---------- list */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; background: #e6e7ea; padding: 4px; border-radius: 10px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 7px; color: #50555c; font-weight: 600; font-size: 13px; }
.tabs a.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
.filters .input { width: auto; min-height: 38px; }
.filters .search { flex: 1; min-width: 180px; }
.tlist { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.trow {
  display: grid; grid-template-columns: 130px minmax(160px, 1.3fr) 110px minmax(160px, 1.5fr) 100px 90px 92px 60px;
  gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line2); color: var(--text);
}
.trow:last-child { border-bottom: 0; }
a.trow:hover { background: #f7f8f9; }
.trow.head { background: #f6f7f8; font-size: 12px; font-weight: 700; color: var(--muted); }
.trow .t-no { font-weight: 700; font-size: 13px; }
.trow .t-no small { display: block; font-weight: 400; }
.trow .t-eq b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .t-eq small, .trow .ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .t-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.trow .t-days { text-align: right; }
.trow .lbl { display: none; }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #eceef0; flex-shrink: 0; }

/* ---------- detail */
.d-head { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.d-head .d-title { flex: 1; min-width: 240px; }
.d-head .d-title .no { color: var(--muted); font-weight: 700; font-size: 13px; }
.d-head .d-title h1 { margin: 2px 0 6px; }
.d-head .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.stepper { display: flex; margin: 4px 0 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 10px 12px; box-shadow: var(--shadow); }
.step { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--muted); }
.step::before { content: ""; position: absolute; top: 11px; left: -50%; right: 50%; height: 3px; background: var(--line); }
.step:first-child::before { display: none; }
.step .dot { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid var(--line); margin: 0 auto 6px; position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; font-weight: 800; }
.step.done .dot { background: var(--primary); border-color: var(--primary); }
.step.done::before, .step.cur::before { background: var(--primary); }
.step.cur .dot { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px var(--primary-weak); }
.step.cur { color: var(--primary); font-weight: 700; }
.step .sub { display: block; font-size: 11px; color: var(--warn); font-weight: 700; }
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; }
.alert.red { background: var(--danger-weak); color: var(--danger); }
.alert.gray { background: #eceef1; color: #50555c; }

dl.info { display: grid; grid-template-columns: 110px 1fr; margin: 0; gap: 0; }
dl.info dt, dl.info dd { padding: 8px 0; border-bottom: 1px solid var(--line2); margin: 0; }
dl.info dt { color: var(--muted); font-size: 13px; }
dl.info dd { white-space: pre-wrap; word-break: break-word; }
dl.info dt:nth-last-child(2), dl.info dd:last-child { border-bottom: 0; }
.pre { white-space: pre-wrap; word-break: break-word; }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.file { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f6f7f8; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.file img, .file video { width: 100%; height: 100%; object-fit: cover; display: block; }
.file .f-doc { padding: 8px; text-align: center; font-size: 12px; word-break: break-all; }
.file .f-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 30px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.5); pointer-events: none; }
.file .f-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; line-height: 1; }
.file .f-prog { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--primary); }
.file-add { border: 2px dashed #c9ccd1; background: #f7f8f9; color: var(--muted); flex-direction: column; gap: 2px; font-size: 13px; }
.file-add b { font-size: 24px; color: var(--primary); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #c4c7cc; }
.timeline li.k-status::after { background: var(--primary); }
.timeline li.k-comment::after { background: var(--ok); }
.timeline li.k-action::after { background: var(--warn); }
.timeline li.k-part::after { background: #8a2fae; }
.timeline .tl-meta { font-size: 12px; color: var(--muted); }
.timeline .tl-msg { white-space: pre-wrap; word-break: break-word; }
.timeline .tl-box { background: #f6f7f8; border-radius: 8px; padding: 8px 10px; margin-top: 4px; }

.ptable { width: 100%; border-collapse: collapse; }
.ptable th, .ptable td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.ptable th { font-size: 12px; color: var(--muted); background: #f6f7f8; font-weight: 700; }
.ptable tr.low td { background: #fff7f7; }
.ptable .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- modal / toast */
.modal-bg { position: fixed; inset: 0; background: rgba(20,21,23,.55); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal h2 { font-size: 18px; }
.modal .m-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.lightbox { background: rgba(0,0,0,.9); }
.lightbox img, .lightbox video { max-width: 100%; max-height: calc(100vh - 80px); border-radius: 6px; }
.lightbox .lb-close { position: fixed; top: 12px; right: 16px; color: #fff; font-size: 30px; background: none; border: 0; cursor: pointer; }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast div { background: #2e3136; color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-weight: 600; animation: tin .2s; }
#toast div.err { background: var(--danger); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.done-box { text-align: center; padding: 30px 20px; }
.done-box .big { font-size: 46px; }
.done-box .no { font-size: 24px; font-weight: 800; color: var(--primary); margin: 8px 0; }
.notice { background: var(--primary-weak); color: #3b3f45; padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-top: 8px; }
.notice a { text-decoration: underline; }
#toast div.link { pointer-events: auto; cursor: pointer; }

/* ---------- 로그인 / 가입 */
body.auth-mode .sidebar, body.auth-mode .topbar, body.auth-mode .tabbar { display: none !important; }
body.auth-mode main { margin: 0; max-width: none; padding: 0; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: linear-gradient(160deg, #3c4046 0%, #2e3136 45%, #1f2124 100%); }
.auth-card { width: 100%; max-width: 440px; background: #fff; border-radius: 16px; padding: 30px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.auth-logo { display: block; width: 210px; max-width: 70%; margin: 0 auto 6px; }
.auth-title { text-align: center; font-weight: 700; color: var(--muted); margin-bottom: 20px; letter-spacing: .3px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.auth-tabs a { flex: 1; text-align: center; padding: 8px; border-radius: 8px; color: var(--muted); font-weight: 700; }
.auth-tabs a.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-pick label { border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.role-pick label b { display: block; }
.role-pick label small { font-size: 12px; }
.role-pick input { display: none; }
.role-pick label:has(input:checked) { border-color: var(--dark); background: var(--primary-weak); }
.notice.warn { background: var(--warn-weak); color: #8a5300; }

/* ---------- mobile */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--line);
    align-items: center; justify-content: space-between; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  }
  .tb-brand { display: flex; gap: 8px; align-items: center; color: var(--text); font-weight: 700; font-size: 13px; }
  .tb-brand img { height: 26px; width: auto; }
  .topbar .live { margin-left: auto; margin-right: 10px; }
  .tabbar a { position: relative; }
  .tabbar .nbadge:not(:empty) { position: absolute; top: 2px; left: 55%; margin: 0; }
  .tb-me { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 7px 0 6px; font-size: 11px; color: var(--muted); font-weight: 600; }
  .tabbar a i { font-style: normal; font-size: 18px; line-height: 1.2; }
  .tabbar a.active { color: var(--primary); }
  .tabbar a.tab-new i { background: var(--primary); color: #fff; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: -2px; }
  main { margin: 0; padding: 16px 16px calc(90px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; }
  .grid2, .grid-detail { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi { padding: 12px; }
  .kpi .k-val { font-size: 24px; }
  .pipeline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .card { padding: 14px; }
  .fields { grid-template-columns: 1fr; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .trow.head { display: none; }
  .trow { grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; }
  .trow > * { grid-column: 1; }
  .trow .t-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .trow .t-days { grid-column: 2; grid-row: 2; }
  .trow .t-sym { font-size: 13px; color: #3f4349; }
  .trow .t-req, .trow .t-asg, .trow .t-loc { display: none; }
  .trow .t-mob { display: block; font-size: 12px; color: var(--muted); }
  .filters .input { flex: 1 1 140px; }
  .stepper { padding: 12px 4px 10px; }
  .step { font-size: 11px; }
  dl.info { grid-template-columns: 90px 1fr; }
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .ptable.resp thead { display: none; }
  .ptable.resp tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 4px; }
  .ptable.resp td { display: flex; justify-content: space-between; border: 0; padding: 3px 8px; }
  .ptable.resp td::before { content: attr(data-l); color: var(--muted); font-size: 12px; margin-right: 10px; }
  .ptable.resp td.num { text-align: right; }
}

/* ---------- print */
@media print {
  .sidebar, .topbar, .tabbar, .no-print, #toast { display: none !important; }
  main { margin: 0; padding: 0; }
  body { background: #fff; }
  .card, .stepper { box-shadow: none; break-inside: avoid; }
  .grid-detail { grid-template-columns: 1fr; }
}
