/* ===== Base Layout ===== */
:root {
  --ascp-surface-canvas: #f5f5f5;
  --ascp-surface-raised: #fbfbfb;
  --ascp-surface-soft: #eceff3;
  --ascp-surface-line: #d6dce4;
  --ascp-surface-ink: #173252;
  --ascp-surface-muted: #64748b;
  --ascp-surface-accent: #2563a6;
}

html {
  overflow: hidden;
  height: 100%;
}

body {
  overflow: hidden;
  height: 100%;
  width: 100%;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* ===== Flatpickr Overrides ===== */
.flatpickr-calendar {
  z-index: 100010 !important;
}

#workSummaryModal .flatpickr-wrapper {
  display: block !important;
  width: 100% !important;
}

#workSummaryModal .flatpickr-wrapper .flatpickr-input {
  width: 100% !important;
}

/* ===== Shared Animations ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-fade-out {
  animation: fadeOut 0.3s ease-in;
}

/* ===== Alert Popup (mobile + desktop 100% 동일) ===== */
.alert-popup {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  margin: 0 !important;
}

.alert-popup.hidden {
  display: none !important;
}

.alert-popup[style*='display: flex'],
.alert-popup[style*='display:flex'] {
  display: flex !important;
}

/* ===== JS cssText → CSS 클래스 (Phase 2) ===== */

/* --- PC 스케줄 (pc-schedule.js) --- */
.pc-drag-ghost {
  position: fixed;
  top: -500px;
  left: -500px;
  width: 120px;
  z-index: 9999;
  pointer-events: none;
}

.pc-confirm-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 20px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 100002;
  text-align: center;
}

.pc-toast-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.pc-user-select-popup {
  position: fixed;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 100003;
  min-width: 150px;
  max-height: 300px;
  overflow-y: auto;
}

/* --- 모바일 스케줄 드래그 (schedule/drag.js) --- */
.schedule-parking-tile {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 4px;
  border-radius: 6px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  overflow: hidden;
  box-sizing: border-box;
}

.mobile-drag-ghost {
  position: fixed;
  width: 120px;
  padding: 8px 10px;
  background: #f3f4f6;
  border-radius: 6px;
  border-left: 3px solid #4f46e5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 10001;
  pointer-events: none;
  transform: scale(1.05);
}

.mobile-floating-ghost {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 -4px 20px rgba(99, 102, 241, 0.4);
  z-index: 9999;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-ghost-dragging {
  position: fixed;
  width: 120px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.6);
  z-index: 10001;
  pointer-events: none;
  transform: scale(1.05);
}

.mobile-ghost-returning {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 -4px 20px rgba(99, 102, 241, 0.4);
  z-index: 9999;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.2s ease;
  pointer-events: auto;
}

