:root {
  color-scheme: dark;
  --bg: #050913;
  --bg-2: #08111f;
  --panel: #0d1624;
  --panel-2: #111b2b;
  --line: rgba(160, 180, 210, .16);
  --text: #ffffff;
  --muted: #94a3b8;
  --pink: #d946ef;
  --violet: #6d35ff;
  --cyan: #22d3ee;
  --danger: #ff355f;
  --ok: #26d36d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(109, 53, 255, .08) 1px, transparent 1px),
    linear-gradient(rgba(34, 211, 238, .045) 1px, transparent 1px),
    radial-gradient(circle at 82% 8%, rgba(109, 53, 255, .18), transparent 34%),
    linear-gradient(135deg, #050913 0%, #07111f 52%, #030711 100%);
  background-size: 44px 44px, 44px 44px, auto, auto;
  color: var(--text);
}

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

button {
  border: 0;
  color: white;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

button:hover { filter: brightness(1.12); }
button.ghost { background: rgba(255,255,255,.08); }
button.danger, .danger { background: var(--danger); }
button.success, .success { background: linear-gradient(135deg, #16a34a, #22c55e); }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  outline: none;
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, .08);
  color: white;
}

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

select option { color: #171020; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }

.hidden { display: none !important; }

.login-gate {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(8, 12, 22, .82), rgba(18, 10, 34, .72)),
    radial-gradient(circle at 50% 22%, rgba(139, 44, 255, .16), transparent 34%),
    #060910;
}

.login-gate::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 54px 54px;
  transform: perspective(700px) rotateX(58deg) translateY(-10%);
  transform-origin: center;
  animation: loginGrid 18s linear infinite;
  opacity: .42;
}

.login-gate::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 7%, rgba(24, 204, 255, .07) 7.5%, transparent 8% 18%, rgba(139, 44, 255, .08) 18.5%, transparent 19% 100%);
  background-size: 520px 100%;
  animation: loginSweep 9s ease-in-out infinite alternate;
  opacity: .7;
}

.login-bg {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 18px;
  padding-inline: 8vw;
  pointer-events: none;
}

.login-bg span {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(24,204,255,.44), rgba(139,44,255,.55), transparent);
  transform: translateX(-22%);
  opacity: .32;
  animation: loginWave 5.5s ease-in-out infinite;
}

.login-bg span:nth-child(2) { animation-delay: .35s; opacity: .22; }
.login-bg span:nth-child(3) { animation-delay: .7s; opacity: .30; }
.login-bg span:nth-child(4) { animation-delay: 1.05s; opacity: .18; }
.login-bg span:nth-child(5) { animation-delay: 1.4s; opacity: .26; }
.login-bg span:nth-child(6) { animation-delay: 1.75s; opacity: .20; }

@keyframes loginGrid {
  from { background-position: 0 0, 0 0; }
  to { background-position: 54px 54px, 54px 54px; }
}

@keyframes loginSweep {
  from { background-position: 0 0; }
  to { background-position: 520px 0; }
}

