/* The shell around every page, on runeui's tokens: the page's column inside ui :app_shell, the sidebar's
   brand and account, the bar's crumbs and actions, a page's head and sections, step pages, the flow and
   the signed-out layout. Unlayered, so these win over runeui's layers. Space with gap, never margins. */

/* ======================================================================= Page */

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  transform: translateY(-200%);
}
.skip-link:focus {
  transform: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--ui-radius-md);
  background: var(--background);
  box-shadow:
    0 0 0 1px var(--border),
    var(--ui-shadow-lg);
}

.main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem 2rem 4rem;
}
@media (max-width: 860px) {
  .main {
    padding: 1rem 1rem 2rem;
  }
}

turbo-cable-stream-source,
[data-herb-debug-inserted]:has(> turbo-cable-stream-source:only-child) {
  display: none;
}

turbo-frame:not([data-slot]) {
  display: contents;
}

@view-transition {
  navigation: auto;
}
[data-slot="sidebar"] {
  view-transition-name: sidebar;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.1s;
}
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none;
  }
}

/* ======================================================================= Utilities */

.muted {
  color: var(--muted-foreground);
}
.muted-sm {
  color: var(--muted-foreground);
  font-size: var(--ui-text-xs);
}
.mono,
.font-mono {
  font-family: var(--font-mono);
}
.mono {
  font-size: 0.8125rem;
}
.tabular {
  font-variant-numeric: tabular-nums;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.link {
  color: inherit;
  text-decoration: none;
}
.link:hover {
  text-decoration: underline;
}
.link--underline,
[data-slot="page-description"] a:not(.ui-button) {
  color: var(--foreground);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--foreground) 30%, transparent);
  text-underline-offset: 3px;
}
.link--underline:hover,
[data-slot="page-description"] a:not(.ui-button):hover {
  text-decoration-color: currentColor;
}
.prose-links a {
  color: var(--brand-foreground);
  text-decoration: none;
}
.prose-links a:hover {
  text-decoration: underline;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.stack--sm {
  gap: 0.5rem;
}
.stack--lg {
  gap: 1.5rem;
}
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.cluster--between {
  justify-content: space-between;
}
.cluster--end {
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.tone--success {
  color: var(--success);
}
.tone--warning {
  color: var(--warning);
}
.tone--negative {
  color: var(--destructive);
}
.tone--brand {
  color: var(--brand-foreground);
}
form.button_to {
  display: contents;
}

/* ======================================================================= Sidebar */

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.sidebar-brand__home {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  padding: 0.375rem;
  border-radius: var(--ui-radius-md);
  color: inherit;
  text-decoration: none;
}
.sidebar-brand__home:hover {
  background: var(--sidebar-accent);
}
.sidebar-brand__mark {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--sidebar-foreground);
}
.sidebar-brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.sidebar-brand__name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-brand__product {
  color: var(--muted-foreground);
  font-size: var(--ui-text-xs);
}
.sidebar-setup {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-account {
  justify-content: flex-start;
  width: 100%;
  height: auto;
  padding-block: 0.375rem;
  text-align: start;
}
.sidebar-account__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.sidebar-account__name {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-account__email {
  overflow: hidden;
  color: var(--muted-foreground);
  font-size: var(--ui-text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-account__chevron {
  flex-shrink: 0;
  color: var(--muted-foreground);
}

/* ======================================================================= The bar */

.panel-bar {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}
.panel-bar__scope {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.panel-bar__crumbs {
  min-width: 0;
}
.panel-bar__actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
}
.panel-bar__leading {
  display: inline-flex;
  align-items: center;
  margin-inline-end: 0.375rem;
  vertical-align: middle;
}
.panel-bar__leading svg {
  width: 1rem;
  height: 1rem;
}
.panel-bar__search {
  color: var(--muted-foreground);
}
.panel-bar__kbd {
  margin-inline-start: 0.5rem;
}
.panel-bar__dot {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--ui-radius-full);
  background: var(--destructive);
  box-shadow: 0 0 0 2px var(--background);
}
@media (max-width: 640px) {
  .panel-bar__search-text,
  .panel-bar__kbd {
    display: none;
  }
}

.notifications-popover {
  width: 22rem;
  padding: 0;
}
.notifications-popover__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.notifications-popover__title {
  font-weight: 500;
}
.notifications-popover__body {
  display: block;
  max-height: 24rem;
  overflow-y: auto;
  padding: 0.25rem;
}

.subscription-notice {
  margin-bottom: 0;
}

/* ======================================================================= Side menu */

.side-layout {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
.side-layout__page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}
@media (max-width: 960px) {
  .side-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }
}

.side-menu {
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
@media (max-width: 960px) {
  .side-menu {
    position: static;
    overflow-x: auto;
  }
  .side-menu [data-slot="sidebar-menu"] {
    flex-direction: row;
  }
  .side-menu [data-slot="sidebar-group-label"] {
    display: none;
  }
}

/* ======================================================================= Page head and record pages */

.page-head__facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 1rem;
  margin-top: 0.25rem;
  color: var(--muted-foreground);
}
.page-head__fact {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
}
.page-head__fact-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.record-page .page-head,
.step-page .page-head {
  margin-bottom: 0;
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}
.section-head__text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.section-head__title {
  margin: 0;
  font-size: var(--ui-text-lg);
  font-weight: 600;
}
.section-head__description {
  margin: 0;
  color: var(--muted-foreground);
  font-size: var(--ui-text-sm);
}

/* ======================================================================= Marks */

.mark {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: var(--mark-size, 2.5rem);
  height: var(--mark-size, 2.5rem);
  border: 1px solid var(--border);
  border-radius: var(--mark-radius, var(--ui-radius-lg));
  background: var(--card);
  box-shadow: var(--ui-shadow-xs);
  color: var(--muted-foreground);
  font-size: var(--mark-font-size, 0.9375rem);
  font-weight: 600;
  user-select: none;
}
.mark > img,
.mark > .brand-mark,
.mark > .ui-icon {
  width: 55%;
  height: 55%;
}
.mark--round {
  --mark-radius: var(--ui-radius-full);
}
.mark--xs {
  --mark-size: 1.25rem;
  --mark-radius: var(--ui-radius-sm);
  --mark-font-size: 0.625rem;
}
.mark--sm {
  --mark-size: 1.5rem;
  --mark-radius: var(--ui-radius-sm);
  --mark-font-size: 0.625rem;
}
.mark--md {
  --mark-size: 2rem;
  --mark-radius: var(--ui-radius-md);
  --mark-font-size: 0.6875rem;
}
.mark--xl {
  --mark-size: 2.75rem;
  --mark-font-size: 1.125rem;
}

.brand-mark {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
}
.brand-mark--aws {
  color: var(--aws);
}

.logo-mark {
  flex-shrink: 0;
  height: auto;
}
.logo-mark--lg {
  width: auto;
  height: 1.375rem;
}
.logo {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
  color: var(--foreground);
}
.logo__name {
  font-size: 1.03rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}

/* ======================================================================= Status dots */

.status-dot {
  display: inline-block;
  flex-shrink: 0;
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--ui-radius-full);
  background: var(--muted-foreground);
}
.status-dot--success {
  background: var(--success);
}
.status-dot--info {
  background: var(--info);
}
.status-dot--warning {
  background: var(--warning);
}
.status-dot--negative {
  background: var(--destructive);
}
.status-dot--pulse {
  animation: status-dot-pulse 1.4s var(--ui-ease) infinite;
}
@keyframes status-dot-pulse {
  50% {
    opacity: 0.35;
  }
}
@media (prefers-reduced-motion: reduce) {
  .status-dot--pulse {
    animation: none;
  }
}

/* ======================================================================= Copying */

.copy-button > span {
  display: inline-flex;
  align-items: center;
  gap: inherit;
}
.copy-button:not([data-copied]) > .copy-button__done,
.copy-button[data-copied] > .copy-button__idle {
  display: none;
}

.snippet {
  position: relative;
  padding: 0.625rem 2.5rem 0.625rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--ui-radius-md);
  background: var(--muted);
}
.snippet__text {
  margin: 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.625;
  white-space: pre-wrap;
  word-break: break-all;
}
.snippet__copy {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
}

/* ======================================================================= Step pages
   A form on a page of its own: the same head in the same place as every page, the form's width limited below it. */

.step-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.step-page__content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 40rem;
}
.step-page__content--narrow {
  max-width: 28rem;
}
.step-page__content--wide {
  max-width: 56rem;
}
.step-page__content--full {
  max-width: none;
}
.step-page__card--flush {
  padding: 0;
}
.step-page__after {
  color: var(--muted-foreground);
}

