:root {
  --bg: #08090d;
  --surface:#0f1014;
  --surface-raised: #16171d;
  --surface-hover: #1c1e26;
  --border: #2a2d38;
  --border-strong: #353945;
  --text:  #ececf1;
  --text-secondary: #a0a3b0;
  --text-tertiary: #6b6f7e;

  --accent:  #5b7fff;
  --accent-hover: #4a6ef5;
  --accent-text:#ffffff;

  --green: #4ade80;
  --green-bg: rgba(74, 222, 128, 0.08);

  --red: #f87171;
  --red-bg:rgba(248, 113, 113, 0.08);

  --yellow:#fbbf24;
  --yellow-bg: rgba(251, 191, 36, 0.08);

  --radius-sm:8px;
  --radius: 12px;

  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

html {
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.55;
  min-height: 100vh;
}

#app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 0 80px;
}

.hidden {
  display: none !important;
}

.state-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 60vh;
  color: var(--text-tertiary);
  font-size: 14px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--surface-raised);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.error-icon {
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--red);
  background: var(--red-bg);
}

#error h2 {
  font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -0.01em;

}
#error p {

  color: var(--text-secondary); font-size: 13.5px; max-width: 360px; text-align: center;
  line-height: 1.6;
}

.dump-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  gap: 10px;
}

.hbtn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-secondary);
}

.hbtn-accent {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.stats-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  margin: 0 28px 28px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 12px 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 0;
  flex: 1 1 0;
}

.stat-label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 0 28px 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 18px;
  background: var(--surface-raised);
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  gap: 12px;
  font-family: var(--font);
}

.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.panel-chevron {
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel.collapsed .panel-chevron {
  transform: rotate(-90deg);
}

.panel.collapsed .panel-body {
  display: none;
}

.panel-body {
  padding: 16px 18px;
}

.kv-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 8px 16px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.kv-row:last-child {
  border-bottom: none;
}

.kv-k {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-tertiary);
  font-weight: 400;
  line-height: 1.4;
}

.kv-v {
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.4;
}

.val {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.detail {
  font-size: 11.5px;
  color: var(--text-tertiary);
  font-style: italic;
}

.subsection-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin: 18px 0 10px;
}

.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}

.tbl thead th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  text-align: left;
  padding: 0 10px 10px;
  border-bottom: 1.5px solid var(--border-strong);
}

.tbl tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 11.5px;
  vertical-align: middle;
}

.tbl tbody tr:last-child td { border-bottom: none; }


.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 6px;
  line-height: 1.4;
}

.badge-green  {
  color: var(--green); background: var(--green-bg);
}

.badge-red    {
  color: var(--red); background: var(--red-bg);
}
.badge-yellow {
  color: var(--yellow); background: var(--yellow-bg);
}
.badge-muted  {
  color: var(--text-tertiary); background: rgba(107, 111, 126, 0.08); font-weight: 600;
}

.cfg-root {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.8;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  overflow-x: auto;
}

.cfg-line {
  display: block;
}
.cfg-key  {
  color: #7eb3f7; font-weight: 500;
}

.cfg-sep  {
  color: var(--text-tertiary);
}
.cfg-str  {
  color: #a3d9a5;
}
.cfg-num  {
  color: #e2c08d;
}
.cfg-bool {
  color: #7eb3f7;
}
.cfg-null {
  color: var(--text-tertiary); font-style: italic;
}
.cfg-empty {
  color: var(--text-tertiary);
}
.cfg-dash {
  color: var(--text-tertiary); margin-right: 6px;
}

.error-note {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 12px;
  font-family: var(--mono);
  background: var(--red-bg);
}

.empty {
  color: var(--text-tertiary);
  font-size: 13px;
  font-style: italic;
  padding: 8px 0;
}

.dump-footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin: 52px 28px 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-weight: 500;
  letter-spacing: 0.02em;
}

#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 9999;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

::-webkit-scrollbar {
  width: 8px; height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 4px;
}

@media (max-width: 860px) {
  .grid-2 {
    grid-template-columns: 1fr;

  }
  .stats-bar {
    flex-wrap: wrap;
  }
  .stat-box {
    flex: 1 1 calc(25% - 10px); min-width: 120px;
  }
}

@media (max-width: 640px) {
  .dump-header {
    padding: 16px 18px; flex-direction: column; gap: 12px; align-items: stretch;
  }
  .header-right {
    justify-content: center;
  }

  .stats-bar {
    margin: 0 16px 24px;
  }
  .grid-2 {
    margin: 0 16px 20px;
  }
  .dump-footer {
    margin: 40px 16px 0;
  }

  .stat-box {
    flex: 1 1 calc(50% - 10px);
  }

  .kv-row {
    grid-template-columns: 1fr; gap: 3px;
  }


  .tbl thead th, .tbl tbody td {
    padding: 7px 10px;
  }
}