#gates-page[hidden] {
  display: none !important;
}

.gates-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.gates-heading h2 {
  margin: 7px 0;
}

.gates-heading p {
  margin: 0;
  color: #718096;
}

.gate-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.gate-metrics article {
  padding: 20px;
  border: 1px solid #e3edf6;
  border-radius: 16px;
  background: #fff;
}

.gate-metrics span {
  color: #718096;
  font-size: 13px;
  font-weight: 700;
}

.gate-metrics strong {
  display: block;
  margin-top: 8px;
  color: #12304f;
  font-size: 30px;
}

.gate-system-status {
  display: inline-flex;
  align-items: center;
  margin-bottom: 18px;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}

.gate-system-status.connected {
  background: #e9fbf4;
  color: #14865f;
}

.gate-system-status.disconnected {
  background: #fff0f0;
  color: #c94d4d;
}

.gate-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.gate-card {
  padding: 22px;
  border: 1px solid #e3edf6;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(25, 71, 113, .06);
}

.gate-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #09b9ef, #0877e8);
  color: white;
  font-size: 18px;
  font-weight: 900;
}

.gate-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.gate-direction {
  color: #079bd3;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
}

.gate-card h3 {
  margin: 5px 0 14px;
  color: #14314f;
}

.gate-card p {
  color: #718096;
  line-height: 1.5;
}

.gate-status {
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.gate-status.ready {
  background: #e9fbf4;
  color: #14865f;
}

.gate-status.disabled {
  background: #f1f4f7;
  color: #77899a;
}

.gate-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 0 0 20px;
}

.gate-details dt {
  margin-bottom: 4px;
  color: #8495a7;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.gate-details dd {
  margin: 0;
  color: #233d58;
  font-size: 13px;
  font-weight: 700;
}

.gate-open-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(90deg, #0dbcec, #0877e8);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.gate-open-button:disabled {
  background: #e7edf2;
  color: #8495a7;
  cursor: not-allowed;
}

.gate-safety-note {
  display: block;
  margin-top: 10px;
  color: #8495a7;
  text-align: center;
}

.gate-history-panel {
  padding: 22px;
}

.gate-section-title h3 {
  margin: 5px 0 18px;
}

.gate-table-wrap {
  overflow-x: auto;
}

.gate-table {
  width: 100%;
  border-collapse: collapse;
}

.gate-table th,
.gate-table td {
  padding: 13px 11px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  white-space: nowrap;
}

.gate-table th {
  color: #718096;
  font-size: 10px;
  text-transform: uppercase;
}

.gate-table td {
  color: #29435d;
  font-size: 13px;
}

.command-status {
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.command-status.sent,
.command-status.confirmed {
  background: #e9fbf4;
  color: #14865f;
}

.command-status.pending {
  background: #fff8df;
  color: #a87900;
}

.command-status.failed,
.command-status.denied {
  background: #fff0f0;
  color: #c94d4d;
}

.gate-message {
  padding: 40px;
  color: #718096;
  text-align: center;
}

@media (max-width: 800px) {
  .gate-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .gates-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .gate-metrics,
  .gate-details {
    grid-template-columns: 1fr;
  }
}
