/* ===== 设计体系：完全照搬「工程工单（Gongdan）」管理端（用户 2026-11-17 指定）=====
   令牌 / 框架 / 组件样式与 Gongdan.Server/wwwroot/css/app.css 保持一致 */
:root {
    --gd-primary: #1B5BD7;
    --gd-primary-deep: #0F3FA8;
    --gd-primary-light: #2E6BE6;
    --gd-bg: #F5F7FA;
    --gd-card: #FFFFFF;
    --gd-text: #1F2329;
    --gd-text-sub: #5F6470;
    --gd-border: #E5E8EF;
    --gd-green: #00B42A;
    --gd-orange: #FF7D00;
    --gd-red: #F53F3F;
    --gd-gray: #86909C;
    --gd-soft: #EEF2F7;
    --gd-sh: 0 2px 10px rgba(15, 63, 168, .06);
    --gd-shh: 0 8px 24px rgba(15, 63, 168, .14);
    --gd-r: 12px;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
    font-family: "Source Han Sans SC", "思源黑体", "Microsoft YaHei", -apple-system, sans-serif;
    font-size: 14px;
    color: var(--gd-text);
    background: var(--gd-bg);
}

a { color: var(--gd-primary); text-decoration: none; }
a:hover { color: var(--gd-primary-light); }

button, input, select, textarea { font: inherit; }

/* ===== 管理端框架：左深色侧栏 + 右主区 ===== */
.app { display: flex; height: 100vh; }

