:root {
  --primary: #7367f0;
  --primary-dark: #5e50ee;
  --body-bg: #f8f7fa;
  --surface: #ffffff;
  --text: #2f2b3d;
  --muted: #6f6b7d;
  --border: #dbdade;
  --danger: #ea5455;
  --success: #28c76f;
  --shadow: 0 0.25rem 1.125rem rgba(47, 43, 61, 0.1);
  --sidebar-width: 270px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--body-bg);
  color: var(--text);
  font-family: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

a {
  color: inherit;
}

.layout {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1030;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.22s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0 0.6rem 1rem;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 0.7rem;
  background: linear-gradient(135deg, var(--primary), #9c8cff);
  color: #fff;
  font-weight: 700;
}

.menu {
  display: grid;
  gap: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.menu-link,
.logout-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 42px;
  padding: 0.65rem 0.85rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-link .nav-icon:first-child {
  margin-left: 0.05rem;
}

.brand-mark {
  box-shadow: 0 0.25rem 0.75rem rgba(115, 103, 240, 0.28);
}

.menu-link:hover,
.menu-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 0.125rem 0.375rem rgba(115, 103, 240, 0.35);
}

.logout-form {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.layout-page {
  width: 100%;
  min-width: 0;
  padding-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 72px;
  margin: 1.25rem 1.5rem 0;
  padding: 0.85rem 1.25rem;
  border: 1px solid rgba(219, 218, 222, 0.65);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.breadcrumb {
  color: var(--muted);
  font-size: 0.8rem;
}

.topbar h1 {
  margin: 0.15rem 0 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.health-button,
.button,
.card button,
.nc-login-card button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 0.45rem;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0.125rem 0.375rem rgba(115, 103, 240, 0.3);
}

.health-button {
  margin-left: auto;
  background: #f1f0ff;
  color: var(--primary);
  box-shadow: none;
}

.button.secondary {
  background: #f3f2f7;
  color: var(--muted);
  box-shadow: none;
}

.button.danger {
  background: var(--danger);
}

.icon-button {
  width: 40px;
  height: 40px;
  display: none;
  place-items: center;
  border: 0;
  border-radius: 0.45rem;
  background: #f3f2f7;
  color: var(--text);
  cursor: pointer;
}

.content {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 1.5rem;
}

.grid {
  display: grid;
  gap: 1.25rem;
}

.stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.two {
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
}

.card {
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid rgba(219, 218, 222, 0.75);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

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

.stat {
  margin-top: 0.35rem;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th,
td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  margin-bottom: 0.85rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 110px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  outline: 0;
  box-shadow: 0 0 0 0.18rem rgba(115, 103, 240, 0.16);
}

code {
  display: inline-block;
  max-width: 100%;
  padding: 0.18rem 0.4rem;
  border-radius: 0.35rem;
  background: #f3f2f7;
  color: #5b55d6;
  overflow-wrap: anywhere;
}

.admin-inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
  gap: 0.65rem;
  align-items: start;
}

.admin-inline-form input,
.admin-inline-form select,
.admin-inline-form textarea {
  margin-bottom: 0;
}

.flash,
.errors {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.55rem;
  background: rgba(40, 199, 111, 0.12);
  color: #168a4d;
}

.errors {
  background: rgba(234, 84, 85, 0.12);
  color: var(--danger);
}

.nc-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(115, 103, 240, 0.22), transparent 30%),
    var(--body-bg);
}

.nc-login-card {
  width: min(100%, 430px);
  padding: 2rem;
  border-radius: 0.85rem;
  background: #fff;
  box-shadow: var(--shadow);
}

.nc-login-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.nc-login-card h1 {
  margin: 1rem 0 0.35rem;
  font-size: 1.45rem;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-left: 0;
  margin-top: 1rem;
  list-style: none;
}

.page-link,
.page-item span {
  display: inline-flex;
  min-width: 36px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  border-radius: 0.45rem;
  background: #f3f2f7;
  color: var(--muted);
  text-decoration: none;
}

.page-item.active .page-link,
.page-link:hover {
  background: var(--primary);
  color: #fff;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1199px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-105%);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .layout-page {
    padding-left: 0;
  }

  .icon-button {
    display: grid;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1020;
    background: rgba(47, 43, 61, 0.45);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }
}

@media (max-width: 767px) {
  .topbar {
    margin: 0;
    border-radius: 0;
  }

  .content {
    padding: 1rem;
  }

  .stats {
    grid-template-columns: 1fr;
  }

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