:root {
  color-scheme: dark;
  font-family: Inter, Arial, sans-serif;
  background: #08111f;
  color: #f4f7fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.2), transparent 30%),
    linear-gradient(180deg, #08111f 0%, #0f172a 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 14px;
  padding: 0.9rem 1.1rem;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #02111f;
  font-weight: 700;
}

button.ghost {
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  background: rgba(15, 23, 42, 0.8);
  color: #f8fafc;
}

select,
textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  background: rgba(15, 23, 42, 0.8);
  color: #f8fafc;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

label {
  display: grid;
  gap: 0.5rem;
}

label span {
  color: #cbd5e1;
  font-size: 0.95rem;
}

h1,
h2,
p {
  margin: 0;
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 2rem;
}

.eyebrow {
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.subtitle {
  margin-top: 0.75rem;
  color: #94a3b8;
  max-width: 700px;
}

.muted {
  color: #94a3b8;
}

.grid {
  display: grid;
  gap: 1.25rem;
}

.card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.15);
  backdrop-filter: blur(12px);
  border-radius: 22px;
  padding: 1.25rem;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.35);
}

.auth-card {
  max-width: 460px;
}

.tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  width: 100%;
  background: rgba(30, 41, 59, 0.8);
  padding: 0.35rem;
  border-radius: 18px;
  margin-bottom: 1.25rem;
}

.tab {
  background: transparent;
  color: #cbd5e1;
}

.tab.active {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
}

.stack {
  display: grid;
  gap: 1rem;
}

.stack.compact {
  gap: 0.85rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.checkbox-row {
  align-content: start;
}

.checkbox-row input {
  width: auto;
}

.dashboard {
  display: grid;
  gap: 1.25rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.stat {
  display: grid;
  gap: 0.5rem;
}

.stat span {
  color: #94a3b8;
}

.stat strong {
  font-size: 2rem;
}

.stat.wide strong {
  font-size: 1.15rem;
  word-break: break-word;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.list {
  display: grid;
  gap: 0.85rem;
}

.mapping-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 1rem;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.12);
  align-items: center;
}

.mapping-meta {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.mapping-meta code,
.mapping-meta a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapping-meta small {
  color: #94a3b8;
}

.mapping-inline-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.15);
  min-width: 120px;
  text-align: center;
}

.inline-stat {
  font-size: 0.95rem;
  color: #e2e8f0;
}

.inline-stat strong {
  color: #38bdf8;
  font-size: 1.15rem;
}

.inline-stat-sub {
  font-size: 0.75rem;
  color: #94a3b8;
}

.usage-summary-row td {
  background: rgba(56, 189, 248, 0.06);
  border-bottom: 2px solid rgba(56, 189, 248, 0.2);
}

.mapping-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: flex-end;
}

.user-item {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
}

.user-actions {
  align-items: stretch;
}

.user-meta {
  align-content: start;
}

.user-channels-input {
  min-height: 140px;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #cbd5e1;
}

.toggle-row input {
  width: auto;
}

.empty {
  padding: 1rem;
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.65);
  color: #94a3b8;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: #f8fafc;
  box-shadow: 0 15px 40px rgba(2, 6, 23, 0.4);
}

.hidden {
  display: none !important;
}

.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.usage-table th,
.usage-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.usage-table th {
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.usage-table td a {
  color: #38bdf8;
  text-decoration: none;
}

.usage-table td a:hover {
  text-decoration: underline;
}

.usage-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.06);
}

.stats-row-admin-secondary {
  margin-bottom: 0.5rem;
}

#usageStatsCard h3,
#userStatsCard h3 {
  color: #cbd5e1;
  font-size: 1rem;
  font-weight: 600;
}

#usageStatsCard .stats-row,
#userStatsCard .stats-row {
  margin-bottom: 0.75rem;
}

.sub-banner {
  text-align: center;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.sub-banner-expired {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.35);
  color: #f87171;
}

.sub-active {
  color: #4ade80;
}

.sub-warning {
  color: #fbbf24;
}

.sub-expired {
  color: #f87171;
}

.sub-admin {
  color: #38bdf8;
}

.sub-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.sub-date-input {
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  font-size: 0.85rem;
}

.sub-plan-select {
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  font-size: 0.85rem;
}

.contact-card {
  text-align: center;
  padding: 1.5rem;
}

.contact-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.contact-link:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
}

.contact-link svg {
  flex-shrink: 0;
}

@media (max-width: 860px) {
  .hero,
  .section-header,
  .mapping-item,
  .stats-row,
  .form-grid,
  .user-item {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero {
    justify-content: stretch;
  }

  .mapping-actions {
    align-items: stretch;
  }
}
