/* ==========================================================================
   Anilax CRM — design system
   Palette: ink navy (structure), brand blue (information), marigold (action),
   paper background. One family (Manrope) with tabular figures for numbers.
   ========================================================================== */
@font-face {
  font-family: "Manrope";
  src: url("../vendor/fonts/manrope-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 800; font-style: normal; font-display: swap;
}

:root {
  --ink: #0E2240; --ink-2: #16325B; --ink-text: #A9BBD6; --ink-muted: #6F86A8;
  --blue: #1565C0; --blue-600: #0F57A8; --blue-50: #EAF2FC; --blue-100: #D5E5F8;
  --marigold: #FF7A00; --marigold-600: #E66A00; --marigold-50: #FFF2E5;
  --paper: #F5F7FB; --surface: #FFFFFF; --surface-2: #FAFBFD; --line: #E2E8F2; --line-2: #EEF2F8;
  --text: #15233A; --text-2: #4A5B76; --muted: #7A8AA3;
  --green: #1F9D6B; --green-50: #E6F6EF; --red: #D93B3B; --red-50: #FCEBEB; --amber: #C98A06; --amber-50: #FDF4DF;
  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --shadow-pop: 0 12px 32px rgba(14, 34, 64, .16);
  --sb-w: 256px; --sb-rail: 76px; --top-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --bs-primary: #1565C0; --bs-primary-rgb: 21, 101, 192;
  --bs-link-color: #1565C0; --bs-link-color-rgb: 21, 101, 192; --bs-link-hover-color: #0F57A8;
  --bs-body-font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--text); --bs-body-bg: var(--paper); --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted); --bs-border-radius: var(--r-sm);
}
:root[data-bs-theme="dark"] {
  --ink: #0A1424; --ink-2: #13233B; --paper: #0D1626; --surface: #132036; --surface-2: #17263F; --line: #24344F; --line-2: #1C2B44;
  --text: #E4EAF4; --text-2: #B3C0D6; --muted: #8496B2; --blue-50: #17304F; --blue-100: #1D3B61; --marigold-50: #3A2610;
  --green-50: #0F3326; --red-50: #3A1818; --amber-50: #3A2E10;
  --bs-body-color: var(--text); --bs-body-bg: var(--paper); --bs-border-color: var(--line);
  --bs-secondary-bg: var(--surface-2); --bs-tertiary-bg: var(--surface-2);
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--paper); color: var(--text); font-size: .9rem; font-feature-settings: "tnum" 1, "cv11" 1; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
h1, h2, h3, h4, h5, h6, .h4, .h5 { color: var(--text); letter-spacing: -.015em; }
.min-w-0 { min-width: 0; }
.num, .table td, .kpi-value { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
::selection { background: var(--blue-100); }

/* ---------- Buttons ---------- */
.btn { font-weight: 600; border-radius: var(--r-sm); transition: background-color .15s, border-color .15s, color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn-primary { --bs-btn-bg: var(--blue); --bs-btn-border-color: var(--blue); --bs-btn-hover-bg: var(--blue-600); --bs-btn-hover-border-color: var(--blue-600); --bs-btn-active-bg: var(--blue-600); --bs-btn-disabled-bg: var(--blue); }
.btn-accent { --bs-btn-color: #fff; --bs-btn-bg: var(--marigold); --bs-btn-border-color: var(--marigold); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--marigold-600); --bs-btn-hover-border-color: var(--marigold-600); --bs-btn-active-bg: var(--marigold-600); --bs-btn-active-color: #fff; --bs-btn-disabled-bg: var(--marigold); --bs-btn-disabled-color: #fff; box-shadow: 0 4px 12px rgba(255, 122, 0, .25); }
.btn-light { --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--blue-50); --bs-btn-hover-border-color: var(--blue-100); --bs-btn-color: var(--text-2); --bs-btn-hover-color: var(--blue); }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; }
.text-accent { color: var(--marigold) !important; }
.bg-blue-50 { background: var(--blue-50) !important; }

/* ---------- Shell ---------- */
.ax-shell { min-height: 100vh; }
.ax-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sb-w); z-index: 1045; background: var(--ink); color: var(--ink-text);
  display: flex; flex-direction: column; transition: width .25s var(--ease), transform .25s var(--ease);
}
.ax-brand { display: flex; align-items: center; gap: .7rem; height: var(--top-h); padding: 0 1.15rem; color: #fff; flex-shrink: 0; }
.ax-brand:hover { color: #fff; }
.ax-logo { width: 36px; height: 36px; flex-shrink: 0; }
.ax-brand-text { font-weight: 800; font-size: 1.02rem; line-height: 1.1; white-space: nowrap; }
.ax-brand-text small { display: block; font-weight: 500; font-size: .72rem; color: var(--ink-muted); }
.ax-sb-close { margin-left: auto; color: var(--ink-text); background: transparent; border: 0; font-size: 1.3rem; display: none; }
.ax-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: .4rem .7rem 1.5rem; scrollbar-width: thin; scrollbar-color: var(--ink-2) transparent; }
.ax-nav .sec { font-size: .72rem; font-weight: 700; color: var(--ink-muted); padding: 1.1rem .75rem .4rem; white-space: nowrap; }
.ax-nav a { position: relative; display: flex; align-items: center; gap: .8rem; color: var(--ink-text); padding: .55rem .75rem; border-radius: 8px; font-size: .875rem; font-weight: 600; white-space: nowrap; transition: background-color .15s, color .15s; }
.ax-nav a i { font-size: 1.08rem; width: 1.25rem; text-align: center; flex-shrink: 0; }
.ax-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.ax-nav a.active { background: var(--ink-2); color: #fff; }
.ax-nav a.active::before { content: ""; position: absolute; left: -.7rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--marigold); }
.ax-nav a.active i { color: var(--marigold); }
.ax-sb-foot { padding: .9rem 1.1rem; border-top: 1px solid rgba(255, 255, 255, .07); font-size: .75rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; }
.ax-backdrop { position: fixed; inset: 0; background: rgba(8, 18, 34, .5); backdrop-filter: blur(2px); z-index: 1044; opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }

.ax-main { margin-left: var(--sb-w); min-width: 0; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left .25s var(--ease); }

/* Desktop collapsed rail */
@media (min-width: 992px) {
  html.sb-collapsed .ax-sidebar { width: var(--sb-rail); }
  html.sb-collapsed .ax-main { margin-left: var(--sb-rail); }
  html.sb-collapsed .ax-brand { padding: 0 20px; }
  html.sb-collapsed .ax-brand-text, html.sb-collapsed .ax-nav .sec, html.sb-collapsed .ax-nav a span, html.sb-collapsed .ax-sb-foot { opacity: 0; pointer-events: none; }
  html.sb-collapsed .ax-nav .sec { height: .6rem; padding: 0; }
  html.sb-collapsed .ax-nav a { justify-content: center; padding: .6rem 0; }
  /* labels must not take space in the rail, or the icons get pushed out of view */
  html.sb-collapsed .ax-nav a span, html.sb-collapsed .ax-brand-text { display: none; }
  html.sb-collapsed .ax-nav a { gap: 0; }
  html.sb-collapsed .ax-nav { padding-left: .55rem; padding-right: .55rem; }
  html.sb-collapsed .ax-nav a.active::before { left: -.55rem; }
  html.sb-collapsed .ax-sb-close { display: none; }
  .ax-brand-text, .ax-nav .sec, .ax-nav a span, .ax-sb-foot { transition: opacity .15s; }
}
/* Mobile off-canvas */
@media (max-width: 991.98px) {
  .ax-sidebar { transform: translateX(-100%); width: min(86vw, 300px); box-shadow: none; }
  html.sb-open .ax-sidebar { transform: none; box-shadow: var(--shadow-pop); }
  html.sb-open .ax-backdrop { opacity: 1; visibility: visible; }
  html.sb-open { overflow: hidden; }
  .ax-main { margin-left: 0; }
  .ax-sb-close { display: block; }
}

/* ---------- Top bar ---------- */
.ax-topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--top-h); display: flex; align-items: center; gap: .6rem; padding: 0 1.25rem;
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line);
}
.ax-topbar .btn-light { border-color: transparent; background: transparent; }
.ax-topbar .btn-light:hover { background: var(--blue-50); }
.ax-search { max-width: 420px; flex: 1; position: relative; }
.ax-search input { padding-left: 2.3rem; background: var(--paper); border-color: var(--line-2); border-radius: 999px; height: 40px; }
.ax-search input:focus { background: var(--surface); border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-50); }
.ax-search > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.ax-search kbd { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); background: var(--surface); color: var(--muted); border: 1px solid var(--line); font-size: .7rem; padding: .05rem .35rem; }
.ax-search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); max-height: 440px; overflow-y: auto; display: none; padding: .3rem; }
.ax-search-results a { display: flex; gap: .6rem; align-items: center; padding: .5rem .6rem; color: var(--text); border-radius: 8px; }
.ax-search-results a:hover, .ax-search-results a.focus { background: var(--blue-50); }
.ax-search-results .t { font-size: .7rem; font-weight: 700; color: var(--blue); background: var(--blue-50); border-radius: 4px; padding: .1rem .4rem; flex-shrink: 0; }
.ax-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), #3D8BE0); color: #fff; display: grid; place-items: center; font-size: .78rem; font-weight: 700; flex-shrink: 0; }
.ax-avatar.sm { width: 26px; height: 26px; font-size: .64rem; }
.ax-avatar.lg { width: 52px; height: 52px; font-size: 1.05rem; }
.notif-dot { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--marigold); color: #fff; font-size: .62rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.dropdown-menu { border-color: var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: .35rem; background: var(--surface); }
.dropdown-item { border-radius: 6px; padding: .45rem .7rem; font-weight: 500; }
.dropdown-item:active { background: var(--blue); }

