/**
 * 佳誉 ERP 2.0 — 弹窗（admin-modal / standard-modal / 业务浮层）
 */
/* 弹窗：遮罩 + 内容区使用 .card */
.admin-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1050;
    align-items: center;
    justify-content: center;
}
.admin-modal.is-open { display: flex; }
.admin-modal-content {
    background: #ffffff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 24px;
    min-width: 360px;
    max-width: 96%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}
.admin-modal-title {
    margin: 0 0 16px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}
.admin-modal .card {
    padding: 0;
    box-shadow: none;
    border: none;
}
/* 弹窗与表单：与 standard 同风格，主按钮蓝、次按钮白底灰框 */
.standard-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1050;
    align-items: center;
    justify-content: center;
}
.standard-modal.is-open {
    display: flex;
}
.standard-modal-content {
    background: #fff;
    border-radius: 8px;
    border: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    padding: 24px;
    min-width: 300px;
    max-width: 80%;
    max-height: 80vh;
    overflow: auto;
}
.standard-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.standard-modal-close-btn {
    border: none;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #9ca3af;
    padding: 0;
}
.standard-modal-close-btn:hover {
    color: #4b5563;
}

/* 表单标签必填红星（配合 <abbr title="必填"> 提升可访问性） */
.standard-required-mark {
    color: #ef4444;
    font-weight: 600;
    margin-left: 2px;
    text-decoration: none;
    cursor: help;
}

.standard-form-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.standard-modal-title {
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: 700;
    color: #333;
}
.standard-modal .standard-form .standard-form-row {
    margin-bottom: 16px;
}
.standard-modal .standard-form .standard-form-row:last-of-type {
    margin-bottom: 0;
}
.standard-modal .standard-form label {
    display: block;
    font-size: 14px;
    color: #555;
    font-weight: 500;
    margin-bottom: 6px;
}
.standard-modal .standard-form .standard-input,
.standard-modal .standard-form .standard-select {
    width: 100%;
}
.standard-modal .standard-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
}
.standard-modal button.standard-btn-secondary,
.standard-modal .standard-btn-secondary {
    height: 32px !important;
    padding: 0 16px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #333 !important;
    background: #fff !important;
    border: 1px solid #d9d9d9 !important;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.standard-modal button.standard-btn-secondary:hover,
.standard-modal .standard-btn-secondary:hover {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}
.standard-modal button.standard-btn-primary,
.standard-modal .standard-btn-primary {
    color: #fff !important;
    background: var(--primary) !important;
    border: none !important;
}
.standard-modal button.standard-btn-primary:hover,
.standard-modal .standard-btn-primary:hover {
    background: var(--primary-hover) !important;
    color: #fff !important;
}

/* ------------------------------------------------------------------
 * 基础设置 / 系统管理 — 表单弹窗：顶栏「确定」「取消」+ 标题 + 可滚动正文
 * 打开即可见主操作，仅中间区域纵向滚动。
 * RF1：顶栏 / 标题 / body-scroll 同 var(--erp-content-inset, 20px)；禁止底栏 footer 占位。
 * 对照：designs/ui-reference → S⑥ / L1「新建/编辑」
 * ------------------------------------------------------------------ */
.standard-modal-content.standard-modal-content--form {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    min-width: 400px;
    max-width: 96%;
    overflow: hidden;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}
/* --form 尺寸 token（MR1）：与 Runbook §1.3 一致，业务弹窗按需叠加修饰符 */
.standard-modal-content.standard-modal-content--form.standard-modal-content--sm {
    min-width: 360px;
    max-width: min(420px, 96vw);
}
.standard-modal-content.standard-modal-content--form.standard-modal-content--md {
    min-width: 400px;
    max-width: min(520px, 96vw);
}
.standard-modal-content.standard-modal-content--form.standard-modal-content--lg {
    min-width: 480px;
    max-width: min(720px, 96vw);
}
.standard-modal-content.standard-modal-content--form.standard-modal-content--xl {
    min-width: 560px;
    max-width: min(960px, 96vw);
}
.standard-modal-content.standard-modal-content--form .standard-modal-actions-top {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px var(--erp-content-inset, 20px);
    border-bottom: 1px solid #f3f4f6;
    background: #fafafa;
}
.standard-modal-content.standard-modal-content--form .standard-modal-actions-top .standard-btn-primary,
.standard-modal-content.standard-modal-content--form .standard-modal-actions-top .standard-btn-secondary {
    height: 32px;
    min-height: 32px;
    padding: 0 16px;
    font-size: 14px;
    line-height: 1;
}
.standard-modal-content.standard-modal-content--form .standard-modal-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px var(--erp-content-inset, 20px) 0;
    margin-bottom: 0;
}
.standard-modal-content.standard-modal-content--form .standard-modal-header .standard-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #333;
}
.standard-modal-content.standard-modal-content--form .standard-modal-head {
    flex-shrink: 0;
    padding: 8px var(--erp-content-inset, 20px) 0;
}
.standard-modal-content.standard-modal-content--form .standard-modal-head .standard-modal-title {
    margin: 0;
}
.standard-modal-content.standard-modal-content--form > .standard-modal-body-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px var(--erp-content-inset, 20px) 16px;
}
.standard-modal-content.standard-modal-content--form .standard-modal-body {
    padding: 0;
}
/* RF1 R2：--form 壳禁止底栏占位；操作仅在 standard-modal-actions-top */
.standard-modal-content.standard-modal-content--form > .standard-modal-footer {
    display: none !important;
}
.standard-modal-close {
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: #9ca3af;
    user-select: none;
}
.standard-modal-close:hover {
    color: #4b5563;
}

