* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f1117;
  --surface: #161a23;
  --surface-soft: #11141c;
  --surface-elevated: #1b2130;
  --border: #232838;
  --border-strong: #2f3a52;
  --text: #e5e7eb;
  --text-strong: #f9fafb;
  --muted: #9ca3af;
  --blue: #2563eb;
  --blue-soft: #1d4ed8;
  --green: #22c55e;
  --green-soft: #065f46;
  --yellow: #f59e0b;
  --yellow-soft: #7c4a03;
  --red: #ef4444;
  --red-soft: #7f1d1d;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

html,
body {
  min-height: 100%;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.08), transparent 26%),
    var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a {
  color: #60a5fa;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
select,
input,
textarea {
  font: inherit;
}

.container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  background: rgba(22, 26, 35, 0.96);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  border-radius: 14px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand img {
  height: 42px;
  width: 42px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg);
  padding: 4px;
  border: 1px solid var(--border);
}

.brand .title {
  font-size: 20px;
  color: #fff;
  font-weight: 700;
}

.brand .subtitle {
  font-size: 13px;
  color: var(--muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #1f2433;
  font-size: 12px;
  color: #d1d5db;
  border: 1px solid var(--border);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b7280;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.status-dot.connected {
  background: var(--green);
}

.status-dot.connecting {
  background: #facc15;
}

.status-dot.disconnected {
  background: var(--red);
}

.dashboard-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.global-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.global-stat {
  background: rgba(22, 26, 35, 0.96);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 14px 16px;
  min-width: 0;
}

.global-stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.global-stat-value {
  margin-top: 8px;
  color: var(--text-strong);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  word-break: break-word;
}

.global-stat-detail {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.global-stat.ok {
  border-color: rgba(34, 197, 94, 0.24);
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.1),
    rgba(22, 26, 35, 0.96) 55%
  );
}

.global-stat.warn {
  border-color: rgba(245, 158, 11, 0.24);
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.1),
    rgba(22, 26, 35, 0.96) 55%
  );
}

.global-stat.fail {
  border-color: rgba(239, 68, 68, 0.24);
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.1),
    rgba(22, 26, 35, 0.96) 55%
  );
}

.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(22, 26, 35, 0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: var(--shadow);
}

.tab-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.tab-btn:hover {
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}

.tab-btn.active {
  color: #fff;
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(96, 165, 250, 0.34);
}

.page-intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}

.page-intro h1 {
  font-size: 30px;
  line-height: 1.05;
  color: #fff;
  margin-top: 6px;
}

.page-intro p {
  margin-top: 8px;
  max-width: 760px;
  color: var(--muted);
  font-size: 14px;
}

.page-intro-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.card {
  background: rgba(22, 26, 35, 0.96);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px;
  border-radius: 14px;
  margin-bottom: 18px;
}

.card h2 {
  color: #f3f4f6;
  margin-bottom: 12px;
  font-size: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  font-weight: 600;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
}

.compact-head {
  margin-bottom: 14px;
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  color: #93c5fd;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card-title {
  color: #fff;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 700;
  margin-top: 6px;
}

.card-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-card {
  max-width: 620px;
  margin: 40px auto 0;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.login-btn,
.btn {
  appearance: none;
  border: 0;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition:
    transform 0.16s ease,
    background 0.18s ease,
    opacity 0.18s ease;
}

.login-btn:hover,
.btn:hover {
  transform: translateY(-1px);
}

.login-btn,
.btn {
  background: var(--blue);
  color: white;
}

.login-btn:hover,
.btn:hover {
  background: var(--blue-soft);
}

.btn-secondary {
  background: #1f2937;
  color: #e5e7eb;
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: #273244;
}

.btn-danger {
  background: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
}

.overview-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.overview-primary,
.overview-sidebar,
.reviews-main,
.reviews-side {
  min-width: 0;
}

.reviews-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.65fr);
  gap: 18px;
  align-items: start;
}

.summary-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(35, 40, 56, 0.8);
}

.summary-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.summary-row span {
  color: var(--muted);
  font-size: 13px;
}

.summary-row strong {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

.activity-preview-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-preview-item {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.activity-preview-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.activity-preview-time {
  color: var(--muted);
  font-size: 12px;
}

.activity-preview-title {
  margin-top: 10px;
  font-weight: 600;
  color: #fff;
}

.activity-preview-meta,
.activity-preview-detail {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  word-break: break-word;
}

.review-detail-card {
  overflow: hidden;
}

.review-hero {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
}

.review-hero.tone-good {
  border-color: rgba(34, 197, 94, 0.28);
  background:
    linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.03)),
    rgba(255, 255, 255, 0.01);
}

.review-hero.tone-warn {
  border-color: rgba(245, 158, 11, 0.28);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.03)),
    rgba(255, 255, 255, 0.01);
}

.review-hero.tone-bad {
  border-color: rgba(239, 68, 68, 0.28);
  background:
    linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.03)),
    rgba(255, 255, 255, 0.01);
}

