* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f1f5f9;
  color: #0f172a;
}

.hidden {
  display: none !important;
}

/* Login */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, #0f172a 0%, #1e3a8a 45%, #f1f5f9 45%);
}

.login-card {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.15);
}

.eyebrow {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 8px;
}

.muted {
  color: #64748b;
}

.small {
  font-size: 13px;
}

label {
  display: block;
  margin: 10px 0 4px;
  font-size: 14px;
}

input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 11px 12px;
}

input[type='color'] {
  min-height: 48px;
  padding: 4px;
  background: #fff;
}

select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

button.secondary {
  background: #475569;
}

button.danger {
  background: #b91c1c;
}

button.warn {
  background: #b45309;
}

.full {
  width: 100%;
  margin-top: 12px;
}

/* Admin shell */
.admin-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.admin-sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  text-align: right;
  background: transparent;
  color: #cbd5e1;
  border-radius: 10px;
  padding: 11px 14px;
  font-weight: 500;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.25);
  color: #fff;
}

.nav-item.link {
  text-decoration: none;
  display: block;
  color: #94a3b8;
  font-size: 14px;
}

.sidebar-footer {
  margin-top: auto;
}

.admin-main {
  padding: 28px 28px 40px;
  overflow-x: hidden;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.host-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 13px;
}

.panel-title {
  margin: 0 0 14px;
  font-size: 18px;
}

.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
}

.hint-card h3 {
  margin-top: 0;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.between {
  justify-content: space-between;
}

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

.span-2 {
  grid-column: span 2;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

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

th,
td {
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 10px;
  text-align: right;
  font-size: 14px;
}

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

.logo-preview {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.color-field {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 10px;
  align-items: center;
}

.color-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.branding-preview {
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #e2e8f0;
}

.branding-preview-card {
  border-radius: 16px;
  padding: 22px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.branding-preview-pill {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #fff;
}

.message.banner {
  margin-bottom: 16px;
}

.message {
  min-height: 22px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
}

.message.ok {
  background: #dcfce7;
  color: #14532d;
}

.message.err {
  background: #fee2e2;
  color: #7f1d1d;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px;
}

.stat-card .label {
  display: block;
  color: #64748b;
  font-size: 13px;
  margin-bottom: 10px;
}

.stat-card strong {
  font-size: 28px;
}

.stat-card-muted {
  border-style: dashed;
  background: #f8fafc;
}

.stat-card-muted .label {
  color: #64748b;
}

.deleted-hint {
  margin: 0 0 14px;
  line-height: 1.5;
}

/* Dashboard: server health (glow only when ok) */
.health-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.health-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.health-copy strong {
  font-size: 15px;
  font-weight: 600;
}

.health-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #94a3b8;
}

.health-strip.health-strip--ok {
  border-color: #86efac;
  background: linear-gradient(135deg, #f0fdf4 0%, #fff 100%);
}

.health-strip.health-strip--ok .health-dot {
  background: #22c55e;
}

.health-strip.health-strip--ok .health-dot.health-dot--glow {
  animation: health-glow 2s ease-in-out infinite;
}

@keyframes health-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  }
  50% {
    box-shadow: 0 0 18px 6px rgba(34, 197, 94, 0.45);
  }
}

.health-strip.health-strip--bad {
  border-color: #fecaca;
  background: #fef2f2;
}

.health-strip.health-strip--bad .health-dot {
  background: #ef4444;
}

.toolbar-head .toolbar-title {
  margin: 0;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Create-org modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.modal-dialog {
  position: relative;
  width: min(520px, 100%);
  max-height: min(90vh, 900px);
  overflow-y: auto;
  background: #fff;
  border-radius: 18px;
  padding: 22px 22px 24px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
  border: 1px solid #e2e8f0;
}

.modal-head {
  margin-bottom: 8px;
}

.modal-head .panel-title {
  margin: 0;
}

.modal-form {
  margin-top: 8px;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 960px) {
  .admin-app {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }
}
