:root {
  color-scheme: dark;

  --bg: #001E42;
  --card: #1F378C;
  --text: #FFFFFF;
  --muted: #D6DEE2;

  --accent: #0018FF;
  --accent-strong: #2D44AC;
  --neon: #00FFE8;

  --border: rgba(146, 195, 254, 0.42);
  --shadow: 0 16px 34px rgba(0, 30, 66, 0.45);
  --glow: 0 0 0 1px rgba(0, 24, 255, 0.25), 0 0 20px rgba(0, 255, 232, 0.12);

  --table-head: rgba(206, 230, 255, 0.14);
  --table-row: rgba(0, 30, 66, 0.58);
  --table-row-alt: rgba(45, 68, 172, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 255, 232, 0.08), transparent 38%),
    radial-gradient(circle at 90% 8%, rgba(0, 24, 255, 0.18), transparent 32%),
    linear-gradient(160deg, #00122b 0%, var(--bg) 45%, #0a1a4f 100%);
  color: var(--text);
  min-height: 100vh;
}

html {
  min-height: 100%;
}

a {
  color: var(--neon);
}

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 15, 36, 0.62);
  display: grid;
  place-items: center;
  backdrop-filter: blur(2px);
}

.loader-card {
  min-width: 280px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  background: linear-gradient(145deg, rgba(31, 55, 140, 0.95), rgba(18, 34, 93, 0.95));
  box-shadow: var(--shadow), var(--glow);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0, 15, 36, 0.68);
  display: grid;
  place-items: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-card {
  width: min(960px, 96vw);
  max-height: 88vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(145deg, rgba(31, 55, 140, 0.97), rgba(18, 34, 93, 0.97));
  box-shadow: var(--shadow), var(--glow);
}

.loader-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(214, 222, 226, 0.35);
  border-top-color: var(--neon);
  animation: loader-spin 0.9s linear infinite;
}

@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  background: rgba(0, 30, 66, 0.82);
  z-index: 5;
}

.admin-report-page {
  overflow-x: hidden;
}

.admin-report-page .topbar {
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
  row-gap: 10px;
}

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

.admin-report-page .topbar-right {
  max-width: 100%;
  flex: 0 1 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.admin-report-page .brand {
  flex: 1 1 420px;
  min-width: 0;
}

.admin-report-page .brand strong {
  display: block;
  min-width: 0;
  line-height: 1.2;
}

.logo-img {
  display: block;
  width: 170px;
  max-width: 100%;
  height: auto;
}

.login-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.container {
  width: min(1280px, 94vw);
  margin: 22px auto 42px;
}

.dashboard-page .container {
  width: calc(100% - 48px);
  max-width: none;
  margin: 22px 24px 42px;
}

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

.cards-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  background: linear-gradient(145deg, rgba(31, 55, 140, 0.95), rgba(18, 34, 93, 0.95));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.card.glow {
  box-shadow: var(--shadow), var(--glow);
}

.card-title {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.card-number {
  margin: 0;
  font-size: 27px;
  line-height: 1.15;
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 8px;
}

.menu-card {
  padding: 12px 16px;
  margin-bottom: 16px;
}

.menu-card .nav-links {
  flex-wrap: wrap;
}

.nav-links a,
button.btn,
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  background: var(--accent);
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: all .2s ease;
}

.nav-links a.secondary,
.btn.secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.nav-links a:hover,
button.btn:hover,
.btn:hover {
  transform: translateY(-1px);
  background: var(--accent-strong);
}

.nav-links a.secondary:hover,
.btn.secondary:hover {
  color: var(--text);
  border-color: var(--neon);
}

.service-status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 30, 66, 0.4);
  padding: 8px 12px;
}

.admin-report-page .service-status-card {
  min-width: min(220px, 100%);
  max-width: 100%;
}

.service-status-title {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.service-status-text {
  font-size: 14px;
  font-weight: 700;
}

.service-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #9aa7b4;
  box-shadow: 0 0 0 3px rgba(154, 167, 180, 0.15);
}

.service-status-card.online .service-status-dot {
  background: #00d38d;
  box-shadow: 0 0 0 3px rgba(0, 211, 141, 0.2);
}

.service-status-card.offline .service-status-dot {
  background: #ff5c78;
  box-shadow: 0 0 0 3px rgba(255, 92, 120, 0.2);
}

.service-status-card.checking .service-status-dot {
  background: #ffd166;
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.18);
}

.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.dashboard-table-card {
  padding-bottom: 12px;
}

.dashboard-table-wrap {
  max-height: 68vh;
  overflow: auto;
  direction: rtl;
}

.dashboard-table-wrap > table {
  direction: ltr;
  table-layout: fixed;
  min-width: 100%;
}

.dashboard-table-wrap th,
.dashboard-table-wrap td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dashboard-table-wrap th:nth-child(1),
.dashboard-table-wrap td:nth-child(1) {
  width: 120px;
}

.dashboard-table-wrap th:nth-child(2),
.dashboard-table-wrap td:nth-child(2) {
  width: 190px;
}

.dashboard-table-wrap th:nth-child(3),
.dashboard-table-wrap td:nth-child(3) {
  width: 190px;
}

.dashboard-table-wrap th:nth-child(4),
.dashboard-table-wrap td:nth-child(4) {
  width: 190px;
}

.dashboard-table-wrap th:nth-child(5),
.dashboard-table-wrap td:nth-child(5) {
  width: 90px;
}

