/* Approved forest palette; scope every layout override to the mobile editor. */
.me-header, .me-footer-total { display: none; }
.me-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media screen and (max-width: 860px) {
  body.me-active {
    --me-forest: #36493f; --me-focus: #4f6256; --me-wash: #f1f3ee;
    --me-ink: #272d29; --me-muted: #727b74; --me-line: #e4e8e1;
    --entry-focus: var(--me-focus); --entry-focus-row: var(--me-wash); --entry-focus-rail: var(--me-focus);
    background: #fcfcfa; color: var(--me-ink); padding-bottom: calc(100px + env(safe-area-inset-bottom));
    overflow-x: clip;
  }
  body.me-active .shell { width: 100%; max-width: 720px; padding: 0; margin: 0 auto; }
  body.me-active .topbar { display: contents; }
  body.me-active .topbar .brand-lockup, body.me-active .topbar .page-nav,
  body.me-active .topbar-actions > button, body.me-active #documentWorkflowPanel,
  body.me-active .main-column > .panel:not(.detail-sheet-section),
  body.me-active .main-column > .metrics { display: none; }
  body.me-active .header-controls, body.me-active .topbar-actions { display: contents; }
  body.me-active #authSessionTools { display: contents; }
  body.me-active #authSessionTools > :not(#estimateSaveStatus) { display: none; }
  body.me-active .detail-sheet-section::before, body.me-active .detail-sheet-section::after { display: none; }
  body.me-active #estimateSaveStatus { position: fixed; bottom: calc(88px + env(safe-area-inset-bottom) + var(--me-keyboard, 0px)); z-index: 35; }
  body.me-active .me-header { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 4px; min-height: 64px; padding: 4px 10px; border-bottom: 1px solid var(--me-line); background: #fcfcfa; }
  body.me-active .me-header > div { min-width: 0; text-align: center; }
  body.me-active .me-header strong { display: block; font-size: 18px; font-weight: 650; line-height: 1.5; }
  body.me-active .me-header span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--me-muted); font-size: 12px; line-height: 1.5; }
  body.me-active .me-header button { border: 0; background: transparent; padding: 0; min-width: 44px; min-height: 44px; font-size: 28px; color: var(--me-ink); box-shadow: none; }
  body.me-active .layout, body.me-active .main-column { display: block; margin: 0; padding: 0; min-width: 0; }
  body.me-active .detail-sheet-section { border: 0; border-radius: 0; padding: 0; margin: 0; background: #fcfcfa; box-shadow: none; overflow: visible; }
  body.me-active .detail-sheet-section > .panel-header,
  body.me-active .detail-selection-sticky, body.me-active .project-quote-status-row,
  body.me-active .detail-scroll-hint,
  body.me-active .detail-table-wrap { display: none; }
  body.me-active.me-selecting .detail-selection-sticky { display: block; position: relative; top: auto; margin: 8px; }
  body.me-active .mobile-line-cards { display: block; margin: 0; padding: 0; }
  body.me-active .me-toolbar { position: sticky; top: var(--it-review-banner-height, 0px); z-index: 12; display: grid; grid-template-columns: minmax(0, 1fr) auto 28px; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; background: #fcfcfa; border-bottom: 1px solid var(--me-line); }
  body.me-active .me-process { display: flex; min-width: 0; min-height: 44px; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; color: var(--me-ink); font-size: 17px; font-weight: 650; box-shadow: none; text-align: left; }
  body.me-active .me-process > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.me-active .me-add, body.me-active .mobile-total-actions [data-mobile-estimate-action="save"] { min-height: 44px; border: 0; border-radius: 8px; padding: 10px 15px; background: var(--me-forest); color: #fff; box-shadow: none; font-size: 15px; font-weight: 600; white-space: nowrap; }
  body.me-active .me-columns { display: flex; justify-content: space-between; padding: 10px 42px 9px 16px; color: var(--me-muted); font-size: 12px; border-bottom: 1px solid var(--me-line); }
  body.me-active .me-columns small { padding-left: 4px; font-size: inherit; font-variant-numeric: tabular-nums; }
  body.me-active .line-card.me-row { display: grid; grid-template-columns: minmax(0, 1fr) 100px 28px; align-items: center; gap: 0 6px; padding: 8px 10px 8px 16px; margin: 0; border: 0; border-bottom: 1px solid var(--me-line); border-radius: 0; box-shadow: none; background: #fcfcfa; min-height: 92px; }
  body.me-active .me-row.is-empty { background: var(--me-wash); }
  body.me-active[data-page="detail"] .line-card.me-row:focus-within { box-shadow: none; }
  body.me-active .me-item { min-width: 0; }
  body.me-active .me-pick { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 3px; box-shadow: none; padding: 0 2px; margin: 0; width: auto; min-width: 0; max-width: 100%; min-height: 36px; color: var(--me-muted); background: transparent; text-align: left; }
  body.me-active .me-pick > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.me-active .me-name { min-height: 40px; font-size: 16px; color: var(--me-ink); font-weight: 650; }
  body.me-active .me-meta { display: flex; min-width: 0; align-items: center; gap: 6px; font-size: 12px; color: var(--me-muted); }
  body.me-active .me-meta .me-pick { font-size: 12px; flex: 0 1 auto; }
  body.me-active .me-meta .me-category { max-width: 46%; }
  body.me-active .me-meta .me-spec { flex: 0 1 auto; }
  body.me-active .me-pick i, body.me-active .me-process i { display: inline-block; width: 6px; height: 6px; flex: 0 0 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin: -3px 4px 0 0; }
  body.me-active .me-numbers { align-self: center; min-width: 0; text-align: right; }
  body.me-active .me-quantity { display: flex; justify-content: flex-end; align-items: center; gap: 6px; font-size: 13px; color: var(--me-muted); margin: 0; }
  body.me-active .me-quantity input { width: 64px; min-width: 0; height: 44px; min-height: 44px; padding: 8px 4px; border: 1px solid #c8cfc7; border-radius: 6px; background: #fff; color: var(--me-ink); font-size: 16px; text-align: center; font-variant-numeric: tabular-nums; box-shadow: none; }
  body.me-active .me-quantity > span { width: 24px; text-align: left; overflow-wrap: anywhere; }
  body.me-active .me-amount { display: block; padding-top: 7px; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
  body.me-active .me-amount::after { content: "원"; padding-left: 1px; font-size: 11px; }
  body.me-active .me-more { min-width: 28px; min-height: 44px; padding: 0; border: 0; border-radius: 4px; color: var(--me-muted); background: transparent; font-size: 22px; box-shadow: none; }
  body.me-active .me-line-status { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; font-size: 11px; color: var(--me-muted); }
  body.me-active .me-line-status:empty { display: none; }
  body.me-active .me-line-status button { min-height: 32px; font-size: 12px; }
  body.me-active .me-empty { padding: 38px 20px; margin: 0; text-align: center; color: var(--me-muted); font-size: 14px; line-height: 1.7; }
  body.me-active .me-add-next { display: block; width: calc(100% - 32px); margin: 12px 16px 20px; min-height: 44px; background: transparent; border: 1px solid var(--me-line); border-radius: 6px; color: var(--me-forest); font-size: 14px; box-shadow: none; }
  body.me-active .mobile-total-bar { display: flex; align-items: center; left: 0; right: 0; bottom: var(--me-keyboard, 0px); width: 100%; max-width: 720px; margin: 0 auto; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); gap: 16px; border: 0; border-top: 1px solid var(--me-line); border-radius: 0; box-shadow: none; background: #fcfcfa; backdrop-filter: none; z-index: 20; }
  body.me-active .mobile-total-copy { display: none; }
  body.me-active .me-footer-total { display: block; min-width: 0; flex: 1; }
  body.me-active .me-footer-total > span { display: block; color: var(--me-muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.me-active .me-footer-total > strong { display: block; color: #35493d; font-size: 21px; font-weight: 650; line-height: 1.5; font-variant-numeric: tabular-nums; }
  body.me-active .mobile-total-actions { display: block; width: auto; flex: 0 0 92px; }
  body.me-active .mobile-total-actions > button:not([data-mobile-estimate-action="save"]) { display: none; }
  body.me-active .mobile-total-actions [data-mobile-estimate-action="save"] { width: 100%; }
  body.me-active .me-selection { display: flex; align-items: center; grid-column: 1 / -1; gap: 8px; }
  body.me-active .me-selection input { width: 20px; height: 20px; min-height: 20px; accent-color: var(--me-forest); }
  body.me-active .process-memo-card, body.me-active .selected-total-card { margin: 0; padding: 12px 16px; border-radius: 0; box-shadow: none; border: 0; border-bottom: 1px solid var(--me-line); }
  body.me-active .me-row:is(.is-estimate-highlighted, .is-estimate-change-added, .is-estimate-change-modified) { background: #fff7dc; }
  body.me-active .me-row.is-estimate-change-deleted { background: #f5f1f0; opacity: .7; }
  body.me-active .me-row.is-estimate-change-deleted .me-item { text-decoration: line-through; }
  body.me-sheet-open { overflow: hidden; }
  body.me-active .me-sheet { position: fixed; inset: auto 0 var(--me-keyboard, 0px); width: 100%; max-width: 720px; max-height: min(78dvh, 640px, calc(var(--me-viewport-height, 100dvh) - 16px)); margin: auto auto 0; padding: 8px 16px max(18px, env(safe-area-inset-bottom)); border: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 32px #272d2912; background: #fcfcfa; color: var(--me-ink); overflow: auto; overscroll-behavior: contain; }
  body.me-active .me-sheet::backdrop { background: rgb(32 40 34 / 24%); }
  body.me-active .me-sheet-handle { width: 36px; height: 4px; margin: 0 auto 7px; border-radius: 4px; background: #c8cfc7; }
  body.me-active .me-sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  body.me-active .me-sheet-heading h2 { margin: 0; font-size: 19px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
  body.me-active .me-sheet-heading button { flex: 0 0 44px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--me-ink); font-size: 26px; box-shadow: none; }
  body.me-active .me-search { display: block; margin: 6px 0 0; }
  body.me-active .me-search input { width: 100%; min-height: 46px; border: 1px solid #e1e5de; border-radius: 8px; background: #f6f7f4; padding: 10px 12px; font-size: 16px; box-shadow: none; }
  body.me-active .me-result-count { margin: 8px 2px 0; font-size: 11px; color: var(--me-muted); }
  body.me-active .me-options { display: grid; gap: 0; padding-top: 6px; }
  body.me-active .me-option, body.me-active .me-load-more { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; width: 100%; margin: 0; padding: 12px 10px; border: 0; border-bottom: 1px solid var(--me-line); border-radius: 0; color: var(--me-ink); background: transparent; font-size: 16px; font-weight: 400; text-align: left; box-shadow: none; overflow-wrap: anywhere; }
  body.me-active .me-option small { flex: 0 0 auto; font-size: 12px; color: var(--me-muted); }
  body.me-active .me-option.is-current { background: var(--me-wash); color: var(--me-forest); font-weight: 650; border-radius: 7px; }
  body.me-active .me-details dl { margin: 12px 0 20px; }
  body.me-active .me-details dl > div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--me-line); font-size: 14px; }
  body.me-active .me-details dt { color: var(--me-muted); }
  body.me-active .me-details dd { margin: 0; font-variant-numeric: tabular-nums; }
  body.me-active .me-details > label { display: grid; gap: 8px; color: var(--me-muted); font-size: 13px; }
  body.me-active .me-details textarea { min-height: 92px; border: 1px solid #c8cfc7; border-radius: 8px; padding: 10px; font-size: 16px; }
  body.me-active .me-delete { width: 100%; min-height: 44px; margin-top: 20px; border: 1px solid #e4d6d2; border-radius: 8px; background: transparent; color: #8c4c3c; box-shadow: none; }
  body.me-active button:disabled { opacity: .45; cursor: default; }
  body.me-active :is(.me-header, .me-toolbar, .me-row, .me-sheet, .mobile-total-actions) button,
  body.me-active :is(.me-quantity, .me-search) input { margin-top: 0; }
}
@media screen and (max-width: 359px) {
  body.me-active .line-card.me-row { grid-template-columns: minmax(0, 1fr) 86px 24px; gap: 0 4px; padding-inline: 10px 6px; }
  body.me-active .me-quantity input { width: 58px; }
  body.me-active .me-quantity > span { width: 20px; }
  body.me-active .me-name { font-size: 15px; }
  body.me-active .me-meta { gap: 4px; }
  body.me-active .me-add { padding-inline: 10px; }
}
