/* === App Shell === */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* === Sidebar Logo Area (very top) === */
.sidebar__logo-area {
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar__hospin-img {
  display: block;
  width: 120px;
  height: auto;
  mix-blend-mode: lighten;
  margin-bottom: 6px;
}

/* === Platform brand bar (below logo) === */
.sidebar__brand {
  padding: var(--sp-3) var(--sp-4) var(--sp-2);
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar__brand-name {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: var(--sp-2);
}
.sidebar__brand-product {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.sidebar__brand-product img {
  height: 32px;
  width: auto;
  background: #fff;
  border-radius: var(--r-sm);
  padding: 3px 8px;
}

/* === Edge Selector (below brand) === */
.edge-selector-new {
  margin: var(--sp-3) var(--sp-3) 0;
}
.edge-selector-new__header {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  padding: 0 var(--sp-1) var(--sp-2);
}
.edge-item-new {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.5rem var(--sp-3);
  border-radius: var(--r-sm);
  margin-bottom: 2px;
  transition: background var(--dur);
}
.edge-item-new--active {
  background: rgba(30, 58, 186, 0.3);
}
.edge-item-new--locked {
  opacity: 0.4;
}
.edge-item-new:hover:not(.edge-item-new--locked) { background: rgba(255,255,255,0.06); }
.edge-item-new__icon {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.edge-item-new--active .edge-item-new__icon { background: var(--edge-blue); }
.edge-item-new__info { flex: 1; min-width: 0; }
.edge-item-new__name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}
.edge-item-new--locked .edge-item-new__name { font-weight: 500; color: rgba(255,255,255,0.7); }
.edge-item-new__status {
  font-size: 0.625rem;
  color: rgba(255,255,255,0.4);
  margin-top: 1px;
}
.edge-item-new--active .edge-item-new__status { color: var(--edge-green); font-weight: 600; }
.edge-item-new__badge {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--edge-green);
}
.edge-item-new__lock { color: rgba(255,255,255,0.25); flex-shrink: 0; }

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background:
    radial-gradient(ellipse 260px 320px at 100% 8%,  rgba(124,58,237,0.28) 0%, transparent 65%),
    radial-gradient(ellipse 220px 400px at 0%   85%, rgba(30,58,186,0.22)  0%, transparent 70%),
    linear-gradient(170deg, #08102E 0%, #0D1A50 50%, #09142E 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s var(--ease);
}

.sidebar__logo {
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar__logo img {
  height: 32px;
  width: auto;
}

.sidebar__logo-tagline {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.4);
  margin-top: var(--sp-1);
  letter-spacing: 0.04em;
}

/* === Edge Selector === */
.edge-selector {
  margin: var(--sp-3) var(--sp-3) 0;
  border: 1px solid var(--sidebar-border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.edge-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  color: var(--sidebar-text);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background var(--dur) var(--ease);
  position: relative;
}

.edge-item--active {
  background: rgba(30, 58, 186, 0.3);
  color: #fff;
  border-bottom: 1px solid var(--sidebar-border);
}

.edge-item--locked {
  opacity: 0.45;
  font-size: 0.75rem;
  padding: var(--sp-2) var(--sp-3);
}

.edge-item__icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.08);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.edge-item--active .edge-item__icon {
  background: var(--edge-blue);
}

.edge-item__name { flex: 1; line-height: 1.2; }
.edge-item__name small {
  display: block;
  font-size: 0.6875rem;
  opacity: 0.6;
  margin-top: 1px;
}

.edge-item__check {
  color: var(--edge-green);
  flex-shrink: 0;
}

.edge-item__lock {
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
}

/* === Navigation === */
.sidebar__nav {
  flex: 1;
  padding: var(--sp-4) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.sidebar__nav-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: var(--sp-3) var(--sp-2) var(--sp-2);
}

.sidebar__nav-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-top: var(--sp-1);
}

.sidebar__nav-group-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  padding: var(--sp-3) var(--sp-2) var(--sp-1);
  margin-top: var(--sp-2);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.5625rem var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav-link:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

.nav-link.is-active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  font-weight: 600;
}

.nav-link svg { flex-shrink: 0; opacity: 0.7; }
.nav-link.is-active svg { opacity: 1; }

/* === Sidebar Footer === */
.sidebar__footer {
  padding: var(--sp-3) var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--sidebar-border);
  margin-top: auto;
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.sidebar__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--edge-blue), var(--edge-cyan));
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar__user-info { flex: 1; min-width: 0; }
.sidebar__user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__user-role {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.45);
}

.sidebar__logout {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.4);
  transition: color var(--dur), background var(--dur);
}
.sidebar__logout:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

