:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  color: #182238;
  background: #f4f7fc;
  font-synthesis: none;
  --blue: #3159d8;
  --blue-dark: #2446b6;
  --blue-soft: #eef3ff;
  --line: #dfe6f1;
  --muted: #68758c;
  --surface: #ffffff;
  --danger: #bf3636;
  --success: #16835d;
  --shadow: 0 18px 50px rgba(44, 66, 112, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% -10%, #e8efff 0, transparent 32%),
    #f4f7fc;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(49, 89, 216, 0.24);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.shell {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 28px;
}

.login-layout {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(620px, 100%);
  padding: 52px;
  border: 1px solid rgba(213, 223, 240, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin-bottom: 26px;
  border: 1px solid #d9e2f5;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(50, 78, 133, 0.12);
}

.brand-mark span {
  width: 25px;
  height: 25px;
  border: 5px solid #e04c51;
  border-radius: 50%;
  box-shadow: 0 0 0 5px #eff3fb;
}

.brand-mark.small {
  width: 46px;
  height: 46px;
  margin: 0;
  border-radius: 14px;
}

.brand-mark.small span {
  width: 19px;
  height: 19px;
  border-width: 4px;
  box-shadow: 0 0 0 4px #eff3fb;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.lead {
  max-width: 510px;
  margin: 18px 0 32px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

form label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

.token-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input {
  min-height: 46px;
  border: 1px solid #ccd6e7;
  border-radius: 12px;
  padding: 0 14px;
  color: #1c2941;
  background: #fbfcff;
}

input::placeholder {
  color: #96a1b3;
}

.primary-button,
.secondary-button,
.text-button,
.danger-button {
  min-height: 42px;
  border-radius: 11px;
  padding: 0 16px;
  font-weight: 700;
}

.primary-button {
  border: 1px solid var(--blue);
  color: #fff;
  background: var(--blue);
}

.primary-button:hover {
  background: var(--blue-dark);
}

.secondary-button {
  border: 1px solid #cdd8ec;
  color: #32415d;
  background: var(--surface);
}

.text-button {
  border: 0;
  color: var(--muted);
  background: transparent;
}

.danger-button {
  min-height: 34px;
  border: 1px solid #efc5c5;
  padding: 0 11px;
  color: var(--danger);
  background: #fff8f8;
}

.danger-button:hover {
  border-color: #df9898;
  background: #fff1f1;
}

.form-error {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 13px;
}

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

.brand-lockup,
.header-actions,
.connection-status {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 13px;
}

.brand-lockup h1 {
  font-size: 25px;
}

.header-actions {
  gap: 9px;
}

.connection-status {
  gap: 7px;
  margin-right: 8px;
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
}

.connection-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px #e1f5ed;
}

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

.metric-card {
  min-height: 154px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 25px rgba(54, 77, 122, 0.055);
}

.metric-card.accent {
  border-color: #cdd9f9;
  background: var(--blue-soft);
}

.metric-card p,
.metric-card span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin: 14px 0 10px;
  color: #172139;
  font-size: 31px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.data-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.tabs {
  display: flex;
  gap: 5px;
  padding: 4px;
  border-radius: 12px;
  background: #f1f4f9;
}

.tab {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  padding: 0 17px;
  color: #68758c;
  font-weight: 700;
  background: transparent;
}

.tab.active {
  color: var(--blue);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(41, 61, 101, 0.1);
}

.search-field input {
  width: 230px;
  min-height: 40px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 16px 20px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #738096;
  background: #fbfcfe;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  color: #34425d;
  font-size: 13px;
}

tbody tr:hover {
  background: #fbfcff;
}

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

.mono {
  color: #26344e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 0 9px;
  color: var(--success);
  background: #eaf7f2;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.inactive {
  color: #788397;
  background: #eff2f6;
}

.message-state {
  padding: 46px 20px;
  color: var(--muted);
  text-align: center;
}

.message-state.error {
  color: var(--danger);
}

.empty-row td {
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 4px 0;
  color: #7a869a;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(380px, calc(100% - 44px));
  padding: 13px 16px;
  border: 1px solid #cdd8ec;
  border-radius: 12px;
  color: #25334e;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.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;
}

@media (max-width: 900px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 580px) {
  .shell {
    width: min(100% - 24px, 1220px);
    padding-top: 18px;
  }

  .login-card {
    padding: 30px 22px;
    border-radius: 20px;
  }

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

  .search-field input {
    width: 100%;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
    padding: 0 8px;
  }

  footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
