/*
 * White-label theme contract
 * --------------------------
 * Tenant-specific values belong in one data-theme block. Components consume
 * only the semantic tokens below. A tenant stylesheet may be loaded after this
 * file and override the same tokens without changing application selectors.
 */
:root,
:root[data-theme="digital-warehouse"] {
  color-scheme: light;

  --color-brand-primary: #4f46e5;
  --color-brand-primary-hover: #4338ca;
  --color-brand-primary-active: #3730a3;
  --color-brand-primary-rgb: 79, 70, 229;
  --color-brand-secondary: #172033;
  --color-accent: #22d3ee;
  --color-accent-rgb: 34, 211, 238;
  --color-danger: #b42318;
  --color-danger-surface: #fef3f2;
  --color-danger-border: #fecaca;
  --color-danger-border-soft: rgba(180, 35, 24, 0.2);
  --color-warning: #a16207;
  --color-warning-surface: #fefce8;
  --color-warning-border: #fde68a;
  --color-success: #15803d;
  --color-success-surface: #f0fdf4;
  --color-success-border: #bbf7d0;
  --color-info: #1d4ed8;
  --color-info-surface: #eff6ff;
  --color-focus: #2563eb;

  --color-page: #f5f7fb;
  --color-page-accent: #eef2ff;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-muted: #f8fafc;
  --color-surface-subtle: #f6f8fb;
  --color-surface-disabled: #f1f5f9;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-text-primary: #172033;
  --color-text-secondary: #64748b;
  --color-text-muted: #667085;
  --color-text-disabled: #94a3b8;
  --color-on-brand: #ffffff;
  --color-on-dark: #ffffff;

  --color-sidebar: #111827;
  --color-sidebar-text: #cbd5e1;
  --color-sidebar-muted: #9ca3af;
  --color-sidebar-hover: rgba(255, 255, 255, 0.06);
  --color-sidebar-active: rgba(79, 70, 229, 0.22);
  --color-sidebar-border: rgba(255, 255, 255, 0.08);
  --color-sidebar-control: rgba(255, 255, 255, 0.08);
  --color-sidebar-control-border: rgba(255, 255, 255, 0.18);

  --color-overlay-soft: rgba(15, 23, 42, 0.26);
  --color-overlay: rgba(15, 23, 42, 0.48);
  --color-overlay-strong: rgba(15, 23, 42, 0.62);
  --color-header-glass: rgba(255, 255, 255, 0.92);
  --color-surface-glass: rgba(255, 255, 255, 0.88);
  --color-surface-glass-muted: rgba(248, 250, 252, 0.78);

  --color-auth-canvas-start: #07101f;
  --color-auth-canvas-middle: #101a35;
  --color-auth-canvas-end: #182044;
  --color-auth-grid-line: rgba(255, 255, 255, 0.045);
  --color-auth-header: rgba(255, 255, 255, 0.96);
  --color-auth-card: rgba(255, 255, 255, 0.985);
  --color-auth-story: rgba(10, 18, 40, 0.76);
  --color-auth-story-text: #f8fafc;
  --color-auth-story-muted: #c7d2e5;
  --color-auth-story-border: rgba(255, 255, 255, 0.13);
  --color-auth-story-gradient-end: rgba(19, 27, 61, 0.94);

  --font-body: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: var(--font-body);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-card: 28px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 18px 50px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 32px 90px rgba(3, 10, 26, 0.34);
  --shadow-control: 0 12px 30px rgba(79, 70, 229, 0.24);
  --shadow-control-subtle: 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow-header: 0 1px 0 rgba(15, 23, 42, 0.02), 0 8px 28px rgba(15, 23, 42, 0.04);
  --shadow-public-header: 0 8px 30px rgba(3, 10, 26, 0.08);
  --shadow-dialog: 0 28px 80px rgba(15, 23, 42, 0.26);
  --shadow-sidebar: 28px 0 60px rgba(15, 23, 42, 0.28);
  --control-height: 48px;
  --logo-width: 264px;
}

:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 48px;
  --space-10: 64px;

  --motion-fast: 160ms;
  --motion-standard: 240ms;
}

@font-face {
  font-family: "robotobold";
  src: url(../fonts/roboto-bold_0-webfont.woff2) format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "robotoregular";
  src: url(../fonts/roboto-regular_0-webfont.woff2) format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "robotolight";
  src: url(../fonts/roboto-light_0-webfont.woff2) format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

html,
body,
#root {
  min-height: 100%;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--color-text-primary);
  background: var(--color-page);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

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

:where(h1, h2, h3, h4, h5, h6, p, ul, ol, figure, fieldset) {
  margin: 0;
}