.review-score-panel {
  background: rgba(15, 17, 23, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 16px;
}

.score-caption {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-big {
  font-size: 50px;
  line-height: 1;
  font-weight: 800;
  margin-top: 10px;
  color: #fff;
}

.score-big span {
  font-size: 20px;
  color: var(--muted);
  font-weight: 600;
  margin-left: 4px;
}

.stars {
  display: flex;
  gap: 4px;
  margin-top: 12px;
}

.star {
  color: rgba(255, 255, 255, 0.16);
  font-size: 22px;
}

.star.active {
  color: #fbbf24;
}

.review-outcome {
  margin-top: 14px;
}

.review-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-content: start;
}

.meta-card {
  background: rgba(15, 17, 23, 0.46);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}

.meta-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-value {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-strong);
  font-weight: 600;
  word-break: break-word;
}

.review-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.section-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  min-width: 0;
}

.section-span-2 {
  grid-column: span 2;
}

.section-label {
  color: #cbd5e1;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  font-weight: 700;
}

.text-surface {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 12px;
  color: var(--text);
  white-space: normal;
  word-break: break-word;
}

.text-mono {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.score-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.score-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.score-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: #dbe3f0;
}

.score-value {
  font-weight: 700;
}

.score-value.good {
  color: #86efac;
}

.score-value.warn {
  color: #fcd34d;
}

.score-value.bad {
  color: #fca5a5;
}

.score-bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.score-bar-fill.good {
  background: linear-gradient(90deg, #16a34a, #4ade80);
}

.score-bar-fill.warn {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}

.score-bar-fill.bad {
  background: linear-gradient(90deg, #dc2626, #f87171);
}

.bullet-list {
  margin-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bullet-list li {
  color: var(--text);
}

.review-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 720px;
  overflow: auto;
  padding-right: 2px;
}

.review-history-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.review-history-pagination .muted {
  font-size: 12px;
  text-align: center;
  flex: 1;
}

.btn-small {
  padding: 6px 10px;
  font-size: 12px;
}

.gateway-url-card {
  background: linear-gradient(135deg, rgba(60, 180, 140, 0.08), rgba(60, 140, 200, 0.06));
  border: 1px solid rgba(60, 180, 140, 0.35);
}

.gateway-url-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-strong);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 14px;
  word-break: break-all;
  letter-spacing: 0.3px;
}

.review-history-item {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 12px;
  color: inherit;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    transform 0.16s ease,
    background 0.16s ease;
}

.review-history-item:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.35);
}

.review-history-item.active {
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(37, 99, 235, 0.09);
}

.review-history-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.review-history-title {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.review-history-prompt {
  margin-top: 8px;
  color: #d1d5db;
  font-size: 13px;
  line-height: 1.45;
}

.review-history-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.token-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.token-item {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.token-item-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.token-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.token-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

table.log {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.log th,
table.log td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.log th {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #11141c;
  position: sticky;
  top: 0;
  z-index: 1;
}

table.log tr.started td {
  color: #d1d5db;
}

table.log tr.completed td {
  color: #e5e7eb;
}

table.log tr.failed td {
  color: #fca5a5;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  border: 1px solid transparent;
}

.pill.started {
  background: rgba(30, 58, 138, 0.45);
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.2);
}

.pill.completed,
.pill.ok {
  background: rgba(6, 95, 70, 0.45);
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.22);
}

.pill.failed,
.pill.fail {
  background: rgba(127, 29, 29, 0.5);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.24);
}

.pill.warn {
  background: rgba(124, 74, 3, 0.46);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.24);
}

.pill.neutral {
  background: rgba(75, 85, 99, 0.4);
  color: #d1d5db;
  border-color: rgba(156, 163, 175, 0.2);
}

select,
input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
}

select:focus,
input:focus,
button:focus {
  outline: 2px solid rgba(96, 165, 250, 0.55);
  outline-offset: 2px;
}

.filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.empty,
.empty-copy {
  color: var(--muted);
  font-style: italic;
}

.empty {
  padding: 10px 4px;
}

.empty-copy {
  font-size: 13px;
  line-height: 1.5;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.error {
  background: #7f1d1d;
  color: #fee2e2;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid rgba(248, 113, 113, 0.24);
}

.success {
  background: #14532d;
  color: #dcfce7;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.token-mask {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
}

.log-wrap {
  max-height: 560px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(17, 20, 28, 0.6);
}

.log-wrap-large {
  max-height: 760px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1100px) {
  .overview-main-grid,
  .reviews-layout,
  .review-hero {
    grid-template-columns: 1fr;
  }

  .review-section-grid,
  .review-meta-grid,
  .token-meta-grid {
    grid-template-columns: 1fr;
  }

  .section-span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 760px) {
  .container {
    padding: 14px;
  }

  .header {
    flex-direction: column;
    align-items: start;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .page-intro,
  .card-head,
  .token-item-top {
    flex-direction: column;
    align-items: start;
  }

  .page-intro-actions,
  .card-actions,
  .button-row {
    width: 100%;
  }

  .page-intro-actions .btn,
  .card-actions .btn,
  .button-row .btn,
  .button-row .login-btn {
    width: 100%;
  }

  .score-big {
    font-size: 42px;
  }

  table.log {
    min-width: 920px;
  }

  .tabbar {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .tab-btn {
    white-space: nowrap;
  }
}