/*
 * 单证备案业务布局层
 *
 * 字体、字号、行高、控件高度、间距、圆角、颜色、阴影、焦点、弹窗、
 * Toast 与响应式视觉全部来自 /shared/tokens.css 和
 * /shared/components.css。本文件只描述单证业务结构、列宽、溢出行为和
 * 业务状态的显隐关系。
 */

.customs-module,
.customs-module .app-frame,
.customs-module .workspace,
.customs-module .content-panel,
.customs-module .view {
  min-width: 0;
  width: 100%;
}

.customs-module .topbar {
  position: sticky;
  top: 0;
}

/* 独立目录提示；视觉与间距复用公共面板、列表及历史卡片。 */
.customs-module .directory-integrity-heading,
.customs-module .directory-issue-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.customs-module .directory-integrity-heading > div,
.customs-module .directory-month,
.customs-module .directory-issue,
.customs-module .directory-paths {
  min-width: 0;
}

.customs-module .directory-integrity p {
  overflow-wrap: anywhere;
}

.customs-module .directory-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.customs-module .directory-counts > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.customs-module .directory-details > summary,
.customs-module .directory-audit > summary {
  cursor: pointer;
}

.customs-module .directory-issue-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customs-module .directory-issue {
  overflow-wrap: anywhere;
}

.customs-module .directory-paths {
  display: grid;
}

.customs-module .directory-reason > span,
.customs-module .directory-audit li > span {
  display: block;
}

.customs-module .directory-audit ol {
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .customs-module .directory-counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customs-module .directory-issue-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .customs-module .directory-integrity-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

.customs-module .topbar-main,
.customs-module .top-actions,
.customs-module .brand-block,
.customs-module .source-heading,
.customs-module .context-copy,
.customs-module .rail-section-heading,
.customs-module .scan-state,
.customs-module .scan-copy,
.customs-module .table-note,
.customs-module .pagination-actions,
.customs-module .manual-actions,
.customs-module .modal-head,
.customs-module .modal-actions,
.customs-module .auto-task-heading,
.customs-module .recipient-toolbar,
.customs-module .task-editor-head,
.customs-module .switch-row,
.customs-module .recipient-item,
.customs-module .recipient-actions,
.customs-module .history-data-heading,
.customs-module .history-total-change,
.customs-module .history-source-line,
.customs-module .edit-hint,
.customs-module .issue-title,
.customs-module .add-row-bar {
  display: flex;
  align-items: center;
}

.customs-module .topbar-main,
.customs-module .context-copy,
.customs-module .rail-section-heading,
.customs-module .table-note,
.customs-module .modal-head,
.customs-module .auto-task-heading,
.customs-module .recipient-toolbar,
.customs-module .task-editor-head,
.customs-module .switch-row,
.customs-module .recipient-item,
.customs-module .history-data-heading,
.customs-module .issue-title {
  justify-content: space-between;
}

.customs-module .top-actions,
.customs-module .pagination-actions,
.customs-module .manual-actions,
.customs-module .modal-actions,
.customs-module .recipient-actions,
.customs-module .history-total-change,
.customs-module .history-source-line,
.customs-module .edit-hint,
.customs-module .add-row-bar {
  flex-wrap: wrap;
}

.customs-module .app-frame {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.customs-module .render-metrics,
.customs-module [hidden] {
  display: none !important;
}

/* 数据空间和扫描摘要是模块内状态带，不是第二条系统侧栏。 */
.customs-module .workspace-rail {
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(320px, 1.3fr) minmax(220px, .8fr) minmax(220px, 1fr);
  align-items: stretch;
}

.customs-module .rail-brand,
.customs-module .rail-section,
.customs-module .brand-copy,
.customs-module .source-option-copy,
.customs-module .scan-copy,
.customs-module .manual-entry-copy,
.customs-module .recipient-main,
.customs-module .history-entry-meta,
.customs-module .history-entry-operation {
  min-width: 0;
}

.customs-module .brand-block,
.customs-module .source-option,
.customs-module .summary-cell,
.customs-module .scan-state {
  width: 100%;
}

.customs-module .product-mark,
.customs-module .source-logo {
  display: block;
  max-width: 100%;
  object-fit: contain;
}

.customs-module .source-switch,
.customs-module .summary-strip,
.customs-module .manual-list,
.customs-module .manual-card-body,
.customs-module .manual-rows,
.customs-module .history-list,
.customs-module .history-detail-content,
.customs-module .history-data-section,
.customs-module .recipient-list,
.customs-module .modal-form,
.customs-module .form-grid,
.customs-module .auto-export-task,
.customs-module .task-editor,
.customs-module .auto-export-time,
.customs-module .schedule-copy,
.customs-module .recipient-main {
  display: grid;
}

.customs-module .rail-source-section {
  display: flex;
  align-items: center;
  justify-content: center;
}

.customs-module .source-logo-crop .source-logo-elangsung {
  max-width: none;
}

.customs-module .source-option-copy,
.customs-module .scan-copy,
.customs-module .recipient-main {
  display: grid;
}

.customs-module .summary-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customs-module .workspace {
  overflow: hidden;
}

.customs-module .tabs {
  display: flex;
  align-items: center;
  overflow-x: auto;
}

.customs-module .tab {
  flex: 0 0 auto;
}

.customs-module .view {
  display: none;
}

.customs-module .view.active {
  display: block;
}

.customs-module .filter-card {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) repeat(3, minmax(130px, 1fr)) minmax(240px, 1.3fr) max-content;
  align-items: end;
}

.customs-module .filter-card label,
.customs-module .date-range-field,
.customs-module .date-range-heading,
.customs-module .date-range-control {
  min-width: 0;
}

.customs-module .date-range-field,
.customs-module .date-range-control {
  position: relative;
}

.customs-module .date-range-heading {
  display: flex;
  justify-content: space-between;
}

.customs-module .date-range-control input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  pointer-events: none;
}

