:root {
  --sg-red: #b5121b;
  --sg-red-dark: #7e0d14;
  --sg-silver: #c8c8c8;
  --sg-gray-900: #151515;
  --sg-gray-800: #222;
  --sg-gray-700: #333;
  --sg-gray-500: #747474;
  --sg-gray-200: #e8e8e8;
  --sg-gray-100: #f5f5f5;
  --sg-white: #ffffff;
  --sg-radius: 9px;
  --sg-shadow: 0 18px 60px rgba(0,0,0,.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f4f4;
  color: var(--sg-gray-900);
}

/* LOGIN */
.sg-login-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(20,20,20,.94), rgba(40,40,40,.82)),
    radial-gradient(circle at 20% 20%, rgba(181,18,27,.45), transparent 28%),
    linear-gradient(120deg, #111, #3a3a3a);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px;
}

.sg-login-shell {
  width: min(1120px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: var(--sg-shadow);
  border-radius: var(--sg-radius);
  overflow: hidden;
}

.sg-login-left {
  padding: 58px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(232,232,232,.92)),
    repeating-linear-gradient(
      90deg,
      rgba(0,0,0,.035) 0,
      rgba(0,0,0,.035) 1px,
      transparent 1px,
      transparent 72px
    );
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sg-brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 48px;
}

.sg-brand-mark {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--sg-red), var(--sg-red-dark));
  color: white;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: .5px;
  box-shadow: 0 10px 24px rgba(181,18,27,.28);
}

.sg-brand-row strong {
  display: block;
  font-size: 22px;
  letter-spacing: -.4px;
}

.sg-brand-row span {
  color: var(--sg-gray-500);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sg-login-left h1 {
  font-size: 43px;
  line-height: 1.05;
  letter-spacing: -1.4px;
  max-width: 660px;
  margin: 0 0 22px;
}

.sg-login-left p {
  font-size: 16px;
  line-height: 1.65;
  color: #444;
  max-width: 620px;
  margin: 0;
}

.sg-login-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 46px;
}

.sg-login-metrics div {
  border: 1px solid #ddd;
  background: white;
  padding: 16px;
  border-radius: var(--sg-radius);
  box-shadow: 0 8px 22px rgba(0,0,0,.05);
}

.sg-login-metrics strong {
  display: block;
  color: var(--sg-red);
  font-size: 18px;
}

.sg-login-metrics span {
  display: block;
  color: #555;
  font-size: 12px;
  margin-top: 4px;
}

.sg-login-card {
  background: #151515;
  color: white;
  padding: 46px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 5px solid var(--sg-red);
}

.sg-card-header {
  margin-bottom: 34px;
}

.sg-card-header span {
  display: block;
  color: var(--sg-silver);
  font-size: 12px;
  letter-spacing: .14em;
  margin-bottom: 10px;
}

.sg-card-header strong {
  display: block;
  font-size: 28px;
  letter-spacing: -.6px;
}

.sg-login-card form {
  display: grid;
  gap: 14px;
}

.sg-login-card label {
  font-size: 13px;
  color: #d6d6d6;
}

.sg-login-card input {
  height: 48px;
  border: 1px solid #555;
  background: #222;
  color: white;
  border-radius: 7px;
  padding: 0 14px;
  font-size: 15px;
  outline: none;
}

.sg-login-card input:focus {
  border-color: var(--sg-red);
  box-shadow: 0 0 0 3px rgba(181,18,27,.2);
}

.sg-login-card button {
  height: 48px;
  border: 0;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--sg-red), var(--sg-red-dark));
  color: white;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
}

.sg-login-card button:hover {
  filter: brightness(1.08);
}

.sg-login-note {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid #333;
  color: #aaa;
  font-size: 12px;
  line-height: 1.55;
}

.error {
  background: rgba(181,18,27,.12);
  border: 1px solid rgba(181,18,27,.45);
  color: #ffb9bf;
  padding: 12px;
  border-radius: 7px;
  margin-bottom: 18px;
}

/* ADMIN SHELL */
.topbar {
  height: 66px;
  background: #151515;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  border-bottom: 4px solid var(--sg-red);
}

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

.topbar span {
  display: block;
  color: #aaa;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar nav a {
  color: #ddd;
  text-decoration: none;
  font-size: 13px;
  padding: 9px 10px;
  border-radius: 6px;
}

.topbar nav a:hover {
  background: #2a2a2a;
  color: white;
}

.topbar nav a.logout {
  background: var(--sg-red);
  color: white;
}

.shell {
  padding: 28px;
  max-width: 1440px;
  margin: 0 auto;
}

.hero {
  background: white;
  border: 1px solid #ddd;
  border-radius: var(--sg-radius);
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 28px rgba(0,0,0,.05);
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 32px;
}

.hero p,
.lead {
  color: #555;
  line-height: 1.55;
  max-width: 760px;
}

.status-card {
  border: 1px solid #ddd;
  border-radius: var(--sg-radius);
  padding: 18px 24px;
  min-width: 180px;
  background: #f8f8f8;
}

.status-card span {
  display: block;
  color: #666;
  font-size: 12px;
  text-transform: uppercase;
}

.status-card strong {
  display: block;
  color: var(--sg-red);
  margin-top: 6px;
  font-size: 22px;
}

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

.module-card {
  display: block;
  background: white;
  color: inherit;
  text-decoration: none;
  border: 1px solid #ddd;
  border-radius: var(--sg-radius);
  padding: 20px;
  min-height: 155px;
  box-shadow: 0 8px 24px rgba(0,0,0,.045);
}

.module-card:hover {
  border-color: var(--sg-red);
  transform: translateY(-1px);
}

.module-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.module-top strong {
  font-size: 17px;
}

.module-card p {
  color: #555;
  font-size: 14px;
  line-height: 1.45;
}

.module-card small {
  color: #777;
}

.active,
.online {
  color: #117a37;
  font-weight: 700;
}

.staging {
  color: #9a6500;
  font-weight: 700;
}

.planned {
  color: #666;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid #ddd;
  border-radius: var(--sg-radius);
  overflow: hidden;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #eee;
  text-align: left;
  font-size: 14px;
}

th {
  background: #202020;
  color: white;
}

code {
  background: #f1f1f1;
  padding: 3px 6px;
  border-radius: 5px;
}

.footer {
  padding: 18px 28px;
  color: #777;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 960px) {
  .sg-login-shell {
    grid-template-columns: 1fr;
  }

  .sg-login-left {
    padding: 34px;
  }

  .sg-login-left h1 {
    font-size: 32px;
  }

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

  .topbar {
    height: auto;
    padding: 18px;
    align-items: flex-start;
    gap: 18px;
    flex-direction: column;
  }

  .topbar nav {
    flex-wrap: wrap;
  }
}

@media (max-width: 620px) {
  .sg-login-body {
    padding: 18px;
  }

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

  .sg-login-card {
    padding: 30px;
  }
}

.app-section {
  margin-top: 34px;
}

.app-section h2 {
  font-size: 20px;
  margin: 0 0 14px;
  padding-left: 12px;
  border-left: 5px solid var(--sg-red);
}

.missing {
  color: #9a6500;
  font-weight: 700;
}

.disabled-card {
  opacity: .72;
  cursor: not-allowed;
  background: #fafafa;
}

.disabled-card:hover {
  transform: none;
  border-color: #ddd;
}

.sg-button-secondary {
  height: 46px;
  border-radius: 7px;
  border: 1px solid #ccc;
  background: #f5f5f5;
  color: #222;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  font-weight: 700;
}