/* 辅料弹窗：三列网格（自 ui_modals 维护，禁止页内 style） */
#modal-accessory .accessory-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px 12px;
    margin-bottom: 6px;
}
#modal-accessory .accessory-form-grid .field-item {
    display: flex;
    flex-direction: column;
}
#modal-accessory .accessory-form-grid .field-item label {
    font-size: 12px;
    color: #374151;
    margin-bottom: 4px;
    font-weight: 500;
}
#modal-accessory .accessory-form-grid .field-item input,
#modal-accessory .accessory-form-grid .field-item select {
    height: 32px;
    min-height: 32px;
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}
#modal-accessory .accessory-form-grid .field-item input:focus,
#modal-accessory .accessory-form-grid .field-item select:focus {
    outline: none;
    border-color: #10b981;
}
#modal-accessory .accessory-form-grid .field-item input[readonly] {
    background: #f3f4f6;
    color: #6b7280;
}
#modal-accessory .accessory-form-grid .field-item input[type="file"] {
    height: auto;
    padding: 4px;
}
#modal-accessory .accessory-form-row-image {
    align-items: flex-end;
}
#modal-accessory .accessory-image-preview-box {
    width: 72px;
    height: 72px;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
}
#modal-accessory .accessory-image-preview-box .accessory-image-placeholder {
    font-size: 11px;
    color: #9ca3af;
}
#modal-accessory .accessory-image-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.order-import-help-overlay { position: fixed; left: 0; top: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 9998; display: flex; align-items: center; justify-content: center; }
.order-import-help-box { background: #fff; border-radius: var(--order-radius); box-shadow: 0 8px 32px rgba(0,0,0,0.2); max-width: 520px; width: 90%; max-height: 85vh; overflow: hidden; display: flex; flex-direction: column; }
.order-import-help-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #e5e7eb; font-weight: 600; font-size: 14px; }
.order-import-help-close { background: none; border: none; font-size: 22px; line-height: 1; color: #6b7280; cursor: pointer; padding: 0 4px; }
.order-import-help-close:hover { color: #111; }
.order-import-help-body { padding: 16px; overflow-y: auto; font-size: 13px; color: #374151; line-height: 1.6; }
.order-import-help-body p { margin: 0 0 12px 0; }
.order-import-help-body p:last-child { margin-bottom: 0; }

.order-import-dup-box { max-width: 640px; }
.order-import-dup-lead { margin: 0 0 12px 0; font-weight: 500; color: #111827; }
.order-import-dup-hint { margin: 12px 0 0 0; font-size: 12px; color: #6b7280; }
.order-import-dup-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #f3f4f6;
}
.order-import-dup-table { font-size: 13px; }
/* 采购矩阵弹窗 */
.purchase-matrix-modal-content { max-width: 90vw; }
.pipeline-popup { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.pipeline-popup-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); }
.pipeline-popup-content { position: relative; background: #fff; border-radius: 8px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); max-width: 420px; width: 100%; max-height: 70vh; overflow: hidden; display: flex; flex-direction: column; }
.pipeline-popup-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid #e5e7eb; }
.pipeline-popup-close { font-size: 22px; background: none; border: none; cursor: pointer; color: #6b7280; padding: 0 4px; line-height: 1; }
.pipeline-popup-body { padding: 12px; overflow: auto; }
.permission-modal-overlay { position: fixed; left: 0; top: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 9998; display: none; align-items: center; justify-content: center; }
.permission-modal-overlay.show { display: flex; }
.permission-modal-box { background: #fff; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); max-width: 520px; width: 90%; max-height: 85vh; overflow: hidden; display: flex; flex-direction: column; }
.permission-modal-actions-top {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
}
.permission-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid #e5e7eb; font-weight: 600; font-size: 14px; }
.permission-modal-close { background: none; border: none; font-size: 22px; line-height: 1; color: #6b7280; cursor: pointer; padding: 0 4px; }
.permission-modal-close:hover { color: #111; }
.permission-modal-body { flex: 1; min-height: 0; padding: 16px; overflow-y: auto; }
.permission-modal-body .perm-group { margin-bottom: 16px; }
.permission-modal-body .perm-group-title { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.permission-modal-body .perm-group-items { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.permission-modal-body .perm-item { display: flex; align-items: center; gap: 6px; }
.permission-modal-body .perm-item input { margin: 0; }
.permission-modal-actions-top .standard-btn-primary:disabled,
.permission-modal-actions-top .standard-btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

/* ==================== 全局 erpAlert / erpConfirm / erpPrompt（partials/_erp_global_dialog_script.html 注入） ==================== */
/* 与 standard-modal-content--form 同构：顶栏 actions-top + body-scroll；z-index 高于业务弹窗 */
#erp-global-dialog-host.standard-modal {
    z-index: 13000;
}
#erp-global-dialog-host .erp-global-dialog-message {
    font-size: 14px;
    line-height: 1.6;
    color: #374151;
    white-space: pre-wrap;
    word-break: break-word;
}
#erp-global-dialog-host #erp-global-dialog-input {
    display: none;
    width: 100%;
    margin-top: 12px;
    box-sizing: border-box;
}
#erp-global-dialog-host #erp-global-dialog-input.is-visible {
    display: block;
}
#erp-global-dialog-host #erp-global-dialog-cancel.is-hidden {
    display: none;
}

/* ==================== 提交样衣制作（版单列表 + 工作台） ==================== */
.erp-submit-sample-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 12000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.erp-submit-sample-overlay .erp-submit-sample-mask {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.erp-submit-sample-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    max-height: min(90vh, 640px);
    overflow: auto;
    box-sizing: border-box;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
}

.erp-submit-sample-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 1.25rem;
}

.erp-submit-sample-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    line-height: 1.35;
}

.erp-submit-sample-dismiss {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: -6px -8px 0 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #9ca3af;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.erp-submit-sample-dismiss:hover {
    background: #f3f4f6;
    color: #4b5563;
}

.erp-submit-sample-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.erp-submit-sample-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
}

.erp-submit-sample-label {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    line-height: 1.4;
}

.erp-submit-sample-field .form-control,
.erp-submit-sample-field select.form-control {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    min-height: 38px;
}

.erp-submit-sample-field input[type="date"].form-control {
    min-height: 38px;
    padding-top: 6px;
    padding-bottom: 6px;
}

.erp-submit-sample-field input[type="number"].form-control {
    text-align: right;
}

.erp-submit-sample-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
}

.erp-submit-sample-footer .btn {
    min-width: 96px;
    border-radius: 8px;
    font-weight: 500;
}

/* 专用类，避免版单列表等页内 .btn-primary 主题色覆盖 */
.erp-submit-sample-submit {
    padding: 8px 18px !important;
    background: #2563eb !important;
    border: 1px solid #2563eb !important;
    color: #fff !important;
}

.erp-submit-sample-submit:hover {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #fff !important;
}
