:root {
  --bg: #0f1419;
  --panel: #1a222d;
  --border: #2a3544;
  --text: #e7edf5;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --accent-dim: #2657a3;
  --danger-bg: #3d1f24;
  --danger-border: #6b2d35;
  --radius: 10px;
  --font: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1a2840, var(--bg));
  color: var(--text);
  line-height: 1.5;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.health {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: #f0c4c8;
  font-size: 0.9rem;
}

.banner.hidden,
.hidden {
  display: none !important;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.toolbar-full {
  flex: 1 1 100%;
}

.excel-field .excel-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  max-width: 52rem;
}

.excel-field .excel-hint strong {
  color: var(--text);
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 140px;
}

.field.grow {
  flex: 1 1 220px;
  min-width: 200px;
}

.field.narrow {
  min-width: 90px;
}

.label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

input,
select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
}

input:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.meta {
  margin: 0.5rem 0 0.75rem;
  min-height: 1.25rem;
}

.muted {
  color: var(--muted);
}

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

.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}

.grid th,
.grid td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.grid th {
  background: #141c26;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.grid tbody tr:hover td {
  background: rgba(61, 139, 253, 0.06);
}

.col-n {
  width: 25%;
  font-variant-numeric: tabular-nums;
}

.col-src {
  width: 25%;
}

tbody td:first-child {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.btn {
  font: inherit;
  cursor: pointer;
  color: var(--text);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.45rem 1rem;
}

.btn:hover:not(:disabled) {
  background: var(--accent);
}

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

.empty-row td {
  color: var(--muted);
  text-align: center;
  padding: 2rem;
}

.field.actions {
  min-width: 200px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(61, 139, 253, 0.12);
  color: var(--text);
  border-color: var(--accent);
}

.btn-small {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.jump {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.jump input {
  width: 5rem;
  padding: 0.4rem 0.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

mark.hl {
  background: rgba(61, 139, 253, 0.35);
  color: var(--text);
  padding: 0 0.1em;
  border-radius: 3px;
}

tr.row-click {
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.6rem 1rem;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 50;
}

.toast.hidden {
  display: none;
}