.mobile-tile-drag-ghost {
  position: fixed;
  opacity: 0.9;
  z-index: 10001;
  pointer-events: none;
  transform: scale(1.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border: 2px solid #4f46e5;
  background: white;
}

.mobile-card-drag-ghost {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
  z-index: 10001;
  pointer-events: none;
}

/* --- 모바일 UI (ui.js) --- */
.bulk-fab-visible {
  position: fixed;
  bottom: 70px;
  right: 24px;
  z-index: 9999;
}

/* --- 업무현황 PDF (work-summary.js) --- */
.pdf-preview-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 100010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

/* ===== Safe-area 유틸리티 (Phase 3) ===== */
.safe-pt-1 {
  padding-top: calc(1rem + env(safe-area-inset-top));
}

.safe-pb-1 {
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

.safe-pt-075 {
  padding-top: calc(0.75rem + env(safe-area-inset-top));
}

.safe-pb-075 {
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

.safe-pt-raw {
  padding-top: env(safe-area-inset-top);
}

.safe-pb-raw {
  padding-bottom: env(safe-area-inset-bottom);
}

.safe-px {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ===== 초기 hidden 상태 (JS에서 .style.display로 토글) =====
 * 주의: 여기 나열된 요소를 JS에서 보이게 하려면 반드시
 *   element.style.display = 'block'  (O)  ← 인라인이 CSS를 오버라이드
 *   element.style.display = ''       (X)  ← 인라인 제거 → 이 CSS 규칙이 다시 적용되어 none 유지
 * 참고: open-close.js 설치/AS 모드 토글 참조
 */
#process-install-period-row,
#process-testrun-period-row,
#process-comment-row,
#process-purchase-row,
#install-action-template,
#btn-record-action,
#btn-install-done,
#btn-delete-ticket,
#mobile-report-view-modal,
#address-book-modal,
#company-edit-modal,
#email-modal,
#reports-list-modal,
#mobile-signature-modal,
#report-generate-modal,
#custom-alert-modal,
#chatModal,
#chatSearchBar,
#chatFilePreview,
#chatFileInput,
#workSummaryModal,
#downloadSummaryBtn,
#notificationModal,
#aiChatModal,
#report-detail-modal,
#notification-center-modal,
#pc-task-modal {
  display: none;
}

#report-detail-modal.report-detail-window-mode {
  background: rgba(15, 23, 42, 0.36);
}

/* 고객이 실제 서명 영역을 즉시 구분하도록 입력면과 주변 대비를 고정한다. */
.signature-pad-stage {
  background: #334155;
}

.signature-pad-surface {
  background: #fff;
  border: 3px solid #e2e8f0;
  border-radius: 0.875rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
}

.signature-pad-watermark {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 20;
  transform: translate(-50%, -50%);
  color: #64748b;
  font-size: clamp(2rem, 10vw, 4.5rem);
  font-weight: 800;
  letter-spacing: 0.28em;
  opacity: 0.16;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  #reports-list-modal *,
  #mobile-report-view-modal *,
  #report-detail-modal * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* 완료 티켓 수정본 상태·버전·차이 패널 — PC와 모바일 공용 */
.process-revision-context { margin: .75rem 1rem 0; padding: .75rem; border: 1px solid #ddd6fe; border-radius: .875rem; background: #fff; color: #1f2937; }
.process-revision-editor { padding-bottom: .75rem; border-bottom: 1px solid #e5e7eb; }
.process-revision-history-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 44px; }
.process-revision-history-toggle-row > div { display: grid; gap: .1rem; }
.process-revision-history-toggle-row strong { font-size: .78rem; }
.process-revision-history-toggle-row span { color: #6b7280; font-size: .68rem; }
.process-revision-history-toggle { position: relative; width: 48px; min-width: 48px; height: 44px; border: 0; background: transparent; padding: 0; }
.process-revision-history-toggle::before { content: ''; position: absolute; left: 1px; top: 9px; width: 46px; height: 26px; border-radius: 999px; background: #cbd5e1; transition: background-color .15s ease; }
.process-revision-history-toggle > span:first-child { position: absolute; left: 4px; top: 12px; width: 20px; height: 20px; border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .25); transition: transform .15s ease; }
.process-revision-history-toggle[aria-checked="true"]::before { background: #4f46e5; }
.process-revision-history-toggle[aria-checked="true"] > span:first-child { transform: translateX(20px); }
.process-revision-history-toggle:disabled { cursor: not-allowed; opacity: .45; }
.process-revision-history-toggle:focus-visible { outline: 3px solid rgba(79, 70, 229, .35); outline-offset: 2px; }
.process-revision-history-body { padding-top: .75rem; border-top: 1px solid #e5e7eb; }
.process-revision-rail { display: flex; align-items: flex-start; gap: .5rem; }
.process-revision-rail > button, .process-revision-diff-head button, .process-revision-report-button, .process-revision-conflict button, .process-revision-footer-actions button { min-width: 44px; min-height: 44px; border-radius: .75rem; border: 1px solid #d1d5db; background: #fff; padding: .55rem .75rem; font-weight: 700; }
.process-revision-rail > button:disabled { opacity: .4; }
.process-revision-version-label { font-size: .82rem; font-weight: 800; overflow-wrap: anywhere; }
.process-revision-meta { margin-top: .2rem; color: #6b7280; font-size: .7rem; }
.process-revision-field { display: grid; gap: .35rem; margin-top: .75rem; font-size: .75rem; font-weight: 700; }
.process-revision-field select, .process-revision-field textarea, .process-revision-diff-head select { width: 100%; border: 1px solid #d1d5db; border-radius: .65rem; background: #fff; padding: .65rem; font-weight: 500; }
.process-revision-history { margin-top: .65rem; border-left: 4px solid #6b7280; background: #f3f4f6; padding: .65rem; font-size: .75rem; font-weight: 700; }
.process-revision-draft-row { display: flex; align-items: center; gap: .5rem; margin-top: .65rem; color: #6b7280; font-size: .72rem; }
.process-revision-draft-badge { border-radius: 999px; background: #ede9fe; color: #6d28d9; padding: .2rem .55rem; font-weight: 800; }
.process-revision-diff-head { display: flex; align-items: end; justify-content: space-between; gap: .5rem; margin-top: .75rem; font-size: .72rem; }
.process-revision-diff-head label { flex: 1; display: grid; gap: .25rem; }
.process-revision-diff-summary { margin-top: .6rem; font-size: .76rem; font-weight: 800; }
.process-revision-diff-list { display: grid; gap: .5rem; margin-top: .5rem; max-height: 44vh; overflow: auto; }
.process-revision-diff { border-left: 4px solid #d97706; border-radius: .6rem; background: #fffbeb; padding: .65rem; }
.process-revision-diff.is-added { border-color: #15803d; background: #f0fdf4; }
.process-revision-diff.is-deleted { border-color: #b91c1c; background: #fef2f2; }
.process-revision-diff h4 { font-size: .73rem; font-weight: 800; }
.process-revision-diff-values { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: .4rem; margin-top: .35rem; font-size: .68rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.process-revision-diff-values del { color: #991b1b; }
.process-revision-diff-values ins { color: #166534; text-decoration: none; font-weight: 700; }
.process-revision-empty { color: #6b7280; font-size: .74rem; padding: .75rem 0; }
.process-revision-report-button { width: 100%; margin-top: .75rem; color: #4338ca; }
.process-revision-conflict { margin-top: .75rem; border: 2px solid #dc2626; border-radius: .75rem; background: #fef2f2; padding: .75rem; }
.process-revision-conflict h3 { color: #991b1b; font-size: .85rem; font-weight: 900; }
.process-revision-conflict p { margin-top: .35rem; font-size: .72rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.process-revision-conflict > div { display: grid; gap: .5rem; margin-top: .65rem; }
.process-revision-footer-actions { display: flex; gap: .5rem; }
.process-revision-footer-actions button { flex: 1; background: #4f46e5; border-color: #4f46e5; color: #fff; font-size: .78rem; }
.process-revision-footer-actions #btn-close-process-revision { background: #6b7280; border-color: #6b7280; }
#process-modal[data-process-mode="FINAL_REVIEW"] #process-form { pointer-events: none; opacity: .82; }
@media (min-width: 1024px) {
  #process-modal[data-process-mode] #process-modal-content { display: block; padding-left: .75rem; padding-right: .75rem; }
  #process-modal[data-process-mode] #process-form { width: 100%; }
  #process-modal[data-process-mode] .process-revision-context { position: static; width: auto; max-width: none; margin: .75rem .25rem 0; }
}
@media (prefers-reduced-motion: reduce) {
  #process-modal[data-process-mode] *, #process-modal[data-process-mode] *::before, #process-modal[data-process-mode] *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

#report-detail-resize-handle {
  display: none;
}

#btn-reset-report-zoom {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  min-width: 44px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  color: #f8fafc;
  border: 1px solid rgba(226, 232, 240, 0.24);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(8px);
  touch-action: manipulation;
}

#btn-reset-report-zoom.hidden {
  display: none;
}

#btn-reset-report-zoom:not(.hidden) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#btn-reset-report-zoom:active {
  transform: scale(0.96);
}

@media (min-width: 768px) {
  #report-detail-modal.report-detail-window-mode {
    inset: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    bottom: 0 !important;
    right: 0 !important;
    overflow: hidden;
  }

  #report-detail-modal.report-detail-window-mode #report-detail-window {
    position: absolute !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 0;
    min-height: 0;
    max-width: 100vw !important;
    max-height: 100vh !important;
    left: 0;
    top: 0;
    transform: none;
    background: #0f172a;
    border: 0;
    border-radius: 0 !important;
    box-shadow: none;
    overflow: hidden;
  }

  #report-detail-modal.report-detail-window-mode #report-detail-header {
    cursor: default;
    user-select: none;
    padding-top: 12px;
  }

  #report-detail-modal.report-detail-window-mode #report-detail-container {
    background: #111827;
  }

  #report-detail-modal.report-detail-window-mode #report-detail-resize-handle {
    display: none;
    position: absolute;
    right: 0;
    bottom: 0;
    width: 22px;
    height: 22px;
    cursor: nwse-resize;
    z-index: 2;
  }

  #report-detail-modal.report-detail-window-mode #btn-reset-report-zoom {
    right: 18px;
    bottom: 18px;
  }

  #report-detail-modal.report-detail-window-mode #report-detail-resize-handle::after {
    content: "";
    position: absolute;
    right: 5px;
    bottom: 5px;
    width: 10px;
    height: 10px;
    border-right: 2px solid rgba(203, 213, 225, 0.9);
    border-bottom: 2px solid rgba(203, 213, 225, 0.9);
  }
}

/* ===== PC에서 모바일 전용 요소 강제 숨김 =====
 * mobile-styles.css(max-width:767px)에 동일 규칙이 있었으나
 * 파일 자체가 768px+에서 로드 안 되므로 규칙 무효 → common.css로 이동
 * Tailwind hidden이 1차 방어이나, JS가 hidden을 제거할 수 있으므로 이중 방어
 */
@media (min-width: 768px) {
  #mobile-schedule-view,
  #parts-dashboard-view,
  #schedule-assign-modal,
  #custom-task-modal,
  #quick-task-modal {
    display: none !important;
  }
}

/* ===== 실제 뷰포트 높이 (PC+모바일 공통) =====
 * 모달에서 h-screen-real 사용 — mobile-styles.css에만 있으면 PC에서 누락
 */
.h-screen-real {
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
}

/* ===== 프로그레스 링 오버레이 (PC+모바일 공통) =====
 * mobile-styles.css에만 있으면 PC(768px+)에서 스타일 미적용 → 날것 div 노출
 * JS: report-generate.js에서 .active 토글로 표시/숨김
 */
.progress-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, visibility 0.2s;
}

.progress-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ===== 모달 헤더 패딩 (Phase 3) ===== */
.modal-header-pt {
  padding-top: 0.75rem;
}

/* Shared modal contract: the shell follows the part of the page that is actually
 * visible when a mobile keyboard or browser chrome changes visualViewport. */
.ascp-modal-contract[data-modal-viewport="visible"] {
  left: var(--ascp-modal-viewport-left, 0px) !important;
  top: var(--ascp-modal-viewport-top, 0px) !important;
  width: var(--ascp-modal-viewport-width, 100vw) !important;
  height: var(--ascp-modal-viewport-height, 100dvh) !important;
  max-height: var(--ascp-modal-viewport-height, 100dvh) !important;
  right: auto !important;
  bottom: auto !important;
  overscroll-behavior: contain;
}

/* The modal stack owns focus, layering and viewport geometry only. Each modal
 * keeps ownership of its own surface and text colors. */

.ascp-modal-contract :focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.42);
  outline-offset: 2px;
}

/* ===== Header status: container color = Local API health, icon = sync state ===== */
.ascp-page-title,
.header-title {
  color: #1e293b;
  text-decoration: none;
  cursor: pointer;
}

.ascp-page-title {
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ascp-page-title:active,
.header-title:active {
  transform: scale(0.97);
}

.ascp-branch-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #d8e0ec;
  border-radius: 9px;
  background: #f8fafc;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background-color 140ms ease, border-color 140ms ease, transform 120ms ease;
}

.ascp-branch-switcher:hover {
  border-color: #94a3b8;
  background: #fff;
}

.ascp-branch-switcher:active {
  transform: scale(0.97);
}

.ascp-branch-switcher:disabled {
  cursor: default;
  opacity: 0.58;
}

.ascp-branch-switcher svg {
  width: 13px;
  height: 13px;
  color: #64748b;
}

.ascp-header-icon-control {
  box-sizing: border-box;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid #d7e2ef;
  border-radius: 9px;
  background: #f8fbff;
  color: #31506f;
  opacity: 1;
}

.ascp-header-icon-control i,
.ascp-header-icon-control svg,
.ascp-header-icon-control.ascp-branch-switcher svg {
  width: 16px;
  height: 16px;
  color: currentColor;
}

#app-logo,
#app-logo-pc {
  display: block;
  object-fit: contain;
  background: transparent;
}

#app-logo-pc {
  width: auto;
  height: 22px !important;
}

.ascp-branch-switcher[hidden],
.ascp-branch-switcher.hidden {
  display: none !important;
}

.ascp-header-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 8px;
  background: #94a3b8;
  color: #fff;
  cursor: pointer;
  line-height: 0;
  padding: 0;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  transition:
    background-color 160ms ease,
    transform 120ms ease,
    opacity 160ms ease;
}

.ascp-header-status svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.8;
}

.ascp-header-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid #d8e0ec;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  line-height: 0;
  padding: 0;
  flex: 0 0 auto;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    transform 120ms ease;
}

.ascp-header-back svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.8;
}

.ascp-header-back.hidden {
  display: none;
}

.ascp-header-back:active {
  transform: scale(0.94);
  background: #eef2f7;
  border-color: #cbd5e1;
}

.ascp-header-status.local-api-health-online {
  background: #22c55e;
}

.ascp-header-status.local-api-health-degraded,
.ascp-header-status.local-api-health-checking {
  background: #f59e0b;
}

.ascp-header-status.local-api-health-offline {
  background: #ef4444;
  animation: local-api-health-alert 1s ease-in-out infinite;
}

.ascp-header-status.local-api-health-checking {
  animation: local-api-health-pulse 1.4s ease-in-out infinite;
}

.ascp-header-status.local-api-health-emergency {
  background: #f97316;
  border-color: #fed7aa;
  color: #fff7ed;
}

.local-api-emergency-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
}

.local-api-emergency-badge.hidden {
  display: none;
}

.local-api-outage-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 100000;
  padding: 8px 12px;
  border-radius: 10px;
  color: #111827;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(255, 251, 235, 0.94);
  backdrop-filter: blur(10px);
}

.local-api-outage-banner[data-state="offline"] {
  color: #7f1d1d;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(254, 242, 242, 0.95);
}

@keyframes local-api-health-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.72;
    transform: scale(1.03);
  }
}

@keyframes local-api-health-alert {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.48;
  }
}

