/* ==========================================================================
   MyBotPlus.com — CRM / Invoice / Tracker pages
   assets/css/business.css
   --------------------------------------------------------------------------
   Shared by crm.php, invoice.php and tracking.php. Each of those has
   two faces: a public landing page when signed out, and the working app when
   signed in. Both live here so the two never drift apart visually.

   Depends on the tokens in assets/css/app.css.
   ========================================================================== */

/* ── Public landing (signed out) ─────────────────────────────────────────── */

.biz-hero {
    padding: 3.5rem 0 3rem;
    background: linear-gradient(180deg, var(--brand-tint) 0%, var(--surface) 100%);
    text-align: center;
}
.biz-hero h1 {
    font-size: clamp(1.75rem, 4.5vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.15;
    margin-bottom: .85rem;
    color: var(--ink);
}
.biz-hero p.lead {
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: var(--text-muted);
    max-width: 40rem;
    margin: 0 auto 1.6rem;
    line-height: 1.65;
}
.biz-hero-cta { display: flex; gap: .65rem; justify-content: center; flex-wrap: wrap; }

/* The "type this, get that" demo that explains the product faster than prose */
.biz-demo {
    max-width: 34rem;
    margin: 2.5rem auto 0;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.biz-demo-head {
    background: var(--brand);
    color: #fff;
    padding: .6rem .9rem;
    font-size: .8rem;
    font-weight: 600;
    display: flex; align-items: center; gap: .45rem;
}
.biz-demo-body {
    padding: 1rem .9rem;
    display: flex; flex-direction: column; gap: .5rem;
    background: var(--surface-2);
}
.biz-bubble {
    max-width: 85%;
    padding: .5rem .75rem;
    border-radius: 14px;
    font-size: .85rem;
    line-height: 1.55;
    white-space: pre-wrap;
}
.biz-bubble.me  { align-self: flex-end;   background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.biz-bubble.bot { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.biz-bubble code {
    font-family: var(--font-mono); font-size: .85em;
    background: rgba(255,255,255,.2); padding: .1em .35em; border-radius: 4px;
}
.biz-bubble.bot code { background: rgba(15,23,42,.07); }

.biz-features {
    display: grid;
    gap: 1.1rem;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    padding: 3rem 0;
}
.biz-feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
}
.biz-feature-icon { font-size: 1.6rem; margin-bottom: .6rem; }
.biz-feature h3 { font-size: 1rem; font-weight: 700; margin-bottom: .35rem; color: var(--ink); }
.biz-feature p  { font-size: .875rem; color: var(--text-muted); line-height: 1.6; }

/* ── App shell (signed in) ───────────────────────────────────────────────── */

.biz-toolbar {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}
.biz-toolbar .grow { flex: 1; min-width: 10rem; }

.biz-stats {
    display: grid;
    gap: .8rem;
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
    margin-bottom: 1.25rem;
}
.biz-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--brand);
    border-radius: var(--radius-lg);
    padding: .85rem 1rem;
}
.biz-stat .k {
    font-size: .66rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); font-weight: 700; margin-bottom: .25rem;
}
.biz-stat .v { font-size: 1.4rem; font-weight: 800; line-height: 1.15; color: var(--ink); }
.biz-stat .n { font-size: .73rem; color: var(--text-muted); margin-top: .15rem; }
.biz-stat.ok   { border-left-color: var(--success); }
.biz-stat.warn { border-left-color: var(--warning); }
.biz-stat.bad  { border-left-color: var(--danger); }
.biz-stat .v.ok   { color: var(--success-dark); }
.biz-stat .v.bad  { color: var(--danger); }

/* ── Split layout: list on the left, detail on the right ─────────────────── */

