/*
 * AppTriage — Brand Overrides
 *
 * Loaded after Tabler CSS in base.html.
 * Provides consistent typography, form styling, and button treatment
 * across all surfaces (dashboard, auth, onboarding, public).
 *
 * Keep minimal. Only override what Tabler can't do natively.
 */


/* ── Alpine.js x-cloak ── */
[x-cloak] { display: none !important; }

/* ── Brand Variables ── */

:root {
  --tblr-font-sans-serif: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --tblr-primary: #2c77e7;
  --tblr-primary-rgb: 44, 119, 231;
  --at-blue: #2c77e7;
  --at-blue-hover: #2269d8;
  --at-slate: #121317;
  --at-slate-mid: #18191D;
  --at-muted: #45474D;
  --at-border: #E1E6EC;
  --at-surface: #F8F9FC;
  --at-shell-bg: #f4f7fb;
  --at-mono: ui-monospace,'SF Mono','SFMono-Regular',Menlo,Consolas,monospace;
}


/* ── Global Typography ── */

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
  color: var(--at-slate);
  background:
    radial-gradient(circle at top left, rgba(0,84,166,0.05), transparent 24%),
    linear-gradient(180deg, #f7f9fc 0%, #f3f6fa 100%);
}

.page-body,
.page-center {
  color: var(--at-slate);
}

.page-body h1,
.page-body h2,
.page-body h3,
.page-body h4,
.page-center h1,
.page-center h2,
.page-center h3,
.page-center h4 {
  color: var(--at-slate);
  letter-spacing: -0.04em;
}

.page-body h1,
.page-body h2,
.page-center h1,
.page-center h2 {
  font-weight: 650;
  line-height: 1.04;
}

.page-body h3,
.page-body h4,
.page-center h3,
.page-center h4 {
  font-weight: 600;
  line-height: 1.12;
}

.page-body .text-secondary,
.page-center .text-secondary,
.page > .navbar .text-secondary {
  color: #667180 !important;
}


/* ── Operational Typography (DS-04) ──
 * Give DATA its own voice on dashboard surfaces: tabular numerals wherever
 * digits align or change, and a restrained monospace accent for referential
 * entities (feedback IDs, one-time codes) and for clock times / app versions.
 * Discipline: mono is ONLY for IDs / codes / clock times / versions / keys —
 * never for names, emails, word-dates, buttons, headings, or sentences.
 */
