:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #657181;
  --line: #dfe5ec;
  --blue: #2563eb;
  --green: #12805c;
  --amber: #a15c00;
  --red: #bd2c2c;
  --shadow: 0 12px 30px rgba(28, 38, 52, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}
h1, h2, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 18px; display: flex; align-items: center; gap: 10px; }
main { width: min(1220px, calc(100% - 32px)); margin: 22px auto 50px; }
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 32px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.top-actions, .period-form, .config-form, .row-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}
.period-form {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.eyebrow {
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.muted { color: var(--muted); font-size: 13px; }
code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
textarea { padding: 12px; }
label {
  display: grid;
  gap: 6px;
  min-width: 190px;
  flex: 1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
label.wide { flex: 2 1 360px; }
.button, button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 15px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.button.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.button.danger { border-color: var(--red); color: var(--red); }
.notice, .alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.45;
}
.notice { border: 1px solid #c7d2fe; background: #eef2ff; color: #26376f; }
.alert { border: 1px solid #fecaca; background: #fff1f2; color: #9f1239; }
.alert.small { margin: 0; font-size: 12px; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.metric {
  min-height: 94px;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.metric.ok { border-left-color: var(--green); }
.metric.warn { border-left-color: var(--amber); }
.metric.bad { border-left-color: var(--red); }
.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 24px;
}
.panel {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.box-number {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #eaf0ff;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}
.token-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.token-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  display: grid;
  gap: 12px;
}
.token-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.token-head span { color: var(--muted); font-size: 12px; }
.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.mini-grid span {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.mini-grid strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 15px;
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
}
th, td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}
th {
  background: #f1f4f8;
  color: #44505e;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}
th[data-direction="desc"]::after { content: " v"; color: var(--blue); }
th[data-direction="asc"]::after { content: " ^"; color: var(--blue); }
tbody tr:last-child td { border-bottom: 0; }
.pill {
  display: inline-flex;
  min-width: 88px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}
.pill.active { background: #e3f5ee; color: var(--green); }
.pill.warning { background: #fff1d9; color: var(--amber); }
.pill.blocked { background: #fde8e8; color: var(--red); }
.empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}
.search { max-width: 320px; }
.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(560px, 100%);
  margin: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
@media (max-width: 900px) {
  .topbar, .panel-title { flex-direction: column; }
  .metric-grid, .token-grid { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { max-width: none; }
}
