:root {
  --periodix-green: #124b3e;
  --periodix-green-dark: #0d392e;
  --periodix-surface: #f8faf8;
  --periodix-ink: #142822;
}

.app-shell {
  --sidebar-width: 264px;
  --workspace-line: #dce6e0;
  --sidebar-muted: #53685f;
  --sidebar-hover: #eff5f0;
  --sidebar-selected: #e2eee6;
  --sidebar-border: #ccdfd2;
  --sidebar-icon: #587167;
  --line: var(--workspace-line);
  --navy: var(--periodix-green-dark);
  --blue: var(--periodix-green);
  --bg: #f2f6f3;
  --text: var(--periodix-ink);
  --muted: var(--sidebar-muted);
  background: var(--bg);
  color: var(--text);
}

.sidebar {
  width: var(--sidebar-width);
  border-right: 1px solid var(--workspace-line);
  background: var(--periodix-surface);
  color: var(--periodix-ink);
  box-shadow: none;
}

.sidebar-brand {
  flex: 0 0 73px;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--workspace-line);
  font-size: 1.5rem;
  font-weight: 800;
}

.sidebar-brand .brand-mark {
  width: 37px;
  height: 37px;
  border-radius: 10px;
  background: var(--periodix-green);
  color: #fff;
  box-shadow: none;
  font-size: 1.23rem;
}

.company-switch {
  margin: 15px 13px 6px;
  padding: 10px 12px;
  border: 1px solid var(--workspace-line);
  border-radius: 10px;
  background: #fff;
}

.company-avatar,
.profile-mini > span {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--sidebar-border);
  border-radius: 9px;
  background: var(--sidebar-selected);
  color: var(--periodix-green);
  font-size: .725rem;
  font-weight: 800;
}

.company-switch small,
.profile-mini small {
  color: var(--sidebar-muted);
  font-size: .75rem;
}

.company-switch strong,
.profile-mini strong {
  color: var(--periodix-ink);
  font-size: .875rem;
  font-weight: 720;
}

.company-switch strong { margin-top: 2px; }

.sidebar nav {
  min-height: 0;
  padding: 1px 12px 12px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c4d6ca transparent;
}

.nav-group + .nav-group {
  margin-top: 11px;
  padding-top: 8px;
  border-top: 1px solid var(--workspace-line);
}

.nav-group-label {
  margin: 9px 10px 4px;
  color: var(--sidebar-muted);
  font-size: .75rem;
  font-weight: 750;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.nav-group ul {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-item {
  position: relative;
  gap: 10px;
  min-height: 36px;
  height: auto;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #344c42;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.25;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--periodix-green-dark);
}

.nav-item[aria-current="page"] {
  border-color: var(--sidebar-border);
  background: var(--sidebar-selected);
  color: var(--periodix-green-dark);
  box-shadow: none;
  font-weight: 750;
}

.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--periodix-green);
}

.nav-item:focus-visible,
.sidebar button:focus-visible,
.topbar button:focus-visible {
  outline: 2px solid #458467;
  outline-offset: 2px;
}

.nav-icon {
  display: block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  opacity: .85;
}

.nav-item[aria-current="page"] .nav-icon { opacity: 1; }
.nav-label { flex: 1; min-width: 0; }

.nav-badge {
  min-width: 22px;
  margin: 0 0 0 auto;
  padding: 2px 5px;
  background: #edf2ee;
  color: #34564a;
  font-size: .75rem;
  text-align: center;
}

.nav-badge-urgent {
  background: #f8ecdd;
  color: #815019;
}

.sidebar-bottom {
  flex: 0 0 auto;
  padding: 11px 13px 13px;
  border-top: 1px solid var(--workspace-line);
  background: var(--periodix-surface);
}

.profile-mini {
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--workspace-line);
  border-radius: 10px;
  background: #fff;
}

.profile-mini > div { min-width: 0; }
.profile-mini strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.profile-mini button {
  flex: 0 0 auto;
  padding: 5px 6px;
  border-radius: 6px;
  color: var(--periodix-green);
  font-size: .75rem;
  font-weight: 700;
}

.profile-mini button:hover { background: var(--sidebar-hover); }

.main-area { margin-left: var(--sidebar-width); }
.topbar { background: rgb(250 252 250 / .96); }
.breadcrumb span, .breadcrumb b { color: var(--sidebar-muted); }
.breadcrumb strong { color: var(--periodix-green-dark); }
.app-shell .primary-button { box-shadow: 0 7px 16px #124b3e20; }
.app-shell .primary-button:hover:not(:disabled) { background: var(--periodix-green-dark); }
.app-shell .kpi-card:focus-visible { outline-color: var(--periodix-green); }

@media (max-width: 800px) {
  .main-area { margin-left: 0; }
  .sidebar {
    width: min(var(--sidebar-width), calc(100vw - 34px));
    visibility: hidden;
    transition: transform .2s ease, visibility .2s ease;
  }
  .sidebar.open {
    visibility: visible;
    box-shadow: 10px 0 36px #14282228;
  }
  .sidebar-brand #closeNav {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--workspace-line);
    border-radius: 8px;
    color: var(--periodix-green);
    background: #fff;
    line-height: 1;
  }
  .nav-toggle {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--workspace-line);
    border-radius: 8px;
    background: #fff;
    color: var(--periodix-green);
  }
  .mobile-overlay { background: rgb(14 38 29 / .42); }
  .app-shell.menu-open .main-area { pointer-events: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .nav-item { transition: none; }
}