.at-num {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
/* Mono chip for referential entities (FB-/RW-/GP- IDs, one-time codes). */
.at-ref {
  font: 600 0.86em/1 var(--at-mono);
  background: rgba(15, 23, 42, 0.05);
  border-radius: 5px;
  padding: 2px 6px;
}
/* Mono WITHOUT a chip — clock times (HH:MM) and app versions (v1.2.0). */
.at-mono-plain {
  font: 600 0.92em/1.2 var(--at-mono);
}


/* ── Table-stand place chip (DS-03) ──
 * Every physical feedback item — a QR card on Table 12, the Patio, Room 305 —
 * comes from a real PLACE. This renders that place as a small tactile object:
 * a brass table-number stand, flat metal with a single inset sheen and a foot
 * bar, so the inbox reads like a floor map of the business. Brass (#A8875A) is
 * THE accent of this feature and must appear nowhere else; digital sources keep
 * their plain text labels. Cross-surface by design — used in the inbox list rows
 * AND the feedback detail Source row — so it lives here, not in either page's
 * stylesheet. Not a button: no hover state; it inherits the row's cursor when
 * the row is a link. Ellipsis lives on the inner label because text-overflow is
 * not applied to a flex container's own anonymous text.
 */
.at-stand {
  display: inline-flex;
  align-items: center;
  max-width: 140px;
  padding: 6px 9px 5px;
  position: relative;
  overflow: hidden;
  color: #fff;
  /* #8a7048 keeps white text at ~4.7:1 (AA for this 10.5px label) */
  background: #8a7048;
  border-radius: 7px 7px 4px 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28);
  font: 650 10.5px/1 var(--at-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.at-stand-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.at-stand::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: -3px;
  height: 3px;
  background: #5e4a2c;
  border-radius: 0 0 3px 3px;
}
/* Quieter metal at night — see design-system.md §20 (dark additions scoped). */
[data-bs-theme="dark"] .at-stand {
  color: #f5efe6;
  background: #8a7048;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}
[data-bs-theme="dark"] .at-stand::after {
  background: #5e4a2c;
}


/* ── Form Controls ── */

.form-control,
.form-select {
  border-radius: 8px;
  border-color: var(--at-border);
  font-size: .875rem;
  letter-spacing: -0.005em;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--at-slate);
  box-shadow: 0 0 0 2px rgba(18, 19, 23, 0.08);
}

.input-group-flat .form-control {
  border-radius: 8px 0 0 8px;
}

.input-group-flat .input-group-text {
  border-radius: 0 8px 8px 0;
  border-color: var(--at-border);
}


/* ── Form Labels ── */

.form-label {
  font-weight: 500;
  font-size: .8125rem;
  letter-spacing: -0.005em;
  color: var(--at-muted);
}

.form-hint {
  color: var(--at-muted);
  letter-spacing: -0.005em;
}


/* ── Primary Buttons ──
 * Scoped to .page (dashboard + auth) and .modal contexts.
 */

.page .btn-primary,
.modal .btn-primary {
  min-height: 2.5rem;
  background: var(--at-blue);
  border-color: var(--at-blue);
  border-radius: 8px;
  font-weight: 600;
  font-size: .875rem;
  letter-spacing: 0;
  box-shadow: 0 1px 2px rgba(20, 91, 198, 0.18);
}

.page .btn-primary:hover,
.page .btn-primary:focus,
.modal .btn-primary:hover,
.modal .btn-primary:focus {
  background: var(--at-blue-hover);
  border-color: var(--at-blue-hover);
  box-shadow: 0 8px 20px rgba(44, 119, 231, 0.20);
}

.page .btn-ghost-secondary,
.page .btn-ghost-primary,
.page .btn-outline-secondary,
.page .btn-outline-primary {
  border-radius: 10px;
}


/* ── Ink page-action buttons ──
 * Webhooks + Compliance primary actions use the same near-black "ink"
 * treatment as the collect / inbox / form-settings surfaces (not brand blue),
 * so page-action buttons read consistently across the app.
 * Light: near-black ink. Dark: inverted near-white button with dark text.
 */
.webhooks-shell .btn-primary,
.compliance-shell .btn-primary {
  color: #fff !important;
  background: #111827 !important;
  border-color: #111827 !important;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.13) !important;
}

.webhooks-shell .btn-primary:hover,
.webhooks-shell .btn-primary:focus,
.compliance-shell .btn-primary:hover,
.compliance-shell .btn-primary:focus {
  color: #fff !important;
  background: #000 !important;
  border-color: #000 !important;
}

/* Dark inversion: both the webhooks shell and the compliance shell darken
 * their surfaces in dark mode. As of WS-6 the compliance cards, the desktop
 * needs-attention rows (.bg-red-lt) and the mobile .is-alert card all use dark
 * backgrounds, so the "Quick Generate" ink button follows the standard dark
 * inversion — a near-white button with dark text — to preserve contrast on the
 * darkened surface, matching the collect / inbox / form-settings ink buttons. */
[data-bs-theme="dark"] .webhooks-shell .btn-primary,
[data-bs-theme="dark"] .compliance-shell .btn-primary {
  --tblr-btn-bg: #e8edf4;
  --tblr-btn-border-color: #e8edf4;
  --tblr-btn-color: #0f172a;
  --tblr-btn-hover-bg: #ffffff;
  --tblr-btn-hover-border-color: #ffffff;
  --tblr-btn-hover-color: #0f172a;
  --tblr-btn-active-bg: #ffffff;
  --tblr-btn-active-border-color: #ffffff;
  --tblr-btn-active-color: #0f172a;
  color: #0f172a !important;
  background: #e8edf4 !important;
  border-color: #e8edf4 !important;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .3) !important;
}

[data-bs-theme="dark"] .webhooks-shell .btn-primary:hover,
[data-bs-theme="dark"] .webhooks-shell .btn-primary:focus,
[data-bs-theme="dark"] .compliance-shell .btn-primary:hover,
[data-bs-theme="dark"] .compliance-shell .btn-primary:focus {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: #ffffff !important;
}


/* ── Inbox Filter Tabs ── */

.at-tab,
.at-tab-active {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
/* Fix status-dot vertical alignment inside tabs */
.at-tab .status-dot,
.at-tab-active .status-dot {
  vertical-align: middle;
  position: relative;
  top: 0;
}

.at-tab {
  color: #64748b;
}

.at-tab:hover {
  background: #f1f5f9;
  color: #334155;
  text-decoration: none;
}

.at-tab-active {
  background: #e2e8f0;
  color: #1e293b;
  font-weight: 600;
}

.at-tab-active:hover {
  background: #cbd5e1;
  color: #1e293b;
  text-decoration: none;
}

/* Dark mode tabs */
[data-bs-theme="dark"] .at-tab {
  color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .at-tab:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff !important;
}

[data-bs-theme="dark"] .at-tab-active {
  background: rgba(255, 255, 255, .18);
  color: #fff !important;
  font-weight: 600;
}

[data-bs-theme="dark"] .at-tab-active:hover {
  background: rgba(255, 255, 255, .24);
  color: #fff !important;
}

/* ── Demo Data Indicator ── */

.at-demo {
  border: 1px dashed #ef4444;
  border-radius: 8px;
  padding: 12px 16px;
}

.at-demo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.at-demo-ic {
  color: #94a3b8;
  flex-shrink: 0;
}

.at-demo-msg {
  font-size: .875rem;
  color: #64748b;
  flex: 1;
  min-width: 0;
}

.at-demo-msg strong {
  color: #334155;
  font-weight: 600;
}

.at-demo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Dark mode */
[data-bs-theme="dark"] .at-demo {
  border-color: #ef4444;
}

[data-bs-theme="dark"] .at-demo-ic {
  color: #64748b;
}

[data-bs-theme="dark"] .at-demo-msg {
  color: #94a3b8;
}

[data-bs-theme="dark"] .at-demo-msg strong {
  color: #e2e8f0;
}

/* ── Dashboard Light Navbar ── */

.page > .navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255,255,255,0.82);
  border-bottom: 1px solid rgba(225, 230, 236, 0.9);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 12px 30px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.page > .navbar .container-xl {
  min-height: 72px;
}

.page > .navbar .nav-link {
  font-size: .875rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: #4f5a67;
  border-radius: 12px;
  padding: .6rem .85rem;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}

.page > .navbar .nav-link:hover {
  color: var(--at-slate);
  background: rgba(18, 19, 23, 0.04);
}

.page > .navbar .nav-item.active .nav-link {
  font-weight: 650;
  color: var(--at-slate);
  background: rgba(32, 107, 196, 0.14);
  box-shadow: inset 0 0 0 1px rgba(32, 107, 196, 0.10);
}

.page > .navbar .nav-link-icon {
  color: #6b7280;
}

.page > .navbar .nav-item.active .nav-link-icon,
.page > .navbar .nav-link:hover .nav-link-icon {
  color: var(--tblr-primary);
}

.page > .navbar .dropdown-menu {
  border-radius: 16px;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.10);
  padding: .5rem;
}

