/* Restagent product layout only — UI primitives from Tabler (docs/ui-manifest.md). */

html, body {
  height: 100%;
}

/* exception: Edgar 2026-09-14 — every product button uses cabinet navbar btn-sm. */
.btn:not(.btn-close),
.btn-lg:not(.btn-close) {
  --tblr-btn-font-size: 0.75rem;
  --tblr-btn-padding-x: 0.5rem;
  --tblr-btn-padding-y: 0.125rem;
}

body.layout-chat {
  overflow: hidden;
}

.layout-chat .page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.layout-chat .page-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.layout-chat #product-navbar {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.layout-chat .chat-main .page-title {
  display: block;
  min-width: 0;
  width: auto;
  flex: 1 1 0%;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.chat-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.msg-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.msg-text.chat-answer-collapsed .card-body {
  max-height: 32rem;
  overflow: hidden;
  mask-image: linear-gradient(#000 0%, #000 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(#000 0%, #000 88%, transparent 100%);
}

/* === Exception 2026-09-10: Edgar-requested visual link between chat and report === */
@media (min-width: 992px) {
  .report-link-divider {
    position: relative;
  }

  .report-link-divider::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 -1px;
    z-index: 2;
    width: 2px;
    pointer-events: none;
    background: linear-gradient(
      180deg,
      var(--tblr-border-color) 0%,
      var(--tblr-primary) 45%,
      var(--tblr-azure) 55%,
      var(--tblr-border-color) 100%
    );
    background-size: 100% 240%;
    animation: report-divider-flow 5s ease-in-out infinite;
  }

  .report-link-divider.is-report-linking::before {
    width: 3px;
    box-shadow: 0 0 12px color-mix(in srgb, var(--tblr-primary) 45%, transparent);
    animation-duration: 0.9s;
  }
}

@keyframes report-divider-flow {
  0%, 100% { background-position: 0 0; opacity: 0.65; }
  50% { background-position: 0 100%; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .report-link-divider::before {
    animation: none;
    background: var(--tblr-border-color);
  }
}

/* Chat bubbles: alignment only; cards/colors = Tabler */
.msg-row.user .msg-body {
  margin-left: auto;
  max-width: min(36rem, 100%);
}

.msg-row.assistant .msg-body {
  max-width: min(42rem, 100%);
}

.chat-composer {
  flex: 0 0 auto;
  background: var(--tblr-bg-surface, transparent);
  /* exception: iOS notch / home indicator — no Tabler primitive for chat dock */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Composer: larger touch target on narrow screens */
@media (max-width: 575.98px) {
  .composer-send.btn-icon {
    min-width: 2.75rem;
    min-height: 2.75rem;
  }

  .chat-composer .form-control {
    font-size: 16px; /* exception: iOS zoom lock on focus */
  }

  .msg-row.user .msg-body,
  .msg-row.assistant .msg-body {
    max-width: 100%;
  }
}

/* Owner-requested white surface also applies to Markdown code. */
.msg-text pre {
  background: #fff;
  color: var(--tblr-body-color, #182433);
  border: 1px solid var(--tblr-border-color, #e5e7eb);
}

.min-w-0 {
  min-width: 0;
}

/* exception: Edgar 2026-09-12 — collapsed filters need a long blinking CTA */
@keyframes restagent-filters-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(6, 111, 209, 0.0); }
  50% { box-shadow: 0 0 0 0.35rem rgba(6, 111, 209, 0.28); }
}
#ready-filters-toggle {
  min-width: 10rem;
  animation: restagent-filters-pulse 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  #ready-filters-toggle { animation: none; }
}

/* Top-nav dropdown lists: cap height; history is a compact list, not a card. */
.top-nav-scroll {
  max-height: min(18rem, 50vh);
}

/* exception: Edgar 2026-09-14 — compact history list + hover-only row actions */
#history-dropdown {
  min-width: min(26rem, calc(100vw - 1rem));
}
@media (max-width: 1199.98px) {
  #history-dropdown {
    min-width: 0;
    width: 100%;
  }
}
#product-navbar.navbar {
  min-height: 0;
}
@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
  [data-conversation-row] .conversation-actions {
    opacity: 0;
  }
  [data-conversation-row]:hover .conversation-actions,
  [data-conversation-row]:focus-within .conversation-actions {
    opacity: 1;
  }
}

