/* Application shell — fixed left sidebar with off-canvas behaviour on small screens */

:root {
  --app-sidebar-width: 15.5rem;
  --app-surface: #ffffff;
  --app-border: #e2e9f2;
  --app-text: #0f1b2d;
  --app-text-soft: #3c4a60;
  --app-text-muted: #7c8aa1;
  --app-mint: #00c2a8;
  --app-mint-strong: #02a890;
  --app-mint-soft: rgba(0, 194, 168, 0.12);
  --app-shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.05), 0 2px 8px rgba(15, 27, 45, 0.04);
}

.app-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
  width: 100%;
}

.app-shell__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-shell__content .app-main {
  padding: 0 1rem;
}

.app-shell__backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  border: 0;
  padding: 0;
  background: rgba(15, 27, 45, 0.42);
  backdrop-filter: blur(2px);
}

/* Sidebar */

.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex-shrink: 0;
  width: var(--app-sidebar-width);
  height: 100vh;
  padding: 1.25rem 0.875rem;
  box-sizing: border-box;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9fd 100%);
  border-right: 1px solid var(--app-border);
  overflow-y: auto;
  z-index: 50;
}

.app-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0.35rem;
}

.app-sidebar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  min-width: 0;
}

.app-sidebar__brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--app-mint) 0%, var(--app-mint-strong) 100%);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(0, 194, 168, 0.28);
}

.app-sidebar__brand-text {
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--app-text) 20%, var(--app-mint-strong) 110%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar__close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--app-border);
  border-radius: 9px;
  background: var(--app-surface);
  color: var(--app-text-soft);
  cursor: pointer;
}

.app-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.app-sidebar__link,
.app-sidebar__sublink {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--app-text-soft);
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.app-sidebar__link svg,
.app-sidebar__sublink svg {
  flex-shrink: 0;
  color: var(--app-text-muted);
}

.app-sidebar__link:hover,
.app-sidebar__sublink:hover {
  background: var(--app-mint-soft);
  color: var(--app-mint-strong);
  text-decoration: none;
}

.app-sidebar__link:hover svg,
.app-sidebar__sublink:hover svg {
  color: var(--app-mint-strong);
}

.app-sidebar__link--active,
.app-sidebar__sublink--active {
  background: var(--app-mint-soft);
  border-color: rgba(0, 194, 168, 0.32);
  color: var(--app-mint-strong);
  box-shadow: var(--app-shadow-sm);
}

.app-sidebar__link--active svg,
.app-sidebar__sublink--active svg {
  color: var(--app-mint-strong);
}

.app-sidebar__group {
  margin-top: 0.5rem;
}

.app-sidebar__group-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--app-text-muted);
}

.app-sidebar__group-head > svg {
  width: 14px;
  height: 14px;
}

.app-sidebar__new-case {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  order: -1;
  flex: 1 0 100%;
  margin-bottom: 0.15rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(0, 194, 168, 0.28);
  border-radius: 8px;
  background: var(--app-mint-soft);
  color: var(--app-mint-strong);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
  text-decoration: none;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.app-sidebar__new-case svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.app-sidebar__new-case:hover {
  background: rgba(0, 194, 168, 0.2);
  border-color: rgba(0, 194, 168, 0.45);
  color: var(--app-mint-strong);
  text-decoration: none;
}

.app-sidebar__sublist {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-left: 0.4rem;
  margin-left: 0.45rem;
  border-left: 1px solid var(--app-border);
}

.app-sidebar__sublink {
  font-weight: 600;
  padding: 0.5rem 0.7rem;
}

/* Work areas listed before the RX resource exists: shown, but not navigable. */
.app-sidebar__sublink--disabled {
  color: var(--app-text-muted);
  cursor: not-allowed;
}

.app-sidebar__sublink--disabled:hover {
  background: transparent;
  color: var(--app-text-muted);
}

.app-sidebar__footer {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--app-border);
}

.app-sidebar__user {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0 0.75rem;
  min-width: 0;
}

.app-sidebar__user-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--app-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar__user-role {
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--app-mint-strong);
}

.app-sidebar__logout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  background: var(--app-surface);
  color: var(--app-text-soft);
  font-size: 0.8125rem;
  font-weight: 650;
  cursor: pointer;
  box-shadow: var(--app-shadow-sm);
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}

.app-sidebar__logout:hover {
  border-color: rgba(0, 194, 168, 0.45);
  color: var(--app-mint-strong);
  background: var(--app-mint-soft);
}

/* Mobile top bar */

.app-topbar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0;
}

.app-topbar__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  background: var(--app-surface);
  color: var(--app-text-soft);
  cursor: pointer;
  box-shadow: var(--app-shadow-sm);
}

.app-topbar__title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--app-text);
}

@media (max-width: 1024px) {
  .app-topbar {
    display: flex;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 18px 50px rgba(15, 27, 45, 0.18);
  }

  .app-sidebar__close {
    display: inline-flex;
  }

  .app-shell--nav-open .app-sidebar {
    transform: translateX(0);
  }

  .app-shell--nav-open .app-shell__backdrop {
    display: block;
  }
}

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