:root {
  --ink: #13231e;
  --muted: #71817b;
  --surface: #ffffff;
  --canvas: #f1f6f3;
  --line: #dfe9e4;
  --sidebar: #102a22;
  --sidebar-deep: #0b201a;
  --accent: #2eaa72;
  --accent-dark: #20895a;
  --accent-soft: #e1f5eb;
  --danger: #d84f5f;
  --shadow: 0 14px 35px rgba(16, 42, 34, 0.08);
  --sidebar-width: 272px;
  --sidebar-collapsed: 84px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 15px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Dashboard shell */
.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 22px 16px 18px;
  overflow: hidden;
  color: #d9ebe3;
  background:
    radial-gradient(circle at 10% 0, rgba(46, 170, 114, 0.2), transparent 32%),
    linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-deep) 100%);
  transition: width 0.25s ease, transform 0.25s ease;
}

.sidebar-brand,
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.sidebar-brand {
  min-height: 52px;
  padding: 0 8px;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 13px;
  color: #082019;
  background: linear-gradient(135deg, #5ed99b, var(--accent));
  box-shadow: 0 8px 20px rgba(46, 170, 114, 0.25);
  font-size: 1.15rem;
  font-weight: 800;
}

.brand-copy,
.auth-brand > span:last-child {
  display: flex;
  flex-direction: column;
}

.brand-copy strong,
.auth-brand strong {
  letter-spacing: 0.08em;
  font-size: 1.05rem;
}

.brand-copy small,
.auth-brand small {
  color: #8eb3a3;
  font-size: 0.7rem;
}

.sidebar-section-label {
  margin: 38px 12px 10px;
  color: #668c7c;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  font-size: 0.67rem;
  font-weight: 700;
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
}

.sidebar-link {
  position: relative;
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border-radius: 12px;
  color: #a9c4b9;
  white-space: nowrap;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  transform: translateX(2px);
}

.sidebar-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(46, 170, 114, 0.95), rgba(32, 137, 90, 0.95));
  box-shadow: 0 9px 22px rgba(20, 105, 69, 0.3);
}

.sidebar-link span {
  font-weight: 600;
}

.sidebar-link svg,
.sidebar-collapse svg {
  display: block;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  opacity: 1;
  visibility: visible;
}

.sidebar-collapse {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  color: #90afa2;
  background: rgba(255, 255, 255, 0.035);
  white-space: nowrap;
}

.sidebar-collapse:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-collapse svg {
  flex: 0 0 22px;
  transition: transform 0.25s ease;
}

.app-main {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.25s ease;
}

.app-shell.sidebar-collapsed .sidebar,
html.sidebar-is-collapsed .app-shell .sidebar {
  width: var(--sidebar-collapsed);
}

.app-shell.sidebar-collapsed .app-main,
html.sidebar-is-collapsed .app-shell .app-main {
  margin-left: var(--sidebar-collapsed);
}

