@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');
:root {
  --rail-w: 60px; --rail-open: 240px;
  --rail-bg: #0d1b22; --rail-bg2: #15272f; --rail-ink: #c9d6dc; --rail-ink2: #7f939c; --rail-line: #22363f;
  --tele: #13836c; --bg: #f4f6f9;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #11161f; } }
:root[data-theme="dark"] { --bg: #11161f; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); }
body { font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif; }

.portal-links:not([hidden]) {
  position: absolute; inset: 0 0 auto; height: 32px;
  display: flex; align-items: center; gap: 16px; padding-inline: 12px;
  background: #f4f6f9; border-bottom: 1px solid #dbe4e9; font-size: 13px;
}
.portal-links a { color: #0f5c4d; text-underline-offset: 3px; }
body:has(.portal-links:not([hidden])) :is(#rail, #stage) { inset-block-start: 32px; }

#rail {
  position: fixed; inset: 0 0 0 auto; width: var(--rail-w); z-index: 50;
  background: var(--rail-bg); color: var(--rail-ink);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .18s ease, box-shadow .18s ease;
}
#rail:hover, #rail:focus-within { width: var(--rail-open); box-shadow: -8px 0 24px rgba(0, 0, 0, .28); }
#stage { position: absolute; inset: 0 var(--rail-w) 0 0; }
#view { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }

.rail-head, .item { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.ic { flex: 0 0 var(--rail-w); width: var(--rail-w); display: grid; place-items: center; }
.ic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic svg .fill { fill: currentColor; }
.lbl { display: flex; flex-direction: column; min-width: 0; opacity: 0; transition: opacity .12s; }
#rail:hover .lbl, #rail:focus-within .lbl { opacity: 1; }
.lbl b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.lbl small { font-size: 11px; color: var(--rail-ink2); overflow: hidden; text-overflow: ellipsis; }

.rail-head { height: 58px; border-bottom: 1px solid var(--rail-line); color: #fff; }
.rail-head .ic svg { width: 28px; height: 28px; }

#teles { list-style: none; margin: 6px 0; padding: 0; flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.item {
  width: 100%; height: 52px; padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit;
  cursor: pointer; text-align: right; text-decoration: none; position: relative;
}
.item:hover, .item:focus-visible { background: var(--rail-bg2); color: #fff; outline: none; }
.item.on { color: #fff; background: var(--rail-bg2); }
.item.on::before { content: ''; position: absolute; inset: 8px 0 8px auto; width: 4px; border-radius: 4px 0 0 4px; background: var(--c, var(--tele)); }
.item.on .ic { color: #fff; }
.item.on .ic span { background: var(--c, var(--tele)); }
.item .ic span { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; transition: background .15s; }
.item:not(.on) .ic span { background: transparent; }
.item .key { margin-inline-start: auto; margin-inline-end: 12px; font-size: 11px; color: var(--rail-ink2); opacity: 0; }
#rail:hover .item .key { opacity: 1; }

.rail-foot { border-top: 1px solid var(--rail-line); padding: 4px 0; }
.rail-foot .item { height: 48px; }
#unitChip .lbl b { color: #ffd479; }

#loading { position: absolute; inset: 0 0 auto 0; height: 3px; pointer-events: none; opacity: 0; transition: opacity .2s; }
#loading span { display: block; height: 100%; width: 35%; background: #ffd479; animation: slide 1s linear infinite; }
#loading.on { opacity: 1; }
@keyframes slide { from { transform: translateX(100%); } to { transform: translateX(-300%); } }

@media (max-width: 700px) {
  :root { --rail-w: 48px; }
  .ic svg { width: 20px; height: 20px; }
  .item .ic span { width: 34px; height: 34px; }
}
@media print { #rail { display: none; } #stage { inset: 0; } }
