:root {
  color-scheme: dark;
  --bg: #0d1017;
  --bg-deep: #0b0e14;
  --panel: #131721;
  --panel-2: #1a1f29;
  --panel-border: rgba(57, 186, 230, 0.08);
  --panel-border-hover: rgba(57, 186, 230, 0.25);
  --text: #bfbdb6;
  --muted: #565b66;
  --accent: #39bae6;
  --accent-dim: rgba(57, 186, 230, 0.12);
  --accent-glow: rgba(57, 186, 230, 0.35);
  --good: #7ee787;
  --good-glow: rgba(126, 231, 135, 0.3);
  --warn: #f2d5cf;
  --warn-glow: rgba(242, 213, 207, 0.3);
  --bad: #f26d78;
  --bad-glow: rgba(242, 109, 120, 0.3);
  --line: rgba(255, 255, 255, 0.04);
  --card-bg: linear-gradient(165deg, rgba(26, 31, 41, 0.9), rgba(19, 23, 33, 0.95));
  --radius: 14px;
  --radius-sm: 10px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Animated Background Mesh ── */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 900px 600px at 15% 10%, rgba(57, 186, 230, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 700px 500px at 85% 80%, rgba(126, 231, 135, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse 500px 400px at 50% 50%, rgba(57, 186, 230, 0.02) 0%, transparent 70%);
  animation: meshDrift 20s ease-in-out infinite alternate;
}

@keyframes meshDrift {
  0% {
    background-position: 0% 0%, 100% 100%, 50% 50%;
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
  100% {
    background-position: 5% 10%, 90% 85%, 55% 45%;
    opacity: 0.8;
  }
}

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── App Container ── */
.app {
  max-width: 1260px;
  margin: 0 auto;
  padding: 32px 28px 48px;
}

/* ── Header ── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: 28px;
  padding-bottom: 24px;
  position: relative;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 20%, var(--accent) 80%, transparent);
  opacity: 0.3;
}

.header-glow {
  position: absolute;
  bottom: -4px;
  left: 10%;
  right: 10%;
  height: 8px;
  background: var(--accent);
  filter: blur(12px);
  opacity: 0.15;
  pointer-events: none;
}

.header-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(0, 212, 255, 0.15);
  padding: 4px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #a0c4ff 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.15;
}

.subtitle {
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.2px;
}

/* ── Error Banner ── */
.error-banner {
  margin: var(--space-2) 0 0;
  color: #ffb0b0;
  background: rgba(255, 64, 96, 0.1);
  border: 1px solid rgba(255, 64, 96, 0.25);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  max-width: 780px;
  font-size: 13px;
  backdrop-filter: blur(8px);
}

.hidden {
  display: none;
}

/* ── Live Status ── */
.status-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.moscow-time {
  font-size: 12px;
  letter-spacing: 0.2px;
  color: #9ec7ff;
  background: rgba(158, 199, 255, 0.08);
  border: 1px solid rgba(158, 199, 255, 0.16);
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 0 20px rgba(0, 122, 255, 0.06);
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 8px var(--warn-glow);
  animation: dotPulse 2s ease-in-out infinite;
  position: relative;
}

.live-dot.online {
  background: var(--good);
  box-shadow: 0 0 8px var(--good-glow), 0 0 20px var(--good-glow);
  animation: dotPulseOnline 1.5s ease-in-out infinite;
}

.live-dot.offline {
  background: var(--bad);
  box-shadow: 0 0 8px var(--bad-glow);
  animation: dotPulseOffline 1s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

@keyframes dotPulseOnline {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 8px var(--good-glow), 0 0 20px var(--good-glow);
  }
  50% {
    opacity: 0.7;
    transform: scale(0.9);
    box-shadow: 0 0 4px var(--good-glow), 0 0 30px var(--good-glow);
  }
}

@keyframes dotPulseOffline {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

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

.tab-nav {
  display: inline-flex;
  gap: 8px;
  margin: 0 0 18px;
  padding: 4px;
  background: var(--panel);
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
}

.tab-btn {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  background: var(--card-bg);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tab-content {
  width: 100%;
}

.ohmy-wrap {
  padding: 18px 20px 20px;
}

.ohmy-hint {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: var(--space-2);
}

.ohmy-hint.is-error {
  color: var(--bad);
}

.ohmy-plan-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: grid;
  gap: 8px;
}

.ohmy-plan-step {
  background: rgba(57, 186, 230, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
}

.ohmy-plan-step.done {
  border-color: rgba(126, 231, 135, 0.25);
  background: rgba(126, 231, 135, 0.07);
}

.cliproxy-panel {
  border-left: 3px solid rgba(255, 165, 0, 0.4);
}

.cliproxy-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.cliproxy-daily-section {
  margin-bottom: 16px;
}

.cliproxy-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--panel-border);
  font-size: 12px;
  color: var(--muted);
}

.panel-header-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: capitalize;
}

.source-oh-my {
  color: #9ec7ff;
  background: rgba(158, 199, 255, 0.12);
  border: 1px solid rgba(158, 199, 255, 0.22);
}

.source-heph {
  color: #7ee787;
  background: rgba(126, 231, 135, 0.12);
  border: 1px solid rgba(126, 231, 135, 0.22);
}

/* ── Card ── */
.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.25s ease;
  animation: cardEntrance 0.6s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card:hover {
  border-color: var(--panel-border-hover);
  box-shadow:
    0 4px 24px rgba(0, 212, 255, 0.06),
    0 0 0 1px rgba(0, 212, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transform: translateY(-2px);
}

.card-hero {
  border-color: rgba(0, 212, 255, 0.12);
}

.card-hero:hover {
  border-color: rgba(0, 212, 255, 0.3);
  box-shadow:
    0 4px 32px rgba(0, 212, 255, 0.1),
    0 0 0 1px rgba(0, 212, 255, 0.08);
}

.card-inner {
  position: relative;
  z-index: 1;
  padding: 20px 22px;
}

.metric-grid .card-inner,
.summary-grid .card-inner {
  padding: 16px 18px;
}

.metric-grid .card,
.summary-grid .card {
  min-height: 116px;
}

.metric-grid .label,
.summary-grid .label {
  font-size: 11px;
  letter-spacing: 0.28px;
}

.metric-grid .value,
.summary-grid .value {
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.1;
}

.metric-grid .value.small,
.summary-grid .value.small {
  font-size: 15px;
}

.card-shine {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06) 30%, rgba(255, 255, 255, 0.06) 70%, transparent);
}

