:root {
  --bg: #0f0c29;
  --bg-2: rgba(19, 23, 44, 0.88);
  --bg-3: rgba(31, 37, 66, 0.78);
  --border: rgba(143, 154, 208, 0.28);
  --text: #e9eeff;
  --dim: #9da9d4;
  --primary: #64ffda;
  --primary-2: #4facfe;
  --warn: #ff7b72;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(860px 560px at 10% -10%, rgba(79, 172, 254, 0.25), transparent 60%),
    radial-gradient(760px 520px at 90% 0%, rgba(100, 255, 218, 0.15), transparent 62%),
    linear-gradient(135deg, #0f0c29 0%, #1f1b45 45%, #161730 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(16, 21, 40, 0.72);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand span {
  color: var(--primary);
}

.desc {
  margin-top: 4px;
  color: var(--dim);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: rgba(16, 21, 40, 0.72);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.sep {
  width: 1px;
  height: 22px;
  background: var(--border);
}

.status-bar {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(16, 21, 40, 0.68);
}

.status {
  color: var(--dim);
  font-size: 12px;
}

.status.error {
  color: var(--warn);
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

button,
select,
input {
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
}

button {
  height: 36px;
  cursor: pointer;
  border: none;
  font-weight: 600;
  padding: 0 12px;
  background: linear-gradient(90deg, var(--primary-2), var(--primary));
  color: #0f1833;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ghost-btn {
  background: rgba(79, 172, 254, 0.14);
  color: #b9dcff;
  border: 1px solid rgba(79, 172, 254, 0.35);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-name {
  color: var(--dim);
  font-size: 12px;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

select,
.number-input {
  height: 36px;
  padding: 0 10px;
  background: #1d2447cc;
}

.inline-label {
  color: var(--dim);
  font-size: 12px;
}

.number-input {
  width: 90px;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 40%) minmax(380px, 60%);
  gap: 10px;
  padding: 10px;
}

.panel {
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-title {
  padding: 10px 12px;
  font-size: 13px;
  color: #c5d2ff;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 22, 44, 0.85);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
  padding: 10px;
}

.mini-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(12, 18, 40, 0.75);
  padding: 10px;
  min-height: 110px;
}

.mini-label {
  color: var(--dim);
  font-size: 12px;
}

.mini-value {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 700;
  color: #d2e6ff;
}

.mini-list {
  margin: 8px 0 0;
  white-space: pre-wrap;
  color: #bfccf6;
  font-size: 12px;
  max-height: 80px;
  overflow: auto;
}

.mini-note {
  margin-top: 8px;
  color: #bfccf6;
  font-size: 12px;
}

.result-wrap,
.tab-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.detail-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.detail-toolbar select {
  min-width: 180px;
}

.detail-counts {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--dim);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  height: 32px;
  padding: 0 10px;
}

.tab-btn.active {
  background: linear-gradient(90deg, #22c55e, #34d399);
}

.hidden {
  display: none !important;
}

.result-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(8, 12, 28, 0.82);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: max-content;
}

.result-table th,
.result-table td {
  border-bottom: 1px solid rgba(143, 154, 208, 0.2);
  border-right: 1px solid rgba(143, 154, 208, 0.15);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  max-width: 380px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.result-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #192249;
  color: #d9e5ff;
}

.result-empty {
  color: var(--dim);
  font-size: 13px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 780px) {
  .brand {
    font-size: 18px;
  }

  .desc {
    display: none;
  }

  .file-name {
    max-width: 120px;
  }

  .detail-toolbar select {
    min-width: 100%;
  }
}