/* === Exception 2026-09-13 (ui-manifest §9): the ready report takes 70% of the cabinet,
   so the chat pane's own width — not the viewport — decides when it goes compact.
   Tabler utilities answer to the viewport, which says nothing about this pane. === */
.chat-main {
  container-type: inline-size;
  container-name: chatpane;
}
@container chatpane (max-width: 34rem) {
  .chat-compact-hide {
    display: none !important;
  }
  .layout-chat .chat-main .page-header {
    padding-top: 0.125rem;
    padding-bottom: 0.125rem;
  }
  .layout-chat .chat-main .page-title {
    font-size: 1rem;
  }
  .chat-main #chat-welcome {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }
  .chat-main #chat-welcome h1 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem !important;
  }
  .chat-main #chat-welcome > .subheader {
    margin-bottom: 0.25rem !important;
  }
  .chat-main #chat-welcome > p {
    margin-bottom: 0.5rem !important;
  }
  .chat-main .msg-scroll > .container-xl,
  .chat-main .chat-composer > .container-xl {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* Slightly center chat column on ultrawide */
.layout-chat .msg-scroll > .container-xl,
.layout-chat .chat-composer > .container-xl {
  max-width: 52rem;
}

/* === Exception 2026-09-06 (ui-manifest §9): ambient brand animation, public pages === */
.landing-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.landing-bg .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
  will-change: transform;
}
.landing-bg .blob-1 {
  width: 46vmax; height: 46vmax;
  left: -12vmax; top: -14vmax;
  background: #206bc4;
  animation: blob-drift-1 26s ease-in-out infinite alternate;
}
.landing-bg .blob-2 {
  width: 38vmax; height: 38vmax;
  right: -10vmax; top: 18vh;
  background: #4299e1;
  opacity: 0.13;
  animation: blob-drift-2 32s ease-in-out infinite alternate;
}
.landing-bg .blob-3 {
  width: 30vmax; height: 30vmax;
  left: 28vw; bottom: -16vmax;
  background: #74b9f0;
  opacity: 0.10;
  animation: blob-drift-3 38s ease-in-out infinite alternate;
}
.landing-bg .grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(32, 107, 196, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 107, 196, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 75% 65% at 50% 42%, #000 0%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 42%, #000 0%, transparent 100%);
  animation: grid-breathe 14s ease-in-out infinite;
}
/* Subtle variant for pricing/security/auth: quieter, no third blob */
.landing-bg-subtle .blob { opacity: 0.08; }
.landing-bg-subtle .blob-2 { opacity: 0.06; }
.landing-bg-subtle .grid { opacity: 0.55; }
/* Cabinet variant: extra quiet for working app pages */
.landing-bg-cabinet .blob { opacity: 0.05; }
.landing-bg-cabinet .blob-2 { opacity: 0.04; }
.landing-bg-cabinet .grid { opacity: 0.3; }

