/* Lead Management System — plain-CSS additions on top of Filament's prebuilt stylesheet.
   No build step: edit and refresh. Brand colour comes from the panel (Color::Indigo).
   Filament puts `.dark` on <html> when the user picks Dark (or System on a dark OS),
   so every custom colour below is a token with a light value and a `.dark` override. */

:root {
    --lms-surface: #fff;
    --lms-surface-2: var(--gray-50);
    --lms-line: var(--gray-200);
    --lms-text: var(--gray-950);
    --lms-text-2: var(--gray-600);
    --lms-muted: var(--gray-500);
    --lms-chip: var(--gray-100);

    --lms-in-bg: #fff;
    --lms-out-bg: var(--primary-600);
    --lms-out-text: #fff;
    --lms-note-bg: #fffbeb;
    --lms-note-line: #fcd34d;
    --lms-note-text: #713f12;
    --lms-system-bg: #eff6ff;
    --lms-system-line: #bfdbfe;
    --lms-system-text: #1e3a8a;
    --lms-failed-bg: #fef2f2;
    --lms-failed-line: #fecaca;
    --lms-danger: #dc2626;
    --lms-success: #16a34a;
    --lms-read: #2563eb;
    --lms-callout-bg: #fffbeb;
    --lms-callout-line: #fde68a;
    --lms-callout-text: #92400e;
    --lms-input-line: var(--gray-300);
}

.dark {
    --lms-surface: var(--gray-900);
    --lms-surface-2: var(--gray-950);
    --lms-line: rgba(255, 255, 255, .1);
    --lms-text: #fff;
    --lms-text-2: var(--gray-300);
    --lms-muted: var(--gray-400);
    --lms-chip: rgba(255, 255, 255, .08);

    --lms-in-bg: var(--gray-800);
    --lms-out-bg: var(--primary-500);
    --lms-note-bg: rgba(250, 204, 21, .1);
    --lms-note-line: rgba(250, 204, 21, .35);
    --lms-note-text: #fde68a;
    --lms-system-bg: rgba(59, 130, 246, .12);
    --lms-system-line: rgba(59, 130, 246, .35);
    --lms-system-text: #bfdbfe;
    --lms-failed-bg: rgba(239, 68, 68, .12);
    --lms-failed-line: rgba(239, 68, 68, .4);
    --lms-danger: #f87171;
    --lms-success: #4ade80;
    --lms-read: #60a5fa;
    --lms-callout-bg: rgba(245, 158, 11, .1);
    --lms-callout-line: rgba(245, 158, 11, .35);
    --lms-callout-text: #fcd34d;
    --lms-input-line: rgba(255, 255, 255, .15);
}

/* ---------- Navigation accent (both themes) ---------- */
.fi-body .fi-sidebar-group-label {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.fi-body .fi-sidebar-item.fi-active > .fi-sidebar-item-btn { box-shadow: inset 3px 0 0 var(--primary-500); }

/* ---------- Shared bits ---------- */
.lms-muted { color: var(--lms-muted); font-size: .8125rem; }
.lms-mt { margin-top: .75rem; }
.lms-mb { margin-bottom: .625rem; }
.lms-icon-sm { width: .95rem; height: .95rem; flex: none; }
.lms-error { display: block; margin-top: .3rem; color: var(--lms-danger); font-size: .8125rem; font-weight: 500; }

/* ---------- Conversation ---------- */
.lms-convo {
    display: flex; flex-direction: column;
    overflow: hidden;
    background: var(--lms-surface);
    color: var(--lms-text);
    border-radius: .75rem;
    box-shadow: 0 1px 2px rgba(16, 20, 40, .05);
    outline: 1px solid var(--lms-line);
}
.lms-convo__head {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--lms-line);
}
.lms-convo__head h3 { font-size: .95rem; font-weight: 600; }

