/* ==========================================================================
   admin-extras.css
   后台增强组件样式（v1.0 · 2026-08-28）
   1) 多图上传缩略图预览 .gallery-preview
   2) Quill 富文本图片：选中框 / 拖拽缩放手柄 / 浮动工具条
   -------------------------------------------------------------------------- */

/* ==================== 1. 多图上传缩略图预览 ==================== */
.gallery-preview {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 8px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
}

.gallery-preview:empty {
    display: none !important;
}

.gp-item {
    position: relative;
    width: 76px;
    height: 76px;
    flex: 0 0 auto;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #eef2f7;
}

.gp-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gp-img.gp-broken {
    opacity: .25;
}

.gp-del {
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
    line-height: 19px;
    text-align: center;
    background: rgba(15, 23, 42, .62);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border-bottom-left-radius: 7px;
    user-select: none;
}

.gp-del:hover {
    background: #ef4444;
}

.gp-idx {
    position: absolute;
    left: 0;
    bottom: 0;
    min-width: 18px;
    padding: 0 4px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    font-size: 11px;
    color: #fff;
    background: rgba(15, 23, 42, .55);
    border-top-right-radius: 6px;
}

/* ==================== 2. Quill 图片缩放工具 ==================== */

/* 编辑器内图片：默认可交互、光标提示 */
.ql-editor img {
    cursor: pointer;
    transition: outline-color .12s ease;
}

.ql-editor img.qz-selected {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
}

/* 浮动工具条（选中图片后出现在图片上方） */
.qz-toolbar {
    position: absolute;
    z-index: 3000;
    display: none;
    align-items: center;
    gap: 4px;
    padding: 5px 7px;
    background: #0f172a;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .28);
    font-size: 12px;
    color: #e2e8f0;
    white-space: nowrap;
    user-select: none;
}

.qz-toolbar.qz-show {
    display: flex;
}

.qz-tb-btn {
    padding: 3px 8px;
    border-radius: 5px;
    cursor: pointer;
    color: #cbd5e1;
    line-height: 18px;
    transition: background .12s ease, color .12s ease;
}

.qz-tb-btn:hover {
    background: #334155;
    color: #fff;
}

.qz-tb-btn.qz-active {
    background: #3b82f6;
    color: #fff;
}

.qz-tb-sep {
    width: 1px;
    height: 16px;
    background: #334155;
    margin: 0 2px;
}

.qz-tb-label {
    color: #94a3b8;
    padding: 0 2px;
}

/* 拖拽手柄：四角 */
.qz-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 2px solid #3b82f6;
    border-radius: 2px;
    z-index: 2999;
    box-sizing: border-box;
}

.qz-handle[data-pos="nw"] { cursor: nwse-resize; }
.qz-handle[data-pos="ne"] { cursor: nesw-resize; }
.qz-handle[data-pos="sw"] { cursor: nesw-resize; }
.qz-handle[data-pos="se"] { cursor: nwse-resize; }

/* 拖拽时的尺寸提示 */
.qz-size-tip {
    position: absolute;
    z-index: 3001;
    display: none;
    padding: 2px 7px;
    background: #0f172a;
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
}

.qz-size-tip.qz-show {
    display: block;
}

/* 提示条：编辑器底部说明 */
.qz-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #94a3b8;
}

.qz-hint b {
    color: #64748b;
}

/* ==========================================================================
   3. 订单模块：分页条贴表格卡底部（ERP 习惯做法）
   问题：订单表只有 1 条记录时，卡片被内容撑得极矮，分页条紧跟着表格行
        浮在页面正中，既不像表尾也不像工具条。
   做法：表格卡改为纵向 flex 并给定最小高度，表格区自动撑开剩余空间，
        分页条被 margin-top:auto 推到卡片底部。记录多时按内容自然增高。
   范围：仅 #module-orders（全站只有订单页用到 .stripe-pagination）。
   -------------------------------------------------------------------------- */
#module-orders .stripe-table-card {
    display: flex;
    flex-direction: column;
    /* 340px ≈ 顶栏 60 + 内容区内边距 24 + 页头 ~78 + 筛选栏 ~136 + 底部留白 24 */
    min-height: max(380px, calc(100vh - 340px));
}

#module-orders .tbl-scroll {
    flex: 1 1 auto;
}

#module-orders .stripe-pagination {
    flex: 0 0 auto;
    margin-top: auto;
}