.page > .navbar .dropdown-item {
  border-radius: 10px;
}

.page > .navbar .dropdown-item:hover {
  background: rgba(15, 23, 42, 0.04);
}

.app-navbar-brand {
  gap: .7rem;
}

.app-navbar-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(243,246,250,0.96));
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.app-navbar-brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.app-navbar-brand-kicker {
  font-size: .625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #7b8390;
  margin-bottom: .15rem;
}

.app-navbar-meta {
  gap: .4rem;
}

.app-shell-frame {
  padding-top: 1.25rem;
  padding-bottom: 2.5rem;
}

.app-shell-shortcuts {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .8rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.76);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}


/* ── Dashboard Product Shell ── */

.app-dashboard {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(44, 119, 231, 0.045), transparent 28rem),
    linear-gradient(180deg, #f8fafc 0%, #f4f7fb 100%);
}

.app-dashboard-main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.app-dashboard .page-wrapper {
  flex: 1 1 auto;
}

.app-sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 284px;
  width: 284px;
  height: 100vh;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.92);
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow-y: auto;
}

.app-sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  min-height: 100%;
}

.app-sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  min-height: 48px;
  padding: .35rem .35rem .7rem;
  color: var(--at-slate);
  text-decoration: none;
}

.app-sidebar-brand:hover {
  color: var(--at-slate);
  text-decoration: none;
}

