:root {
  color-scheme: dark;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background: #07111f;
  color: #f4f7fb;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.16), transparent 35%),
    linear-gradient(180deg, #081423 0%, #050b14 100%);
}

.dashboard-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 100%;
  height: 100vh;
  padding: 0.8rem 1.5rem 1rem;
  gap: 0.8rem;
}

.dashboard-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.dashboard-logo {
  display: block;
  width: min(290px, 55vw);
  max-height: 92px;
  object-fit: contain;
}

.brand-divider {
  width: min(400px, 70vw);
  height: 1px;
  margin: 0.55rem 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(56, 189, 248, 0.35),
    rgba(37, 99, 235, 0.95),
    rgba(56, 189, 248, 0.35),
    transparent
  );
  box-shadow:
    0 0 10px rgba(37, 99, 235, 0.65),
    0 0 20px rgba(56, 189, 248, 0.2);
}

.dashboard-header h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.5vw, 2.15rem);
  font-weight: 750;
  letter-spacing: 0.02em;
}

.overall-status {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.55rem;
  padding: 0.55rem 1rem;
  border: 1px solid rgba(74, 222, 128, 0.32);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.1);
  color: #bbf7d0;
  font-size: 1rem;
  font-weight: 700;
}

.status-dot,
.monitor-dot {
  flex: 0 0 auto;
  border-radius: 50%;
  background: #22c55e;
  box-shadow:
    0 0 7px rgba(34, 197, 94, 1),
    0 0 18px rgba(34, 197, 94, 0.9);
}

.status-dot {
  width: 0.72rem;
  height: 0.72rem;
}

.last-updated {
  margin: 0.45rem 0 0;
  color: #8fa1b8;
  font-size: 0.82rem;
}

.monitor-groups {
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  min-height: 0;
}

.monitor-group {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.35rem;
  min-height: 0;
}

.group-title {
  margin: 0;
  color: #dbeafe;
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  font-weight: 720;
  letter-spacing: 0.03em;
}

.card-grid {
  display: grid;
  gap: 0.7rem;
  min-height: 0;
}

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

.card-grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.monitor-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 0.7rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(15, 29, 48, 0.96), rgba(9, 18, 31, 0.96));
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.monitor-card::before {
  content: "";
  position: absolute;
  inset: 0 10% auto;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: #22c55e;
  box-shadow:
    0 0 8px rgba(34, 197, 94, 0.95),
    0 0 22px rgba(34, 197, 94, 0.7);
}

.monitor-dot {
  width: 0.78rem;
  height: 0.78rem;
  margin-bottom: 0.45rem;
}

