:root {
  color-scheme: light;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #f3f4f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #10b981;
  --border: #e5e7eb;
  --radius: 18px;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(160deg, #eef1ff, #f9fafb);
  color: var(--text);
  min-height: 100vh;
  padding: 48px 18px 80px;
}

.admin-shell {
  margin: 0 auto;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding: 12px 4px;
}

.admin-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2.4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.admin-header .subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  border: 1px solid rgba(37, 99, 235, 0.04);
  backdrop-filter: blur(6px);
}

.card h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

.form-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: end;
}

label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input {
  margin-top: 6px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
  background: #f9fafb;
}

input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.7);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  background: #fff;
}

.field-row {
  display: flex;
  flex-direction: column;
}

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

button {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.2s;
  box-shadow: var(--shadow-soft);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.18);
}

button:active {
  transform: translateY(0);
}

button.ghost {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-dark);
  box-shadow: none;
}

button.ghost:hover {
  box-shadow: none;
  filter: brightness(1.05);
}

.hint {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 560px;
}

thead th {
  text-align: left;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 14px 0;
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

tbody tr:last-child td {
  border-bottom: none;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.status.err {
  background: rgba(248, 113, 113, 0.14);
  color: #b91c1c;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
}

.row-actions button {
  padding: 10px 16px;
  font-size: 0.85rem;
  background: linear-gradient(135deg, #f97316, #ea580c);
  box-shadow: none;
}

.row-actions button:disabled {
  opacity: 0.35;
  cursor: default;
  background: rgba(15, 23, 42, 0.08);
  color: var(--muted);
}

.empty-state td {
  text-align: center;
  padding: 30px 0;
  color: var(--muted);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  min-width: 220px;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.25);
  z-index: 999;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-ok {
  background: rgba(16, 185, 129, 0.95);
}

.toast-warn {
  background: rgba(251, 191, 36, 0.95);
  color: #1f2937;
}

.toast-error {
  background: rgba(248, 113, 113, 0.95);
}

.toast-info {
  background: rgba(15, 23, 42, 0.92);
}

@media (max-width: 768px) {
  body {
    padding: 32px 14px 60px;
  }

  .card {
    padding: 22px 20px;
  }

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

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

  .row-actions {
    justify-content: flex-start;
  }

  button {
    width: 100%;
  }

  button.ghost {
    width: auto;
  }
}
