@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
  --bg: #f8f2f7;
  --panel: #4a173f;
  --panel-soft: #7a305f;
  --accent: #f05b93;
  --accent-soft: #ffb6d0;
  --text: #2f2333;
  --muted: #726577;
  --line: rgba(74, 23, 63, 0.12);
  --success: #1f9b73;
  --danger: #d44f6a;
  --warning: #ffb347;
  --shadow: 0 22px 54px rgba(74, 23, 63, 0.12);
}

* {
  box-sizing: border-box;
}

a {
  text-decoration: none;
}

body {
  margin: 0;
  font-family: 'Source Sans 3', sans-serif;
  background: linear-gradient(180deg, #fff8fc 0%, #f7eef7 100%);
  color: var(--text);
}

.container {
  width: 100%;
  padding: 0 20px 0 24px;
  margin: 0 auto;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.24s ease;
}

body.sidebar-collapsed .admin-shell {
  grid-template-columns: 88px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #4a173f 0%, #63244f 100%);
  color: #fff;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.24s ease, transform 0.24s ease;
  z-index: 90;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sidebar h1,
.sidebar h2,
.content h1,
.panel h2,
.table-card h2,
.login-card h1 {
  font-family: 'Space Grotesk', sans-serif;
}

.sidebar .brand {
  display: block;
  margin-bottom: 26px;
}

.brand-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.brand-subtitle {
  margin: 10px 0 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.82);
}

.brand-user {
  margin: 10px 0 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.88);
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.9);
}

.nav-icon {
  width: 18px;
  display: inline-flex;
  justify-content: center;
  flex: 0 0 18px;
}

.nav-label {
  white-space: nowrap;
}

body.sidebar-collapsed .sidebar {
  padding-inline: 14px;
}

body.sidebar-collapsed .sidebar .brand p,
body.sidebar-collapsed .sidebar .nav-label {
  display: none;
}

body.sidebar-collapsed .sidebar .brand-title {
  font-size: 1rem;
}

body.sidebar-collapsed .sidebar nav a {
  justify-content: center;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27, 9, 24, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
  z-index: 80;
}

body.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.content {
  padding: 24px 0 32px;
  overflow-x: hidden;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.page-header-main {
  display: flex;
  align-items: center;
  min-width: 0;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle {
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--panel);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.sidebar-toggle-inline {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: none;
  display: none;
}

.sidebar-toggle-mobile {
  display: none;
}

.card-grid,
.dashboard-grid,
.form-grid,
.stats-grid {
  display: grid;
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel,
.table-card,
.stat-card,
.login-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  color: var(--panel);
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.btn,
.btn-secondary,
.btn-danger,
.inline-btn {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
}

.btn-small {
  padding: 8px 14px;
  font-size: 0.9rem;
}

.btn {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #ff8ab5);
}

.btn-secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--panel);
}

.btn-danger,
.inline-btn.danger {
  color: #fff;
  background: var(--danger);
}

.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
}

.flash-success {
  background: rgba(31, 155, 115, 0.1);
  color: #126046;
}

.flash-error {
  background: rgba(212, 79, 106, 0.1);
  color: #8b2842;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(74, 23, 63, 0.08);
  text-align: left;
  vertical-align: top;
}

.table tbody tr[data-editable-row] {
  cursor: pointer;
  transition: background 0.18s ease;
}

.table tbody tr[data-editable-row]:hover {
  background: rgba(240, 91, 147, 0.06);
}

.editor-shell {
  display: grid;
  gap: 18px;
}

.editor-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.table-tools {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.table-note {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(240, 91, 147, 0.12);
  color: var(--panel);
  font-size: 0.85rem;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
}

.login-card .form-grid {
  grid-template-columns: 1fr;
}

.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filters .field {
  min-width: 180px;
  flex: 1;
}

.note {
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    transform: translateX(-100%);
  }

  .container {
    padding: 0 14px;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-collapsed .admin-shell {
    grid-template-columns: 1fr;
  }

  body.sidebar-collapsed .sidebar {
    padding-inline: 20px;
  }

  body.sidebar-collapsed .sidebar .brand p,
  body.sidebar-collapsed .sidebar .nav-label {
    display: block;
  }

  body.sidebar-collapsed .sidebar nav a {
    justify-content: flex-start;
  }

  .sidebar-toggle-inline,
  .sidebar-toggle-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-toggle-desktop {
    display: none;
  }

  .dashboard-grid,
  .stats-grid,
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-grid,
  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header-actions {
    justify-content: flex-end;
  }

  .table-tools {
    flex-direction: column;
    align-items: flex-start;
  }
}
