/* =========================================================
   天然气流量计管理系统 V3 · 样式
   统一设计语言：深蓝主色 #1e3a5f / 金色点缀 / 浅灰背景
   ========================================================= */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif; color: #1f2d3d; background: #f3f6fa; -webkit-font-smoothing: antialiased; }
body { font-size: 14px; line-height: 1.5; }
.hidden { display: none !important; }

a { color: #1e3a5f; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ========== 登录页 ========== */
.login-page {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 48px 20px;
  background:
    radial-gradient(820px 520px at 16% 6%, rgba(86,138,186,.55), transparent 62%),
    radial-gradient(680px 460px at 88% 96%, rgba(255,207,63,.16), transparent 65%),
    linear-gradient(155deg, #0e2140 0%, #1e3a5f 55%, #2b5080 100%);
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ""; position: absolute; inset: -20%;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(600px) rotateX(58deg) translateY(18%);
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 72%);
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 72%);
  pointer-events: none;
}
.login-card {
  position: relative; z-index: 1;
  width: 404px; max-width: 100%;
  padding: 38px 36px 28px;
  background: #fff; border-radius: 20px;
  box-shadow: 0 32px 70px rgba(3,14,30,.45), 0 3px 10px rgba(3,14,30,.2);
  text-align: center;
}
.login-brand { margin-bottom: 28px; }
.login-mark { width: 66px; height: 66px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center;
  border-radius: 18px; background: linear-gradient(145deg, #31598a, #1b3a5f);
  box-shadow: inset 0 0 0 1px rgba(255,207,63,.35), inset 0 1px 0 rgba(255,255,255,.25), 0 12px 24px rgba(23,48,79,.3); }
.login-title-cn { margin: 0 0 7px; font-size: 22px; font-weight: 700; letter-spacing: 1.5px; color: #16294a; }
.login-title-en { font-size: 10px; font-weight: 600; letter-spacing: 2.2px; color: #9aa9bd; }
.login-field { margin-bottom: 15px; text-align: center; }
.login-field > span { display: block; margin-bottom: 7px; font-size: 12.5px; font-weight: 600; letter-spacing: .5px; color: #5c6f86; }
.login-field input { width: 100%; height: 44px; padding: 0 14px; font-size: 14px; text-align: center; color: #1f2d3d;
  border: 1px solid #dde5ef; border-radius: 10px; background: #f7f9fc; transition: all .18s; }
.login-field input::placeholder { color: #a9b6c7; letter-spacing: .5px; }
.login-field input:focus { outline: none; border-color: #2b5080; background: #fff; box-shadow: 0 0 0 3px rgba(43,80,128,.14); }
.cap-row { display: flex; gap: 10px; align-items: center; }
.cap-row input { flex: 1; min-width: 0; }
.cap-row img { width: 120px; height: 44px; border-radius: 10px; border: 1px solid #dde5ef; background: #fff; cursor: pointer; }
.login-card .login-submit { height: 46px; margin-top: 8px; padding: 0; font-size: 15px; letter-spacing: 6px; text-indent: 6px;
  border-radius: 10px; background: linear-gradient(135deg, #24466e, #162d4b);
  box-shadow: 0 10px 20px rgba(30,58,95,.28); transition: all .18s; }
.login-card .login-submit:hover { background: linear-gradient(135deg, #2b5080, #1a3557);
  transform: translateY(-1px); box-shadow: 0 14px 24px rgba(30,58,95,.32); }
.login-card .login-submit:active { transform: translateY(0); }
.login-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid #eef2f8; font-size: 12px; color: #93a3b8; letter-spacing: .3px; text-align: center; line-height: 1.9; }
.login-foot-dev { color: #6f8299; font-weight: 500; letter-spacing: .5px; }
.login-foot-tel { color: #93a3b8; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.login-copy { position: relative; z-index: 1; font-size: 12px; color: rgba(255,255,255,.55); letter-spacing: 1px; }
@media (max-width: 480px) { .login-card { padding: 30px 22px 24px; } .login-title-cn { font-size: 19px; } }

/* ========== 按钮 ========== */
.btn-primary, .btn-default, .btn-danger, .btn-link { border: none; border-radius: 8px; padding: 9px 18px; font-size: 14px; transition: all .18s; }
.btn-primary { background: #1e3a5f; color: #fff; font-weight: 500; }
.btn-primary:hover { background: #162d4b; }
.btn-primary:disabled { background: #9db0c6; cursor: not-allowed; }
.btn-default { background: #f1f5fb; color: #1e3a5f; border: 1px solid #dbe3ee; }
.btn-default:hover { background: #e5ecf6; }
.btn-danger { background: #d6383a; color: #fff; }
.btn-danger:hover { background: #b32a2c; }
.btn-link { background: transparent; border: none; color: #1e3a5f; padding: 6px 10px; font-size: 13px; }
.btn-link:hover { background: #eef2f8; border-radius: 6px; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; letter-spacing: 4px; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

/* ========== 主布局 ========== */
#app { display: flex; height: 100%; }
.sidebar { width: 228px; background: #162d4b; color: #c9d6e8; display: flex; flex-direction: column; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 22px 22px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-cn { color: #fff; font-weight: 600; font-size: 15px; }
.brand-en { color: #7f92ad; font-size: 10px; letter-spacing: 1px; margin-top: 2px; }
#nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin: 2px 0; border-radius: 8px; cursor: pointer; font-size: 14px; color: #c9d6e8; transition: all .18s; user-select: none; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(255,207,63,.15), rgba(255,255,255,.04)); color: #ffcf3f; }
.nav-item .ni-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-item .ni-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-badge { margin-left: auto; background: #d6383a; color: #fff; font-size: 10px; padding: 1px 7px; border-radius: 9px; }

.sb-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #7f92ad; }
.sb-logout { padding: 4px 8px; margin-top: 8px; color: #7f92ad; }
.sb-logout:hover { color: #ffcf3f; background: rgba(255,255,255,.05); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: #fff; border-bottom: 1px solid #e6edf5; }
.crumb { font-size: 14px; color: #5c6f86; }
.crumb b { color: #1e3a5f; font-weight: 600; }
.top-right { display: flex; gap: 8px; align-items: center; }
.page { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ========== 通用卡片 / 网格 ========== */
.card { background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(30,58,95,.06); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 15px; color: #1e3a5f; }

.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
/* 网格子项允许收缩，避免内部表格把列撑破导致右侧溢出 */
.grid2 > *, .grid3 > *, .grid4 > * { min-width: 0; }
@media (max-width: 1100px) { .grid4 { grid-template-columns: repeat(2,1fr); } .grid3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 1320px) { .grid2 { grid-template-columns: 1fr; } }

/* ========== KPI 卡片 ========== */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kpi { background: linear-gradient(135deg, #fff 0%, #f8fbff 100%); border: 1px solid #e6edf5; border-radius: 10px; padding: 16px; position: relative; overflow: hidden; }
.kpi .k-label { color: #5c6f86; font-size: 13px; }
.kpi .k-value { font-size: 28px; font-weight: 600; color: #1e3a5f; margin-top: 6px; letter-spacing: 1px; }
.kpi .k-sub { font-size: 12px; color: #8a9bb3; margin-top: 4px; }
.kpi .k-tag { position: absolute; top: 12px; right: 12px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.kpi.k-danger .k-value { color: #d6383a; }
.kpi.k-danger .k-tag { background: #fdecea; color: #d6383a; }
.kpi.k-warn .k-value { color: #e09200; }
.kpi.k-warn .k-tag { background: #fff4dc; color: #c87a00; }
.kpi.k-ok .k-value { color: #2a8a5a; }
.kpi.k-ok .k-tag { background: #e6f4ec; color: #2a8a5a; }
.kpi.k-gold .k-tag { background: #fff4dc; color: #a97c00; }

/* ========== 表格 ========== */
.table-wrap { overflow: auto; max-height: 70vh; border-radius: 8px; border: 1px solid #e6edf5; }
table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
thead th { background: #f1f5fb; color: #1e3a5f; font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 1px solid #dbe3ee; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
tbody td { padding: 9px 12px; border-bottom: 1px solid #eef2f8; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
tbody tr:hover { background: #f7faff; }
tbody tr:last-child td { border-bottom: none; }
td.t-center, th.t-center { text-align: center; }
td.t-right, th.t-right { text-align: right; }

.tag { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.tag-total { background: #e6ecf5; color: #1e3a5f; }
.tag-ok { background: #e6f4ec; color: #2a8a5a; }
.tag-warn { background: #fff4dc; color: #c87a00; }
.tag-danger { background: #fdecea; color: #d6383a; }
.tag-info { background: #e6f0fa; color: #23599a; }
.tag-muted { background: #eef2f8; color: #6a7a90; }
.tag-gold { background: #fff4dc; color: #a97c00; }
.tag-active { background: #e6f4ec; color: #2a8a5a; }
.tag-stopped { background: #fdecea; color: #d6383a; }
.tag-standby { background: #e6ecf5; color: #1e3a5f; }

/* ========== 搜索 / 筛选栏 ========== */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { height: 34px; padding: 0 10px; border: 1px solid #dbe3ee; border-radius: 6px; background: #fff; min-width: 140px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: #1e3a5f; box-shadow: 0 0 0 2px rgba(30,58,95,.12); }
.toolbar input[type=search] { min-width: 220px; }
.toolbar .spacer { flex: 1; }
.toolbar .count { color: #5c6f86; font-size: 12px; margin-right: 4px; }

/* ========== 分页 ========== */
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 12px; font-size: 13px; color: #5c6f86; }
.pager button { padding: 4px 10px; border: 1px solid #dbe3ee; background: #fff; border-radius: 4px; color: #1e3a5f; }
.pager button:hover:not(:disabled) { background: #eef2f8; }
.pager button[disabled] { color: #b6c3d3; cursor: not-allowed; }
.pager .active { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }

/* ========== 弹窗 ========== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
/* 遮罩不使用 backdrop-filter：整屏模糊会在弹窗内滚动时每帧重算，导致明显掉帧（实测 50fps → 61fps） */
.modal-mask { position: absolute; inset: 0; background: rgba(10, 20, 40, .52); }
.modal-dialog { position: relative; background: #fff; border-radius: 12px; width: 640px; max-width: calc(100vw - 32px); max-height: calc(100vh - 64px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal-dialog.small { width: 460px; }
.modal-dialog.wide { width: 900px; }
.modal-head { padding: 16px 22px; border-bottom: 1px solid #eef2f8; display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 16px; color: #1e3a5f; font-weight: 600; }
.modal-close { border: none; background: transparent; font-size: 22px; color: #8a9bb3; line-height: 1; padding: 0 6px; }
.modal-close:hover { color: #1e3a5f; }
.modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 22px; border-top: 1px solid #eef2f8; display: flex; justify-content: flex-end; gap: 10px; }

/* ========== 表单 ========== */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; color: #5c6f86; font-size: 12px; margin-bottom: 5px; font-weight: 500; }
.form-row input, .form-row select, .form-row textarea { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #dbe3ee; border-radius: 6px; background: #fafbfd; transition: all .18s; }
.form-row textarea { height: 72px; padding: 8px 10px; resize: vertical; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: #1e3a5f; background: #fff; box-shadow: 0 0 0 2px rgba(30,58,95,.12); }
.form-row input[readonly] { background: #f1f5fb; color: #5c6f86; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.form-tip { font-size: 12px; color: #8a9bb3; margin-top: 4px; }
.form-tip.err { color: #d6383a; }
.form-tip.ok { color: #2a8a5a; }
.group-title { font-size: 13px; font-weight: 600; color: #1e3a5f; margin: 18px 0 10px; padding-left: 8px; border-left: 3px solid #ffcf3f; }
.sep { margin: 20px 0 12px; padding-top: 12px; border-top: 1px solid #eef2f8; font-size: 13px; color: #1e3a5f; font-weight: 600; }
.warn-tip { padding: 12px 14px; background: #fff4dc; color: #c87a00; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }

/* ========== 通知 ========== */
.toast { position: fixed; top: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast-item { padding: 10px 16px; background: #fff; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); border-left: 4px solid #1e3a5f; min-width: 240px; animation: toast-in .2s; font-size: 13px; }
.toast-item.success { border-left-color: #2a8a5a; }
.toast-item.error { border-left-color: #d6383a; }
.toast-item.warn { border-left-color: #e09200; }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ========== 看板图表容器 ========== */
.chart-box { height: 250px; width: 100%; }
.chart-box.tall { height: 250px; }

/* ========== 预警列表 ========== */
.warn-list { max-height: 260px; overflow-y: auto; }
.warn-item { padding: 10px 12px; border-radius: 6px; margin-bottom: 8px; border-left: 3px solid; font-size: 13px; line-height: 1.5; }
.warn-item.danger { background: #fdecea; border-left-color: #d6383a; }
.warn-item.warning { background: #fff4dc; border-left-color: #e09200; }
.warn-item .wi-head { display: flex; justify-content: space-between; font-weight: 600; }
.warn-item .wi-msg { color: #5c6f86; font-size: 12px; margin-top: 3px; }

/* ========== 抄表人员：场站卡片 ========== */
.station-card { background: #fff; border-radius: 10px; padding: 18px; border: 1px solid #e6edf5; display: flex; flex-direction: column; gap: 12px; }
.station-card h4 { margin: 0; font-size: 15px; color: #1e3a5f; }
.station-card .sc-line { font-size: 12px; color: #5c6f86; }

.reading-table input { width: 100px; height: 30px; padding: 0 8px; border: 1px solid #dbe3ee; border-radius: 4px; text-align: right; }
.reading-table th, .reading-table td { padding: 9px 8px; }
.reading-table input:focus { outline: none; border-color: #1e3a5f; }

/* ========== 权限隔离提示 ========== */
.restricted { padding: 48px 24px; text-align: center; color: #8a9bb3; }
.restricted svg { margin-bottom: 16px; }

/* ========== 工具 ========== */
.text-muted { color: #8a9bb3; }
.text-center { text-align: center; }
.text-danger { color: #d6383a; }
.text-warn { color: #c87a00; }
.text-ok { color: #2a8a5a; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.spinner { width: 18px; height: 18px; border: 2px solid #dbe3ee; border-top-color: #1e3a5f; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 48px 24px; text-align: center; color: #a5b4c8; font-size: 13px; }

/* 小屏折叠侧栏 */
@media (max-width: 900px) {
  .sidebar { width: 56px; }
  .brand-cn, .brand-en, .nav-item span:not(.ni-icon), .sb-foot > div { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
}