.dashboard-table-wrap th:nth-child(6),
.dashboard-table-wrap td:nth-child(6) {
  width: 90px;
}

.dashboard-table-wrap th:nth-child(7),
.dashboard-table-wrap td:nth-child(7) {
  width: 90px;
}

.dashboard-table-wrap th:nth-child(8),
.dashboard-table-wrap td:nth-child(8) {
  width: 100px;
}

.dashboard-table-wrap th:nth-child(9),
.dashboard-table-wrap td:nth-child(9) {
  width: auto;
  min-width: 320px;
  text-align: left;
  vertical-align: top;
}

.links-table th:first-child,
.links-table td:first-child {
  text-align: left;
  vertical-align: top;
}

.coupon-table th:first-child,
.coupon-table td:first-child,
.coupon-table th:nth-child(6),
.coupon-table td:nth-child(6) {
  text-align: left;
  vertical-align: top;
}

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

thead th {
  text-align: center;
  background: var(--table-head);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 12px 10px;
  position: sticky;
  top: 0;
  z-index: 2;
}

tbody tr {
  background: var(--table-row);
}

tbody tr:nth-child(even) {
  background: var(--table-row-alt);
}

td {
  padding: 12px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: middle;
  font-size: 14px;
  text-align: center;
}

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

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(460px, 96vw);
  padding: 24px;
  border-radius: 16px;
  background: linear-gradient(150deg, rgba(31, 55, 140, 0.96), rgba(10, 26, 79, 0.96));
  border: 1px solid var(--border);
  box-shadow: var(--shadow), var(--glow);
}

.login-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.login-subtitle {
  margin: 8px 0 16px;
  color: var(--muted);
}

.input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 30, 66, 0.45);
  color: var(--text);
  padding: 10px 12px;
}

.alert {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 145, 145, 0.45);
  background: rgba(255, 54, 54, 0.16);
}

.hide {
  display: none;
}

.code {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 12px;
  white-space: nowrap;
}

.dashboard-page .code {
  white-space: normal;
}

.report-stack {
  display: grid;
  gap: 6px;
  text-align: left;
}

.report-line {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.report-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.report-value {
  min-width: 0;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.pill {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 18px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.8fr) minmax(180px, 1fr) 1fr 1fr auto auto auto;
  gap: 10px;
  margin-bottom: 12px;
  align-items: center;
}

.admin-report-page .dashboard-table-wrap > table.report-table {
  table-layout: auto;
  min-width: 1680px;
}

.admin-report-page .report-shell,
.admin-report-page .report-kpis,
.admin-report-page .report-table-section,
.admin-report-page .report-table-wrap,
.admin-report-page .report-table {
  min-width: 0;
}

.admin-report-page .report-table-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-report-page .report-table-wrap {
  overflow: auto;
}

.admin-report-page .dashboard-table-wrap th:nth-child(1),
.admin-report-page .dashboard-table-wrap td:nth-child(1) {
  width: 150px;
}

.admin-report-page .dashboard-table-wrap th:nth-child(2),
.admin-report-page .dashboard-table-wrap td:nth-child(2) {
  width: 220px;
}

.admin-report-page .dashboard-table-wrap th:nth-child(3),
.admin-report-page .dashboard-table-wrap td:nth-child(3) {
  width: 170px;
}

.admin-report-page .dashboard-table-wrap th:nth-child(4),
.admin-report-page .dashboard-table-wrap td:nth-child(4) {
  width: 220px;
}

.admin-report-page .dashboard-table-wrap th:nth-child(5),
.admin-report-page .dashboard-table-wrap td:nth-child(5) {
  width: 220px;
}

.admin-report-page .dashboard-table-wrap th:nth-child(6),
.admin-report-page .dashboard-table-wrap td:nth-child(6) {
  width: 300px;
  text-align: left;
  vertical-align: top;
}

.admin-report-page .dashboard-table-wrap th:nth-child(7),
.admin-report-page .dashboard-table-wrap td:nth-child(7) {
  width: 430px;
  text-align: left;
  vertical-align: top;
}

.admin-report-page .dashboard-table-wrap th:nth-child(8),
.admin-report-page .dashboard-table-wrap td:nth-child(8) {
  width: 320px;
  text-align: left;
  vertical-align: top;
}

.admin-report-page .dashboard-table-wrap thead th {
  background: #2d44ac;
}

@media (min-width: 981px) {
  html,
  body.admin-report-page {
    height: 100%;
  }

  body.dashboard-page.admin-report-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
  }

  .admin-report-page .report-shell {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 22px 24px 24px;
    overflow: hidden;
  }

  .admin-report-page .menu-card,
  .admin-report-page .report-kpis {
    flex: 0 0 auto;
  }

  .admin-report-page .report-table-section {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .admin-report-page .report-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }
}

.dashboard-paid-only {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.pagination-bar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1.3fr 1.6fr 1fr auto;
  gap: 12px;
  align-items: end;
}

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

.coupon-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr 0.8fr 1fr auto;
  gap: 12px;
  align-items: end;
}

@media (max-width: 980px) {
  .cards-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meta-grid {
    grid-template-columns: 1fr 1fr;
  }

  .coupon-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-filters {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .cards-4 {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 14px;
    flex-wrap: wrap;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .service-status-card {
    width: 100%;
    min-width: 0;
  }

  .container {
    width: 96vw;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }

  .coupon-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-filters {
    grid-template-columns: 1fr;
  }
}