/* ======================================================================= The flow
   Setting up and adding an app: the steps down the left, one question on the right, help at the foot. */

.flow {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: color-mix(in oklab, var(--muted) 55%, var(--background));
}
.flow__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem);
}
.flow__brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
}
.flow__home {
  color: inherit;
  text-decoration: none;
}
.flow__divider {
  inline-size: 1px;
  block-size: 1.25rem;
  background: var(--border);
}
.flow__title {
  overflow: hidden;
  font-size: var(--ui-text-sm);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow__actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.25rem;
}
.flow__actions .ui-button {
  gap: 0.375rem;
}
.flow__body {
  display: flex;
  flex: 1;
  justify-content: center;
  inline-size: min(78rem, 100%);
  margin-inline: auto;
  padding: clamp(1rem, 4vh, 3rem) clamp(1.25rem, 4vw, 3rem) 4rem;
}
.flow__body--steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}
@media (width >= 64rem) {
  .flow__body--steps {
    grid-template-columns: 19rem minmax(0, 1fr);
    gap: 4rem;
  }
}
.flow__steps {
  display: none;
}
@media (width >= 64rem) {
  .flow__steps {
    display: block;
    align-self: stretch;
    padding: 1.5rem 3rem 1.5rem 0;
    border-right: 1px solid var(--border);
  }
  .flow__steps > .flow-stepper {
    position: sticky;
    top: 2rem;
  }
}
.flow__main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  inline-size: 100%;
  max-inline-size: 50rem;
  min-width: 0;
  padding-top: 1rem;
}
.flow__mark {
  inline-size: 3rem;
  block-size: 3rem;
  color: var(--foreground);
}
.flow .step-page [data-slot="page-title"] {
  font-size: clamp(1.625rem, 2.5vw, 2rem);
  letter-spacing: -0.03em;
}
.flow .step-page [data-slot="page-description"] {
  font-size: 0.9375rem;
}
.flow__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
  border-top: 1px solid var(--border);
}
.flow__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.flow__link {
  color: var(--muted-foreground);
  font-size: var(--ui-text-sm);
  text-decoration: none;
}
.flow__link:hover {
  color: var(--foreground);
}