.customs-module .date-range-control input[type="range"]::-webkit-slider-thumb,
.customs-module .date-range-control input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
}

.customs-module .table-wrap {
  overflow: auto;
  overscroll-behavior: contain;
}

.customs-module table {
  width: 100%;
  min-width: 940px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.customs-module th,
.customs-module td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.customs-module th.number,
.customs-module td.number {
  text-align: right;
}

.customs-module th.center,
.customs-module td.center {
  text-align: center;
}

.customs-module .column-work { width: 15%; }
.customs-module .column-factory { width: 20%; }
.customs-module .column-customs { width: 14%; }
.customs-module .column-vat { width: 16%; }
.customs-module .column-date { width: 12%; }
.customs-module .column-source { width: 12%; }
.customs-module .column-status { width: 11%; }

.customs-module .work-code,
.customs-module .date-cell,
.customs-module .status {
  white-space: nowrap;
}

.customs-module .editable-cell {
  position: relative;
}

.customs-module .cell-editor {
  width: 100%;
}

.customs-module .table-pagination {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content max-content;
  align-items: center;
}

.customs-module .page-size-control {
  display: flex;
  align-items: center;
}

.customs-module .manual-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.customs-module .manual-card,
.customs-module .history-entry,
.customs-module .history-data-row {
  overflow: hidden;
}

.customs-module .manual-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.customs-module .factory-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.customs-module .auto-preview {
  overflow-x: auto;
}

.customs-module .auto-edit-form {
  display: grid;
  grid-template-columns: minmax(150px, .9fr) repeat(4, minmax(130px, 1fr)) max-content;
  align-items: end;
}

.customs-module .manual-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) max-content;
  align-items: end;
}

.customs-module .factory-evidence,
.customs-module .factory-review-fields {
  grid-column: 1 / -1;
  min-width: 0;
  border: 1px solid var(--suite-color-border);
  background: var(--suite-color-canvas);
}