.app-sidebar-brand-mark,
.app-navbar-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  flex-shrink: 0;
}

.app-sidebar-brand-mark img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.app-sidebar-brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.05;
}

.app-sidebar-brand-kicker,
.app-topbar-eyebrow {
  color: #7b8390;
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
}

.app-sidebar-brand-name {
  margin-top: .2rem;
  color: var(--at-slate);
  font-size: 1.125rem;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.app-sidebar-section {
  display: grid;
  gap: .28rem;
}

.app-sidebar-section-label {
  padding: 0 .55rem .25rem;
  color: #8a94a3;
  font-size: .66rem;
  font-weight: 750;
  letter-spacing: .1em;
  line-height: 1;
  text-transform: uppercase;
}

.app-sidebar-link {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: .56rem;
  min-height: 48px;
  padding: .5rem .55rem;
  color: #4f5a67;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.app-sidebar-link:hover {
  color: var(--at-slate);
  text-decoration: none;
  background: rgba(15, 23, 42, 0.04);
}

.app-sidebar-link.is-active {
  color: #0f172a;
  background: rgba(17, 24, 39, 0.055);
  border-color: rgba(17, 24, 39, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.68);
}

.app-sidebar-link.is-active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 11px;
  bottom: 11px;
  width: 3px;
  border-radius: 999px;
  background: #111827;
}

.app-sidebar-link--subtle .app-sidebar-link-copy {
  color: #8a94a3;
}

.app-sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #64748b;
  background: rgba(248, 250, 252, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.app-sidebar-link.is-active .app-sidebar-icon {
  color: #111827;
  background: #fff;
  border-color: rgba(17, 24, 39, 0.14);
}

.app-sidebar-link-main {
  display: flex;
  flex-direction: column;
  gap: .12rem;
  min-width: 0;
}

.app-sidebar-link-title {
  color: inherit;
  font-size: .875rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.app-sidebar-link-copy {
  color: #717d8c;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 .45rem;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1;
}

.app-dashboard-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(225, 230, 236, 0.92);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.025);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.app-dashboard-topbar-container {
  min-height: 64px;
  padding-inline: 1.5rem;
  gap: 1rem;
}

.app-topbar-context {
  align-items: center;
  gap: .75rem;
  min-width: 0;
}

.app-topbar-context-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.05;
}

