.loading { display: grid; place-items: center; min-height: 100dvh; color: var(--sand-text-tertiary); font: var(--text-secondary); }

.brand-mark { width: 28px; height: 28px; flex: none; }
/* The white-tile RokBot logo (assets/logo/rokbot-logo.svg): fixed brand colors in both themes. */
.brand-mark .brand-tile-rim { fill: none; stroke: #fff; stroke-opacity: .9; stroke-width: 8; }
/* A 1 px hairline at any size keeps the near-white tile visible on light sidebars. */
.brand-mark .brand-tile-edge { fill: none; stroke: #0e4a5c; stroke-opacity: .22; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.brand-mark .brand-face { stroke: #303747; stroke-width: 20; stroke-linejoin: round; }
.brand-mark .brand-eye { fill: #f5f5f4; }
.brand-mark .brand-accent { fill: #38bdf8; }

/* The column background continues the sidebar below the sticky panel on long pages. */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; background: linear-gradient(to right, var(--sand-bg-sidebar) 232px, var(--sand-bg-pane) 232px); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100dvh; min-height: 0; border-right: var(--hairline) solid var(--sand-border-tertiary-translucent); background: var(--sand-bg-sidebar); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-4) var(--space-3) var(--space-3) var(--space-4); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--sand-text-primary); font: var(--text-body); font-weight: var(--weight-semibold); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand small { color: var(--sand-text-tertiary); font: var(--text-meta); font-weight: var(--weight-regular); }
.nav-toggle { display: none; }
.nav { display: flex; flex: 1; flex-direction: column; gap: 2px; min-height: 0; padding: var(--space-1) var(--space-3) var(--space-3); overflow-y: auto; }
.nav-group, .nav-group-label {
  margin: var(--space-4) 0 var(--space-1);
  padding: var(--space-2) var(--space-3) 0;
  border-top: var(--hairline) solid var(--sand-border-tertiary-translucent);
  color: var(--sand-text-quaternary);
  font: var(--text-caption);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav-group-label:first-child { margin-top: var(--space-1); padding-top: 0; border-top: 0; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 32px;
  padding: 6px var(--space-2) 6px var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sand-text-secondary);
  font: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.nav-item, .nav-item:hover { text-decoration: none; }
.nav-item svg { width: 16px; height: 16px; flex: none; display: block; color: var(--sand-icon-tertiary); transition: color var(--duration-fast) var(--ease-out); }
.nav-item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--sand-bg-hover); color: var(--sand-text-primary); }
.nav-item:hover svg { color: var(--sand-icon-secondary); }
.nav-item.active {
  background: var(--sand-bg-elevated);
  color: var(--sand-text-primary);
  font-weight: var(--weight-semibold);
  box-shadow: var(--shadow-card), inset 0 0 0 var(--hairline) var(--sand-border-secondary-translucent);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 3px;
  width: 3px;
  border-radius: var(--radius-full);
  background: var(--sand-bg-accent-primary);
}
.nav-item.active svg { color: var(--sand-text-accent-primary); }
.sidebar-foot { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-3); border-top: var(--hairline) solid var(--sand-border-tertiary-translucent); }
.account { flex: 1; min-width: 0; min-height: 44px; padding-left: var(--space-2); }
.account.active::before { display: none; }
.account .avatar { width: 28px; height: 28px; }
.account-copy { display: flex; flex-direction: column; min-width: 0; }
.account-copy strong { overflow: hidden; font: var(--text-secondary); font-weight: var(--weight-medium); text-overflow: ellipsis; white-space: nowrap; }
.account-copy .status { display: block; overflow: hidden; font: var(--text-meta); text-overflow: ellipsis; }
.account-copy .status::before { display: inline-block; margin-right: 6px; vertical-align: 1px; }
.avatar { display: grid; place-items: center; flex: none; overflow: hidden; border-radius: var(--radius-full); background: var(--sand-bg-secondary-hover); color: var(--sand-text-secondary); font: var(--text-secondary); font-weight: var(--weight-semibold); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.main { min-width: 0; background: var(--sand-bg-pane); }
/* One page container; app.js fills the head (title, description, tabs) and shows module panels. */
.page { display: flex; flex-direction: column; gap: var(--space-6); width: 100%; max-width: 760px; margin: 0 auto; padding: var(--space-8) var(--space-8) 72px; }
.page.wide { max-width: 1120px; }
.page-body { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }
.module { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }
.module[hidden], [data-route-hidden] { display: none !important; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 36px; margin-bottom: calc(var(--space-1) * -1); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
/* The page head names the page; a module's own heading only stays for screen readers, its buttons stay. */
.module > .page-header { justify-content: flex-end; min-height: 0; margin-bottom: calc(var(--space-3) * -1); }
.module > .page-header > h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.route-head { display: flex; flex-direction: column; gap: var(--space-4); }
.route-copy { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.route-title { color: var(--sand-text-primary); font: var(--text-page-title); letter-spacing: -0.012em; }
.route-description { max-width: 620px; color: var(--sand-text-tertiary); font: var(--text-secondary); }
.route-tabs { display: flex; gap: 2px; max-width: 100%; margin: 0 -2px; padding: 0 2px 0; overflow-x: auto; border-bottom: var(--hairline) solid var(--sand-border-tertiary-translucent); scrollbar-width: none; }
.route-tabs::-webkit-scrollbar { display: none; }
.route-tab { position: relative; flex: none; padding: var(--space-2) var(--space-3) 10px; border-radius: var(--radius-md) var(--radius-md) 0 0; color: var(--sand-text-tertiary); font: var(--text-secondary); white-space: nowrap; text-decoration: none; transition: color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out); }
.route-tab:hover { background: var(--sand-bg-hover); color: var(--sand-text-primary); text-decoration: none; }
.route-tab[aria-current="page"] { color: var(--sand-text-primary); font-weight: var(--weight-semibold); }
.route-tab[aria-current="page"]::after { content: ""; position: absolute; right: var(--space-3); bottom: -1px; left: var(--space-3); height: 2px; border-radius: 1px; background: var(--sand-text-primary); }
.route-tab:focus-visible { outline: 2px solid var(--sand-border-focus-primary); outline-offset: -2px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; background: var(--sand-bg-pane); }
  .sidebar { z-index: 20; height: auto; border-right: 0; border-bottom: var(--hairline) solid var(--sand-border-tertiary-translucent); }
  .sidebar-head { padding: 10px 10px 10px var(--space-4); }
  .nav-toggle { display: inline-grid; }
  .sidebar .nav, .sidebar .sidebar-foot { display: none; }
  .sidebar.open { position: fixed; inset: 0; height: 100dvh; }
  .sidebar.open .nav { display: flex; }
  .sidebar.open .sidebar-foot { display: flex; }
  .sidebar.open .nav-item { min-height: 44px; }
  .page { gap: var(--space-4); padding: 20px var(--space-4) 56px; }
  .page-body, .module { gap: var(--space-6); }
  .route-title { font: var(--text-heading3); font-weight: var(--weight-semibold); }
  .route-tabs { margin: 0 calc(var(--space-4) * -1); padding: 0 var(--space-3); }
}