.customs-module .factory-evidence dl,
.customs-module .factory-review-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.customs-module .factory-evidence dd,
.customs-module .factory-evidence p { overflow-wrap: anywhere; }

.customs-page .factory-review-basis-raw {
  max-height: 18rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* This modal is appended to body, outside the module shell. The shared
   .modal-backdrop supplies its 16px padding and shared visual treatment. */
#factoryReviewModal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

#factoryReviewModal[hidden] { display: none; }

#factoryReviewModal .modal-card {
  max-height: calc(100dvh - 32px);
  overflow: auto;
  min-width: 0;
}

#factoryReviewModal .factory-evidence,
#factoryReviewModal .factory-review-fields {
  grid-column: 1 / -1;
  min-width: 0;
}

#factoryReviewModal .factory-evidence dl,
#factoryReviewModal .factory-review-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

#factoryReviewModal .factory-review-form,
#factoryReviewModal .factory-review-form label {
  display: grid;
  min-width: 0;
}

#factoryReviewModal .factory-review-form input { min-width: 0; width: 100%; }
#factoryReviewModal .factory-evidence dd,
#factoryReviewModal .factory-evidence p { overflow-wrap: anywhere; }

.customs-module .issue-row {
  display: grid;
  grid-template-columns: minmax(160px, .3fr) minmax(0, 1fr);
}

.customs-module .history-entry-summary {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(105px, max-content);
  align-items: start;
}

.customs-module .history-entry-operation {
  display: grid;
  grid-template-columns: minmax(180px, max-content) minmax(0, 1fr);
  align-items: start;
}

.customs-module .history-expand {
  justify-self: end;
  white-space: nowrap;
}

.customs-module .history-reading-guide ol,
.customs-module .history-explanation-flow,
.customs-module .history-status-comparison,
.customs-module .history-record-comparison {
  display: grid;
}

.customs-module .history-status-comparison {
  grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
  align-items: stretch;
}

.customs-module .history-status-side,
.customs-module .history-record-side {
  min-width: 0;
}

.customs-module .history-comparison-arrow,
.customs-module .history-record-arrow {
  display: grid;
  place-items: center;
}

.customs-module .history-reading-guide ol {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.customs-module .history-reading-guide li,
.customs-module .history-step,
.customs-module .history-technical > div {
  display: flex;
}

.customs-module .history-entry-meta {
  display: grid;
  justify-items: end;
}

.customs-module .history-work-number,
.customs-module .history-result {
  display: block;
}

.customs-module .history-action,
.customs-module .history-result {
  grid-column: 1 / -1;
}

.customs-module .history-day {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.customs-module .history-technical > div {
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.customs-module .history-entry:not([open]) .expand-open,
.customs-module .history-entry[open] .expand-closed {
  display: none;
}

.customs-module .history-note {
  display: grid;
  grid-template-columns: minmax(120px, .25fr) minmax(0, 1fr);
}

.customs-module .history-data-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

.customs-module .history-data-row dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customs-module .history-record-comparison {
  grid-template-columns: minmax(0, 1fr) 32px minmax(0, 1fr);
  align-items: stretch;
}

.customs-module .history-data-row dl > div,
.customs-module .history-data-row dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.customs-module .action-menu {
  position: relative;
}

.customs-module .action-menu-panel {
  position: absolute;
  right: 0;
  display: grid;
  min-width: 190px;
}

.customs-module .action-menu:not([open]) .action-menu-panel {
  display: none;
}

.customs-module .modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

.customs-module + .modal-backdrop,
body > .modal-backdrop {
  z-index: var(--suite-z-modal, 1200);
}

.customs-module .email-tasks-modal,
body > .email-tasks-modal {
  width: min(860px, 100%);
}

.customs-module .auto-export-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, .4fr);
  align-items: end;
}

.customs-module .schedule-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.customs-module .form-grid.two-column,
body > .modal-backdrop .form-grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* 弹窗位于模块 shell 之外；仅补足业务表单的网格结构。 */
.customs-page > .modal-backdrop .modal-head,
.customs-page > .modal-backdrop .modal-actions,
.customs-page > .modal-backdrop .auto-task-heading,
.customs-page > .modal-backdrop .recipient-toolbar,
.customs-page > .modal-backdrop .task-editor-head,
.customs-page > .modal-backdrop .switch-row,
.customs-page > .modal-backdrop .recipient-item,
.customs-page > .modal-backdrop .recipient-actions {
  display: flex;
  align-items: center;
}

.customs-page > .modal-backdrop .modal-head,
.customs-page > .modal-backdrop .auto-task-heading,
.customs-page > .modal-backdrop .recipient-toolbar,
.customs-page > .modal-backdrop .task-editor-head,
.customs-page > .modal-backdrop .switch-row,
.customs-page > .modal-backdrop .recipient-item {
  justify-content: space-between;
}

.customs-page > .modal-backdrop .modal-form,
.customs-page > .modal-backdrop .form-grid,
.customs-page > .modal-backdrop .auto-export-task,
.customs-page > .modal-backdrop .task-editor,
.customs-page > .modal-backdrop .recipient-list,
.customs-page > .modal-backdrop .recipient-main,
.customs-page > .modal-backdrop .auto-export-time {
  display: grid;
}

.customs-page > .modal-backdrop .auto-export-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, .4fr);
  align-items: end;
}