.app-topbar-context-copy strong {
  margin-top: .2rem;
  max-width: 34rem;
  color: var(--at-slate);
  font-size: .95rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar-plan {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: .25rem .58rem;
  border-radius: 8px;
  color: #4b647f;
  background: rgba(44, 119, 231, 0.08);
  border: 1px solid rgba(44, 119, 231, 0.12);
  font-size: .74rem;
  font-weight: 700;
  text-decoration: none;
}

.app-topbar-plan:hover {
  color: var(--at-blue);
  text-decoration: none;
  border-color: rgba(44, 119, 231, 0.22);
}

.app-navbar-tools {
  gap: .35rem;
}

.app-dashboard-topbar .nav-link {
  border-radius: 10px;
}

.app-menu-icon {
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  color: #111827;
}

.app-menu-icon--open {
  display: inline-flex;
}

.app-menu-icon--close {
  display: none;
}

.app-topbar-menu-button[aria-expanded="true"] .app-menu-icon--open {
  display: none;
}

.app-topbar-menu-button[aria-expanded="true"] .app-menu-icon--close {
  display: inline-flex;
}

.app-user-trigger {
  min-height: 40px;
  border-radius: 10px;
}

.app-mobile-nav-collapse {
  flex-basis: 100%;
}

.app-mobile-nav-panel {
  display: grid;
  gap: .8rem;
  width: 100%;
  padding: .85rem 0 1rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.app-mobile-nav-section {
  display: grid;
  gap: .3rem;
}

.app-mobile-nav-label {
  color: #8a94a3;
  font-size: .66rem;
  font-weight: 750;
  letter-spacing: .1em;
  line-height: 1;
  text-transform: uppercase;
}

.app-mobile-nav-link {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: .65rem;
  min-height: 52px;
  padding: .54rem .64rem;
  color: #4f5a67;
  border-radius: 10px;
  text-decoration: none;
}

.app-mobile-nav-link:hover,
.app-mobile-nav-link.is-active {
  color: var(--at-slate);
  background: rgba(17, 24, 39, 0.055);
  text-decoration: none;
}

.app-mobile-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: #65748a;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.94);
}

.app-mobile-nav-link.is-active .app-mobile-nav-icon {
  color: #111827;
  background: #fff;
  border-color: rgba(17, 24, 39, 0.14);
}

.app-mobile-nav-copy {
  display: flex;
  flex-direction: column;
  gap: .08rem;
  min-width: 0;
}

.app-mobile-nav-copy strong {
  color: inherit;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.12;
}

.app-mobile-nav-copy small {
  color: #778294;
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.24;
}

@media (min-width: 992px) {
  .app-dashboard .app-shell-frame {
    padding-top: 1.5rem;
  }

  .app-dashboard .navbar-brand,
  .app-dashboard .navbar-toggler,
  .app-dashboard .app-mobile-nav-collapse {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  .app-dashboard {
    display: block;
  }

  .app-dashboard-topbar {
    background: rgba(255, 255, 255, 0.92);
  }

  .app-dashboard-topbar-container {
    min-height: 68px;
    padding-inline: 1rem;
    flex-wrap: nowrap;
  }

  .app-topbar-menu-button {
    order: 10;
    margin-left: auto;
    border: 0;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.04);
  }

  .app-navbar-meta {
    display: none !important;
  }

  .app-mobile-nav-collapse {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    z-index: 1029;
    max-height: calc(100svh - 68px);
    padding: .75rem 1rem 1rem;
    overflow-y: auto;
    background:
      linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(244, 247, 251, 0.96));
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 22px 45px rgba(15, 23, 42, 0.14);
  }

  .app-mobile-nav-panel {
    max-width: 560px;
    margin: 0 auto;
    padding: .75rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .app-mobile-nav-section + .app-mobile-nav-section {
    padding-top: .72rem;
    border-top: 1px solid rgba(15, 23, 42, 0.07);
  }

  .app-mobile-nav-label {
    padding-inline: .2rem;
  }

  .app-dashboard .app-shell-frame {
    padding-top: 1rem;
  }
}

[data-bs-theme="dark"] .app-dashboard {
  background:
    radial-gradient(circle at top left, rgba(44, 119, 231, 0.12), transparent 28rem),
    linear-gradient(180deg, #0f141b 0%, #111820 100%);
}

[data-bs-theme="dark"] .app-sidebar,
[data-bs-theme="dark"] .app-dashboard-topbar,
[data-bs-theme="dark"] .app-mobile-nav-panel {
  background: rgba(18, 24, 33, 0.92);
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: none;
}

[data-bs-theme="dark"] .app-mobile-nav-collapse {
  background: rgba(11, 16, 23, 0.96);
  border-color: rgba(148, 163, 184, 0.14);
}

[data-bs-theme="dark"] .app-sidebar-brand-mark,
[data-bs-theme="dark"] .app-navbar-brand-mark,
[data-bs-theme="dark"] .app-sidebar-icon,
[data-bs-theme="dark"] .app-mobile-nav-icon {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(148, 163, 184, 0.18);
}

[data-bs-theme="dark"] .app-sidebar-brand-name,
[data-bs-theme="dark"] .app-topbar-context-copy strong,
[data-bs-theme="dark"] .navbar-brand-text-inner,
[data-bs-theme="dark"] .app-menu-icon,
[data-bs-theme="dark"] .app-sidebar-link:hover,
[data-bs-theme="dark"] .app-mobile-nav-link:hover,
[data-bs-theme="dark"] .app-mobile-nav-link.is-active {
  color: #f8fafc;
}

[data-bs-theme="dark"] .app-sidebar-link,
[data-bs-theme="dark"] .app-mobile-nav-link {
  color: #cbd5e1;
}

[data-bs-theme="dark"] .app-sidebar-link.is-active,
[data-bs-theme="dark"] .app-mobile-nav-link.is-active {
  background: rgba(44, 119, 231, 0.18);
  border-color: rgba(44, 119, 231, 0.28);
}


/* ── Navbar Brand Wordmark ── */

.navbar-brand-text-inner {
  font-weight: 600;
  color: var(--at-slate);
  letter-spacing: -0.02em;
}


/* ── Card Borders ── */

.page-body .card,
.page-center .card {
  border-color: rgba(15, 23, 42, 0.09);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 28px rgba(15, 23, 42, 0.055);
  background: linear-gradient(180deg, rgba(255,255,255,0.995), rgba(248,250,252,0.97));
}

.page-center .card-md {
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 18px 42px rgba(15, 23, 42, 0.07);
}

.page-body .card-header,
.page-center .card-header {
  background: transparent;
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

.page-body .card-body,
.page-center .card-body {
  color: var(--at-slate);
}


/* ── Card Titles ── */

.card-title {
  font-weight: 600;
  letter-spacing: -0.03em;
}

.card-subtitle {
  letter-spacing: -0.005em;
}


/* ── Tabs (inside cards) ── */

.nav-tabs .nav-link.active {
  font-weight: 600;
  color: var(--at-slate);
  border-bottom-color: var(--at-slate);
}

.nav-tabs .nav-link {
  font-size: .875rem;
  letter-spacing: -0.005em;
}


/* ── Textareas ── */

textarea.form-control {
  line-height: 1.6;
}


/* ── Alerts ── */

.alert {
  border-radius: 10px;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.app-flash,
.app-upgrade-banner {
  border-radius: 10px;
}

.app-flash {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 1rem;
  padding: .68rem 2.65rem .68rem .9rem;
  border: 1px solid rgba(15, 23, 42, .10);
  background: rgba(255, 255, 255, .94);
  color: #172033;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .92),
    0 1px 2px rgba(15, 23, 42, .035);
}

.app-flash .d-flex {
  align-items: center;
  min-width: 0;
}

.app-flash .d-flex > div {
  font-size: .88rem;
  font-weight: 530;
  line-height: 1.35;
}

.app-flash.alert-success {
  border-color: rgba(22, 163, 74, .18);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(240,253,244,.74));
}

.app-flash.alert-info {
  border-color: rgba(37, 99, 235, .16);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(239,246,255,.78));
}

.app-flash.alert-warning {
  border-color: rgba(245, 158, 11, .22);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,251,235,.78));
}

