:root {
  --app-sidebar-width: 270px;
  --app-sidebar-collapsed-width: 82px;
  --app-header-height: 72px;
  --app-green: #178a50;
  --app-green-dark: #0e653b;
  --app-green-deep: #0a4f2f;
  --app-green-soft: #eaf7ef;
  --app-gold: #f3bd18;
  --app-bg: #f4f6f8;
  --app-surface: #ffffff;
  --app-surface-muted: #f9fafb;
  --app-text: #172033;
  --app-muted: #697386;
  --app-border: #e4e8ed;
  --app-shadow: 0 10px 30px rgba(23, 32, 51, 0.08);
  --app-radius: 16px;
}

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

html {
  min-height: 100%;
  background: var(--app-bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--app-text);
  background: var(--app-bg);
  font-family:
    Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

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

.app-sidebar-container {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1045;
  width: var(--app-sidebar-width);
  transition:
    width 220ms ease,
    transform 220ms ease;
}

.app-sidebar {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(
      180deg,
      var(--app-green) 0%,
      var(--app-green-dark) 55%,
      var(--app-green-deep) 100%
    );
  box-shadow: 8px 0 28px rgba(9, 70, 41, 0.18);
}

.app-sidebar-brand {
  display: flex;
  align-items: center;
  min-height: var(--app-header-height);
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.06);
}

.app-sidebar-logo {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
}

.app-sidebar-brand-copy {
  min-width: 0;
  margin-left: 12px;
  line-height: 1.1;
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.app-sidebar-brand-copy strong,
.app-sidebar-brand-copy span {
  display: block;
}

.app-sidebar-brand-copy strong {
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.app-sidebar-brand-copy span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-sidebar-close {
  display: none;
  width: 38px;
  height: 38px;
  margin-left: auto;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.app-sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px 10px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color:
    rgba(255, 255, 255, 0.25)
    transparent;
}

.app-sidebar-section-label {
  margin: 4px 12px 10px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.app-sidebar-item,
.app-sidebar-subitem {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  margin: 3px 0;
  border: 0;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.app-sidebar-item {
  padding: 8px 10px;
  text-align: left;
}

.app-sidebar-item:hover,
.app-sidebar-item:focus-visible,
.app-sidebar-item.active,
.app-sidebar-item[aria-expanded="true"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
}

.app-sidebar-item.active::before {
  position: absolute;
  inset: 8px auto 8px -10px;
  width: 4px;
  border-radius: 0 6px 6px 0;
  background: var(--app-gold);
  content: "";
}

.app-sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  font-size: 1.15rem;
  background: rgba(255, 255, 255, 0.08);
}

.app-sidebar-item:hover .app-sidebar-icon,
.app-sidebar-item.active .app-sidebar-icon,
.app-sidebar-item[aria-expanded="true"] .app-sidebar-icon {
  color: var(--app-green-deep);
  background: var(--app-gold);
}

.sidebar-text {
  min-width: 0;
  margin-left: 10px;
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.app-sidebar-chevron {
  margin-left: auto;
  font-size: 0.78rem;
  transition: transform 180ms ease;
}

.app-sidebar-item[aria-expanded="true"] .app-sidebar-chevron {
  transform: rotate(180deg);
}

.app-sidebar-submenu {
  margin: 2px 0 7px 20px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.app-sidebar-subitem {
  min-height: 40px;
  padding: 7px 10px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.86rem;
}

.app-sidebar-subitem:hover,
.app-sidebar-subitem:focus-visible,
.app-sidebar-subitem.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
}

.app-sidebar-subicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  flex: 0 0 22px;
}

.app-sidebar-footer {
  display: flex;
  align-items: center;
  min-height: 66px;
  margin: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
}

.app-sidebar-footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  color: var(--app-gold);
  background: rgba(255, 255, 255, 0.1);
}

.app-sidebar-footer strong,
.app-sidebar-footer small {
  display: block;
}

.app-sidebar-footer small {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.7rem;
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--app-header-height);
  padding: 0 18px;
  border-bottom: 1px solid rgba(228, 232, 237, 0.9);
  background: var(--app-green);
  box-shadow: 0 4px 18px rgba(23, 32, 51, 0.04);
  backdrop-filter: blur(14px);
}

.app-header-left,
.app-header-actions {
  display: flex;
  align-items: center;
}

.app-header-left {
  min-width: 0;
  gap: 14px;
}

.app-header-actions {
  gap: 8px;
}

.app-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  color: var(--app-text);
  background: var(--app-surface);
  box-shadow: 0 2px 8px rgba(23, 32, 51, 0.04);
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease;
}

.app-icon-button:hover,
.app-icon-button:focus-visible {
  border-color: rgba(23, 138, 80, 0.35);
  background: var(--app-green-soft);
  transform: translateY(-1px);
}

.app-icon-button i {
  font-size: 1.1rem;
}

