:root {
  --nav: #102b4e;
  --nav2: #0a213d;
  --blue: #1767c6;
  --blue-soft: #edf5ff;
  --ink: #172b44;
  --muted: #6f8196;
  --line: #e2e8f0;
  --bg: #f4f7fa;
  --good: #16805c;
  --warn: #a56a12;
  --bad: #bd4141;
  --shadow: 0 16px 45px rgba(24, 55, 91, .08);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 system-ui, -apple-system, "Microsoft YaHei", sans-serif;
}
button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }
.hidden { display: none !important; }
.btn,
.filters button,
.actions button,
.pager button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}
.btn.light,
.ghost {
  border: 1px solid #d6e1ec;
  background: #fff;
  color: #285f9e;
}
.danger { background: var(--bad) !important; }
.logo {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 12px;
  background: #2376d8;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 70% 20%, #e7f1ff, #f5f8fb 42%, #e9eff6);
}
.login-box {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid #dbe4ee;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 24px 70px #193b641c;
}
.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 25px; }
.login-brand b { display: block; font-size: 22px; }
.login-brand small { display: block; color: var(--muted); }
.login-box label { display: grid; gap: 7px; margin: 15px 0; color: #40546c; font-weight: 700; }
.login-box input {
  width: 100%;
  height: 43px;
  padding: 0 12px;
  border: 1px solid #cbd7e3;
  border-radius: 9px;
}
.login-box input:focus,
input:focus,
select:focus {
  outline: 2px solid #c6dcf6;
  border-color: #5590d1;
}
.login-box .btn { width: 100%; height: 43px; margin-top: 8px; }
.error { min-height: 22px; color: var(--bad); }

.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  min-height: 0;
  padding: 18px 14px 14px;
  overflow-y: auto;
  flex-direction: column;
  background: linear-gradient(180deg, var(--nav), var(--nav2));
  color: #fff;
  scrollbar-width: thin;
  scrollbar-color: #ffffff2c transparent;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 10px 14px; }
.brand b { display: block; font-size: 19px; }
.brand small { display: block; color: #9fb2ca; }
#nav { flex: 1 0 auto; }
.nav-group {
  margin: 12px 11px 4px;
  padding-top: 9px;
  border-top: 1px solid #ffffff14;
  color: #718ba9;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
}
.nav-group:first-child { margin-top: 0; padding-top: 0; border: 0; }
nav button {
  display: flex;
  width: 100%;
  min-height: 37px;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 8px;
  background: transparent;
  color: #b8c6d8;
  text-align: left;
  font-weight: 650;
}
nav button:hover { background: #ffffff0d; color: #fff; }
nav button.active { background: #2470c8; color: #fff; box-shadow: inset 3px 0 #7fbdff; }
.ico { width: 20px; flex: 0 0 20px; text-align: center; }
.account {
  margin: 16px 8px 0;
  padding: 14px 4px 0;
  border-top: 1px solid #ffffff1c;
}
.account-user { display: flex; align-items: center; gap: 9px; }
.account-user b, .account-user small { display: block; }
.account-user small { color: #93a7c0; }
.account-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #39c18d;
  box-shadow: 0 0 0 4px #39c18d18;
}
.account-actions { display: flex; gap: 7px; margin-top: 10px; }
.account-actions button {
  flex: 1;
  padding: 7px 4px;
  border-radius: 7px;
  background: #ffffff0d;
  color: #a9c3df;
  font-size: 12px;
}
.account-actions button:hover { background: #ffffff18; color: #fff; }

.main { min-width: 0; padding: 28px clamp(20px, 3vw, 42px) 60px; }
.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.crumb { color: #7c8ca0; font-size: 12px; }
.top h1 { margin: 5px 0 2px; font-size: 27px; }
.top p { margin: 0; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.mobile-menu { display: none; }
.live-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 99px;
  background: #e8f6f0;
  color: #187358;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: #20a875; }
.content { display: grid; gap: 18px; min-width: 0; }
.loading,
.empty {
  padding: 60px 24px;
  border: 1px dashed #cad5e1;
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}
.empty strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 16px; }
.empty.error { color: var(--bad); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.metric,
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.metric { padding: 18px; text-align: left; }
button.metric { transition: border-color .15s, transform .15s, box-shadow .15s; }
button.metric:hover {
  border-color: #9ebce0;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.metric small { display: block; color: var(--muted); }
.metric strong {
  display: block;
  margin: 7px 0 3px;
  overflow-wrap: anywhere;
  font-size: clamp(22px, 2.1vw, 29px);
  line-height: 1.2;
}
.metric em { color: var(--muted); font-size: 12px; font-style: normal; }
.metric.good strong { color: var(--good); }
.metric.warn strong { color: var(--warn); }
.metric.bad strong { color: var(--bad); }
.panel { overflow: hidden; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 19px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.panel-body { padding: 18px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 18px;
}
.fact { min-width: 0; padding: 14px; border-radius: 9px; background: #f4f7fb; }
.fact small { display: block; color: var(--muted); }
.fact b { display: block; margin-top: 4px; overflow-wrap: anywhere; font-size: 16px; }
.entry-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; padding: 18px; }
.entry-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafcff;
  color: var(--ink);
  text-align: left;
}
.entry-card:hover { border-color: #9ebce0; background: #f4f9ff; }
.entry-card small { display: block; color: var(--muted); }
.entry-card b { display: block; margin-top: 4px; font-size: 16px; }

.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.filters input,
.filters select {
  width: min(260px, 100%);
  height: 36px;
  padding: 0 10px;
  border: 1px solid #ccd7e3;
  border-radius: 8px;
  background: #fff;
  color: #405671;
}
.filters select { width: 170px; }
.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 99px;
  background: #eaf2fc;
  color: #2762a4;
  font-size: 12px;
}
.tag.green, .tag.good { background: #e7f6ef; color: #187358; }
.tag.amber, .tag.warn { background: #fff3dd; color: #936518; }
.tag.red, .tag.bad { background: #ffeded; color: #a43d3d; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 12px 14px; border-bottom: 1px solid #edf1f5; text-align: left; }
th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #f7f9fb;
  color: #66778c;
  font-size: 12px;
}
tbody tr.click-row { cursor: pointer; }
tbody tr:hover { background: #f3f8ff; }
.link { padding: 0; background: none; color: #1760bd; font-weight: 700; }
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 16px;
  color: var(--muted);
}
.pager button:disabled { opacity: .35; cursor: default; }

.segment-list { display: grid; gap: 14px; padding: 18px; }
.segment-row {
  display: grid;
  grid-template-columns: minmax(100px, 150px) minmax(100px, 1fr) minmax(70px, auto);
  align-items: center;
  gap: 12px;
  padding: 3px 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.segment-track { height: 8px; overflow: hidden; border-radius: 9px; background: #e6edf5; }
.segment-track i { display: block; height: 100%; border-radius: inherit; background: #2a74c8; }
.segment-row.good .segment-track i { background: var(--good); }
.segment-row.warn .segment-track i { background: #d99a35; }
.segment-row.bad .segment-track i { background: #cf5a5a; }
.notice {
  padding: 12px 14px;
  border: 1px solid #f0dfb2;
  border-radius: 10px;
  background: #fff8e8;
  color: #82601b;
  font-size: 12px;
}
.coverage {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid #dce8f5;
  border-radius: 10px;
  background: #f6faff;
  color: #536a84;
  font-size: 12px;
}
.coverage b { color: #244f80; }
.section-title { margin: 26px 0 10px; }
.detail-section {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.detail-section > summary {
  padding: 13px 15px;
  background: #f7f9fb;
  cursor: pointer;
  font-weight: 750;
}
.detail-section > div { padding: 0; }
.detail-list { display: grid; gap: 8px; padding: 14px; }
.detail-list p { margin: 0; padding: 9px 11px; border-radius: 8px; background: #f7f9fb; }

.drawer {
  width: min(820px, 96vw);
  height: 100vh;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: -24px 0 70px #10254135;
}
.drawer::backdrop { background: #0b203b70; }
.drawer-close {
  position: sticky;
  z-index: 5;
  top: 18px;
  float: right;
  width: 36px;
  height: 36px;
  margin: 18px;
  border-radius: 9px;
  background: #eef3f8;
  color: #40566f;
  font-size: 22px;
}
.dialog-content { padding: 30px; }
.dialog-content h2 { margin: 0 50px 5px 0; }
.dialog-subtitle { margin: 0 50px 18px 0; color: var(--muted); }
.form-stack { max-width: 100%; }
.form-stack label { display: grid; gap: 7px; }
.form-stack input,
.form-stack select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid #ccd7e3;
  border-radius: 8px;
}
.actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 0 18px 18px; }
.dialog-content > .actions { padding: 0; margin-top: 18px; }
.toast {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 11px 16px;
  border-radius: 9px;
  background: #173657;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .18s;
}
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding-right: 22px; padding-left: 22px; }
}

@media (max-width: 620px) {
  .app { display: block; }
  .sidebar {
    position: fixed;
    z-index: 70;
    top: 0;
    left: 0;
    width: min(286px, 86vw);
    padding: 16px 14px;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 18px 0 50px #081a2f55;
  }
  .app.menu-open .sidebar { transform: translateX(0); }
  .brand { justify-content: flex-start; padding: 0 8px 12px; }
  .brand div, .account, .nav-group { display: block; }
  nav button { justify-content: flex-start; padding: 8px 12px; font-size: 14px; }
  nav button .ico { font-size: 14px; }
  .main { padding: 17px 11px 40px; }
  .top { align-items: flex-start; }
  .top-actions { flex-direction: column; align-items: flex-end; }
  .live-badge { display: none; }
  .mobile-menu { display: inline-flex; align-items: center; }
  .metric-grid, .facts, .entry-grid { grid-template-columns: 1fr; }
  .filters { width: 100%; }
  .filters input, .filters select { width: 100%; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .segment-row { grid-template-columns: 90px 1fr 60px; }
  .drawer { width: 100vw; }
}