/* Cabinet pages: quick, gentle header rise (no stagger, no bounce) */
.page-wrapper > .page-header:first-child {
  animation: cabinet-rise 0.35s ease-out;
}
@keyframes cabinet-rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes blob-drift-1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(6vmax, 5vmax) scale(1.12); }
}
@keyframes blob-drift-2 {
  from { transform: translate(0, 0) scale(1.05); }
  to   { transform: translate(-5vmax, 6vmax) scale(0.95); }
}
@keyframes blob-drift-3 {
  from { transform: translate(0, 0) scale(0.95); }
  to   { transform: translate(4vmax, -4vmax) scale(1.1); }
}
@keyframes grid-breathe {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* Entrance: gentle staggered rise, no bounce.
   Первый экран не прячем в opacity:0 — он и есть LCP: только лёгкий подъём. */
.landing-enter {
  transform: translateY(14px);
  animation: landing-rise 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: var(--enter-delay, 0s);
}
.landing-enter-fade {
  opacity: 0;
}
@keyframes landing-rise {
  to { opacity: 1; transform: translateY(0); }
}

/* Статичные SVG-миниатюры витрины: рисуются сразу, оживают один раз. */
.landing-chart-frame {
  width: 100%;
}
.landing-svg-chart {
  display: block;
  overflow: visible;
}
@media (prefers-reduced-motion: no-preference) {
  .landing-svg-chart .svg-bar,
  .landing-svg-chart .svg-hbar {
    transform-box: fill-box;
    animation: svg-bar-grow 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
    animation-delay: var(--bar-delay, 0s);
  }
  .landing-svg-chart .svg-bar {
    transform-origin: bottom;
  }
  .landing-svg-chart .svg-hbar {
    transform-origin: left;
    animation-name: svg-hbar-grow;
  }
  /* pathLength="1" в разметке: штрих не зависит от реальной длины линии. */
  .landing-svg-chart .svg-line {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: svg-line-draw 1.1s ease-out forwards;
  }
}
@keyframes svg-bar-grow {
  from { transform: scaleY(0.02); }
  to { transform: scaleY(1); }
}
@keyframes svg-hbar-grow {
  from { transform: scaleX(0.02); }
  to { transform: scaleX(1); }
}
@keyframes svg-line-draw {
  to { stroke-dashoffset: 0; }
}

/* Headline accent: slow gradient shimmer within brand blues */
.landing-accent {
  background: linear-gradient(100deg, #206bc4 20%, #4299e1 40%, #74b9f0 50%, #4299e1 60%, #206bc4 80%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: accent-flow 7s ease-in-out infinite;
}
@keyframes accent-flow {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* Headline letters: one restrained entrance wave, then the text stays still. */
.landing-letters {
  display: inline-block;
  white-space: nowrap;
}
.landing-letter {
  display: inline-block;
  background: linear-gradient(100deg, #206bc4 15%, #4299e1 55%, #74b9f0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  transform: translateY(0.35em) rotate(2deg);
  animation: letter-reveal 0.65s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: calc(0.18s + var(--letter) * 0.035s);
}
@keyframes letter-reveal {
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

/* Landing CTA keeps the class for tests; look is the same cabinet btn-sm. */

/* Unpaid cabinet frost: Tabler has no frosted lock overlay. Navbar stays outside page-wrapper. */
.cabinet-frost-host > *:not(#cabinet-frost-overlay) {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}
#cabinet-frost-overlay {
  background: rgba(255, 255, 255, 0.35);
  z-index: 1020;
}

/* The reports pane remains usable; only AI is unavailable without a balance. */
.ai-balance-locked .chat-main {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}
#ai-balance-overlay {
  z-index: 10;
  background: rgba(255, 255, 255, 0.32);
}
.ai-balance-lock-card {
  max-width: 30rem;
}

@media (prefers-reduced-motion: reduce) {
  .landing-bg .blob, .landing-bg .grid,
  .landing-enter, .landing-accent, .landing-letter {
    animation: none;
    transition: none;
  }
  .landing-enter { opacity: 1; transform: none; }
  .landing-accent { color: #206bc4; background: none; }
  .landing-letter { color: #206bc4; background: none; opacity: 1; transform: none; }
  .page-wrapper > .page-header:first-child { animation: none; }
}

/* Two panes on desktop: the chat keeps what the report does not take. */
@media (min-width: 992px) {
  #chat-panes {
    flex-wrap: nowrap;
  }
  #ai-workspace {
    /* col-12 pins width to 100%, which would wrap the report onto its own row. */
    width: auto;
    flex: 1 1 0;
    min-width: 20%;
  }
  #ready-reports-panel {
    width: var(--panel-width, 70%);
    flex: 0 0 var(--panel-width, 70%);
    max-width: var(--panel-width, 70%);
  }
  #panel-resizer {
    flex: 0 0 10px;
    cursor: col-resize;
    background: transparent;
    position: relative;
  }
  #panel-resizer::before {
    content: "";
    position: absolute;
    inset: 0 4px;
    background: var(--tblr-border-color, #dee2e6);
    border-radius: 2px;
  }
  #panel-resizer:hover::before,
  #panel-resizer:focus-visible::before {
    background: var(--tblr-primary, #206bc4);
  }
}

/* A slice label wraps on spaces, never letter by letter; numbers never wrap. */
.report-slice {
  min-width: 15rem;
  word-break: normal;
  overflow-wrap: break-word;
}
#ready-table-panel td.text-end,
#ready-table-panel th.text-end {
  white-space: nowrap;
}

/* Live table: a header sorts on click and carries a grip on its right edge. */
#report-table th[data-sort-column] {
  position: relative;
  user-select: none;
}
#report-table th[data-sort-column] {
  cursor: pointer;
}
#report-table .report-th {
  cursor: pointer;
}
#report-table .report-th:hover {
  text-decoration: underline;
}
#report-table th[aria-sort="ascending"] .report-th::after {
  content: " ↑";
}
#report-table th[aria-sort="descending"] .report-th::after {
  content: " ↓";
}
#report-table .report-grip {
  position: absolute;
  top: 0;
  right: 0;
  width: 11px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  border-right: 2px dotted var(--tblr-border-color, #dee2e6);
}
#report-table .report-grip:hover,
#report-table .report-grip[data-dragging="1"] {
  border-right-color: var(--tblr-primary, #206bc4);
  background: rgba(32, 107, 196, 0.12);
}
#report-table th[data-sort-column]:hover {
  background: rgba(32, 107, 196, 0.06);
}