/* ---------- Content ---------- */
.ax-content { padding: 1.4rem 1.6rem 3rem; flex: 1; }
.ax-page-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.1rem; }
.ax-page-head h1 { font-size: 1.45rem; font-weight: 800; margin: 0; }
.ax-page-head .sub, .ax-page-head .text-muted.small { color: var(--muted) !important; font-size: .82rem; margin-top: .15rem; }
.breadcrumb { font-size: .78rem; margin-bottom: .3rem; --bs-breadcrumb-divider-color: var(--muted); }
.breadcrumb a { color: var(--muted); } .breadcrumb a:hover { color: var(--blue); }

.card { --bs-card-bg: var(--surface); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--line-2); font-weight: 700; padding: .85rem 1.1rem; font-size: .9rem; }
.card-body { padding: 1.1rem; }

.table { --bs-table-bg: transparent; --bs-table-color: var(--text); margin: 0; }
.table > :not(caption) > * > * { padding: .7rem .8rem; border-bottom-color: var(--line-2); }
.table thead th { font-size: .76rem; color: var(--muted); font-weight: 700; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { vertical-align: middle; }
.table-hover > tbody > tr { transition: background-color .12s; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--blue-50); }
.table-sm > :not(caption) > * > * { padding: .45rem .6rem; }

