/* CRM pages: the look Ariel picked from the lead board mockup (2026-10-14).
   AdminLayout puts class "crm" on the page container for CRM pages only; everything
   here is scoped under it so the rest of the admin is untouched. */

.crm {
    --crm-bg: #f4f5fa;
    --crm-panel: #ffffff;
    --crm-col: #e9ebf4;
    --crm-ink: #1d2250;
    --crm-muted: #646a8a;
    --crm-line: #dcdfeb;
    --crm-navy: #22285C;
    --crm-late-bg: #fff7e6;
    --crm-late: #b86f00;
    --crm-good: #1f9d5b;
    --crm-bad: #d23c3c;
    --crm-src-call: #e23b3b;
    --crm-src-cart: #ef7d1a;
    --crm-src-fb: #1f6fe0;
    --crm-src-ig: #c2368f;
    --crm-src-phone: #1f9d5b;
    --crm-src-web: #6b4fd8;
    --crm-display: "Fredoka", "Trebuchet MS", sans-serif;
    --crm-body: "Nunito Sans", "Segoe UI", system-ui, sans-serif;

    font-family: var(--crm-body) !important;
    color: var(--crm-ink);
    letter-spacing: 0;
}

/* The admin layout forces Segoe UI on everything; take it back inside CRM pages. */
.crm, .crm .mud-typography, .crm .mud-button-root, .crm .mud-input, .crm .mud-table,
.crm .mud-tab, .crm .mud-chip, .crm input, .crm textarea, .crm select, .crm button {
    font-family: var(--crm-body) !important;
    letter-spacing: 0 !important;
}

/* ---- Headings ---- */
.crm .mud-typography-h4, .crm .mud-typography-h5, .crm h1.crm-title {
    font-family: var(--crm-display) !important;
    font-weight: 600 !important;
    color: var(--crm-navy);
    text-wrap: balance;
}
.crm .mud-typography-h4, .crm h1.crm-title { font-size: 1.9rem; line-height: 1.2; margin: 0; }
.crm .mud-typography-h5 { font-size: 1.5rem; }
.crm .mud-typography-h6 { font-weight: 800 !important; color: var(--crm-ink); }
.crm .mud-typography-body2.mud-secondary-text, .crm .crm-sub { color: var(--crm-muted) !important; max-width: 75ch; }

/* ---- Surfaces: flat panels with a hairline, no drop shadows ---- */
.crm .mud-paper:not(.mud-popover):not(.mud-dialog) {
    border-radius: 12px !important;
    box-shadow: none !important;
    border: 1px solid var(--crm-line);
}
.crm .mud-paper.mud-paper-outlined { border-color: var(--crm-line) !important; }
.crm .mud-card { border-radius: 12px !important; box-shadow: none !important; border: 1px solid var(--crm-line); }

/* ---- Buttons: rounded, bold, no shouting capitals ---- */
.crm .mud-button-root.mud-button {
    border-radius: 8px !important;
    text-transform: none !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}
.crm .mud-button-filled.mud-button-filled-primary { background: var(--crm-navy) !important; }
.crm .mud-button-outlined { border-color: var(--crm-line) !important; }

/* ---- Chips and tabs as pills ---- */
.crm .mud-chip { border-radius: 999px !important; font-weight: 700; }
.crm .mud-tabs-tabbar { background: transparent !important; }
.crm .mud-tab { text-transform: none !important; font-weight: 700 !important; border-radius: 8px 8px 0 0; }
.crm .mud-tab.mud-tab-active { color: var(--crm-navy) !important; }
.crm .mud-toggle-group { border-radius: 999px !important; overflow: hidden; }
.crm .mud-toggle-item { text-transform: none !important; font-weight: 700 !important; }