.app-header-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.app-header-kicker {
  color: whitesmoke;
  font-size: 0.73rem;
}

.app-header-copy strong {
  overflow: hidden;
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-notification-badge {
  position: absolute;
  top: -6px;
  right: -5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #dc3545;
  font-size: 0.68rem;
  font-weight: 700;
}

.app-user-button {
  display: flex;
  align-items: center;
  min-width: 178px;
  padding: 6px 12px 6px 7px;
  border: 1px solid var(--app-border);
  border-radius: 14px;
  color: var(--app-text);
  background: var(--app-surface);
}

.app-user-button::after {
  margin-left: auto;
}

.app-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 11px;
  color: #fff;
  background:
    linear-gradient(135deg, var(--app-green), var(--app-green-dark));
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.app-user-avatar-lg {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
  border-radius: 14px;
}

.app-user-meta {
  display: flex;
  min-width: 0;
  margin: 0 10px;
  flex-direction: column;
  text-align: left;
}

.app-user-meta strong,
.app-user-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-user-meta strong {
  max-width: 120px;
  font-size: 0.82rem;
}

.app-user-meta small {
  max-width: 120px;
  color: var(--app-muted);
  font-size: 0.68rem;
}

.app-header-menu,
.app-user-menu {
  min-width: 310px;
  padding: 10px;
  border: 1px solid var(--app-border);
  border-radius: 16px;
  box-shadow: var(--app-shadow);
}

.app-header-menu {
  width: min(430px, calc(100vw - 24px));
  max-height: min(650px, calc(100vh - 90px));
  overflow: hidden;
}

#header-notification-list {
  max-height: min(510px, calc(100vh - 220px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.app-user-menu {
  min-width: 260px;
}

.app-menu-heading,
.app-user-menu-summary,
.app-notification-item {
  position: relative;
  display: flex;
  align-items: center;
}

.app-notification-item[data-notification-url] { cursor: pointer; }

.app-notification-state {
  display: block;
  margin-top: 5px;
  padding: 0;
  border: 0;
  color: var(--app-brand, #178a50);
  background: transparent;
  font-size: 0.68rem;
}

.app-menu-heading {
  justify-content: space-between;
  padding: 4px 7px 10px;
}

.app-notification-item {
  gap: 10px;
  padding: 10px 7px;
  border-radius: 12px;
}

.app-notification-item:hover {
  background: var(--app-surface-muted);
}

.app-notification-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
}

.app-notification-item strong,
.app-notification-item small,
.app-user-menu-summary strong,
.app-user-menu-summary small {
  display: block;
}

.app-notification-item strong {
  font-size: 0.82rem;
}

.app-notification-item small,
.app-user-menu-summary small {
  color: var(--app-muted);
  font-size: 0.72rem;
}

.app-notification-body {
  flex: 1 1 auto;
  min-width: 0;
}

.app-notification-item--unread {
  background: var(--app-surface-muted, #f6f7f9);
}

.app-notification-item--read {
  opacity: 0.62;
}

.app-notification-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--app-brand, #178a50);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 600;
  vertical-align: middle;
}

.app-notification-empty {
  padding: 16px 10px;
  color: var(--app-muted);
  font-size: 0.78rem;
  text-align: center;
}

.app-user-menu-summary {
  gap: 10px;
  padding: 7px;
}

.app-search-panel {
  height: min(420px, 80vh) !important;
  border: 0;
  border-radius: 0 0 22px 22px;
  box-shadow: var(--app-shadow);
}

.app-search-results {
  display: grid;
  gap: 8px;
  max-height: 250px;
  margin-top: 18px;
  overflow-y: auto;
}

.app-search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  color: var(--app-text);
  background: #fff;
  text-decoration: none;
}

.app-search-result:hover {
  border-color: rgba(23, 138, 80, 0.35);
  background: var(--app-green-soft);
}

.app-content {
  flex: 1 1 auto;
  min-width: 0;
}

.app-content-inner {
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  padding: 28px 28px 36px !important;
}

.app-content-inner > :first-child {
  margin-top: 0;
}

.app-content-inner .card {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: 0 6px 22px rgba(23, 32, 51, 0.06);
}

.app-content-inner .row {
  --bs-gutter-x: 1.25rem;
  --bs-gutter-y: 1.25rem;
}

.app-loading-state {
  display: grid;
  min-height: 45vh;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--app-muted);
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 12px 28px;
  border-top: 1px solid var(--app-border);
  color: var(--app-muted);
  background: var(--app-surface);
  font-size: 0.78rem;
}

.app-footer-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-logout-modal {
  border: 0;
  border-radius: 20px;
  box-shadow: var(--app-shadow);
}

.app-logout-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, #e44b5f, #c8283d);
  box-shadow: 0 12px 24px rgba(200, 40, 61, 0.24);
  font-size: 1.7rem;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 1040;
  display: none;
  border: 0;
  background: rgba(4, 24, 15, 0.55);
  backdrop-filter: blur(2px);
}