:where(ul, ol) {
  padding: 0;
  list-style: none;
}

:where(button, input, select, textarea) {
  font: inherit;
}

button,
[role="button"] {
  cursor: pointer;
}

button:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
}

a {
  color: var(--color-brand-primary);
  text-decoration: none;
}

img,
svg {
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.spin {
  animation: base-spin 700ms linear infinite;
}

@keyframes base-spin {
  to { transform: rotate(360deg); }
}

.wrapper--public {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 78px minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  background: var(--color-auth-canvas-start);
  font-family: var(--font-body);
}

.wrapper--public > header {
  grid-row: 1;
  grid-column: 1;
  display: grid;
  grid-template-columns: minmax(0, 1180px);
  justify-content: center;
  padding: 0 clamp(24px, 5vw, 72px);
  background: var(--color-auth-header);
  border-bottom: 1px solid color-mix(in srgb, var(--color-text-primary) 8%, transparent);
  box-shadow: var(--shadow-public-header);
  backdrop-filter: blur(18px);
}

.wrapper--public > header .logo {
  justify-self: start;
  align-self: center;
}

.wrapper--public > header .logo img {
  display: block;
  width: var(--logo-width);
  max-width: min(52vw, var(--logo-width));
  max-height: 52px;
  height: auto;
  object-fit: contain;
}

.wrapper--public > main {
  grid-row: 2;
  grid-column: 1;
  min-width: 0;
  padding: 0;
  overflow: auto;
}

.wrapper--public > aside {
  display: none;
}

.auth-page {
  isolation: isolate;
  position: relative;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vh, 64px) clamp(20px, 5vw, 72px);
  overflow: hidden;
  color: var(--color-text-primary);
  background:
    linear-gradient(var(--color-auth-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-auth-grid-line) 1px, transparent 1px),
    radial-gradient(circle at 12% 18%, rgba(var(--color-accent-rgb), 0.2), transparent 34%),
    radial-gradient(circle at 88% 82%, rgba(var(--color-brand-primary-rgb), 0.34), transparent 36%),
    linear-gradient(135deg, var(--color-auth-canvas-start), var(--color-auth-canvas-middle) 52%, var(--color-auth-canvas-end));
  background-size: 44px 44px, 44px 44px, auto, auto, auto;
}

.auth-page::before,
.auth-page::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 999px;
  pointer-events: none;
}

.auth-page::before {
  width: clamp(260px, 34vw, 540px);
  aspect-ratio: 1;
  top: -24%;
  right: -9%;
  border: 1px solid rgba(var(--color-accent-rgb), 0.26);
  box-shadow:
    0 0 0 54px rgba(var(--color-accent-rgb), 0.035),
    0 0 0 108px rgba(var(--color-brand-primary-rgb), 0.035);
}

.auth-page::after {
  width: clamp(180px, 24vw, 360px);
  aspect-ratio: 1;
  bottom: -22%;
  left: -8%;
  background: rgba(var(--color-brand-primary-rgb), 0.12);
  filter: blur(2px);
}

.auth-shell {
  width: min(100%, 1080px);
  min-height: min(570px, calc(100dvh - 190px));
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  overflow: hidden;
  border: 1px solid var(--color-auth-story-border);
  border-radius: var(--radius-card);
  background: var(--color-auth-card);
  box-shadow: var(--shadow-lg);
}

.auth-card,
.auth-story {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-card {
  padding: clamp(40px, 6vw, 72px);
  background: var(--color-auth-card);
}

.auth-card__eyebrow,
.auth-story__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 22px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-card__eyebrow {
  color: var(--color-brand-primary);
}

.auth-card__eyebrow::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 5px rgba(var(--color-accent-rgb), 0.16);
}

.auth-card h1 {
  max-width: 12ch;
  margin: 0;
  color: var(--color-text-primary);
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 730;
  line-height: 0.98;
  letter-spacing: -0.052em;
}

.auth-card__intro {
  max-width: 48ch;
  margin: 24px 0 0;
  color: var(--color-text-secondary);
  font-size: clamp(1rem, 1.6vw, 1.125rem);
  line-height: 1.7;
}

.auth-card__alert {
  margin: 22px 0 0;
  padding: 12px 14px;
  color: var(--color-danger);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
  border: 1px solid var(--color-danger-border-soft);
  border-radius: var(--radius-sm);
  background: var(--color-danger-surface);
}

.auth-card__actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin: 34px 0 0;
}

.auth-action {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition:
    transform var(--motion-fast) ease,
    background-color var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease;
}

.auth-action:hover {
  transform: translateY(-2px);
}

.auth-action:active {
  transform: translateY(0);
}