.app-flash.alert-danger {
  border-color: rgba(220, 38, 38, .18);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(254,242,242,.78));
}

.app-flash .btn-close {
  top: 50%;
  right: .72rem;
  width: 1.7rem;
  height: 1.7rem;
  padding: .42rem;
  border-radius: 999px;
  transform: translateY(-50%);
  background-size: .62rem;
  opacity: .5;
}

.app-flash .btn-close:hover,
.app-flash .btn-close:focus {
  background-color: rgba(15, 23, 42, .06);
  opacity: .72;
}

.app-upgrade-banner {
  background: linear-gradient(180deg, rgba(255,251,235,0.96), rgba(255,247,220,0.96));
  border: 1px solid rgba(245, 158, 11, 0.18);
}

.app-flash.alert-info,
.app-flash.alert-success,
.app-flash.alert-warning,
.app-flash.alert-danger {
  background-image: none;
}


/* ── Brand Logo (shared by auth + onboarding) ── */

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
}

.auth-brand-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-brand-text {
  font-weight: 560;
  font-size: 1.125rem;
  color: var(--at-slate);
  letter-spacing: -0.02em;
}

.auth-brand:hover .auth-brand-text {
  color: var(--at-slate);
}


/* ── Links ── */

.page-body a:not(.btn):not(.nav-link):not(.list-group-item):not(.dropdown-item):not(.page-link),
.page-center a:not(.btn):not(.nav-link):not(.list-group-item):not(.dropdown-item) {
  color: #0054a6;
}


/* ── Form label description (e.g., "Forgot password?") ── */

