/*
 * app.css -- compact overrides on top of Sneat core.css, plus the few layout
 * rules Sneat keeps in demo.css. No SCSS build needed: the sidebar reads CSS
 * variables, and the rest is plain cascade.
 */

:root, [data-bs-theme] {
  /* Tighter sidebar */
  --bs-menu-width: 14.5rem;
  --bs-menu-collapsed-width: 4.5rem;
  --bs-menu-item-spacer: 0.0625rem;
  --bs-menu-vertical-link-padding-y: 0.3rem;
  --bs-menu-vertical-link-padding-x: 0.8rem;
  --bs-menu-vertical-menu-link-padding-y: 0.25rem;
  --bs-menu-vertical-menu-level-spacer: 0.5rem;
}

/* Base type one notch smaller than Sneat's 15px default */
html { font-size: 14px; }
body { font-size: 0.9286rem; line-height: 1.4; }
h1, .h1 { font-size: 1.85rem; } h2, .h2 { font-size: 1.55rem; } h3, .h3 { font-size: 1.3rem; }
h4, .h4 { font-size: 1.15rem; } h5, .h5 { font-size: 1rem; }   h6, .h6 { font-size: 0.9286rem; }

/* Compact controls */
.btn { padding: 0.36rem 0.9rem; font-size: 0.9286rem; }
.btn-sm { padding: 0.22rem 0.6rem; font-size: 0.8125rem; }
.btn-icon { width: calc(1.5em + 0.72rem + 2px); height: calc(1.5em + 0.72rem + 2px); }
.btn-icon.btn-sm { width: calc(1.5em + 0.44rem + 2px); height: calc(1.5em + 0.44rem + 2px); }
.btn:hover { transform: none; }
.form-control { padding: 0.4rem 0.75rem; font-size: 0.9286rem; }
.form-control-sm { padding: 0.25rem 0.6rem; font-size: 0.8125rem; }
/* Longhands only: the shorthand would reset the right gutter core.css reserves for the caret */
.form-select { padding-top: 0.4rem; padding-bottom: 0.4rem; padding-left: 0.75rem; font-size: 0.9286rem; }
.form-select-sm { padding-top: 0.25rem; padding-bottom: 0.25rem; padding-left: 0.6rem; font-size: 0.8125rem; }
.form-label { margin-bottom: 0.25rem; font-size: 0.8571rem; }
.input-group-text { padding: 0.4rem 0.75rem; }
.card .card-header { padding: 0.9rem 1.25rem; }
.card .card-body { padding: 1.25rem; }
.card-title { margin-bottom: 0.5rem; }
.table > :not(caption) > * > * { padding: 0.5rem 0.9rem; }
.table-sm > :not(caption) > * > * { padding: 0.3rem 0.6rem; }

/* Data tables inside cards (.table-wrap / .app-table) */
.app-table { margin-bottom: 0; }
.app-table > :not(caption) > * > * { padding: 0.7rem 0.9rem; vertical-align: middle; }
.app-table > :not(caption) > * > :first-child { padding-left: 1.25rem; }
.app-table > :not(caption) > * > :last-child { padding-right: 1.25rem; }
.app-table > thead > tr > th {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--bs-secondary-color); background: color-mix(in srgb, var(--bs-body-color) 5%, transparent);
  border-bottom: 1px solid var(--bs-border-color);
  white-space: nowrap;
}
.app-table > tbody > tr:last-child > td { border-bottom: 0; }
.app-table > tbody > tr:hover > td { background: color-mix(in srgb, var(--bs-body-color) 3%, transparent); }
.app-table .table-serial { width: 3.25rem; color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; text-align: right; }
.app-table .table-actions { width: 1%; text-align: right; }
.app-table .avatar.avatar-sm { width: 1.85rem; height: 1.85rem; }
.app-table .avatar.avatar-sm .avatar-initial { font-size: 0.7rem; }
.table-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--bs-border-color);
}
.table-filters .form-select-sm { width: auto; min-width: 9rem; padding-right: 1.9rem; }
.table-filters-search { flex: 0 1 18rem; width: auto; }
.table-filters-search .input-group-text { padding-right: 0.25rem; color: var(--bs-secondary-color); }
.table-filters-search .input-group-text .bx { font-size: 1rem; }
.table-filters-search .form-control { padding-left: 0.4rem; }
/* Row count + rows-per-page sit at the right end of the filter row */
.table-filters-end { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-left: auto; }
.table-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.25rem;
  padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--bs-border-color);
}
.table-count { font-size: 0.8571rem; color: var(--bs-secondary-color); }
.table-count strong { color: var(--bs-body-color); font-weight: 600; }
.table-page-size { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 0.8571rem; color: var(--bs-secondary-color); white-space: nowrap; }
.table-page-size .form-select-sm { min-width: 4.5rem; }
.table-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.75rem 1.25rem; border-top: 1px solid var(--bs-border-color); }
.card > .table-wrap:first-child .table-toolbar, .card > .table-toolbar:first-child, .card > .table-filters:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.dropdown-item { padding: 0.4rem 1rem; }
.alert { padding: 0.65rem 1rem; }
/* Impersonation / support-access notice at the top of every page */
.support-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.support-banner > .bx { font-size: 1.35rem; }
.support-banner form { margin: 0; }
.modal-header { padding: 1rem 1.25rem; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 0.75rem 1.25rem; }
.badge { font-size: 0.75em; }
.breadcrumb { margin-bottom: 0.75rem; font-size: 0.8571rem; }