@keyframes local-api-health-ok {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.28);
    opacity: 0.72;
  }
}
/* Reports archive quick filters */
.reports-quick-filter {
  box-shadow: none;
}

.reports-quick-filter[data-reports-filter-value="install"] {
  background-color: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.reports-quick-filter[data-reports-filter-value="install"][aria-pressed="true"] {
  background-color: #059669;
  border-color: #059669;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.reports-quick-filter[data-reports-filter-value="as"] {
  background-color: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}

.reports-quick-filter[data-reports-filter-value="as"][aria-pressed="true"] {
  background-color: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.reports-quick-filter[data-reports-filter-value="lastWeek"] {
  background-color: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

.reports-quick-filter[data-reports-filter-value="lastWeek"][aria-pressed="true"] {
  background-color: #d97706;
  border-color: #d97706;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.reports-quick-filter[data-reports-filter-value="thisWeek"] {
  background-color: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}

.reports-quick-filter[data-reports-filter-value="thisWeek"][aria-pressed="true"] {
  background-color: #4f46e5;
  border-color: #4f46e5;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.schedule-lock-control {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 8;
  width: 13px;
  height: 13px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #64748b;
  opacity: 0.22;
  cursor: pointer;
  line-height: 0;
}

.schedule-lock-control svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  pointer-events: none;
}

.schedule-lock-control.is-locked {
  color: #2563eb;
  opacity: 1;
}

.schedule-lock-control:disabled {
  cursor: wait;
}

.release-announcement-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow: auto;
  background: rgba(255, 255, 255, 0.5);
}

.release-announcement-panel {
  box-sizing: border-box;
  width: min(560px, 100%);
  max-height: 100%;
  padding: 24px;
  overflow: auto;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Noto Sans KR", sans-serif;
  outline: none;
}

.release-announcement-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
}