/* ==========================================================================
   4. 订单详情弹窗（方案 B · 双栏主次式）
   结构：头部关键信息条 → 左栏（封面卡 / 订单信息 / 金额构成 / 备注）
        → 右栏（客户名片 / 状态流转时间轴） → 底部操作条
   颜色一律走主题 token，不硬编码。
   -------------------------------------------------------------------------- */

/* ---- 头部关键信息条 ---- */
.od-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
}

.od-head-l { min-width: 0; }

.od-ono {
    font-size: 12px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    word-break: break-all;
}

.od-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 3px;
}

.od-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2px 9px;
    margin-left: 6px;
    vertical-align: 2px;
}

.od-head-r { text-align: right; }

.od-amt-label {
    font-size: 11px;
    letter-spacing: .08em;
    color: var(--text-muted);
}

.od-amt-big {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.02em;
    line-height: 1.2;
}

.od-head-badges { margin-top: 6px; }

/* ---- 双栏骨架 ---- */
.od-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: start;
    padding: 18px 20px;
}

/* ---- 左栏：封面卡 ---- */
.od-cover-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 16px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.od-cover {
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
    border-radius: 9px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    background: #fff;
}

.od-cover-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-muted);
}

.od-cover-info { min-width: 0; }

.od-cover-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.od-cover-meta {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.od-cover-tags { margin-top: 6px; }

/* ---- 分区 ---- */
.od-sec { margin-bottom: 18px; }
.od-sec:last-child { margin-bottom: 0; }

.od-sec-t {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--text-primary);
    padding-bottom: 7px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* ---- 键值网格 ---- */
.od-dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 16px;
}

.od-dl-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.od-k {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 1px;
}

.od-v {
    font-size: 13.5px;
    color: var(--text-primary);
    word-break: break-all;
}

.od-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.od-empty { color: var(--text-muted); }

/* ---- 金额构成表 ---- */
.od-amt {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.od-amt td { padding: 7px 0; border-bottom: 1px dashed var(--border-color); }
.od-amt tr:last-child td { border-bottom: none; }
.od-amt-k { color: var(--text-secondary); }
.od-amt-v { text-align: right; font-weight: 600; color: var(--text-primary); }
.od-amt-cut { color: var(--success-color); }

.od-amt-total td {
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    border-bottom: none;
    font-size: 15px;
    font-weight: 700;
}

/* ---- 备注 ---- */
.od-remark {
    font-size: 13.5px;
    color: var(--text-secondary);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    white-space: pre-wrap;
}

/* ---- 右栏：客户名片 ---- */
.od-cust {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    background: var(--bg-light);
}

.od-cust-top {
    display: flex;
    align-items: center;
    gap: 11px;
    padding-bottom: 13px;
    margin-bottom: 11px;
    border-bottom: 1px dashed var(--border-color);
}

.od-avatar {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-color);
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.od-cust-idbox { min-width: 0; }

.od-cust-nm {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.od-cust-uid {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.od-cust-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 0;
}

.od-cust-row .od-v { text-align: right; }

.od-bal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 11px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.od-bal-k { font-size: 12px; color: var(--text-secondary); }

.od-bal-v {
    font-size: 17px;
    font-weight: 700;
    color: var(--success-color);
}

/* ---- 右栏：状态流转时间轴 ---- */
.od-tl {
    margin-top: 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 15px;
    background: var(--bg-light);
}

.od-tl-t {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.od-tl-item {
    display: flex;
    gap: 10px;
    position: relative;
    padding-bottom: 13px;
}

.od-tl-item:last-child { padding-bottom: 0; }

.od-tl-item::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 15px;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
}

.od-tl-item:last-child::before { display: none; }

.od-tl-dot {
    width: 11px;
    height: 11px;
    flex: 0 0 auto;
    margin-top: 4px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--border-color);
    position: relative;
    z-index: 1;
}

.od-tl-dot.is-done { background: var(--success-color); border-color: var(--success-color); }
.od-tl-dot.is-now { background: var(--primary-color); border-color: var(--primary-color); }

.od-tl-tt { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.od-tl-dt { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

/* ---- 底部操作条 ---- */
.od-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 13px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
}

.od-foot-grp {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.od-foot-lbl {
    font-size: 11px;
    letter-spacing: .05em;
    color: var(--text-muted);
}

/* 窄屏折叠为单栏，避免右栏被挤扁 */
@media (max-width: 991px) {
    .od-grid { grid-template-columns: minmax(0, 1fr); }
    .od-amt-big { font-size: 21px; }
}