/* ---- Tables: calm header, roomy rows, no zebra noise ---- */
.crm .mud-table { border-radius: 12px; overflow: hidden; }
.crm .mud-table-head .mud-table-cell {
    background: var(--crm-col) !important;
    color: var(--crm-muted) !important;
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em !important;
}
.crm .mud-table-striped .mud-table-row:nth-of-type(odd) { background: transparent !important; }
.crm .mud-table-row:hover { background: #f7f8fc !important; }
.crm .mud-table-cell { border-color: var(--crm-line) !important; }

/* ---- Inputs ---- */
.crm .mud-input-outlined-border { border-radius: 8px !important; border-color: var(--crm-line) !important; }

/* ---- Shared CRM pieces ---- */
.crm-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crm-pill {
    border: 1px solid var(--crm-line); background: var(--crm-panel); color: var(--crm-ink);
    border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 13px; cursor: pointer;
    display: inline-flex; gap: 6px; align-items: center; line-height: 1.3;
}
.crm-pill .dot { width: 9px; height: 9px; border-radius: 50%; }
.crm-pill .n { color: var(--crm-muted); font-weight: 700; }
.crm-pill.on { background: var(--crm-navy); color: #fff; border-color: var(--crm-navy); }
.crm-pill.on .n { color: inherit; opacity: 0.75; }
.crm-seg { display: inline-flex; border: 1px solid var(--crm-line); border-radius: 8px; overflow: hidden; background: var(--crm-panel); flex-wrap: wrap; }
.crm-seg button { border: 0; background: transparent; color: var(--crm-ink); padding: 6px 12px; font-weight: 700; font-size: 13px; cursor: pointer; }
.crm-seg button.on { background: var(--crm-col); color: var(--crm-navy); }
.crm-chip {
    justify-self: start; align-self: start; background: var(--c, var(--crm-navy)); color: #fff;
    border-radius: 999px; padding: 1px 9px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.02em; line-height: 1.6;
}
.crm-btn {
    border: 1px solid var(--crm-line); background: var(--crm-panel); color: var(--crm-ink);
    border-radius: 8px; padding: 6px 12px; font-weight: 700; font-size: 13px; cursor: pointer; line-height: 1.3;
}
.crm-btn.primary { background: var(--crm-navy); color: #fff; border-color: var(--crm-navy); }
.crm-btn.good { color: var(--crm-good); }
.crm-btn.bad { color: var(--crm-bad); }
.crm-btn.on { background: var(--crm-navy); color: #fff; border-color: var(--crm-navy); }
.crm-btn:disabled { opacity: 0.5; cursor: default; }
.crm-pill:focus-visible, .crm-btn:focus-visible, .crm-seg button:focus-visible, .lb-card:focus-visible {
    outline: 3px solid var(--crm-src-web); outline-offset: 2px;
}
.crm-box { border: 1px solid var(--crm-line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; background: var(--crm-panel); }
.crm-box > h4 { margin: 0; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--crm-muted); font-weight: 800; }
.crm-muted { color: var(--crm-muted); }

/* Source colours, one per place a lead can come from. */
.src-call_request { --c: var(--crm-src-call); }
.src-abandoned_cart { --c: var(--crm-src-cart); }
.src-meta_form { --c: var(--crm-src-fb); }
.src-instagram { --c: var(--crm-src-ig); }
.src-missed_call { --c: var(--crm-src-phone); }
.src-website { --c: var(--crm-src-web); }

/* MudBlazor's "secondary" text is the brand pink; on CRM pages hints and fine print read as calm grey instead. */
.crm .mud-typography.mud-secondary-text, .crm .mud-input-helper-text { color: var(--crm-muted) !important; }

/* Tabs across the top of a grouped CRM page (Messaging, Reviews, Customers): big enough to read at a glance. */
.crm-tabs {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; padding: 6px;
    background: var(--crm-col); border-radius: 14px; width: max-content; max-width: 100%;
}
.crm-tab {
    padding: 10px 20px; font: 600 1.05rem var(--crm-display); color: var(--crm-ink) !important; text-decoration: none !important;
    border-radius: 10px; letter-spacing: 0; background: var(--crm-panel); border: 2px solid var(--crm-line);
}
.crm-tab:hover { border-color: var(--crm-navy); }
.crm-tab.on { background: var(--crm-navy); border-color: var(--crm-navy); color: #fff !important; }
.crm-tab:focus-visible { outline: 3px solid var(--crm-src-web); outline-offset: 2px; }

/* Grouped pages (Customers, Messaging, Reviews): page heading, then the tabs, then the chosen tab's page,
   whose own heading becomes a section heading and whose container lines up with the tabs. */
.crm-hub { display: grid; gap: 6px; }
.crm-hub > .crm-sub { margin: 0 0 8px; }
.crm-hub > .crm-tabs { margin-bottom: 8px; }
.crm-hub-body .mud-container { max-width: none !important; padding-left: 0 !important; padding-right: 0 !important; margin-top: 0 !important; }
.crm-hub-body .mud-typography-h4, .crm-hub-body h1.crm-title { font-size: 1.35rem !important; color: var(--crm-ink) !important; }

/* Greyed-out (disabled) filled buttons keep readable text. */
.crm .mud-button-filled.mud-button-filled-primary:disabled,
.crm .mud-button-filled.mud-button-filled-primary.mud-button-disabled { background: #b9bdd6 !important; color: #fff !important; }
.crm .crm-btn.primary:disabled { background: #b9bdd6; border-color: #b9bdd6; color: #fff; }

/* Every CRM page lines up on the left edge, like the grouped pages; widths stay as each page set them. */
.crm .mud-container { margin-left: 0 !important; padding-left: 0 !important; padding-right: 0 !important; }

/* Simple tables get the same calm header as the big ones. */
.crm .mud-simple-table thead th {
    background: var(--crm-col) !important; color: var(--crm-muted) !important; font-size: 0.75rem !important;
    font-weight: 800 !important; text-transform: uppercase; letter-spacing: 0.06em !important;
}
