/* App shell: steel rail, steel header, steel ground. */

.skip-link {
  position: absolute; left: var(--space-3); top: calc(var(--space-3) * -6); z-index: var(--z-toast);
  padding: var(--space-2) var(--space-4); background: var(--ink-soft); color: var(--paper);
  border-radius: var(--radius-control); font-weight: var(--weight-semibold); text-decoration: none;
}
.skip-link:focus-visible { top: var(--space-3); }

.shell {
  display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, var(--steel-rail) 0 var(--rail-width), var(--steel-ground) var(--rail-width));
}
.shell-column { display: grid; grid-template-rows: var(--header-height) minmax(0, 1fr); min-width: 0; }

/* Rail */
.rail {
  position: sticky; top: 0; z-index: var(--z-rail); height: 100vh;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-1);
  padding: var(--space-3) 0; background: var(--steel-rail); color: var(--steel-rail-text);
}
.rail-nav, .rail-foot { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.rail-foot { margin-block-start: auto; }
.rail-brand { margin-block-end: var(--space-4); }
.rail-brand img { display: block; width: 36px; height: 36px; }
.rail-item { position: relative; }
.rail-link {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  color: var(--steel-rail-text); background: transparent; border: 0; border-radius: var(--radius-rail);
  cursor: pointer; text-decoration: none;
  transition: background-color var(--duration-quick) var(--ease-out), color var(--duration-quick) var(--ease-out);
}
.rail-link:hover { background: var(--steel-rail-active); color: var(--steel-rail-text-strong); }
.rail-link[aria-current="page"] { background: var(--paper); color: var(--ink); }
.rail-link:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
.rail-form { margin: 0; }

/* Rail tooltip: transitions.dev tooltip timing, CSS only */
.rail-tip {
  position: absolute; left: calc(100% + var(--space-2)); top: 50%; z-index: var(--z-popover);
  translate: 0 -50%; scale: var(--scale-small, 0.98); transform-origin: 0 50%;
  padding: var(--space-1) var(--space-3); border-radius: var(--radius-control);
  background: var(--ink-soft); color: var(--paper); font-size: var(--text-sm); font-weight: var(--weight-semibold);
  white-space: nowrap; pointer-events: none; opacity: 0;
  box-shadow: var(--shadow-lift);
  transition: opacity 50ms var(--ease-out), scale 50ms var(--ease-out);
}
.rail-item:hover .rail-tip, .rail-item:has(:focus-visible) .rail-tip {
  opacity: 1; scale: 1;
  transition: opacity var(--duration-quick) var(--ease-out) var(--duration-micro), scale var(--duration-quick) var(--ease-out) var(--duration-micro);
}

/* Header */
.shell-header {
  position: sticky; top: 0; z-index: var(--z-header);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: 0 var(--space-6); background: var(--steel-header); color: var(--ink);
  box-shadow: var(--shadow-header);
}
.shell-heading { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
.shell-heading h1 { font-size: var(--text-xl); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-md); font-weight: var(--weight-semibold); }
.breadcrumb a { color: var(--ink); }
.breadcrumb [aria-current="page"] { font-family: var(--font-data); }
.shell-user { display: flex; align-items: baseline; gap: var(--space-2); font-size: var(--text-sm); white-space: nowrap; }
.shell-user strong { font-weight: var(--weight-semibold); }
.shell-role::before { content: "·"; margin-inline-end: var(--space-2); }

.shell-main { padding: var(--space-6); min-width: 0; }

/* Signed-out top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  height: var(--header-height); padding: 0 var(--space-6); background: var(--steel-header); box-shadow: var(--shadow-header);
}
.topbar-brand { display: flex; align-items: center; gap: var(--space-2); color: var(--ink); font-weight: var(--weight-bold); font-size: var(--text-lg); text-decoration: none; }
.topbar-brand img { width: 28px; height: 28px; }

/* Auth layout */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--space-8) var(--space-4); }
.auth-stub { display: grid; width: min(100%, 400px); padding: var(--space-8) var(--space-6) var(--space-6); gap: var(--space-4); }
.auth-brand { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-bold); font-size: var(--text-lg); color: var(--ink); text-decoration: none; }
.auth-brand img { width: 32px; height: 32px; }
.auth-stub h1 { font-size: var(--text-2xl); }
.auth-stub form { display: grid; }
.auth-stub .btn-primary { width: 100%; min-height: 40px; margin-block-start: var(--space-2); }
.auth-foot { padding-block-start: var(--space-3); border-top: 1px dashed var(--rule-dashed); font-size: var(--text-sm); }

@media (max-width: 720px) {
  .shell { --rail-width: 56px; }
  .rail-link { width: 40px; height: 40px; }
  .shell-header { padding: 0 var(--space-4); }
  .shell-user .shell-role { display: none; }
  .shell-main { padding: var(--space-4); }
}
