/* 运营台合同
   宽度：格子保底过宽、芯片当正文折、按钮行靠缩小字号硬撑。
   文字：各页私自写字号/字重/字体栈，设备型号会和列表、详情对不上。
   本文件在 base.html 里晚于页面 extra_css 加载，用来收口共用角色，不给单页打补丁。

   宽度四条：
   1. 格子用 min(100%, N)，永不撑破视口
   2. 芯片 / 按钮是原子：nowrap + 图标不缩 + 过长省略
   3. 工具条以组回流（换行或横滑），不按字符压缩
   4. 宽表横滑，不压列

   文字三条：
   1. 产品名（设备型号）用 sans + 700，不用 mono，不用 800
   2. 编号（工单号 / SN / 电话 / 密码）用 --font-mono
   3. 页面英雄标题可放大，但字族/字重/字距仍走同一套令牌
*/

/* 设备型号：卡片主视觉 / 列表主字段 */
.type-device,
.device-model,
.tile-title,
.wo-module-content.type-device {
    font-family: var(--type-device-family, var(--font-sans));
    font-size: var(--type-device-size, 1rem);
    font-weight: var(--type-device-weight, 700);
    line-height: var(--type-device-leading, 1.35);
    letter-spacing: var(--type-device-tracking, -0.01em);
    color: var(--type-device-color, var(--text-main, #0f172a));
}

/* 详情英雄区：只统一字族/字重/字距，字号留给页面层级 */
.type-device-hero,
.device-name,
.mwo-hero-model,
.ms-focus h1 {
    font-family: var(--type-device-family, var(--font-sans));
    font-weight: var(--type-device-weight, 700);
    letter-spacing: var(--type-device-tracking, -0.01em);
    color: var(--type-device-color, var(--text-main, #0f172a));
}

.type-name,
.customer-name,
.as-customer-name {
    font-family: var(--type-name-family, var(--font-sans));
    font-weight: var(--type-name-weight, 700);
    color: var(--type-name-color, var(--text-main, #0f172a));
}

/* 工作台卡片里客户名是次级信息，只统一字族/字重，颜色留给卡片层级 */
.tile-customer-name {
    font-family: var(--type-name-family, var(--font-sans));
    font-weight: var(--type-name-weight, 700);
}

.type-code,
.order-code,
.tile-order-code,
.as-order-code,
.ms-code,
.device-sn,
.customer-phone {
    font-family: var(--type-code-family, var(--font-mono));
    letter-spacing: var(--type-code-tracking, 0.02em);
    font-variant-numeric: tabular-nums;
}

.type-code,
.order-code,
.tile-order-code,
.as-order-code {
    font-weight: var(--type-code-weight, 700);
}

.ops-page {
    min-width: 0;
}

.ops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
    gap: 1rem;
    min-width: 0;
}

.ops-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    min-width: 0;
    margin: 1.5rem 0 1rem;
}

.ops-toolbar-title {
    margin: 0;
    min-width: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
}

.ops-toolbar-meta {
    color: var(--text-muted, #64748b);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.ops-chip,
.as-engineer-chip,
.as-engineer-empty {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    min-width: 0;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-sm, 8px);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.ops-chip i,
.as-engineer-chip i,
.as-engineer-empty i {
    flex-shrink: 0;
}

.ops-chip-label,
.as-engineer-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ops-chip.tone-danger {
    background: var(--rose-soft, #fff1f2);
    color: var(--rose-ink, #be123c);
}

.ops-chip.tone-warning {
    background: var(--warning-soft, #fffbeb);
    color: var(--warning-ink, #7c2d12);
}

.ops-chip.tone-info {
    background: var(--primary-light, #eff6ff);
    color: var(--primary-hover, #1d4ed8);
}

.ops-chip.tone-muted {
    background: var(--bg-muted, #f1f5f9);
    color: var(--text-muted, #64748b);
}

.ops-chip-stack {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
    max-width: 100%;
    min-width: 0;
}

.ops-card,
.ops-panel {
    min-width: 0;
    background: var(--bg-surface, #fff);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-xs, 0 1px 2px rgba(15, 23, 42, 0.04));
}

.ops-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ops-card-head,
.ops-card-foot {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
}

.ops-card-head {
    padding: 1rem 1.125rem 0.75rem;
}

.ops-card-head-main {
    min-width: 0;
}

.ops-code {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    text-decoration: none;
}

.ops-code:hover {
    color: var(--primary, #2563eb);
}

.ops-code-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ops-sub {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-dim, #94a3b8);
}

.ops-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    min-width: 0;
    padding: 0 1.125rem 0.75rem;
    flex: 1;
}

@media (min-width: 720px) {
    .ops-split.has-media {
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
        align-items: start;
    }
}

.ops-stack {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
}

.ops-label {
    margin: 0 0 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
}

.ops-prose {
    margin: 0;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-md, 12px);
    background: var(--bg-base, #f8fafc);
    color: var(--text-main, #0f172a);
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ops-prose.is-compact {
    -webkit-line-clamp: 3;
}

.ops-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.85rem;
    min-width: 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-soft, #e2e8f0);
    color: var(--text-muted, #64748b);
    font-size: 0.8125rem;
}

.ops-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    max-width: 100%;
}

.ops-meta-item i {
    flex-shrink: 0;
    color: var(--text-dim, #94a3b8);
}

.ops-meta-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ops-card-foot {
    align-items: center;
    padding: 0.75rem 1.125rem;
    background: var(--bg-base, #f8fafc);
    border-top: 1px solid var(--border-soft, #e2e8f0);
}

.ops-id {
    font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
    font-size: 0.75rem;
    color: var(--text-dim, #94a3b8);
    white-space: nowrap;
}

.ops-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    min-width: 0;
}

.ops-actions .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.ops-media {
    min-width: 0;
}

.ops-photo {
    width: 100%;
    max-height: 13.75rem;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: var(--radius-md, 12px);
    background: var(--slate-deep, #1e293b);
}

.ops-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.ops-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.ops-thumbs img,
.ops-thumb-more {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-sm, 8px);
    border: 1px solid var(--border-soft, #e2e8f0);
}

.ops-thumbs img {
    object-fit: cover;
    cursor: pointer;
}

.ops-thumb-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-muted, #f1f5f9);
    color: var(--text-muted, #64748b);
    font-size: 0.75rem;
    font-weight: 700;
}

.ops-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    min-width: 0;
}

@media (min-width: 992px) {
    .ops-chart-grid {
        grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    }
}

.ops-panel {
    padding: 1rem 1.125rem 1.125rem;
}

.ops-panel-title {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
}

.ops-chart {
    width: 100%;
    height: clamp(14rem, 32vw, 18.75rem);
    min-width: 0;
}

.ops-empty {
    grid-column: 1 / -1;
    padding: 2.5rem 1.25rem;
    text-align: center;
    color: var(--text-muted, #64748b);
}

.ops-empty h2 {
    margin: 0.5rem 0 0.35rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
}

.ops-empty p {
    margin: 0;
    font-size: 0.875rem;
}

.ops-empty i {
    font-size: 1.75rem;
    color: var(--text-dim, #94a3b8);
}

.ops-table-wrap,
.as-table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.ops-table-wrap .table-responsive,
.as-table-wrap .table-responsive {
    overflow: visible;
}

.ops-table,
.as-table {
    min-width: var(--ops-table-min, 68rem);
}

.ops-col-lock,
.as-col-status,
.as-col-engineer,
.as-col-time,
.as-col-actions {
    white-space: nowrap;
}

.as-col-status { width: 6.5rem; }
.as-col-engineer { width: 8.75rem; }
.as-col-time { width: 8.5rem; }
.as-col-actions { width: 7.5rem; }

.as-engineer-chip {
    max-width: 8.75rem;
    background: var(--bg-muted, #f1f5f9);
    color: var(--text-main, #0f172a);
}

.as-engineer-empty {
    padding: 0;
    color: var(--text-muted, #64748b);
}

/* 页头操作：贴标题行右侧，不参与抢宽度；窄屏整组落到下一行仍靠右 */
header.page-head .page-head-actions {
    container-type: normal;
    flex: 0 0 auto;
    align-self: flex-start;
    margin-left: auto;
    justify-content: flex-end;
    flex-wrap: wrap !important;
    overflow: visible;
}

header.page-head .page-head-actions > a.btn,
header.page-head .page-head-actions > .btn {
    flex: 0 0 auto !important;
    min-width: max-content !important;
    max-width: none !important;
    font-size: 0.8125rem !important;
}

@media (max-width: 576px) {
    header.page-head .page-head-actions {
        flex-basis: 100%;
        margin-left: 0;
    }

    header.page-head .page-head-actions > a.btn,
    header.page-head .page-head-actions > .btn {
        flex: 1 1 auto !important;
        justify-content: center;
    }
}

.ops-grid > .gx-card-enter:nth-child(2) { animation-delay: 40ms; }
.ops-grid > .gx-card-enter:nth-child(3) { animation-delay: 80ms; }
.ops-grid > .gx-card-enter:nth-child(4) { animation-delay: 120ms; }
.ops-grid > .gx-card-enter:nth-child(n + 5) { animation-delay: 160ms; }

.ops-preview-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-sm, 8px);
}