/* Menu chrome */
/* core.css positions the collapse pin for its own 16.25rem menu; follow ours */
.menu .app-brand .layout-menu-toggle { inset-inline-start: calc(var(--bs-menu-width) - 1.05rem); }
/* Icons inside buttons size from the button, not from .icon-base */
.btn .bx { font-size: 1.15em; vertical-align: -0.2em; }
.btn-icon .bx { font-size: 1.2rem; flex: none; inline-size: 1em; block-size: 1em; }
.btn-icon.btn-sm .bx { font-size: 1rem; }
.menu-vertical .menu-header { margin: 0.75rem 0 0.25rem; }
.menu-vertical .menu-header .menu-header-text { font-size: 0.75rem; }
.menu-vertical .menu-icon { font-size: 1.15rem; }
.menu .app-brand { height: 56px; margin-top: 8px; }
.app-brand-logo svg { width: 22px; height: 30px; }
.app-brand-text { font-size: 1.3rem; letter-spacing: -0.3px; }

/* Page gutter */
.container-p-y:not([class^="pb-"]):not([class*=" pb-"]) { padding-bottom: 1.25rem !important; }
.container-p-y:not([class^="pt-"]):not([class*=" pt-"]) { padding-top: 1.25rem !important; }

/* Keep the scrollbar track reserved so fixed elements never shift when a modal
   hides the page scrollbar; and restate the navbar inset for modal-open, because
   core.css hardcodes its own 16.25rem menu width there rather than the variable. */
html { scrollbar-gutter: stable; }
@media (min-width: 1200px) {
  .layout-menu-fixed.layout-navbar-fixed:not(.layout-menu-collapsed) .modal-open .layout-content-navbar:not(.layout-without-menu) .layout-navbar {
    inset-inline-start: var(--bs-menu-width);
  }
}

/* From Sneat demo.css: fixed navbar needs the page pushed down */
.layout-navbar-fixed .layout-wrapper:not(.layout-horizontal):not(.layout-without-menu) .layout-page { padding-top: 68px !important; }
.layout-navbar-fixed .layout-wrapper:not(.layout-without-menu) .layout-page { padding-top: 60px !important; }
.content-wrapper .navbar { z-index: auto; }
.layout-navbar { height: 3.6rem; }

/* Page header row: title left, actions right */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 1rem; }
.page-header h4 { margin: 0; }

/* Toasts */
#toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 1090; display: flex; flex-direction: column; gap: 0.5rem; }
#toast-container .toast { min-width: 18rem; font-weight: 500; }
/* Solid colours (Sneat's are 85% opaque) and a close button in the text colour. */
#toast-container .bs-toast.bg-success { --bs-toast-bg: var(--bs-success); }
#toast-container .bs-toast.bg-danger { --bs-toast-bg: var(--bs-danger); }
#toast-container .bs-toast.bg-warning { --bs-toast-bg: var(--bs-warning); }
#toast-container .bs-toast.bg-info { --bs-toast-bg: var(--bs-info); }
#toast-container .toast .btn-close { filter: brightness(0); opacity: 0.55; }
#toast-container .toast.text-white .btn-close { filter: brightness(0) invert(1); opacity: 0.85; }