.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.35px;
  text-transform: uppercase;
}

.value {
  margin-top: 10px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.value.small {
  font-size: 18px;
  font-weight: 600;
}

/* ── Panels ── */
.panel {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: var(--space-3);
  overflow: hidden;
  animation: cardEntrance 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.35s backwards;
}

.panel:last-of-type {
  animation-delay: 0.45s;
}

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

.panel-accent {
  width: 3px;
  height: 18px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text);
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  padding: 0 8px 8px;
}

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

th, td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.35px;
  text-transform: uppercase;
}

td {
  font-weight: 500;
}

tbody tr {
  transition: background 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

tbody tr:hover {
  background: rgba(0, 212, 255, 0.025);
  box-shadow: inset 3px 0 0 var(--accent);
}

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

.empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 14px;
  font-style: normal;
}

/* ── TPS Classes ── */
.tps-good {
  color: var(--good);
  font-weight: 700;
  text-shadow: 0 0 12px var(--good-glow);
}

.tps-warn {
  color: var(--warn);
  font-weight: 700;
  text-shadow: 0 0 12px var(--warn-glow);
}

.tps-bad {
  color: var(--bad);
  font-weight: 700;
  text-shadow: 0 0 12px var(--bad-glow);
}

/* ── Bar Chart ── */
.bar {
  font-family: 'Outfit', system-ui, sans-serif;
  letter-spacing: -1px;
  font-size: 14px;
}

.bar.tps-good {
  text-shadow: 0 0 8px var(--good-glow);
}

.bar.tps-warn {
  text-shadow: 0 0 8px var(--warn-glow);
}

.bar.tps-bad {
  text-shadow: 0 0 8px var(--bad-glow);
}

/* ── Footer ── */
.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 24px 0 0;
  color: var(--muted);
  font-size: 12px;
  opacity: 0.5;
}

.footer-dot {
  color: var(--accent);
}

/* ── Responsive ── */

.compact-panel {
  margin-bottom: 12px;
  border-left: none;
}

.compact-panel .panel-header {
  padding: 12px 2px 10px;
  border-bottom: none;
  justify-content: space-between;
}

.compact-panel .panel-title {
  font-size: 14px;
}

.compact-panel .panel-accent {
  height: 16px;
}

.compact-section {
  margin-bottom: 8px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.35px;
  margin-bottom: 12px;
  padding-left: 4px;
}

.compact-panel .section-title {
  font-size: 11px;
  margin-bottom: 8px;
  padding-left: 0;
}

.anthropic-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
  font-size: 12px;
  color: var(--muted);
}

.compact-panel .anthropic-footer {
  margin-top: 8px;
  padding-top: 8px;
  font-size: 11px;
}

.updated-label {
  font-weight: 500;
}

.updated-time {
  color: var(--text);
  font-weight: 500;
}

.anthropic-grid,
.compact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

  .tab-nav {
    width: 100%;
  }

  .tab-btn {
    flex: 1;
    text-align: center;
  }

  .app {
    padding: 20px 16px 36px;
  }

  h1 {
    font-size: 28px;
  }
}

@media (max-width: 650px) {
  .anthropic-grid { grid-template-columns: 1fr; }
  .compact-grid { grid-template-columns: 1fr; }
  .metric-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }

  .header {
    flex-direction: column;
    gap: 12px;
  }

  .value {
    font-size: 24px;
  }

  th, td {
    padding: 9px 10px;
    font-size: 12px;
  }
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 212, 255, 0.3);
}

/* ── Selection ── */
::selection {
  background: rgba(0, 212, 255, 0.25);
  color: #fff;
}