.side {
    width: 212px;
    background: linear-gradient(180deg, var(--gd-primary-deep), #0A2C73 70%, #082252);
    color: #C9D6F2;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width .25s ease;
}

.logo { padding: 22px 20px 16px; display: flex; align-items: center; gap: 10px; cursor: default; user-select: none; }
.logo .mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, var(--gd-primary-light), #5B8DEF);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; font-size: 16px;
    box-shadow: 0 4px 10px rgba(46, 107, 230, .4);
}
.logo b { color: #fff; font-size: 16px; }
.logo small { display: block; font-size: 11px; color: #8FA6D8; margin-top: 2px; }
.logo > div:last-child { white-space: nowrap; }

.nav { flex: 1; padding: 6px 12px; overflow-y: auto; }
.nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: 9px;
    color: #C9D6F2; font-size: 14px; margin-bottom: 2px;
    transition: all .18s; cursor: pointer;
    position: relative; flex-wrap: nowrap;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; transform: translateX(3px); }
.nav a.on { background: linear-gradient(90deg, var(--gd-primary-light), rgba(46, 107, 230, .25)); color: #fff; box-shadow: 0 4px 12px rgba(46, 107, 230, .35); }
.nav a span, .nav .gt > span { white-space: nowrap; }
.nav a i, .nav .gt i { font-style: normal; flex-shrink: 0; width: 20px; text-align: center; display: inline-block; }

/* 2 级导航：可折叠分组 */
.nav .grp2 .gt {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: 9px;
    color: #C9D6F2; font-size: 14px; margin-top: 6px;
    cursor: pointer; transition: all .18s; user-select: none;
}
.nav .grp2 .gt:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav .grp2 .gt .ar { margin-left: auto; font-size: 10px; color: #7E95C9; transition: transform .22s; }
.nav .grp2.open .gt .ar { transform: rotate(180deg); }
.nav .grp2 .sub-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.nav .grp2.open .sub-wrap { grid-template-rows: 1fr; }
.nav .grp2 .sub-wrap > div { overflow: hidden; }
.nav a.sub { padding-left: 40px; position: relative; }
.nav a.sub::before {
    content: ""; position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
    width: 5px; height: 5px; border-radius: 50%; background: #5F7BBF; transition: all .18s;
}
.nav a.sub:hover::before { background: #fff; }
.nav a.sub.on::before { background: #fff; box-shadow: 0 0 6px rgba(255, 255, 255, .8); }

/* 侧栏整体折叠（收成窄条只留图标） */
.side.mini { width: 64px; }
.side.mini .logo { flex-direction: column; gap: 6px; padding: 18px 0 12px; }
.side.mini .logo > div:last-child { display: none; }
.side.mini .nav a { justify-content: center; padding: 10px 0; }
.side.mini .nav a > span { display: none; }
.side.mini .nav a.sub { padding-left: 0; }
.side.mini .nav a.sub::before { display: none; }
.side.mini .nav .gt { justify-content: center; padding: 10px 0; }
.side.mini .nav .gt > span, .side.mini .nav .gt .ar { display: none; }
.side.mini .nav .sub-wrap { display: none; }

.side .ft {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 20px; font-size: 11px; color: #6E84BB;
    border-top: 1px solid rgba(255, 255, 255, .08);
}
.side .ft > span { flex: 1; white-space: nowrap; }
.side.mini .ft { justify-content: center; }
.side.mini .ft > span { display: none; }
.mini-btn {
    width: 26px; height: 26px; border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08);
    color: #C9D6F2; cursor: pointer; font-size: 13px; flex-shrink: 0; transition: all .18s;
}
.mini-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }

/* 主区：顶栏 + 内容滚动区 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.top {
    height: 58px; background: var(--gd-card); border-bottom: 1px solid #E8ECF2;
    display: flex; align-items: center; padding: 0 24px; gap: 16px; flex-shrink: 0; flex-wrap: nowrap;
}
.top h1 { font-size: 18px; font-weight: 600; white-space: nowrap; flex-shrink: 0; margin: 0; }
.top .crumb { color: var(--gd-gray); font-size: 12.5px; flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-spacer { flex: 1; }
.ph2-note {
    background: #E8F1FF; border: 1px solid #BFD6FA; color: #0F3FA8;
    font-size: 11.5px; border-radius: 8px; padding: 4px 10px; white-space: nowrap; flex-shrink: 0;
}

.body { flex: 1; overflow-y: auto; overflow-x: auto; padding: 20px 24px; min-width: 0; overscroll-behavior: contain; }

/* ===== 通用组件 ===== */
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .card { flex: 1; min-width: 280px; }
.card { background: var(--gd-card); border-radius: var(--gd-r); box-shadow: var(--gd-sh); padding: 18px 20px; transition: box-shadow .25s, transform .25s; }
.card:hover { box-shadow: var(--gd-shh); }
.card h3 { font-size: 16px; font-weight: 500; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h3 .more { margin-left: auto; font-size: 12.5px; color: var(--gd-primary); cursor: pointer; font-weight: 400; }
.card p { margin: 0 0 8px; line-height: 1.9; color: var(--gd-text-sub); }
.card p:last-child { margin-bottom: 0; }
.card .tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.card .tags:last-child { margin-bottom: 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }

.stat { position: relative; overflow: hidden; padding: 20px; color: #fff; border-radius: var(--gd-r); cursor: pointer; transition: transform .25s, box-shadow .25s; box-shadow: var(--gd-sh); }
.stat:hover { transform: translateY(-4px); box-shadow: var(--gd-shh); }
.stat:nth-child(1) { background: linear-gradient(135deg, #1B5BD7, #4E86F0); }
.stat:nth-child(2) { background: linear-gradient(135deg, #0F9D8F, #2EC4B6); }
.stat:nth-child(3) { background: linear-gradient(135deg, #7C4DFF, #A17FFF); }
.stat:nth-child(4) { background: linear-gradient(135deg, #F76707, #FFA94D); }
.stat .n { font-size: 30px; font-weight: 700; }
.stat .l { opacity: .88; font-size: 13px; margin-top: 4px; }
.stat .ic { position: absolute; right: 14px; top: 14px; font-size: 34px; opacity: .22; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.t-ok { background: #E8F8EE; color: var(--gd-green); }
.t-warn { background: #FFF3E6; color: var(--gd-orange); }
.t-err { background: #FEECEB; color: var(--gd-red); }
.t-info { background: #E8F1FF; color: var(--gd-primary); }
.t-gray { background: var(--gd-soft); color: var(--gd-gray); }

.bar { height: 7px; border-radius: 4px; background: var(--gd-soft); overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--gd-primary), #5B8DEF); }

.mini-ava {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--gd-primary); color: #fff; font-size: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; flex-shrink: 0;
}

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; border: none;
    font-size: 13.5px; cursor: pointer; font-family: inherit;
    transition: all .18s; font-weight: 500;
}
.btn-p { background: linear-gradient(135deg, var(--gd-primary), var(--gd-primary-light)); color: #fff; box-shadow: 0 4px 10px rgba(27, 91, 215, .3); }
.btn-p:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(27, 91, 215, .42); }
.btn-g { background: var(--gd-soft); color: var(--gd-text-sub); }
.btn-g:hover { background: #E2E9F3; }
.btn-err { background: linear-gradient(135deg, #F53F3F, #FF6B6B); color: #fff; box-shadow: 0 4px 10px rgba(245, 63, 63, .3); }
.btn-err:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(245, 63, 63, .42); }

.lnk { color: var(--gd-primary); cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.lnk:hover { text-decoration: underline; }
.lnk.d { color: var(--gd-red); }

.muted { color: var(--gd-text-sub); }
.small { font-size: 12.5px; }
.mt16 { margin-top: 16px; }

/* ===== 输入框 / 顶栏搜索 ===== */
.inp {
    border: 1px solid #DDE3EC; border-radius: 8px; padding: 9px 12px;
    font-size: 13.5px; background: #fff; outline: none;
    color: var(--gd-text); transition: all .18s; font-family: inherit;
}
.inp:focus { border-color: var(--gd-primary); box-shadow: 0 0 0 3px rgba(27, 91, 215, .12); }
.top-search { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.top-inp { width: 280px; padding: 8px 12px; }

/* ===== 页签（分段控件，同工程工单登录页样式语言）===== */
.sn-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs {
    display: inline-flex; gap: 4px; padding: 4px;
    background: #F2F5FA; border-radius: 10px;
}
.tab {
    border: none; background: transparent; padding: 7px 18px; border-radius: 8px;
    color: var(--gd-text-sub); cursor: pointer; font-size: 13.5px;
    font-family: inherit; transition: all .18s;
}
.tab:hover { color: var(--gd-primary); }
.tab.on { background: #fff; color: var(--gd-primary); font-weight: 600; box-shadow: var(--gd-sh); }

/* ===== 键值表 / 记录选择 / 图例 / 曲线 ===== */
table.kv th { width: 150px; font-weight: 500; white-space: nowrap; vertical-align: top; }
.src-note { margin-left: auto; font-size: 12px; color: var(--gd-gray); font-weight: 400; }
.card h4 { font-size: 13.5px; font-weight: 600; color: var(--gd-text-sub); margin: 16px 0 8px; }

.picks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }.pick {
    border: 1px solid #DDE3EC; background: #fff; border-radius: 20px;
    padding: 5px 14px; font-size: 12.5px; cursor: pointer;
    color: var(--gd-text-sub); font-family: inherit; transition: all .18s;
}
.pick:hover { border-color: var(--gd-primary); color: var(--gd-primary); }
.pick.on { background: #F0F5FF; border-color: var(--gd-primary); color: var(--gd-primary); font-weight: 600; }

.lg { display: flex; gap: 16px; font-size: 12px; color: var(--gd-text-sub); margin: 10px 0 6px; flex-wrap: wrap; }
.lg i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.chart { width: 100%; height: 220px; background: #FAFBFE; border: 1px solid #EEF1F5; border-radius: 8px; }
.chart.tall { height: 300px; }

/* ===== 阶段一/阶段二多卡片布局（左右 45:65，左列上下 82:18）===== */
.stage1-grid,
.stage2-grid {
    display: grid;
    grid-template-columns: 39.5fr 70.5fr; /* 用户指令：分栏左移总宽 5%（原 45:65） */
    grid-template-rows: 82fr 18fr;
    gap: 16px;
    height: calc(100vh - 185px);
    min-height: 640px;
}
.s1-comp { grid-area: 1 / 1; overflow: auto; }
.s1-unlinked { grid-area: 2 / 1; }
.s1-pressure { grid-area: 1 / 2 / 3 / 3; display: flex; flex-direction: column; overflow: hidden; }
.h3-tags { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.s2-safety { grid-area: 1 / 1; overflow: auto; }
.s2-synth { grid-area: 2 / 1; }
.s2-online { grid-area: 1 / 2 / 3 / 3; overflow: auto; }
.card.tight { padding: 12px 16px; }
.card.tight h3 { font-size: 14px; margin-bottom: 8px; }
.unlinked-list.compact { gap: 6px; }
.unlinked-list.compact .unlinked-row { font-size: 13px; }

/* 明细页：单行统计卡 + 日期导航 + 左右两组 */
.day-stat { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.day-stat-label { font-size: 14px; color: var(--gd-text-sub); }
.day-stat-num { font-size: 26px; font-weight: 700; color: var(--gd-primary); line-height: 1; }
.day-stat-unit { color: var(--gd-gray); font-size: 13px; }
.day-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.day-nav .btn { padding: 4px 10px; font-size: 12.5px; }
.day-inp { padding: 4px 8px; font-size: 12.5px; width: 140px; }
.details-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }

@media (max-width: 1250px) {
    .details-grid { grid-template-columns: 1fr; }
}

/* 吸附表头滚动明细表 */
.tbl-scroll { max-height: 260px; overflow-y: auto; border: 1px solid #EEF1F5; border-radius: 8px; }
.tbl-scroll table { margin: 0; }
.tbl-scroll th { position: sticky; top: 0; background: #F7F9FC; z-index: 1; }
table.dense { font-size: 12.5px; }
table.dense th, table.dense td { padding: 6px 10px; white-space: nowrap; }

/* 保压卡：图形区 + 右侧统计（占卡宽 20%，简写）；数据明细三组横向递进、撑满卡底 */
.ps-flex { display: flex; gap: 12px; align-items: stretch; }
.ps-flex .chart { flex: 1; min-width: 0; }
.ps-stats { flex: 0 0 20%; min-width: 0; }
.ps-stats h4 { margin: 0 0 6px; font-size: 12.5px; }
.ps-stats table + h4 { margin-top: 10px; }
.ps-stats table.dense th, .ps-stats table.dense td { padding: 5px 6px; }
.ps-stats table.dense td:first-child { color: var(--gd-gray); }
.ps-data {
    flex: 1;
    min-height: 160px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.ps-data table { margin: 0; }
.ps-data th { position: sticky; top: 0; background: #F7F9FC; z-index: 1; }
.ps-data table.dense th, .ps-data table.dense td { padding: 5px 6px; font-size: 12px; }

@media (max-width: 1250px) {
    .stage1-grid, .stage2-grid { display: flex; flex-direction: column; height: auto; min-height: 0; }
    .s1-comp, .s2-safety { overflow: visible; }
    .s1-pressure, .s2-online { overflow: visible; }
    .ps-data { grid-template-columns: 1fr; }
}

/* ===== 未接入区块 / 提示条 ===== */
.unlinked-list { display: flex; flex-direction: column; gap: 10px; }
.unlinked-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13.5px; }
.unlinked-row b { min-width: 5em; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; line-height: 1.7; }
.alert-err { background: #FEECEB; color: var(--gd-red); }
.alert-info { background: var(--gd-soft); color: var(--gd-text-sub); }

.tags.col { flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 10px; }

.empty { text-align: center; color: var(--gd-gray); font-size: 12.5px; padding: 26px 0; line-height: 2; }
.empty span { font-size: 11.5px; color: #B0B8C7; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--gd-gray); font-weight: 500; font-size: 12.5px; padding: 9px 12px; border-bottom: 1px solid #EEF1F5; }
td { padding: 11px 12px; border-bottom: 1px solid #F3F5F8; vertical-align: middle; }
tbody tr:hover { background: #F7FAFF; }

/* ===== Blazor 框架错误条 ===== */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    display: none;
    left: 0;
    padding: 0.6rem 3rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "发生未处理错误。";
    }

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #b91c1c; }

/* ===== 响应式 ===== */
@media (max-width: 1250px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .top .crumb { display: none; }
    .body { padding: 14px; }
    .stats { grid-template-columns: 1fr; }
}
