:root {
  --bg: #070b14;
  --panel: #0f172a;
  --panel-2: #111c31;
  --line: rgba(148, 163, 184, .18);
  --text: #f8fafc;
  --muted: #94a3b8;
  --blue: #38bdf8;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(14, 21, 38, .98), rgba(7, 11, 20, 1) 42%),
    var(--bg);
  font-family: "Tajawal", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 10px;
  color: #06120b;
  background: linear-gradient(135deg, var(--green), var(--blue));
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.muted,
.panel-head span,
.event-row time,
.eyebrow {
  color: var(--muted);
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #cbd5e1;
}

.topbar form {
  margin: 0;
}

.link-button {
  border: 0;
  color: #cbd5e1;
  background: transparent;
  cursor: pointer;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin: 8px 0 18px;
}

.flash {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, .9);
}

.flash.success {
  border-color: rgba(34, 197, 94, .45);
}

.flash.error {
  border-color: rgba(239, 68, 68, .45);
}

.flash.warning {
  border-color: rgba(245, 158, 11, .45);
}

.status-hero,
.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr);
  gap: 24px;
  align-items: stretch;
  min-height: 360px;
  margin: 12px 0 24px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, .96), rgba(17, 24, 39, .92)),
    radial-gradient(circle at 10% 20%, rgba(34, 197, 94, .22), transparent 34%);
}

.status-hero.is-offline {
  background:
    linear-gradient(135deg, rgba(15, 23, 42, .96), rgba(17, 24, 39, .92)),
    radial-gradient(circle at 10% 20%, rgba(100, 116, 139, .26), transparent 34%);
}

.admin-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 0;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(36px, 7vw, 74px);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.status-copy p,
.admin-hero p {
  max-width: 760px;
  color: #cbd5e1;
  font-size: 19px;
  line-height: 1.7;
}

.status-pills,
.hero-actions,
.toggle-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-pills span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px;
  color: #dbeafe;
  background: rgba(15, 23, 42, .72);
}

.pulse-panel {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(2, 6, 23, .46);
}

.pulse-ring {
  display: grid;
  width: 220px;
  height: 220px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 14px solid rgba(34, 197, 94, .24);
  border-top-color: var(--green);
  border-radius: 50%;
  text-align: center;
}

.is-offline .pulse-ring {
  border-color: rgba(148, 163, 184, .22);
  border-top-color: #94a3b8;
}

.pulse-ring strong {
  font-size: 38px;
  line-height: 1;
}

.pulse-ring span {
  max-width: 150px;
  color: var(--muted);
  font-size: 13px;
  direction: ltr;
}

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

.metrics-grid article {
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(15, 23, 42, .78);
}

.metrics-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
}

.metrics-grid strong {
  display: block;
  font-size: 34px;
  line-height: 1.1;
}

.metrics-grid .ok {
  border-color: rgba(34, 197, 94, .42);
}

.metrics-grid .bad {
  border-color: rgba(239, 68, 68, .42);
}

.metrics-grid .warn {
  border-color: rgba(245, 158, 11, .42);
}

.split-layout,
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  gap: 18px;
  margin: 24px 0;
}

.admin-grid {
  align-items: start;
}

.panel,
.login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: rgba(15, 23, 42, .82);
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.event-list {
  display: grid;
  gap: 10px;
  max-height: 480px;
  overflow: auto;
}

.event-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 156px;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, .12);
  border-radius: 8px;
  padding: 12px;
  background: rgba(2, 6, 23, .35);
}

.event-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-row time {
  direction: ltr;
  font-size: 13px;
  text-align: left;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.login-card {
  width: min(460px, 100%);
  margin: 80px auto;
}

.form-stack {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 7px;
  color: #cbd5e1;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--text);
  background: rgba(2, 6, 23, .62);
  outline: none;
}

input:focus {
  border-color: rgba(56, 189, 248, .72);
}

.toggle-grid label {
  display: inline-flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: #dbeafe;
  background: rgba(2, 6, 23, .4);
}

.toggle-grid input {
  width: auto;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.button.primary {
  background: linear-gradient(135deg, #16a34a, #0891b2);
}

.button.secondary {
  border-color: rgba(56, 189, 248, .32);
  background: rgba(14, 165, 233, .14);
}

.button.ghost {
  width: 100%;
  border-color: var(--line);
  background: rgba(2, 6, 23, .38);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 38px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 900px) {
  .status-hero,
  .admin-hero,
  .split-layout,
  .admin-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .event-row {
    grid-template-columns: 1fr;
  }

  .event-row time {
    text-align: right;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
  }

  .topbar,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-hero,
  .admin-hero {
    padding: 22px;
  }

  h1 {
    font-size: 38px;
  }

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