.form-label-description a {
  font-weight: 500;
  font-size: .8125rem;
}


/* ── HTMX Loading States ── */

.htmx-request .htmx-indicator {
  display: inline-block !important;
}

.htmx-indicator {
  display: none;
}

/* Subtle opacity transition for HTMX-swapped content */
.htmx-added {
  animation: htmxFadeIn 0.2s ease-out;
}

@keyframes htmxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Content area dims slightly while loading */
.htmx-request.htmx-settling {
  opacity: 0.7;
  transition: opacity 0.15s ease;
}


/* ── Empty State Illustrations ── */

.empty-state-illustration {
  max-width: 180px;
  height: auto;
}


/* ── Dark Mode Fallbacks ── */

[data-bs-theme="dark"] .page > .navbar {
  background: rgba(18, 24, 33, 0.85);
  border-bottom-color: var(--tblr-border-color);
  box-shadow: none;
}

[data-bs-theme="dark"] body {
  background: linear-gradient(180deg, #0f1720 0%, #111b26 100%);
}

[data-bs-theme="dark"] .navbar-brand-text-inner {
  color: #fff;
}

[data-bs-theme="dark"] .app-navbar-brand-mark,
[data-bs-theme="dark"] .page-body .card,
[data-bs-theme="dark"] .page-center .card,
[data-bs-theme="dark"] .app-shell-shortcuts {
  background: rgba(20, 26, 35, 0.92);
  border-color: var(--tblr-border-color);
  box-shadow: none;
}

[data-bs-theme="dark"] .app-navbar-brand-mark img {
  filter: invert(1);
}

[data-bs-theme="dark"] .page > .navbar .nav-link {
  color: #c2c8d0;
}

[data-bs-theme="dark"] .page > .navbar .nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

[data-bs-theme="dark"] .page > .navbar .nav-item.active .nav-link {
  background: rgba(32, 107, 196, 0.18);
  color: #fff;
}

[data-bs-theme="dark"] .app-navbar-brand-kicker {
  color: #8b96a8;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  border-color: var(--tblr-border-color);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  border-color: var(--tblr-primary);
  box-shadow: 0 0 0 2px rgba(32, 107, 196, 0.15);
}

[data-bs-theme="dark"] .form-label {
  color: var(--tblr-secondary-color);
}

[data-bs-theme="dark"] .auth-brand-text {
  color: #fff;
}

[data-bs-theme="dark"] .page-body .card,
[data-bs-theme="dark"] .page-center .card {
  border-color: var(--tblr-border-color);
}

[data-bs-theme="dark"] .app-upgrade-banner {
  background: rgba(84, 52, 12, 0.52);
  border-color: rgba(245, 158, 11, 0.22);
}

/* Dark mode: Tabler handles btn-primary natively — no override needed */

/* ── Over-limit blur (plan limit enforcement) ─── */
.feedback-blurred {
  filter: blur(5px);
  user-select: none;
  pointer-events: none;
}

.over-limit-overlay {
  position: relative;
}

.over-limit-lock {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  white-space: nowrap;
}

/* ── Credential / config boxes ────────────────── */
.credentials-box {
  background: var(--at-surface);
  border-radius: 10px;
  padding: 1.25rem;
}

[data-bs-theme="dark"] .credentials-box {
  background: var(--tblr-bg-surface);
}

/* ── AI classification badges ─────────────────── */
.badge-dashed {
  border: 1px dashed currentColor;
}

[data-bs-theme="dark"] .subheader {
  color: var(--tblr-secondary-color);
}

/* Operational-typography reference chip (DS-04) — subtle neutral fill on dark,
   matching the other dashboard count chips; no border. */
[data-bs-theme="dark"] .at-ref {
  background: rgba(148, 163, 184, 0.12);
}


/* ── Dark Mode: dashboard brand tokens (WS-1) ──────────────────────────
   The --at-* tokens (see :root at the top of this file) are defined once and
   are also consumed by the marketing, onboarding and auth surfaces on their
   forced-light backgrounds. Those surfaces receive data-bs-theme="dark" too
   (base.html theme script runs on every page), so this redefinition is SCOPED
   to the dashboard shell (.app-dashboard) — never global — otherwise light-only
   marketing text (color: var(--at-slate)) would flip to light-on-light and
   vanish. Every dashboard page (inbox, detail, forms, form-settings,
   project-create) renders inside .page.app-dashboard, so the flip reaches them
   all. Surfaces with their own dark handling (collect-overview, auth,
   .credentials-box) set explicit values that win over the token, so nothing
   double-darkens. */
[data-bs-theme="dark"] .app-dashboard {
  --at-slate: #f1f5f9;      /* primary text / headings on dark */
  --at-slate-mid: #e2e8f0;  /* slightly dimmer strong text */
  --at-muted: #94a3b8;      /* muted / secondary text */
  --at-border: rgba(148, 163, 184, 0.16);  /* subtle dark border */
  --at-surface: rgba(15, 23, 42, 0.40);     /* recessed dark surface */
  --at-shell-bg: #0f141b;   /* dark shell background */
}

/* Flash / toast messages (templates/includes/_messages.html). The light rules
   above give .app-flash a near-white background + #172033 text; invert both and
   keep the per-variant hue in the border. */
[data-bs-theme="dark"] .app-flash {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(20, 26, 35, 0.95);
  color: #e2e8f0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .04),
    0 1px 2px rgba(0, 0, 0, .30);
}
[data-bs-theme="dark"] .app-flash.alert-success {
  border-color: rgba(34, 197, 94, .30);
  background: rgba(19, 34, 26, 0.95);
}
[data-bs-theme="dark"] .app-flash.alert-info {
  border-color: rgba(59, 130, 246, .30);
  background: rgba(19, 28, 44, 0.95);
}
[data-bs-theme="dark"] .app-flash.alert-warning {
  border-color: rgba(245, 158, 11, .32);
  background: rgba(38, 30, 16, 0.95);
}
[data-bs-theme="dark"] .app-flash.alert-danger {
  border-color: rgba(239, 68, 68, .30);
  background: rgba(40, 22, 22, 0.95);
}
[data-bs-theme="dark"] .app-flash .btn-close:hover,
[data-bs-theme="dark"] .app-flash .btn-close:focus {
  background-color: rgba(255, 255, 255, .10);
}


/* ── Inbox Filter Tab Scroll ── */

@media (max-width: 767.98px) {
  .at-tabs-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, #000 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
  }
  .at-tabs-scroll::-webkit-scrollbar { display: none; }
}


