/* Sensoria VK Mini App — iOS 26 style */
@supports (padding: max(0px)) {
  :root {
    --safe-top: max(env(safe-area-inset-top), 12px);
    --safe-bottom: max(env(safe-area-inset-bottom), 12px);
    --safe-left: max(env(safe-area-inset-left), 12px);
    --safe-right: max(env(safe-area-inset-right), 12px);
  }
}

:root {
  --sensoria-accent: #6366f1;
  --sensoria-accent-dark: #4f46e5;
  --sensoria-glow: rgba(99, 102, 241, 0.3);
  --bg-primary: #0a0a0b;
  --bg-secondary: #141416;
  --bg-card: #1c1c1e;
  --bg-elevated: #2c2c2e;
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #6e6e73;
  --border: rgba(255, 255, 255, 0.08);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  padding-bottom: var(--safe-bottom, 24px);
}

.hidden { display: none !important; }

/* Header — Sensoria branding */
.header {
  position: relative;
  padding: var(--safe-top, 20px) 20px 28px;
  overflow: hidden;
}

.header-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--sensoria-accent) 0%, transparent 70%);
  opacity: 0.15;
}

.header-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.logo-icon {
  font-size: 36px;
  color: var(--sensoria-accent);
  text-shadow: 0 0 24px var(--sensoria-glow);
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.logo-text {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sublabel {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Main */
.main {
  padding: 0 16px;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--sensoria-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 0 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex-shrink: 0;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.tab:hover, .tab.active {
  background: var(--sensoria-accent);
  color: #fff;
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

.tab-admin {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.tab-admin.active {
  background: #ef4444;
  color: #fff;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.card h2 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Stats */
.stats-grid {
  display: grid;
  gap: 12px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.stat-label { color: var(--text-secondary); font-size: 14px; }
.stat-value { font-weight: 600; font-size: 16px; }

.stat-row.warns {
  border-left: 4px solid #f59e0b;
}

.stat-row.promo {
  border-left: 4px solid var(--sensoria-accent);
}

/* Punishments */
.punishments-info {
  text-align: center;
  padding: 24px;
}

.punishments-info .big {
  font-size: 48px;
  font-weight: 700;
  color: var(--sensoria-accent);
}

/* Top list */
.top-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.top-rank {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sensoria-accent);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.top-item:nth-child(1) .top-rank { background: #fbbf24; color: #000; }
.top-item:nth-child(2) .top-rank { background: #94a3b8; color: #fff; }
.top-item:nth-child(3) .top-rank { background: #b45309; color: #fff; }

.top-nick { flex: 1; font-weight: 500; }
.top-count { color: var(--text-secondary); }

/* Proverka */
.proverka-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

.proverka-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.proverka-item {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--sensoria-accent);
}

.proverka-role { font-size: 11px; color: var(--sensoria-accent); text-transform: uppercase; margin-bottom: 4px; }
.proverka-nick { font-weight: 600; }

/* Admin */
.admin-warn-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.admin-warn-form .input {
  min-width: 140px;
}

.admin-table-wrap {
  overflow-x: auto;
  margin: -4px 0;
}

.admin-table {
  width: 100%;
  min-width: 400px;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}

.admin-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 16px;
}

.input::placeholder { color: var(--text-tertiary); }

.btn {
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-negative {
  background: #ef4444;
  color: #fff;
}

.btn-negative:active { opacity: 0.9; }

.admin-staff-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.admin-staff-item:last-child { border-bottom: none; }

.staff-warns {
  color: #f59e0b;
  font-weight: 600;
}

/* Analytics */
.analytics-chart {
  margin-bottom: 20px;
}

.analytics-bar {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.analytics-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sensoria-accent), #818cf8);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.analytics-day {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

.error {
  text-align: center;
  padding: 40px 20px;
  color: #f87171;
}

.error p { margin: 0; }