/* === Main Content Area === */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.page-header {
  background: var(--edge-surface);
  border-bottom: 1px solid var(--edge-border);
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-header__left { min-width: 0; }
.page-title {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--edge-text);
}
.page-subtitle {
  font-size: 0.8125rem;
  color: var(--edge-muted);
  margin-top: 1px;
}

.page-header__right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.page-content {
  flex: 1;
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

/* === Sidebar Brand Edge Row === */
.sidebar__brand-edge {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-top: var(--sp-2);
  padding: 5px var(--sp-2);
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--sidebar-border);
  cursor: pointer;
  transition: background var(--dur);
}
.sidebar__brand-edge:hover { background: rgba(255,255,255,0.1); }
.sidebar__brand-edge-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.75);
  flex: 1;
}
.sidebar__brand-edge-chevron { color: rgba(255,255,255,0.4); flex-shrink: 0; }

/* === Edge Item Ativo Badge === */
.edge-item-new__ativo-badge {
  font-size: 0.5625rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--edge-green);
  color: #fff;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* === Notification Bell === */
.notif-bell {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--edge-border);
  cursor: pointer;
  color: var(--edge-muted);
  transition: all var(--dur);
  background: var(--edge-surface);
  flex-shrink: 0;
}
.notif-bell:hover { border-color: var(--edge-border-mid); color: var(--edge-text); background: var(--edge-bg); }
.notif-bell__count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: var(--edge-red);
  color: #fff;
  font-size: 0.5625rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--edge-surface);
}

/* === Live Clock Badge === */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--edge-muted);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--edge-green);
  animation: pulse-live 2s infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ── Sidebar Collapse ────────────────────────────────── */

/* Topbar strip (always visible — holds collapse toggle) */
.sidebar__topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: var(--sp-2) var(--sp-3);
  min-height: 44px;
  flex-shrink: 0;
}

/* Toggle button */
.sidebar__pin-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.35);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.sidebar__pin-btn:hover {
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.90);
}

/* Collapsed: narrow icon-only rail */
.sidebar.is-collapsed {
  width: 64px;
}

/* Collapsed + hovered: expand over main content */
.sidebar.is-collapsed.is-hover-expanded {
  width: var(--sidebar-width);
  box-shadow: 4px 0 24px rgba(0,0,0,0.22);
  z-index: 50;
}

/* Topbar: center toggle when collapsed */
.sidebar.is-collapsed:not(.is-hover-expanded) .sidebar__topbar {
  justify-content: center;
}

/* Hide logo, brand, edge-selector — shown only when expanded */
.sidebar.is-collapsed:not(.is-hover-expanded) .sidebar__logo-area,
.sidebar.is-collapsed:not(.is-hover-expanded) .sidebar__brand,
.sidebar.is-collapsed:not(.is-hover-expanded) .edge-selector-new {
  display: none;
}

/* Hide group-section labels */
.sidebar.is-collapsed:not(.is-hover-expanded) .sidebar__nav-group-label {
  display: none;
}

/* Center nav icons; text overflows and is clipped by overflow-x:hidden */
.sidebar.is-collapsed:not(.is-hover-expanded) .nav-link {
  padding-left: 0;
  padding-right: 0;
  justify-content: center;
}

/* Center user avatar */
.sidebar.is-collapsed:not(.is-hover-expanded) .sidebar__user {
  justify-content: center;
}

/* Hide user text and logout link */
.sidebar.is-collapsed:not(.is-hover-expanded) .sidebar__user-info,
.sidebar.is-collapsed:not(.is-hover-expanded) .sidebar__logout {
  display: none;
}

/* Centro Operacional sidebar polish */
.sidebar__logo-area {
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  border-bottom: none;
}
.sidebar__hospin-img {
  display: block;
  width: 118px;
  height: auto;
  mix-blend-mode: normal;
  margin-bottom: 7px;
}
.sidebar__logo-area::before { content: none; }
.sidebar__logo-area::after {
  content: "Edge Hospital";
  display: block;
  margin-top: 2px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255,255,255,0.68);
}
.sidebar__logo-tagline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-3);
  font-size: 0;
  color: #86EFAC;
}
.sidebar__logo-tagline::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.12);
}
.sidebar__logo-tagline::after {
  content: "Operação Normal";
  font-size: 0.75rem;
  font-weight: 700;
}
.sidebar {
  background:
    linear-gradient(180deg, #2E1065 0%, #3B0764 52%, #1E0B4B 100%);
}
.nav-link.is-active {
  background: rgba(255,255,255,0.14);
  box-shadow: inset 3px 0 0 #C026D3;
}
.sidebar__nav-group-label {
  border-top: none;
  margin-top: var(--sp-1);
  padding-top: var(--sp-2);
}