@keyframes loginWave {
  0%, 100% { transform: translateX(-24%) scaleX(.72); }
  50% { transform: translateX(24%) scaleX(1); }
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  display: grid;
  gap: 16px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(17, 24, 39, .88), rgba(9, 12, 22, .92));
  box-shadow: 0 30px 100px rgba(0,0,0,.58), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(18px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.login-brand strong {
  display: block;
  font-size: 18px;
}

.login-brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.login-card h1, .login-card p { margin: 0; }
.login-card h1 {
  max-width: 12ch;
  font-size: clamp(34px, 5vw, 54px);
  line-height: .98;
}

.login-card p {
  max-width: 54ch;
  font-size: 15px;
  line-height: 1.6;
}

.login-card p, small, .muted { color: var(--muted); }

.login-primary {
  width: fit-content;
  min-width: 180px;
  padding: 13px 18px;
}

.gmail-step {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  background: rgba(255,255,255,.045);
}

.gmail-step span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

aside {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 18px 16px;
  border-right: 1px solid var(--line);
  background: rgba(5, 11, 22, .92);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 18px;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.nav-label {
  display: block;
  margin: 18px 8px 7px;
  color: rgba(255,255,255,.52);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

aside button {
  width: 100%;
  margin: 4px 0;
  text-align: left;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}

aside button.active {
  color: white;
  background: linear-gradient(135deg, rgba(109, 53, 255, .62), rgba(109, 53, 255, .18));
  border-color: rgba(145, 111, 255, .48);
  box-shadow: inset 3px 0 0 rgba(255,255,255,.28);
}

main {
  min-width: 0;
  padding: 24px 28px;
}

.page { display: none; }
.page.active { display: grid; gap: 18px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-top {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 520px) auto;
  align-items: center;
  gap: 16px;
}

.dashboard-top h1 {
  margin-bottom: 3px;
}

.dash-search {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(145, 111, 255, .22);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
}

.dash-search input {
  border: 0;
  background: transparent;
}

.dashboard-metrics {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.metric-card {
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -42% 24%;
  height: 90px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(139,44,255,.28), transparent 70%);
}

.metric-card i {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(109,53,255,.46), rgba(217,70,239,.22));
  font-style: normal;
  font-size: 22px;
}

.metric-card small {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-main {
  grid-template-columns: 1.05fr 1.1fr 1fr;
}

.dashboard-main .card:first-child {
  grid-row: span 2;
}

.revenue-card {
  min-height: 240px;
}

.revenue-card > b {
  display: block;
  margin: 16px 0 4px;
  font-size: 34px;
}

.sparkline {
  height: 118px;
  display: flex;
  align-items: end;
  gap: 10px;
  margin-top: 18px;
  padding: 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(109,53,255,.18), rgba(34,211,238,.05));
}

.sparkline span {
  flex: 1;
  min-height: 18px;
  border-radius: 999px 999px 2px 2px;
  background: linear-gradient(180deg, #a855f7, #22d3ee);
}

.sparkline span:nth-child(1) { height: 34%; }
.sparkline span:nth-child(2) { height: 52%; }
.sparkline span:nth-child(3) { height: 46%; }
.sparkline span:nth-child(4) { height: 68%; }
.sparkline span:nth-child(5) { height: 58%; }
.sparkline span:nth-child(6) { height: 78%; }
.sparkline span:nth-child(7) { height: 88%; }

.quick-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
}

.quick-actions h2 {
  min-width: max-content;
  margin-right: auto;
}

.quick-actions button {
  min-width: max-content;
  background: rgba(139, 44, 255, .22);
  border: 1px solid rgba(145,111,255,.28);
}

.dashboard-bottom {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.status-dot {
  color: #69f59b;
  font-size: 12px;
}

.server-list {
  display: grid;
  gap: 10px;
}

.server-list span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.server-list b {
  padding: 3px 8px;
  border-radius: 999px;
  color: #50ef86;
  background: rgba(22,163,74,.18);
  font-size: 12px;
}

.device-result-card {
  display: grid;
  gap: 14px;
  width: 100%;
}

.device-user-head {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
}

.device-user-head img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--violet);
}

.device-user-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

h1, h2 { margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 18px; }

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

.grid.two { grid-template-columns: 1.1fr .9fr; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.agency-console {
  display: grid;
  grid-template-columns: minmax(360px, .95fr) minmax(420px, 1.25fr);
  gap: 16px;
  align-items: start;
}

.agency-editor {
  position: static;
}

.agency-data-layout {
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(460px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(18, 29, 46, .88), rgba(7, 15, 27, .86));
  box-shadow: 0 18px 60px rgba(0,0,0,.26), inset 0 1px 0 rgba(255,255,255,.055);
}

.metrics .card {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.metrics .card span {
  color: var(--muted);
  font-size: 12px;
}

.metrics .card b {
  font-size: 30px;
  line-height: 1;
}

.row,
.list-row {
  border: 1px solid rgba(160, 180, 210, .10);
  background: rgba(8, 16, 29, .58);
}

.row:hover,
.list-row:hover {
  background: rgba(20, 32, 52, .74);
  border-color: rgba(109, 53, 255, .36);
}

.pill {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.07);
}

.status-active {
  color: #39e37a;
  background: rgba(22, 163, 74, .16);
}

.status-expired {
  color: #fbbf24;
  background: rgba(245, 158, 11, .14);
}

.status-danger {
  color: #ff6b81;
  background: rgba(225, 29, 72, .16);
}

.compact-head {
  gap: 10px;
  margin-bottom: 12px;
}

.compact-head h2 {
  margin: 0;
}

.status-active,
.status-paid {
  color: #48df7b;
}

.status-expired,
.status-pending {
  color: #ffb84d;
}

.status-danger {
  color: #ff6868;
}

.metrics .card {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.card span { color: var(--muted); }
.card b { font-size: 24px; }

.form {
  display: grid;
  gap: 11px;
  align-content: start;
}

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

.toolbar input { max-width: 620px; }

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

.list {
  display: grid;
  gap: 10px;
  max-height: 540px;
  overflow: auto;
  padding-right: 4px;
}

.list.compact { max-height: 330px; }

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid rgba(160, 180, 210, .10);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(160, 180, 210, .10);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  color: #dbeafe;
  background: rgba(255,255,255,.045);
  font-size: 12px;
}

.admin-table td small {
  display: block;
  margin-top: 4px;
}

.admin-table .actions {
  display: flex;
  gap: 8px;
}

.cricket-metrics {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
}

.cricket-metrics .card {
  position: relative;
  overflow: hidden;
  min-height: 86px;
  border-color: rgba(145,111,255,.30);
  background:
    radial-gradient(circle at 86% 18%, rgba(216,70,239,.22), transparent 36%),
    linear-gradient(135deg, rgba(24,37,58,.92), rgba(10,17,30,.96));
}

.cricket-metrics .card::after {
  content: "";
  position: absolute;
  inset: auto 16px 0 16px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,190,53,.75), transparent);
}