.biz-split {
    display: grid;
    gap: 1.1rem;
    grid-template-columns: 1fr;
    align-items: start;
}
@media (min-width: 1100px) {
    .biz-split { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
    .biz-split .biz-detail { position: sticky; top: 5.5rem; }
}

.biz-detail-empty {
    text-align: center;
    padding: 2.5rem 1.25rem;
    color: var(--text-muted);
    font-size: .875rem;
}

/* ── Rows ────────────────────────────────────────────────────────────────── */

.biz-row {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .7rem .9rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .12s;
}
.biz-row:last-child { border-bottom: none; }
.biz-row:hover      { background: var(--surface-2); }
.biz-row.is-active  { background: var(--brand-tint); }

.biz-avatar {
    width: 2.15rem; height: 2.15rem;
    border-radius: 50%;
    background: var(--brand-tint);
    color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .82rem;
    flex-shrink: 0;
}

.biz-row-main  { flex: 1; min-width: 0; }
.biz-row-title {
    font-weight: 600; font-size: .875rem; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.biz-row-sub {
    font-size: .75rem; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.biz-row-right { text-align: right; flex-shrink: 0; }
.biz-row-amt   { font-weight: 700; font-size: .875rem; }
.biz-row-amt.in  { color: var(--success-dark); }
.biz-row-amt.out { color: var(--danger); }

/* ── Notes timeline ──────────────────────────────────────────────────────── */

.biz-note {
    padding: .6rem .8rem;
    border-left: 2px solid var(--border-strong);
    margin-bottom: .6rem;
    font-size: .82rem;
    line-height: 1.55;
    color: var(--text);
    background: var(--surface-2);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    white-space: pre-wrap;
}
.biz-note.from-chat   { border-left-color: var(--brand); }
.biz-note.from-system { border-left-color: var(--success); background: var(--success-tint); }
.biz-note-meta { font-size: .68rem; color: var(--text-faint); margin-top: .3rem; }

/* ── Stage pills ─────────────────────────────────────────────────────────── */

.biz-stage {
    display: inline-block;
    padding: .12rem .5rem;
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 700;
    white-space: nowrap;
}
.stage-new       { background: #EFF6FF; color: #1D4ED8; }
.stage-contacted { background: #FEF3C7; color: #92400E; }
.stage-qualified { background: #F5F3FF; color: #6D28D9; }
.stage-customer  { background: var(--success-tint); color: var(--success-dark); }
.stage-lost      { background: #F3F4F6; color: #6B7280; }

.st-draft     { background: #F3F4F6; color: #4B5563; }
.st-sent      { background: #EFF6FF; color: #1D4ED8; }
.st-partial   { background: #FEF3C7; color: #92400E; }
.st-paid      { background: var(--success-tint); color: var(--success-dark); }
.st-overdue   { background: var(--danger-tint); color: var(--danger-dark); }
.st-cancelled { background: #F3F4F6; color: #9CA3AF; }

/* ── Simple bar chart, no library ────────────────────────────────────────── */

.biz-chart {
    display: flex;
    align-items: flex-end;
    gap: .35rem;
    height: 8rem;
    padding: .5rem 0;
}
.biz-chart-col {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: .2rem;
    min-width: 0;
}
.biz-chart-bars {
    width: 100%;
    height: 6.2rem;
    display: flex; align-items: flex-end; justify-content: center; gap: 2px;
}
.biz-chart-bar {
    width: 45%;
    min-height: 2px;
    border-radius: 2px 2px 0 0;
    transition: height .3s ease;
}
.biz-chart-bar.in  { background: var(--success); }
.biz-chart-bar.out { background: #FCA5A5; }
.biz-chart-label {
    font-size: .62rem; color: var(--text-faint);
    white-space: nowrap; overflow: hidden;
}

.biz-legend { display: flex; gap: 1rem; font-size: .72rem; color: var(--text-muted); }
.biz-legend i { width: .7rem; height: .7rem; border-radius: 2px; display: inline-block; margin-right: .3rem; }

/* ── Category bars ───────────────────────────────────────────────────────── */

.biz-cat { margin-bottom: .55rem; }
.biz-cat-top {
    display: flex; justify-content: space-between;
    font-size: .78rem; margin-bottom: .2rem;
}
.biz-cat-name { color: var(--text); font-weight: 500; }
.biz-cat-val  { color: var(--text-muted); }
.biz-cat-track { height: .35rem; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.biz-cat-fill  { height: 100%; background: var(--brand); border-radius: 999px; }

/* ── Invoice builder ─────────────────────────────────────────────────────── */

.biz-items { width: 100%; border-collapse: collapse; font-size: .82rem; }
.biz-items th {
    text-align: left; padding: .4rem .45rem;
    font-size: .65rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted); font-weight: 700;
    border-bottom: 1px solid var(--border);
}
.biz-items td { padding: .3rem .25rem; vertical-align: middle; }
.biz-items input {
    width: 100%; padding: .35rem .45rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font: inherit; font-size: .82rem; background: var(--surface); color: var(--ink);
    outline: none;
}
.biz-items input:focus { border-color: var(--brand); }
.biz-items input[type=number] { text-align: right; }
.biz-items .col-del { width: 2rem; text-align: center; }

.biz-del {
    background: none; border: 0; cursor: pointer;
    color: var(--text-faint); font-size: 1rem; line-height: 1; padding: .2rem;
}
.biz-del:hover { color: var(--danger); }

.biz-totals { margin-left: auto; max-width: 17rem; font-size: .85rem; }
.biz-totals dl { display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem; }
.biz-totals dt { color: var(--text-muted); }
.biz-totals dd { text-align: right; font-weight: 600; margin: 0; }
.biz-totals .grand {
    border-top: 1px solid var(--border);
    padding-top: .45rem; margin-top: .3rem;
    font-size: 1.05rem; font-weight: 800;
}

/* Wide tables must scroll inside their card, never push the page sideways. */
.biz-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 640px) {
    .biz-toolbar { gap: .4rem; }
    .biz-stat .v { font-size: 1.2rem; }
}

/* ── Landing-page sections ───────────────────────────────────────────────
   Used by /crm, /invoice and
   /tracking whenever they grow the same sections. */

.biz-h2 {
    margin: 2.75rem 0 1.1rem;
    font-size: clamp(1.35rem, 3.4vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--ink);
}

/* A feature heading that is also a link still has to read as a heading —
   the underline appears on hover, not at rest. */
.biz-feature h3 a {
    color: inherit;
    text-decoration: none;
    border-bottom: 2px solid var(--brand-line);
}
.biz-feature h3 a:hover { border-bottom-color: var(--brand); color: var(--brand); }
.biz-feature p a { color: var(--brand); }

/* ── FAQ ─────────────────────────────────────────────────────────────────
   <details>, so it works with JavaScript off and needs no ARIA of our own.
   The answers are real text in the page, not hidden behind a script: an FAQ
   marked up as FAQPage but not visible to a reader is what gets structured
   data ignored. */

.biz-faq {
    max-width: 48rem;
    border-top: 1px solid var(--border);
}

.biz-faq-item { border-bottom: 1px solid var(--border); }

.biz-faq-item > summary {
    cursor: pointer;
    padding: .95rem .5rem .95rem 0;
    font-weight: 650;
    font-size: 1rem;
    color: var(--ink);
    list-style: none;
    position: relative;
    padding-right: 2rem;
}
.biz-faq-item > summary::-webkit-details-marker { display: none; }

/* The chevron is drawn rather than added as an element, so the markup stays
   the two tags a screen reader expects to find. */
.biz-faq-item > summary::after {
    content: "";
    position: absolute;
    right: .5rem; top: 1.25rem;
    width: .5rem; height: .5rem;
    border-right: 2px solid var(--text-faint);
    border-bottom: 2px solid var(--text-faint);
    transform: rotate(45deg);
    transition: transform .18s ease;
}
.biz-faq-item[open] > summary::after { transform: rotate(-135deg); top: 1.45rem; }
.biz-faq-item > summary:hover { color: var(--brand); }

.biz-faq-item > p {
    margin: 0 0 1.1rem;
    padding-right: 2rem;
    color: var(--text);
    line-height: 1.7;
}

/* ── Closing call to action ──────────────────────────────────────────── */

.biz-endcta {
    margin: 3rem 0 1rem;
    padding: 2.25rem 1.5rem;
    text-align: center;
    background: var(--brand-tint);
    border: 1px solid var(--brand-line);
    border-radius: var(--radius-lg, .75rem);
}
.biz-endcta h2 {
    margin: 0 0 .6rem;
    font-size: clamp(1.3rem, 3.2vw, 1.6rem);
    font-weight: 800;
    color: var(--ink);
}
.biz-endcta p {
    margin: 0 auto 1.35rem;
    max-width: 34rem;
    color: var(--text);
    line-height: 1.65;
}
.biz-endcta a { color: var(--brand); }
.biz-endcta .btn-signup { color: #fff; }
