/**
 * Shared left rail — keep icon slots 40×40, logout 24×24, avatar 32×32 on every page.
 * Stacking (low → high): rail → app-shell → topbar (modals use higher z-index per page).
 */
:root {
  --z-rail: 1;
  --z-shell: 2;
  --z-topbar: 10;
}

.rail {
  position: fixed;
  left: var(--rail-edge, 0px);
  top: 0;
  z-index: var(--z-rail);
  width: var(--rail-w, 56px);
  min-width: var(--rail-w, 56px);
  max-width: var(--rail-w, 56px);
  height: 100vh;
  height: 100dvh;
  background: #ffffff;
  border-right: 1px solid #fed629;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--rail-top-pad, 96px) 0 24px var(--rail-inset-x, 8px);
  gap: var(--rail-slot-gap, 10px);
  box-sizing: border-box;
}

.rail__btn {
  width: var(--rail-btn, 40px);
  height: var(--rail-btn, 40px);
  min-width: var(--rail-btn, 40px);
  min-height: var(--rail-btn, 40px);
  border: none;
  border-radius: 12px;
  background: var(--rail-slot-bg, #ffffff);
  display: grid;
  place-items: center;
  grid-template: 1fr / 1fr;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  box-sizing: border-box;
}

.rail__btn .figma-icon,
.rail__btn .figma-icon--24 {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  display: block;
  object-fit: contain;
}

.rail__btn .rail__icon--state-active,
.rail__btn .rail__icon--state-idle {
  grid-area: 1 / 1;
}

.rail__btn--active .rail__icon--state-idle {
  display: none;
}

.rail__btn:not(.rail__btn--active) .rail__icon--state-active {
  display: none;
}

.rail__btn--active {
  background: var(--rail-slot-active-bg, #fff2be);
}

.rail__spacer {
  flex: 1;
  min-height: 0;
  align-self: stretch;
}

.rail__logout {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  margin-left: calc(var(--rail-icon-inset, 16px) - var(--rail-inset-x, 8px));
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
  box-sizing: border-box;
}

.rail__logout .figma-icon,
.rail__logout .figma-icon--24 {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  display: block;
  object-fit: contain;
}

.rail__avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  overflow: hidden;
  margin-top: 14px;
  margin-left: 4px;
  margin-bottom: 0;
  flex-shrink: 0;
  box-sizing: border-box;
}

.rail__avatar img {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  display: block;
  object-fit: cover;
}

.app-shell {
  position: relative;
  z-index: var(--z-shell);
}

/* 顶栏：全宽固定在视口顶，叠在侧栏之上；内容区与侧栏右缘对齐 */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-topbar);
  box-sizing: border-box;
  padding-left: calc(var(--rail-total, 56px) + 24px);
  padding-right: 24px;
}

.app-shell > .workspace {
  margin-top: var(--topbar-h, 80px);
  min-height: 0;
  height: calc(100dvh - var(--topbar-h, 80px));
  max-height: calc(100dvh - var(--topbar-h, 80px));
  box-sizing: border-box;
}

/* 隐藏滚动条，保留滚轮/触控滚动 */
html {
  scrollbar-width: none;
  -ms-overflow-style: none;
  scrollbar-gutter: auto;
}

html::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

/* 取消 stable 沟槽，避免隐藏滚动条后仍预留空白 */
.home-scroll,
.prof-scroll,
.arch-scroll,
.sched-scroll,
.sched-week-menu,
.apps-filter__menu,
.comp-patient-picker__menu,
.apps-scroll,
.home-timeline__scroll,
.home-event-modal__body,
.patient-card__body,
.chat-panel__messages,
.arch-modal__form {
  scrollbar-gutter: auto !important;
}
