/* Amroar CRM in the Salesforce Lightning look: Lightning's colours, type scale, cards, tables,
   buttons and header. Loaded last on every page, so it restyles the shared components.
   Salesforce's own typeface is not licensed for outside use; Lightning itself uses the system
   font stack below, so text renders the same way it does in Salesforce. */

:root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
  --bg: #f3f3f3 !important; --panel: #ffffff !important; --ink: #181818 !important; --muted: #5c5c5c !important;
  --line: #e5e5e5 !important; --line-strong: #c9c9c9;
  --accent: #0176d3 !important; --accent-ink: #ffffff !important; --accent-dark: #014486; --focus: #1b96ff;
  --ok: #2e844a !important; --ok-bg: #ebf7e6 !important; --warn: #8c4b02 !important; --warn-bg: #fef1cd !important;
  --err: #ba0517 !important; --err-bg: #fef1ee !important; --info-bg: #eef4ff !important;
  --radius: 4px !important;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji" !important;
  --shadow: 0 2px 2px 0 rgba(0, 0, 0, .1);
  --brand-band: #cfe9fe;
  color-scheme: light !important;
}

html { background: var(--bg); }
body { font: 13px/1.5 var(--font); color: var(--ink); background: var(--bg) linear-gradient(180deg, var(--brand-band) 0, #e5f2fd 120px, var(--bg) 260px) no-repeat; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }
.wrap { max-width: 1440px; padding-top: 12px; }

/* ---------- Page header (Lightning "page header" card with an object icon) ---------- */
header.top { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 16px; margin-bottom: 12px; gap: 12px; }
header.top h1 { font-size: 18px; font-weight: 700; line-height: 1.25; color: var(--ink); }
header.top .sub { color: var(--muted); font-size: 13px; }
.lx-eyebrow { display: block; font-size: 12px; color: var(--muted); line-height: 1.2; }
.lx-title { display: flex; flex-direction: column; }
.lx-icon { flex: none; width: 32px; height: 32px; border-radius: 4px; display: grid; place-items: center; color: #fff; }
.lx-icon svg { width: 20px; height: 20px; fill: currentColor; }
.lx-lead { background: #f88962; } .lx-account { background: #5867e8; } .lx-contact { background: #a094ed; }
.lx-report { background: #2ecbbe; } .lx-bot { background: #3ba755; } .lx-setup { background: #747474; }

/* ---------- Cards, tiles, panels ---------- */
.panel, .tile, .card, .side, .draft, nav.settings-nav, .convo, .auth-card {
  background: var(--panel); border: 1px solid var(--line-strong) !important; border-radius: var(--radius) !important; box-shadow: var(--shadow); }
.panel { padding: 12px 16px 16px; }
.panel h2, .card h3 { font-size: 14px; font-weight: 700; color: var(--ink); }
.panel .hint, .hint { color: var(--muted); font-size: 13px; }
.tiles { gap: 12px; }
.tile { padding: 12px 16px; display: block; transition: border-color .1s; }
a.tile:hover { border-color: var(--accent) !important; text-decoration: none; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 24px; font-weight: 300; letter-spacing: -.01em; color: var(--ink); }
.tile .s { font-size: 12px; color: var(--muted); }

/* ---------- Data tables ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); }
table { font-size: 13px; }
th { background: #f3f3f3; color: #444444; font-size: 12px; font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line-strong); }
td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
tbody tr:hover td { background: #f3f3f3; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Buttons (neutral, brand, destructive) ---------- */
button.btn, a.btn { font: inherit; font-size: 13px; line-height: 30px; padding: 0 16px; min-height: 32px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: #fff; color: var(--accent); font-weight: 400; cursor: pointer; display: inline-flex; align-items: center; }
button.btn:hover, a.btn:hover { background: #f3f3f3; border-color: var(--line-strong); color: var(--accent-dark); text-decoration: none; }
button.btn:focus-visible, a.btn:focus-visible { outline: 0; box-shadow: 0 0 3px var(--accent); border-color: var(--focus); }
button.primary, button.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, button.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
button.danger, button.btn.danger { background: #fff; color: var(--err); border-color: var(--line-strong); }
button.danger:hover { background: var(--err); color: #fff; border-color: var(--err); }
button.armed { background: var(--err) !important; color: #fff !important; border-color: var(--err) !important; }
button.small, button.btn.small { line-height: 22px; min-height: 24px; padding: 0 10px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
.linkish { color: var(--accent); text-decoration: none !important; }
.linkish:hover { text-decoration: underline !important; }

/* ---------- Form elements ---------- */
label { font-size: 12px; color: #444; }
input, select, textarea { font: inherit; font-size: 13px; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0 12px; min-height: 32px; background: #fff; color: var(--ink); }
textarea { padding: 8px 12px; }
input[type=checkbox] { min-height: 0; accent-color: var(--accent); width: 14px; height: 14px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--focus); box-shadow: 0 0 3px var(--accent); }

/* ---------- Labels instead of capsules ---------- */
.chip, .ch, .tag-replied { border-radius: 2px !important; padding: 1px 6px !important; font-size: 11px !important; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase; background: #ecebea; color: #3e3e3c; border: 0; line-height: 16px; }
.chip-ok { background: #2e844a; color: #fff; } .chip-warn { background: #fe9339; color: #181818; }
.chip-err { background: #ba0517; color: #fff; } .chip-info { background: var(--accent); color: #fff; }
.nav .count, nav.tabs .count, .side a.nav .count { border-radius: 2px !important; background: var(--accent); color: #fff; }

/* ---------- Inline messages (Lightning alerts) ---------- */
.msg { border-radius: var(--radius); padding: 8px 12px; border: 1px solid transparent; border-left-width: 4px; font-size: 13px; }
.msg-ok { background: var(--ok-bg); color: #194e31; border-color: #2e844a; }
.msg-err { background: var(--err-bg); color: #8e030f; border-color: #ba0517; }
.msg-info { background: #fff; color: var(--ink); border-color: #747474; }
.banner { border-radius: var(--radius); border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.banner-err { border-left-color: var(--err); background: var(--err-bg); color: #8e030f; }
.banner-info { border-left-color: var(--accent); background: #fff; }

/* ---------- Tabs ---------- */
nav.tabs, .subtabs { border-bottom: 1px solid var(--line-strong); }
nav.tabs a, .subtabs button { color: #444; font-size: 13px; padding: 10px 12px; border-bottom: 3px solid transparent; }
nav.tabs a.on, .subtabs button.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.seg { border-radius: var(--radius); border-color: var(--line-strong); }
.seg button { color: var(--accent); font-size: 13px; }
.seg button.on { background: var(--accent); color: #fff; }

/* ---------- Vertical navigation (Settings, AI Agents list) ---------- */
nav.settings-nav { padding: 8px 0; }
nav.settings-nav .nav-group, .side h3 { font-size: 12px; font-weight: 700; text-transform: none; letter-spacing: 0; color: #444; padding: 12px 16px 4px; margin: 0; }
nav.settings-nav a { border-radius: 0; border-left: 3px solid transparent; padding: 6px 16px 6px 13px; color: var(--ink); font-weight: 400; }
nav.settings-nav a:hover { background: #f3f3f3; text-decoration: none; }
nav.settings-nav a.on { background: #eef4ff; border-left-color: var(--accent); color: var(--accent); font-weight: 700; }
.side a.nav { border-radius: 0; border-left: 3px solid transparent; }
.side a.nav.on { background: #eef4ff; border-left-color: var(--accent); color: var(--accent); }
.agent-link { border-radius: 0; } .agent-link.on { background: #eef4ff; box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- Pagination ---------- */
.pg { border: 1px solid var(--line-strong); background: #fff; color: var(--accent); border-radius: var(--radius); min-height: 28px; }
.pg:hover:not(:disabled) { background: #f3f3f3; }
.pg-on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Detail panels (record "details" layout) ---------- */
.detail dl { gap: 0 16px; }
.detail dt, .detail dd { padding: 6px 0; border-bottom: 1px solid var(--line); }
.detail dt { font-size: 12px; color: var(--muted); }
.raw { border-radius: var(--radius); background: #fafaf9; }
fieldset.purposes { border-color: var(--line-strong); border-radius: var(--radius); }

/* ---------- Sign-in pages (Salesforce login look) ---------- */
body.auth-page { background: #f3f3f3; }
.auth-card { box-shadow: none; padding: 28px 28px 24px; }
.auth-card h1 { font-size: 20px; font-weight: 300; }
.auth-card .btn.primary { justify-content: center; font-size: 14px; min-height: 40px; }
.auth-logo { width: 96px; border-radius: 8px; }

/* ---------- Conversations ---------- */
.bubble { border-radius: 8px; }
.av { border-radius: 4px; background: #a094ed; color: #fff; }

@media (max-width: 860px) { header.top { padding: 10px 12px; } }

/* CRM summary tiles: a tidy 4-across highlights row, 2-across on phones. */
#p-tiles, #c-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) { #p-tiles, #c-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
