/* Side navigation rail (funcs/SideRail.js) — Reports, Payroll.
   Page layout:  <div class="rail-layout"><div id="railHost"></div><div class="rail-main">…content…</div></div>
   Colours are the app's: grey icons (#6B6B6B), hover #f0f3f4 (buttons.css .btn-icon), selected = app theme
   (#076A89) on its tint, like the selected .seg-tab. */

.rail-layout {
  display: flex;
  flex-direction: row;
  height: 100%;
  min-height: 0;
}
.rail-host { display: contents; }
.rail-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.side-rail {
  flex: 0 0 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 0;
  box-sizing: border-box;
  border-right: 1px solid #ececec;
  background: #ffffff;
  overflow-y: auto;
  scrollbar-width: none;
}
.side-rail::-webkit-scrollbar { display: none; }

.side-rail-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-regular, #6B6B6B);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.side-rail-item:hover { background: #f0f3f4; color: var(--app-theme, #076A89); }
.side-rail-item:focus { outline: none; }
.side-rail-item:focus-visible { box-shadow: 0 0 0 3px rgba(7, 106, 137, 0.35); }
.side-rail-item svg { width: 22px; height: 22px; display: block; pointer-events: none; }

/* Selected main item: tinted pill + a bar on the rail edge. */
.side-rail-item.is-selected { background: rgba(7, 106, 137, 0.12); color: var(--app-theme, #076A89); }
.side-rail-item.is-selected:not(.is-sub)::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--app-theme, #076A89);
}

/* Sub-options of the selected item: a grouped, slightly smaller block right under it. */
.side-rail-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 5px;
  margin: 0 0 4px;
  border-radius: 14px;
  background: #f4f7f8;
}
.side-rail-item.is-sub { width: 36px; height: 36px; border-radius: 10px; }
.side-rail-item.is-sub svg { width: 18px; height: 18px; }
.side-rail-item.is-sub:hover { background: #ffffff; }
.side-rail-item.is-sub.is-selected { background: var(--app-theme, #076A89); color: #ffffff; }

/* Tooltip (one per page, position:fixed): the reference "Authentication" chip. */
.side-rail-tip {
  position: fixed;
  z-index: 10000;
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid #e3e3e3;
  background: #ffffff;
  color: var(--font-dark, #3B3B3B);
  font-family: App-Regular, sans-serif;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}
.side-rail-tip[hidden] { display: none; }

/* Small screens: the rail becomes a strip above the content (icons in a row, sub-options after the selected one). */
@media (max-width: 600px) {
  .rail-layout { flex-direction: column; }
  .side-rail {
    flex: 0 0 auto;
    flex-direction: row;
    width: 100%;
    padding: 6px 10px;
    border-right: none;
    border-bottom: 1px solid #ececec;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .side-rail-item.is-selected:not(.is-sub)::before { left: 9px; right: 9px; top: auto; bottom: -6px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .side-rail-group { flex-direction: row; margin: 0 0 0 2px; }
}
