/* public/css/style.css - Design System & Print CSS for PDS Management System */

:root {
  --primary-blue: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-light: #eff6ff;
  --accent-teal: #0d9488;
  --accent-light: #f0fdfa;
  --surface-bg: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--surface-bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.app-header {
  height: 64px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 20;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #2563eb, #0d9488);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.3px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.role-switcher-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
}

.role-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.role-select {
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: #1e40af;
  cursor: pointer;
  outline: none;
}

/* Body: Sidebar + Main Content */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.app-sidebar {
  width: 216px;
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 16px 10px;
  gap: 6px;
  flex-shrink: 0;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 8px 12px 4px 12px;
  letter-spacing: 0.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.nav-item.active {
  background-color: var(--primary-light);
  color: var(--primary-blue);
  font-weight: 600;
  border-color: #bfdbfe;
}

.nav-item-icon {
  font-size: 16px;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #475569;
  font-weight: 600;
}

.nav-item.active .nav-badge {
  background: #bfdbfe;
  color: #1d4ed8;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Main Content Area */
.app-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 20px 24px;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.4px;
}

.page-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary-blue);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #ffffff;
  border-color: var(--border-color);
  color: #334155;
}
.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}
.btn-success:hover {
  background-color: #15803d;
}

.btn-outline-danger {
  background: transparent;
  border-color: #fca5a5;
  color: var(--danger);
}
.btn-outline-danger:hover {
  background: #fef2f2;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Filters & Search Bar */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
  flex-wrap: wrap;
  background: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.search-input {
  flex: 1;
  min-width: 220px;
  padding: 7px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}
.search-input:focus {
  border-color: var(--border-focus);
}

.filter-select {
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background-color: #ffffff;
  outline: none;
  cursor: pointer;
}

/* Table Cards */
.table-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-card-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: #f8fafc;
  padding: 11px 12px;
  font-weight: 600;
  font-size: 12px;
  color: #475569;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: #f8fafc;
}

/* Compact Single-Line Data Tables (Master Grade, Domestic PDS, Export PDS) */
.compact-data-table th,
.compact-data-table td {
  white-space: nowrap;
  padding: 9px 8px;
}

.compact-data-table th:first-child,
.compact-data-table td:first-child {
  padding-left: 14px;
}

.compact-data-table th:last-child,
.compact-data-table td:last-child {
  padding-right: 14px;
}

.compact-data-table th.col-tight {
  width: 1%;
}

.compact-data-table .btn-sm {
  padding: 4px 8px;
  font-size: 12px;
  gap: 4px;
}

