:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-muted: #f0f3f9;
  --accent: #0d6efd;
  --text: #1f2d3d;
  --muted: #667085;
  --border: #e5e7eb;
  --shadow-soft: 0 10px 30px rgba(17, 24, 39, 0.08);
  --radius: 14px;
}

body.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

html.theme-contrast,
body.theme-contrast {
  --bg: #0b1727;
  --surface: #101c2d;
  --surface-muted: #162841;
  --accent: #5dd1ff;
  --text: #e8edf5;
  --muted: #9badc4;
  --border: #1f3048;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.container {
  max-width: 1320px;
  padding: 0 0.8rem;
}

main[role="main"] {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 1rem;
}

header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow: visible;
}

.glass-nav {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}

.navbar {
  overflow: visible;
}

.navbar-collapse {
  overflow: visible;
}

.navbar-brand {
  font-weight: 700;
  color: var(--text);
}

.navbar .nav-link {
  color: var(--text);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.navbar .navbar-toggler {
  border-color: var(--border);
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  background: var(--surface-muted);
  color: var(--accent);
}

.navbar .nav-link.active {
  background: #e6eeff;
  color: #0b5ed7;
  box-shadow: inset 0 0 0 1px #c7d9ff;
}

.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  padding: 0.4rem;
  background: var(--surface);
  backdrop-filter: blur(6px);
  z-index: 2000;
  min-width: 240px;
  max-width: 320px;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: absolute;
  top: 100%;
  left: auto;
  right: 0;
  transform: none !important;
}

.dropdown-item {
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: normal;
  word-break: break-word;
  line-height: 1.2;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--surface-muted);
  color: var(--accent);
}

.dropdown-item.active {
  background: #e6eeff;
  color: #0b5ed7;
  box-shadow: inset 0 0 0 1px #c7d9ff;
}

.btn-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 0;
}

.breadcrumb-wrapper .breadcrumb {
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--muted);
}

.breadcrumb-wrapper {
  display: inline-block;
  padding: 0.32rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  margin-left: 0.15rem;
}

.breadcrumb-item + .breadcrumb-item::before {
  color: var(--muted);
}

.page-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
}

.page-subtitle {
  margin: 0.1rem 0 0;
  color: var(--muted);
}

.offcanvas {
  background: var(--surface);
  color: var(--text);
}

.offcanvas-body {
  overflow-y: auto;
  max-height: calc(100vh - 120px);
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}

.mobile-link:hover {
  background: var(--surface-muted);
  color: var(--accent);
}

.mobile-link.active {
  background: #e6eeff;
  color: #0b5ed7;
  box-shadow: inset 0 0 0 1px #c7d9ff;
}

.footer {
  margin-top: auto;
  padding: 1rem 0;
  color: var(--muted);
  background: transparent;
}

@media (min-width: 992px) {
  .navbar .dropdown:hover > .dropdown-menu,
  .navbar .dropdown:focus-within > .dropdown-menu {
    display: block;
  }
}

@media (max-width: 575.98px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    margin-top: 0;
    margin-bottom: 0.6rem;
    padding: 0.25rem 0;
  }
  .breadcrumb-wrapper {
    margin-left: 0;
    box-shadow: none;
    border: 1px solid var(--border);
    padding: 0.25rem 0.45rem;
  }
  .container {
    padding: 0 0.5rem;
  }
  .navbar .nav-link {
    padding: 0.45rem 0.6rem;
  }
  main[role="main"] {
    padding: 0.6rem;
  }
}
