:root {
  color-scheme: dark;
  --bg: #111413;
  --sidebar: #171b19;
  --panel: #f4f0e8;
  --panel-muted: #e6e0d4;
  --text: #f5f1e9;
  --ink: #1b1d1a;
  --muted: #9ba39d;
  --muted-ink: #686f68;
  --line: rgba(255, 255, 255, 0.1);
  --panel-line: rgba(27, 29, 26, 0.12);
  --green: #74d17a;
  --green-dark: #26733c;
  --yellow: #f4c86a;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--green);
  color: #07100a;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(116, 209, 122, 0.12);
  color: var(--text);
}

.nav-icon {
  color: var(--green);
  width: 18px;
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.sidebar-note span,
.sidebar-note strong {
  display: block;
}

.sidebar-note span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.sidebar-note strong {
  font-size: 13px;
}

.main {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: 0;
}

.topbar p,
.panel-header p,
.auth-panel p {
  color: var(--muted);
  margin-top: 7px;
}

.refresh-button,
.token-form button {
  border: 0;
  border-radius: var(--radius);
  background: var(--green);
  color: #07100a;
  font-weight: 800;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
}

.auth-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.auth-panel h2,
.panel h2 {
  font-size: 18px;
}

.token-form {
  display: flex;
  gap: 10px;
  min-width: min(460px, 100%);
}

.token-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  min-height: 42px;
  padding: 0 12px;
  outline: none;
}

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

.metric,
.panel {
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
  min-height: 104px;
}

.metric span {
  color: var(--muted-ink);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  font-size: 34px;
  line-height: 1;
  margin-top: 18px;
}

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

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-header p {
  color: var(--muted-ink);
  font-size: 14px;
}

.date-pill {
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  color: var(--muted-ink);
  font-size: 12px;
  font-weight: 800;
  padding: 7px 9px;
}

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

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 760px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--panel-line);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted-ink);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.user-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.status.premium {
  background: rgba(38, 115, 60, 0.14);
  color: var(--green-dark);
}

.status.free {
  background: rgba(27, 29, 26, 0.08);
  color: var(--muted-ink);
}

.empty-cell {
  color: var(--muted-ink);
  text-align: center;
  padding: 34px;
}

.health-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.health-list div {
  border-bottom: 1px solid var(--panel-line);
  padding-bottom: 12px;
}

.health-list dt {
  color: var(--muted-ink);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.health-list dd {
  margin: 5px 0 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.message {
  margin-top: 18px;
  border-radius: var(--radius);
  background: var(--panel-muted);
  color: var(--muted-ink);
  padding: 12px;
  font-size: 14px;
  line-height: 1.4;
}

.message.ok {
  color: var(--green-dark);
}

.message.error {
  color: #a33434;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-note {
    display: none;
  }

  .status-row,
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .auth-panel,
  .token-form {
    flex-direction: column;
    align-items: stretch;
  }

  h1 {
    font-size: 27px;
  }
}