/* htmx request state */
.htmx-indicator { opacity: 0; transition: opacity 150ms ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-request .btn[type="submit"] { pointer-events: none; opacity: 0.7; }

/* Tables without DataTables: sortable headers and row actions */
th a.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
th a.sort-link .bx { font-size: 0.9em; vertical-align: -0.1em; }
.row-actions { white-space: nowrap; }
.row-actions .btn { margin-left: 0.15rem; }
.empty-state { padding: 3rem 1rem; text-align: center; color: var(--bs-secondary-color); }
.empty-state .bx { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* Public site */
.site-nav .nav-link { padding: 0.5rem 0.8rem; }
/* Sign in / Sign up / Get started: one centred row on desktop, full-width
   stacked buttons when the menu is collapsed. */
.site-nav-actions { align-items: center; gap: 0.5rem; }
.site-nav-actions .btn { display: inline-flex; align-items: center; }
@media (max-width: 767.98px) {
  .site-nav-actions { align-items: stretch; padding: 0.5rem 0; border-top: 1px solid var(--bs-border-color); }
  .site-nav-actions .btn { width: 100%; justify-content: center; }
}
.hero { padding: 4rem 0; }
.site-footer { padding: 2rem 0; font-size: 0.8571rem; }

/* Chatbot portal */
.chat-preview { display: block; width: 100%; height: 560px; border: 1px solid var(--bs-border-color); border-radius: 0.5rem; background: #f4f5fa; }
.code-block { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem 1rem; background: var(--bs-tertiary-bg); border-radius: 0.375rem; }
.code-block pre { flex: 1; white-space: pre-wrap; word-break: break-all; font-size: 0.8125rem; }
.cell-truncate { max-width: 32rem; }
.transcript-row { display: flex; margin-bottom: 0.75rem; }
.transcript-row.is-visitor { justify-content: flex-end; }
.transcript-bubble { max-width: 80%; padding: 0.6rem 0.85rem; border-radius: 0.75rem; background: var(--bs-tertiary-bg); }
.transcript-row.is-visitor .transcript-bubble { background: var(--bs-primary-bg-subtle); }
.plan-option { cursor: pointer; }
.plan-option:has(input:checked) { border-color: var(--bs-primary); box-shadow: 0 0 0 2px var(--bs-primary); }
.onboarding-steps { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding: 0; list-style: none; counter-reset: step; font-size: 0.8571rem; color: var(--bs-secondary-color); }
.onboarding-steps li { counter-increment: step; }
.onboarding-steps li::before { content: counter(step); display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; margin-right: 0.4rem; border-radius: 50%; background: var(--bs-tertiary-bg); font-weight: 600; }
.onboarding-steps li.active { color: var(--bs-body-color); font-weight: 600; }
.onboarding-steps li.active::before { background: var(--bs-primary); color: #fff; }
.checklist .list-group-item { display: flex; align-items: center; gap: 0.6rem; }
.stat-tile h5 { margin-bottom: 0; }
.navbar-client { max-width: 16rem; }

/* Public site */
.hero-title { font-size: clamp(2rem, 4.5vw, 3.1rem); line-height: 1.12; letter-spacing: -0.02em; }
.hero-lead { max-width: 40rem; }
.hero-demo { max-width: 26rem; margin-left: auto; margin-right: auto; }
.hero-demo .bubble-bot, .hero-demo .bubble-user { padding: 0.6rem 0.85rem; border-radius: 0.9rem; margin-bottom: 0.6rem; max-width: 88%; font-size: 0.9rem; }
.hero-demo .bubble-bot { background: var(--bs-tertiary-bg); border-bottom-left-radius: 0.25rem; }
.hero-demo .bubble-user { background: var(--bs-primary); color: #fff; margin-left: auto; border-bottom-right-radius: 0.25rem; }
.feature-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border-radius: 0.6rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary); font-size: 1.4rem; }
.step-number { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--bs-primary); color: #fff; font-weight: 700; }
.prose { max-width: 46rem; }
.prose h2 { font-size: 1.25rem; margin-top: 2rem; }
.price-card.featured { border: 2px solid var(--bs-primary); }
.section { padding: 3rem 0; }
