:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --text: #1d2733;
  --muted: #667488;
  --line: #dce3ea;
  --accent: #1677ff;
  --accent-strong: #0e5ed4;
  --success: #12a150;
  --warn: #c78205;
  --danger: #d83b3b;
  --ink: #0f1722;
  --shadow: 0 14px 40px rgba(30, 45, 65, 0.08);
  --insight-card-height: 430px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body.drawer-open {
  overflow: hidden;
}

body.widget-reordering {
  user-select: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

label[for] {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.is-hidden {
  display: none !important;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(244, 246, 248, 0.72);
  backdrop-filter: blur(10px);
}

.loading-panel {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: min(520px, 100%);
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #d9e6f2;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.loading-panel strong {
  display: block;
  margin-bottom: 4px;
}

.loading-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.loading-track {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: 999px;
}

.loading-track div {
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 160ms ease;
}

#loadingPercent {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.welcome-view {
  position: relative;
  display: grid;
  gap: 24px;
  min-height: 100vh;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(245, 248, 251, 0.92)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1440' height='900' viewBox='0 0 1440 900'%3E%3Crect width='1440' height='900' fill='%23e9eff5'/%3E%3Cg opacity='.48'%3E%3Cpath d='M0 164h1440M0 316h1440M0 468h1440M0 620h1440M0 772h1440' stroke='%23cbd6e0' stroke-width='1'/%3E%3Cpath d='M160 0v900M356 0v900M552 0v900M748 0v900M944 0v900M1140 0v900M1336 0v900' stroke='%23cbd6e0' stroke-width='1'/%3E%3C/g%3E%3Cg fill='none' stroke-linecap='round' stroke-width='8'%3E%3Cpath d='M108 674c116-96 230-118 342-66s230 54 354 4 258-48 402 4' stroke='%231677ff' opacity='.34'/%3E%3Cpath d='M156 384c120 44 246 44 378 0s262-46 390-6 244 36 348-12' stroke='%2312a150' opacity='.32'/%3E%3Cpath d='M238 196c94 54 186 70 276 48s172-12 246 30 166 46 276 12' stroke='%23d83b3b' opacity='.22'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

.welcome-view.is-dragging::before {
  position: fixed;
  inset: 0;
  z-index: 20;
  content: "";
  pointer-events: none;
  background: rgba(240, 247, 255, 0.72);
  border: 4px solid rgba(22, 119, 255, 0.46);
  box-shadow: inset 0 0 0 12px rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(6px);
}

.welcome-view.is-dragging::after {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 21;
  min-width: min(520px, calc(100vw - 40px));
  padding: 18px 22px;
  color: var(--text);
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #b9d8f8;
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(30, 45, 65, 0.16);
  content: "松开鼠标导入日志文件";
  pointer-events: none;
  transform: translateX(-50%);
  font-size: 18px;
  font-weight: 850;
}

.welcome-view.is-dragging .hero-banner {
  outline: 2px solid rgba(22, 119, 255, 0.36);
  outline-offset: 8px;
  border-radius: 8px;
}

.hero-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 48px;
  align-items: center;
  width: min(1180px, 100%);
  min-height: calc(100vh - 206px);
  margin: 0 auto;
}

.hero-copy {
  display: grid;
  gap: 22px;
}

.hero-copy h1 {
  max-width: 760px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(44px, 7vw, 82px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-text {
  max-width: 700px;
  margin: 0;
  color: #435166;
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.hero-actions span {
  color: var(--muted);
  font-size: 14px;
}

.primary-button.large {
  min-height: 52px;
  padding: 0 28px;
  font-size: 16px;
}

.hero-drop {
  display: grid;
  min-height: 520px;
  place-items: center;
  padding: 28px;
  border: 1px dashed rgba(22, 119, 255, 0.32);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.hero-drop.is-dragging,
.hero-drop:focus {
  border-color: var(--accent);
  background: rgba(240, 247, 255, 0.92);
  outline: none;
  transform: translateY(-2px);
}

.terminal-card {
  width: min(440px, 100%);
  padding: 18px;
  color: #e8f1ff;
  background: #101824;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(16, 24, 36, 0.24);
}

.terminal-top {
  display: flex;
  gap: 8px;
  padding-bottom: 18px;
}

.terminal-top span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff5f57;
}

.terminal-top span:nth-child(2) {
  background: #ffbd2e;
}

.terminal-top span:nth-child(3) {
  background: #28c840;
}

.terminal-lines {
  display: grid;
  gap: 10px;
}

.terminal-lines p {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  margin: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 14px;
}

.terminal-lines b {
  color: #80c7ff;
}

.terminal-lines span {
  color: #9fb1c7;
}

.mini-chart {
  display: flex;
  gap: 10px;
  align-items: end;
  height: 120px;
  margin-top: 20px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.mini-chart i {
  flex: 1;
  min-width: 12px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, #53b7ff, #1677ff);
}

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.feature-strip article {
  display: grid;
  gap: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.feature-strip strong {
  color: var(--ink);
  font-size: 16px;
}

.feature-strip span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.analysis-view {
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100vh;
  padding: 24px;
  overflow-y: auto;
  background: #fbfcfd;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1,
.brand p,
.panel h3,
.file-list h2 {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand p,
.eyebrow,
.panel-header span,
.metric span,
.file-list h2,
.file-list li,
label,
.drop-zone small {
  color: var(--muted);
}

.brand p,
.panel-header span,
.file-list li,
.drop-zone small {
  font-size: 13px;
}

.drop-zone {
  display: grid;
  min-height: 178px;
  place-items: center;
  gap: 8px;
  padding: 22px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed #aebdca;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #f0f7ff;
  outline: none;
  transform: translateY(-1px);
}

.drop-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: #e7f1ff;
  font-size: 34px;
  line-height: 1;
}

.control-group {
  display: grid;
  gap: 8px;
}

.control-group.two-col {
  grid-template-columns: 1fr 1fr;
}

label {
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(22, 119, 255, 0.13);
}

.primary-button,
.ghost-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 700;
}

.primary-button {
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-strong);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.ghost-button {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}

.ghost-button:hover {
  background: var(--surface-soft);
}

.file-list {
  margin-top: auto;
}

.file-list h2 {
  font-size: 12px;
  text-transform: uppercase;
}

.file-list ul {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 10px 0 0;
  list-style: none;
}

.file-list li {
  padding: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dashboard {
  display: grid;
  align-content: start;
  gap: 22px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.panel-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.detail-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 260px;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.detail-card:hover,
.detail-card:focus {
  border-color: #b9d8f8;
  box-shadow: 0 18px 44px rgba(30, 45, 65, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.flexible-note-widget {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.flexible-note-widget:hover,
.flexible-note-widget:focus {
  border-color: #b9d8f8;
  box-shadow: 0 18px 44px rgba(30, 45, 65, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.flexible-note-widget-title {
  display: none;
}

.flexible-note-widget p {
  min-height: 0;
  margin: 0;
  overflow: auto;
  color: #435166;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.insight-grid > .flexible-note-widget-medium {
  grid-column: span 2 !important;
}

.insight-grid > .flexible-note-widget-large {
  grid-column: span 3 !important;
}

.eyebrow {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.analysis-toolbar {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.filter-control {
  position: relative;
  min-width: 0;
}

.filter-rules {
  position: relative;
}

.filter-expression {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 6px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.filter-chip {
  display: inline-flex;
  max-width: 360px;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid #d8e5ef;
  border-radius: 999px;
  font-size: 13px;
}

.filter-chip span,
.filter-chip b,
.filter-chip em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-chip b {
  color: var(--accent);
  font-weight: 800;
}

.filter-chip em {
  max-width: 170px;
  color: var(--muted);
  font-style: normal;
}

.filter-chip i {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--muted);
  border-radius: 50%;
  font-style: normal;
}

.filter-chip i:hover {
  color: #fff;
  background: var(--danger);
}

.filter-plus {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
}

.filter-clear-inline {
  min-height: 30px;
  padding: 0 9px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.filter-popover {
  position: absolute;
  z-index: 12;
  top: calc(100% + 8px);
  left: 0;
  width: min(920px, calc(100vw - 64px));
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.filter-editor {
  display: grid;
  grid-template-columns: minmax(180px, 0.22fr) minmax(140px, 0.16fr) minmax(0, 1fr) 96px;
  gap: 8px;
  align-items: end;
}

.filter-editor [data-editor-role="value-slot"] {
  min-width: 0;
}

.filter-time-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.filter-time-range label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.filter-time-range span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.filter-time-range input {
  min-width: 0;
  font-size: 14px;
}

.filter-editor button {
  height: 42px;
  padding: 0 14px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-weight: 800;
}

.filter-empty {
  padding: 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.file-summary {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 10px 14px;
  color: var(--muted);
  background: #edf3f8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.file-summary strong {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 13px;
}

.file-summary ul {
  display: flex;
  gap: 8px;
  min-width: 0;
  padding: 0;
  margin: 0;
  overflow-x: auto;
  list-style: none;
}

.file-summary li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  gap: 6px;
  align-items: center;
  flex: 0 0 auto;
  max-width: 260px;
  padding: 6px 7px 6px 10px;
  color: #435166;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
}

.file-summary li span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-summary li button {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  padding: 0;
  color: #7a8798;
  background: #eef3f7;
  border: 1px solid #d6e0ea;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.file-summary li button:hover,
.file-summary li button:focus {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  outline: none;
}

.ipdb-status {
  margin: -10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 116px;
  padding: 18px;
}

.metric strong {
  align-self: end;
  overflow-wrap: anywhere;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.insight-grid > .panel {
  position: relative;
  height: var(--insight-card-height);
  overflow: hidden;
  cursor: grab;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    opacity 140ms ease,
    transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

.insight-grid > .panel:active {
  cursor: grabbing;
}

.insight-grid > .panel.is-dragging {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
}

.insight-grid > .panel.is-widget-hidden {
  display: none;
}

.widget-pointer-drag-image {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 90;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.96;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.24);
  cursor: grabbing;
  transition: none;
  will-change: transform;
}

.widget-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  padding: 0;
  color: #5d6b7d;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(30, 45, 65, 0.12);
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  transform: scale(0.92);
  transition:
    background 160ms ease,
    color 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

.insight-grid > .panel:hover .widget-remove,
.insight-grid > .panel:focus-within .widget-remove {
  opacity: 1;
  transform: scale(1);
}

.widget-remove:hover,
.widget-remove:focus {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  outline: none;
}

.add-widget-card {
  display: grid;
  grid-column: span 1;
  place-items: center;
  border-style: dashed;
  box-shadow: none;
  cursor: pointer;
}

.add-widget-card:hover,
.add-widget-card:focus-visible {
  border-color: #9ec8f5;
  background: #f8fbff;
  outline: none;
}

.add-widget-button {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  padding: 0;
  color: var(--accent);
  background: #f0f7ff;
  border: 1px solid #cfe2fb;
  border-radius: 50%;
  font-size: 44px;
  line-height: 1;
  pointer-events: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.add-widget-card:hover .add-widget-button,
.add-widget-card:focus-visible .add-widget-button {
  background: #e4f1ff;
  border-color: #9ec8f5;
  transform: scale(1.04);
}

.widget-drag-image {
  position: fixed;
  top: -10000px;
  left: -10000px;
  z-index: 100;
  box-shadow: 0 28px 70px rgba(18, 32, 46, 0.26);
  opacity: 0.96;
  pointer-events: none;
  transform: scale(1.02);
}

body.widget-reordering .insight-grid > .panel:not(.is-dragging) {
  transition:
    transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 160ms ease;
}

body.widget-reordering .insight-grid > .panel.is-reordering {
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .insight-grid > .panel,
  body.widget-reordering .insight-grid > .panel:not(.is-dragging) {
    transition:
      border-color 160ms ease,
      box-shadow 160ms ease,
      opacity 140ms ease;
  }
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel.trend-panel.wide {
  grid-column: 1 / -1;
}

.insight-grid > .trend-panel {
  display: flex;
  flex-direction: column;
}

.panel.map-panel {
  grid-column: 1 / -1;
}

.insight-grid > .panel:not(.wide):not(.map-panel) {
  grid-column: span 1;
}

.insight-grid > .panel.trend-panel-1 {
  grid-column: span 1 !important;
}

.insight-grid > .panel.trend-panel-2 {
  grid-column: span 2 !important;
}

.insight-grid > .panel.global-map-panel {
  grid-column: 1 / -1 !important;
}

.insight-grid > .panel.global-map-panel-2 {
  grid-column: span 2 !important;
}

.insight-grid > .panel.map-panel-1 {
  grid-column: span 1 !important;
}

.insight-grid > .panel.map-panel-2 {
  grid-column: span 2 !important;
}

.insight-grid > .panel.china-map-panel {
  grid-column: 1 / -1 !important;
}

.global-source-panel,
.china-source-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 260px;
}

.panel h3 {
  font-size: 17px;
}

.trend-chart {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  margin-top: 14px;
}

.trend-chart.compact {
  height: auto;
}

.trend-chart.medium {
  height: auto;
}

.bar-list {
  display: grid;
  align-content: start;
  gap: 12px;
  margin-top: 16px;
}

.insight-grid .bar-list {
  min-height: 0;
  overflow: auto;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  font-size: 13px;
}

.bar-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-value {
  flex: 0 0 auto;
  color: var(--muted);
}

.bar-track {
  height: 8px;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  min-width: 3px;
  background: var(--accent);
  border-radius: inherit;
}

.bar-fill.success {
  background: var(--success);
}

.bar-fill.warn {
  background: var(--warn);
}

.bar-fill.danger {
  background: var(--danger);
}

.compact .bar-track {
  height: 6px;
}

.global-map-panel .source-map,
.china-map-panel .source-map {
  margin-top: 16px;
}

.source-map {
  height: auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf5fb;
}

.source-map svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.geo-water {
  fill: #edf5fb;
}

.geo-shape {
  fill: #d7e3ed;
  stroke: #ffffff;
  stroke-width: 0.8;
  transition:
    fill 140ms ease,
    opacity 140ms ease;
}

.geo-shape:hover {
  opacity: 0.78;
}

.geo-shape.heat-1 {
  fill: #bfe0ff;
}

.geo-shape.heat-2 {
  fill: #73b7fb;
}

.geo-shape.heat-3 {
  fill: #287fd8;
}

.geo-shape.heat-4 {
  fill: #084d9c;
}

.map-bars {
  align-content: start;
  margin-top: 0;
}

.china-map {
  display: block;
}

.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  overscroll-behavior: contain;
  animation: drawerFadeIn 220ms ease forwards;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(15, 23, 34, 0.26);
  border: 0;
  animation: backdropFadeIn 220ms ease forwards;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(66.666vw, 980px);
  min-width: min(720px, 100%);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(18, 32, 46, 0.18);
  overscroll-behavior: contain;
  animation: drawerSlideIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.detail-drawer.is-map-drawer .drawer-panel {
  width: min(80vw, 1280px);
}

.widget-drawer {
  pointer-events: none;
}

.widget-drawer .drawer-panel {
  width: min(82vw, 1280px);
  min-width: min(760px, 100%);
  pointer-events: auto;
}

.widget-drawer .drawer-backdrop {
  pointer-events: none;
}

.detail-drawer.is-closing {
  pointer-events: none;
  animation: drawerFadeOut 220ms ease forwards;
}

.detail-drawer.is-closing .drawer-backdrop {
  animation: backdropFadeOut 220ms ease forwards;
}

.detail-drawer.is-closing .drawer-panel {
  animation: drawerSlideOut 220ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.drawer-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2,
.drawer-header p {
  margin: 0;
}

.drawer-header h2 {
  font-size: 22px;
}

.drawer-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.drawer-close {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}

.drawer-list {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
}

.widget-drawer-list {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: contain;
}

.widget-drawer.is-drop-target .drawer-panel {
  border-left-color: #7db7ef;
  box-shadow: -24px 0 60px rgba(18, 32, 46, 0.18), inset 4px 0 0 #2d8cdf;
}

.widget-drawer-categories {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 18px 12px;
  overflow: auto;
  background: linear-gradient(180deg, #f8fbff 0%, #f1f5f9 100%);
  border-right: 1px solid var(--line);
}

.widget-drawer-categories button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  color: #435166;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.widget-drawer-categories button:hover,
.widget-drawer-categories button:focus,
.widget-drawer-categories button.is-active {
  color: var(--text);
  background: rgba(225, 237, 250, 0.86);
  outline: none;
}

.widget-drawer-categories button strong {
  color: var(--muted);
  font-size: 12px;
}

.widget-drawer-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  grid-auto-flow: dense;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 22px;
  overflow: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(242, 247, 252, 0.9)),
    var(--surface-soft);
}

.widget-drawer-item {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 220px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(30, 45, 65, 0.11);
  cursor: grab;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.widget-drawer-item.is-medium {
  grid-column: span 2;
  min-height: 220px;
}

.widget-drawer-item.is-large {
  grid-column: span 3;
  min-height: 220px;
}

.widget-drawer-item:active {
  cursor: grabbing;
}

.widget-drawer-item:hover,
.widget-drawer-item:focus-within {
  border-color: #b9d8f8;
  box-shadow: 0 24px 54px rgba(30, 45, 65, 0.16);
  transform: translateY(-2px);
}

.widget-preview {
  position: relative;
  display: grid;
  min-height: 140px;
  overflow: hidden;
  background: linear-gradient(135deg, #f8fbff 0%, #dfeaf4 100%);
  border: 1px solid rgba(207, 219, 231, 0.88);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.widget-preview.is-large {
  min-height: 140px;
}

.widget-preview[data-widget-preview="overview"] {
  align-items: end;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  padding: 44px 14px 16px;
  background: linear-gradient(135deg, #17334a 0%, #5e7487 100%);
}

.widget-preview[data-widget-preview="overview"] i {
  display: block;
  height: var(--h);
  min-height: 18px;
  background: linear-gradient(180deg, #70d0ff, #1677ff);
  border-radius: 999px 999px 6px 6px;
}

.widget-preview[data-widget-preview="overview"] svg {
  position: absolute;
  right: 12px;
  bottom: 16px;
  left: 12px;
  width: calc(100% - 24px);
  height: 52px;
  opacity: 0.7;
}

.widget-preview[data-widget-preview="overview"] path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-linecap: round;
  stroke-width: 5;
}

.preview-kpi {
  position: absolute;
  top: 14px;
  left: 14px;
  color: #fff;
  font-size: 28px;
  font-weight: 850;
  line-height: 1;
}

.preview-note-line {
  display: block;
  width: 72%;
  height: 10px;
  margin-left: 16px;
  background: #c9d8e5;
  border-radius: 999px;
}

.preview-note-line.long {
  width: 82%;
  margin-top: 34px;
}

.preview-note-line.short {
  width: 48%;
}

.widget-preview[data-widget-preview="blank"] {
  align-content: center;
  gap: 12px;
  background: linear-gradient(135deg, #f9fbfd 0%, #edf3f8 100%);
}

.widget-preview[data-widget-preview="maps"] {
  place-items: center;
  padding: 0;
  background: #edf5fb;
}

.preview-map-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.preview-geo-water {
  fill: #edf5fb;
}

.preview-geo-shape {
  fill: #d7e3ed;
  stroke: #ffffff;
  stroke-width: 0.9;
}

.preview-map-svg[viewBox="0 0 640 390"] .preview-geo-shape {
  stroke-width: 0.8;
}

.preview-map-loading {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.widget-preview[data-widget-preview="requests"],
.widget-preview[data-widget-preview="clients"],
.widget-preview[data-widget-preview="sources"] {
  align-content: center;
  gap: 10px;
  padding: 16px;
}

.widget-preview b {
  display: block;
  width: var(--w);
  height: 10px;
  background: linear-gradient(90deg, #1677ff, #77b9ff);
  border-radius: 999px;
}

.preview-status {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.preview-status.ok {
  background: #12a150;
}

.preview-status.warn {
  position: absolute;
  top: 16px;
  left: 58px;
  background: #c78205;
}

.preview-status.danger {
  position: absolute;
  top: 16px;
  left: 100px;
  background: #d83b3b;
}

.preview-chip {
  width: max-content;
  padding: 7px 10px;
  color: #0e5ed4;
  background: #e6f2ff;
  border: 1px solid #b9d8f8;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 850;
}

.widget-drawer-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
}

.widget-drawer-item strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.widget-drawer-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.widget-drawer-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.widget-drawer-item button {
  display: grid;
  width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  padding: 0;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.widget-drawer-item button:hover,
.widget-drawer-item button:focus {
  background: #1f6fbf;
  outline: none;
}

.widget-drawer-item.is-widget-active button {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
}

.widget-drawer-item.is-widget-active button:hover,
.widget-drawer-item.is-widget-active button:focus {
  background: #eef4fb;
  border-color: #b9d8f8;
}

.widget-drawer-empty {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.detail-drawer.is-map-drawer .drawer-list {
  padding: 20px;
}

.drawer-map {
  display: grid;
  min-height: 0;
  overflow: visible;
  place-items: center;
}

.drawer-map svg {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: calc(100vh - 150px);
  object-fit: contain;
}

.drawer-map.world-map {
  aspect-ratio: 2 / 1;
}

.drawer-map.china-map {
  aspect-ratio: 640 / 390;
}

.drawer-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.drawer-row[data-filter-field] {
  cursor: pointer;
}

.drawer-row[data-filter-field]:hover {
  border-color: #b9d8f8;
  background: #f3f8fd;
}

.drawer-index {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.drawer-label {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.drawer-row strong {
  color: var(--muted);
  font-size: 13px;
}

.drawer-track {
  grid-column: 2 / -1;
  height: 6px;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: 999px;
}

.drawer-track div {
  height: 100%;
  min-width: 3px;
  background: var(--accent);
  border-radius: inherit;
}

.drawer-action-menu {
  position: fixed;
  z-index: 60;
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 7px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 12px 28px rgba(18, 32, 46, 0.14);
}

.drawer-action-menu button {
  height: 30px;
  padding: 0 8px;
  color: var(--accent);
  text-align: center;
  background: transparent;
  border: 1px solid #cfd9e6;
  border-radius: 0;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.drawer-action-menu button:hover {
  background: #eef6ff;
  border-color: #9fc5ff;
}

.flexible-note-editor {
  display: grid;
  gap: 14px;
}

.flexible-note-editor textarea {
  min-height: 260px;
  width: 100%;
  resize: vertical;
  padding: 14px;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  line-height: 1.7;
}

.flexible-note-editor textarea:focus {
  border-color: #9ec8f5;
  outline: none;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

.flexible-note-editor div {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.flexible-note-editor button {
  min-height: 38px;
  padding: 0 14px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-weight: 800;
}

.flexible-note-editor button[type="button"] {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.flexible-note-editor button:hover,
.flexible-note-editor button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

@keyframes drawerFadeIn {
  from {
    visibility: visible;
  }
  to {
    visibility: visible;
  }
}

@keyframes drawerFadeOut {
  from {
    visibility: visible;
  }
  to {
    visibility: visible;
  }
}

@keyframes backdropFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes backdropFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes drawerSlideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes drawerSlideOut {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

.empty-cell {
  display: grid;
  height: 170px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .hero-banner {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-drop {
    min-height: 360px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .stats-grid,
  .insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .insight-grid > .panel:not(.wide):not(.map-panel) {
    grid-column: span 1;
  }

  .insight-grid > .panel.trend-panel-2 {
    grid-column: span 2;
  }

  .insight-grid > .panel.global-map-panel,
  .insight-grid > .panel.china-map-panel {
    grid-column: 1 / -1 !important;
  }

  .insight-grid > .panel.global-map-panel-2 {
    grid-column: span 2 !important;
  }

  .insight-grid > .panel.map-panel-1 {
    grid-column: span 1 !important;
  }

  .insight-grid > .panel.map-panel-2 {
    grid-column: span 2 !important;
  }

  .china-map {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  :root {
    --insight-card-height: 360px;
  }

  .welcome-view {
    padding: 18px;
  }

  .hero-banner {
    gap: 26px;
  }

  .hero-copy h1 {
    font-size: 42px;
  }

  .hero-drop {
    min-height: 300px;
    padding: 16px;
  }

  .feature-strip {
    grid-template-columns: 1fr;
  }

  .dashboard,
  .sidebar {
    padding: 18px;
  }

  .stats-grid,
  .insight-grid,
  .panel.wide,
  .panel.map-panel,
  .panel.global-map-panel,
  .panel.global-source-panel,
  .panel.china-map-panel,
  .panel.china-source-panel,
  .insight-grid > .panel:not(.wide):not(.map-panel) {
    display: grid;
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .trend-chart {
    height: auto;
  }

  .insight-grid > .trend-panel {
    display: flex;
  }

  .control-group.two-col {
    grid-template-columns: 1fr;
  }

  .filter-editor {
    grid-template-columns: 1fr;
  }

  .filter-time-range {
    grid-template-columns: 1fr;
  }

  .file-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .source-map {
    height: auto;
  }

  .widget-drawer .drawer-panel {
    width: 100%;
    min-width: 100%;
  }

  .widget-drawer-list {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .widget-drawer-items {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .widget-drawer-item,
  .widget-drawer-item.is-medium,
  .widget-drawer-item.is-large {
    grid-column: auto;
  }

  .widget-drawer-item,
  .widget-drawer-item.is-medium {
    min-height: 220px;
  }

  .widget-drawer-item.is-large {
    min-height: 220px;
  }

  .widget-preview.is-large {
    min-height: 140px;
  }

  .widget-drawer-categories {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
