:root {
  --bg: #111827;
  --ink: #f5e9c8;
  --muted: #b9a57e;
  --paper: #1b2434;
  --panel: #121a27;
  --line: #8b6a33;
  --blue: #87b8e8;
  --blue-2: #223a55;
  --gold: #d3a341;
  --red: #e07a5f;
  --green: #77b48a;
  --shadow: 0 16px 36px rgba(0, 0, 0, .42);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  background:
    radial-gradient(circle at 18px 18px, rgba(211, 163, 65, .11) 2px, transparent 2px) 0 0 / 34px 34px,
    linear-gradient(135deg, #0c111b, var(--bg));
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 14px;
  background: linear-gradient(180deg, #182235, #101723);
  border-right: 1px solid #5f4824;
  box-shadow: 8px 0 30px rgba(0, 0, 0, .3);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(160deg, #497da8, #15324b);
  border: 2px solid var(--gold);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25), 0 4px 14px rgba(28,40,55,.25);
}

h1, h2, h3 { margin: 0; letter-spacing: 0; }

.brand h1 {
  font-size: 16px;
  color: #d8ecff;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.dropzone {
  display: block;
  padding: 12px;
  border: 2px dashed #977040;
  background: rgba(18, 26, 39, .8);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 12px;
}

.server-picker {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.server-picker span {
  color: #d2b46f;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 800;
}

.server-picker select {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0e1520;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.server-picker select:focus {
  outline: 2px solid rgba(135, 184, 232, .45);
  outline-offset: 1px;
}

.dropzone input { display: none; }
.dropzone span { display: block; font-weight: 800; color: var(--red); }
.dropzone small { color: var(--muted); }
.dropzone.dragging,
.dropzone.uploading {
  border-color: var(--blue);
  background: rgba(34, 58, 85, .82);
}
.dropzone.error {
  border-color: var(--red);
}

.nav {
  display: grid;
  gap: 7px;
}

.nav button {
  text-align: left;
  border: 1px solid #4e7ca5;
  background: linear-gradient(#264a68, #172c42);
  color: white;
  padding: 8px 10px;
  border-radius: 7px;
  font-weight: 800;
  cursor: pointer;
}

.nav button.active {
  background: linear-gradient(#d4a344, #8f6321);
  color: #140f0a;
  border-color: #e6c575;
}

.app {
  padding: 14px;
  min-width: 0;
}

.hero-window,
.panel {
  background: linear-gradient(180deg, var(--paper), #151e2d);
  border: 1px solid #8d6630;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-window {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 88px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--red);
  font-weight: 850;
  text-transform: uppercase;
  font-size: 11px;
}

.hero-window h2 {
  font-size: 23px;
}

.hero-window p {
  margin-bottom: 0;
}

.hero-stamp {
  min-width: 96px;
  text-align: center;
  padding: 9px;
  color: #fff;
  background: #193a59;
  border: 1px solid #d8b76c;
  border-radius: 8px;
  font-weight: 850;
}

.view { display: none; }
.view.active { display: block; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}

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

.panel {
  padding: 10px;
  margin-bottom: 10px;
}

.panel h3 {
  color: var(--blue);
  margin-bottom: 8px;
  font-size: 16px;
}

.compact-panel {
  padding: 8px 10px;
}

.compact-panel h3 {
  margin-bottom: 6px;
  font-size: 14px;
}

.compact-panel .grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.compact-panel .stat-card {
  min-height: 52px;
  padding: 7px 9px;
}

.compact-panel .stat-value {
  font-size: 15px;
}

.stat-card {
  min-height: 66px;
  padding: 9px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat-label {
  color: #d2b46f;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 800;
}

.stat-value {
  margin-top: 4px;
  font-size: 17px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.stat-sub {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.table-panel {
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.filter {
  width: min(360px, 100%);
  margin-bottom: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0e1520;
  color: var(--ink);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th, td {
  padding: 5px 8px;
  border-bottom: 1px solid #2b3545;
  text-align: left;
  vertical-align: top;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, .025);
}

tbody tr:hover {
  background: rgba(135, 184, 232, .1);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--blue-2);
  color: #d8ecff;
  text-transform: uppercase;
  font-size: 11px;
  user-select: none;
}

th.sortable {
  cursor: pointer;
}

th.sortable::after {
  content: "<>";
  float: right;
  color: #c8a75c;
  font-size: 10px;
  margin-left: 8px;
}

th.sort-asc::after {
  content: "^";
}

th.sort-desc::after {
  content: "v";
}

.pill {
  display: inline-block;
  padding: 2px 7px;
  background: #ebf5ff;
  border: 1px solid #98bad5;
  border-radius: 999px;
  color: #1c496a;
  font-size: 12px;
  font-weight: 700;
}

.with-raw-id {
  cursor: help;
}

.raw-id {
  display: none;
  margin-left: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.with-raw-id:hover .raw-id,
.with-raw-id:focus .raw-id {
  display: inline;
}

.empty {
  padding: 10px;
  color: var(--muted);
}

.raw {
  max-height: 70vh;
  overflow: auto;
  padding: 10px;
  background: #080d14;
  color: #f4dfb3;
  border-radius: 8px;
  font-size: 11px;
}

@media (max-width: 920px) {
  body { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 2px solid #9b743b;
  }
  .two-col { grid-template-columns: 1fr; }
  .hero-window { align-items: flex-start; flex-direction: column; }
}
