:root {
  --bg: #f5f5ef;
  --card: #ffffff;
  --card-soft: #ffffff;
  --border: #e5e5de;
  --text: #111827;
  --muted: #6b7280;

  --blue: #0f766e;
  --green: #16a34a;
  --orange: #ea580c;
  --amber: #d97706;
  --red: #dc2626;
}

/* ===== RESET ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 32px 24px 40px;
  background: var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
}

/* ===== PAGE HEADER ===== */
.page-header {
  max-width: 1200px;
  margin: 24px auto 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-size: 24px;
  color: #0b5f55;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ===== DASHBOARD ===== */
.dashboard {
  max-width: 1330px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ===== MAIN GRID — 3 COLUMN LAYOUT ===== */
.main-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

/* ===== COLUMNS ===== */
.left-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.center-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.alert-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 90px;
}

/* ===== CARD ===== */
.card,
.card-soft {
  background: var(--card);
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 25px rgba(15, 23, 42, 0.06);
  padding: 16px 18px;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.card-sub {
  letter-spacing: 0.18em;
  font-weight: 900;
  padding: 5px;
  margin: 10px;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}

/* ===== GATEWAY STATUS ===== */
.status-list {
  list-style: none;
  margin-top: 8px;
  font-size: 13px;
}

.status-label {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 500;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ONLINE */
.badge.online {
  background: #ecfdf5;
  color: #15803d;
}

.badge.online .badge-dot {
  background: #22c55e;
}

/* OFFLINE */
.badge.offline {
  background: #fef2f2;
  color: var(--red);
}

.badge.offline .badge-dot {
  background: var(--red);
}

/* ===== DOORS ===== */
.door-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

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

.door-label {
  font-size: 13px;
  color: var(--muted);
}

/* ===== DOOR INFO LAYOUT (NEW) ===== */
.door-info {
      flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;

}

.door-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* ===== DOOR STATE ===== */
.door-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  margin-top: 0;
  margin-bottom: 6px;
  color: #111827;
  order: 1;
}

/* Door label below pill */
.door-label {
  order: 2;
}

/* OPEN */
.door-state.alert {
  background: #fef2f2;
}

.door-state.alert::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dc2626;
}

/* CLOSED */
.door-state.ok {
  background: #eff6ff;
}

.door-state.ok::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb;
}

/* ================================================= */
/* ✅ LAST UPDATED — CLEAN METADATA STYLE */
/* ================================================= */

.door-update {
  display: flex;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
    flex-wrap: wrap;
  white-space: nowrap;
  line-height: 1.4;
}

.door-update::before {
  content: "🕒";
  font-size: 11px;
  opacity: 0.6;
  flex-shrink: 0;
}

.door-time {
  font-weight: 500;
  color: var(--muted);
   word-break: break-word;
}

/* ===== TELEMETRY ===== */
.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.env-mini {
  background: #fbfbf7;
  border-radius: 14px;
  padding: 10px 10px 30px;
  border: 1px solid var(--border);
}

.env-mini-title {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.telemetry-chart {
  width: 100%;
  height: 120px;
}

.tel-anomaly {
  width: 680px;
}

.alignment {
  width: 300px;
}

/* ===== TABLE ===== */
table {
  background-color: #faf9f6;
  width: 100%;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

th,
td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
}

/* ===== EVENT LOG ===== */
.log-box {
  max-height: 180px;
  overflow-y: auto;
  border-radius: 12px;
  background: #fbfbf7;
  border: 1px solid var(--border);
}

/* ================================================= */
/* RESPONSIVE */
/* ================================================= */

@media (max-width: 1100px) {
  .main-grid {
    grid-template-columns: 260px 1fr;
  }

  .alert-column {
    position: static;
  }
}

@media (max-width: 900px) {
  body {
    padding: 20px 14px 28px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .page-title {
    font-size: 20px;
  }

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

  .alert-column {
    order: -1;
  }

  .tel-anomaly,
  .alignment {
    width: 100%;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .card,
  .card-soft {
    padding: 14px;
    border-radius: 14px;
  }

  .card-title {
    font-size: 11px;
  }

  .door-state {
    font-size: 12px;
    padding: 5px 12px;
  }

  .telemetry-chart {
    height: 100px;
  }
}


/* ================================
   📦 Reference Ranges – Safe UI
================================ */
/* ================================
   CONFIGURED LIMITS – CENTERED UI
================================ */

/* Outer card */
.reference-card {
  padding: 24px 22px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid #eef2f7;
}

/* Inner container */
.config-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Title */
.config-title {
  text-align: center;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #6b7280;
  margin-bottom: 22px;
}

/* Config blocks */
.config-box {
  width: 100%;
  max-width: 280px;              /* 🔑 fixes overflow */
  background: #ffffff;
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 16px;
  text-align: center;

  border: 1px solid #f1f5f9;
  box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}

/* Secondary (muted) box */
.config-box.muted {
  background: #f8fafc;
}

/* Label */
.config-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

/* Value */
.config-value {
  font-size: 15px;
  font-weight: 800;
  color: #2f766a;
  letter-spacing: 0.02em;
}

/* ± range */
.config-value span {
  font-size: 16px;
  font-weight: 700;
  color: #7aa6a0;
}

/* Footer */
.config-footer {
  margin-top: 14px;
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
}