.release-announcement-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 16px;
  border: 0;
}

.release-announcement-text,
.release-announcement-list {
  margin: 0 0 14px;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.6;
}

.release-announcement-list {
  padding-left: 20px;
}

.release-announcement-list li + li {
  margin-top: 5px;
}

.release-announcement-navigation {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) auto minmax(88px, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.release-announcement-nav {
  min-height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.release-announcement-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.release-announcement-position {
  min-width: 48px;
  color: #64748b;
  font-size: 13px;
  text-align: center;
}

.release-announcement-dismiss {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 18px;
  border: 1px solid #9ca3af;
  background: #ffffff;
  color: #111827;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.release-announcement-nav:focus-visible,
.release-announcement-dismiss:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.release-announcement-entry {
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 5px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 10px;
  line-height: 1;
  opacity: 0.5;
  cursor: pointer;
}

.release-announcement-entry i,
.release-announcement-entry svg {
  width: 13px;
  height: 13px;
}

.release-announcement-entry:hover {
  background: #f1f5f9;
  opacity: 0.8;
}

.release-announcement-entry:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  opacity: 1;
}

@media (max-width: 767px) {
  .release-announcement-panel {
    padding: 20px;
  }

  .release-announcement-title {
    font-size: 18px;
  }
}

/* ===== Unified application surface =====
 * Safari's adjacent browser chrome samples at #f5f5f5. Application shells use
 * that canvas; printed documents, PDF canvases and semantic state colors keep
 * their domain-owned palettes. */
html,
body,
#safe-area-top-bg,
#left-panel,
#right-panel,
#pc-layout-wrapper,
.dashboard-fixed,
#ticket-filter-bar,
#cards-container,
#schedule-container,
#schedule-assign-panel,
#schedule-ticket-panel,
#daily-report-modal,
#stats-modal {
  background-color: var(--ascp-surface-canvas) !important;
}

.ticket-card,
.ticket-card.install-card,
.ticket-card.completed-card,
.schedule-order-sheet-panel,
.activity-panel {
  background-color: var(--ascp-surface-raised) !important;
}

.parts-dashboard-view {
  background-color: var(--ascp-surface-canvas) !important;
}

.parts-dashboard-card-table,
.parts-dashboard-rows,
.parts-dashboard-row,
.parts-dashboard-cell,
.parts-dashboard-mobile-summary span {
  background-color: #f8f9fa !important;
}

#reception-modal form,
#install-modal form,
#process-modal-content,
#mobile-report-view-modal > div,
#process-contact-picker-modal > div,
#address-book-modal > div,
#company-edit-modal > div,
#email-modal > div,
#reports-list-modal > div,
#mobile-signature-modal,
#custom-alert-modal > div,
#chatModal > div,
#workSummaryModal > div,
#notificationModal > div,
#aiChatModal > div,
#notification-center-modal > div,
#notification-detail-popup > div,
.weekly-worklog-modal,
.parts-procurement-shipment-dialog,
.parts-dashboard-trash-dialog,
.release-announcement-panel {
  background-color: var(--ascp-surface-canvas) !important;
}

#address-book-modal > div > :first-child,
#reports-list-modal > div > :first-child,
#mobile-signature-modal > div:first-child,
#chatModal > div > :first-child,
#workSummaryModal > div > :first-child,
#notificationModal > div > :first-child,
#aiChatModal > div > :first-child,
#notification-center-modal > div > :first-child,
.activity-header,
.parts-procurement-shipment-head,
.schedule-order-sheet-head {
  color: var(--ascp-surface-ink) !important;
  background: var(--ascp-surface-canvas) !important;
  border-color: var(--ascp-surface-line) !important;
}

#address-book-modal > div > :first-child :is(h2, h3, button, svg),
#reports-list-modal > div > :first-child :is(h2, h3, button, svg),
#chatModal > div > :first-child :is(h2, h3, button, svg),
#workSummaryModal > div > :first-child :is(h2, h3, button, svg),
#notificationModal > div > :first-child :is(h2, h3, button, svg),
#aiChatModal > div > :first-child :is(h2, h3, button, svg),
#notification-center-modal > div > :first-child :is(h2, h3, button, svg) {
  color: var(--ascp-surface-ink) !important;
}

