* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e5e7eb;
  background:
    radial-gradient(circle at 10% 0%, rgba(59, 130, 246, 0.18), transparent 30%),
    radial-gradient(circle at 90% 0%, rgba(168, 85, 247, 0.14), transparent 32%),
    #0f172a;
}

button,
input {
  font: inherit;
}

button,
.link-btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 15px;
  background: rgba(51, 65, 85, 0.96);
  color: #e5e7eb;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.link-btn:hover {
  filter: brightness(1.12);
}

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

input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  color: #e5e7eb;
  background: rgba(2, 6, 23, 0.72);
}

input:focus {
  border-color: rgba(96, 165, 250, 0.86);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.page {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 30px 0;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.brand {
  display: inline-flex;
  padding: 7px 13px;
  border: 1px solid rgba(147, 197, 253, 0.35);
  border-radius: 999px;
  color: #93c5fd;
  background: rgba(15, 23, 42, 0.7);
  font-size: 13px;
}

.header h1 {
  margin: 14px 0 8px;
  font-size: clamp(30px, 5vw, 48px);
}

.header p,
.panel p,
.login-card p,
.muted {
  color: #94a3b8;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}

.login-card,
.panel,
.stat-card,
.warning,
.safe {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.78);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(14px);
}

.login-card {
  max-width: 460px;
  margin: 50px auto;
  padding: 26px;
}

.login-card label {
  display: block;
  margin: 16px 0 8px;
  color: #cbd5e1;
}

.primary {
  width: 100%;
  margin-top: 14px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-weight: 800;
}

.error {
  color: #fecaca;
  margin-top: 12px;
}

.warning,
.safe {
  padding: 14px 16px;
  margin-bottom: 16px;
}

.warning {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
  background: rgba(127, 29, 29, 0.28);
}

.safe {
  border-color: rgba(45, 212, 191, 0.28);
  color: #ccfbf1;
  background: rgba(20, 83, 45, 0.18);
}

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

.stat-card {
  padding: 18px;
}

.stat-value {
  font-size: 28px;
  font-weight: 900;
  color: #bfdbfe;
  word-break: break-all;
}

.stat-label {
  margin-top: 6px;
  color: #94a3b8;
  font-size: 13px;
}

.panel {
  padding: 22px;
  margin-top: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.panel-head h2,
.panel h2 {
  margin: 0 0 8px;
}

.tools {
  display: grid;
  grid-template-columns: minmax(180px, 240px) auto auto auto;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  padding: 13px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.13);
}

th {
  color: #cbd5e1;
  background: rgba(30, 41, 59, 0.75);
  font-size: 13px;
}

td {
  color: #e5e7eb;
}

code {
  padding: 4px 7px;
  border-radius: 8px;
  color: #bfdbfe;
  background: rgba(30, 41, 59, 0.9);
}

.badge {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.badge.ok {
  background: rgba(34, 197, 94, 0.15);
  color: #bbf7d0;
}

.badge.warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fde68a;
}

.badge.danger {
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.danger {
  background: rgba(220, 38, 38, 0.9);
}

.empty {
  text-align: center;
  color: #94a3b8;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.password-form {
  display: grid;
  grid-template-columns: 1fr 1fr 160px;
  gap: 10px;
}

.password-form .primary {
  margin-top: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.72);
}

.modal-card {
  width: min(820px, 100%);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 22px;
  background: #0f172a;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  padding: 20px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.detail-grid div,
.mini-item {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 12px;
  background: rgba(30, 41, 59, 0.55);
}

.detail-grid span {
  display: block;
  color: #94a3b8;
  font-size: 12px;
  margin-bottom: 6px;
}

.detail-grid strong {
  word-break: break-all;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-item {
  display: grid;
  grid-template-columns: 80px 1fr 120px;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 100;
  padding: 12px 18px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.96);
  color: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

@media (max-width: 860px) {
  .header,
  .panel-head {
    flex-direction: column;
  }

  .tools,
  .password-form,
  .stat-grid,
  .detail-grid,
  .mini-item {
    grid-template-columns: 1fr;
  }

  .header-actions,
  .row-actions {
    flex-direction: column;
    width: 100%;
  }

  .header-actions button,
  .header-actions a,
  .row-actions button {
    width: 100%;
    text-align: center;
  }
}
