/* Shared shell chrome for user and admin pages. Keep shell/topbar/sidebar styling here only. */
:root {
  --shell-sidebar-width: 240px;
}

html, body {
  overflow-y: auto;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
}

body.sidebar-open {
  overflow: hidden;
}

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

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--shell-sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, #3D3830 0%, #322E28 100%);
  color: #F0EBE3;
  display: flex;
  flex-direction: column;
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 250ms ease;
  box-shadow: none;
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: radial-gradient(ellipse at 50% 0%, rgba(122,158,126,0.18) 0%, transparent 70%);
  pointer-events: none;
}

body.sidebar-open .sidebar,
.sidebar.is-open {
  transform: translateX(0);
  box-shadow: 4px 0 24px rgba(44,40,37,0.18);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid rgba(240,235,227,0.10);
  position: relative;
  z-index: 1;
}

.sidebar-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: none;
  overflow: hidden;
  border: 0;
  padding: 0;
}

.sidebar-brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: #F0EBE3;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.625rem;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  z-index: 1;
}

.nav-section-shell {
  background: rgba(240,235,227,0.04);
  border: 1px solid rgba(240,235,227,0.10);
  border-radius: 10px;
  overflow: hidden;
}

.sidebar-nav > .nav-section-shell + .nav-section-shell {
  margin-top: 0.4rem;
}

.nav-section-shell.user-functions-shell .nav-section-items {
  padding: 2px 8px 10px;
}

.nav-section-shell.user-functions-shell .nav-link {
  padding: 0.56rem 0.65rem;
  font-size: 0.83rem;
  border-radius: 7px;
}

.nav-section-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  color: #9ca3af;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.nav-section-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 6px 8px;
}

.nav-link,
.logout-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #C4BBAF;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  position: relative;
  transition: background 150ms ease, color 150ms ease;
}

.nav-link[hidden] {
  display: none !important;
}

button.nav-link {
  appearance: none;
  -webkit-appearance: none;
}

.nav-link:hover,
.logout-btn:hover {
  background: rgba(240,235,227,0.08);
  color: #F0EBE3;
}

.nav-link.active {
  background: rgba(122,158,126,0.20);
  color: #F0EBE3;
  font-weight: 600;
}

.nav-link.active::before {
  content: none;
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.85;
  font-size: 14px;
}

.nav-text,
.nav-link-text,
.logout-label {
  flex: 1;
  min-width: 0;
}

.badge,
.nav-link-badge {
  margin-left: auto;
  background: #B8943D;
  color: #2C2825;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  transition: all 0.3s ease;
  min-width: 22px;
  text-align: center;
}

.badge-zero {
  background: rgba(255,255,255,0.2);
  color: #9A9184;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(240,235,227,0.10);
  position: relative;
}

.sidebar-contact {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 12px;
  color: #A49A8C;
  line-height: 1.35;
}

.sidebar-contact-link {
  color: #D7C8B2;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.sidebar-contact-link:hover,
.sidebar-contact-link:focus-visible {
  color: #F2E6D5;
}

.sidebar-footer::after {
  content: "";
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.15), transparent);
  pointer-events: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,40,37,0.45);
  border: none;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
  box-shadow: none;
  color: transparent;
  z-index: 230;
  backdrop-filter: blur(2px);
}

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

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-top: 60px;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  z-index: 280;
  height: 60px;
  background: #FFFFFF;
  border-bottom: 1px solid #E5DFD6;
  box-shadow: 0 1px 4px rgba(44,40,37,0.06);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.875rem;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.topbar-brand-logo {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 0;
  background: transparent;
  background-color: transparent !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 150ms ease;
  padding: 0;
}

.topbar-brand-logo:hover {
  transform: scale(1.04);
}

.topbar-brand-logo:focus,
.topbar-brand-logo:focus-visible,
.topbar-brand-logo:active {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  outline: none;
}

.topbar-brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.topbar-brand-name {
  font-size: 0.95rem;
  font-weight: 400;
  color: #1F2937;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-brand-name:empty {
  display: none;
}

.topbar-brand-sub {
  font-size: 0.75rem;
  color: #7A9E7E;
}

.topbar-brand-sub:empty {
  display: none;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
  padding: 0.375rem 0.625rem;
  border-radius: 8px;
  transition: background 150ms ease;
}

.topbar-user:hover {
  background: #F1ECE4;
}

.topbar-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1F2937;
}

.topbar-user-role {
  font-size: 0.7rem;
  font-weight: 500;
  color: #7A9E7E;
}

.topbar-user-role:empty {
  display: none;
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #EDF3ED;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.topbar-user.guest-cta {
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(122, 158, 126, 0.28);
  background: rgba(122, 158, 126, 0.08);
  gap: 0.4rem;
  flex-direction: column;
  align-items: stretch;
}

.topbar-user.guest-cta:hover {
  background: rgba(122, 158, 126, 0.14);
}

.topbar-user.guest-cta .topbar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
}

.topbar-user.guest-cta .topbar-user-role {
  font-size: 0.68rem;
  color: #6B7C6D;
}

.topbar-user.guest-cta .topbar-avatar {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #4F8C3C;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

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

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

  .topbar,
  .main-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .topbar {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
  }

  .main-area {
    padding-top: 60px;
  }

  .topbar {
    width: 100%;
  }
}
