:root {
  --bg: #0f1419;
  --surface: #1a222c;
  --border: #2a3542;
  --text: #e8eef4;
  --muted: #8b9aab;
  --accent: #3d8bfd;
  --danger: #e85d5d;
  --ok: #3ecf8e;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1c3a5c 0%, transparent 55%),
    radial-gradient(900px 500px at 90% 0%, #243528 0%, transparent 50%),
    var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.error {
  color: var(--danger);
}

code {
  font-size: 0.85em;
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.gate-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.gate-card h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 650;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  background: #10161d;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.55rem 0.7rem;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.top-actions {
  display: flex;
  gap: 0.5rem;
}

.overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

.stat .label {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat .value {
  font-size: 1.35rem;
  font-weight: 650;
  margin-top: 0.25rem;
}

.stat.warn .value {
  color: var(--danger);
}

.stat.ok .value {
  color: var(--ok);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.search {
  display: flex;
  gap: 0.4rem;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.create-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  align-items: end;
  margin-bottom: 1rem;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.create-form label {
  margin: 0;
}

.btn-danger {
  background: var(--danger);
  margin-top: 0.5rem;
}

.status-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
}

.status-badge.ACTIVE {
  color: var(--ok);
  border-color: rgba(62, 207, 142, 0.4);
}

.status-badge.SUSPENDED {
  color: #e0b34d;
  border-color: rgba(224, 179, 77, 0.45);
}

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

.quick-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 1rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: rgba(61, 139, 253, 0.08);
}

.detail {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: stretch end;
  z-index: 20;
}

.detail-inner {
  width: min(440px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 1rem 1.1rem 2rem;
  overflow-y: auto;
}

.detail-inner h3 {
  margin: 0.5rem 0 0.75rem;
}

.detail-grid {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.jobs,
.usage {
  margin-top: 1rem;
  font-size: 0.85rem;
}

.jobs li,
.usage li {
  margin-bottom: 0.35rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .detail {
    place-items: end stretch;
  }

  .detail-inner {
    width: 100%;
    max-height: 85vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
  }
}