body.sidebar-collapsed .app-sidebar-container {
  width: var(--app-sidebar-collapsed-width);
}

body.sidebar-collapsed .app-main-column {
  margin-left: var(--app-sidebar-collapsed-width);
}

body.sidebar-collapsed .app-sidebar-brand {
  justify-content: center;
  padding-inline: 10px;
}

body.sidebar-collapsed .app-sidebar-logo {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
}

body.sidebar-collapsed .app-sidebar-brand-copy,
body.sidebar-collapsed .app-sidebar-section-label,
body.sidebar-collapsed .app-sidebar-footer .sidebar-text,
body.sidebar-collapsed .app-sidebar-chevron,
body.sidebar-collapsed .app-sidebar-item .sidebar-text,
body.sidebar-collapsed .app-sidebar-subitem .sidebar-text {
  width: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-6px);
}

body.sidebar-collapsed .app-sidebar-item {
  justify-content: center;
  padding-inline: 10px;
}

body.sidebar-collapsed .app-sidebar-item.active::before {
  inset-inline-start: -10px;
}

body.sidebar-collapsed .app-sidebar-submenu {
  display: none !important;
}

body.sidebar-collapsed .app-sidebar-footer {
  justify-content: center;
}

body.app-dark {
  --app-bg: #111827;
  --app-surface: #182231;
  --app-surface-muted: #202c3c;
  --app-text: #eef2f7;
  --app-muted: #aab4c2;
  --app-border: #2c3949;
  color-scheme: dark;
}

body.app-dark .app-header,
body.app-dark .app-footer,
body.app-dark .app-icon-button,
body.app-dark .app-user-button,
body.app-dark .app-header-menu,
body.app-dark .app-user-menu,
body.app-dark .app-search-result {
  color: var(--app-text);
  background: var(--app-surface);
}

body.app-dark .dropdown-menu {
  --bs-dropdown-color: var(--app-text);
  --bs-dropdown-bg: var(--app-surface);
  --bs-dropdown-border-color: var(--app-border);
  --bs-dropdown-link-color: var(--app-text);
  --bs-dropdown-link-hover-color: var(--app-text);
  --bs-dropdown-link-hover-bg: var(--app-surface-muted);
}

@media (max-width: 1199.98px) {
  :root {
    --app-sidebar-width: 250px;
  }

  .app-content-inner {
    padding-inline: 22px !important;
  }
}

@media (max-width: 991.98px) {
  .app-sidebar-container {
    width: min(88vw, 300px);
    transform: translateX(-104%);
  }

  .app-main-column,
  body.sidebar-collapsed .app-main-column {
    margin-left: 0;
  }

  body.sidebar-mobile-open {
    overflow: hidden;
  }

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

  body.sidebar-mobile-open .sidebar-overlay {
    display: block;
  }

  .app-sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  body.sidebar-collapsed .app-sidebar-container {
    width: min(88vw, 300px);
  }

  body.sidebar-collapsed .app-sidebar-brand-copy,
  body.sidebar-collapsed .app-sidebar-section-label,
  body.sidebar-collapsed .app-sidebar-footer .sidebar-text,
  body.sidebar-collapsed .app-sidebar-chevron,
  body.sidebar-collapsed .app-sidebar-item .sidebar-text,
  body.sidebar-collapsed .app-sidebar-subitem .sidebar-text {
    width: auto;
    margin-left: 10px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  body.sidebar-collapsed .app-sidebar-item {
    justify-content: flex-start;
  }

  body.sidebar-collapsed .app-sidebar-submenu {
    display: block;
  }

  .app-header {
    padding-inline: 14px;
  }

  .app-user-button {
    min-width: 0;
    padding-right: 8px;
  }

  .app-user-meta {
    display: none;
  }

  .app-content-inner {
    padding: 22px 16px 30px !important;
  }

  .app-footer {
    padding-inline: 16px;
  }
}

@media (max-width: 575.98px) {
  :root {
    --app-header-height: 64px;
  }

  .app-header {
    min-height: var(--app-header-height);
    gap: 8px;
    padding-inline: 10px;
  }

  .app-header-actions {
    gap: 5px;
  }

  .app-header-copy {
    display: none;
  }

  .app-icon-button {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .app-user-button {
    padding: 4px 7px;
    border-radius: 11px;
  }

  .app-user-avatar {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .app-header-menu,
  .app-user-menu {
    min-width: min(92vw, 310px);
  }

  .app-content-inner {
    padding: 16px 10px 24px !important;
  }

  .app-content-inner .row {
    --bs-gutter-x: 0.8rem;
    --bs-gutter-y: 0.8rem;
  }

  .app-footer {
    justify-content: center;
    text-align: center;
  }

  .app-footer-meta {
    display: none;
  }
}
