* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: #0e1117; color: #e6edf3; min-height: 100vh; }
.app { max-width: 960px; margin: 0 auto; padding: 0 16px; min-height: 100vh; display: flex; flex-direction: column; }

.header { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid #21262d; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 1.25rem; color: #58a6ff; }
.nav { display: flex; gap: 12px; }
.nav a { color: #8b949e; text-decoration: none; }
.nav a:hover { color: #58a6ff; }
.user { margin-left: auto; color: #8b949e; font-size: 0.9rem; }
.main { flex: 1; padding: 24px 0; }

.card { background: #161b22; border: 1px solid #21262d; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.card h2 { margin: 0 0 16px; font-size: 1.1rem; color: #c9d1d9; }
.hint { color: #8b949e; font-size: 0.85rem; margin: 0 0 12px; }
.balance { margin-bottom: 12px; }
.duration-row { display: flex; gap: 8px; align-items: center; }
.duration-row select { width: auto; max-width: 160px; }
.duration-row input { max-width: 100px; }
.key-format-hint { margin: 0 0 8px; font-size: 0.85rem; color: #8b949e; line-height: 1.4; }
.key-format-hint code { background: #21262d; padding: 2px 6px; border-radius: 4px; }
.last-keys-block { margin-top: 12px; }
.last-keys-block .btn { margin-right: 8px; }
.copy-status { margin-top: 6px; font-size: 0.9rem; color: #8b949e; }
.copy-status.error { color: #f85149; }
.page-title { margin: 0 0 20px; font-size: 1.25rem; color: #c9d1d9; }

.monitor-stats .stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 12px; }
.stat-box { background: #0d1117; border: 1px solid #21262d; border-radius: 8px; padding: 12px; text-align: center; }
.stat-value { display: block; font-size: 1.5rem; font-weight: 700; color: #58a6ff; }
.stat-label { font-size: 0.8rem; color: #8b949e; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; }
.badge-ok { background: #238636; color: #fff; }
.badge-danger { background: #da3633; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-danger { background: #da3633; color: #fff; }
.btn-danger:hover { background: #b62324; }
.alert-desc { color: #8b949e; font-size: 0.9rem; margin-bottom: 12px; }

.keys-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.keys-toolbar .checkbox-label { display: inline-flex; align-items: center; gap: 6px; color: #8b949e; font-size: 0.9rem; cursor: pointer; }
.col-check { width: 48px; text-align: center; vertical-align: middle; }
.key-cb, .checkbox-pill { width: 22px; height: 22px; cursor: pointer; }
.keys-table .key-cb { display: block; margin: 0 auto; }
.danger-zone { border-color: #da3633; }
.status-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 8px; vertical-align: middle; box-shadow: 0 0 8px currentColor; }
.status-dot.safe { background: #3fb950; color: #3fb950; }
.status-dot.danger { background: #f85149; color: #f85149; }
.status-dot.blocked { background: #8b949e; color: #8b949e; }
.monitor-reseller-row { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-bottom: 1px solid #21262d; }
.monitor-reseller-row:last-child { border-bottom: none; }
.monitor-reseller-login { font-weight: 600; min-width: 140px; }
.monitor-reseller-status { display: flex; align-items: center; gap: 8px; min-width: 200px; }
.monitor-reseller-actions { margin-left: auto; }
.panel-detail { margin-top: 20px; border: 1px solid #30363d; border-radius: 8px; overflow: hidden; }
.panel-detail-header { background: #0d1117; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.panel-detail-body { padding: 20px; }
.panel-detail-section { margin-bottom: 20px; }
.panel-detail-section h3 { font-size: 0.95rem; color: #8b949e; margin: 0 0 10px; }
.panel-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-monitor { background: #238636; color: #fff; }
.btn-monitor:hover { background: #2ea043; }
.impersonation-banner { color: #f0883e; }
.danger-zone h2 { color: #f85149; }

.form-row { margin-bottom: 12px; }
.form-row label { display: block; margin-bottom: 4px; color: #8b949e; font-size: 0.9rem; }
.form-row input { width: 100%; max-width: 280px; padding: 8px 12px; background: #0d1117; border: 1px solid #30363d; border-radius: 6px; color: #e6edf3; }
.btn { padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; border: none; }
.btn-primary { background: #238636; color: #fff; }
.btn-primary:hover { background: #2ea043; }
.btn-outline { background: transparent; color: #8b949e; border: 1px solid #30363d; }
.btn-outline:hover { color: #c9d1d9; border-color: #8b949e; }
.gen-result { margin-top: 12px; font-family: monospace; font-size: 0.9rem; }
.gen-result.error { color: #f85149; }

.stats-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stats-strip .stat-card { background: #161b22; border: 1px solid #21262d; border-radius: 10px; padding: 16px; text-align: center; }
.stats-strip .stat-card .stat-num { font-size: 1.75rem; font-weight: 700; color: #58a6ff; line-height: 1.2; }
.stats-strip .stat-card .stat-label { font-size: 0.8rem; color: #8b949e; margin-top: 4px; }
.stats-strip .stat-card.online .stat-num { color: #3fb950; }
.stats-strip .stat-card.users .stat-num { color: #a371f7; }
.dashboard-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.dashboard-toolbar .stats-strip { flex: 1; min-width: 300px; }

.activity-feed { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.activity-feed li { padding: 8px 12px; border-bottom: 1px solid #21262d; display: flex; justify-content: space-between; gap: 12px; }
.activity-feed li:last-child { border-bottom: none; }
.activity-feed .at { color: #8b949e; font-size: 0.8rem; white-space: nowrap; }
.chart-bar-wrap { display: flex; align-items: flex-end; gap: 4px; height: 80px; margin-top: 8px; }
.chart-bar-wrap .bar { flex: 1; min-width: 24px; background: #238636; border-radius: 4px 4px 0 0; min-height: 4px; }
.chart-bar-wrap .bar:hover { background: #2ea043; }
.chart-labels { display: flex; gap: 4px; margin-top: 6px; font-size: 0.7rem; color: #8b949e; }
.chart-labels span { flex: 1; min-width: 24px; text-align: center; }
.limit-info { color: #8b949e; font-size: 0.85rem; margin-top: 8px; }

.table-wrap { overflow-x: auto; }
.keys-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.keys-table th, .keys-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #21262d; }
.keys-table th { color: #8b949e; font-weight: 600; }
.keys-table code { font-size: 0.85rem; word-break: break-all; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: #161b22; border: 1px solid #21262d; border-radius: 12px; padding: 32px; width: 100%; max-width: 320px; }
.login-box h1 { margin: 0 0 4px; font-size: 1.5rem; color: #58a6ff; }
.login-box .subtitle { margin: 0 0 20px; color: #8b949e; font-size: 0.9rem; }
.login-box .error { color: #f85149; font-size: 0.9rem; margin-bottom: 12px; }
.login-form input { width: 100%; padding: 10px 12px; margin-bottom: 12px; background: #0d1117; border: 1px solid #30363d; border-radius: 6px; color: #e6edf3; }
.login-form .btn { width: 100%; margin-top: 8px; }

/* ——— Кастомные селект и чекбоксы под тёмный стиль ——— */
.cosmic-select,
.dark-select {
  appearance: none;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  padding: 8px 28px 8px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.cosmic-select:hover,
.dark-select:hover { border-color: #484f58; }
.cosmic-select:focus,
.dark-select:focus { outline: none; border-color: #58a6ff; }

.cosmic-input {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  padding: 8px 12px;
}
.cosmic-input:hover { border-color: #484f58; }
.cosmic-input:focus { outline: none; border-color: #58a6ff; }

.cosmic-cb { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: #8b949e; font-size: 0.9rem; }
.cosmic-checkbox {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid #30363d;
  border-radius: 4px;
  background: #0d1117;
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
}
.cosmic-checkbox:hover { border-color: #484f58; }
input.cosmic-checkbox:checked {
  background: #238636;
  border-color: #2ea043;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23fff' d='M16.7 5.3l-9 9-4-4 1.4-1.4 2.6 2.6 7.6-7.6z'/%3E%3C/svg%3E");
  background-size: 12px;
  background-position: center;
  background-repeat: no-repeat;
}

/* Страница Информация — те же карточки и блоки */
.info-main { padding-top: 16px; }
.info-title { font-size: 1.6rem; color: #c9d1d9; margin: 0 0 4px; font-weight: 700; }
.info-subtitle { color: #8b949e; font-size: 0.9rem; margin: 0 0 24px; }
.cosmic-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.cosmic-stat-card {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}
.cosmic-stat-card .cosmic-num { display: block; font-size: 1.9rem; font-weight: 700; color: #58a6ff; line-height: 1.2; }
.cosmic-stat-card .cosmic-label { font-size: 0.8rem; color: #8b949e; margin-top: 6px; display: block; }
.cosmic-stat-card.online .cosmic-num { color: #3fb950; }
.cosmic-stat-card.users .cosmic-num { color: #a371f7; }
.info-actions { margin-bottom: 24px; }
.cosmic-card { background: #161b22; border: 1px solid #21262d; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.cosmic-card h2 { margin: 0 0 12px; font-size: 1.05rem; color: #c9d1d9; }
.cosmic-feed li { background: transparent; }
.cosmic-chart .bar { background: #238636; border-radius: 4px 4px 0 0; }
.cosmic-chart .bar:hover { background: #2ea043; }
