/*
 * Aspin's console on top of Filament's own stylesheet: the inbox, the lead
 * card, the board and the timeline (ax-*), and a few touches to the panel.
 * Filament's build carries only its own Tailwind classes, so everything here
 * is plain CSS on Filament's colour variables (rgb(var(--primary-500))).
 * Dark mode follows Filament's `.dark` on <html>.
 */

:root {
    --ax-sand: 250 246 238;
    --ax-sand-deep: 232 220 196;
    --ax-gold: 196 150 74;
    --ax-ink: 15 23 42;
    --ax-line: 226 232 240;
    --ax-muted: 100 116 139;
    --ax-card: 255 255 255;
    --ax-chat-bg: 244 241 234;
    --ax-out: 220 242 246;
    --ax-agent: 232 246 249;
    --ax-staff: 255 244 214;
    --ax-radius: 14px;
    --ax-shadow: 0 1px 2px rgb(15 23 42 / .06), 0 4px 16px rgb(15 23 42 / .04);
}

.dark {
    --ax-ink: 241 245 249;
    --ax-line: 39 49 66;
    --ax-muted: 148 163 184;
    --ax-card: 17 24 39;
    --ax-chat-bg: 11 17 28;
    --ax-out: 12 59 74;
    --ax-agent: 10 47 60;
    --ax-staff: 66 49 12;
}

/* ---- Panel touches ------------------------------------------------------- */

.fi-body { background: rgb(var(--ax-sand)); }
.dark .fi-body { background: rgb(3 7 18); }
.fi-sidebar { background: rgb(var(--ax-card)); border-right: 1px solid rgb(var(--ax-line)); }
.fi-sidebar-item-active > a, .fi-sidebar-item-active > button { background: rgb(var(--primary-50)) !important; }
.dark .fi-sidebar-item-active > a { background: rgb(var(--primary-500) / .15) !important; }
.fi-section, .fi-ta-ctn, .fi-wi-stats-overview-stat { border-radius: var(--ax-radius) !important; box-shadow: var(--ax-shadow) !important; }
.fi-simple-layout { background: radial-gradient(1200px 600px at 10% -10%, rgb(var(--primary-100)), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgb(var(--ax-sand-deep)), transparent 60%), rgb(var(--ax-sand)); }
.dark .fi-simple-layout { background: radial-gradient(1200px 600px at 10% -10%, rgb(var(--primary-900) / .5), transparent 60%), rgb(3 7 18); }
.fi-simple-main { border-radius: 20px !important; box-shadow: 0 20px 60px rgb(15 23 42 / .12) !important; }

.ax-muted { color: rgb(var(--ax-muted)); }
.ax-link { color: rgb(var(--primary-600)); font-weight: 600; font-size: .8125rem; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.ax-link:hover { text-decoration: underline; }
.ax-link.is-muted { color: rgb(var(--ax-muted)); font-weight: 500; }
.dark .ax-link { color: rgb(var(--primary-400)); }

/* ---- Inbox: the three panes -------------------------------------------- */

.ax-inbox-wrap { container-type: inline-size; }
.ax-inbox {
    display: grid;
    grid-template-columns: minmax(260px, 330px) minmax(380px, 1fr) minmax(260px, 300px);
    height: calc(100vh - 9.5rem);
    min-height: 560px;
    border-radius: 18px;
    overflow: hidden;
    background: rgb(var(--ax-card));
    border: 1px solid rgb(var(--ax-line));
    box-shadow: var(--ax-shadow);
}
.ax-inbox:not(:has(.ax-side)) { grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); }
/* By the inbox's own width, not the window's: the panel's sidebar takes its share. */
@container (max-width: 1000px) { .ax-inbox, .ax-inbox:not(:has(.ax-side)) { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); } .ax-side { display: none; } }
@container (max-width: 640px) {
    .ax-inbox, .ax-inbox:not(:has(.ax-side)) { grid-template-columns: 1fr; height: auto; }
    .ax-inbox:has(.ax-chathead) .ax-list { display: none; }
    .ax-chatpane { min-height: 75vh; }
}