#reports-list-modal
  :is(#btn-bulk-view-reports, #btn-bulk-print-reports, #btn-bulk-download-reports):not(:disabled) {
  color: #ffffff !important;
}

/* Five-action palette: airy blue-led accents at one restrained saturation. */
.main-action-grid > .mobile-action-menu-wrap > button,
.main-action-grid > button {
  color: #ffffff !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1) !important;
}

#btn-reception { background: #2776a8 !important; border-color: #1f638f !important; color: #ffffff !important; }
#btn-ticket-mode-filter { background: #52799e !important; border-color: #436788 !important; color: #ffffff !important; }
#btn-incomplete { background: #4e7394 !important; border-color: #3f607c !important; color: #ffffff !important; }
#btn-schedule-mode { background: #71699d !important; border-color: #5e5688 !important; color: #ffffff !important; }
#btn-ops-menu { background: #3e8076 !important; border-color: #326c63 !important; color: #ffffff !important; }

.mobile-action-pop {
  color: var(--ascp-surface-ink) !important;
  background: #f1f3f5 !important;
  border-color: var(--ascp-surface-line) !important;
}

#btn-ticket-mode-filter.is-longpressing {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 166, 0.3) !important;
}

/* Shared procurement reading surface and explicit one-row editor. */
.parts-dashboard-row[data-read-only="1"] { cursor: pointer; }
.parts-dashboard-row[data-read-only="1"] :is(input, textarea, select, button) {
  pointer-events: none;
  cursor: pointer;
  caret-color: transparent;
}
.parts-procurement-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
}
.parts-procurement-preview-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.58); }
.parts-procurement-preview-editor {
  position: relative;
  width: min(1120px, calc(100vw - 56px));
  height: min(760px, calc(100dvh - 48px));
  max-height: calc(100dvh - 48px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 16px;
  background: #f8fafc;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
}
.parts-procurement-preview-editor.is-trash { width: min(720px, calc(100vw - 56px)); height: auto; }
.parts-procurement-preview-editor > header,
.parts-procurement-preview-editor > footer,
.parts-procurement-preview-editor-body > footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #fff;
}
.parts-procurement-preview-editor > header { justify-content: space-between; border-bottom: 1px solid #e2e8f0; }
.parts-procurement-preview-editor > header div { display: flex; align-items: baseline; gap: 12px; }
.parts-procurement-preview-editor > header strong { font-size: 16px; }
.parts-procurement-preview-editor > header span { color: #b45309; font-size: 12px; font-weight: 700; }
.parts-procurement-preview-editor > header button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; font-size: 20px; line-height: 1; }
.parts-procurement-preview-editor > footer,
.parts-procurement-preview-editor-body > footer { border-top: 1px solid #e2e8f0; }
.parts-procurement-preview-editor > footer span,
.parts-procurement-preview-editor-body > footer span { flex: 1; }
.parts-procurement-preview-editor > footer button,
.parts-procurement-preview-editor-body > footer button { min-width: 72px; padding: 8px 12px; }
.parts-procurement-preview-editor button.is-danger { border-color: #fecaca; color: #dc2626; }
.parts-procurement-preview-editor-body { display: grid; grid-template-columns: minmax(0, 44fr) minmax(0, 56fr); grid-template-rows: minmax(0, 1fr) auto; gap: 12px; min-height: 0; overflow: hidden; padding: 12px; }
.parts-procurement-preview-editor-body > footer { grid-column: 1 / -1; }
.parts-procurement-preview-editor-info { min-width: 0; min-height: 0; overflow: auto; }
.parts-procurement-preview-editor-section { padding: 10px; border: 1px solid #dbe3ee; border-radius: 10px; background: #fff; }
.parts-procurement-preview-editor-section + .parts-procurement-preview-editor-section { margin-top: 10px; }
.parts-procurement-preview-editor-section h4 { margin: 0 0 10px; color: #334155; font-size: 12px; }
.parts-procurement-preview-form-grid { display: grid; gap: 8px; margin-bottom: 10px; }
.parts-procurement-preview-form-grid.is-identity,
.parts-procurement-preview-form-grid.is-cost { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.parts-procurement-preview-form-grid.is-single { grid-template-columns: 1fr; }
.parts-procurement-preview-form-grid.is-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.parts-procurement-preview-form-grid.is-cost { margin-bottom: 0; }
.parts-procurement-preview-quote { margin-top: 10px; padding-top: 10px; border-top: 1px solid #e2e8f0; }
.parts-procurement-preview-quote > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.parts-procurement-preview-quote h4 { margin: 0; }
.parts-procurement-preview-quote label { flex: none; padding: 6px 9px; border: 1px solid #cbd5e1; border-radius: 8px; color: #334155; font-size: 12px; font-weight: 800; cursor: pointer; }
.parts-quote-documents-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.parts-quote-documents-list > span { display: inline-flex; }
.parts-quote-documents-list button { min-height: 30px; padding: 5px 8px; border-radius: 0; }
.parts-quote-documents-list button:first-child { border-radius: 7px 0 0 7px; border-color: #93c5fd; color: #1d4ed8; }
.parts-quote-documents-list button:last-child { margin-left: -1px; border-radius: 0 7px 7px 0; color: #dc2626; }
.parts-quote-documents-list small { color: #64748b; font-size: 11px; }

.parts-preview-autocomplete { position: relative; display: block; min-width: 0; color: inherit; }
.parts-preview-autocomplete-results {
  position: absolute;
  z-index: 8;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .14);
}
.parts-preview-autocomplete-results[hidden] { display: none; }
.parts-preview-autocomplete-results button {
  display: block;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #0f172a;
  text-align: left;
}
.parts-preview-autocomplete-results button:hover,
.parts-preview-autocomplete-results button:focus { background: #eff6ff; }

.parts-procurement-preview-card.is-delivery-soon {
  background: #fffbeb;
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.62), 0 1px 2px rgba(15, 23, 42, 0.05);
}

.parts-procurement-preview-card.is-delivery-due {
  animation: parts-procurement-delivery-due-blink 1.2s ease-in-out infinite;
}

@keyframes parts-procurement-delivery-due-blink {
  0%, 100% {
    background: #fff1f2;
    box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.82), 0 1px 2px rgba(15, 23, 42, 0.05);
  }
  50% {
    background: #fff;
    box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.2), 0 1px 2px rgba(15, 23, 42, 0.05);
  }
}

@media (prefers-reduced-motion: reduce) {
  .parts-procurement-preview-card.is-delivery-due {
    animation: none;
    background: #fff1f2;
    box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.82), 0 1px 2px rgba(15, 23, 42, 0.05);
  }
}
.parts-procurement-preview-form-grid label { display: grid; gap: 4px; min-width: 0; }
.parts-procurement-preview-form-grid label > span { color: #475569; font-size: 12px; font-weight: 700; }
.parts-procurement-preview-form-grid input,
.parts-procurement-preview-form-grid select,
.parts-procurement-preview-form-grid textarea,
.parts-procurement-thread-composer > textarea,
.parts-procurement-preview-ticket-tools input {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font-size: 14px;
}
.parts-procurement-preview-form-grid textarea { resize: vertical; }
.parts-money-input { position: relative; display: block; min-width: 0; }
.parts-money-input input { padding-right: 28px; text-align: right; font-variant-numeric: tabular-nums; }
.parts-money-input b { position: absolute; top: 50%; right: 9px; transform: translateY(-50%); color: #64748b; font-size: 12px; pointer-events: none; }
.parts-procurement-preview-ticket-tools { display: grid; grid-template-columns: 12em 1fr auto; gap: 8px; font-size: 14px; margin: 10px 0; }
.parts-procurement-preview-ticket-tools input { width: 12em; }
.parts-procurement-preview-ticket-tools button { grid-column: 3; width: 7em; padding: 6px 10px; white-space: nowrap; }
.parts-ticket-heading { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 14px; }
.parts-procurement-preview-linked-ticket { color: #1d4ed8; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.parts-procurement-preview-ticket-results { max-height: 230px; overflow: auto; display: grid; gap: 8px; }
.parts-ticket-candidate { display: grid; grid-template-columns: 10em minmax(0, 1fr); gap: 12px; border: 1px solid #dbe3ee; border-radius: 8px; padding: 10px; font-size: 13px; }
.parts-ticket-candidate > strong { overflow-wrap: anywhere; align-self: center; }
.parts-ticket-candidate > div { min-width: 0; display: grid; gap: 5px; }
.parts-ticket-candidate button { display: grid; grid-template-columns: 10ch minmax(0, 1fr); gap: 12px; padding: 8px; text-align: left; align-items: start; width: 100%; }
.parts-ticket-candidate button[aria-pressed="true"] { background: #eff6ff; border-color: #60a5fa; color: #1d4ed8; }
.parts-ticket-candidate button span { overflow-wrap: anywhere; }
.parts-ticket-candidate button em { font-style: normal; overflow-wrap: anywhere; }
.parts-procurement-preview-editor-thread { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid #dbe3ee; border-radius: 10px; background: white; }
.parts-procurement-preview-editor-thread > h4 { padding: 12px 14px; margin: 0; border-bottom: 1px solid #e2e8f0; color: #334155; font-size: 13px; font-weight: 700; }
.parts-procurement-preview-editor-thread .parts-procurement-thread { min-height: 0; overflow: auto; padding: 12px 14px; margin: 0; }
.parts-procurement-thread-composer { padding: 10px 12px; border-top: 1px solid #e2e8f0; background: #f8fafc; }
.parts-procurement-thread-composer > textarea { display: block; resize: vertical; max-height: 160px; }
.parts-procurement-thread { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 0; }
.parts-procurement-thread li { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 10px 0; }
.parts-procurement-thread li + li { border-top: 1px solid #edf1f6; }
.parts-procurement-thread .is-change { padding-left: 10px; border-left: 2px solid #cbd5e1; }
.parts-procurement-thread .is-acknowledgement { color: #64748b; }
.parts-thread-entry-body { min-width: 0; }
.parts-thread-entry-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-height: 24px; }
.parts-thread-new { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; font-style: normal; font-weight: 900; line-height: 1; }
.parts-thread-entry-actions button { min-width: 48px; min-height: 28px; padding: 4px 9px; border: 1px solid #93c5fd; border-radius: 7px; background: #eff6ff; color: #1d4ed8; font-size: 12px; font-weight: 800; white-space: nowrap; }
.parts-thread-entry-actions button:disabled { opacity: .6; }
.parts-procurement-thread small { color: #64748b; font-size: 12px; }
.parts-procurement-thread p { margin: 3px 0 0; color: #1e293b; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.parts-procurement-thread p:first-child { margin-top: 0; }
.parts-procurement-preview-card { cursor: pointer; -webkit-tap-highlight-color: rgba(37, 99, 235, .08); }
.parts-procurement-preview-card button,
.parts-procurement-preview-card input,
.parts-procurement-preview-card textarea { cursor: auto; }
.parts-procurement-preview-card button { cursor: pointer; }
.parts-thread-change-summary { width: 100%; display: flex; align-items: center; gap: 6px; margin-top: 3px; padding: 0; border: 0; background: transparent; color: #1e293b; font: inherit; font-size: 14px; line-height: 1.5; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.parts-thread-change-summary:hover { color: #1d4ed8; }
.parts-thread-change-badge { flex: none; min-width: 34px; padding: 2px 6px; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: 10px; font-weight: 900; line-height: 1.5; text-align: center; }
.parts-thread-change-badge[data-tone="create"] { background: #e2e8f0; color: #334155; }
.parts-thread-change-badge[data-tone="change"] { background: #fef3c7; color: #92400e; }
.parts-thread-change-badge[data-tone="progress"] { background: #dcfce7; color: #166534; }
.parts-thread-change-badge[data-tone="receipt"] { background: #ede9fe; color: #6d28d9; }
.parts-thread-change-badge[data-tone="sale"] { background: #ccfbf1; color: #0f766e; }
.parts-thread-change-badge[data-tone="link"] { background: #dbeafe; color: #1d4ed8; }
.parts-thread-change-text { min-width: 0; }
.parts-thread-change-count { flex: none; padding: 1px 5px; border-radius: 999px; background: #f1f5f9; color: #64748b; font-size: 10px; font-weight: 800; white-space: nowrap; }
.parts-procurement-thread .is-empty { display: block; color: #64748b; font-size: 13px; }
.parts-thread-images { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.parts-thread-images button { width: 72px; height: 54px; display: grid; place-items: center; overflow: hidden; padding: 0; border: 1px solid #cbd5e1; border-radius: 8px; background: #f8fafc; color: #1d4ed8; font-size: 11px; font-weight: 800; }
.parts-thread-images img { width: 100%; height: 100%; display: block; object-fit: cover; }
.parts-thread-file { display: inline-block; margin-top: 8px; padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 8px; cursor: pointer; font-size: 12px; }
.parts-thread-change-dialog { position: fixed; inset: 0; z-index: 10030; display: grid; place-items: center; padding: 18px; }
.parts-thread-change-dialog > section { position: relative; width: min(420px, 100%); max-height: min(620px, calc(100dvh - 36px)); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; border-radius: 14px; background: #fff; box-shadow: 0 20px 60px rgba(15, 23, 42, .3); }
.parts-thread-change-dialog header, .parts-thread-change-dialog footer { display: flex; align-items: center; padding: 12px 14px; }
.parts-thread-change-dialog header { justify-content: space-between; border-bottom: 1px solid #e2e8f0; }
.parts-thread-change-dialog header button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; line-height: 1; }
.parts-thread-change-dialog > section > div { min-height: 0; overflow: auto; padding: 12px 14px; }
.parts-thread-change-dialog dl { margin: 0; padding: 10px 0; }
.parts-thread-change-dialog dl + dl { border-top: 1px solid #e2e8f0; }
.parts-thread-change-dialog dt { margin-bottom: 7px; font-weight: 800; }
.parts-thread-change-dialog dl div { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; padding: 3px 0; }
.parts-thread-change-dialog dl span { color: #64748b; font-size: 12px; }
.parts-thread-change-dialog dd { margin: 0; overflow-wrap: anywhere; }
.parts-thread-change-dialog footer { justify-content: flex-end; border-top: 1px solid #e2e8f0; }
.parts-thread-change-dialog footer button { min-width: 64px; padding: 7px 12px; }
.parts-procurement-preview-trash-list { max-height: min(620px, calc(100dvh - 150px)); overflow: auto; padding: 14px; }
.parts-procurement-preview-trash-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 9px; border-bottom: 1px solid #e2e8f0; }
.parts-procurement-preview-trash-list span { display: grid; min-width: 0; }
.parts-procurement-preview-trash-list em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #64748b; font-size: 11px; font-style: normal; }
.parts-procurement-preview-trash-list button { padding: 6px 9px; }

@media (max-width: 899px) {
  .parts-procurement-preview-editor-body { display: block; overflow: auto; }
  .parts-procurement-preview-editor-info { overflow: visible; }
  .parts-procurement-preview-editor-thread { margin-top: 12px; grid-template-rows: auto auto auto; }
  .parts-procurement-preview-editor-thread .parts-procurement-thread { max-height: 40dvh; }
}

@media (max-width: 767px) {
  .parts-procurement-preview-modal { place-items: end center; }
  .parts-procurement-preview-editor,
  .parts-procurement-preview-editor.is-trash {
    width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top));
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .parts-procurement-preview-form-grid.is-identity,
  .parts-procurement-preview-form-grid.is-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .parts-ticket-candidate { grid-template-columns: 1fr; }
}
