/* TailAdmin-inspired styles — plain CSS (Tailwind CDN does not process @apply). */
:root {
  --sidebar-w: 260px;
}

body { font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif; }

/* Sidebar nav active state */
.nav-item.active {
  background-color: rgb(59 130 246 / 0.12);
  color: rgb(37 99 235);
  font-weight: 600;
  border-left: 3px solid rgb(37 99 235);
}

/* ── Form elements ────────────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;          /* slate-700 */
  margin-bottom: 0.25rem;
}

.form-input {
  display: block;
  width: 100%;
  border-radius: 0.375rem;
  border: 1px solid #cbd5e1; /* slate-300 */
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background-color: #fff;
}
.form-input:focus {
  border-color: #3b82f6;   /* blue-500 */
  box-shadow: 0 0 0 1px #3b82f6;
}

select.form-input {
  appearance: auto;
}

textarea.form-input {
  min-height: 6rem;
  resize: vertical;
}

.form-error {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #dc2626;           /* red-600 */
}

.form-hint {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #64748b;           /* slate-500 */
}

/* Checkbox / toggle alignment */
.form-input[type="checkbox"] {
  display: inline-block;
  width: auto;
  box-shadow: none;
  vertical-align: middle;
  margin-right: 0.5rem;
  accent-color: #3b82f6;
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  line-height: 1.25rem;
  border: none;
}
.btn:disabled, .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s;
  text-decoration: none;
  line-height: 1.25rem;
  border: none;
  background-color: #2563eb; /* blue-600 */
  color: #fff;
}
.btn-primary:hover { background-color: #1d4ed8; }  /* blue-700 */
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s;
  text-decoration: none;
  line-height: 1.25rem;
  border: 1px solid #cbd5e1; /* slate-300 */
  background-color: #fff;
  color: #334155;           /* slate-700 */
}
.btn-ghost:hover { background-color: #f8fafc; } /* slate-50 */

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s;
  text-decoration: none;
  line-height: 1.25rem;
  border: none;
  background-color: #dc2626; /* red-600 */
  color: #fff;
}
.btn-danger:hover { background-color: #b91c1c; } /* red-700 */
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0; /* slate-200 */
  background-color: #fff;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 1.5rem;
}

.card-body {
  padding: 1.5rem;
}

/* ── Badges ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25rem;
}

.badge-ok {
  display: inline-flex; align-items: center; border-radius: 9999px;
  padding: 0.125rem 0.625rem; font-size: 0.75rem; font-weight: 500;
  background-color: #ecfdf5;  /* emerald-50 */
  color: #047857;             /* emerald-700 */
}

.badge-warn {
  display: inline-flex; align-items: center; border-radius: 9999px;
  padding: 0.125rem 0.625rem; font-size: 0.75rem; font-weight: 500;
  background-color: #fffbeb;  /* amber-50 */
  color: #b45309;             /* amber-700 */
}

.badge-bad {
  display: inline-flex; align-items: center; border-radius: 9999px;
  padding: 0.125rem 0.625rem; font-size: 0.75rem; font-weight: 500;
  background-color: #fef2f2;  /* red-50 */
  color: #b91c1c;             /* red-700 */
}

.badge-muted {
  display: inline-flex; align-items: center; border-radius: 9999px;
  padding: 0.125rem 0.625rem; font-size: 0.75rem; font-weight: 500;
  background-color: #f1f5f9;  /* slate-100 */
  color: #475569;             /* slate-600 */
}

/* ── Tables ───────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

.table {
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead {
  background-color: #f8fafc;  /* slate-50 */
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;             /* slate-500 */
}

.table th {
  padding: 0.75rem 1.5rem;
  text-align: left;
  font-weight: 500;
}

.table td {
  padding: 1rem 1.5rem;
  vertical-align: middle;
  color: #334155;             /* slate-700 */
}

.table tbody tr {
  border-top: 1px solid #f1f5f9; /* slate-100 */
  transition: background-color 0.1s;
}

.table tbody tr:hover {
  background-color: #f8fafc;  /* slate-50 */
}

/* Dense editor table (e.g. backend targets): inputs need the full cell. */
.table-targets {
  table-layout: fixed;
  width: 100%;
}
.table-targets th,
.table-targets td {
  padding: 0.5rem 0.5rem;
}
.table-targets th {
  white-space: nowrap;        /* ENABLED/BACKUP must not merge visually */
}
.table-targets td .form-input {
  width: 100%;
  min-width: 0;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
/* Number spinners eat ~20px of an already-tight cell; the fields are
   small integers operators type directly. */
.table-targets input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.table-targets input[type="number"]::-webkit-outer-spin-button,
.table-targets input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ── Pagination ───────────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  color: #334155;
  transition: background-color 0.15s;
}

.pagination a:hover {
  background-color: #f1f5f9;
}

.pagination .active {
  background-color: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
