/* ============================================================
   地铁轨道云平台 - 全局样式
   ============================================================ */
:root {
  --primary: #1a5cb8;
  --primary-dark: #14478d;
  --primary-light: #e8f0fb;
  --accent: #e60012;
  --text: #1f2d3d;
  --text-light: #6b7a90;
  --border: #dde4ee;
  --bg: #f3f6fb;
  --card: #ffffff;
  --success: #1e9e5a;
  --warning: #d98014;
  --danger: #d63a3a;
  --radius: 10px;
  --sidebar-w: 232px;
  --shadow: 0 2px 10px rgba(20, 55, 110, 0.07);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; border-radius: 6px; border: 1px solid transparent;
  background: var(--primary); color: #fff; cursor: pointer; font-size: 14px;
  transition: opacity .15s;
}
.btn:hover { opacity: .88; }
.btn.block { width: 100%; padding: 11px; font-size: 15px; }
.btn.ghost { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn.ghost:hover { background: var(--primary-light); opacity: 1; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 5px; }
.btn.danger { background: var(--danger); }
.btn.danger.ghost { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.success { background: var(--success); }
.btn.warn { background: var(--warning); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px;
}
.card-title { font-size: 15.5px; font-weight: 600; margin-bottom: 16px; padding-left: 10px; border-left: 4px solid var(--primary); }

.form-item { margin-bottom: 15px; }
.form-item > label { display: block; margin-bottom: 6px; color: var(--text-light); font-size: 13px; }
.form-item > label .req { color: var(--accent); margin-left: 2px; }
input[type=text], input[type=password], input[type=datetime-local], input[type=date],
input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; color: var(--text); background: #fff; outline: none; font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,92,184,.1); }
input[readonly] { background: #f5f7fa; color: var(--text-light); }
textarea { resize: vertical; min-height: 84px; }
.form-row { display: flex; gap: 14px; }
.form-row .form-item { flex: 1; }
.radio-line { display: flex; gap: 22px; align-items: center; height: 38px; }
.radio-line label { display: flex; gap: 6px; align-items: center; cursor: pointer; color: var(--text); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.tbl th { background: #f7f9fd; color: var(--text-light); font-weight: 600; white-space: nowrap; }
.tbl tr:hover td { background: #fafcfe; }
.tbl .ops { display: flex; gap: 6px; flex-wrap: wrap; }
.tbl-empty { text-align: center; color: var(--text-light); padding: 40px 0 !important; }

.badge { display: inline-block; padding: 2.5px 10px; border-radius: 20px; font-size: 12px; }
.badge.blue   { background: var(--primary-light); color: var(--primary); }
.badge.green  { background: #e4f6ec; color: var(--success); }
.badge.orange { background: #fdf1e2; color: var(--warning); }
.badge.red    { background: #fdeaea; color: var(--danger); }
.badge.gray   { background: #eef1f6; color: var(--text-light); }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar select, .toolbar input { width: auto; min-width: 150px; }
.toolbar .spacer { flex: 1; }

/* 模态框 */
.mask { position: fixed; inset: 0; background: rgba(15, 30, 60, .45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: #fff; border-radius: 12px; width: 640px; max-width: 96vw; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.modal.wide { width: 880px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-close { cursor: pointer; font-size: 20px; color: var(--text-light); background: none; border: none; line-height: 1; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* toast */
#toast-box { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 10px 20px; border-radius: 8px; color: #fff; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.18); animation: fadeIn .2s; }
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; } }

/* ============================================================
   登录页 (西安地铁元素)
   ============================================================ */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0d3a78 0%, #14478d 45%, #1a5cb8 100%);
  position: relative; overflow: hidden; padding: 30px 16px;
}
/* 地铁线路装饰 */
.metro-lines { position: absolute; inset: 0; opacity: .35; pointer-events: none; }
.login-wrap { position: relative; z-index: 2; display: flex; gap: 0; width: 980px; max-width: 100%; border-radius: 16px; overflow: hidden; box-shadow: 0 24px 70px rgba(4, 22, 54, .45); }
.login-left {
  flex: 1.15; background: linear-gradient(160deg, rgba(255,255,255,.10), rgba(255,255,255,.03));
  backdrop-filter: blur(2px); color: #fff; padding: 40px 36px; display: flex; flex-direction: column;
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.login-brand img { width: 52px; height: 52px; }
.login-brand .t1 { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.login-brand .t2 { font-size: 12px; opacity: .75; margin-top: 3px; letter-spacing: 3px; }
.login-slogan { font-size: 13px; opacity: .8; margin-bottom: 26px; }
.notice-panel { flex: 1; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); border-radius: 12px; padding: 18px 20px; overflow: hidden; display: flex; flex-direction: column; }
.notice-panel h4 { font-size: 15px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.notice-panel h4::before { content: ""; width: 4px; height: 16px; background: #ffd100; border-radius: 2px; display: inline-block; }
.notice-list { overflow-y: auto; flex: 1; margin-top: 10px; }
.notice-item { padding: 10px 0; border-bottom: 1px dashed rgba(255,255,255,.18); cursor: pointer; }
.notice-item .nt { font-size: 13.5px; font-weight: 600; }
.notice-item .nd { font-size: 12px; opacity: .65; margin-top: 4px; }
.notice-empty { color: rgba(255,255,255,.6); font-size: 13px; padding: 20px 0; text-align: center; }
.login-right { flex: 1; background: #fff; padding: 46px 44px; display: flex; flex-direction: column; justify-content: center; }
.login-right h2 { font-size: 21px; margin-bottom: 4px; }
.login-right .sub { color: var(--text-light); font-size: 13px; margin-bottom: 26px; }
.login-right .form-item input, .login-right .form-item select { padding: 11px 13px; }
.login-links { display: flex; justify-content: space-between; margin: 4px 0 18px; font-size: 13px; }
.login-links a { cursor: pointer; }
.login-tip { margin-top: 18px; font-size: 12.5px; color: var(--text-light); text-align: center; }

/* ============================================================
   应用主框架
   ============================================================ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: linear-gradient(180deg, #123f7c, #0d3568);
  color: #cdd9ee; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-brand img { width: 38px; height: 38px; flex-shrink: 0; }
.side-brand .name { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.35; word-break: break-all; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-user .avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #fff; flex-shrink: 0; }
.side-user .un { color: #fff; font-size: 14px; font-weight: 600; }
.side-user .ud { font-size: 12px; opacity: .7; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.nav { flex: 1; padding: 10px 0; }
.nav-group { padding: 8px 0; }
.nav-group-title { font-size: 11.5px; opacity: .5; padding: 6px 18px 4px; letter-spacing: 1px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10.5px 18px; color: #cdd9ee; font-size: 14px; border-left: 3px solid transparent; }
.nav a .ico { width: 18px; text-align: center; font-style: normal; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: #ffd100; }
.side-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.1); }
.side-foot .btn { width: 100%; background: rgba(255,255,255,.12); }

.main { flex: 1; padding: 24px 28px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.topbar .crumb { color: var(--text-light); font-size: 13px; }
.topbar .crumb b { color: var(--text); }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h2 { font-size: 19px; }

/* 数据看板占位 */
.dev-box {
  min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text-light);
}
.dev-box .gear { font-size: 54px; margin-bottom: 16px; }
.dev-box h3 { color: var(--text); margin-bottom: 8px; font-size: 17px; }
.dev-box p { font-size: 13px; }

/* 流程时间线 */
.flow-steps { display: flex; flex-direction: column; gap: 0; }
.flow-step { display: flex; gap: 14px; }
.flow-step .rail { display: flex; flex-direction: column; align-items: center; }
.flow-step .dot { width: 14px; height: 14px; border-radius: 50%; background: #d5dde9; margin-top: 4px; flex-shrink: 0; }
.flow-step .line { flex: 1; width: 2px; background: #d5dde9; min-height: 26px; }
.flow-step:last-child .line { display: none; }
.flow-step.done .dot { background: var(--success); }
.flow-step.pending .dot { background: var(--warning); box-shadow: 0 0 0 4px rgba(217,128,20,.18); }
.flow-step .fc { flex: 1; padding-bottom: 16px; }
.flow-step .fr { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px; }
.flow-step .fr b { font-size: 14px; }
.flow-step .fm { font-size: 12.5px; color: var(--text-light); margin-top: 3px; }

/* 打印 */
.print-preview { border: 1px dashed var(--border); background: #fff; padding: 10px; max-height: 55vh; overflow: auto; }
.download-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.dl-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; text-align: center; }
.dl-card .ic { width: 66px; height: 66px; border-radius: 16px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; font-size: 30px; color: #fff; }
.dl-card h4 { margin-bottom: 6px; font-size: 15.5px; }
.dl-card p { font-size: 12.5px; color: var(--text-light); margin-bottom: 16px; }
.dl-card img.qr { width: 150px; height: 150px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; }

/* 个人中心 */
.profile-grid { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.avatar-box { text-align: center; }
.avatar-box img { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary-light); background: #f5f7fa; }
.avatar-box .uname { font-size: 17px; font-weight: 600; margin-top: 12px; }
.avatar-box .uacc { color: var(--text-light); font-size: 13px; margin: 4px 0 14px; }
.kv { display: flex; border-bottom: 1px solid var(--border); padding: 11px 0; }
.kv .k { width: 110px; color: var(--text-light); flex-shrink: 0; }
.kv .v { flex: 1; word-break: break-all; }

/* 单位树 */
.unit-tree .node { padding-left: 0; }
.unit-node { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; background: #fff; }
.unit-row { display: flex; align-items: center; gap: 8px; padding: 9px 12px; }
.unit-row .lv { font-size: 11px; color: #fff; background: var(--primary); border-radius: 4px; padding: 1px 7px; }
.unit-row .nm { flex: 1; font-weight: 600; }
.unit-children { padding: 4px 12px 10px 34px; }

/* 分组勾选 */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 10px; }
.check-grid label { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 5px; cursor: pointer; font-size: 13px; }
.check-grid label:hover { background: var(--primary-light); }

/* stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.stat-card .n { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-card .l { color: var(--text-light); font-size: 13px; margin-top: 4px; }

.muted { color: var(--text-light); font-size: 12.5px; }
.mt { margin-top: 14px; }
.flex { display: flex; gap: 10px; align-items: center; }
.hidden { display: none !important; }

/* ---------- 缓存清理页 ---------- */
.cache-opt { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: #fff; }
.cache-opt:hover { border-color: var(--primary); }
.cache-opt input[type="checkbox"] { margin-top: 3px; width: 16px; height: 16px; cursor: pointer; }

/* ============================================================
   移动端 H5 适配 (<=768px)
   ============================================================ */
.mobile-topbar { display: none; }
.side-mask { display: none; }

@media (max-width: 768px) {
  body { -webkit-text-size-adjust: 100%; }

  /* 移动顶栏(替代固定侧边栏) */
  .mobile-topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 60;
    background: linear-gradient(90deg, #123f7c, #0d3568); color: #fff;
    padding: 10px 14px; margin: -12px -14px 14px;
  }
  .menu-btn {
    background: rgba(255,255,255,.15); border: none; color: #fff;
    font-size: 18px; width: 36px; height: 36px; border-radius: 8px;
    cursor: pointer; line-height: 1; flex-shrink: 0; padding: 0;
  }
  .menu-btn:active { background: rgba(255,255,255,.3); }
  .mt-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* 侧边栏改为抽屉 */
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 200;
    width: min(78vw, 300px); height: 100vh;
    transform: translateX(-105%); transition: transform .25s ease;
  }
  body.side-open .sidebar { transform: none; box-shadow: 0 0 46px rgba(0,0,0,.4); }
  body.side-open .side-mask { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 150; }

  /* 主区与卡片 */
  .main { padding: 12px 14px; }
  .card { padding: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .page-head { flex-wrap: wrap; gap: 8px; }
  .page-head h2 { font-size: 17px; }
  .card-title { font-size: 14.5px; }

  /* 表格横向滚动 */
  .tbl { font-size: 12.5px; }
  .tbl th, .tbl td { padding: 8px; }

  /* 表单单列化 */
  .form-row { flex-direction: column; gap: 0; }
  .radio-line { gap: 14px; height: auto; flex-wrap: wrap; }
  .toolbar input, .toolbar select { min-width: 0; flex: 1; }
  .toolbar .btn { flex-shrink: 0; }

  /* 布局栅格降为单/双列 */
  .profile-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .n { font-size: 20px; }
  .download-cards { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }

  /* 登录页: 公告栏收起, 表单铺满 */
  .login-wrap { width: 100%; flex-direction: column; }
  .login-left { display: none; }
  .login-right { padding: 30px 22px; }

  /* 模态框近全屏 */
  .mask { padding: 10px; align-items: flex-end; }
  .modal { width: 100%; max-width: 100vw; max-height: 90vh; border-radius: 12px 12px 0 0; }
  .modal.wide { width: 100%; }
  .modal-body { padding: 14px; }
  .modal-head, .modal-foot { padding: 12px 14px; }

  /* 单位树缩进收窄 */
  .unit-children { padding-left: 16px; }

  /* 个人中心头像区 */
  .avatar-box img { width: 90px; height: 90px; }
}

/* 登录页移动端品牌头(桌面端隐藏) */
.login-mobile-brand { display: none; }
@media (max-width: 768px) {
  .login-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
  .login-mobile-brand img { width: 40px; height: 40px; }
  .login-mobile-brand span { font-size: 18px; font-weight: 700; color: var(--primary-dark); letter-spacing: 1px; }
}
