/* ===================== 通信施工管理系统 · 全局样式 ===================== */
:root {
  --brand: #0b4f9e;
  --brand-2: #1673d1;
  --brand-3: #e8f2fd;
  --ink: #1b2536;
  --ink-2: #5a6a80;
  --ink-3: #8b98aa;
  --line: #e4eaf2;
  --bg: #f2f5f9;
  --card: #ffffff;
  --ok: #17a673;
  --ok-bg: #e7f8f1;
  --warn: #e8871e;
  --warn-bg: #fdf0e0;
  --danger: #dd4436;
  --danger-bg: #fdecea;
  --info: #1673d1;
  --info-bg: #e8f2fd;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(21, 45, 78, .07);
  --shadow-lg: 0 12px 40px rgba(15, 35, 60, .16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--brand-2); text-decoration: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c6d2e0; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== 登录页 ===================== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 15% 10%, rgba(22, 115, 209, .18), transparent 60%),
    radial-gradient(900px 500px at 85% 90%, rgba(11, 79, 158, .22), transparent 60%),
    linear-gradient(135deg, #0a3f7d 0%, #10559f 45%, #0b4f9e 100%);
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 40%, #000 30%, transparent 78%);
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 940px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(2, 20, 45, .45);
}
.login-side {
  padding: 46px 42px;
  background: linear-gradient(150deg, #0b4f9e, #0d63c6 60%, #1580e8);
  color: #fff;
  display: flex; flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-side::after {
  content: "";
  position: absolute; right: -70px; bottom: -70px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.login-side .login-brand {
  display: flex; align-items: center; gap: 11px;
  margin-bottom: 20px; position: relative; z-index: 2;
}
.login-side .login-brand img {
  width: 46px; height: 46px; object-fit: contain;
  padding: 6px; background: #fff; border-radius: 13px;
  box-shadow: 0 10px 22px rgba(2, 18, 42, .28);
}
.login-side .login-brand-txt b { display: block; font-size: 15px; letter-spacing: 4px; font-weight: 700; }
.login-side .login-brand-txt span { display: block; font-size: 9px; letter-spacing: 1.6px; opacity: .62; margin-top: 2px; }
.login-mobile-brand { display: none; }
.login-side h1 { font-size: 25px; letter-spacing: 1px; font-weight: 700; }
.login-side .sub { margin-top: 8px; font-size: 13px; opacity: .8; letter-spacing: 2px; }
.login-side ul { margin-top: 30px; display: grid; gap: 13px; position: relative; z-index: 2; }
.login-side li { display: flex; gap: 10px; font-size: 13px; opacity: .92; list-style: none; }
.login-side li em {
  width: 20px; height: 20px; flex: 0 0 20px;
  border-radius: 50%; background: rgba(255,255,255,.2);
  font-style: normal; font-size: 12px; display: grid; place-items: center;
}
.login-side .foot { font-size: 11px; opacity: .55; margin-top: 28px; }

.login-form { padding: 46px 40px; display: flex; flex-direction: column; justify-content: center; }
.login-form h2 { font-size: 20px; }
.login-form p.tip { color: var(--ink-3); font-size: 12.5px; margin: 6px 0 24px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; height: 42px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fbfcfe; transition: .15s;
  outline: none;
}
.field textarea { height: auto; padding: 10px 13px; resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-2); background: #fff;
  box-shadow: 0 0 0 3px rgba(22,115,209,.12);
}
.btn {
  height: 42px; padding: 0 18px; border-radius: 9px;
  font-size: 13.5px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: .15s; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #0d5cb8; }
.btn-ghost { background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: #c9d6e6; color: var(--ink); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; margin-top: 6px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.login-accounts { margin-top: 22px; border-top: 1px dashed var(--line); padding-top: 16px; }
.login-accounts .t { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }
.acct-list { display: flex; flex-wrap: wrap; gap: 7px; }
.acct {
  padding: 5px 10px; border-radius: 20px; font-size: 11.5px;
  background: var(--brand-3); color: var(--brand);
  border: 1px solid transparent;
}
.acct:hover { border-color: var(--brand-2); }

/* ===================== 主框架 ===================== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 214px; flex: 0 0 214px;
  background: linear-gradient(180deg, #0b3c74, #0b4f9e 60%, #0a4a94);
  color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 30;
}
.brand { padding: 20px 18px 16px; display: flex; gap: 10px; align-items: center; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px;
  background: rgba(255,255,255,.16);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  border: 1px solid rgba(255,255,255,.22);
}
.brand .name { font-size: 14px; font-weight: 600; letter-spacing: .5px; line-height: 1.25; }
.brand .name small { display: block; font-weight: 400; font-size: 10px; opacity: .6; letter-spacing: 1.5px; }

.nav { flex: 1; padding: 8px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-radius: 9px; margin-bottom: 3px;
  font-size: 13px; color: rgba(255,255,255,.72);
  transition: .15s; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.09); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-item .dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.5); }
.nav-item.active .dot { background: #6ec1ff; box-shadow: 0 0 0 3px rgba(110,193,255,.25); }

.side-foot { padding: 12px 14px 16px; border-top: 1px solid rgba(255,255,255,.1); }
.side-user { display: flex; gap: 9px; align-items: center; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
  background: linear-gradient(135deg, #4a9df0, #1673d1);
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
}
.side-user .meta { font-size: 12px; line-height: 1.3; }
.side-user .meta b { display: block; font-size: 12.5px; }
.side-user .meta span { opacity: .65; font-size: 11px; }
.logout { margin-top: 9px; width: 100%; height: 30px; border-radius: 7px; font-size: 12px; color: rgba(255,255,255,.7); background: rgba(255,255,255,.08); }
.logout:hover { background: rgba(255,255,255,.16); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; position: sticky; top: 0; z-index: 20;
}
.topbar .menu-btn { display: none; width: 34px; height: 34px; border-radius: 8px; font-size: 18px; color: var(--ink-2); }
.topbar h2 { font-size: 16px; font-weight: 600; }
.topbar .crumb { font-size: 11.5px; color: var(--ink-3); margin-top: -2px; }
.topbar .spacer { flex: 1; }
.topbar .clock { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.page { padding: 18px 20px 40px; flex: 1; }

/* ===================== 通用组件 ===================== */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 14px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #f0f4f9; }
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: #fff; border-radius: var(--radius); padding: 15px 16px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  border-left: 3px solid var(--brand-2);
}
.kpi .label { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.kpi .value small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 3px; }
.kpi .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.kpi .sub .up { color: var(--ok); }
.kpi .sub .down { color: var(--danger); }
.kpi.k2 { border-left-color: var(--ok); }
.kpi.k3 { border-left-color: var(--warn); }
.kpi.k4 { border-left-color: #7b61d8; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 5px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.b-blue { background: var(--info-bg); color: var(--info); }
.b-green { background: var(--ok-bg); color: var(--ok); }
.b-orange { background: var(--warn-bg); color: var(--warn); }
.b-red { background: var(--danger-bg); color: var(--danger); }
.b-gray { background: #eef2f7; color: var(--ink-2); }
.b-purple { background: #f0ecfd; color: #6b4fd8; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 11px 14px; text-align: left; font-size: 13px; white-space: nowrap; }
th { background: #f8fafd; color: var(--ink-2); font-weight: 500; font-size: 12.5px; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
td { border-bottom: 1px solid #f3f6fa; }
tr:hover td { background: #fafcff; }
td.num { font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 200px; }

.progress { height: 6px; background: #eef2f7; border-radius: 3px; overflow: hidden; min-width: 70px; }
.progress i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #1673d1, #45a3f5); transition: width .4s; }
.progress.warn i { background: linear-gradient(90deg, #e8871e, #f5b342); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select {
  height: 34px; padding: 0 11px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; font-size: 13px; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--brand-2); }
.toolbar .grow { flex: 1; min-width: 120px; }
.toolbar .grow input { width: 100%; }

.empty { padding: 46px 20px; text-align: center; color: var(--ink-3); font-size: 13px; }

.bars { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 88px 1fr 78px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-row .lbl { color: var(--ink-2); }
.bar-track { height: 18px; background: #f2f5f9; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #0b4f9e, #3d95ea); }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }

.chart-box { height: 210px; display: flex; align-items: flex-end; gap: 16px; padding: 10px 6px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.chart-col .bar {
  width: 100%; max-width: 46px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #4aa3f2, #1268c9);
  min-height: 3px; position: relative; transition: height .5s;
}
.chart-col .bar span {
  position: absolute; top: -19px; left: 50%; transform: translateX(-50%);
  font-size: 10.5px; color: var(--ink-2); white-space: nowrap;
}
.chart-col .m { font-size: 11.5px; color: var(--ink-3); }

.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: 14px; }
.team-card { background: #fff; border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow); border-top: 3px solid var(--brand-2); }
.team-card h4 { font-size: 14px; }
.team-card .region { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.team-card .rows { margin-top: 12px; display: grid; gap: 7px; font-size: 12.5px; }
.team-card .rows div { display: flex; justify-content: space-between; color: var(--ink-2); }
.team-card .rows b { color: var(--ink); font-weight: 500; }

.list-simple { display: grid; gap: 9px; }.list-simple .row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #eef2f7; font-size: 12.5px; }
.list-simple .row:last-child { border-bottom: none; }
.list-simple .row .name { flex: 1; color: var(--ink); }
.list-simple .row .meta { color: var(--ink-3); font-size: 11.5px; }

/* ===================== 工单动态列表 ===================== */
.task-feed { display: grid; }
.feed-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px dashed #eef2f7;
}
.feed-row:last-child { border-bottom: none; }
.feed-main { flex: 1; min-width: 0; }
.feed-main b { font-size: 13px; font-weight: 500; }
.feed-main .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-right { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }

/* ===================== 弹窗 ===================== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(12, 26, 45, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100; backdrop-filter: blur(2px);
  animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-head h3 { font-size: 15px; flex: 1; }
.modal-head .x { width: 28px; height: 28px; border-radius: 7px; color: var(--ink-3); font-size: 17px; }
.modal-head .x:hover { background: #f2f5f9; color: var(--ink); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-body .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }

/* ===================== Toast ===================== */
.toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%);
  background: rgba(24, 38, 58, .92); color: #fff;
  padding: 10px 18px; border-radius: 9px; font-size: 13px;
  z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: toastIn .2s ease;
}
.toast.err { background: rgba(196, 52, 40, .95); }
.toast.ok { background: rgba(20, 130, 95, .95); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px) } to { opacity: 1; transform: translate(-50%, 0) } }

/* ===================== 响应式：平板 / 手机 ===================== */
.only-mobile { display: none; }
.m-list { display: grid; gap: 10px; }
.m-item {
  background: #fff; border-radius: var(--radius); padding: 13px 14px;
  box-shadow: var(--shadow); display: grid; gap: 8px;
}
.m-item .m-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.m-item .m-top b { font-size: 13.5px; line-height: 1.4; }
.m-item .m-sub { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
.m-item .m-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.m-item .m-row b { color: var(--ink); font-weight: 600; }
.m-item .m-ops { display: flex; gap: 8px; margin-top: 2px; }
.m-item .m-ops .btn { flex: 1; }

@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .login-card { grid-template-columns: 1fr; max-width: 420px; }
  .login-side { display: none; }
  .login-mobile-brand {
    display: flex; align-items: center; gap: 10px; margin-bottom: 22px;
  }
  .login-mobile-brand img { width: 34px; height: 34px; object-fit: contain; }
  .login-mobile-brand span { font-size: 14px; font-weight: 700; letter-spacing: .5px; color: var(--ink-1); }

  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .22s ease;
    width: 218px; box-shadow: 8px 0 30px rgba(0,0,0,.2);
  }
  .sidebar.open { transform: none; }
  .sidebar-mask {
    position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 29;
  }
  .topbar .menu-btn { display: block; }
  .page { padding: 14px 12px 34px; }
  .kpi-grid { gap: 10px; }
  .kpi { padding: 12px 13px; }
  .kpi .value { font-size: 20px; }
  table { min-width: 620px; }
  .topbar .clock { display: none; }
  .toolbar input, .toolbar select { flex: 1; min-width: 100px; }
  .modal-body .row2 { grid-template-columns: 1fr; }
  .only-desktop { display: none !important; }
  .only-mobile { display: block; }
  .grid-2, .grid-3 { gap: 12px; }

  /* 表格瘦身：隐藏次要列，保证手机端核心信息完整可见 */
  table.pj, table.tk { min-width: 100% !important; }
  table.pj th:nth-child(1), table.pj td:nth-child(1),
  table.pj th:nth-child(3), table.pj td:nth-child(3),
  table.pj th:nth-child(4), table.pj td:nth-child(4),
  table.pj th:nth-child(9), table.pj td:nth-child(9) { display: none; }
  table.tk th:nth-child(1), table.tk td:nth-child(1),
  table.tk th:nth-child(4), table.tk td:nth-child(4),
  table.tk th:nth-child(6), table.tk td:nth-child(6) { display: none; }
  .feed-main .meta { white-space: normal; }
}

/* ============ v1.1.0 多组织 / 注册 / 提醒 ============ */
.auth-tabs { display: flex; gap: 6px; background: #f1f4f9; border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.auth-tab { flex: 1; border: 0; background: transparent; border-radius: 8px; padding: 9px 0; font-size: 13.5px; color: #5c6b80; cursor: pointer; font-weight: 500; }
.auth-tab.active { background: #fff; color: #0b4f9e; box-shadow: 0 1px 4px rgba(16,42,84,.10); font-weight: 600; }
.login-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tenant-chip { font-size: 12px; color: #0b4f9e; background: #eaf2ff; border-radius: 20px; padding: 4px 11px; margin-right: 12px; border: 1px solid #d6e4ff; }

.alert-slot:empty { display: none; }
.alert-banner { display: flex; align-items: center; gap: 10px; margin: 14px 18px 0; padding: 11px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.55; border: 1px solid; }
.alert-banner.info { background: #f0f7ff; border-color: #cfe3fb; color: #1b4f8a; }
.alert-banner.warn { background: #fff8ec; border-color: #f5ddb0; color: #8a5a11; }
.alert-banner.danger { background: #fef1f0; border-color: #f6cfcb; color: #9c2a22; }
.alert-ico { font-size: 16px; }
.alert-text { flex: 1; }
.alert-text b { font-weight: 600; }
.alert-side { font-size: 12px; white-space: nowrap; opacity: .8; }

.renew-info { font-size: 13px; color: #3c4b60; background: #f5f8fc; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.hint-line { font-size: 12px; color: #8b98aa; margin-top: 6px; line-height: 1.6; }
.member-mini { margin-top: 14px; border-top: 1px dashed #e3e9f2; padding-top: 10px; }
.member-mini .t { font-size: 12.5px; color: #8b98aa; margin-bottom: 6px; }
.member-mini .row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid #f2f5f9; }
.member-mini .row:last-child { border-bottom: 0; }
.member-mini .name b { font-size: 13.5px; }

@media (max-width: 820px) {
  .alert-banner { margin: 10px 12px 0; font-size: 12.8px; border-radius: 9px; }
  .alert-side { display: none; }
  .tenant-chip { display: none; }
}
