:root {
  --bg: #0f172a;
  --bg-card: #020617;
  --fg: #e5e7eb;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.15);
  --danger: #f97373;
  --danger-soft: rgba(248, 113, 113, 0.15);
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.15);
  --muted: #6b7280;
  --border: #1f2937;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #1e293b, #020617 55%);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px;
}

.app {
  width: 100%;
  max-width: 1100px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 25px 80px rgba(15, 23, 42, 0.9);
  padding: 20px 22px 24px;
  backdrop-filter: blur(20px);
}

header {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  height: 40px;
  display: block;
}

.badge-env {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #bbf7d0;
  white-space: nowrap;
}

.badge-env.error {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 10px;
}

@media (max-width: 780px) {
  .grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .table-wrapper {
    max-height: 560px;
    overflow-y: auto;
  }
}

.card {
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.98),
    rgba(2, 6, 23, 0.98)
  );
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 14px 14px 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
}

.card-subtitle {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

label {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-bottom: 3px;
}

input[type="text"] {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.9);
  color: var(--fg);
  font-size: 13px;
  padding: 7px 9px;
  outline: none;
  width: 100%;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
}

.field-half {
  flex: 1 1 160px;
}

.btn {
  border-radius: 999px;
  border: none;
  font-size: 13px;
  padding: 7px 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.08s ease, box-shadow 0.08s ease,
    background 0.08s ease;
}

/* glow sedikit dikurangi */
.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: white;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.45);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

/* glow aktifnya juga sedikit dikurangi */
.btn-primary:not(:disabled):active {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.9);
  color: var(--fg);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(15, 23, 42, 1);
  border-color: rgba(148, 163, 184, 0.8);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.9);
}

.btn-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
}

.btn-icon:hover {
  border-color: rgba(248, 113, 113, 0.6);
  color: var(--danger);
  background: rgba(15, 23, 42, 1);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.9);
}

.status-dot.bad {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.9);
}

.status-badge {
  border-radius: 999px;
  font-size: 11px;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
}

.status-badge.ok {
  background: var(--ok-soft);
  border-color: rgba(74, 222, 128, 0.4);
  color: #bbf7d0;
}

.status-badge.bad {
  background: var(--danger-soft);
  border-color: rgba(248, 113, 113, 0.55);
  color: #fecaca;
}

.status-badge.neutral {
  background: rgba(30, 64, 175, 0.18);
  border-color: rgba(59, 130, 246, 0.55);
  color: #bfdbfe;
}

/* --- layout status bertumpuk (BLOCKED) --- */
.status-mainline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-badge.stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

/* pill di layout stack tidak perlu margin-left */
.status-badge.stack .pill {
  margin-left: 0;
}

.table-wrapper {
  border-radius: 10px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: radial-gradient(circle at top left, #020617, #020617 60%);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 100%;
}

thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(15, 23, 42, 0.97);
}

th,
td {
  padding: 7px 9px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.9);
  vertical-align: middle;
}

th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  position: sticky;
  top: 0;
  backdrop-filter: blur(12px);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(15, 23, 42, 0.7);
}

.domain-cell-main {
  font-size: 13px;
  font-weight: 500;
}

.domain-link {
  color: var(--fg);
  text-decoration: none;
}

.domain-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.domain-cell-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.muted {
  color: var(--muted);
  font-size: 11px;
}

.tag {
  font-size: 10px;
  border-radius: 999px;
  padding: 2px 6px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #e5e7eb;
  margin-left: 6px;
}

.pill {
  font-size: 10px;
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(55, 65, 81, 0.9);
  color: #e5e7eb;
}

.text-right {
  text-align: right;
}

.center-text {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 14px 0;
}

.badge-small {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: var(--muted);
}

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
  gap: 10px;
}

.link {
  color: var(--accent);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.error-text {
  color: #fecaca;
  font-size: 11px;
}

.search-input {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.9);
  color: var(--fg);
  font-size: 12px;
  padding: 6px 10px;
  min-width: 180px;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
  outline: none;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.pagination-btn {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.9);
  font-size: 11px;
  padding: 4px 10px;
  color: var(--muted);
  cursor: pointer;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Modal edit domain */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.86);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.show {
  display: flex;
}

.modal-card {
  background: linear-gradient(135deg, #020617, #020617);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 16px 18px 14px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.9);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-title {
  font-size: 14px;
  font-weight: 600;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.field-group label {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-bottom: 3px;
}

.field-group input[type="text"] {
  width: 100%;
}