.flow-stepper [data-slot="timeline-item"] {
  --marker: 1.75rem;
  padding-bottom: 2rem;
}
.flow-stepper [data-slot="timeline-marker"] {
  font-size: var(--ui-text-xs);
  font-weight: 600;
}
.flow-stepper__item:is([data-state="complete"], [data-state="current"]) [data-slot="timeline-marker"] {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
}
.flow-stepper__item[data-state="current"] [data-slot="timeline-marker"] {
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 12%, transparent);
}
.flow-stepper__item[data-state="complete"] [data-slot="timeline-connector"] {
  background: var(--primary);
}
.flow-stepper__item[data-end="true"] {
  padding-bottom: 0;
}
.flow-stepper__item[data-end="true"] [data-slot="timeline-connector"] {
  display: none;
}
.flow-stepper__item[data-state="current"] [data-slot="timeline-title"] {
  font-weight: 600;
}
.flow-stepper__item[data-state="upcoming"] :is([data-slot="timeline-title"], [data-slot="timeline-description"]) {
  color: var(--muted-foreground);
}
.flow-stepper [data-slot="timeline-title"] {
  font-size: var(--ui-text-sm);
  line-height: 1.75rem;
}
.flow-stepper [data-slot="timeline-description"] {
  font-size: 0.8125rem;
}
.flow-stepper__item[data-fresh="true"] [data-slot="timeline-marker"] {
  animation: flow-pop var(--ui-duration-travel, 300ms) var(--ui-ease-out) both;
}
.flow-cheer {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  z-index: 60;
  margin: 0;
  padding: 0.625rem 1.125rem;
  border: 1px solid color-mix(in oklab, var(--success) 25%, transparent);
  border-radius: 999px;
  color: var(--success);
  background: color-mix(in oklab, var(--success) 10%, var(--background));
  box-shadow:
    var(--ui-shadow-sm),
    0 8px 24px -12px color-mix(in oklab, var(--foreground) 25%, transparent);
  font-size: var(--ui-text-sm);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  translate: -50% 0;
  animation:
    flow-cheer-in 450ms var(--ui-ease-out) both,
    flow-cheer-out 400ms var(--ui-ease-in-out, ease-in) 3.2s forwards;
}
@keyframes flow-cheer-in {
  from {
    opacity: 0;
    translate: -50% -1.5rem;
    scale: 0.92;
  }
  to {
    opacity: 1;
    translate: -50% 0;
    scale: 1;
  }
}
@keyframes flow-cheer-out {
  to {
    opacity: 0;
    translate: -50% -1rem;
    visibility: hidden;
  }
}
@keyframes flow-pop {
  from {
    scale: 0.4;
  }
  70% {
    scale: 1.2;
  }
  to {
    scale: 1;
  }
}
@keyframes flow-rise {
  from {
    opacity: 0;
    translate: 0 0.5rem;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .flow-stepper__item[data-fresh="true"] [data-slot="timeline-marker"],
  .flow-cheer {
    animation: flow-cheer-out 1ms linear 3.2s forwards;
  }
}

/* ======================================================================= Signed out */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100dvh;
}
@media (max-width: 1024px) {
  .auth {
    grid-template-columns: minmax(0, 1fr);
  }
}
.auth__side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem;
}
.auth__center {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
}
.auth__box {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  max-width: 24rem;
}
.auth__head {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.auth__mark {
  color: var(--foreground);
}
.auth__mark-logo {
  width: auto;
  height: 1.5rem;
}
.auth__intro {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.auth__heading {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.auth__description {
  margin: 0;
  color: var(--muted-foreground);
}
.auth__footer {
  color: var(--muted-foreground);
  text-align: center;
}
.auth__note {
  margin: 0;
  color: var(--muted-foreground);
  font-size: var(--ui-text-xs);
  text-align: center;
}
