:root {
  --bg: #eef2f6;
  --card: #ffffff;
  --text: #172738;
  --muted: #627185;
  --line: #d6dee7;
  --accent: #0f6b8c;
  --accent-2: #1e4d7d;
  --ok: #2f8f5f;
  --bad: #b74235;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 15%, #d3e7ef 0, transparent 38%),
    radial-gradient(circle at 85% 18%, #e9f0d8 0, transparent 34%),
    var(--bg);
  min-height: 100vh;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(56px);
  opacity: 0.44;
  pointer-events: none;
}

.shape-a {
  width: 280px;
  height: 280px;
  background: #9fd3c7;
  top: -90px;
  right: -80px;
}

.shape-b {
  width: 260px;
  height: 260px;
  background: #f5c48f;
  bottom: -95px;
  left: -80px;
}

.container {
  max-width: 1180px;
  margin: 22px auto;
  padding: 0 16px 56px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(18, 42, 68, 0.08);
  margin-bottom: 12px;
}

.narrow {
  max-width: 430px;
  margin: 80px auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

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

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 1.55rem;
}

h2 {
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.muted {
  color: var(--muted);
  margin-top: 6px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-connection-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.meta-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #f8fbff;
}

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

.meta-value {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 4px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-inline {
  display: grid;
  grid-template-columns: 180px 1fr 2fr 120px;
  gap: 8px;
}

label {
  font-size: 0.9rem;
  display: grid;
  gap: 6px;
  color: #304961;
}

input,
select,
button,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 96px;
}

button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: white;
  cursor: pointer;
}

button:hover {
  opacity: 0.94;
}

button.secondary {
  background: #eef4fa;
  color: var(--text);
  border: 1px solid var(--line);
}

button.mini {
  padding: 6px 8px;
  font-size: 0.77rem;
}

button.danger-outline {
  border-color: #e6b3ad;
  color: #7d2e26;
  background: #fff7f5;
}

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

.row.spread {
  justify-content: space-between;
  align-items: center;
}

.table-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.table-scroll-medium {
  max-height: 280px;
}

.table-scroll-large {
  max-height: 350px;
}

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

th,
td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.88rem;
  white-space: nowrap;
}

.log-detail {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 520px;
  line-height: 1.3;
}

th {
  color: #274562;
  background: #f5f9fd;
  position: sticky;
  top: 0;
  z-index: 1;
}

.msg {
  margin: 10px 0 0;
  font-size: 0.9rem;
}

.token-box {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px dashed #9fb4c9;
  background: #f8fbff;
  font-family: Consolas, "Courier New", monospace;
  word-break: break-all;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.ok {
  color: #1f6040;
  background: #d7f2e4;
}

.badge.bad {
  color: #6e2a22;
  background: #f8ddd9;
}

.token-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.token-cell code {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-area {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 2000;
}

.notice {
  background: #12263a;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 240px;
  box-shadow: 0 10px 24px rgba(8, 18, 28, 0.35);
}

.notice.error {
  background: #6f221a;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 20, 28, 0.45);
  display: grid;
  place-items: center;
  z-index: 2100;
  padding: 16px;
}

.modal-card {
  width: min(620px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 16px 40px rgba(18, 37, 58, 0.28);
}

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

.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.field-help {
  font-size: 0.8rem;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.boot-error {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 5000;
  padding: 10px 12px;
  border: 1px solid #e6b3ad;
  border-radius: 10px;
  background: #fff4f2;
  color: #7d2e26;
  font-size: 0.86rem;
}

@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .admin-connection-grid {
    grid-template-columns: 1fr;
  }

  .form-inline {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  th,
  td {
    font-size: 0.82rem;
  }
}
