:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #030303;
  color: #fff;
  --red: #e50914;
  --red-soft: rgba(229, 9, 20, 0.16);
  --panel: rgba(18, 18, 18, 0.86);
  --panel-strong: #141414;
  --line: rgba(255, 255, 255, 0.1);
  --muted: rgba(255, 255, 255, 0.62);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 10%, rgba(229, 9, 20, 0.24), transparent 30%),
    linear-gradient(145deg, #030303, #100003 48%, #030303);
}

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

button {
  border: 0;
  cursor: pointer;
}

input, textarea, select {
  width: 100%;
  color: #fff;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  padding: 12px 13px;
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  align-items: stretch;
}

.login-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 64px;
  overflow: hidden;
}

.login-art::before {
  content: "";
  position: absolute;
  inset: 8%;
  background: linear-gradient(120deg, rgba(229, 9, 20, 0.2), transparent), url("https://image.tmdb.org/t/p/original/4HodYYKEIsGOdinkGi2Ucz6X9i0.jpg") center/cover;
  opacity: 0.36;
  filter: saturate(0.8);
  transform: rotate(-2deg) scale(1.08);
  border-radius: 28px;
  z-index: -1;
}

.login-art img {
  width: min(340px, 50vw);
  margin-bottom: 22px;
}

.login-art p {
  max-width: 680px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 24px;
  line-height: 1.35;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 44px;
  background: rgba(0, 0, 0, 0.72);
  border-left: 1px solid var(--line);
}

.eyebrow {
  width: fit-content;
  color: #fff;
  background: var(--red-soft);
  border: 1px solid rgba(229, 9, 20, 0.36);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1, h2, h3, p {
  margin: 0;
}

.login-panel h1 {
  font-size: 44px;
  line-height: 0.96;
}

.muted {
  color: var(--muted);
}

.error-text {
  min-height: 22px;
  color: #ffb7bb;
  font-weight: 700;
}

.primary-btn, .ghost-btn, .danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  color: #fff;
  font-weight: 900;
}

.primary-btn {
  background: var(--red);
  box-shadow: 0 14px 34px rgba(229, 9, 20, 0.25);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.danger-btn {
  background: rgba(229, 9, 20, 0.14);
  border: 1px solid rgba(229, 9, 20, 0.34);
}

.small-btn {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 12px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: rgba(0, 0, 0, 0.78);
  border-right: 1px solid var(--line);
}

.brand {
  padding: 4px 8px 28px;
}

.brand img {
  width: 178px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 13px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  border-radius: 10px;
  font-weight: 850;
  text-align: left;
}

.nav button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.admin-chip {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.main {
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.topbar h1 {
  font-size: 36px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.stat-card, .panel, .table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
}

.panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-header h2 {
  font-size: 24px;
}

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

.form-grid .wide {
  grid-column: span 2;
}

.table-card {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: rgba(255, 255, 255, 0.86);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
}

.pill.red {
  background: var(--red-soft);
  border-color: rgba(229, 9, 20, 0.36);
}

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

.provider-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 18px;
  align-items: end;
  padding: 22px;
  margin-bottom: 16px;
  background:
    linear-gradient(135deg, rgba(229, 9, 20, 0.2), rgba(255, 255, 255, 0.045)),
    var(--panel);
  border: 1px solid rgba(229, 9, 20, 0.25);
  border-radius: 18px;
}

.provider-command h2 {
  margin-top: 12px;
  font-size: 34px;
}

.provider-command p {
  max-width: 760px;
  margin-top: 8px;
  line-height: 1.5;
}

.provider-command-actions {
  display: grid;
  gap: 10px;
}

.compact-panel {
  margin-bottom: 16px;
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(286px, 1fr));
  gap: 14px;
}

.provider-card {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.provider-card.active {
  background: linear-gradient(145deg, rgba(229, 9, 20, 0.16), rgba(255, 255, 255, 0.045));
  border-color: rgba(229, 9, 20, 0.42);
}

.provider-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.25);
}

.provider-toggle-card {
  width: 100%;
  display: grid;
  gap: 14px;
  padding: 16px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.provider-card-top {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: center;
}

.provider-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(229, 9, 20, 0.18);
  border: 1px solid rgba(229, 9, 20, 0.28);
  color: #fff;
  font-size: 20px;
  font-weight: 950;
}

.provider-card h3 {
  font-size: 18px;
  margin-bottom: 3px;
}

.provider-card p {
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.provider-switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
}

.provider-switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  transition: transform 180ms ease, background 180ms ease;
}

.provider-switch.on {
  background: var(--red);
  border-color: rgba(255, 255, 255, 0.16);
}

.provider-switch.on i {
  transform: translateX(20px);
  background: #fff;
}

.provider-card-meta,
.module-row,
.provider-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.module-row span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.075);
  color: rgba(255, 255, 255, 0.7);
}

.module-row span.ok {
  color: #bcffd1;
  background: rgba(31, 175, 92, 0.16);
  border: 1px solid rgba(31, 175, 92, 0.28);
}

.module-row span.bad {
  color: #ffd2d5;
  background: rgba(229, 9, 20, 0.14);
  border: 1px solid rgba(229, 9, 20, 0.28);
}

.pill.green {
  background: rgba(31, 175, 92, 0.16);
  border-color: rgba(31, 175, 92, 0.34);
  color: #c9ffd9;
}

.provider-card-actions {
  padding: 0 16px 16px;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 14px 16px;
  background: #fff;
  color: #080808;
  border-radius: 12px;
  font-weight: 850;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  transform: translateY(120px);
  opacity: 0;
  transition: 220ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1100px) {
  .app-shell, .login-screen, .split, .provider-command {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  .admin-chip {
    position: static;
    margin-top: 18px;
  }
  .stats-grid, .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .main, .login-panel, .login-art {
    padding: 22px;
  }
  .stats-grid, .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .wide {
    grid-column: span 1;
  }
  table {
    min-width: 760px;
  }
  .table-card {
    overflow-x: auto;
  }
}