.lms-thread {
    display: flex; flex-direction: column; gap: .85rem;
    min-height: 280px; max-height: 60vh;
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--lms-surface-2);
}
.lms-day {
    align-self: center;
    padding: .15rem .65rem; border-radius: 99px;
    background: var(--lms-chip); color: var(--lms-muted);
    font-size: .72rem; font-weight: 600;
}
.lms-msg { max-width: 78%; }
.lms-msg--in { align-self: flex-start; }
.lms-msg--out { align-self: flex-end; }
.lms-msg--note, .lms-msg--system { align-self: center; max-width: 88%; }
.lms-msg__bubble {
    padding: .6rem .9rem;
    border-radius: .9rem;
    background: var(--lms-in-bg);
    border: 1px solid var(--lms-line);
    color: var(--lms-text);
    box-shadow: 0 1px 1px rgba(16, 20, 40, .04);
    white-space: pre-wrap; overflow-wrap: anywhere;
    font-size: .875rem; line-height: 1.5;
}
.lms-msg--in .lms-msg__bubble { border-top-left-radius: .25rem; }
.lms-msg--out .lms-msg__bubble {
    background: var(--lms-out-bg); border-color: var(--lms-out-bg); color: var(--lms-out-text);
    border-top-right-radius: .25rem;
}
.lms-msg--out.is-failed .lms-msg__bubble { background: var(--lms-failed-bg); border-color: var(--lms-failed-line); color: var(--lms-text); }
.lms-msg--note .lms-msg__bubble { background: var(--lms-note-bg); border: 1px dashed var(--lms-note-line); color: var(--lms-note-text); }
.lms-msg--system .lms-msg__bubble { background: var(--lms-system-bg); border-color: var(--lms-system-line); color: var(--lms-system-text); }
.lms-msg__subject { font-weight: 700; margin-bottom: .25rem; }
.lms-msg__meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: .3rem;
    margin-top: .3rem;
    color: var(--lms-muted); font-size: .72rem;
}
.lms-msg--out .lms-msg__meta { justify-content: flex-end; }
.lms-msg__error { margin-top: .2rem; color: var(--lms-danger); font-size: .75rem; font-weight: 500; text-align: right; }
.lms-msg__files { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.lms-msg__file {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .25rem .55rem; border-radius: .5rem;
    background: var(--lms-chip); color: var(--lms-text); font-size: .75rem;
}
.lms-ticks { font-weight: 700; letter-spacing: -.12em; }
.lms-ticks.is-read { color: var(--lms-read); }

.lms-empty {
    display: flex; flex-direction: column; align-items: center; gap: .3rem;
    margin: auto; padding: 2.5rem 1rem;
    color: var(--lms-muted); text-align: center; font-size: .85rem;
}
.lms-empty strong { color: var(--lms-text); }
.lms-empty__icon { width: 2.25rem; height: 2.25rem; color: var(--lms-muted); opacity: .6; }

/* ---------- Composer ---------- */
.lms-composer { border-top: 1px solid var(--lms-line); }
.lms-composer .fi-tabs { padding: .5rem .75rem 0; border-radius: 0; box-shadow: none; background: transparent; }
.lms-composer__body { padding: .9rem 1.25rem 1.1rem; }
.lms-composer__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.lms-composer__foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .75rem; }
.lms-field > span:first-child { display: block; margin-bottom: .3rem; font-size: .8125rem; font-weight: 500; color: var(--lms-text-2); }
.lms-textarea {
    display: block; width: 100%; min-height: 5.5rem;
    padding: .6rem .75rem;
    border: 1px solid var(--lms-input-line); border-radius: .5rem;
    background: var(--lms-surface); color: var(--lms-text);
    font: inherit; font-size: .875rem; line-height: 1.5;
    resize: vertical;
}
.lms-textarea::placeholder { color: var(--lms-muted); }
.lms-textarea:focus { outline: none; border-color: var(--primary-500); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary-500) 25%, transparent); }
.lms-textarea.is-invalid { border-color: var(--lms-danger); }
.lms-callout {
    margin-bottom: .75rem; padding: .6rem .8rem;
    border-radius: .5rem; border: 1px solid var(--lms-callout-line);
    background: var(--lms-callout-bg); color: var(--lms-callout-text); font-size: .8125rem;
}

/* ---------- Activity timeline ---------- */
.lms-timeline { list-style: none; margin: 0; padding: 0; }
.lms-timeline li { position: relative; margin-left: .3rem; padding: .45rem 0 .45rem 1.1rem; border-left: 2px solid var(--lms-line); }
.lms-timeline li::before {
    content: ""; position: absolute; left: -6px; top: .8rem;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--lms-surface); border: 2px solid var(--primary-500);
}
.lms-timeline__title { font-size: .8125rem; font-weight: 600; color: var(--lms-text); }
.lms-timeline__detail { font-size: .8rem; color: var(--lms-text-2); }
.lms-timeline__meta { font-size: .72rem; color: var(--lms-muted); }

/* ---------- Website snippets (code blocks stay dark in both themes) ---------- */
.lms-snippets { display: grid; gap: 1rem; color: var(--lms-text); }
.lms-snippets code { padding: .05rem .3rem; border-radius: .25rem; background: var(--lms-chip); }
.lms-code { overflow: hidden; border-radius: .6rem; background: #0f1220; outline: 1px solid var(--lms-line); }
.lms-code__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: .5rem .75rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: #e2e5f3; font-size: .8rem;
}
.lms-code pre {
    margin: 0; padding: .9rem 1rem; overflow-x: auto;
    color: #e2e5f3; font-size: .78rem; line-height: 1.6;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

/* ---------- Setup & health ---------- */
.lms-health { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; align-items: start; color: var(--lms-text); }
.lms-health__main, .lms-health__side { display: grid; gap: 1.5rem; }
.lms-checklist { list-style: none; margin: 0; padding: 0; }
.lms-checklist li { display: flex; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--lms-line); }
.lms-checklist li:last-child { border-bottom: 0; }
.lms-checklist__mark { width: 1.25rem; height: 1.25rem; flex: none; margin-top: .05rem; }
.lms-checklist .is-ok .lms-checklist__mark { color: var(--lms-success); }
.lms-checklist .is-bad .lms-checklist__mark { color: var(--lms-danger); }
.lms-checklist__label { font-weight: 600; font-size: .875rem; }
.lms-dl { display: grid; grid-template-columns: 7rem 1fr; gap: .4rem .75rem; margin: 0; font-size: .85rem; }
.lms-dl dt { color: var(--lms-muted); }
.lms-dl dd { margin: 0; }
.lms-health code { font-size: .8em; }
.lms-endpoints { display: grid; gap: .75rem; }
.lms-endpoint { display: flex; align-items: center; gap: .35rem; margin-top: .2rem; }
.lms-endpoint code {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: .35rem .55rem; border-radius: .4rem;
    background: var(--lms-surface-2); border: 1px solid var(--lms-line); font-size: .75rem;
}

@media (max-width: 1100px) {
    .lms-health { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .lms-msg { max-width: 92%; }
    .lms-composer__row { grid-template-columns: minmax(0, 1fr); }
    .lms-composer__foot { flex-direction: column; align-items: stretch; }
}
