:root {
  --blue-50: #e3f2fd;
  --blue-100: #bbdefb;
  --blue-200: #90caf9;
  --blue-300: #64b5f6;
  --blue-400: #42a5f5;
  --ink: #1f3447;
  --muted: #6c8194;
  --line: #d8ecfb;
  --bg: #f5fbff;
  --white: #ffffff;
  font-family: "Inter", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
button, .button { border: 0; border-radius: 8px; padding: 10px 14px; background: var(--blue-100); color: #0f4168; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .button:hover { background: var(--blue-200); }
button.primary { background: var(--blue-400); color: white; }
button.ghost { background: transparent; color: var(--muted); }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; font: inherit; background: white; color: var(--ink); }
textarea { min-height: 96px; margin: 14px 0; resize: vertical; }
label { display: grid; gap: 8px; color: var(--muted); }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, var(--blue-50), #fff); }
.login-card { width: min(420px, 100%); display: grid; gap: 16px; padding: 32px; background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 45px rgba(66,165,245,.18); }
.brand-mark { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 8px; background: var(--blue-400); color: white; font-size: 28px; font-weight: 800; }
.login-card h1 { margin: 0; }
.login-card p, .login-card small { color: var(--muted); margin: 0; }

.layout { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.sidebar { padding: 20px; background: white; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; height: 100vh; }
.logo { font-size: 26px; font-weight: 800; margin-bottom: 16px; color: #1565a8; }
.sidebar button { justify-content: flex-start; background: transparent; color: var(--ink); }
.sidebar button.active { background: var(--blue-50); color: #0d68a8; font-weight: 700; }
.sidebar .ghost { margin-top: auto; }

.content { padding: 24px; overflow: hidden; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 20px; }
.topbar h1 { margin: 0 0 4px; }
.topbar p { margin: 0; color: var(--muted); }
.search-box { display: flex; width: min(460px, 100%); gap: 8px; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.panel, .metric { background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 30px rgba(66,165,245,.1); }
.panel { padding: 18px; overflow: auto; }
.panel h2 { margin: 0 0 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-head div { display: flex; flex-wrap: wrap; gap: 8px; }
.metric { padding: 20px; display: grid; gap: 10px; }
.metric span { color: var(--muted); }
.metric strong { font-size: 36px; color: #1565a8; }
.wide { grid-column: span 3; }

.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.full { margin-bottom: 16px; }
.suggested { border-color: var(--blue-400); box-shadow: 0 0 0 3px var(--blue-50); }

.table-wrap { overflow: auto; margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; min-width: 780px; background: white; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: #1565a8; background: var(--blue-50); }
tr:hover td { background: #f0f8ff; }

.bars { display: grid; gap: 12px; }
.bars div { display: grid; grid-template-columns: 100px 1fr 40px; gap: 10px; align-items: center; }
.bars i { height: 10px; background: var(--blue-300); border-radius: 99px; }
.tree { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tree div { display: flex; justify-content: space-between; padding: 12px; background: var(--blue-50); border-radius: 8px; }
.source-row { display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: center; margin-bottom: 10px; }
.toast { position: fixed; right: 24px; top: 24px; padding: 12px 16px; border-radius: 8px; color: white; background: #2e7d32; box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 10; }
.toast.error { background: #c62828; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; flex-direction: row; overflow-x: auto; }
  .logo { display: none; }
  .content { padding: 16px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .grid, .form-grid { grid-template-columns: 1fr; }
  .wide { grid-column: span 1; }
  .panel-head { align-items: stretch; flex-direction: column; }
}