.auth-action:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 4px;
}

.auth-action--primary {
  color: var(--color-on-brand);
  background: var(--color-brand-primary);
  box-shadow: var(--shadow-control);
}

.auth-action--primary:hover {
  background: var(--color-brand-primary-hover);
}

.auth-action--primary:active {
  background: var(--color-brand-primary-active);
}

.auth-action--secondary {
  color: var(--color-text-primary);
  border-color: var(--color-border);
  background: var(--color-surface-subtle);
}

.auth-action--secondary:hover {
  border-color: rgba(var(--color-brand-primary-rgb), 0.45);
  background: var(--color-surface);
}

.auth-action__arrow {
  font-size: 1.15rem;
  line-height: 1;
  transition: transform var(--motion-fast) ease;
}

.auth-action:hover .auth-action__arrow {
  transform: translateX(3px);
}

.auth-card__trust {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 24px 0 0;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.auth-card__trust::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--color-accent);
}

.auth-story {
  position: relative;
  padding: clamp(40px, 5vw, 64px);
  color: var(--color-auth-story-text);
  background:
    radial-gradient(circle at 100% 0, rgba(var(--color-accent-rgb), 0.18), transparent 38%),
    linear-gradient(145deg, var(--color-auth-story), var(--color-auth-story-gradient-end));
}

.auth-story::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -110px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(var(--color-accent-rgb), 0.26);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(var(--color-accent-rgb), 0.035);
}

.auth-story__eyebrow {
  color: var(--color-accent);
}

.auth-story h2 {
  max-width: 12ch;
  margin: 0;
  color: var(--color-auth-story-text);
  font-size: clamp(1.85rem, 3.5vw, 3rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.auth-story__copy {
  max-width: 38ch;
  margin: 20px 0 0;
  color: var(--color-auth-story-muted);
  font-size: 0.98rem;
  line-height: 1.7;
}

.auth-story__features {
  display: grid;
  gap: 14px;
  margin: 32px 0 0;
}

.auth-story__features li {
  position: relative;
  padding: 0 0 0 26px;
  color: var(--color-auth-story-text);
  font-size: 0.88rem;
  font-weight: 620;
  line-height: 1.45;
}

.auth-story__features li::before {
  content: "";
  position: absolute;
  top: 0.25em;
  left: 0;
  width: 10px;
  height: 10px;
  border: 2px solid var(--color-accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(var(--color-accent-rgb), 0.1);
}

.startup-config-error {
  width: min(calc(100% - 40px), 640px);
  margin: 10vh auto;
  padding: clamp(28px, 6vw, 52px);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}

.startup-config-error h1,
.startup-config-error p {
  line-height: 1.5;
}

.startup-config-error h1 {
  margin: 8px 0 12px;
  font-size: clamp(1.8rem, 5vw, 2.55rem);
  letter-spacing: -0.035em;
}

.startup-config-error p {
  margin: 0 0 10px;
  color: var(--color-text-secondary);
}

.startup-config-error__eyebrow {
  color: var(--color-brand-primary) !important;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.startup-config-error button {
  min-height: 48px;
  margin-top: 24px;
  padding: 0 22px;
  color: var(--color-on-brand);
  font-weight: 700;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--color-brand-primary);
  cursor: pointer;
}

.startup-config-error button:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

.startup-status__progress {
  width: 100%;
  height: 4px;
  margin-top: 24px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-surface-subtle);
}

.startup-status__progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--color-brand-primary);
  animation: startup-progress 1.1s ease-in-out infinite alternate;
}

@keyframes startup-progress {
  from {
    transform: translateX(-30%);
  }

  to {
    transform: translateX(170%);
  }
}

@media (max-width: 840px) {
  .auth-shell {
    width: min(100%, 620px);
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-story {
    min-height: 300px;
  }
}

@media (max-width: 560px) {
  .wrapper--public {
    grid-template-rows: 68px minmax(0, 1fr);
  }

  .wrapper--public > header {
    padding: 0 20px;
  }

  .auth-page {
    place-items: start center;
    padding: 20px 14px 34px;
  }

  .auth-shell {
    min-height: 0;
    border-radius: 20px;
  }

  .auth-card,
  .auth-story {
    padding: 34px 26px;
  }

  .auth-card h1 {
    font-size: clamp(2.25rem, 14vw, 3.25rem);
  }

  .auth-card__actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-story {
    min-height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-action,
  .auth-action__arrow {
    transition: none;
  }

  .startup-status__progress span {
    width: 100%;
    animation: none;
  }

  .auth-action:hover,
  .auth-action:hover .auth-action__arrow {
    transform: none;
  }
}

