/* ============ Design tokens ============ */
:root {
    --ink: #0f172a;
    --ink-2: #475569;
    --muted: #94a3b8;
    --line: #e2e8f0;
    --surface: #f4f6f8;
    --card: #ffffff;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --accent-soft: #ccfbf1;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(15, 23, 42, .05);
}

html, body {
    font-family: "Cairo", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    background: var(--surface);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h3, h4, h5, h6, .brand-name {
    font-weight: 700;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.35rem;
}

/* Cairo runs slightly large; nudge the base size down a hair for balance. */
body { font-size: 0.95rem; }

/* ============ App shell ============ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.content {
    flex-grow: 1;
    padding: 28px 32px;
    width: 100%;
    min-width: 0; /* let flex children shrink so tables can scroll instead of overflow */
}

/* Panels and cards fill the available width instead of being pinned to a fixed
   pixel width (which left dead space on wide / zoomed-out screens). NOTE: Bootstrap
   .row must NOT get max-width:100% — its negative gutter margins need the natural
   width, otherwise the row shifts left and leaves dead space on the right. */
.content > .panel,
.content > .card {
    max-width: 100%;
}

/* Mobile top bar + drawer plumbing (hidden on desktop) */
.nav-toggle { display: none; }
.topbar { display: none; }
.nav-overlay { display: none; }

/* ============ Sidebar ============ */
.sidebar {
    width: 256px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #0c1a17, #10231e);
    color: #e2e8f0;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    /* Keep the scroll inside the menu instead of chaining to the page behind it. */
    overscroll-behavior: contain;
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: rgba(94, 234, 212, .38) transparent;
}

/* A slim, on-brand scrollbar. The default one is nearly invisible against the dark
   gradient, which makes a long menu look truncated rather than scrollable. */
.sidebar::-webkit-scrollbar { width: 10px; }
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(94, 234, 212, .45), rgba(15, 118, 110, .6));
    border-radius: 999px;
    border: 3px solid transparent;   /* inset the thumb so it reads as a slim pill */
    background-clip: padding-box;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(94, 234, 212, .8), rgba(15, 118, 110, .85));
    background-clip: padding-box;
}

/* CRITICAL for a long menu: the sidebar is a flex column pinned to 100vh, so by default
   flex SHRINKS its children to make everything fit. Nav groups (overflow:hidden) were being
   squashed to a fraction of their height, hiding the links inside — and because nothing
   actually overflowed, overflow-y:auto never produced a scrollbar. Locking the children at
   their natural size lets the menu overflow properly and become scrollable. */
.sidebar > * { flex-shrink: 0; }

/* ============ Responsive: collapse the sidebar into a drawer on phones/tablets ============ */
@media (max-width: 768px) {
    .topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 1030;
        height: 54px;
        padding: 0 14px;
        background: #0c1a17;
        color: #fff;
        box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
    }

    .nav-burger {
        font-size: 1.5rem;
        line-height: 1;
        cursor: pointer;
        padding: 4px 8px;
        margin: 0;
        user-select: none;
    }

    .topbar-title {
        font-weight: 600;
        font-size: .95rem;
    }

    /* app-shell becomes a vertical stack: topbar, then content; sidebar floats over */
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 260px;
        z-index: 1040;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }

    .nav-toggle:checked ~ .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, .4);
    }

    .nav-toggle:checked ~ .nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1035;
        background: rgba(0, 0, 0, .45);
    }

    .content {
        padding: 16px;
        max-width: 100%;
    }
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 4px 8px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    margin-bottom: 10px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #134e4a, #0f766e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.brand-name {
    font-weight: 600;
    font-size: .95rem;
    color: #fff;
    line-height: 1.2;
}

.brand-sub {
    font-size: .68rem;
    color: #5eead4;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nav-section {
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #64748b;
    margin: 16px 10px 6px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cbd5e1;
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: .9rem;
    margin-bottom: 2px;
    border-left: 3px solid transparent;
    transition: background .15s ease, color .15s ease;
}

