/* ==========================================================================
   GrantCore app shell — one navigation rail + one top bar for every page.
   Loaded after grants.css. Activated by shell.js, which adds `gc-shell` to <html>.
   ========================================================================== */
:root {
  --gc-rail-w: 248px;
  --gc-rail-collapsed: 68px;
  --gc-rail-cur: var(--gc-rail-w);
  --gc-top-h: 56px;
  --gc-rail-bg: var(--sidebar-bg, #1A1D23);
  --gc-rail-text: var(--sidebar-text, #A1A7B3);
  --gc-rail-active: #fff;
  --gc-rail-accent: var(--sidebar-accent, #667EEA);
  --gc-rail-hover: rgba(255,255,255,.06);
  --gc-top-bg: color-mix(in srgb, var(--surface, #fff) 92%, transparent);
  --gc-ease: cubic-bezier(.2,.7,.2,1);
}
html.gc-rail-collapsed { --gc-rail-cur: var(--gc-rail-collapsed); }

/* ---- Page offsets: the shell is fixed, the page moves right and down ---- */
html.gc-shell body { padding-left: var(--gc-rail-cur); padding-top: var(--gc-top-h); box-sizing: border-box; transition: padding-left .25s var(--gc-ease); }
html.gc-shell .layout { height: calc(100vh - var(--gc-top-h)); }
html.gc-shell .fp-wrap { min-height: calc(100vh - var(--gc-top-h)); }
html.gc-shell .reviewer-layout, html.gc-shell .cr-layout { min-height: calc(100vh - var(--gc-top-h) - 60px); }

/* ---- Retire the page-local navigation ---- */
html.gc-shell .layout > aside.sidebar,
html.gc-shell .fp-side,
html.gc-shell .hamburger-btn,
html.gc-shell .sidebar-mobile-overlay { display: none !important; }
html.gc-shell .page-header .theme-toggle.standalone { display: none; }
html.gc-shell .page-header .page-breadcrumb, html.gc-shell .ws-header .page-breadcrumb, html.gc-shell .rv-header .page-breadcrumb { display: none; }

/* ---- Rail ---- */
.gc-rail {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--gc-rail-cur); z-index: 300;
  background: var(--gc-rail-bg); color: var(--gc-rail-text);
  display: flex; flex-direction: column;
  transition: width .25s var(--gc-ease), transform .25s var(--gc-ease);
  font-family: inherit;
}
.gc-rail-brand { display: flex; align-items: center; gap: 10px; height: var(--gc-top-h); padding: 0 14px; border-bottom: 1px solid rgba(255,255,255,.06); text-decoration: none; color: #fff; flex-shrink: 0; }
.gc-rail-brand img { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; }
.gc-rail-brand strong { font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.gc-rail-brand small { display: block; font-size: 10px; color: var(--gc-rail-text); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.gc-rail-portal { margin: 12px 10px 4px; }
.gc-rail-portal button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04); color: #fff; cursor: pointer; font: inherit; font-size: 13px; text-align: left;
}
.gc-rail-portal button:hover { background: rgba(255,255,255,.08); }
.gc-rail-portal .gc-ico { color: var(--gc-rail-accent); }
.gc-rail-portal .gc-lbl { flex: 1; min-width: 0; }
.gc-rail-portal .gc-lbl small { display: block; font-size: 10px; color: var(--gc-rail-text); text-transform: uppercase; letter-spacing: .08em; }
.gc-rail-portal .gc-lbl span { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-rail-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 10px 12px; scrollbar-width: thin; }
.gc-rail-nav::-webkit-scrollbar { width: 6px; } .gc-rail-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.gc-rail-sec { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .45; padding: 16px 10px 6px; white-space: nowrap; }
.gc-rail-nav a {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 1px 0; border-radius: 9px;
  color: var(--gc-rail-text); text-decoration: none; font-size: 13.5px; line-height: 1.2; white-space: nowrap;
  transition: background .15s, color .15s;
}
.gc-rail-nav a:hover { background: var(--gc-rail-hover); color: #fff; }
.gc-rail-nav a.active { background: color-mix(in srgb, var(--gc-rail-accent) 22%, transparent); color: #fff; font-weight: 600; }
.gc-rail-nav a.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gc-rail-accent); }
.gc-rail-nav a .gc-ico, .gc-rail-portal .gc-ico, .gc-menu a .gc-ico { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; }
.gc-rail-nav a .gc-ico svg, .gc-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gc-rail-nav a .gc-badge { margin-left: auto; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--gc-rail-accent); color: #fff; }
.gc-rail-nav a .gc-kbd { margin-left: auto; font-size: 10px; opacity: .5; }
.gc-rail-foot { border-top: 1px solid rgba(255,255,255,.06); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.gc-rail-foot a, .gc-rail-foot button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--gc-rail-text); text-decoration: none; font: inherit; font-size: 13px; background: none; border: none; cursor: pointer; white-space: nowrap; width: 100%; text-align: left; }
.gc-rail-foot a:hover, .gc-rail-foot button:hover { background: var(--gc-rail-hover); color: #fff; }

/* collapsed state: icons only, labels as tooltips */
html.gc-rail-collapsed .gc-rail-brand strong, html.gc-rail-collapsed .gc-rail-brand small,
html.gc-rail-collapsed .gc-rail-sec, html.gc-rail-collapsed .gc-rail-nav a > span:not(.gc-ico),
html.gc-rail-collapsed .gc-rail-portal .gc-lbl, html.gc-rail-collapsed .gc-rail-portal .gc-chev,
html.gc-rail-collapsed .gc-rail-foot span:not(.gc-ico) { display: none; }
html.gc-rail-collapsed .gc-rail-nav a, html.gc-rail-collapsed .gc-rail-foot a, html.gc-rail-collapsed .gc-rail-foot button, html.gc-rail-collapsed .gc-rail-portal button { justify-content: center; padding-left: 0; padding-right: 0; }
html.gc-rail-collapsed .gc-rail-brand { justify-content: center; padding: 0; }
html.gc-rail-collapsed .gc-rail-sec + a { margin-top: 10px; }
html.gc-rail-collapsed [data-tip] { position: relative; }
html.gc-rail-collapsed [data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: #111; color: #fff; padding: 6px 10px; border-radius: 6px; font-size: 12px; white-space: nowrap; z-index: 400; box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.3));
}

/* ---- Top bar ---- */
.gc-top {
  position: fixed; top: 0; left: var(--gc-rail-cur); right: 0; height: var(--gc-top-h); z-index: 290;
  display: flex; align-items: center; gap: 8px; padding: 0 16px;
  background: var(--gc-top-bg); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border, #e5e7eb); color: var(--text-primary, #111);
  transition: left .25s var(--gc-ease);
}
.gc-top button, .gc-top a.gc-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text-primary, #111); cursor: pointer; font: inherit; font-size: 13px; text-decoration: none; }
.gc-top button:hover, .gc-top a.gc-btn:hover { background: var(--surface-hover, rgba(0,0,0,.05)); }
.gc-top .gc-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gc-top-context { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--text-secondary, #555); }
.gc-top-context .gc-crumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-top-context .gc-crumb b { color: var(--text-primary, #111); font-weight: 600; }
.gc-top-context .gc-sep { opacity: .4; }
.gc-top-spacer { flex: 1; }
.gc-tenant { border: 1px solid var(--border, #e5e7eb) !important; background: var(--surface, #fff) !important; max-width: 300px; }
.gc-tenant .gc-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-tenant .gc-tag { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted, #777); }
.gc-search { border: 1px solid var(--border, #e5e7eb) !important; color: var(--text-secondary, #555) !important; min-width: 200px; justify-content: flex-start; }
.gc-search kbd { margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border, #e5e7eb); background: var(--surface-secondary, #f5f6fa); font-family: inherit; }
.gc-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-gradient, linear-gradient(135deg,#667eea,#764ba2)); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; letter-spacing: .02em; }
.gc-top .gc-user { padding: 0 6px 0 4px; }
.gc-top .gc-user .gc-name { max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-hamburger { display: none; }

/* ---- Menus (portal switcher, tenant, user) ---- */
.gc-menu {
  position: fixed; z-index: 350; min-width: 240px; max-width: 340px; padding: 6px; border-radius: 12px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); box-shadow: var(--shadow-xl, 0 20px 50px rgba(0,0,0,.25));
  color: var(--text-primary, #111); font-size: 13px; animation: gc-pop .14s var(--gc-ease);
}
@keyframes gc-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.gc-menu .gc-menu-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--border, #e5e7eb); margin-bottom: 4px; }
.gc-menu .gc-menu-head b { display: block; font-size: 14px; }
.gc-menu .gc-menu-head small { color: var(--text-muted, #777); display: block; }
.gc-menu .gc-role { display: inline-block; margin-top: 6px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--accent-light, #eef0ff); color: var(--accent, #5b45d6); }
.gc-menu a, .gc-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; color: inherit; text-decoration: none; background: none; border: none; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.gc-menu a:hover, .gc-menu button:hover { background: var(--surface-hover, rgba(0,0,0,.05)); }
.gc-menu a.active { background: color-mix(in srgb, var(--accent, #667eea) 12%, transparent); font-weight: 600; }
.gc-menu a .gc-sub { display: block; font-size: 11px; color: var(--text-muted, #777); font-weight: 400; }
.gc-menu .gc-menu-sec { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted, #777); padding: 8px 12px 4px; }
.gc-menu hr { border: 0; border-top: 1px solid var(--border, #e5e7eb); margin: 4px 0; }
.gc-menu .gc-danger { color: var(--danger, #dc2626); }

/* ---- Mobile: rail becomes a drawer ---- */
@media (max-width: 900px) {
  html.gc-shell body { padding-left: 0; }
  .gc-rail { transform: translateX(-100%); width: var(--gc-rail-w); box-shadow: none; }
  html.gc-rail-open .gc-rail { transform: none; box-shadow: var(--shadow-xl, 0 20px 50px rgba(0,0,0,.4)); }
  html.gc-rail-open .gc-rail-brand strong, html.gc-rail-open .gc-rail-sec, html.gc-rail-open .gc-rail-nav a > span, html.gc-rail-open .gc-rail-portal .gc-lbl, html.gc-rail-open .gc-rail-foot span { display: initial; }
  .gc-top { left: 0; padding: 0 10px; }
  .gc-hamburger { display: inline-flex; }
  .gc-search { min-width: 0; }
  .gc-search span, .gc-search kbd, .gc-top .gc-user .gc-name, .gc-top-context { display: none; }
  .gc-rail-scrim { position: fixed; inset: 0; z-index: 299; background: rgba(0,0,0,.45); display: none; }
  html.gc-rail-open .gc-rail-scrim { display: block; }
}
@media (prefers-reduced-motion: reduce) { .gc-rail, .gc-top, html.gc-shell body { transition: none; } .gc-menu { animation: none; } }

.gc-top .gc-lang,.gc-lang{appearance:none;-webkit-appearance:none;background:var(--surface-secondary,#f1f3f9);color:var(--text-primary,#1f2937);border:1px solid var(--border,#e3e6ef);border-radius:8px;font-size:12px;font-weight:600;padding:5px 22px 5px 8px;cursor:pointer;margin:0 6px 0 0;width:auto;max-width:72px;flex:0 0 auto;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23667' stroke-width='1.5'/></svg>");background-repeat:no-repeat;background-position:right 8px center}
.gc-lang:focus{outline:2px solid var(--primary,#667eea);outline-offset:1px}