.monitor-name {
  width: 100%;
  margin: 0;
  overflow: hidden;
  color: #f8fafc;
  font-size: clamp(0.92rem, 1.4vw, 1.15rem);
  font-weight: 720;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monitor-state {
  margin-top: 0.2rem;
  color: #86efac;
  font-size: clamp(0.78rem, 1vw, 0.92rem);
  font-weight: 650;
}

.monitor-response {
  margin-top: 0.15rem;
  color: #8192a8;
  font-size: clamp(0.68rem, 0.9vw, 0.8rem);
}

@media (max-width: 900px) {
  .dashboard-shell {
    padding-inline: 0.8rem;
  }

  .card-grid {
    gap: 0.45rem;
  }

  .monitor-card {
    padding: 0.45rem;
  }
}

@media (max-height: 800px) {
  .dashboard-shell {
    padding-top: 0.4rem;
    gap: 0.45rem;
  }

  .dashboard-logo {
    width: min(245px, 50vw);
    max-height: 70px;
  }

  .brand-divider {
    margin: 0.3rem 0;
  }

  .dashboard-header h1 {
    font-size: 1.5rem;
  }

  .overall-status {
    margin-top: 0.35rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.9rem;
  }

  .last-updated {
    margin-top: 0.3rem;
    font-size: 0.72rem;
  }

  .monitor-groups {
    gap: 0.4rem;
  }

  .monitor-group {
    gap: 0.2rem;
  }

  .card-grid {
    gap: 0.45rem;
  }

  .monitor-dot {
    width: 0.62rem;
    height: 0.62rem;
    margin-bottom: 0.25rem;
  }

  .monitor-card {
    border-radius: 11px;
  }
}

/* Final viewport-fit adjustments */
.dashboard-shell {
  grid-template-rows: auto minmax(0, 1fr);
  padding-top: 0.35rem;
  gap: 0.45rem;
}

.dashboard-logo {
  width: min(265px, 52vw);
  max-height: 76px;
}

.brand-divider {
  margin: 0.3rem 0;
}

.dashboard-header h1 {
  font-size: clamp(1.45rem, 2.2vw, 1.95rem);
}

.overall-status {
  margin-top: 0.35rem;
  padding: 0.42rem 0.9rem;
  font-size: 0.9rem;
}

.last-updated {
  margin-top: 0.28rem;
  font-size: 0.72rem;
}

.monitor-groups {
  grid-template-rows:
    minmax(0, 1fr)
    minmax(0, 1fr)
    minmax(0, 1.45fr);
  gap: 0.45rem;
}

.monitor-group {
  gap: 0.22rem;
}

.group-title {
  font-size: clamp(0.9rem, 1.2vw, 1.05rem);
  line-height: 1.1;
}

.card-grid {
  gap: 0.55rem;
}

.monitor-card {
  padding: 0.45rem 0.65rem;
}

.monitor-name {
  overflow: visible;
  font-size: clamp(0.82rem, 1.15vw, 1.05rem);
  line-height: 1.15;
  text-overflow: clip;
  white-space: normal;
}

.monitor-dot {
  width: 0.66rem;
  height: 0.66rem;
  margin-bottom: 0.3rem;
}

.monitor-state {
  margin-top: 0.15rem;
  font-size: clamp(0.72rem, 0.9vw, 0.85rem);
  line-height: 1.1;
}

.monitor-response {
  margin-top: 0.12rem;
  font-size: clamp(0.63rem, 0.78vw, 0.74rem);
  line-height: 1.1;
}

.card-grid.three-column {
  grid-template-rows: repeat(2, minmax(76px, 1fr));
}

/* Card hierarchy and final polish */
.monitor-groups {
  grid-template-rows:
    minmax(0, 1.08fr)
    minmax(0, 1.08fr)
    minmax(0, 1.22fr);
}

.card-grid.three-column {
  grid-template-rows: repeat(2, minmax(66px, 1fr));
}

.monitor-card {
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.monitor-card:hover {
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.3);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(37, 99, 235, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.monitor-card:hover::before {
  box-shadow:
    0 0 10px rgba(34, 197, 94, 1),
    0 0 28px rgba(34, 197, 94, 0.85);
}

.monitor-name {
  font-size: clamp(0.9rem, 1.25vw, 1.12rem);
  font-weight: 800;
}

.monitor-state {
  margin-top: 0.18rem;
  font-size: clamp(0.66rem, 0.78vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.monitor-response {
  margin-top: 0.1rem;
  color: #71839a;
}

/* Live monitor status colors */
.monitor-card.online::before,
.monitor-card.online .monitor-dot {
  background: #22c55e;
}

.monitor-card.online::before,
.monitor-card.online .monitor-dot {
  box-shadow:
    0 0 8px rgba(34, 197, 94, 0.95),
    0 0 22px rgba(34, 197, 94, 0.7);
}

.monitor-card.online .monitor-state {
  color: #86efac;
}

.monitor-card.offline::before,
.monitor-card.offline .monitor-dot {
  background: #ef4444;
}

.monitor-card.offline::before,
.monitor-card.offline .monitor-dot {
  box-shadow:
    0 0 8px rgba(239, 68, 68, 0.95),
    0 0 22px rgba(239, 68, 68, 0.7);
}

.monitor-card.offline .monitor-state {
  color: #fca5a5;
}

.monitor-card.pending::before,
.monitor-card.pending .monitor-dot {
  background: #f59e0b;
}

.monitor-card.pending::before,
.monitor-card.pending .monitor-dot {
  box-shadow:
    0 0 8px rgba(245, 158, 11, 0.95),
    0 0 22px rgba(245, 158, 11, 0.7);
}

.monitor-card.pending .monitor-state {
  color: #fcd34d;
}

.monitor-card.maintenance::before,
.monitor-card.maintenance .monitor-dot {
  background: #f59e0b;
}

.monitor-card.maintenance::before,
.monitor-card.maintenance .monitor-dot {
  box-shadow:
    0 0 8px rgba(245, 158, 11, 0.95),
    0 0 22px rgba(245, 158, 11, 0.7);
}

.monitor-card.maintenance .monitor-state {
  color: #fde68a;
}

.monitor-card.unknown::before,
.monitor-card.unknown .monitor-dot {
  background: #94a3b8;
}

.monitor-card.unknown::before,
.monitor-card.unknown .monitor-dot {
  box-shadow:
    0 0 8px rgba(148, 163, 184, 0.75),
    0 0 18px rgba(148, 163, 184, 0.45);
}

.monitor-card.unknown .monitor-state {
  color: #cbd5e1;
}

/* ==========================================================
   SECTION HEADER DIVIDERS
   ========================================================== */

.group-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.group-title::after {
  content: "";
  flex: 1;
  height: 1px;

  background: linear-gradient(
    90deg,
    rgba(37, 99, 235, 0.95),
    rgba(56, 189, 248, 0.35),
    transparent
  );

  box-shadow:
    0 0 8px rgba(37, 99, 235, 0.55),
    0 0 16px rgba(56, 189, 248, 0.18);
}

/* ==========================================================
   ANIMATED CARD STATUS BAR GLOW
   ========================================================== */

@keyframes online-status-glow {
  0%,
  100% {
    box-shadow:
      0 0 7px rgba(34, 197, 94, 0.85),
      0 0 18px rgba(34, 197, 94, 0.55);
  }

  50% {
    box-shadow:
      0 0 12px rgba(34, 197, 94, 1),
      0 0 30px rgba(34, 197, 94, 0.9);
  }
}

@keyframes offline-status-glow {
  0%,
  100% {
    box-shadow:
      0 0 7px rgba(239, 68, 68, 0.85),
      0 0 18px rgba(239, 68, 68, 0.55);
  }

  50% {
    box-shadow:
      0 0 12px rgba(239, 68, 68, 1),
      0 0 30px rgba(239, 68, 68, 0.9);
  }
}

@keyframes pending-status-glow {
  0%,
  100% {
    box-shadow:
      0 0 7px rgba(245, 158, 11, 0.85),
      0 0 18px rgba(245, 158, 11, 0.55);
  }

  50% {
    box-shadow:
      0 0 12px rgba(245, 158, 11, 1),
      0 0 30px rgba(245, 158, 11, 0.9);
  }
}

@keyframes maintenance-status-glow {
  0%,
  100% {
    box-shadow:
      0 0 7px rgba(245, 158, 11, 0.85),
      0 0 18px rgba(245, 158, 11, 0.55);
  }

  50% {
    box-shadow:
      0 0 12px rgba(245, 158, 11, 1),
      0 0 30px rgba(245, 158, 11, 0.9);
  }
}

.monitor-card.online::before {
  animation: online-status-glow 3.5s ease-in-out infinite;
}

.monitor-card.offline::before {
  animation: offline-status-glow 2.2s ease-in-out infinite;
}

.monitor-card.pending::before {
  animation: pending-status-glow 3s ease-in-out infinite;
}

.monitor-card.maintenance::before {
  animation: maintenance-status-glow 3.5s ease-in-out infinite;
}

.monitor-card.unknown::before {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .monitor-card::before {
    animation: none !important;
  }
}

/* ==========================================================
   TOP RIGHT ADMIN BUTTON
   ========================================================== */

.dashboard-header {
    position: relative;
}

.admin-button {
    position: absolute;
    top: 0;
    right: 0;

    margin: 0;

    padding: 0.45rem 1rem;

    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(37, 99, 235, 0.35);
    border-radius: 999px;

    color: #dbeafe;
    font-size: 0.8rem;
    font-weight: 700;

    cursor: pointer;

    transition: all .2s ease;
}

.admin-button:hover {
    border-color: rgba(59,130,246,.8);

    box-shadow:
        0 0 10px rgba(59,130,246,.45),
        0 0 24px rgba(59,130,246,.18);
}

/* ==========================================================
   ADMIN MODE GLOW
   ========================================================== */

body.admin-mode {
  background:
    radial-gradient(
      circle at top,
      rgba(37, 99, 235, 0.26),
      transparent 36%
    ),
    linear-gradient(
      180deg,
      #0b1730 0%,
      #060d18 100%
    );
}

body.admin-mode .admin-button {
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.95);
  background: rgba(30, 64, 175, 0.22);

  box-shadow:
    0 0 12px rgba(59, 130, 246, 0.72),
    0 0 28px rgba(59, 130, 246, 0.32);
}

body.admin-mode .brand-divider {
  box-shadow:
    0 0 14px rgba(37, 99, 235, 0.9),
    0 0 32px rgba(56, 189, 248, 0.35);
}

body.admin-mode .group-title::after {
  box-shadow:
    0 0 12px rgba(37, 99, 235, 0.75),
    0 0 24px rgba(56, 189, 248, 0.25);
}

body.admin-mode .monitor-card:hover {
  border-color: rgba(59, 130, 246, 0.75);

  box-shadow:
    0 0 12px rgba(59, 130, 246, 0.2),
    0 0 24px rgba(59, 130, 246, 0.1),
    0 14px 30px rgba(0, 0, 0, 0.3);
}

/* ==========================================================
   ADMIN LOGIN DIALOG
   ========================================================== */

.admin-dialog {
  width: min(90vw, 420px);
  padding: 0;
  border: 1px solid rgba(96, 165, 250, 0.32);
  border-radius: 16px;
  background: transparent;
  color: #f8fafc;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.6),
    0 0 28px rgba(37, 99, 235, 0.14);
}

.admin-dialog::backdrop {
  background: rgba(2, 8, 23, 0.76);
  backdrop-filter: blur(5px);
}

.admin-dialog-panel {
  width: auto;
  padding: 1.5rem;
  border: 0;
  border-radius: 15px;
  background:
    linear-gradient(
      180deg,
      rgba(15, 29, 48, 0.99),
      rgba(9, 18, 31, 0.99)
    );
  box-shadow: none;
}

.admin-dialog-panel h2 {
  margin: 0 0 1.25rem;
  color: #f8fafc;
  font-size: 1.35rem;
  text-align: center;
}

.admin-dialog-panel label {
  display: block;
  margin-bottom: 0.5rem;
  color: #cbd5e1;
  font-weight: 650;
}

.admin-dialog-panel input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 9px;
  background: rgba(2, 8, 23, 0.55);
  color: #ffffff;
  font: inherit;
}

.admin-dialog-panel input:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.9);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.admin-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.admin-dialog-actions button {
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 9px;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#admin-cancel-button {
  background: #374151;
}

#admin-cancel-button:hover {
  background: #4b5563;
}

#admin-unlock-button {
  background: #2563eb;
}

