/* DarkSpark base: reset, app shell, rail, topbar, tenant tabs. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The `hidden` attribute must actually hide.
 *
 * It is only a UA-stylesheet `display: none`, so ANY author rule that sets display
 * beats it - which every button, flex row and grid item in this file does. The
 * client hides things with `el.hidden = true` in a dozen places, and each one that
 * happens to carry a display rule has been quietly ignoring it. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--ds-bg);
  color: var(--ds-text);
  font-family: var(--ds-font);
  font-size: var(--ds-fs-md);
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Faint scanline + vignette. Subtle enough to read as texture, not decoration. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgb(255 255 255 / 0.012) 3px 4px),
    radial-gradient(ellipse at 50% 0%, transparent 40%, rgb(0 0 0 / 0.55) 100%);
}

a {
  color: var(--ds-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--ds-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--ds-line-bright);
  border: 2px solid var(--ds-bg);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ds-accent-dim);
}

:focus-visible {
  outline: 1px solid var(--ds-accent);
  outline-offset: 1px;
}

/* ---------------------------------------------------------------- shell */

.shell {
  display: grid;
  grid-template-columns: var(--ds-rail-w) 1fr;
  height: 100vh;
  position: relative;
  z-index: 2;
}

/* ---------------------------------------------------------------- rail */

.rail {
  /* Explicit, because the shell gains a third column when Charon opens and grid
     auto-placement does not put a row-positioned item where source order suggests.
     See the note in charon.css. */
  grid-column: 1;
  background: linear-gradient(180deg, var(--ds-surface) 0%, var(--ds-void) 100%);
  border-right: 1px solid var(--ds-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 10px;
  gap: 4px;
  z-index: var(--ds-z-rail);
}

.rail__orb {
  margin-bottom: 10px;
}

.rail__div {
  width: 24px;
  height: 1px;
  background: var(--ds-line-bright);
  margin: 6px 0;
}

.rail__spacer {
  flex: 1;
}

.navbtn {
  position: relative;
  width: 40px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ds-text-faint);
  border-radius: var(--ds-radius);
  cursor: pointer;
  transition: color var(--ds-t-fast) var(--ds-ease), background var(--ds-t-fast) var(--ds-ease);
}
.navbtn svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.6;
}
.navbtn:hover {
  color: var(--ds-text);
  background: var(--ds-surface-2);
}
.navbtn.is-active {
  color: var(--ds-accent);
  background: var(--ds-accent-wash);
}
/* Active marker rides the tenant accent, so the rail agrees with the tab bar. */
.navbtn.is-active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--ds-accent);
  box-shadow: var(--ds-glow-sm);
}

.navbtn__tip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ds-raised);
  border: 1px solid var(--ds-line-bright);
  color: var(--ds-text);
  font-size: var(--ds-fs-sm);
  padding: 3px 8px;
  border-radius: var(--ds-radius);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ds-t-fast) var(--ds-ease);
  z-index: var(--ds-z-pop);
}
.navbtn:hover .navbtn__tip {
  opacity: 1;
}

/* ---------------------------------------------------------------- main */

.main {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  height: var(--ds-topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-line);
  padding-right: var(--ds-pad);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 0 12px;
  border-right: 1px solid var(--ds-line);
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: var(--ds-fs-sm);
  text-transform: uppercase;
  color: var(--ds-text-dim);
}
.topbar__brand b {
  color: var(--ds-text);
  font-weight: 700;
}

/* Tenant tabs: the deterministic accent is a safety feature. With several tenants
   open, colour is what stops a destructive action landing in the wrong one. */
.tabs {
  display: flex;
  align-items: stretch;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  --tab-accent: var(--ds-accent);
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--ds-line);
  background: transparent;
  color: var(--ds-text-faint);
  font-family: inherit;
  font-size: var(--ds-fs-md);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--ds-t-fast) var(--ds-ease), background var(--ds-t-fast) var(--ds-ease);
}
.tab:hover {
  color: var(--ds-text-dim);
  background: var(--ds-surface-2);
}
.tab.is-active {
  color: var(--ds-text);
  background: var(--ds-surface-2);
}
.tab.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--tab-accent);
  box-shadow: 0 0 10px var(--tab-accent);
}
.tab__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tab-accent);
  box-shadow: 0 0 7px var(--tab-accent);
  flex: 0 0 auto;
}
.tab__sub {
  font-size: var(--ds-fs-xs);
  color: var(--ds-text-ghost);
  font-family: var(--ds-mono);
}

.topbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--ds-gap);
  padding-left: var(--ds-pad);
}

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}

.page {
  padding: 18px 22px 40px;
  max-width: 1600px;
}

.page--flush {
  padding: 0;
  max-width: none;
  height: 100%;
}

/* ---------------------------------------------------------------- headings */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--ds-gap);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ds-line);
}

.page-title {
  margin: 0;
  font-size: var(--ds-fs-2xl);
  font-weight: 650;
  letter-spacing: -0.01em;
}
.page-sub {
  margin: 4px 0 0;
  color: var(--ds-text-dim);
  font-size: var(--ds-fs-md);
  max-width: 78ch;
}

.eyebrow {
  font-family: var(--ds-mono);
  font-size: var(--ds-fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ds-accent);
  margin-bottom: 6px;
}

.section-title {
  font-size: var(--ds-fs-sm);
  font-family: var(--ds-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ds-text-faint);
  margin: 26px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ds-line);
}
