* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6fb;
  color: #1f2937;
}

.admin-header {
  padding: 22px 28px;
  background: linear-gradient(135deg, #16213e, #23395d);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-header h1 {
  margin: 0;
  font-size: 24px;
}

.admin-header p {
  margin: 6px 0 0;
  opacity: 0.85;
}

#reloadBtn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  background: white;
  color: #16213e;
  font-weight: 700;
  cursor: pointer;
}

.admin-main {
  padding: 24px;
  max-width: 1500px;
  margin: 0 auto;
}

.summary-area {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: white;
  border-radius: 16px;
  padding: 18px 22px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.summary-label {
  font-size: 13px;
  color: #64748b;
}

.summary-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 800;
}

.admin-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tab-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  background: white;
  color: #334155;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
}

.tab-btn.active {
  background: #2563eb;
  color: white;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.table-area,
.detail-area,
.alias-panel {
  background: white;
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.table-area h2,
.detail-area h2,
.alias-panel h2 {
  margin-top: 0;
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

th {
  background: #f8fafc;
  text-align: left;
  color: #475569;
}

tr:hover {
  background: #f9fafb;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.badge-ok {
  background: #dcfce7;
  color: #166534;
}

.badge-ng {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-warn {
  background: #fef3c7;
  color: #92400e;
}

.badge-muted {
  background: #e5e7eb;
  color: #374151;
}

.detail-btn,
.delete-btn,
.primary-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  color: white;
  cursor: pointer;
  font-weight: 800;
}

.detail-btn {
  background: #2563eb;
}

.delete-btn {
  background: #ef4444;
  margin-top: 10px;
}

.primary-btn {
  background: linear-gradient(135deg, #06b6d4, #7c3aed);
  border-radius: 999px;
  padding: 12px 20px;
}

#detailBox {
  background: #0f172a;
  color: #dbeafe;
  border-radius: 12px;
  padding: 16px;
  overflow-x: auto;
  min-height: 260px;
  font-size: 13px;
}

.alias-desc {
  color: #475569;
  line-height: 1.8;
}

.alias-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.alias-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.alias-form input,
.alias-form textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 11px 12px;
  background: white;
  color: #0f172a;
  outline: none;
}

.alias-form textarea {
  min-height: 82px;
  resize: vertical;
}

.alias-form button {
  grid-column: 1 / -1;
}

.status-box {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #0f172a;
  background: #f1f5f9;
}

.alias-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.alias-item {
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.alias-main,
.alias-sub {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #0f172a;
  line-height: 1.7;
  word-break: break-all;
}

.alias-label {
  min-width: 64px;
  font-size: 12px;
  color: #64748b;
}

.alias-meta {
  margin-top: 8px;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
}

.alias-memo {
  margin-top: 6px;
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
}

.alias-empty {
  color: #64748b;
  padding: 12px;
}

@media(max-width:768px) {
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .summary-area {
    flex-direction: column;
  }

  .alias-form {
    grid-template-columns: 1fr;
  }
}