/* ── Delete Button: muted by default, red on hover ── */
.btn-delete-muted {
  color: #94a3b8 !important;
}
.btn-delete-muted:hover {
  color: var(--tblr-danger) !important;
  background: rgba(var(--tblr-danger-rgb), .06) !important;
}

/* ── Project Card Links ── */
.at-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 1rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  border-radius: 8px;
  transition: background .15s, color .15s;
  min-height: 44px;
}
.at-card-link:hover {
  background: #f1f5f9;
  color: #1e293b;
  text-decoration: none;
}
.at-card-link-primary {
  color: var(--tblr-primary);
}
.at-card-link-primary:hover {
  background: rgba(var(--tblr-primary-rgb), .08);
  color: var(--tblr-primary);
}

/* ── Inbox Row Hover ── */

.list-group-item-action:hover {
  background-color: rgba(var(--tblr-primary-rgb), .04) !important;
}


/* ── DS-05 · Paper-artifact empty-state illustrations ──
 * One inline-SVG stroke language (receipt / card / sticker / envelope) shared
 * across dashboard empty states, echoing the landing hero's paper world.
 * Main strokes inherit currentColor from .il-figure, set to the muted
 * secondary-text token so the figure reads as quiet/secondary and flips
 * automatically in dark under [data-bs-theme="dark"] .app-dashboard.
 * Exactly one .il-accent element per figure is stroked in brand primary. */
.il-figure {
  display: inline-flex;
  color: var(--at-muted);
  line-height: 0;
}
.il-figure .il-svg {
  width: 84px;
  height: 80px;
}
.il-figure--sm .il-svg {
  width: 54px;
  height: 54px;
}
.il-figure .il-accent {
  stroke: var(--tblr-primary, #2c77e7);
  opacity: .9;
}