.side-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.side-link.active {
    background: rgba(16, 185, 129, .14);
    color: #fff;
    border-left-color: #10b981;
}

.side-ico {
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

/* Red attention counter on a nav item (needs-human chats, new knowledge gaps). */
.nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    font-size: .62rem;
    font-weight: 700;
    line-height: 1;
    padding: 3px 6px;
    flex-shrink: 0;
}
/* Collapsed rail: pin the badge to the icon's corner so it stays visible. */
.nav-collapse:checked ~ .sidebar .side-link { position: relative; }
.nav-collapse:checked ~ .sidebar .nav-badge {
    position: absolute;
    top: 2px;
    right: 6px;
    margin-left: 0;
}

/* ============ Collapsible nav groups ============ */
.nav-grp { display: none; }
.nav-grp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}
.nav-grp-head:hover { color: #94a3b8; }
.nav-chev { font-size: .7rem; transition: transform .2s ease; }
.nav-group {
    overflow: hidden;
    max-height: 0;
    transition: max-height .22s ease;
}
/* Expand when the group's checkbox is on, or when it contains the active page */
#grp-knowledge:checked ~ .grp-knowledge,
#grp-setup:checked ~ .grp-setup,
#grp-quotes:checked ~ .grp-quotes,
.nav-group:has(.side-link.active) { max-height: 500px; }
#grp-knowledge:checked ~ .grp-head-knowledge .nav-chev,
#grp-setup:checked ~ .grp-head-setup .nav-chev,
#grp-quotes:checked ~ .grp-head-quotes .nav-chev { transform: rotate(90deg); }
/* Icons-only sidebar: force groups open (their text heads are hidden via .nav-section) */
.nav-collapse:checked ~ .sidebar .nav-group { max-height: 500px; }

/* ============ Desktop: collapsible sidebar (icons-only mode) ============ */
.nav-collapse { display: none; }

.nav-collapse-btn {
    display: none; /* desktop only — shown in the media query below */
    align-self: flex-end;
    cursor: pointer;
    color: #94a3b8;
    font-size: .85rem;
    padding: 2px 8px;
    border-radius: 8px;
    user-select: none;
    margin-bottom: 4px;
}

.nav-collapse-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-collapse-btn .when-closed { display: none; }

.btn-logout .side-ico { width: auto; }
.btn-logout { display: flex; align-items: center; justify-content: center; gap: 8px; }

@media (min-width: 769px) {
    .nav-collapse-btn { display: block; }

    .sidebar { transition: width .2s ease, padding .2s ease; }

    /* Slim rail, Zoho-Books style: icon on top with a tiny label underneath, so the
       purpose of every icon stays readable even when collapsed. */
    .nav-collapse:checked ~ .sidebar { width: 92px; padding: 20px 6px; }
    .nav-collapse:checked ~ .sidebar .brand-text,
    .nav-collapse:checked ~ .sidebar .nav-section { display: none; }
    .nav-collapse:checked ~ .sidebar .side-link {
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        padding: 8px 4px;
        border-left: none;
        border-radius: 10px;
        text-align: center;
    }
    .nav-collapse:checked ~ .sidebar .nav-text {
        display: block;
        font-size: .62rem;
        line-height: 1.15;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .nav-collapse:checked ~ .sidebar .btn-logout { flex-direction: column; gap: 2px; padding: 8px 4px; }
    .nav-collapse:checked ~ .sidebar .brand { justify-content: center; padding: 4px 0 14px; }
    .nav-collapse:checked ~ .sidebar .nav-collapse-btn { align-self: center; }
    .nav-collapse:checked ~ .sidebar .nav-collapse-btn .when-open { display: none; }
    .nav-collapse:checked ~ .sidebar .nav-collapse-btn .when-closed { display: inline; }
    .nav-collapse:checked ~ .sidebar .side-ico { font-size: 1.15rem; }
}

/* ============ Conversations: WhatsApp-style split view ============ */
.convo-split {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.convo-main { flex: 1 1 auto; min-width: 0; }

.convo-side {
    width: 300px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: 78vh;
    overflow: hidden;
}

.convo-side-head {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}

.convo-side-list { overflow-y: auto; flex: 1; }

.convo-item {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background .12s ease;
}

.convo-item:hover { background: #f8fafc; }
.convo-item.active { background: #ecfdf5; border-inline-start: 3px solid #10b981; }

.convo-item-name { font-weight: 600; font-size: .88rem; color: #111827; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.convo-item-meta { font-size: .72rem; color: #6b7280; margin-top: 2px; display: flex; gap: 6px; align-items: center; }
.convo-score { font-size: .68rem; padding: 1px 6px; }
.convo-item-note {
    font-size: .72rem;
    color: #b45309;
    background: #fffbeb;
    border-radius: 6px;
    padding: 3px 7px;
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Agent note bar above the chat */
.note-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 8px 12px;
}
.note-label { font-size: .82rem; font-weight: 600; color: #92400e; white-space: nowrap; }

@media (max-width: 900px) {
    .convo-side { display: none; } /* small screens: chat only, use the full list page */
}

.logout-form {
    margin-top: auto;
    padding-top: 16px;
}

.btn-logout {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .18);
    color: #cbd5e1;
    border-radius: 10px;
    padding: 8px;
    font-size: .85rem;
    transition: background .15s ease;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

/* ============ Cards & panels ============ */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--card);
}

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
    margin-bottom: 20px; /* baseline spacing so stacked panels never touch (mb-* utilities still override) */
}

.panel-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    font-size: .95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel .table {
    margin-bottom: 0;
}

/* ============ Tables ============ */
.table thead th {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    padding: .6rem 1.1rem;
}

.table tbody td {
    padding: .65rem 1.1rem;
    vertical-align: middle;
    color: var(--ink-2);
}

.table tbody tr td:first-child {
    color: var(--ink);
    font-weight: 500;
}

/* ============ Buttons & forms ============ */
.btn {
    border-radius: 10px;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: var(--accent-strong) !important;
    border-color: var(--accent-strong) !important;
}

.btn-outline-primary {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-outline-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.form-control, .form-select {
    border-radius: 10px;
    border-color: var(--line);
}

.form-control:focus, .form-select:focus {
    border-color: #14b8a6;
    box-shadow: 0 0 0 .2rem rgba(20, 184, 166, .15);
}

.form-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: .3rem;
}

.alert {
    border-radius: 10px;
}

/* ============ Soft status badges ============ */
.badge-soft {
    display: inline-block;
    padding: .32em .75em;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-soft-success { background: #d1fae5; color: #065f46; }
.badge-soft-danger  { background: #fee2e2; color: #991b1b; }
.badge-soft-info    { background: #dbeafe; color: #1e40af; }
.badge-soft-warning { background: #fef3c7; color: #92400e; }
.badge-soft-neutral { background: #e2e8f0; color: #475569; }

/* ============ KPI stat tiles ============ */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 18px 0 26px;
}

.kpi-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    gap: 14px;
    align-items: center;
}

.kpi-ico {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.kpi-ico-teal  { background: #ccfbf1; }
.kpi-ico-blue  { background: #dbeafe; }
.kpi-ico-amber { background: #fef3c7; }
.kpi-ico-red   { background: #fee2e2; }
.kpi-ico-gray  { background: #e2e8f0; }

.kpi-value {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.kpi-label {
    font-size: .8rem;
    color: var(--ink-2);
}

.kpi-alert {
    font-size: .72rem;
    color: #b91c1c;
    font-weight: 600;
}

/* ============ Chat ============ */
.chat-box {
    background: #efeae2;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.chat-row {
    display: flex;
    margin-bottom: 8px;
}

.chat-row.chat-right {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 4px 14px 14px 14px;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
    font-size: .92rem;
}

.chat-row.chat-right .chat-bubble {
    border-radius: 14px 4px 14px 14px;
}

.bubble-customer { background: #ffffff; }
.bubble-ai       { background: #d9fdd3; }
.bubble-agent    { background: #dbeafe; }

/* Per-message direction (WhatsApp-style): Arabic renders RTL, English LTR,
   mixed content aligns to its dominant language via dir="auto" on the element. */
.chat-text { text-align: start; }

.chat-meta {
    font-size: .7rem;
    color: #6c757d;
    margin-bottom: 2px;
}

/* ============ Login ============ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1100px 550px at 15% -5%, rgba(19, 78, 74, .45), transparent),
        radial-gradient(900px 500px at 110% 110%, rgba(15, 118, 110, .25), transparent),
        linear-gradient(160deg, #0c1a17, #0f172a);
}

.login-card {
    width: min(410px, 92vw);
    background: #fff;
    border-radius: 18px;
    padding: 38px 34px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
}

.login-logo {
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, #134e4a, #0f766e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.login-title {
    text-align: center;
    font-weight: 650;
    margin-bottom: 2px;
}

.login-sub {
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
    margin-bottom: 26px;
}

/* ============ Misc ============ */
.page-sub {
    color: var(--muted);
    font-size: .88rem;
    margin-bottom: 1.2rem;
}

.text-muted {
    color: var(--muted) !important;
}

/* ============ Collapsible section header ============ */
.section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: .95rem;
    color: var(--ink);
}
.section-toggle .chev {
    transition: transform .15s ease;
    color: var(--muted);
    font-size: .75rem;
}
.section-toggle.open .chev { transform: rotate(90deg); }

/* ============ Stepper (wizard) ============ */
.stepper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.stepper .step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
}
.stepper .step .num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #cbd5e1;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .74rem;
}
.stepper .step.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
}
.stepper .step.active .num { background: var(--accent); }
.stepper .step.done { color: var(--accent-strong); }
.stepper .step.done .num { background: var(--accent); }

/* ============ Filter bar + pills ============ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    margin-bottom: 18px;
}
.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill {
    padding: 6px 13px;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--ink-2);
    font-size: .82rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, border-color .12s;
}
.filter-pill:hover { background: #e8eef4; }
.filter-pill.active { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.filter-pill .cnt { opacity: .65; font-weight: 500; margin-inline-start: 2px; }

/* ============ Lead cards ============ */
.lead-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.lead-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow);
    transition: box-shadow .15s, transform .15s;
}
.lead-card:hover { box-shadow: 0 8px 22px rgba(15, 23, 42, .09); transform: translateY(-1px); }
.lead-card-attention { border-inline-start: 4px solid #dc3545; }
.lead-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lead-name { font-weight: 700; font-size: 1rem; line-height: 1.25; }
.lead-biz { color: var(--ink-2); font-size: .85rem; line-height: 1.3; }
.lead-contact { font-size: .78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 3px 14px; }
.lead-contact a { color: var(--muted); text-decoration: none; }
.lead-contact a:hover { color: var(--accent); }
.lead-product {
    font-size: .78rem; color: var(--ink-2);
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.lead-signals { display: flex; flex-wrap: wrap; gap: 4px; }
.lead-chip { font-size: .68rem; padding: 2px 7px; border-radius: 6px; background: #f1f5f9; color: var(--ink-2); white-space: nowrap; }
.lead-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

/* ============ Generic entity cards (Industry KB, etc.) ============ */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.info-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow);
    transition: box-shadow .15s, transform .15s;
}
.info-card:hover { box-shadow: 0 8px 22px rgba(15, 23, 42, .09); transform: translateY(-1px); }
.info-card.is-off { opacity: .58; }
.info-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.info-card-title { font-weight: 700; font-size: 1.02rem; line-height: 1.25; }
.info-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 3px; }
.info-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.info-chip { font-size: .7rem; padding: 2px 8px; border-radius: 6px; background: #f1f5f9; color: var(--ink-2); white-space: nowrap; }
.info-preview { font-size: .82rem; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.info-card-foot { margin-top: auto; display: flex; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ============ Brand Voice ============ */
.bv-section { margin-bottom: 20px; }
.bv-section-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.bv-section-sub { color: var(--muted); font-size: .82rem; margin-bottom: 14px; }
.bv-num { width: 24px; height: 24px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-strong); display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; flex: none; }

.bv-slider-row { margin-bottom: 14px; }
.bv-slider-row label { font-weight: 600; font-size: .85rem; margin-bottom: 2px; display: block; }
.bv-slider-ends { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.bv-slider-row input[type=range] { width: 100%; accent-color: var(--accent); }

.rule-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--card); }
.rule-toggle .rt-text { font-size: .86rem; }
.rule-toggle.on { border-color: var(--accent); background: var(--accent-soft); }

.bv-preview { position: sticky; top: 16px; }
.bv-preview-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: .88rem; white-space: pre-wrap; word-break: break-word; min-height: 60px; }
.bv-preview-before { background: #f8fafc; color: var(--ink-2); }
.bv-preview-after { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.bv-preview-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 10px 0 4px; }

.bv-override { border-inline-start: 3px solid var(--accent); padding-inline-start: 8px; }
.bv-default-item { display: flex; align-items: center; gap: 8px; font-size: .84rem; padding: 3px 0; }

/* Editable tables share the app table styling but keep inputs compact */
.bv-table td { vertical-align: middle; }
.bv-table .form-control, .bv-table .form-select { font-size: .82rem; padding: .3rem .5rem; }
.bv-dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; display: inline-block; }

/* ============ Message-history modal (Reminders) ============ */
.msg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1060;
    padding: 16px;
}
.msg-modal-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    width: min(680px, 100%);
    max-height: 85vh;
    overflow: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
}

/* ============ In-app page help (ⓘ next to a page title) ============ */
.page-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-inline-start: 8px;
    padding: 0;
    border: 1.5px solid var(--accent);
    border-radius: 50%;
    background: transparent;
    color: var(--accent);
    font-size: .78rem;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, "Times New Roman", serif;  /* a proper serif "i" reads as an info mark */
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    transition: background .15s ease, color .15s ease;
}
.page-help-btn:hover {
    background: var(--accent);
    color: #fff;
}
.page-help-block { margin-bottom: 14px; }
.page-help-heading {
    font-weight: 700;
    font-size: .92rem;
    color: var(--ink);
    margin-bottom: 4px;
}
.page-help-list {
    margin: 0;
    padding-inline-start: 20px;
    color: var(--ink-2);
    font-size: .88rem;
    line-height: 1.65;
}
.page-help-list li { margin-bottom: 3px; }

/* ============ AI conversation summary body ============ */
.summary-body {
    background: #f8fafc;
    border: 1px solid var(--line);
    font-size: .9rem;
    line-height: 1.75;   /* bullets each sit on their own line, so give them room */
    color: var(--ink);
}
.summary-body strong { color: var(--ink); font-weight: 700; }

/* ============ Quantity inputs (quote draft & add-ons) ============ */
/* Number inputs collapse to an unreadable sliver in tight table cells; give them a real
   footprint, center the value, and keep the browser spinners from eating the digits. */
.qty-input {
    min-width: 80px;
    text-align: center;
    font-weight: 600;
}
.qty-input::-webkit-inner-spin-button { margin-inline-start: 4px; }

/* ============ Kit editor field groups (product-kits) ============ */
/* One color language across the editor so the operator always knows what a field is FOR:
   neutral = identity/basics · blue = internal AI teaching · green = client-facing · amber = pricing */
.fg {
    border: 1px solid var(--line);
    background: #f8fafc;
    border-radius: 12px;
    padding: 14px 16px;
}
.fg + .fg { margin-top: 12px; }
.fg-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ink-2);
    margin-bottom: 10px;
}
.fg-hint { font-size: .78rem; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }
.fg-ai { background: #eff6ff; border-color: #bfdbfe; }
.fg-ai .fg-title { color: #1e40af; }
.fg-client { background: #ecfdf5; border-color: #a7f3d0; }
.fg-client .fg-title { color: #065f46; }
.fg-price { background: #fffbeb; border-color: #fde68a; }
.fg-price .fg-title { color: #92400e; }