/* The chat list */
.ax-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid rgb(var(--ax-line)); }
.ax-list-head { padding: .875rem .875rem .5rem; display: flex; flex-direction: column; gap: .5rem; border-bottom: 1px solid rgb(var(--ax-line)); }
.ax-search { position: relative; flex: 1; }
.ax-search input { width: 100%; border-radius: 999px; border: 1px solid rgb(var(--ax-line)); background: rgb(var(--ax-sand)); padding: .55rem .9rem .55rem 2.2rem; font-size: .875rem; color: rgb(var(--ax-ink)); outline: none; }
.dark .ax-search input { background: rgb(255 255 255 / .04); }
.ax-search input:focus { border-color: rgb(var(--primary-400)); box-shadow: 0 0 0 3px rgb(var(--primary-500) / .15); }
.ax-search-icon { position: absolute; left: .75rem; top: 50%; width: 1rem; height: 1rem; transform: translateY(-50%); color: rgb(var(--ax-muted)); }
.ax-select-sm, .ax-field select {
    appearance: none; -webkit-appearance: none;
    background-color: rgb(var(--ax-card));
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right .5rem center; background-size: 1.1rem;
}
.ax-select-sm { border-radius: 10px; border: 1px solid rgb(var(--ax-line)); color: rgb(var(--ax-ink)); font-size: .8125rem; padding: .45rem 2rem .45rem .7rem; }
.ax-tabs { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; padding-bottom: .25rem; }
.ax-tab { white-space: nowrap; border: 0; background: transparent; border-radius: 999px; padding: .3rem .7rem; font-size: .78rem; font-weight: 600; color: rgb(var(--ax-muted)); cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
.ax-tab:hover { background: rgb(var(--ax-sand)); color: rgb(var(--ax-ink)); }
.ax-tab.is-active { background: rgb(var(--primary-600)); color: #fff; }
.ax-tab-count { background: rgb(var(--ax-line)); color: rgb(var(--ax-ink)); border-radius: 999px; padding: 0 .4rem; font-size: .7rem; line-height: 1.2rem; }
.ax-tab-count.is-hot { background: rgb(var(--danger-500)); color: #fff; }
.ax-tab.is-active .ax-tab-count { background: rgb(255 255 255 / .25); color: #fff; }

.ax-list-body { overflow-y: auto; flex: 1; }
.ax-chat { width: 100%; display: flex; gap: .75rem; padding: .7rem .875rem; text-align: left; border: 0; border-bottom: 1px solid rgb(var(--ax-line) / .6); background: transparent; cursor: pointer; transition: background .12s; }
.ax-chat:hover { background: rgb(var(--ax-sand)); }
.dark .ax-chat:hover { background: rgb(255 255 255 / .03); }
.ax-chat.is-active { background: rgb(var(--primary-50)); box-shadow: inset 3px 0 0 rgb(var(--primary-500)); }
.dark .ax-chat.is-active { background: rgb(var(--primary-500) / .12); }
.ax-chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.ax-chat-top, .ax-chat-bottom { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.ax-chat-name { font-weight: 600; font-size: .9rem; color: rgb(var(--ax-ink)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-chat.is-unread .ax-chat-name { font-weight: 800; }
.ax-chat-time { font-size: .72rem; color: rgb(var(--ax-muted)); flex-shrink: 0; }
.ax-chat.is-unread .ax-chat-time { color: rgb(var(--primary-600)); font-weight: 700; }
.ax-chat-preview { font-size: .8125rem; color: rgb(var(--ax-muted)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-chat.is-unread .ax-chat-preview { color: rgb(var(--ax-ink)); }
.ax-chat-badges { display: flex; gap: .25rem; flex-shrink: 0; align-items: center; }
.ax-chat-lead { font-size: .72rem; color: rgb(var(--ax-muted)); display: flex; align-items: center; gap: .35rem; }
.ax-empty-list { padding: 3rem 1rem; text-align: center; color: rgb(var(--ax-muted)); font-size: .875rem; }
.ax-empty-icon { width: 2.5rem; height: 2.5rem; margin: 0 auto .5rem; opacity: .5; }

.ax-avatar { position: relative; flex-shrink: 0; width: 2.75rem; height: 2.75rem; border-radius: 999px; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .875rem; letter-spacing: .02em; }
.ax-avatar.is-lg { width: 2.6rem; height: 2.6rem; }
.ax-avatar.is-sm { width: 1.85rem; height: 1.85rem; font-size: .7rem; }
.ax-avatar-badge { position: absolute; right: -3px; bottom: -3px; width: 1.15rem; height: 1.15rem; border-radius: 999px; font-size: .6rem; display: flex; align-items: center; justify-content: center; border: 2px solid rgb(var(--ax-card)); }
.ax-avatar-badge.is-agent { background: rgb(var(--primary-500)); color: #fff; }
.ax-avatar-badge.is-human { background: rgb(var(--ax-gold)); }

.ax-pill { font-size: .68rem; font-weight: 700; border-radius: 999px; padding: .05rem .45rem; line-height: 1.1rem; }
.ax-pill.is-danger { background: rgb(var(--danger-100)); color: rgb(var(--danger-700)); }
.ax-pill.is-warning { background: rgb(var(--warning-100)); color: rgb(var(--warning-700)); }
.ax-unread { min-width: 1.25rem; height: 1.25rem; border-radius: 999px; background: rgb(var(--primary-500)); color: #fff; font-size: .7rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 .3rem; }

.ax-dot { width: .55rem; height: .55rem; border-radius: 999px; display: inline-block; flex-shrink: 0; }
.ax-dot.is-sky { background: #0ea5e9; } .ax-dot.is-indigo { background: #6366f1; } .ax-dot.is-amber { background: #f59e0b; }
.ax-dot.is-violet { background: #8b5cf6; } .ax-dot.is-emerald { background: #10b981; } .ax-dot.is-rose { background: #f43f5e; }

/* The open chat */
.ax-chatpane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: rgb(var(--ax-chat-bg)); }
.ax-chatpane::before { content: ''; }
.ax-chathead { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; background: rgb(var(--ax-card)); border-bottom: 1px solid rgb(var(--ax-line)); }
.ax-chathead-who { min-width: 7rem; flex: 1 1 auto; }
.ax-chathead-line { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.ax-chathead-name { font-weight: 700; color: rgb(var(--ax-ink)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ax-chathead-sub { font-size: .78rem; color: rgb(var(--ax-muted)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-chathead-state .ax-state { font-size: .68rem; padding: .15rem .55rem; }
.ax-chathead-sub a { color: inherit; text-decoration: none; }
.ax-chathead-sub a:hover { text-decoration: underline; }
.ax-chathead-actions { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.ax-chathead-actions .fi-btn { white-space: nowrap; }
.ax-state { font-size: .75rem; font-weight: 700; border-radius: 999px; padding: .3rem .7rem; white-space: nowrap; }
.ax-state.is-agent { background: rgb(var(--primary-100)); color: rgb(var(--primary-800)); }
.ax-state.is-human { background: rgb(var(--ax-gold) / .18); color: rgb(146 98 24); }
.ax-state.is-warning { background: rgb(var(--warning-100)); color: rgb(var(--warning-800)); }
.ax-state.is-danger { background: rgb(var(--danger-100)); color: rgb(var(--danger-700)); }
.dark .ax-state.is-agent { background: rgb(var(--primary-500) / .2); color: rgb(var(--primary-300)); }
.dark .ax-state.is-human { color: rgb(var(--ax-gold)); }
@container (max-width: 1150px) { .ax-chathead-state { display: none; } }

.ax-banner { font-size: .78rem; padding: .4rem 1rem; text-align: center; font-weight: 600; }
.ax-banner.is-warning { background: rgb(var(--warning-50)); color: rgb(var(--warning-800)); border-bottom: 1px solid rgb(var(--warning-200)); }
.ax-banner.is-danger { background: rgb(var(--danger-50)); color: rgb(var(--danger-700)); border-bottom: 1px solid rgb(var(--danger-200)); }
.dark .ax-banner.is-warning { background: rgb(var(--warning-500) / .1); color: rgb(var(--warning-300)); border-color: transparent; }
.dark .ax-banner.is-danger { background: rgb(var(--danger-500) / .1); color: rgb(var(--danger-300)); border-color: transparent; }

.ax-thread { flex: 1; overflow-y: auto; padding: 1rem clamp(.75rem, 3vw, 2.5rem); display: flex; flex-direction: column; gap: .35rem;
    background-image: radial-gradient(rgb(var(--ax-sand-deep) / .55) 1px, transparent 1px); background-size: 18px 18px; }
.dark .ax-thread { background-image: radial-gradient(rgb(255 255 255 / .04) 1px, transparent 1px); }
.ax-day { display: flex; justify-content: center; margin: .75rem 0 .35rem; }
.ax-day span { background: rgb(var(--ax-card)); color: rgb(var(--ax-muted)); font-size: .72rem; font-weight: 600; padding: .2rem .7rem; border-radius: 8px; box-shadow: var(--ax-shadow); }
.ax-row { display: flex; }
.ax-row.is-in { justify-content: flex-start; }
.ax-row.is-out { justify-content: flex-end; }
.ax-bubble { position: relative; max-width: min(78%, 560px); padding: .45rem .7rem .35rem; border-radius: 12px; font-size: .9rem; line-height: 1.42; color: rgb(var(--ax-ink)); background: rgb(var(--ax-card)); box-shadow: 0 1px 1px rgb(15 23 42 / .08); }
.ax-row.is-in .ax-bubble { border-top-left-radius: 4px; }
.ax-row.is-out .ax-bubble { border-top-right-radius: 4px; }
.ax-bubble.is-agent { background: rgb(var(--ax-agent)); }
.ax-bubble.is-staff { background: rgb(var(--ax-staff)); }
.ax-bubble.is-held { outline: 2px dashed rgb(var(--warning-400)); outline-offset: -2px; }
.ax-bubble.is-failed { outline: 2px solid rgb(var(--danger-400)); outline-offset: -2px; }
.ax-author { font-size: .7rem; font-weight: 700; color: rgb(var(--primary-700)); margin-bottom: .1rem; }
.ax-bubble.is-staff .ax-author { color: rgb(146 98 24); }
.dark .ax-author { color: rgb(var(--primary-300)); }
.dark .ax-bubble.is-staff .ax-author { color: rgb(var(--ax-gold)); }
.ax-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ax-photo { display: block; max-width: 280px; max-height: 320px; border-radius: 8px; margin: .15rem 0 .25rem; object-fit: cover; }
.ax-file { display: inline-block; margin-bottom: .25rem; font-weight: 600; color: rgb(var(--primary-700)); }
.ax-meta { display: flex; justify-content: flex-end; align-items: center; gap: .45rem; flex-wrap: wrap; margin-top: .1rem; font-size: .68rem; color: rgb(var(--ax-muted)); }
.ax-tick { font-size: .72rem; letter-spacing: -.12em; color: rgb(var(--ax-muted)); }
.ax-tick.is-read { color: #34b7f1; }
.ax-tick.is-held { color: rgb(var(--warning-500)); letter-spacing: 0; }
.ax-held { color: rgb(var(--warning-700)); font-weight: 700; }
.ax-failed { color: rgb(var(--danger-600)); font-weight: 600; }
.dark .ax-held { color: rgb(var(--warning-300)); }

.ax-why { margin-top: .35rem; border-top: 1px solid rgb(var(--ax-line)); padding-top: .3rem; font-size: .75rem; color: rgb(var(--ax-muted)); }
.ax-why summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .4rem; user-select: none; }
.ax-why summary::-webkit-details-marker { display: none; }
.ax-conf { --c: 0; display: inline-flex; align-items: center; justify-content: center; min-width: 2.4rem; height: 1.2rem; border-radius: 999px; font-weight: 700; font-size: .68rem; color: #fff;
    background: color-mix(in srgb, #10b981 calc(var(--c) * 1%), #f43f5e); }
.ax-why ul { list-style: none; margin: .4rem 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.ax-why li { display: flex; gap: .4rem; align-items: baseline; }
.ax-why li.is-used { color: rgb(var(--ax-ink)); font-weight: 600; }
.ax-why li em { font-style: normal; opacity: .6; }
.ax-score { font-variant-numeric: tabular-nums; background: rgb(var(--ax-line)); border-radius: 4px; padding: 0 .25rem; font-size: .66rem; }
.ax-why-handed { color: rgb(var(--danger-600)); font-weight: 700; }
.ax-why-reason { margin: .2rem 0 .3rem; font-style: italic; }

.ax-note { align-self: center; max-width: 80%; text-align: center; font-size: .75rem; color: rgb(var(--ax-muted)); background: rgb(var(--ax-card) / .8); border-radius: 8px; padding: .25rem .7rem; margin: .2rem 0; }
.ax-note.is-team { background: rgb(254 249 195); color: rgb(113 63 18); border: 1px solid rgb(253 224 71); text-align: left; white-space: pre-wrap; }
.dark .ax-note.is-team { background: rgb(113 63 18 / .35); color: rgb(254 240 138); border-color: transparent; }
.ax-note-meta { display: block; font-size: .66rem; opacity: .7; margin-top: .1rem; }

.ax-composer { background: rgb(var(--ax-card)); border-top: 1px solid rgb(var(--ax-line)); padding: .6rem .8rem .45rem; }
.ax-composer.is-noting { background: rgb(254 252 232); }
.dark .ax-composer.is-noting { background: rgb(113 63 18 / .25); }
.ax-composer-row { display: flex; align-items: flex-end; gap: .45rem; }
.ax-composer textarea { flex: 1; resize: none; border-radius: 20px; border: 1px solid rgb(var(--ax-line)); background: rgb(var(--ax-sand)); color: rgb(var(--ax-ink)); padding: .6rem 1rem; font-size: .9rem; line-height: 1.35; max-height: 180px; min-height: 2.6rem; overflow-y: hidden; outline: none; }
.dark .ax-composer textarea { background: rgb(255 255 255 / .04); }
.ax-composer textarea:focus { border-color: rgb(var(--primary-400)); box-shadow: 0 0 0 3px rgb(var(--primary-500) / .15); }
.ax-icon-btn { width: 2.4rem; height: 2.4rem; border-radius: 999px; border: 0; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.ax-icon-btn:hover { background: rgb(var(--ax-sand)); }
.ax-icon-btn.is-on { background: rgb(253 224 71); }
.ax-send { width: 2.6rem; height: 2.6rem; border-radius: 999px; border: 0; background: rgb(var(--primary-600)); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; box-shadow: 0 4px 12px rgb(var(--primary-600) / .35); }
.ax-send:hover { background: rgb(var(--primary-700)); }
.ax-send:disabled { opacity: .5; }
.ax-send-icon { width: 1.15rem; height: 1.15rem; }
.ax-composer-hint { font-size: .7rem; color: rgb(var(--ax-muted)); padding: .25rem .4rem 0 5.4rem; }
.ax-attach-preview { display: flex; align-items: center; gap: .6rem; padding: 0 0 .5rem 5.4rem; }
.ax-attach-preview img { height: 64px; border-radius: 8px; }

.ax-welcome { margin: auto; text-align: center; max-width: 440px; padding: 2rem; color: rgb(var(--ax-muted)); }
.ax-welcome-logo { width: 140px; margin: 0 auto 1.25rem; opacity: .9; }
.dark .ax-welcome-logo { filter: brightness(0) invert(1); opacity: .7; }
.ax-welcome h2 { font-size: 1.25rem; font-weight: 800; color: rgb(var(--ax-ink)); margin-bottom: .5rem; }
.ax-welcome p { font-size: .875rem; line-height: 1.5; }
.ax-welcome-stats { display: flex; justify-content: center; gap: 1.25rem; margin-top: 1.25rem; font-size: .8rem; }
.ax-welcome-stats strong { display: block; font-size: 1.5rem; color: rgb(var(--primary-600)); }

/* The lead beside the chat */
.ax-side { border-left: 1px solid rgb(var(--ax-line)); overflow-y: auto; background: rgb(var(--ax-card)); }
.ax-leadcard { padding: 1rem; display: flex; flex-direction: column; gap: .8rem; }
.ax-side-head { display: flex; justify-content: space-between; align-items: center; }
.ax-side-tools { display: flex; gap: .6rem; align-items: center; }
.ax-side-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: rgb(var(--ax-muted)); }
.ax-side-title.is-sub { margin-top: .25rem; }
.ax-side-empty { padding: 2.5rem 1rem; text-align: center; color: rgb(var(--ax-muted)); font-size: .875rem; display: flex; flex-direction: column; gap: .75rem; align-items: center; }
.ax-side-fact { font-size: .8rem; background: rgb(var(--ax-sand)); border-radius: 10px; padding: .45rem .7rem; color: rgb(var(--ax-ink)); }
.dark .ax-side-fact { background: rgb(255 255 255 / .04); }

.ax-stage-track { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; }
.ax-stage { border: 1px solid rgb(var(--ax-line)); background: transparent; border-radius: 8px; font-size: .68rem; font-weight: 700; padding: .35rem .25rem; cursor: pointer; color: rgb(var(--ax-muted)); line-height: 1.15; }
.ax-stage:hover { border-color: rgb(var(--primary-300)); color: rgb(var(--ax-ink)); }
.ax-stage.is-current { color: #fff; border-color: transparent; }
.ax-stage.is-current.is-sky { background: #0ea5e9; } .ax-stage.is-current.is-indigo { background: #6366f1; } .ax-stage.is-current.is-amber { background: #f59e0b; }
.ax-stage.is-current.is-violet { background: #8b5cf6; } .ax-stage.is-current.is-emerald { background: #10b981; } .ax-stage.is-current.is-rose { background: #f43f5e; }

.ax-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.ax-field { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.ax-field.is-wide { grid-column: 1 / -1; }
.ax-field span { font-size: .68rem; font-weight: 700; color: rgb(var(--ax-muted)); text-transform: uppercase; letter-spacing: .04em; }
.ax-field input, .ax-field select, .ax-lead-note input {
    width: 100%; border-radius: 9px; border: 1px solid rgb(var(--ax-line)); background-color: rgb(var(--ax-card)); color: rgb(var(--ax-ink));
    font-size: .84rem; padding: .4rem .55rem; outline: none; }
.ax-field input:focus, .ax-field select:focus, .ax-lead-note input:focus { border-color: rgb(var(--primary-400)); box-shadow: 0 0 0 3px rgb(var(--primary-500) / .12); }
.dark .ax-field input, .dark .ax-field select, .dark .ax-lead-note input, .dark .ax-select-sm { background-color: rgb(255 255 255 / .03); color-scheme: dark; }
.ax-field select { padding-right: 1.8rem; }

/* Timeline (lead card, lead page) */
.ax-timeline { list-style: none; margin: 0; padding: 0 0 0 .9rem; border-left: 2px solid rgb(var(--ax-line)); display: flex; flex-direction: column; gap: .7rem; }
.ax-timeline li { position: relative; font-size: .8rem; color: rgb(var(--ax-ink)); }
.ax-timeline li::before { content: ''; position: absolute; left: calc(-.9rem - 6px); top: .3rem; width: 10px; height: 10px; border-radius: 999px; background: rgb(var(--ax-line)); border: 2px solid rgb(var(--ax-card)); }
.ax-timeline li.is-stage::before { background: rgb(var(--primary-500)); }
.ax-timeline li.is-agent::before { background: #8b5cf6; }
.ax-timeline li.is-note::before { background: rgb(var(--ax-gold)); }
.ax-timeline li.is-created::before { background: #10b981; }
.ax-timeline-meta { font-size: .7rem; color: rgb(var(--ax-muted)); margin-top: .1rem; }
.ax-mini-thread { display: flex; flex-direction: column; gap: .35rem; background: rgb(var(--ax-chat-bg)); border-radius: 12px; padding: .8rem; margin-bottom: .75rem; }

/* ---- Lead board ---------------------------------------------------------- */

.ax-board-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.ax-board-bar .ax-search { max-width: 320px; }
.ax-board-total { margin-left: auto; font-size: .85rem; color: rgb(var(--ax-muted)); }
.ax-board-total strong { color: rgb(var(--ax-ink)); font-size: 1rem; }
.ax-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(235px, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: .75rem; align-items: stretch; }
.ax-col { background: rgb(var(--ax-card) / .65); border: 1px solid rgb(var(--ax-line)); border-radius: 16px; display: flex; flex-direction: column; height: calc(100vh - 15rem); min-height: 420px; transition: background .15s, border-color .15s; border-top: 4px solid; }
.ax-col.is-sky { border-top-color: #0ea5e9; } .ax-col.is-indigo { border-top-color: #6366f1; } .ax-col.is-amber { border-top-color: #f59e0b; }
.ax-col.is-violet { border-top-color: #8b5cf6; } .ax-col.is-emerald { border-top-color: #10b981; } .ax-col.is-rose { border-top-color: #f43f5e; }
.ax-col.is-over { background: rgb(var(--primary-50)); border-color: rgb(var(--primary-300)); }
.dark .ax-col.is-over { background: rgb(var(--primary-500) / .1); }
.ax-col-head { display: flex; align-items: center; gap: .45rem; padding: .7rem .8rem .5rem; }
.ax-col-title { font-weight: 800; font-size: .85rem; color: rgb(var(--ax-ink)); }
.ax-col-count { font-size: .72rem; font-weight: 700; background: rgb(var(--ax-line)); color: rgb(var(--ax-ink)); border-radius: 999px; padding: 0 .45rem; }
.ax-col-sum { margin-left: auto; font-size: .72rem; font-weight: 700; color: rgb(var(--ax-muted)); }
.ax-col-body { overflow-y: auto; padding: .2rem .6rem .7rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.ax-col-empty { border: 2px dashed rgb(var(--ax-line)); border-radius: 12px; padding: 1.25rem .5rem; text-align: center; color: rgb(var(--ax-muted)); font-size: .78rem; }

.ax-card { background: rgb(var(--ax-card)); border-radius: 12px; border: 1px solid rgb(var(--ax-line)); box-shadow: var(--ax-shadow); cursor: grab; transition: transform .12s, box-shadow .12s; }
.ax-card:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgb(15 23 42 / .1); }
.ax-card.is-dragging { opacity: .45; transform: rotate(1.5deg); }
.ax-card-link { display: block; padding: .65rem .75rem .35rem; color: inherit; text-decoration: none; }
.ax-card-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.ax-card-name { font-weight: 700; font-size: .875rem; color: rgb(var(--ax-ink)); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-card-line { font-size: .78rem; color: rgb(var(--ax-ink)); margin-top: .15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-card-foot { display: flex; gap: .6rem; align-items: center; font-size: .74rem; color: rgb(var(--ax-muted)); margin-top: .4rem; }
.ax-card-value { font-weight: 800; color: rgb(var(--primary-700)); }
.dark .ax-card-value { color: rgb(var(--primary-300)); }
.ax-card-when { margin-left: auto; }
.ax-card-tools { display: flex; align-items: center; gap: .45rem; padding: .3rem .75rem .5rem; border-top: 1px solid rgb(var(--ax-line) / .6); font-size: .72rem; }
.ax-owner { width: 1.4rem; height: 1.4rem; border-radius: 999px; background: rgb(var(--ax-gold)); color: #fff; font-weight: 800; font-size: .68rem; display: inline-flex; align-items: center; justify-content: center; }
.ax-follow { color: rgb(var(--ax-muted)); }
.ax-follow.is-due { color: rgb(var(--danger-600)); font-weight: 700; }
.ax-card-chat { margin-left: auto; text-decoration: none; font-size: .95rem; opacity: .8; }
.ax-card-chat:hover { opacity: 1; }

/* ---- Dashboard widgets ---------------------------------------------------- */

.ax-funnel { display: flex; flex-direction: column; gap: .55rem; }
.ax-funnel-row { display: grid; grid-template-columns: 9.5rem 1fr 6.5rem; gap: .75rem; align-items: center; font-size: .82rem; }
.ax-funnel-label { display: flex; align-items: center; gap: .45rem; font-weight: 600; color: rgb(var(--ax-ink)); }
.ax-funnel-bar { height: 1.6rem; border-radius: 8px; background: rgb(var(--ax-line) / .6); overflow: hidden; }
.ax-funnel-fill { height: 100%; border-radius: 8px; display: flex; align-items: center; justify-content: flex-end; padding-right: .5rem; color: #fff; font-weight: 800; font-size: .75rem; min-width: 1.8rem; }
.ax-funnel-fill.is-sky { background: linear-gradient(90deg, #7dd3fc, #0ea5e9); } .ax-funnel-fill.is-indigo { background: linear-gradient(90deg, #a5b4fc, #6366f1); }
.ax-funnel-fill.is-amber { background: linear-gradient(90deg, #fcd34d, #f59e0b); } .ax-funnel-fill.is-violet { background: linear-gradient(90deg, #c4b5fd, #8b5cf6); }
.ax-funnel-fill.is-emerald { background: linear-gradient(90deg, #6ee7b7, #10b981); } .ax-funnel-fill.is-rose { background: linear-gradient(90deg, #fda4af, #f43f5e); }
.ax-funnel-value { text-align: right; font-weight: 700; color: rgb(var(--ax-muted)); font-variant-numeric: tabular-nums; }

.ax-waiting { display: flex; flex-direction: column; }
.ax-waiting a { display: flex; align-items: center; gap: .7rem; padding: .6rem .2rem; border-bottom: 1px solid rgb(var(--ax-line) / .6); text-decoration: none; color: inherit; }
.ax-waiting a:last-child { border-bottom: 0; }
.ax-waiting a:hover { background: rgb(var(--ax-sand)); border-radius: 10px; }
.dark .ax-waiting a:hover { background: rgb(255 255 255 / .03); }
.ax-waiting-main { flex: 1; min-width: 0; }
.ax-waiting-name { font-weight: 700; font-size: .875rem; color: rgb(var(--ax-ink)); }
.ax-waiting-why { font-size: .78rem; color: rgb(var(--ax-muted)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-waiting-when { font-size: .72rem; color: rgb(var(--danger-600)); font-weight: 700; white-space: nowrap; }