#admin-unlock-button:hover {
  background: #1d4ed8;
}

.admin-error {
  margin: 0.75rem 0 0;
  color: #ef4444;
  font-size: 0.9rem;
  font-weight: 600;
}

.admin-dialog-panel input.error {
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
}



.admin-controls-dialog {
  width: min(92vw, 460px);
  padding: 0;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 16px;
  background: transparent;
  color: #f8fafc;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.6),
    0 0 28px rgba(37, 99, 235, 0.12);
}

.admin-controls-dialog::backdrop {
  background: rgba(2, 8, 23, 0.76);
  backdrop-filter: blur(4px);
}

.admin-controls-panel {
  padding: 1.25rem;
  border-radius: 16px;
  background:
    linear-gradient(
      180deg,
      rgba(15, 29, 48, 0.98),
      rgba(9, 18, 31, 0.98)
    );
}

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

.admin-controls-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

#admin-controls-close {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

#admin-controls-close:hover {
  background: rgba(148, 163, 184, 0.18);
  color: #ffffff;
}

.admin-panel-section {
  display: grid;
  gap: 0.8rem;
}

.admin-panel-section h3,
.admin-panel-section p {
  margin: 0;
}

.admin-panel-section h3 {
  color: #dbeafe;
  font-size: 1rem;
}