.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .sidebar-section-label,
.app-shell.sidebar-collapsed .sidebar-link span,
.app-shell.sidebar-collapsed .sidebar-collapse span,
html.sidebar-is-collapsed .app-shell .brand-copy,
html.sidebar-is-collapsed .app-shell .sidebar-section-label,
html.sidebar-is-collapsed .app-shell .sidebar-link span,
html.sidebar-is-collapsed .app-shell .sidebar-collapse span {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-link,
.app-shell.sidebar-collapsed .sidebar-collapse,
html.sidebar-is-collapsed .app-shell .sidebar-link,
html.sidebar-is-collapsed .app-shell .sidebar-collapse {
  justify-content: center;
  padding-inline: 0;
}

.app-shell.sidebar-collapsed .sidebar-collapse svg,
html.sidebar-is-collapsed .app-shell .sidebar-collapse svg {
  transform: rotate(180deg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px 34px;
  border-bottom: 1px solid rgba(218, 229, 224, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(15px);
}

.topbar-start,
.topbar-user {
  display: flex;
  align-items: center;
}

.topbar-start {
  gap: 14px;
}

.topbar-eyebrow {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-title {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 750;
}

.topbar-user {
  gap: 11px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.user-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: #176542;
  background: var(--accent-soft);
  font-weight: 800;
}

.user-copy {
  display: flex;
  min-width: 150px;
  flex-direction: column;
}

.user-copy strong {
  overflow: hidden;
  max-width: 190px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.user-copy small {
  color: var(--muted);
  font-size: 0.73rem;
}

.logout-button,
.mobile-menu-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: #f3f7f5;
  transition: color 0.18s ease, background 0.18s ease;
}

.logout-button:hover {
  color: var(--danger);
  background: #fff0f2;
}

.mobile-menu-button {
  display: none;
}

.app-content {
  width: 100%;
  max-width: 1480px;
  flex: 1;
  margin: 0 auto;
  padding: 34px;
}

.app-footer {
  padding: 18px 34px 24px;
  color: #8b9a94;
  text-align: center;
  font-size: 0.78rem;
}

.sidebar-overlay {
  display: none;
}

/* Content components */
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-title {
  margin: 0 0 5px;
  font-size: 1.45rem;
  font-weight: 760;
}

.page-description {
  margin: 0;
  color: var(--muted);
}

.app-content > h1 {
  margin-bottom: 22px;
  font-size: 1.65rem;
  font-weight: 750;
}

.app-content > form:not(.d-inline),
.auth-content form {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-header {
  min-height: 64px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfc;
}

.card-body {
  padding: 22px;
}

.table {
  margin-bottom: 0;
  color: var(--ink);
}

.table > :not(caption) > * > * {
  padding: 15px 18px;
  border-bottom-color: #e9f0ed;
}

.table thead th {
  color: #708079;
  background: #f7faf8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.71rem;
  font-weight: 750;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-bg-type: #fbfdfc;
}

.table tbody tr:hover > * {
  background: #f1faf5;
}

.form-label {
  margin-bottom: 7px;
  color: #40524b;
  font-size: 0.85rem;
  font-weight: 650;
}

.form-control,
.form-select {
  min-height: 46px;
  border-color: #d8e4df;
  border-radius: 11px;
  background-color: #fbfdfc;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.22rem rgba(46, 170, 114, 0.13);
}

.form-check-input:checked {
  border-color: var(--accent);
  background-color: var(--accent);
}

.btn {
  border-radius: 10px;
  font-weight: 650;
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 6px 14px rgba(46, 170, 114, 0.18);
}

.btn-primary:hover,
.btn-primary:focus {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.btn-outline-primary {
  border-color: #9ed7bb;
  color: var(--accent-dark);
}

.btn-outline-primary:hover {
  border-color: var(--accent);
  background: var(--accent);
}

.btn-link {
  color: var(--accent-dark);
}

.badge.bg-secondary {
  padding: 7px 10px;
  border-radius: 8px;
  color: #24744f !important;
  background: var(--accent-soft) !important;
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.status-badge > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.active {
  color: #238456;
  background: #e3f6ec;
}

.status-badge.blocked {
  color: #c24152;
  background: #ffedf0;
}

.alert {
  border: 0;
  border-radius: 13px;
}

/* Authentication */
.auth-body {
  background:
    radial-gradient(circle at 15% 15%, rgba(57, 190, 126, 0.19), transparent 28%),
    radial-gradient(circle at 90% 90%, rgba(16, 67, 52, 0.13), transparent 30%),
    #eff6f2;
}

.auth-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  padding: 38px 22px 24px;
}

.auth-brand {
  color: var(--ink);
}

.auth-brand small {
  color: var(--muted);
}

.auth-content {
  display: flex;
  width: 100%;
  max-width: 510px;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding-block: 35px;
}

.auth-content > h1 {
  margin-bottom: 18px;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 780;
}

.auth-content > p {
  max-width: 460px;
  margin: -7px auto 18px;
  text-align: center;
}

.auth-content form {
  width: 100% !important;
  max-width: none;
  padding: 32px;
}

.auth-content form > .btn-primary {
  min-width: 130px;
}

.auth-footer {
  color: #83938c;
  font-size: 0.78rem;
}

@media (max-width: 991.98px) {
  .sidebar {
    width: min(290px, 86vw);
    transform: translateX(-105%);
    box-shadow: 22px 0 50px rgba(7, 30, 23, 0.24);
  }

  .app-main,
  .app-shell.sidebar-collapsed .app-main,
  html.sidebar-is-collapsed .app-shell .app-main {
    margin-left: 0;
  }

  .app-shell.sidebar-collapsed .sidebar,
  html.sidebar-is-collapsed .app-shell .sidebar {
    width: min(290px, 86vw);
  }

  .app-shell.sidebar-collapsed .brand-copy,
  .app-shell.sidebar-collapsed .sidebar-section-label,
  .app-shell.sidebar-collapsed .sidebar-link span,
  .app-shell.sidebar-collapsed .sidebar-collapse span,
  html.sidebar-is-collapsed .app-shell .brand-copy,
  html.sidebar-is-collapsed .app-shell .sidebar-section-label,
  html.sidebar-is-collapsed .app-shell .sidebar-link span,
  html.sidebar-is-collapsed .app-shell .sidebar-collapse span {
    display: flex;
  }

  .app-shell.sidebar-collapsed .sidebar-section-label,
  html.sidebar-is-collapsed .app-shell .sidebar-section-label {
    display: block;
  }

  .app-shell.sidebar-collapsed .sidebar-link,
  .app-shell.sidebar-collapsed .sidebar-collapse,
  html.sidebar-is-collapsed .app-shell .sidebar-link,
  html.sidebar-is-collapsed .app-shell .sidebar-collapse {
    justify-content: flex-start;
    padding-inline: 14px;
  }

  .sidebar-collapse {
    display: none;
  }

  .mobile-menu-button {
    display: grid;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1030;
    display: block;
    border: 0;
    background: rgba(4, 22, 17, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.sidebar-open {
    overflow: hidden;
  }

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

  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 575.98px) {
  .topbar {
    min-height: 72px;
    padding: 10px 16px;
  }

  .topbar-eyebrow,
  .user-copy {
    display: none;
  }

  .topbar-title {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.05rem;
  }

  .topbar-user {
    gap: 7px;
    padding-left: 0;
    border-left: 0;
  }

  .app-content {
    padding: 22px 15px;
  }

  .app-content .d-flex.justify-content-between {
    align-items: flex-start !important;
    gap: 12px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-responsive-mobile {
    overflow-x: auto;
  }

  .auth-shell {
    padding: 24px 15px 18px;
  }

  .auth-content form {
    padding: 24px 20px;
  }
}
