/* Platform shell — токены, шапка, кнопки, чипы (общие для всех страниц) */

:root {
  --color-surface: #08090c;
  --color-panel: #111318;
  --color-border: #1e2128;
  --color-accent: #0ea5e9;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --header-control-h: 2.125rem;
}

* {
  box-sizing: border-box;
}

body.platform-body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--color-surface);
  color: #8891a0;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

body.platform-body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(14, 165, 233, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

body.platform-body > *:not(.pf-toast):not(.usage-toast):not(.modal-backdrop):not(.chat-chart-fs-backdrop):not(#chat-chart-fs-modal):not(.pf-error-log-backdrop):not(.pf-error-log-launcher):not(.mobile-site-nav):not(.pf-top-progress):not(#ui-tooltip):not(.model-picker-menu):not(.option-picker-menu) {
  position: relative;
  z-index: 1;
}

.header-bar {
  position: relative;
  z-index: 50;
  overflow: visible;
  flex-shrink: 0;
  background: rgba(17, 19, 24, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.platform-header-inner {
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .platform-header-inner {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.header-wrap,
.header-tools,
.header-tools-right {
  overflow: visible;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0 0.75rem;
  min-height: var(--header-control-h);
  font-size: 0.75rem;
  font-weight: 500;
  color: #8891a0;
  border-radius: 8px;
  border: 1px solid #1e2128;
  background: #0c0d11;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.btn-ghost:hover {
  color: #f0f2f5;
  background: rgba(255, 255, 255, 0.04);
  border-color: #262a33;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0 0.75rem;
  min-height: var(--header-control-h);
  font-size: 0.8125rem;
  font-weight: 500;
  color: #fff;
  border-radius: 8px;
  border: 1px solid #0ea5e9;
  background: #0284c7;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary:hover {
  background: #0ea5e9;
}

.filter-toggle-group {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  min-height: var(--header-control-h);
  padding: 0.125rem;
  border-radius: 8px;
  border: 1px solid #1e2128;
  background: #0c0d11;
  flex-wrap: wrap;
}

.filter-chip {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.filter-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.filter-chip input + span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: calc(var(--header-control-h) - 0.25rem);
  padding: 0 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #55606e;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.filter-chip input:checked + span,
.filter-chip input[type="radio"]:checked + span {
  background: rgba(14, 165, 233, 0.12);
  color: #38bdf8;
  border-color: rgba(14, 165, 233, 0.28);
}

.filter-chip:hover input:not(:checked) + span {
  color: #8891a0;
  background: rgba(255, 255, 255, 0.04);
}

.filter-chip input:focus-visible + span {
  outline: none;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25);
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-accent);
}

.btn-ghost.is-busy,
.header-btn.is-busy {
  opacity: 0.65;
  cursor: wait;
  pointer-events: none;
}

.header-btn.is-busy svg {
  animation: platform-spin 0.8s linear infinite;
}

@keyframes platform-spin {
  to { transform: rotate(360deg); }
}

#health-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
}

#health-bar .ml-auto {
  margin-left: auto;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.card {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 16px;
}

.section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #55606e;
  text-transform: uppercase;
}

.stat-tile {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
  border: 1px solid var(--color-border);
  border-radius: 12px;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

.platform-main {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.platform-dev-links {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.625rem;
  font-family: 'JetBrains Mono', monospace;
}

.platform-dev-links a {
  color: #55606e;
  text-decoration: none;
}

.platform-dev-links a:hover {
  color: #8891a0;
}
