:root {
  --bg: #eef1f4;
  --bg-deep: #d9e0e8;
  --panel: #f7f8fa;
  --panel-solid: #ffffff;
  --ink: #1c2430;
  --ink-soft: #5a6573;
  --line: #d5dce0;
  --brand: #1f4b6e;
  --brand-2: #2d6a8f;
  --accent: #c47a2c;
  --ok: #2f7d5b;
  --warn: #b7791f;
  --danger: #a33b3b;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.08);
  --radius: 14px;
  --font: "Noto Sans SC", "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(45, 106, 143, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(196, 122, 44, 0.10), transparent 55%),
    linear-gradient(180deg, #e8eef3 0%, var(--bg) 40%, #e6ebea 100%);
}

.hidden { display: none !important; }
button, input, select, textarea { font: inherit; }
a { color: var(--brand-2); text-decoration: none; }

.btn {
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: .15s ease;
}
.btn:hover { border-color: #b7c3cf; }
.btn.primary {
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border-color: transparent;
  color: #fff;
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.accent {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
.btn.danger { background: #fff5f5; color: var(--danger); border-color: #efc4c4; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.icon-btn {
  border: 0; background: transparent; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--ink-soft);
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
}
.login-bg {
  position: absolute; inset: 0;
  background:
    linear-gradient(120deg, rgba(31,75,110,.88), rgba(28,36,48,.72)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(160deg, #1f4b6e, #314653 50%, #4a5d4e);
  z-index: 0;
}
.login-card {
  position: relative; z-index: 1;
  width: min(420px, 100%);
  background: rgba(255,255,255,.96);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 28px; }
.brand h1 { margin: 0; font-size: 28px; letter-spacing: .04em; color: var(--brand); }
.brand p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }
.brand-mark {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #2d6a8f, #1f4b6e);
  color: #fff; font-weight: 700; font-size: 22px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-mark.sm { width: 38px; height: 38px; font-size: 16px; border-radius: 10px; }
#login-form label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--ink-soft); }
#login-form input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff;
}
#login-form input:focus { outline: 2px solid rgba(45,106,143,.25); border-color: var(--brand-2); }
#login-form .btn { margin-top: 22px; padding: 12px; }
.login-hint { margin: 16px 0 0; font-size: 12px; color: #8a94a1; line-height: 1.5; }

/* Layout */
.main-layout { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar {
  background: linear-gradient(180deg, #1c3042, #24384c 40%, #1e3344);
  color: #d7e2ec;
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 18px;
}
.side-brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-brand strong { display: block; color: #fff; }
.side-brand small { color: #9eb0c0; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  color: #c5d3df; padding: 10px 12px; border-radius: 10px;
  display: block; font-size: 14px;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { box-shadow: inset 3px 0 0 var(--accent); }
.side-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; }
.side-user { font-size: 13px; color: #b7c6d4; margin-bottom: 10px; line-height: 1.5; }
.workspace { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 24px 8px;
}
.topbar h2 { margin: 0; font-size: 22px; font-weight: 600; }
.topbar-actions { display: flex; gap: 12px; align-items: center; }
.clock { color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.content { padding: 8px 24px 28px; }

/* Cards / panels */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--panel-solid);
  border: 1px solid rgba(213,220,224,.8);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-card .label { color: var(--ink-soft); font-size: 13px; }
.stat-card .value { margin-top: 8px; font-size: 28px; font-weight: 600; letter-spacing: .02em; font-family: "IBM Plex Sans", var(--font); }
.stat-card .sub { margin-top: 6px; font-size: 12px; color: #8a94a1; }

.panel {
  background: var(--panel-solid);
  border: 1px solid rgba(213,220,224,.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.panel-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.panel-body { padding: 16px 18px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar input, .toolbar select, .form-grid input, .form-grid select, .form-grid textarea {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fff;
}
.toolbar input { min-width: 180px; }

.table-wrap { overflow: auto; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.data th, table.data td {
  padding: 11px 12px; border-bottom: 1px solid #e8eef2; text-align: left; white-space: nowrap;
}
table.data th { color: var(--ink-soft); font-weight: 500; background: #f5f7f9; position: sticky; top: 0; }
table.data tr:hover td { background: #fafbfc; }

.tag {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; background: #eef3f7; color: var(--brand);
}
.tag.ok { background: #e7f5ef; color: var(--ok); }
.tag.warn { background: #fff6e8; color: var(--warn); }
.tag.info { background: #eaf3fb; color: var(--brand-2); }
.tag.muted { background: #f0f2f4; color: #7a8592; }
.tag.danger { background: #fdeeee; color: var(--danger); }

.form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 5px; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }
.form-grid textarea { min-height: 80px; resize: vertical; }

.split-2 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
#map, .map-box {
  height: 520px; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; background: #dde5ea;
}
.map-list { max-height: 520px; overflow: auto; }
.map-item {
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer;
}
.map-item:hover, .map-item.active { border-color: var(--brand-2); background: #f4f8fb; }
.map-item strong { display: block; margin-bottom: 4px; }
.map-item small { color: var(--ink-soft); line-height: 1.45; display: block; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--ink-soft); font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1c2430; color: #fff; padding: 10px 16px; border-radius: 10px;
  z-index: 1000; box-shadow: var(--shadow); font-size: 14px;
}

.modal { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(20,28,36,.45); }
.modal-panel {
  position: relative; width: min(720px, calc(100vw - 28px)); max-height: calc(100vh - 40px);
  overflow: auto; background: #fff; border-radius: 16px; box-shadow: var(--shadow);
}
.modal-head, .modal-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.modal-foot { border-bottom: 0; border-top: 1px solid var(--line); justify-content: flex-end; gap: 8px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px; }

.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 10px; }
.chart-bars .bar {
  flex: 1; background: linear-gradient(180deg, #5d8fb0, #2d6a8f); border-radius: 6px 6px 2px 2px;
  min-width: 8px; position: relative;
}
.chart-bars .bar span {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--ink-soft); white-space: nowrap;
}
.muted { color: var(--ink-soft); }
.empty { padding: 36px; text-align: center; color: var(--ink-soft); }

@media (max-width: 1100px) {
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 20; }
  .nav { flex-direction: row; overflow: auto; }
  .nav a { white-space: nowrap; }
  .side-foot { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}
