:root {
  --bg: #f7f8fb;
  --card: #ffffff;
  --muted: #6b7280;
  --text: #111827;
  --primary: #4f46e5;
  --primary-strong: #4338ca;
  --border: #e5e7eb;
  --danger: #e11d48;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

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

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

h1,
h2,
h3 {
  margin: 0 0 0.25rem;
}

p {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(239, 239, 239, 0.9);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.5px;
}

.user-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.page {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subsection {
  margin-top: 1rem;
}

.grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
}

.stretch {
  height: 100%;
}

.pill-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pill {
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  min-width: 140px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #fff;
  transition: background 0.2s ease, transform 0.1s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.primary {
  background: var(--primary);
}

.primary:hover {
  background: var(--primary-strong);
}

.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.danger {
  color: var(--danger);
  border-color: rgba(225, 29, 72, 0.4);
}

.is-hidden {
  display: none !important;
}

.block {
  width: 100%;
}

.status {
  min-height: 1.2rem;
  margin-top: 0.35rem;
  font-size: 0.9rem;
}

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

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

th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  background: #f5f5f5;
}

tr:hover td {
  background: rgba(79, 70, 229, 0.06);
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.center {
  text-align: center;
}

dialog {
  border: none;
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  padding: 1rem 1.25rem;
  max-width: 360px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.dialog-form h3 {
  margin-bottom: 0.5rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Loader */
.loader {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 999;
}

.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(79, 70, 229, 0.2);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@media (max-width: 600px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

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

  .table-actions {
    flex-direction: column;
  }
}