.pds-grade-link {
  display: block;
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pds-grade-link:hover {
  text-decoration: underline;
}

.pds-grade-link-dom {
  color: #1e40af;
}

.pds-grade-link-exp {
  color: #0f766e;
}

.pds-sub-meta {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pds-ref-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.pds-ref-pill-dom {
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #dbeafe;
}

.pds-ref-pill-exp {
  color: #0f766e;
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
}

.pds-tpl-text {
  font-size: 12px;
  color: #475569;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pds-cert-text {
  font-size: 12px;
  color: #0369a1;
  font-weight: 600;
  max-width: 175px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pds-time-text {
  font-size: 11.5px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pds-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.mg-code-title {
  font-weight: 700;
  color: #1e40af;
  font-size: 13.5px;
  line-height: 1.3;
  white-space: nowrap;
}

.mg-code-meta {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mg-matrix-text {
  font-size: 12px;
  color: #334155;
  font-weight: 500;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mg-appearance-text {
  font-size: 11px;
  color: #64748b;
  margin-top: 3px;
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mg-specs-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #334155;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.mg-spec-item {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}

.mg-spec-label {
  color: #64748b;
}

.mg-spec-value {
  color: #0f172a;
  font-weight: 600;
}

.mg-spec-sep {
  color: #cbd5e1;
  user-select: none;
}

.mg-pds-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.mg-pds-badges .badge {
  font-size: 11px;
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
}

.mg-pds-badges .badge-zero {
  opacity: 0.52;
}

.mg-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-teal {
  background: #f0fdfa;
  color: #0f766e;
  border: 1px solid #99f6e4;
}

.badge-gray {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-green {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.badge-amber {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-red {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.badge-purple {
  background: #faf5ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

.badge-indigo {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

/* Form Styles inside Modals */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background-color: #fff;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-col {
  flex: 1;
}

/* Modal Framework */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 840px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-dialog.modal-xl {
  max-width: 1100px;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.modal-close-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  padding: 12px 18px;
  background: #0f172a;
  color: #ffffff;
  font-size: 13px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.25s ease forwards;
}

.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ========================================================
   PDS 高保真渲染器 & 打印标准样式 (A4 PRINT CSS)
   ======================================================== */
.pds-preview-wrapper {
  background: #475569;
  padding: 30px;
  border-radius: var(--radius-md);
  overflow-y: auto;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

.pds-page-container {
  width: 210mm;
  min-height: 297mm;
  background: #ffffff;
  padding: 13mm 16mm 15mm 16mm;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  position: relative;
  box-sizing: border-box;
  font-size: 12px;
  color: #1e293b;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  page-break-after: always;
  break-after: page;
}

.pds-page-content-flow {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.pds-page-subtitle-banner {
  background: var(--pds-stripe, #f8fafc);
  border-left: 4px solid var(--pds-primary, #1e40af);
  padding: 6px 12px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--pds-primary, #1e40af);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 0 4px 4px 0;
}

.pds-section,
.pds-spec-table,
.pds-packaging-layout-both,
.pds-packaging-layout-photo,
.pds-chart-card,
.pds-engineering-notes,
.pds-apps-grid,
.pds-desc-text,
.pds-certs-grid {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.pds-section-title {
  page-break-after: avoid !important;
  break-after: avoid !important;
}

/* Charts Grid & Cards for Page 2 */
.pds-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 10px;
}

.pds-charts-grid.single-chart {
  grid-template-columns: 1fr;
  max-width: 600px;
  margin: 10px auto 0 auto;
}

.pds-chart-card {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  page-break-inside: avoid;
}

.pds-chart-card.full-width {
  grid-column: 1 / -1;
}

.pds-chart-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--pds-primary, #1e40af);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 4px;
}

.pds-chart-legend {
  display: flex;
  gap: 10px;
  font-size: 9px;
  color: #64748b;
  font-weight: 600;
}

.pds-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pds-legend-color {
  width: 12px;
  height: 3px;
  border-radius: 2px;
}

.pds-engineering-notes {
  background: #f8fafc;
  border-left: 3.5px solid var(--pds-primary, #1e40af);
  padding: 8px 12px;
  font-size: 10px;
  color: #475569;
  line-height: 1.5;
  margin-top: 14px;
}

/* PDS Document Header */
.pds-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 2.5px solid var(--pds-primary, #1e40af);
  margin-bottom: 16px;
}

.pds-header-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pds-logo-text {
  font-size: 20px;
  font-weight: 800;
  color: var(--pds-primary, #1e40af);
  letter-spacing: -0.5px;
}

.pds-company-name {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.pds-tagline {
  font-size: 11px;
  color: #64748b;
}

.pds-header-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: #64748b;
}

.pds-doc-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--pds-primary, #1e40af);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  border-radius: 3px;
  margin-bottom: 4px;
}

/* PDS Main Title */
.pds-title-section {
  margin-bottom: 16px;
  padding: 8px 12px;
  background: #f8fafc;
  border-left: 4px solid var(--pds-primary, #1e40af);
}

.pds-product-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.pds-product-meta {
  font-size: 11px;
  color: #475569;
  margin-top: 4px;
  display: flex;
  gap: 16px;
}

.pds-section {
  margin-bottom: 16px;
}

.pds-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--pds-primary, #1e40af);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 4px;
}

.pds-desc-text {
  font-size: 11.5px;
  line-height: 1.6;
  color: #334155;
  text-align: justify;
}

/* PDS Metric Table */
.pds-spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 6px;
}

.pds-spec-table th {
  background-color: var(--pds-primary, #1e40af);
  color: #ffffff;
  padding: 6px 10px;
  font-weight: 700;
  text-align: left;
  border: 1px solid var(--pds-primary, #1e40af);
}

.pds-spec-table td {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  color: #1e293b;
}

.pds-spec-table tr:nth-child(even) td {
  background-color: var(--pds-stripe, #f8fafc);
}

.pds-spec-table .spec-value-col {
  font-weight: 600;
  color: #0f172a;
}

/* Certifications Pill Grid */
.pds-certs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.pds-cert-pill {
  padding: 3px 8px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #334155;
}

/* PDS Footer */
.pds-doc-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #cbd5e1;
  font-size: 10px;
  color: #64748b;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pds-footer-disclaimer {
  font-style: italic;
  font-size: 9.5px;
  line-height: 1.4;
  color: #94a3b8;
}

.pds-footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

/* Dynamic Anti-Leak Watermark Layer */
.pds-watermark-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  opacity: 0.14;
}

.watermark-row {
  display: flex;
  justify-content: space-around;
  transform: rotate(-25deg);
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
  color: #dc2626;
  letter-spacing: 2px;
  user-select: none;
}

/* ========================================================
   MODULAR PDS DESIGN SYSTEM STYLES
   ======================================================== */
.form-module-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.form-module-card:hover {
  border-color: #cbd5e1;
}

.form-module-card.module-required {
  border-left: 4px solid #2563eb;
}

.form-module-card.module-optional {
  border-left: 4px solid #0d9488;
}

.form-module-card.module-disabled {
  opacity: 0.65;
  background: #f8fafc;
}

.module-header {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.module-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1e40af;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form-module-card.module-optional .module-num {
  background: #0f766e;
}

.module-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #1e293b;
}

.module-badge-req {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 700;
}

.module-badge-opt {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #ccfbf1;
  color: #0f766e;
  font-weight: 700;
}

.module-order-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.module-order-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fixed-module-notice {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 14px;
  font-size: 12px;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-body {
  padding: 14px;
}

/* Character Counter */
.char-counter {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.char-counter.valid {
  background: #dcfce7;
  color: #15803d;
}

.char-counter.invalid {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

/* Applications Tags Editor (Module 1) */
.app-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  margin-bottom: 8px;
}

.app-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
}

.app-tag-remove {
  cursor: pointer;
  color: #94a3b8;
  font-size: 13px;
  font-weight: bold;
  transition: color 0.15s;
}

.app-tag-remove:hover {
  color: #ef4444;
}

.quick-tag-preset {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-tag-preset:hover {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}

/* Metric Selection (Module 3) */
.metric-selector-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11.5px;
  color: #64748b;
}

.metric-select-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.metric-select-row.selected {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.metric-select-row.unselected {
  background: #f8fafc;
  opacity: 0.6;
}

/* Subgroup Classified Container for Metrics */
.metric-subgroup-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.metric-subgroup-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 7px 7px 0 0;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-subgroup-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Document View Styles for Modules */
.pds-apps-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  margin-bottom: 10px;
}

.pds-app-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #1e293b;
}

.pds-app-chip-icon {
  color: var(--pds-primary, #1e40af);
  font-weight: 900;
  font-size: 11px;
}

.pds-desc-text {
  font-size: 11.5px;
  line-height: 1.65;
  color: #334155;
  text-align: justify;
}

/* ========================================================
   PACKAGING PHOTO & DISPLAY MODE (MODULE 5)
   ======================================================== */
.pkg-mode-selector {
  display: flex;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 3px;
  gap: 4px;
  margin-bottom: 10px;
}

.pkg-mode-btn {
  flex: 1;
  padding: 6px 10px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.pkg-mode-btn:hover {
  color: #1e293b;
  background: rgba(255, 255, 255, 0.6);
}

.pkg-mode-btn.active {
  background: #ffffff;
  color: #0f766e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

.pkg-photo-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 16px;
  background: #f8fafc;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 10px;
}

.pkg-photo-dropzone:hover, .pkg-photo-dropzone.dragover {
  border-color: #0d9488;
  background: #f0fdfa;
}

.pkg-photo-dropzone-icon {
  font-size: 26px;
  margin-bottom: 4px;
}

.pkg-photo-dropzone-text {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
}

.pkg-photo-dropzone-sub {
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 2px;
}

.pkg-photo-preview-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  margin-bottom: 10px;
}

.pkg-photo-thumb-wrap {
  width: 70px;
  height: 52px;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pkg-photo-thumb {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.pkg-photo-info {
  flex: 1;
  font-size: 12px;
}

.pkg-photo-name {
  font-weight: 700;
  color: #0f766e;
  margin-bottom: 2px;
  word-break: break-all;
}

.pkg-photo-actions {
  display: flex;
  gap: 6px;
}

.pkg-preset-btn {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.pkg-preset-btn:hover {
  background: #f0fdfa;
  border-color: #0d9488;
  color: #0f766e;
}

.pkg-preset-btn.active {
  background: #0d9488;
  border-color: #0f766e;
  color: #ffffff;
  font-weight: 600;
}

/* PDS Document Packaging Presentation Styles */
.pds-packaging-layout-both {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 8px;
}

.pds-pkg-photo-col {
  width: 140px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  background: #fcfcfd;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.pds-pkg-photo-col img {
  width: 100%;
  height: 95px;
  object-fit: contain;
  background: #f8fafc;
  display: block;
}

.pds-pkg-photo-caption {
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  padding: 3px 4px;
  background: #f1f5f9;
  color: #475569;
  border-top: 1px solid #e2e8f0;
}

.pds-pkg-text-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 11px;
  line-height: 1.55;
  color: #334155;
}

.pds-packaging-layout-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

.pds-pkg-photo-center {
  max-width: 240px;
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  background: #f8fafc;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.pds-pkg-photo-center img {
  width: 100%;
  height: 105px;
  object-fit: contain;
  display: block;
}

/* ========================================================
   PRINT SPECIFIC RULES (WINDOW.PRINT - MULTI-PAGE A4)
   ======================================================== */
.pds-print-only-root {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0 !important;
  }

  html, body {
    width: 210mm !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* 完全隐藏主界面与全部模态框（避免 modal-dialog 的 max-height:90vh / overflow:hidden / flex / transform 截断多页打印） */
  .app-container,
  .modal-overlay,
  .toast-container {
    display: none !important;
  }

  /* 仅启用挂载在 body 顶层的纯净多页 A4 打印根节点 */
  #pds-print-container.pds-print-only-root {
    display: block !important;
    position: static !important;
    width: 210mm !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  #pds-print-container > .pds-page-container {
    display: block !important;
    position: relative !important;
    width: 210mm !important;
    height: 296.5mm !important;
    min-height: 296.5mm !important;
    max-height: 296.5mm !important;
    padding: 12mm 15mm 26mm 15mm !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  #pds-print-container > .pds-page-container:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  #pds-print-container .pds-page-content-flow {
    display: block !important;
  }

  #pds-print-container .pds-doc-footer {
    position: absolute !important;
    bottom: 10mm !important;
    left: 15mm !important;
    right: 15mm !important;
    margin-top: 0 !important;
    background: #ffffff !important;
  }

  #pds-print-container .pds-spec-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}