.cricket-metrics .card b {
  font-size: 30px;
  letter-spacing: 0;
}

.four-panel {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
}

.cricket-public-title {
  justify-self: center;
  margin: -2px 0;
  padding: 8px 18px;
  border-radius: 8px;
  color: #1a1200;
  background: linear-gradient(135deg, #ffe16a, #ffbe35);
  font-weight: 900;
  text-transform: uppercase;
}

.cricket-public-grid {
  grid-template-columns: minmax(260px, .95fr) minmax(260px, 1fr) minmax(260px, .95fr) minmax(260px, .95fr) minmax(260px, .95fr);
  align-items: stretch;
}

.cricket-promo {
  min-height: 360px;
  align-content: end;
  background:
    linear-gradient(180deg, rgba(5,9,19,.1), rgba(5,9,19,.92)),
    url("hope_logo.png") left 18px top 18px / 86px auto no-repeat,
    radial-gradient(circle at 70% 25%, rgba(217,70,239,.36), transparent 34%),
    linear-gradient(135deg, rgba(109,53,255,.52), rgba(5,9,19,.88));
}

.cricket-promo h2 {
  font-size: 24px;
  line-height: 1.1;
}

.cricket-promo > b {
  display: inline-block;
  width: fit-content;
  margin: 10px 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,53,95,.82);
}

.scoreline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 8px;
  background: rgba(0,0,0,.24);
  text-align: center;
}

.scoreline b {
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.10);
  font-size: 14px;
}

.pill.status-active,
.pill.status-registration-open {
  border-color: rgba(34,197,94,.38);
  color: #bbf7d0;
  background: rgba(34,197,94,.16);
}

.pill.status-completed {
  border-color: rgba(59,130,246,.38);
  color: #bfdbfe;
  background: rgba(59,130,246,.16);
}

.pill.status-inactive,
.pill.status-archived,
.pill.status-cancelled {
  border-color: rgba(148,163,184,.30);
  color: #cbd5e1;
  background: rgba(148,163,184,.12);
}

.admin-table .actions button {
  white-space: nowrap;
  padding: 8px 10px;
}

.cricket-bracket {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
}

.bracket-col {
  display: grid;
  gap: 18px;
}

.bracket-node,
.bracket-final {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(145,111,255,.32);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
}

.bracket-final {
  min-height: 160px;
  place-content: center;
  text-align: center;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.052);
}

.row:hover {
  border-color: rgba(139, 44, 255, .42);
  background: rgba(139, 44, 255, .08);
}

.row > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.row button {
  padding: 8px 10px;
  font-size: 13px;
}

.agency-list .row {
  align-items: flex-start;
}

.agency-list .row b {
  font-size: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(24, 204, 255, .12);
  color: #9beaff;
  border: 1px solid rgba(24, 204, 255, .26);
}

.profile-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0,0,0,.18);
}

.page h1 + .muted,
.page-head .muted {
  margin-top: 4px;
}

.profile-preview img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pink);
}

.profile-preview div {
  display: grid;
  gap: 4px;
}

.profile-preview span { color: var(--muted); }

.mini-log {
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: rgba(0,0,0,.22);
  color: var(--muted);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.info-line {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.055);
}

.info-line span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.info-line b {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.room-warning-preview {
  padding: 14px;
  border-radius: 8px;
  color: #77fff0;
  background: rgba(29, 255, 218, .12);
  border: 1px solid rgba(29, 255, 218, .22);
  line-height: 1.45;
}

h3 {
  margin: 14px 0 10px;
  font-size: 15px;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 8px 0 0;
  color: #d8c8e7;
}

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

.toggles label,
.card.form > label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
}

input[type="checkbox"] {
  width: auto;
}

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 1fr; }
  aside {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  .brand { grid-column: 1 / -1; }
  .grid, .grid.two, .grid.three { grid-template-columns: 1fr; }
  .cricket-metrics, .four-panel, .cricket-public-grid, .cricket-bracket { grid-template-columns: 1fr; }
  .agency-console, .agency-data-layout { grid-template-columns: 1fr; }
  .agency-editor { position: static; }
  .info-grid { grid-template-columns: 1fr; }
  .toolbar { flex-wrap: wrap; }
}

@media (max-width: 620px) {
  main { padding: 14px; }
  h1 { font-size: 24px; }
  .split, .toggles { grid-template-columns: 1fr; }
}
