/* Connect+ Dashboard Editor - base reset & global rules (from prototype). */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--tx);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  font-weight: 450;
  line-height: 1.45;
  font-feature-settings: 'cv11', 'ss03';
  -webkit-font-smoothing: antialiased;
  /* Full-viewport app: no page scroll; screens scroll internally. */
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  /* App shell: a full-height icon rail on the left (brand, tenant, navigation,
     status, theme, sign out), banner + toolbar + screen to the right. There is
     no top bar. #topbar-root is `display: contents`, so the rail and toolbar it
     mounts participate in this grid directly (see ui/topbar.js). */
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
}
body:not(:has(#topbar-root[hidden])) { background: var(--frame); }
#topbar-root { display: contents; }
#topbar-root[hidden] { display: none; }
#impersonation-banner { grid-column: 2; grid-row: 1; }
#screen-root { grid-column: 2; grid-row: 3; }

/* Inset canvas: the screen is a rounded surface floating on the frame colour
   (--bg), with a gap on every side. Chrome (header, rail, toolbar) sits on the
   frame with no hard borders. Wallboard mode hides the chrome and stays full-bleed. */
body:not(:has(#topbar-root[hidden])) #screen-root {
  margin: var(--canvas-gap) var(--canvas-gap) var(--canvas-gap) 0;
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: var(--r-canvas);
}
/* Under the dashboard toolbar the canvas needs no extra top gap. */
body:has(.subbar:not([hidden])) #screen-root { margin-top: 0; }

/* Wallboard mode hides the chrome and owns the whole viewport. */
body:has(#topbar-root[hidden]) { display: block; }

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 1000;
  padding: 8px 14px;
  background: var(--ac);
  color: var(--ac-on);
  border-radius: var(--r-md);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 8px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.011em; font-weight: 600; }

a { color: var(--ac); }

button { font-family: inherit; }
button:disabled { opacity: .4; cursor: not-allowed; }

input, select, textarea { font-family: inherit; }

/* Focus ring convention: 2px indigo (Centra primary focus), 2px offset. */
:focus-visible {
  outline: 2px solid var(--indigo) !important;
  outline-offset: 2px;
  border-radius: 5px;
}
/* <main> is only focused programmatically (skip link); it is not a control. */
#screen-root:focus-visible { outline: none !important; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(128, 140, 150, .25); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes shimmer { 0% { background-position: -160% 0; } 100% { background-position: 160% 0; } }

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