.customs-page > .modal-backdrop .schedule-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.customs-page > .modal-backdrop .form-grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1180px) {
  .customs-module .workspace-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customs-module .filter-card {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .customs-module .date-range-field {
    grid-column: span 2;
  }

  .customs-module .auto-edit-form,
  .customs-module .manual-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .customs-module .topbar {
    position: static;
  }

  .customs-module .workspace-rail,
  .customs-module .filter-card,
  .customs-module .auto-edit-form,
  .customs-module .manual-form,
  .customs-module .history-entry-summary,
  .customs-module .history-note,
  .customs-module .schedule-facts,
  .customs-module .auto-export-controls,
  .customs-module .form-grid.two-column,
  .customs-page > .modal-backdrop .schedule-facts,
  .customs-page > .modal-backdrop .auto-export-controls,
  .customs-page > .modal-backdrop .form-grid.two-column,
  body > .modal-backdrop .form-grid.two-column {
    grid-template-columns: minmax(0, 1fr);
  }

  .customs-module .history-status-comparison,
  .customs-module .history-record-comparison {
    grid-template-columns: minmax(0, 1fr);
  }

  .customs-module .date-range-field {
    grid-column: auto;
  }

  .customs-module .table-pagination {
    grid-template-columns: minmax(0, 1fr) max-content;
  }

  .customs-module .pagination-actions {
    grid-column: 1 / -1;
  }

  .customs-module .manual-intro,
  .customs-module .manual-card-head,
  .customs-module .topbar-main {
    align-items: stretch;
    flex-direction: column;
  }

  .customs-module .history-data-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .customs-module .history-reading-guide ol {
    grid-template-columns: minmax(0, 1fr);
  }

  .customs-module .history-entry-meta {
    justify-items: start;
  }

  .customs-module .history-data-row dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .customs-module .workspace-rail,
  .customs-module .summary-strip,
  .customs-module .filter-card,
  .customs-module .auto-edit-form,
  .customs-module .manual-form,
  .customs-module .history-data-row dl,
  .customs-module .table-pagination {
    grid-template-columns: minmax(0, 1fr);
  }

  .customs-module .pagination-actions {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .customs-module *,
  .customs-module *::before,
  .customs-module *::after {
    scroll-behavior: auto !important;
  }
}