/* Tabler's default row tint is 7.5% of the text colour and vanishes in a dense report. */
.table-hover {
  --tblr-table-hover-bg: rgba(32, 107, 196, 0.11);
}

/* exception: dense tables. Tabler table-sm only tightens padding, not type. */
.table {
  font-size: 0.75rem;
}

/* exception 2026-09-12: verified ready-report keys in the native filter.
   <option> is OS-painted; Tabler bg-green-lt does not reliably tint the list. */
#preset option[data-verified="1"] {
  background-color: var(--tblr-green-lt);
}
#report-table tbody tr:hover .report-slice {
  font-weight: 500;
}

/* exception 2026-09-13: P&L compact rows + sticky header in a bounded scroller.
   table-responsive overflow prevents viewport-sticky thead; Tabler table-sm is still
   too tall for a 90-line editable statement. Safe-area offset is not in kit utilities. */
#pnl-wrap {
  max-height: min(70dvh, 44rem);
  overflow: auto;
}
#pnl-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--tblr-bg-surface);
  box-shadow: inset 0 -1px 0 var(--tblr-border-color);
}
#pnl-table > :not(caption) > * > * {
  padding-top: 0.12rem;
  padding-bottom: 0.12rem;
}
#pnl-table .form-control,
#pnl-table .form-select {
  min-height: 1.35rem;
  padding-top: 0.05rem;
  padding-bottom: 0.05rem;
}
#pnl-save-float {
  bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  right: calc(0.75rem + env(safe-area-inset-right, 0px));
}

/* Highcharts 12 colours itself with light-dark() and defaults its container to
   "color-scheme: light dark". The whole product is light-only, so a visitor whose
   system is dark got black chart boxes inside white cards. Pin charts to light. */
.highcharts-container,
.highcharts-container svg {
  color-scheme: light;
}

/* Example chips open the demo modal, so they must read as buttons. */
.landing-demo-chip {
  cursor: pointer;
}

/* Sticky landing top bar: the page is long, the way around it must stay on screen. */
/* html,body height:100% above is the chat layout's; sticky needs a body as tall as the page. */
body.landing-page {
  height: auto;
  min-height: 100%;
}
.landing-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.landing-topbar.is-stuck {
  border-bottom-color: var(--tblr-border-color, #e6e7e9);
  box-shadow: 0 1px 12px rgba(24, 36, 51, 0.06);
}
.landing-nav-link {
  color: var(--tblr-secondary, #667382);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.375rem 0.625rem;
  border-radius: var(--tblr-border-radius, 4px);
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.landing-nav-link:hover,
.landing-nav-link:focus-visible {
  color: #206bc4;
  background: rgba(32, 107, 196, 0.07);
}
.landing-nav-link.is-current {
  color: #206bc4;
  background: rgba(32, 107, 196, 0.1);
  font-weight: 500;
}
/* Anchors must not land under the sticky bar. */
#how-it-works, #whats-inside, #security, #pricing, #faq, #knowledge-base {
  scroll-margin-top: 5.5rem;
}
@media (prefers-reduced-motion: reduce) {
  .landing-topbar, .landing-nav-link { transition: none; }
}

/* Security tabs: panes differ in length — hold the height so the page does not jump. */
#security .tab-content {
  min-height: 15rem;
}
#security .nav-pills .nav-link {
  white-space: normal;
}

/* Заголовок героя: один текст на все ширины вместо двух спанов под breakpoint. */
.landing-headline {
  font-size: clamp(2.25rem, 5.4vw, 4.5rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}
