/*
 * First-paint skeleton (no JS): the markup lives inside #root in index.html and React replaces it on its first render.
 * boot.js picks the layout before the first paint with <html data-boot="auth|account|shell">, and .dark for the theme.
 * Colors come from Romana's tokens when styles.css is already loaded (production), with the same values as fallbacks
 * (dev, where the CSS arrives with the JS). Same file in apps/web/admin/public/boot.css: keep them in sync.
 * Same-origin file, no inline styles (strict CSP).
 */
html {
  background: var(--background, #ebebeb); /* romana-ignore: fallback before the token CSS loads */
  color: var(--foreground, #333333); /* romana-ignore: fallback before the token CSS loads */
  --rb-card: var(--card, #ffffff);
  --rb-border: var(--border, #d9dfe4);
  --rb-paper: var(--paper, #f5f5f5);
  --rb-line: var(--paper-line, #dfe9f1);
  --rb-margin: var(--paper-margin, #f9abab);
  --rb-ink: var(--ink, #1c2433);
  --rb-sidebar: var(--sidebar, #dedede);
}
html.dark {
  background: var(--background, #141517); /* romana-ignore: fallback before the token CSS loads */
  color: var(--foreground, #e7e8ea); /* romana-ignore: fallback before the token CSS loads */
  --rb-card: var(--card, #1c1d20);
  --rb-border: var(--border, #2f3136);
  --rb-paper: var(--paper, #141517);
  --rb-line: var(--paper-line, #23262b);
  --rb-margin: var(--paper-margin, #5a3238);
  --rb-ink: var(--ink, #cfd4dc);
  --rb-sidebar: var(--sidebar, #18191c);
}

body {
  margin: 0;
}
.rb {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
}
.rb-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
html[lang="en"] .rb-es,
html:not([lang="en"]) .rb-en {
  display: none;
}

/* One layout at a time; the shell is the fallback when boot.js didn't run. */
.rb-auth,
.rb-account {
  display: none;
}
html[data-boot="auth"] .rb-auth,
html[data-boot="account"] .rb-account {
  display: flex;
}
html[data-boot="auth"] .rb-shell,
html[data-boot="account"] .rb-shell {
  display: none;
}

/* Placeholders: Romana's Skeleton (pulse at 10% of the text color). */
.rb-sk {
  display: block;
  border-radius: 0.375rem;
  background: color-mix(in srgb, currentColor 10%, transparent); /* Skeleton: bg-foreground/10 */
  animation: rb-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.rb-sk.rb-round {
  border-radius: 9999px;
}
@keyframes rb-pulse {
  50% {
    opacity: 0.5;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rb-sk {
    animation: none;
  }
}
.rb-h3 {
  height: 0.75rem;
}
.rb-h4 {
  height: 1rem;
}
.rb-h7 {
  height: 1.75rem;
}
.rb-h8 {
  height: 2rem;
}
.rb-h9 {
  height: 2.25rem;
}
.rb-w16 {
  width: 4rem;
}
.rb-w24 {
  width: 6rem;
}
.rb-w32 {
  width: 8rem;
}
.rb-w40 {
  width: 10rem;
}
.rb-w56 {
  width: 14rem;
  max-width: 70%;
}
.rb-w72 {
  width: 18rem;
  max-width: 90%;
}
.rb-wfull {
  width: 100%;
}
.rb-sq8 {
  width: 2rem;
  height: 2rem;
}

/* Romana's mark (the landing favicon): beam in the text color, weight in the brand color. */
.rb-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.rb-mark {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}
.rb-mark .rb-beam {
  fill: none;
  stroke: currentColor;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rb-mark .rb-weight {
  fill: var(
    --brand-logo-color,
    var(--brand, #c64722)
  ); /* romana-ignore: fallback before the token CSS loads */
}

.rb-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  border: 1px solid var(--rb-border);
  border-radius: calc(var(--radius, 0.625rem) + 4px);
  background: var(--rb-card);
}
.rb-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.rb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* ── App shell: sidebar + navbar + content (DashboardShell) ──────────────── */
.rb-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}
.rb-sidebar {
  display: none;
  width: 16rem;
  flex: none;
  flex-direction: column;
  gap: 0.875rem;
  padding: 1rem;
  background: var(--rb-sidebar);
}
.rb-sidebar .rb-brand {
  height: 2rem;
  margin-bottom: 0.75rem;
}
.rb-main {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}
.rb-navbar {
  display: flex;
  height: 3rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--rb-border);
}
.rb-navbar-start {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.rb-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 1rem;
}
.rb-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.rb-cards .rb-card {
  min-height: 8.5rem;
}
.rb-tall {
  min-height: 12rem;
}
@media (min-width: 640px) {
  .rb-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .rb-content {
    padding: 1.5rem;
  }
}
@media (min-width: 1024px) {
  .rb-sidebar {
    display: flex;
  }
  .rb-menu {
    display: none;
  }
}

/* ── Account pages: navbar + one centered column (AccountFrame) ───────────── */
.rb-account {
  flex-direction: column;
}
.rb-account .rb-navbar > *,
.rb-account .rb-column {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
}
.rb-account .rb-navbar {
  padding: 0;
}
.rb-account .rb-row {
  padding: 0 1rem;
  box-sizing: border-box;
}
@media (min-width: 640px) {
  .rb-account .rb-row,
  .rb-column {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}
.rb-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 1rem;
  box-sizing: border-box;
}
@media (min-width: 1024px) {
  .rb-column {
    padding: 2.5rem 1.5rem;
  }
}

/* ── Sign-in: notebook page, panel + card (AuthLayout variant="notebook") ── */
.rb-auth {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  background-color: var(--rb-paper);
  background-image:
    linear-gradient(var(--rb-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--rb-line) 1px, transparent 1px);
  background-size: 30px 30px;
}
.rb-auth::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 1.5rem;
  width: 2px;
  background: var(--rb-margin);
}
.rb-auth-panel,
.rb-auth-form {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.5rem 1.5rem 2.75rem;
  box-sizing: border-box;
}
.rb-auth-panel {
  gap: 1rem;
}
.rb-auth-panel .rb-titles {
  display: none;
}
.rb-auth-form {
  flex: 1;
  justify-content: center;
}
.rb-auth .rb-card {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  box-sizing: border-box;
  border: 2px solid var(--rb-ink);
  box-shadow: 4px 4px 0 var(--rb-ink);
}
@media (min-width: 768px) {
  .rb-auth {
    flex-direction: row;
  }
  .rb-auth::before {
    left: 4.5rem;
  }
  .rb-auth-panel,
  .rb-auth-form {
    width: 50%;
    padding: 2.5rem 3rem 2.5rem 6.5rem;
  }
  .rb-auth-panel {
    justify-content: space-between;
  }
  .rb-auth-panel .rb-titles {
    display: flex;
  }
  .rb-auth-form {
    padding-left: 3rem;
    border-left: 2px dashed var(--rb-ink);
  }
}