.form-label { font-weight: 600; font-size: .8rem; margin-bottom: .3rem; color: var(--text-2); }
.form-control, .form-select { font-size: .88rem; border-color: var(--line); border-radius: var(--r-sm); background-color: var(--surface); color: var(--text); }
.form-control:focus, .form-select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-50); }
.form-control-sm, .form-select-sm { min-height: 34px; }
.form-check-input:checked { background-color: var(--blue); border-color: var(--blue); }
.ax-filter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .8rem .9rem; margin-bottom: 1rem; }
.ax-filter .search-live { position: relative; }
.filter-toggle-row { display: none !important; }
.ax-filter .search-live i { position: absolute; left: .7rem; bottom: .55rem; color: var(--muted); }
.ax-filter .search-live input { padding-left: 2rem; }

/* Badges as soft pills */
.badge { font-weight: 700; border-radius: 999px; padding: .32em .7em; font-size: .72rem; }
.text-bg-primary { background: var(--blue-50) !important; color: var(--blue) !important; }
.text-bg-info { background: #E3F4FA !important; color: #0B7FA6 !important; }
.text-bg-success { background: var(--green-50) !important; color: var(--green) !important; }
.text-bg-danger { background: var(--red-50) !important; color: var(--red) !important; }
.text-bg-warning { background: var(--amber-50) !important; color: var(--amber) !important; }
.text-bg-secondary { background: var(--line-2) !important; color: var(--text-2) !important; }
.text-bg-dark { background: var(--ink) !important; color: #fff !important; }
.text-bg-light { background: var(--surface-2) !important; color: var(--muted) !important; border: 1px solid var(--line); }
:root[data-bs-theme="dark"] .text-bg-info { background: #10303D !important; color: #5CC4E6 !important; }

.pagination { --bs-pagination-border-color: var(--line); --bs-pagination-bg: var(--surface); --bs-pagination-active-bg: var(--blue); --bs-pagination-active-border-color: var(--blue); --bs-pagination-color: var(--text-2); margin: 0; flex-wrap: wrap; }
nav[role="navigation"] p.small { color: var(--muted); }

/* ---------- KPIs ---------- */
.kpi, .card.kpi { padding: 1rem 1.1rem; display: flex; flex-direction: row; gap: .9rem; align-items: center; height: 100%; color: inherit; transition: border-color .15s; }
a.kpi:hover { border-color: var(--blue-100); color: inherit; }
.kpi .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; background: var(--blue-50); color: var(--blue); flex-shrink: 0; }
.kpi .ic.orange { background: var(--marigold-50); color: var(--marigold); }
.kpi .ic.green { background: var(--green-50); color: var(--green); }
.kpi .ic.red { background: var(--red-50); color: var(--red); }
.kpi .v, .kpi-value { font-size: 1.4rem; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.kpi .l { font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi .s { font-size: .76rem; color: var(--muted); }
.stat-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stat-strip > a { padding: .85rem 1rem; color: inherit; border-right: 1px solid var(--line-2); transition: background-color .15s; }
.stat-strip > a:last-child { border-right: 0; }
.stat-strip > a:hover { background: var(--surface-2); }
.stat-strip .l { font-size: .76rem; color: var(--muted); font-weight: 600; }
.stat-strip .v { font-size: 1.25rem; font-weight: 800; }

/* ---------- Dashboard hero: today's agenda ---------- */
.today { position: relative; overflow: hidden; border-radius: var(--r-lg); background: var(--ink); color: #fff; padding: 1.4rem 1.5rem; display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 1rem; margin-bottom: 1.2rem; }
.today h1 { color: #fff; font-size: 1.5rem; font-weight: 800; margin: 0 0 .2rem; }
.today .lede { color: var(--ink-text); font-size: .88rem; margin-bottom: 1rem; }
.today-art { align-self: end; justify-self: end; width: 220px; margin: -1rem -.5rem -1.4rem 0; }
.agenda { display: flex; gap: .7rem; overflow-x: auto; padding-bottom: .3rem; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: var(--ink-2) transparent; }
.agenda-item { scroll-snap-align: start; flex: 0 0 200px; background: var(--ink-2); border: 1px solid rgba(255, 255, 255, .07); border-radius: var(--r); padding: .7rem .8rem; color: #fff; position: relative; transition: border-color .15s, background-color .15s; }
.agenda-item:hover { color: #fff; border-color: rgba(255, 122, 0, .6); }
.agenda-item .tm { font-size: .78rem; font-weight: 800; color: var(--marigold); display: flex; align-items: center; gap: .35rem; }
.agenda-item .sj { font-weight: 700; font-size: .86rem; margin-top: .25rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.agenda-item .wh { font-size: .75rem; color: var(--ink-text); margin-top: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-item.late .tm { color: #FF8D8D; }
.agenda-empty { color: var(--ink-text); font-size: .88rem; padding: .7rem 0; }
.agenda-track { position: relative; height: 3px; background: rgba(255, 255, 255, .08); border-radius: 3px; margin: .2rem 0 .8rem; }
.agenda-track span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--marigold); border-radius: 3px; transition: width 1s var(--ease); }
.dash-controls { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.dash-controls .form-select { width: auto; max-width: 220px; }
.range-tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.range-tabs button { border: 0; background: transparent; color: var(--text-2); font-weight: 700; font-size: .8rem; padding: .35rem .8rem; border-radius: 999px; transition: background-color .15s, color .15s; }
.range-tabs button.active { background: var(--blue); color: #fff; }

/* ---------- Skeletons ---------- */
.sk { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--line-2) 0%, var(--surface-2) 50%, var(--line-2) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
.sk-v { height: 1.5rem; width: 70%; margin-top: .3rem; }
.sk-l { height: .7rem; width: 45%; }
.sk-chart { height: 220px; width: 100%; }
@keyframes sk { to { background-position: -200% 0; } }
.is-loading .ld-hide { visibility: hidden; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: .9rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; scroll-snap-type: x proximity; }
.kanban-col { flex: 0 0 286px; scroll-snap-align: start; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.kanban-col .head { padding: .75rem .85rem; border-bottom: 1px solid var(--line); font-weight: 700; font-size: .86rem; }
.kanban-col .head small { color: var(--muted); font-weight: 600; }
.kanban-col .body { padding: .6rem; overflow-y: auto; min-height: 90px; flex: 1; }
.deal { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .65rem .75rem; margin-bottom: .55rem; cursor: grab; transition: border-color .15s, box-shadow .15s; }
.deal:hover { border-color: var(--blue); }
.deal .amt { font-weight: 800; color: var(--blue); }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: var(--shadow-pop); }
.col-won .head { box-shadow: inset 0 3px 0 var(--green); border-radius: var(--r) var(--r) 0 0; }
.col-lost .head { box-shadow: inset 0 3px 0 var(--red); border-radius: var(--r) var(--r) 0 0; }

/* ---------- Timeline, misc ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1.1rem 2.4rem; }
.timeline li::before { content: ""; position: absolute; left: .8rem; top: 1.7rem; bottom: 0; width: 2px; background: var(--line-2); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: 0; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--blue-50); color: var(--blue); display: grid; place-items: center; font-size: .78rem; }
.empty-state { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty-state svg { width: 150px; height: auto; display: block; margin: 0 auto .9rem; }
.empty-state .et { font-weight: 700; color: var(--text); font-size: .95rem; margin-bottom: .2rem; }
.dl-grid { display: grid; grid-template-columns: 130px 1fr; gap: .5rem .8rem; font-size: .86rem; margin: 0; }
.dl-grid dt { color: var(--muted); font-weight: 600; }
.dl-grid dd { margin: 0; word-break: break-word; }
.nav-tabs { border-color: var(--line); } .nav-tabs .nav-link { font-weight: 600; color: var(--text-2); } .nav-tabs .nav-link.active { color: var(--blue); border-color: var(--line) var(--line) var(--surface); background: var(--surface); }
.nav-pills .nav-link { font-weight: 600; color: var(--text-2); border-radius: 999px; } .nav-pills .nav-link.active { background: var(--blue); }
.progress { background: var(--line-2); border-radius: 999px; } .progress-bar { border-radius: 999px; }
.modal-content { border: 0; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-pop); }
.modal-header, .modal-footer { border-color: var(--line-2); }
.toast-container { z-index: 1090; }
.toast { border: 0; border-radius: var(--r); box-shadow: var(--shadow-pop); }
.select2-container { width: 100% !important; }
.select2-container--bootstrap-5 .select2-selection { border-color: var(--line); min-height: 38px; background-color: var(--surface); }
.select2-container--bootstrap-5 .select2-dropdown { border-color: var(--line); background: var(--surface); }
.fc { font-size: .82rem; } .fc .fc-button-primary { background: var(--blue); border-color: var(--blue); } .fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--blue-600); }

/* Turbo: progress bar + frame loading */
.turbo-progress-bar { height: 3px; background: var(--marigold); box-shadow: 0 0 10px rgba(255, 122, 0, .6); }
turbo-frame { display: block; }
turbo-frame[aria-busy="true"] { opacity: .55; pointer-events: none; transition: opacity .15s .1s; }
turbo-frame[aria-busy="true"] .card { position: relative; }

/* ---------- Mobile bottom navigation ---------- */
.ax-tabbar { display: none; }
@media (max-width: 991.98px) {
  .ax-tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
    background: var(--surface); border-top: 1px solid var(--line); padding: .3rem .3rem calc(.3rem + env(safe-area-inset-bottom));
  }
  .ax-tabbar a, .ax-tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .66rem; font-weight: 700; color: var(--muted); padding: .3rem 0; background: none; border: 0; border-radius: 8px; }
  .ax-tabbar i { font-size: 1.2rem; }
  .ax-tabbar .active { color: var(--blue); }
  .ax-tabbar .fab { color: #fff; }
  .ax-tabbar .fab span.b { width: 44px; height: 44px; margin-top: -1.3rem; border-radius: 50%; background: var(--marigold); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(255, 122, 0, .4); border: 3px solid var(--surface); }
  .ax-tabbar .fab span.b i { font-size: 1.25rem; }
  .ax-content { padding: 1rem 1rem calc(5.5rem + env(safe-area-inset-bottom)); }
  .ax-topbar { padding: 0 .75rem; gap: .35rem; }
  .ax-page-head h1 { font-size: 1.25rem; }
  .dl-grid { grid-template-columns: 110px 1fr; }
  .today { grid-template-columns: minmax(0, 1fr); padding: 1.1rem; }
  .today-art { display: none; }
  .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-strip > a:nth-child(3n) { border-right: 0; }
  .stat-strip > a:nth-child(-n+3) { border-bottom: 1px solid var(--line-2); }
}
@media (max-width: 575.98px) {
  .dash-controls { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .dash-controls .form-select { max-width: none; width: 100%; grid-column: 1 / -1; }
  .range-tabs { overflow-x: auto; scrollbar-width: none; }
  .range-tabs button { padding: .35rem .6rem; flex-shrink: 0; }
  .kpi, .card.kpi { padding: .8rem; gap: .6rem; flex-direction: column; align-items: flex-start; }
  .kpi .ic { width: 34px; height: 34px; font-size: 1rem; border-radius: 9px; }
  .kpi .v { font-size: 1.15rem; }
  .ax-search { display: none; }
  .ax-search.open { display: block; position: absolute; left: .5rem; right: .5rem; top: 12px; max-width: none; z-index: 2; }
  .ax-page-head { align-items: stretch; }
  .ax-page-head > div:last-child:not(:first-child) { width: 100%; }
  .agenda-item { flex-basis: 78vw; }
}

/* ---------- Tables become cards on phones ---------- */
@media (max-width: 767.98px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { border-bottom: 1px solid var(--line); padding: .7rem .9rem; position: relative; }
  .table-cards > :not(caption) > * > * { border: 0; padding: .14rem 0; }
  .table-cards td { display: flex; justify-content: space-between; gap: 1rem; font-size: .84rem; text-align: right !important; }
  .table-cards td > * { min-width: 0; overflow-wrap: anywhere; }
  .table-cards td { overflow-wrap: anywhere; }
  .table-cards td::before { content: attr(data-label); color: var(--muted); font-weight: 600; font-size: .76rem; text-align: left; flex-shrink: 0; }
  .table-cards td:first-child { display: block; text-align: left !important; font-size: .95rem; padding-bottom: .3rem; }
  .table-cards td:first-child::before { display: none; }
  .table-cards td:empty, .table-cards td.cell-empty { display: none; }
  .table-cards td.td-check { position: absolute; right: .9rem; top: .8rem; width: auto; display: block; }
  .table-cards td.td-check::before { display: none; }
  .table-cards td.td-check + td { padding-right: 2rem; display: block; text-align: left !important; font-size: .95rem; padding-bottom: .3rem; }
  .table-cards td.td-check + td::before { display: none; }
  /* Filters collapse behind a button; the search box stays visible */
  .ax-filter[data-live] > :not(.search-live):not(.filter-toggle-row) { display: none; }
  .ax-filter[data-live].open > :not(.search-live):not(.filter-toggle-row) { display: block; }
  .ax-filter[data-live] .search-live { flex: 1 1 0; }
  .filter-toggle-row { display: flex !important; align-items: flex-end; width: auto !important; }
  .table-responsive:has(.table-cards) { overflow: visible; }
}

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--surface); }
.auth-hero { position: relative; background: var(--ink); color: #fff; padding: 2.8rem 3rem; display: flex; flex-direction: column; overflow: hidden; }
.auth-hero h1 { color: #fff; font-weight: 800; font-size: 2.25rem; line-height: 1.12; letter-spacing: -.03em; max-width: 15ch; margin: 2.5rem 0 .9rem; }
.auth-hero p { color: var(--ink-text); max-width: 42ch; }
.auth-art { margin-top: auto; width: 100%; max-width: 520px; }
.auth-form { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-form .inner { width: 100%; max-width: 380px; }
.auth-form .form-control { height: 46px; }
.pw-toggle { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); padding: .3rem .5rem; }
@media (max-width: 991.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* ---------- Motion: one orchestrated dashboard load ---------- */
@media (prefers-reduced-motion: no-preference) {
  .dash-ready .reveal { animation: rise .5s var(--ease) both; }
  .dash-ready .reveal:nth-child(2) { animation-delay: .05s; } .dash-ready .reveal:nth-child(3) { animation-delay: .1s; } .dash-ready .reveal:nth-child(4) { animation-delay: .15s; }
  .agenda-item { animation: slidein .45s var(--ease) both; }
  .agenda-item:nth-child(2) { animation-delay: .06s; } .agenda-item:nth-child(3) { animation-delay: .12s; } .agenda-item:nth-child(4) { animation-delay: .18s; } .agenda-item:nth-child(n+5) { animation-delay: .24s; }
  .art-float { animation: float 6s ease-in-out infinite; transform-origin: center; }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes float { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

@media print { .ax-sidebar, .ax-topbar, .ax-tabbar, .no-print { display: none !important; } .ax-main { margin: 0; } }

/* ---- v1.2: builder, messaging, AI ---- */
.ax-section-title { font-size: .78rem; font-weight: 700; color: var(--text-2); padding-bottom: .35rem; border-bottom: 1px solid var(--line-2); margin-bottom: .6rem; }
.ai-out { white-space: pre-line; font-size: .88rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: .75rem .9rem; }
.ai-out:empty { display: none; }
.ai-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; background: var(--marigold-50); color: var(--marigold-600); }
.score-ring { --v: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-variant-numeric: tabular-nums;
  background: radial-gradient(closest-side, var(--surface) 76%, transparent 78% 100%), conic-gradient(var(--marigold) calc(var(--v) * 1%), var(--line-2) 0); }
.field-row { display: flex; align-items: center; gap: .75rem; padding: .65rem .9rem; border-bottom: 1px solid var(--line-2); background: var(--surface); }
.field-row:last-child { border-bottom: 0; }
.field-row .grip { cursor: grab; color: var(--muted); }
.field-row.inactive { opacity: .55; }
.otp-input { letter-spacing: .5em; font-size: 1.4rem; text-align: center; font-variant-numeric: tabular-nums; }
.inv-paper { background: #fff; color: #15233A; }
@media print { .ax-sidebar, .ax-topbar, .ax-tabbar, .breadcrumb, .no-print, .ax-page-head .btn, .ax-page-head form { display: none !important; } .ax-main { margin: 0 !important; } .ax-content { padding: 0 !important; } .card { border: 0 !important; box-shadow: none !important; } }

/* ---- Floating AI assistant ---- */
#copilot { position: fixed; inset: 0; pointer-events: none; z-index: 1060; }
#copilot > * { pointer-events: auto; }
.cp-fab { position: fixed; right: 24px; bottom: 24px; display: inline-flex; align-items: center; gap: .45rem; height: 52px; padding: 0 1.1rem 0 .95rem; border: 0; border-radius: 26px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: .9rem; box-shadow: 0 10px 28px rgba(14, 34, 64, .32), 0 0 0 3px rgba(255, 122, 0, .0);
  cursor: grab; touch-action: none; user-select: none; transition: box-shadow .2s, transform .15s; }
.cp-fab i { font-size: 1.2rem; color: var(--marigold); }
.cp-fab:hover { box-shadow: 0 12px 30px rgba(14, 34, 64, .38), 0 0 0 3px rgba(255, 122, 0, .35); }
.cp-fab:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }
.cp-fab.dragging { cursor: grabbing; transform: scale(1.06); transition: none; }
.cp-fab[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--marigold); }
.cp-panel { position: fixed; width: min(400px, calc(100vw - 24px)); height: min(600px, calc(100vh - 110px)); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-pop); overflow: hidden; }
.cp-panel[hidden] { display: none; }
.cp-panel.opening { animation: cpIn .18s var(--ease); }
@keyframes cpIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.cp-head { display: flex; align-items: center; gap: .65rem; padding: .8rem .8rem .8rem 1rem; background: var(--ink); color: #fff; }
.cp-avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 122, 0, .15); color: var(--marigold); flex: none; }
.cp-title { font-weight: 800; font-size: .95rem; line-height: 1.1; }
.cp-sub { font-size: .72rem; color: var(--ink-text); }
.cp-icon { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-text); flex: none; }
.cp-icon:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.cp-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .75rem; background: var(--surface-2); font-size: .875rem; }
.cp-welcome p { color: var(--text-2); }
.cp-note { font-size: .78rem; background: var(--amber-50); color: var(--text-2); border-radius: 8px; padding: .5rem .65rem; }
.cp-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.cp-chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: .3rem .7rem; font-size: .78rem; text-align: left; }
.cp-chip:hover { border-color: var(--blue); color: var(--blue); }
.cp-msg { max-width: 92%; }
.cp-msg.user { align-self: flex-end; background: var(--blue); color: #fff; padding: .5rem .75rem; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.cp-msg.bot { align-self: flex-start; width: 92%; }
.cp-msg.bot .cp-text { background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: .6rem .8rem; line-height: 1.5; }
.cp-msg.bot .cp-text ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.cp-msg.err .cp-text { border-color: var(--red); color: var(--red); }
.cp-table { margin-top: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 260px; }
.cp-table table { width: 100%; font-size: .76rem; border-collapse: collapse; }
.cp-table th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 700; text-align: left; padding: .4rem .55rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cp-table td { padding: .4rem .55rem; border-bottom: 1px solid var(--line-2); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.cp-table tr[data-href] { cursor: pointer; }
.cp-table tr[data-href]:hover td { background: var(--blue-50); }
.cp-table caption { caption-side: top; padding: .4rem .55rem 0; font-weight: 700; font-size: .76rem; color: var(--text-2); }
.cp-links { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.cp-links a { font-size: .76rem; font-weight: 700; border-radius: 999px; padding: .25rem .65rem; background: var(--blue-50); color: var(--blue); }
.cp-typing { display: inline-flex; gap: 4px; padding: .7rem .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; align-self: flex-start; }
.cp-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: cpDot 1s infinite; }
.cp-typing span:nth-child(2) { animation-delay: .15s; } .cp-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes cpDot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.cp-input { display: flex; align-items: flex-end; gap: .5rem; padding: .65rem; border-top: 1px solid var(--line); background: var(--surface); }
.cp-input textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: .55rem .75rem; font-size: .875rem; max-height: 120px; background: var(--surface); color: var(--text); }
.cp-input textarea:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-100); }
.cp-send { width: 38px; height: 38px; border: 0; border-radius: 11px; background: var(--marigold); color: #fff; font-size: 1.05rem; flex: none; }
.cp-send:disabled { opacity: .5; }
.cp-foot { font-size: .68rem; color: var(--muted); text-align: center; padding: 0 .5rem .5rem; background: var(--surface); }
@media (max-width: 991.98px) { .cp-fab { bottom: calc(84px + env(safe-area-inset-bottom)); } }
@media (max-width: 575.98px) {
  .cp-fab { height: 48px; padding: 0 .85rem; } .cp-fab-label { display: none; }
  .cp-panel { left: 8px !important; right: 8px !important; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)) !important; width: auto; height: min(78vh, 640px); }
}
@media (prefers-reduced-motion: reduce) { .cp-panel.opening, .cp-typing span { animation: none; } }
@media print { #copilot { display: none !important; } }