#maintenance-status-text {
  margin-top: 0.25rem;
  color: #94a3b8;
  font-size: 0.9rem;
}

.admin-panel-section label {
  color: #cbd5e1;
  font-size: 0.88rem;
  font-weight: 650;
}

#maintenance-reason {
  width: 100%;
  box-sizing: border-box;
  padding: 0.72rem 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 9px;
  background: rgba(2, 8, 23, 0.5);
  color: #f8fafc;
  font: inherit;
}

#maintenance-reason::placeholder {
  color: #64748b;
}

#maintenance-reason:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.22);
}

#maintenance-toggle-button {
  justify-self: start;
}

.maintenance-message {
  margin: 0;
  color: #93c5fd;
  font-size: 0.88rem;
}

.admin-controls-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

#admin-controls-logout,
#admin-controls-done,
#maintenance-toggle-button {
  padding: 0.65rem 0.9rem;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 9px;
  background: rgba(37, 99, 235, 0.16);
  color: #dbeafe;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#admin-controls-logout:hover,
#admin-controls-done:hover,
#maintenance-toggle-button:hover {
  background: rgba(37, 99, 235, 0.28);
}

#admin-controls-logout {
  border-color: rgba(248, 113, 113, 0.25);
  background: rgba(127, 29, 29, 0.18);
  color: #fecaca;
}

#admin-controls-logout:hover {
  background: rgba(127, 29, 29, 0.32);
}

.maintenance-reason {
  max-width: 100%;
  margin-top: 0.25rem;
  overflow: hidden;
  color: #fcd34d;
  font-size: clamp(0.65rem, 0.8vw, 0.78rem);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
