/* ============================================================================
   ICS Lead Management Platform — Design System
   ----------------------------------------------------------------------------
   A modern, professional interface built on a small set of design tokens.
   Works with Django templates + HTMX. Light theme with subtle depth.
   ============================================================================ */

/* --- Design tokens -------------------------------------------------------- */
:root {
    /* Surfaces */
    --bg: #eef2ed;
    --bg-surface: #fffefa;
    --bg-subtle: #f7f9f5;
    --bg-inset: #e8eee8;

    /* Text */
    --text: #17231c;
    --text-muted: #627068;
    --text-dim: #98a69d;

    /* Lines */
    --border: #dce5dd;
    --border-light: #eaf0ea;

    /* Brand */
    --accent: #2f756a;
    --accent-hover: #245e56;
    --accent-soft: #e1f0eb;
    --accent-deep: #174a43;
    --accent-loud: #c6ed77;

    /* Semantic */
    --success: #4d8b5c;
    --success-soft: #edf7ee;
    --success-border: #c5e4c9;
    --warning: #b8792f;
    --warning-soft: #fff7e8;
    --warning-border: #f4d9a6;
    --danger: #b8564c;
    --danger-soft: #fff0ee;
    --danger-border: #efc5c0;
    --info: #397d9a;
    --info-soft: #edf6f8;
    --info-border: #c8e2e7;

    /* Header */
    --sidebar-bg: #14221b;
    --sidebar-text: #b9c8bd;
    --sidebar-muted: #7f9385;
    --header-bg: #14221b;
    --header-text: #c8d4ca;

    /* Shape & depth */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(23, 35, 28, .05);
    --shadow: 0 7px 22px rgba(23, 35, 28, .055), 0 1px 2px rgba(23, 35, 28, .04);
    --shadow-lg: 0 16px 42px rgba(23, 35, 28, .13);
    --shadow-focus: 0 0 0 3px rgba(47, 117, 106, .2);

    /* Motion */
    --ease: cubic-bezier(.4, 0, .2, 1);
}

/* --- Reset & base --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); }
img { max-width: 100%; display: block; }

::selection { background: var(--accent); color: #fff; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

/* Focus visibility for accessibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* --- App shell ------------------------------------------------------------- */
.app-shell { display: flex; height: 100%; min-height: 100vh; }
.app-frame { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    height: 60px;
    background: var(--header-bg);
    color: var(--header-text);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 2px 10px rgba(30, 27, 75, .35);
    flex-shrink: 0;
    position: relative;
    z-index: 50;
}

.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: #fff;
}
.brand-mark {
    width: 32px; height: 32px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    color: #fff; font-size: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
    flex-shrink: 0;
}
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.app-tagline { font-size: 11px; opacity: .65; font-weight: 500; letter-spacing: .02em; }

.header-nav { display: flex; gap: 2px; align-items: center; }
.nav-link {
    color: var(--header-text);
    text-decoration: none;
    padding: 7px 13px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    opacity: .78;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: opacity .15s var(--ease), background .15s var(--ease);
}
.nav-link:hover { opacity: 1; background: rgba(255, 255, 255, .09); }
.nav-link.active {
    opacity: 1;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,.12) inset;
}
.nav-sep { width: 1px; height: 20px; background: rgba(255,255,255,.14); margin: 0 4px; }
.nav-link--secondary { opacity: .5; font-size: 12px; }
.nav-link--secondary:hover { opacity: .85; }

.header-right { display: flex; align-items: center; gap: 12px; }
.user-chip {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12.5px; font-weight: 500;
    color: var(--header-text);
    padding: 4px 10px 4px 4px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
}
.user-avatar {
    width: 24px; height: 24px; border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 11px; font-weight: 700;
}

/* --- Sidebar navigation ---------------------------------------------------- */
.app-sidebar {
    width: 236px;
    flex: 0 0 236px;
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 18px 12px 14px;
    position: relative;
    z-index: 60;
    transition: width .22s var(--ease), flex-basis .22s var(--ease), transform .22s var(--ease);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px 18px; }
.app-sidebar .brand { gap: 10px; min-width: 0; }
.app-sidebar .brand-mark {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--accent-loud); border: none; color: var(--sidebar-bg);
    box-shadow: 0 5px 14px rgba(198, 237, 119, .12);
}
.app-sidebar .brand-name { color: #f7fbf4; font-size: 17px; }
.app-sidebar .app-tagline { display: block; color: var(--sidebar-muted); font-size: 10px; line-height: 1.2; }
.sidebar-collapse, .sidebar-toggle {
    border: 1px solid transparent; background: transparent; color: var(--sidebar-muted);
    cursor: pointer; border-radius: 7px; font: inherit;
}
.sidebar-collapse { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-collapse:hover { color: #f7fbf4; background: rgba(255,255,255,.08); }
.sidebar-status {
    display: flex; align-items: center; gap: 7px;
    padding: 8px 10px; margin: 0 3px 21px;
    color: var(--sidebar-muted); border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.sidebar-team-switcher {
    margin: -7px 3px 17px; padding: 9px 9px 8px;
    background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.09); border-radius: 9px;
}
.sidebar-team-label {
    display: flex; align-items: center; gap: 6px; margin-bottom: 5px;
    color: var(--sidebar-muted); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.sidebar-team-switcher form { margin: 0; }
.sidebar-team-switcher select {
    width: 100%; min-width: 0; padding: 6px 7px; border: 1px solid rgba(255,255,255,.13); border-radius: 6px;
    background: rgba(0,0,0,.16); color: #f7fbf4; font: 600 11px/1.2 "Manrope", sans-serif;
}
.sidebar-team-switcher select:focus { outline: 2px solid var(--accent-loud); outline-offset: 1px; }
.sidebar-team-manage {
    display: flex; align-items: center; gap: 6px; margin-top: 7px;
    color: var(--sidebar-muted); font-size: 10px; text-decoration: none;
}
.sidebar-team-manage:hover { color: var(--accent-loud); }
.live-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--accent-loud); box-shadow: 0 0 0 3px rgba(198,237,119,.12); flex-shrink: 0; }
.sidebar-scroll { overflow-y: auto; min-height: 0; flex: 1; padding: 0 3px; }
.sidebar-section-label {
    color: var(--sidebar-muted); font-size: 9.5px; font-weight: 800;
    letter-spacing: .13em; text-transform: uppercase; padding: 0 10px 8px;
}
.sidebar-section-label:not(:first-child) { padding-top: 22px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar-link, .sidebar-logout {
    min-height: 38px; display: flex; align-items: center; gap: 11px;
    padding: 8px 10px; border-radius: 8px; border: 1px solid transparent;
    color: var(--sidebar-text); text-decoration: none; font-size: 12.5px; font-weight: 600;
    transition: background .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.sidebar-link i, .sidebar-logout i { width: 18px; text-align: center; font-size: 15px; color: var(--sidebar-muted); flex-shrink: 0; }
.sidebar-link:hover, .sidebar-logout:hover { color: #f7fbf4; background: rgba(255,255,255,.075); }
.sidebar-link:hover i, .sidebar-logout:hover i { color: var(--accent-loud); }
.sidebar-link.active {
    color: var(--sidebar-bg); background: var(--accent-loud); box-shadow: 0 5px 14px rgba(198,237,119,.1);
}
.sidebar-link.active i { color: var(--sidebar-bg); }
.sidebar-link--muted { color: var(--sidebar-muted); }
.sidebar-menu-group { position: relative; }
.sidebar-menu-group > .sidebar-link { padding-right: 38px; }
.sidebar-submenu-toggle {
    position: absolute; top: 6px; right: 6px; z-index: 1;
    width: 27px; height: 27px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 6px;
    color: var(--sidebar-muted); background: transparent;
    cursor: pointer;
}
.sidebar-submenu-toggle:hover { color: var(--accent-loud); background: rgba(255,255,255,.09); }
.sidebar-submenu-toggle:focus-visible { outline: 2px solid var(--accent-loud); outline-offset: 1px; }
.sidebar-menu-group > .sidebar-link.active + .sidebar-submenu-toggle { color: var(--sidebar-bg); }
.sidebar-menu-group > .sidebar-link.active + .sidebar-submenu-toggle:hover { background: rgba(20,34,27,.12); }
.sidebar-submenu-toggle i { font-size: 11px; transition: transform .18s var(--ease); }
.sidebar-menu-group.is-open > .sidebar-submenu-toggle i { transform: rotate(180deg); }
.sidebar-subnav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 1px 0 5px 22px;
    padding: 3px 0 3px 13px;
    border-left: 1px solid rgba(198, 237, 119, .25);
}
.sidebar-subnav[hidden] { display: none !important; }
.sidebar-subnav a {
    position: relative;
    padding: 5px 8px;
    border-radius: 5px;
    color: var(--sidebar-muted);
    font-size: 10.5px;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
}
.sidebar-subnav a::before { content: ""; position: absolute; left: -14px; top: 50%; width: 6px; height: 1px; background: rgba(198, 237, 119, .25); }
.sidebar-subnav a:hover { color: #f7fbf4; background: rgba(255,255,255,.06); }
.sidebar-subnav a.active { color: var(--accent-loud); background: rgba(198,237,119,.08); }
.sidebar-badge {
    margin-left: auto; min-width: 19px; padding: 1px 5px; border-radius: 10px;
    color: #fff; background: #b8564c; font-size: 10px; font-weight: 800; text-align: center;
}
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.1); padding: 14px 3px 0; margin-top: 14px; }
.sidebar-user { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 3px 7px 11px; }
.sidebar-user .user-avatar { width: 29px; height: 29px; background: rgba(198,237,119,.16); color: var(--accent-loud); flex-shrink: 0; }
.sidebar-user-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-user-copy strong { color: #f7fbf4; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy small { color: var(--sidebar-muted); font-size: 10px; }
.sidebar-footer form { margin: 0; }
.sidebar-logout { width: 100%; background: transparent; cursor: pointer; font-family: inherit; text-align: left; }
.sidebar-logout i { font-size: 14px; }

/* --- Topbar ----------------------------------------------------------------- */
.app-topbar {
    height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 0 28px; background: rgba(255,254,250,.9); border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px); position: relative; z-index: 40;
}
.topbar-leading, .topbar-actions { display: flex; align-items: center; gap: 13px; min-width: 0; }
.sidebar-toggle { display: none; width: 34px; height: 34px; color: var(--text-muted); font-size: 20px; }
.sidebar-toggle:hover { background: var(--bg-inset); color: var(--text); }
.topbar-context { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.topbar-kicker { color: var(--text-dim); font: 500 9.5px/1.2 "IBM Plex Mono", monospace; letter-spacing: .07em; text-transform: uppercase; }
.topbar-title { color: var(--text); font-size: 16px; font-weight: 800; letter-spacing: -.025em; }
.topbar-search {
    display: inline-flex; align-items: center; gap: 9px; min-width: 180px; padding: 8px 10px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--bg-subtle); color: var(--text-muted);
    cursor: pointer; font: 500 12px/1.2 inherit; text-align: left;
}
.topbar-search:hover { border-color: #b7cbbd; background: var(--bg-surface); color: var(--text); }
.topbar-search i { color: var(--accent); }
.topbar-search kbd { margin-left: auto; padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-surface); color: var(--text-dim); font: 500 10px "IBM Plex Mono", monospace; }
.topbar-live { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 11px; font-weight: 700; }
.topbar-live .live-dot { width: 6px; height: 6px; background: var(--success); box-shadow: none; }

.sidebar-scrim { display: none; }

/* --- Main shell ------------------------------------------------------------ */
.app-main {
    width: 100%; max-width: 1680px; margin: 0 auto;
    padding: 22px 28px 24px;
    height: calc(100vh - 68px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Buttons --------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s var(--ease), border-color .15s var(--ease),
                box-shadow .15s var(--ease), transform .05s var(--ease);
    user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-lg { padding: 11px 20px; font-size: 14.5px; border-radius: 10px; }
.btn-full { width: 100%; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 1px 2px rgba(79, 70, 229, .35);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:focus-visible { box-shadow: var(--shadow-focus); }

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-inset); border-color: #cbd5e1; }

.btn-success {
    background: var(--success);
    color: #fff; border-color: var(--success);
    box-shadow: 0 1px 2px rgba(5, 150, 105, .3);
}
.btn-success:hover:not(:disabled) { background: #1D583A; }

.btn-danger {
    background: var(--danger);
    color: #fff; border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #8F2525; }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-inset); color: var(--text); }
.header-right .btn-ghost { color: var(--header-text); border-color: rgba(255, 255, 255, .2); background: transparent; }
.header-right .btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* --- Inputs & forms -------------------------------------------------------- */
.input {
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder { color: var(--text-dim); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
.input-sm { padding: 6px 9px; font-size: 12.5px; }
.input-full { width: 100%; }
.input[readonly] { background: var(--bg-subtle); color: var(--text-muted); }
textarea.input { resize: vertical; line-height: 1.55; }
select.input { cursor: pointer; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

.field-label {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 5px;
}
.field-hint { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }

.check-label {
    display: flex; align-items: flex-start; gap: 9px;
    padding: 5px 0; font-size: 13px; cursor: pointer; color: var(--text);
}
.check-label input[type="checkbox"] { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; }
.check-label input[type="radio"] { accent-color: var(--accent); }

/* --- Cards & sections ------------------------------------------------------ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.card-header h3 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }

/* --- Stats row ------------------------------------------------------------- */
.dashboard-intro {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
    padding: 0 2px 2px; flex-shrink: 0;
}
.eyebrow {
    display: block; color: var(--accent); font: 600 10px/1.2 "IBM Plex Mono", monospace;
    letter-spacing: .12em; text-transform: uppercase; margin-bottom: 5px;
}
.dashboard-intro h1 { font-size: 26px; line-height: 1.1; letter-spacing: -.045em; font-weight: 800; }
.dashboard-intro p { color: var(--text-muted); font-size: 12.5px; margin-top: 6px; }
.intro-signal {
    display: flex; align-items: center; gap: 9px; padding: 9px 11px;
    border: 1px solid var(--border); border-radius: 9px; background: rgba(255,254,250,.65); flex-shrink: 0;
}
.intro-signal > span:last-child { display: flex; flex-direction: column; gap: 1px; }
.intro-signal strong { color: var(--text); font-size: 11.5px; }
.intro-signal small { color: var(--text-dim); font-size: 10px; }
.intro-signal--linkedin { border-color: #cfe0ea; background: #f6fafb; }
.intro-signal--linkedin .live-dot { background: #0a66c2; box-shadow: 0 0 0 3px rgba(10,102,194,.12); }
.stats-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    flex-shrink: 0;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 13px;
    position: relative;
    overflow: hidden;
    transition: box-shadow .15s var(--ease), transform .15s var(--ease), border-color .15s var(--ease);
}
.stat-card::after {
    content: "";
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--border);
    opacity: .8;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card--accent::after { background: var(--accent); }
.stat-card--metric::after { background: var(--success); }
.stat-card--warn::after { background: var(--warning); }

.stat-icon {
    width: 42px; height: 42px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-inset); color: var(--text-muted);
    font-size: 18px; flex-shrink: 0;
}
.stat-card--accent .stat-icon { background: var(--accent-soft); color: var(--accent); }
.stat-card--metric .stat-icon { background: var(--success-soft); color: var(--success); }
.stat-card--warn .stat-icon { background: var(--warning-soft); color: var(--warning); }

.stat-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stat-value {
    font-size: 21px; font-weight: 800; letter-spacing: -.02em;
    color: var(--text); line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.stat-value small { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.stat-label { font-size: 10.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-sub { font-size: 11px; color: var(--text-dim); font-weight: 500; }

/* --- KPI strip (dashboard) --------------------------------------------------
   Single bordered row with internal dividers instead of 6 separate cards —
   the numbers carry the hierarchy instead of 6 repeated card chromes. */
.kpi-strip {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    overflow: hidden;
}
.kpi {
    flex: 1;
    display: flex; align-items: center; gap: 12px;
    padding: 13px 16px;
    border-right: 1px solid var(--border-light);
    min-width: 0;
}
.kpi:last-child { border-right: none; }
.kpi-icon {
    width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-inset); color: var(--text-muted); font-size: 17px;
}
.kpi--primary .kpi-icon { background: var(--accent-soft); color: var(--accent); }
.kpi--success .kpi-icon { background: var(--success-soft); color: var(--success); }
.kpi--warn .kpi-icon { background: var(--warning-soft); color: var(--warning); }
.kpi--danger .kpi-icon { background: var(--danger-soft); color: var(--danger); }
.kpi--accent-soft .kpi-icon { background: var(--accent-soft); color: var(--accent); }

.kpi-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.kpi-value { font-size: 20px; font-weight: 800; letter-spacing: -.02em; color: var(--text); line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.kpi-label { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.kpi-sub { font-size: 10.5px; color: var(--text-dim); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.metric-rail {
    display: flex; align-items: center; gap: 0; min-height: 31px; padding: 0 4px;
    color: var(--text-muted); font-size: 10.5px; flex-shrink: 0;
}
.metric-rail span { display: inline-flex; align-items: center; gap: 5px; padding: 0 14px; border-right: 1px solid var(--border); white-space: nowrap; }
.metric-rail span:first-child { padding-left: 3px; }
.metric-rail span:last-child { border-right: 0; }
.metric-rail i { color: var(--accent); }
.metric-rail strong { color: var(--text); font: 600 11px "IBM Plex Mono", monospace; }

@media (max-width: 1280px) {
    .kpi-strip { flex-wrap: wrap; }
    .kpi { flex: 1 1 33.33%; border-bottom: 1px solid var(--border-light); }
}

/* --- Quick actions bar ----------------------------------------------------- */
.quick-actions {
    display: flex;
    align-items: center; justify-content: space-between; gap: 12px;
    padding: 9px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap; flex-shrink: 0;
}
.quick-actions-primary, .quick-actions-secondary { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.quick-actions-secondary { margin-left: auto; gap: 12px; }
.action-caption { color: var(--text-dim); font: 600 9.5px "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.quick-link { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 11px; font-weight: 700; text-decoration: none; }
.quick-link:hover { color: var(--accent); }
.quick-actions-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
#action-result {
    margin-left: auto;
    font-size: 12.5px; font-weight: 500;
    color: var(--success);
    display: flex; align-items: center; gap: 6px;
    max-width: 420px;
}
#action-result:empty { display: none; }

/* --- Dashboard body (two panels) -------------------------------------------- */
.dashboard {
    display: flex; flex-direction: column;
    gap: 12px; flex: 1; min-height: 0;
}
.dashboard-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 540px;
    gap: 14px;
    flex: 1; min-height: 0;
}
.dashboard-body > * { height: 100%; min-height: 0; overflow: hidden; }

/* --- Lead list panel -------------------------------------------------------- */
.lead-list-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; overflow: hidden;
}
.panel-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; flex-wrap: wrap; flex-shrink: 0;
}
.panel-title { display: flex; align-items: center; gap: 8px; }
.panel-title h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.panel-context {
    color: var(--text-dim);
    font-size: 11px;
    margin-left: auto;
    white-space: nowrap;
}
.panel-count {
    font-size: 11px; font-weight: 700;
    background: var(--accent-soft); color: var(--accent);
    padding: 2px 8px; border-radius: 12px;
}
.filter-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filter-bar .input { min-width: 120px; }
.filter-bar input[name="search"] { min-width: 170px; flex: 1; }

.filter-toolbar { display: flex; flex-direction: column; }

/* "More filters" disclosure — pure CSS (checkbox hack), so the secondary
   filters (source, email/phone presence, category, tag, dates) stay out of
   the way until asked for, without an absolutely-positioned popover that
   would get clipped by the panel's overflow:hidden. */
.filter-more-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 11px;
    font-size: 12.5px; font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-subtle);
    border: 1px dashed var(--border);
    border-radius: 8px;
    cursor: pointer; user-select: none; white-space: nowrap;
    transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.filter-more-toggle:hover { background: var(--bg-inset); color: var(--text); }
.filter-more-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.more-filters-checkbox {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.filter-toolbar:has(.more-filters-checkbox:checked) .filter-more-toggle {
    color: var(--accent); border-color: var(--accent); background: var(--accent-soft);
}
.filter-toolbar:has(.more-filters-checkbox:focus-visible) .filter-more-toggle {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

.filter-more-panel {
    display: none;
    gap: 6px; align-items: center; flex-wrap: wrap;
    padding: 10px 2px 0;
    margin-top: 8px;
    border-top: 1px dashed var(--border-light);
}
.more-filters-checkbox:checked ~ .filter-more-panel { display: flex; }
.filter-more-panel .input { min-width: 130px; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    font-size: 12px; font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    cursor: pointer; user-select: none;
    transition: background .15s, color .15s, border-color .15s;
}
.filter-chip input { accent-color: var(--accent); cursor: pointer; }
.filter-chip:has(input:checked) {
    background: var(--accent-soft); color: var(--accent); border-color: var(--accent);
}
.filter-clear {
    display: inline-flex; align-items: center;
    color: var(--text-dim); text-decoration: none;
    padding: 4px 8px; border-radius: 10px;
}
.filter-clear:hover { color: var(--danger); background: var(--danger-soft); }

#lead-table-container { overflow-y: auto; flex: 1; }

/* --- Dedicated LinkedIn queue --------------------------------------------- */
.linkedin-list-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-top: 3px solid #0a66c2;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    flex: 0 0 300px;
    min-height: 0;
    overflow: hidden;
}
.linkedin-panel-header { align-items: flex-start; }
.linkedin-panel-header > div:first-child { min-width: 0; }
.panel-count--linkedin { background: #e8f1f9; color: #0a66c2; }
.linkedin-panel-meta {
    color: var(--text-dim);
    font-size: 11.5px;
    margin-top: 3px;
}
.linkedin-table-wrap { min-height: 0; overflow: auto; flex: 1; }
.linkedin-table { min-width: 780px; }
.linkedin-table th { background: #f4f8fb; }
.linkedin-table td { padding-top: 8px; padding-bottom: 8px; }
.linkedin-table-link,
.linkedin-table-email {
    color: var(--accent);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.linkedin-table-link:hover,
.linkedin-table-email:hover { text-decoration: underline; }
.linkedin-table-link--website { color: var(--text-muted); font-weight: 500; }
.linkedin-empty {
    padding: 28px 16px !important;
    text-align: center;
    color: var(--text-muted);
}
.linkedin-empty i { display: block; color: #0a66c2; font-size: 24px; margin-bottom: 7px; }
.linkedin-empty span { display: block; }
.linkedin-empty .text-muted { font-size: 12px; margin-top: 3px; }
.linkedin-table-footer {
    border-top: 1px solid var(--border-light);
    color: var(--text-dim);
    font-size: 11px;
    padding: 7px 14px;
    flex-shrink: 0;
}
.linkedin-workspace-table { min-width: 940px; }
.linkedin-workspace-table th { background: #f4f8fb; }

/* --- Bulk actions bar -------------------------------------------------------- */
.bulk-bar {
    display: none;
    align-items: center; gap: 8px;
    padding: 7px 14px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.bulk-bar--active { display: flex; }
.bulk-count {
    font-size: 12px; font-weight: 700; color: var(--accent-deep);
    margin-right: 2px;
    white-space: nowrap;
}
.bulk-bar .btn { white-space: nowrap; }
#bulk-result {
    margin-left: auto;
    font-size: 12px; font-weight: 500;
    color: var(--success);
    display: flex; align-items: center; gap: 6px;
    min-width: 0;
}
#bulk-result:empty { display: none; }
#bulk-result .text-danger { color: var(--danger); }

/* --- Lead table ------------------------------------------------------------- */
.lead-table-wrap { overflow-x: auto; height: 100%; }
.lead-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.lead-table th {
    text-align: left;
    padding: 9px 14px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 2;
    white-space: nowrap;
}
.lead-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
.lead-table tbody tr:last-child td { border-bottom: none; }

.th-check, .td-check { width: 30px; padding: 9px 6px 9px 14px !important; text-align: left; }
.th-check input[type="checkbox"], .td-check input[type="checkbox"] {
    width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer;
    vertical-align: middle;
}

.lead-row {
    cursor: pointer;
    transition: background .1s var(--ease);
}
.lead-row:hover { background: var(--accent-soft); }
.lead-row--selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.lead-row--opted-out { opacity: .45; }
.lead-row--actionable { box-shadow: inset 3px 0 0 var(--warning); }

.td-company { display: flex; align-items: center; gap: 10px; }
.company-avatar {
    width: 30px; height: 30px; border-radius: 8px;
    color: #fff; font-size: 11.5px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
}
.company-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.company-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.company-url { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.lead-row--selected .company-name { color: var(--accent-deep); }

.td-score { text-align: center; }
.score-cell {
    display: inline-flex;
    align-items: center; justify-content: center;
    min-width: 30px; height: 26px;
    padding: 0 6px;
    border-radius: 7px;
    font-size: 12px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.score-cell--good { background: var(--success-soft); color: var(--success); }
.score-cell--warn { background: var(--warning-soft); color: var(--warning); }
.score-cell--bad  { background: var(--danger-soft); color: var(--danger); }

.lead-count { padding: 10px 14px; font-size: 12px; color: var(--text-muted); }

/* Pagination */
.pagination-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 14px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-subtle);
    font-size: 12px;
    flex-shrink: 0;
}
.page-info { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Status-icon legend for the table's "OK" column */
.table-legend { display: flex; gap: 14px; align-items: center; font-size: 11px; color: var(--text-dim); }
.table-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
@media (max-width: 1400px) { .table-legend { display: none; } }
.page-btns { display: flex; gap: 4px; align-items: center; }
.page-btn { padding: 5px 9px; font-size: 12px; }
.page-btn:disabled { opacity: .3; cursor: default; }

.empty-state { text-align: center; color: var(--text-muted); padding: 40px 16px; }
.empty-state .empty-icon { font-size: 34px; color: var(--text-dim); margin-bottom: 10px; }
.empty-state p { margin-bottom: 6px; }

/* --- Detail panel ----------------------------------------------------------- */
.detail-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-y: auto;
}
.panel-placeholder {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 10px; color: var(--text-muted);
    padding: 40px 28px; text-align: center;
    height: 100%;
}
.placeholder-icon {
    width: 64px; height: 64px; border-radius: 18px;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; margin-bottom: 6px;
}
.placeholder-shortcuts { display: flex; gap: 8px; margin-top: 14px; }

.lead-detail { padding: 18px; }

/* Detail header */
.detail-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.detail-header .company-avatar { width: 44px; height: 44px; border-radius: 12px; font-size: 15px; }
.detail-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.detail-heading h3 { font-size: 17px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }

/* Detail info grid */
.detail-info { margin-bottom: 14px; }
.info-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.info-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}
.info-cell { min-width: 0; }
.info-cell--wide { grid-column: 1 / -1; }
.it-label {
    font-size: 10px; font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase; letter-spacing: .05em;
    display: flex; align-items: center; gap: 5px;
    margin-bottom: 1px;
}
.it-value { color: var(--text); font-size: 12.5px; word-break: break-word; }
.it-value a { color: var(--accent); text-decoration: none; font-weight: 500; }
.it-value a:hover { text-decoration: underline; }

/* Compliance callout */
.compliance-note {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 9px 12px; border-radius: 8px;
    font-size: 12.5px; margin: 12px 0;
}
.compliance-note--ok { background: var(--success-soft); color: var(--success); border: 1px solid var(--success-border); }
.compliance-note--warn { background: var(--warning-soft); color: #92400e; border: 1px solid var(--warning-border); }
.compliance-note--bad { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); }
.compliance-note i { margin-top: 2px; }

/* Primary next-step actions, promoted above the tabs */
.quick-action-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.quick-action-row form { display: contents; }

/* --- Tabs ------------------------------------------------------------------- */
.detail-tabs {
    display: flex; gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}
.tab-btn {
    padding: 8px 12px;
    font-size: 12.5px; font-weight: 600;
    font-family: inherit;
    border: none; background: none; cursor: pointer;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: inline-flex; align-items: center; gap: 6px;
    transition: color .15s var(--ease), border-color .15s var(--ease);
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover:not(.active) { color: var(--text); }
.tab-content { padding: 2px 0 4px; }

/* --- Audit hero ------------------------------------------------------------- */
.audit-score-hero {
    display: flex; gap: 16px; align-items: center;
    padding: 14px 16px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 14px;
}
.score-circle {
    flex-shrink: 0;
    width: 78px; height: 78px; border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: 3px solid;
}
.score--good { border-color: var(--success); background: var(--success-soft); }
.score--warn { border-color: var(--warning); background: var(--warning-soft); }
.score--bad  { border-color: var(--danger); background: var(--danger-soft); }
.score-number { font-size: 26px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.score--good .score-number { color: var(--success); }
.score--warn .score-number { color: var(--warning); }
.score--bad  .score-number { color: var(--danger); }
.score-sub { font-size: 10.5px; color: var(--text-dim); font-weight: 600; }

.score-details { flex: 1; min-width: 0; }
.score-title { font-size: 12.5px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.score-bars { display: flex; flex-direction: column; gap: 4px; }
.score-bar-row { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.score-bar-label { width: 52px; text-align: right; color: var(--text-muted); font-weight: 600; }
.score-bar-track { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.score-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s var(--ease); }
.score-bar-val { width: 34px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* --- High impact & finding groups ------------------------------------------- */
.high-impact-section {
    margin-bottom: 14px;
    border: 1px solid var(--warning-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.section-heading {
    padding: 9px 14px;
    background: var(--warning-soft);
    font-size: 12px; font-weight: 700;
    color: var(--warning);
    border-bottom: 1px solid var(--warning-border);
    display: flex; align-items: center; gap: 7px;
}
.high-impact-item { padding: 10px 14px; border-bottom: 1px solid var(--border-light); }
.high-impact-item:last-child { border-bottom: none; }
.hi-impact { font-size: 13px; color: var(--text); line-height: 1.5; }

.finding-group {
    margin-bottom: 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-surface);
}
.finding-group--clean { opacity: .72; }
.finding-group-header {
    padding: 9px 13px;
    cursor: pointer;
    font-size: 13px; font-weight: 650;
    font-family: inherit;
    background: var(--bg-subtle);
    display: flex; align-items: center; gap: 9px;
    list-style: none;
    user-select: none;
    transition: background .15s var(--ease);
}
.finding-group-header::-webkit-details-marker { display: none; }
.finding-group-header::before {
    content: "\f284"; /* bi-chevron-right */
    font-family: "bootstrap-icons";
    font-size: 10px;
    color: var(--text-dim);
    transition: transform .18s var(--ease);
}
details[open] > .finding-group-header::before { transform: rotate(90deg); }
.finding-group-header:hover { background: var(--bg-inset); }
.finding-group-header i { color: var(--text-muted); }
.finding-count {
    margin-left: auto;
    background: var(--danger); color: #fff;
    padding: 1px 8px; border-radius: 10px;
    font-size: 10.5px; font-weight: 700;
}
.finding-ok { margin-left: auto; font-size: 11px; color: var(--success); font-weight: 650; }
.finding-info { margin-left: auto; font-size: 11px; color: var(--text-muted); font-weight: 500; }

.finding-card {
    padding: 9px 13px 9px 14px;
    border-top: 1px solid var(--border-light);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3px 9px;
    align-items: baseline;
}
.fc-impact { font-size: 13px; color: var(--text); line-height: 1.45; grid-column: 2; }
.fc-detail { font-size: 11px; color: var(--text-dim); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; grid-column: 2; word-break: break-word; }
.finding--critical { border-left: 3px solid var(--danger); }
.finding--high     { border-left: 3px solid var(--warning); }
.finding--medium   { border-left: 3px solid #f59e0b; }
.finding--low      { border-left: 3px solid var(--text-dim); }

.sev-badge {
    display: inline-block;
    padding: 1px 7px;
    font-size: 9.5px; font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-radius: 5px;
    grid-row: 1;
    align-self: start;
    margin-top: 2px;
}
.sev--critical { background: var(--danger-soft); color: var(--danger); }
.sev--high     { background: var(--warning-soft); color: var(--warning); }
.sev--medium   { background: #fef3c7; color: #b45309; }
.sev--low      { background: var(--bg-inset); color: var(--text-dim); }

/* Lighthouse */
.lh-scores { display: flex; gap: 8px; margin: 10px 12px; flex-wrap: wrap; }
.lh-score {
    display: flex; flex-direction: column; align-items: center;
    padding: 7px 14px;
    background: var(--bg-inset);
    border-radius: 8px;
}
.lh-score-label { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.lh-score-value { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* --- History / interaction lists -------------------------------------------- */
.interaction-list, .compliance-log-list { list-style: none; }
.interaction-item, .compliance-log-item {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 11px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 12.5px;
    background: var(--bg-subtle);
}
.ix-icon { color: var(--text-dim); flex-shrink: 0; }
.ix-type { font-weight: 650; min-width: 78px; }
.ix-subject { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ix-date, .cl-date { color: var(--text-dim); white-space: nowrap; font-size: 11.5px; }
.cl-action { font-weight: 650; min-width: 118px; }
.cl-detail { flex: 1; color: var(--text-muted); font-size: 11.5px; }

/* --- Action rows ------------------------------------------------------------- */
.detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}
.detail-actions .btn { justify-content: center; }
.detail-actions .btn-full { grid-column: 1 / -1; }
.action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.action-buttons .btn { width: 100%; justify-content: center; }
.action-form, .draft-form { margin: 10px 0; }
.action-form .btn, .draft-form .btn { margin-top: 8px; }
.draft-form textarea { font-size: 12.5px; line-height: 1.55; font-family: inherit; }

/* --- Badges ------------------------------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center; gap: 5px;
    padding: 2.5px 9px;
    font-size: 11px; font-weight: 650;
    border-radius: 12px;
    white-space: nowrap;
    line-height: 1.5;
}
.badge-tier { background: var(--info-soft); color: var(--info); }
.badge-category { background: #fdf4ff; color: #a21caf; }
.badge-tag { background: var(--bg-inset); color: var(--text-muted); font-weight: 600; }
.badge-tag::before { content: ""; }
.badge-source { background: var(--bg-inset); color: var(--text-muted); }
.badge-score { background: var(--bg-inset); color: var(--text); font-variant-numeric: tabular-nums; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* Status pills with a coloured dot */
.badge-status::before {
    content: "";
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.status-new { background: var(--bg-inset); color: #64748b; }
.status-pending_review { background: var(--warning-soft); color: var(--warning); }
.status-audited { background: var(--accent-soft); color: var(--accent); }
.status-draft_ready { background: var(--info-soft); color: var(--info); }
.status-approved { background: var(--success-soft); color: var(--success); }
.status-contacted { background: #dbeafe; color: #2563eb; }
.status-replied { background: #ede9fe; color: #7c3aed; }
.status-nurture { background: #fed7aa; color: #ea580c; }
.status-client { background: #bbf7d0; color: #16a34a; }
.status-opted_out { background: var(--danger-soft); color: var(--danger); }
.status-skipped { background: #f8fafc; color: #94a3b8; }

/* --- Toasts ------------------------------------------------------------------ */
.toast {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 10px 13px;
    border-radius: 9px;
    font-size: 12.5px; font-weight: 500;
    margin-bottom: 12px;
    animation: toast-in .2s var(--ease);
}
.toast--success { background: var(--success-soft); color: var(--success); border: 1px solid var(--success-border); }
.toast--error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); }
.toast--warn { background: var(--warning-soft); color: #92400e; border: 1px solid var(--warning-border); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}
#toast-container { position: fixed; top: 68px; right: 20px; z-index: 100; width: 340px; }

/* --- Quick add form ---------------------------------------------------------- */
.quick-add-form { max-height: calc(100vh - 180px); overflow-y: auto; padding-right: 4px; }
.quick-add-form .field-label { margin-top: 12px; }
.quick-add-form .field-label:first-child { margin-top: 0; }
.quick-add-form .input { margin-bottom: 0; }

/* --- Pipeline ---------------------------------------------------------------- */
.page-content { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.page-content .card { flex: 1; min-height: 0; overflow-y: auto; }
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; margin-bottom: 14px; flex-shrink: 0;
}
.page-header h2 {
    font-size: 19px; font-weight: 800; letter-spacing: -.02em;
    display: flex; align-items: center; gap: 9px;
}
.page-header h2 i { color: var(--accent); }

.pipeline-stats {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px; margin-bottom: 14px; flex-shrink: 0;
}
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 150px; }
.form-group { margin-bottom: 10px; }

/* --- Discovery --------------------------------------------------------------- */
.discovery-page { display: flex; flex-direction: column; height: 100%; }
.discovery-page h2 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; flex-shrink: 0; display: flex; align-items: center; gap: 9px; }
.discovery-page h2 i { color: var(--accent); }
.discovery-page > p { flex-shrink: 0; margin: 2px 0 14px; }
.discovery-layout {
    display: grid;
    grid-template-columns: 390px minmax(0, 1fr);
    gap: 14px;
    flex: 1; min-height: 0;
}
.discovery-layout > * { min-height: 0; overflow-y: auto; }

.discovery-config {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    overflow-y: auto; height: 100%;
    display: flex; flex-direction: column; gap: 4px;
}
.config-section {
    border: none; margin: 0 0 16px; padding: 0;
}
.config-section legend {
    font-size: 12.5px; font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    padding: 0;
    display: flex; align-items: center; gap: 7px;
    letter-spacing: -.01em;
}
.config-section legend i { color: var(--accent); }

.source-option {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    margin-bottom: 7px;
    cursor: pointer;
    transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}
.source-option:hover { border-color: #c7d2fe; background: var(--bg-subtle); }
.source-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent);
}
.source-option input[type="checkbox"] { margin-top: 4px; accent-color: var(--accent); flex-shrink: 0; }
.source-option strong { font-size: 13px; display: block; line-height: 1.3; }
.source-option .so-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

.city-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 10px; }
.city-check { font-size: 12.5px; padding: 3.5px 0; }
.category-group {
    margin-bottom: 7px;
    padding: 8px 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: 9px;
}
.cat-group-label { font-weight: 650; font-size: 12.5px; }
.cat-tags { font-size: 10.5px; padding-left: 24px; color: var(--text-dim); }

.range-control { display: flex; align-items: center; gap: 14px; }
.range-control input[type="range"] {
    flex: 1; accent-color: var(--accent);
    height: 4px; cursor: pointer;
}
.range-value { font-size: 13px; white-space: nowrap; color: var(--text-muted); }
.range-value strong { color: var(--accent); font-size: 15px; }

.discovery-results {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    height: 100%; overflow-y: auto;
}
.results-placeholder {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    min-height: 100%; height: 100%;
    gap: 10px; padding: 32px; text-align: center;
}
.results-stats-grid { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.mini-stat {
    padding: 9px 16px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: 9px;
    font-size: 12.5px; color: var(--text-muted);
}
.mini-stat strong { color: var(--text); font-size: 14px; }

.discovery-results-active { padding: 18px; }
.results-header {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; margin-bottom: 14px;
}
.results-header h3 { font-size: 15.5px; font-weight: 750; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.results-header h3 i { color: var(--accent); }
.results-timestamp { font-size: 12px; color: var(--text-dim); }

.discovery-loading {
    display: flex; align-items: center; gap: 16px;
    padding: 20px;
    margin-bottom: 16px;
    background: var(--info-soft);
    border: 1px solid var(--info-border);
    border-radius: var(--radius);
}
.loading-spinner { flex-shrink: 0; width: 46px; height: 46px; }
.spinner-ring {
    width: 46px; height: 46px;
    border: 4px solid rgba(8, 145, 178, .18);
    border-top-color: var(--info);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.loading-text { flex: 1; min-width: 0; }
.loading-status { font-size: 14.5px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.loading-sub { font-size: 12px; color: var(--text-muted); }

.progress-section { margin-bottom: 16px; }
.progress-bar-wrap {
    height: 9px;
    background: var(--bg-inset);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 7px;
    border: 1px solid var(--border-light);
}
.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 5px;
    transition: width .4s var(--ease);
}
.progress-bar-animated {
    background: var(--accent);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.progress-detail {
    display: flex; justify-content: space-between; gap: 10px;
    font-size: 12px; color: var(--text-muted);
}

.results-summary {
    padding: 22px;
    background: var(--success-soft);
    border: 1px solid var(--success-border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    text-align: center;
}
.summary-big { margin-bottom: 8px; }
.summary-number { font-size: 44px; font-weight: 800; color: var(--success); line-height: 1; font-variant-numeric: tabular-nums; }
.summary-label { display: block; font-size: 13px; color: var(--text-muted); font-weight: 600; margin-top: 3px; }
.summary-details {
    display: flex; flex-wrap: wrap; gap: 14px;
    justify-content: center;
    font-size: 12.5px; color: var(--text);
}
.summary-details span { display: inline-flex; align-items: center; gap: 5px; }

.results-errors {
    margin-bottom: 14px;
    padding: 10px 14px;
    background: var(--danger-soft);
    border: 1px solid var(--danger-border);
    border-radius: 9px;
}
.results-errors p { margin-bottom: 3px; }
.results-errors p:last-child { margin-bottom: 0; }

.new-leads-section { margin-top: 18px; }
.new-leads-section h4 { font-size: 13.5px; font-weight: 700; margin-bottom: 9px; display: flex; align-items: center; gap: 7px; }
.new-leads-section h4 i { color: var(--success); }
.new-leads-table-wrap { overflow-x: auto; border: 1px solid var(--border-light); border-radius: var(--radius); }
.results-actions { display: none; }

.results-empty { padding: 24px; text-align: center; color: var(--text-muted); }
.results-empty ul {
    display: inline-block; text-align: left; margin-top: 10px;
    font-size: 13px;
}
.results-empty li { margin-bottom: 4px; }

.discovery-status { margin-top: 10px; font-size: 12.5px; }

/* --- Teams / tenancy ------------------------------------------------------- */
.team-page { overflow-y: auto; padding-right: 3px; }
.team-page-header {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 18px;
    margin-bottom: 16px; flex-shrink: 0;
}
.team-page-header h2 {
    display: flex; align-items: center; gap: 9px; margin-top: 3px;
    font-size: 20px; font-weight: 800; letter-spacing: -.025em;
}
.team-page-header h2 i { color: var(--accent); }
.team-page-header p { margin-top: 3px; }
.team-current-pill {
    display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex-shrink: 0;
    padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-surface); box-shadow: var(--shadow-sm);
    color: var(--accent-deep); font-size: 12px;
}
.team-current-pill .live-dot { width: 6px; height: 6px; margin-bottom: 2px; background: var(--accent); box-shadow: none; }
.team-current-pill small { color: var(--text-dim); font-size: 10px; }
.team-control-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 14px; margin-bottom: 14px; }
.team-card {
    padding: 18px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.team-card--locked { background: var(--bg-surface); }
.team-card--locked .team-card-icon { background: var(--bg-inset); color: var(--text-muted); }
.team-card-heading { display: flex; align-items: flex-start; gap: 10px; }
.team-card-heading--spread { justify-content: space-between; gap: 16px; }
.team-card-heading h3 { font-size: 14px; font-weight: 800; letter-spacing: -.01em; }
.team-card-heading p { margin-top: 2px; color: var(--text-muted); font-size: 11.5px; }
.team-card-icon {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 31px; height: 31px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 15px;
}
.team-card-icon--lime { background: rgba(198,237,119,.26); color: var(--accent-deep); }
.team-list { display: grid; gap: 6px; margin-top: 15px; }
.team-list-item {
    display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 9px;
    border: 1px solid var(--border-light); border-radius: 8px; background: var(--bg-subtle); color: var(--text); text-align: left;
}
.team-list-item.is-current { border-color: var(--accent); background: var(--accent-soft); }
.team-list-mark {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 27px; height: 27px; border-radius: 7px; background: var(--sidebar-bg); color: var(--accent-loud); font-size: 11px; font-weight: 800;
}
.team-list-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.team-list-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.team-list-copy small { color: var(--text-dim); font-size: 10px; }
.team-list-item .badge { margin-left: auto; }
.team-create-form { margin-top: 17px; }
.team-create-row { display: flex; gap: 7px; margin-top: 5px; }
.team-create-row .input { min-width: 0; flex: 1; }
.team-stat-strip { display: flex; gap: 16px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border-light); color: var(--text-muted); font-size: 11px; }
.team-stat-strip strong { color: var(--accent-deep); font: 700 14px "IBM Plex Mono", monospace; margin-right: 3px; }
.team-members-card { padding: 0; overflow: hidden; }
.team-members-card > .team-card-heading { padding: 18px 18px 14px; }
.team-invite-bar {
    display: grid; grid-template-columns: minmax(170px, 1fr) minmax(150px, 1.1fr) 140px auto; align-items: center; gap: 8px;
    padding: 11px 18px; background: var(--bg-subtle); border-top: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light);
}
.team-invite-bar > div { display: flex; flex-direction: column; line-height: 1.25; }
.team-invite-bar strong { font-size: 11.5px; }
.team-invite-bar small { color: var(--text-muted); font-size: 10px; margin-top: 2px; }
.team-members-table-wrap { overflow-x: auto; }
.team-members-table { width: 100%; border-collapse: collapse; min-width: 650px; font-size: 12px; }
.team-members-table th { padding: 9px 18px; background: var(--bg-subtle); border-bottom: 1px solid var(--border-light); color: var(--text-muted); font-size: 10px; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.team-members-table td { padding: 10px 18px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.team-members-table tbody tr:last-child td { border-bottom: 0; }
.team-person { display: flex; align-items: center; gap: 9px; }
.team-person .company-avatar { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-deep); }
.team-person > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.team-person strong { font-size: 12px; }
.team-person small { color: var(--text-muted); font-size: 10.5px; }
.team-members-table .input-sm { min-width: 115px; }
.team-access-copy { color: var(--text-muted); font-size: 11px; }
.team-member-action { width: 48px; text-align: right; }
.team-remove-btn { color: var(--danger); }
.team-role-legend { display: flex; flex-wrap: wrap; gap: 9px 18px; padding: 11px 18px; background: var(--bg-subtle); border-top: 1px solid var(--border-light); color: var(--text-muted); font-size: 10.5px; }
.team-role-legend b { color: var(--text); }
.team-messages { margin-bottom: 12px; }
.team-message { display: flex; align-items: center; gap: 7px; padding: 9px 12px; border: 1px solid var(--success-border); border-radius: 8px; background: var(--success-soft); color: var(--success); font-size: 12px; }
.team-message--error { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger); }
.platform-teams-table td { font-variant-numeric: tabular-nums; }

/* --- Outreach automation ----------------------------------------------------- */
.automation-config-col {
    display: flex; flex-direction: column; gap: 12px;
    min-height: 0; overflow-y: auto; padding-right: 2px;
}
.automation-config-col .discovery-config { height: auto; flex: 0 0 auto; }
.automation-filters {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.automation-filters .input { width: 100%; }
.automation-filters input[name="search"] { grid-column: 1 / -1; }
.automation-filters .btn { grid-column: 1 / -1; }

.selection-section { margin-top: 2px; }
.selection-summary {
    display: flex; align-items: center; gap: 10px; padding: 10px 11px; margin-bottom: 8px;
    border: 1px solid var(--border-light); border-radius: 9px; background: var(--bg-subtle);
}
.selection-summary-number {
    color: var(--accent-deep); font: 700 20px/1 "IBM Plex Mono", monospace; min-width: 34px;
}
.selection-summary span:last-child { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.selection-summary strong { font-size: 12px; }
.selection-summary small { color: var(--text-muted); font-size: 10.5px; line-height: 1.35; }
.selection-mode-card {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px;
    padding: 10px 11px; margin-bottom: 7px; border: 1px solid var(--border); border-radius: 9px;
    cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.selection-mode-card:hover { background: var(--bg-subtle); border-color: #b8cdc1; }
.selection-mode-card--active { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.selection-mode-card input { accent-color: var(--accent); margin: 0; }
.selection-mode-card > span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.selection-mode-card strong { font-size: 12.5px; }
.selection-mode-card small { color: var(--text-muted); font-size: 10.5px; line-height: 1.35; }
.selection-mode-card > i { color: var(--accent); font-size: 14px; }
.selection-mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.selection-mode-grid .selection-mode-card { margin-bottom: 0; }
.automation-browser-selection {
    margin: 0; padding: 14px 24px 16px;
    border-bottom: 1px solid var(--border-light); flex-shrink: 0;
}
.automation-browser-selection legend { margin-bottom: 7px; }
.automation-runbar {
    position: sticky; bottom: -18px; z-index: 2;
    margin: 2px -18px -18px; padding: 12px 18px 18px;
    background: var(--bg-surface); border-top: 1px solid var(--border-light);
}
.automation-runbar .field-hint { margin-top: 7px; }

/* The wide side of automation is the working area: browse, compare, select,
   then let the same surface become the run-progress view after submission. */
#automation-results { overflow: hidden; }
.automation-browser {
    display: flex; flex-direction: column; height: 100%; min-height: 0;
}
.automation-browser-header {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
    padding: 22px 24px 16px; border-bottom: 1px solid var(--border-light); flex-shrink: 0;
}
.automation-browser-header h3 {
    display: flex; align-items: center; gap: 8px;
    margin-top: 3px; font-size: 16px; font-weight: 780; letter-spacing: -.015em;
}
.automation-browser-header h3 i { color: var(--accent); }
.automation-browser-header p { margin-top: 4px; color: var(--text-muted); font-size: 12px; }
.automation-browser-count {
    display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0;
    color: var(--text-dim); font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
}
.automation-browser-count strong {
    color: var(--accent-deep); font: 700 25px/1 "IBM Plex Mono", monospace;
    letter-spacing: -.04em;
}
.automation-browser-toolbar {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 10px 24px; background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-light); flex-shrink: 0;
}
.automation-page-selection { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.automation-selection-persist { color: var(--text-dim); font-size: 11px; margin-left: 5px; }
.automation-page-count {
    color: var(--text-muted); font: 500 10.5px "IBM Plex Mono", monospace;
    white-space: nowrap;
}
#automation-lead-browser { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#automation-results-content { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
#automation-results-content > .discovery-results-active { flex: 1; overflow: auto; }
.automation-browser-table-wrap { overflow: auto; flex: 1; min-height: 0; }
.automation-browser-table { min-width: 1000px; }
.automation-browser-table th { background: var(--bg-subtle); }
.automation-browser-row { transition: background .1s var(--ease); }
.automation-browser-row:hover { background: var(--accent-soft); }
.automation-browser-row.is-selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.automation-browser-row input[type="checkbox"], #automation-page-check { accent-color: var(--accent); }
.browser-website, .browser-contact {
    color: var(--accent); font-size: 11.5px; text-decoration: none; white-space: nowrap;
}
.browser-contact { color: var(--text-muted); }
.browser-website:hover { text-decoration: underline; }
.automation-browser-footer {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 10px 24px; border-top: 1px solid var(--border-light); flex-shrink: 0;
}
.manual-picker { margin-top: 10px; }
.picker-toolbar { display: flex; gap: 5px; align-items: center; margin-bottom: 5px; }
.picker-toolbar .input { min-width: 0; flex: 1; }
.picker-toolbar .btn { padding-left: 7px; padding-right: 7px; font-size: 10.5px; }
.picker-count { color: var(--text-dim); font: 500 10px "IBM Plex Mono", monospace; margin: 0 2px 5px; }
.picker-hint { display: flex; gap: 5px; align-items: flex-start; color: var(--text-muted); font-size: 10.5px; line-height: 1.4; margin-top: 6px; }
.picker-hint i { color: var(--accent); margin-top: 2px; }

.lead-picker {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: 9px;
    padding: 4px 6px;
    background: var(--bg-inset);
}
.picker-head {
    padding: 6px 2px; font-size: 12.5px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
}
.picker-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 6px;
    border-radius: 7px;
    font-size: 12.5px;
    cursor: pointer;
}
.picker-row:hover { background: var(--bg-subtle); }
.picker-row input[type="checkbox"] { accent-color: var(--accent); flex-shrink: 0; }
.picker-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-row .badge { font-size: 9.5px; }

.automation-table td { font-size: 12.5px; }
.automation-table .td-automation { text-align: center; }
.automation-table .badge { font-size: 9.5px; text-transform: capitalize; }
.text-nowrap { white-space: nowrap; }

/* --- Automation flow studio ------------------------------------------------ */
.automation-flow-studio {
    margin: 18px 0 20px;
    background: #fbfdf9;
    border: 1px solid #d5e2d8;
    border-radius: 16px;
    box-shadow: 0 14px 36px rgba(23, 35, 28, .08), 0 1px 2px rgba(23, 35, 28, .04);
    overflow: hidden;
}
.automation-flow-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid #e1ebe3;
    background: var(--bg-surface);
}
.automation-flow-title { min-width: 230px; }
.automation-flow-title h3 { margin-top: 3px; font-size: 20px; letter-spacing: -.035em; }
.automation-flow-title p { margin-top: 3px; color: var(--text-muted); font-size: 12px; }
.automation-flow-title .eyebrow { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-deep); }
.automation-flow-toolbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.flow-picker-label { color: var(--text-dim); font: 600 10px/1 "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .08em; }
.flow-name-input { width: 172px; font-weight: 700; }
.automation-flow-workbench { display: grid; grid-template-columns: 192px minmax(560px, 1fr) 214px; min-height: 546px; }
.automation-flow-palette, .automation-flow-inspector { background: #f7faf6; padding: 15px 12px; }
.automation-flow-palette { border-right: 1px solid #e1ebe3; }
.automation-flow-inspector { border-left: 1px solid #e1ebe3; }
.flow-panel-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 1px 4px 11px; color: var(--text); font-size: 12px; font-weight: 800; letter-spacing: -.01em; }
.flow-panel-heading small { color: var(--text-dim); font: 500 9px/1 "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .06em; }
.flow-palette-group { padding: 11px 0 4px; border-top: 1px solid #e1ebe3; }
.flow-palette-group:first-of-type { border-top: 0; padding-top: 2px; }
.flow-palette-label { display: block; padding: 0 4px 7px; color: var(--text-dim); font: 600 9px/1 "IBM Plex Mono", monospace; letter-spacing: .07em; text-transform: uppercase; }
.flow-palette-node { width: 100%; display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 8px 6px; margin: 3px 0; border: 1px solid transparent; border-radius: 8px; color: var(--text); background: transparent; text-align: left; cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease); }
.flow-palette-node:hover { background: #fff; border-color: #cdded2; transform: translateX(2px); }
.flow-palette-node > i { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: #e1f0eb; color: var(--accent); font-size: 12px; }
.flow-palette-node span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 700; }
.flow-palette-node em { color: var(--text-dim); font: 500 8px/1 "IBM Plex Mono", monospace; font-style: normal; text-transform: uppercase; }
.flow-palette-node--action > i { color: #5549a7; background: #ecebff; }
.flow-palette-node--logic > i { color: #ad741d; background: #fff3d9; }
.flow-palette-node--output > i { color: #3f8154; background: #e3f4e5; }
.flow-palette-node.is-live em { color: var(--success); }
.automation-flow-canvas-column { min-width: 0; background: #eef4ef; }
.automation-flow-canvas-toolbar { height: 43px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 13px; border-bottom: 1px solid #dce8de; background: rgba(255, 255, 255, .64); }
.flow-canvas-status, .flow-canvas-actions { display: flex; align-items: center; gap: 8px; }
.flow-canvas-status { min-width: 0; color: var(--text-muted); font: 500 10px/1 "IBM Plex Mono", monospace; }
.flow-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-loud); box-shadow: 0 0 0 3px rgba(198, 237, 119, .25); }
.flow-toolbar-divider { width: 1px; height: 14px; background: #cbd9cf; }
.flow-icon-btn { min-width: 26px; height: 26px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid #d4e1d6; border-radius: 6px; color: var(--text-muted); background: #fff; font-size: 13px; cursor: pointer; }
.flow-icon-btn:hover { color: var(--accent-deep); border-color: #9fbeb0; background: #f6fbf6; }
.flow-icon-btn--wide { padding: 0 8px; font: 600 10px/1 "IBM Plex Mono", monospace; }
.flow-icon-btn--danger:hover { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
#automation-flow-zoom { min-width: 38px; text-align: center; color: var(--text-dim); font: 500 9px/1 "IBM Plex Mono", monospace; }
.automation-flow-canvas { position: relative; height: 458px; overflow: auto; background-color: #edf3ee; background-image: radial-gradient(#bfd0c2 1px, transparent 1px); background-size: 18px 18px; outline: none; }
.automation-flow-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.automation-flow-world { position: relative; min-width: 1000px; min-height: 460px; transform-origin: 0 0; }
.automation-flow-edges { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; color: #7a9b87; pointer-events: none; }
.automation-flow-edge { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; opacity: .72; }
.automation-flow-node { position: absolute; z-index: 2; width: 214px; min-height: 116px; padding: 10px 12px; border: 1px solid #c8d9cc; border-radius: 11px; background: #fffefa; box-shadow: 0 6px 16px rgba(31, 55, 39, .09), 0 1px 2px rgba(31, 55, 39, .06); cursor: grab; user-select: none; transition: box-shadow .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease); }
.automation-flow-node:active { cursor: grabbing; }
.automation-flow-node:hover { box-shadow: 0 10px 21px rgba(31, 55, 39, .14), 0 1px 2px rgba(31, 55, 39, .06); }
.automation-flow-node.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 117, 106, .16), 0 9px 20px rgba(31, 55, 39, .13); }
.automation-flow-node.is-connecting { border-color: #776ee0; box-shadow: 0 0 0 3px rgba(119, 110, 224, .2), 0 9px 20px rgba(31, 55, 39, .13); }
.flow-node--action { border-top: 3px solid #7168d1; }
.flow-node--logic { border-top: 3px solid #d49b42; }
.flow-node--output { border-top: 3px solid #62a672; }
.flow-node--source { border-top: 3px solid var(--accent); }
.flow-node-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.flow-node-kind, .flow-node-runtime { font: 600 8px/1 "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .07em; }
.flow-node-kind { color: var(--text-dim); }
.flow-node-runtime { color: var(--success); }
.flow-node--logic .flow-node-runtime { color: var(--warning); }
.flow-node-main { display: flex; align-items: center; gap: 9px; padding-right: 4px; }
.flow-node-icon { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 30px; border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-size: 14px; }
.flow-node--action .flow-node-icon { color: #5549a7; background: #ecebff; }
.flow-node--logic .flow-node-icon { color: #ad741d; background: #fff3d9; }
.flow-node--output .flow-node-icon { color: #3f8154; background: #e3f4e5; }
.flow-node-main strong, .flow-node-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-node-main strong { font-size: 12px; letter-spacing: -.01em; }
.flow-node-main small { margin-top: 2px; color: var(--text-muted); font-size: 9.5px; }
.flow-handle { position: absolute; z-index: 4; width: 10px; height: 10px; padding: 0; border: 2px solid #fffefa; border-radius: 50%; background: #83a891; box-shadow: 0 0 0 1px #6e9380; cursor: crosshair; }
.flow-handle:hover, .automation-flow-node.is-connecting .flow-handle--out { background: #6259c3; box-shadow: 0 0 0 3px rgba(98, 89, 195, .18); }
.flow-handle--in { top: 68px; left: -6px; }
.flow-handle--out { top: 68px; right: -6px; }
.automation-flow-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--text-muted); text-align: center; pointer-events: none; }
.automation-flow-empty[hidden] { display: none; }
.automation-flow-empty i { color: var(--accent); font-size: 28px; }
.automation-flow-empty strong { color: var(--text); font-size: 14px; }
.automation-flow-empty span { max-width: 250px; font-size: 11px; }
.automation-flow-hint { padding: 8px 13px; color: var(--text-dim); border-top: 1px solid #dce8de; font: 500 9px/1.4 "IBM Plex Mono", monospace; }
.automation-flow-hint i { color: var(--accent); }
.automation-flow-inspector { min-width: 0; }
.flow-inspector-empty { display: flex; min-height: 230px; padding: 35px 11px; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-dim); text-align: center; }
.flow-inspector-empty i { color: #a7bcab; font-size: 24px; }
.flow-inspector-empty p { max-width: 150px; font-size: 11px; line-height: 1.55; }
.flow-inspector-node-mark { width: 35px; height: 35px; display: grid; place-items: center; margin: 3px 0 15px; border-radius: 9px; color: var(--accent-deep); background: var(--accent-soft); font-size: 15px; }
.flow-field-label { display: block; margin: 13px 0 5px; color: var(--text-muted); font: 600 9px/1 "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .06em; }
.flow-inspector-meta { display: flex; justify-content: space-between; gap: 8px; margin: 12px 0; color: var(--text-dim); font: 500 8px/1.3 "IBM Plex Mono", monospace; }
.flow-inspector-meta span:first-child { color: var(--accent); }
.flow-field-check { display: flex; align-items: flex-start; gap: 8px; margin-top: 13px; cursor: pointer; }
.flow-field-check input { margin-top: 2px; accent-color: var(--accent); }
.flow-field-check strong, .flow-field-check small { display: block; }
.flow-field-check strong { font-size: 10px; }
.flow-field-check small { margin-top: 2px; color: var(--text-muted); font-size: 9px; line-height: 1.4; }
.flow-remove-node { width: 100%; margin-top: 9px; justify-content: center; color: var(--danger); }
.automation-flow-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 18px; border-top: 1px solid #e1ebe3; color: var(--text-muted); font-size: 10px; }
.automation-flow-footer i { margin-right: 5px; color: var(--success); }
.automation-flow-footer strong { color: var(--text); }
.automation-flow-footer > div:last-child { color: var(--text-dim); font: 500 9px/1 "IBM Plex Mono", monospace; }
.automation-flow-triggers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px 18px 16px; border-top: 1px solid #e1ebe3; background: #fbfdf9; }
.flow-fullscreen-btn[aria-pressed="true"] { color: var(--accent-deep); border-color: #9fbeb0; background: var(--accent-soft); }
body.flow-studio-overlay-open { overflow: hidden; }
.automation-flow-studio.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    border: 0;
    border-radius: 0;
    background: #fbfdf9;
    box-shadow: none;
}
.automation-flow-studio.is-fullscreen .automation-flow-workbench { min-height: 0; height: 100%; }
.automation-flow-studio.is-fullscreen .automation-flow-palette,
.automation-flow-studio.is-fullscreen .automation-flow-inspector { min-height: 0; overflow-y: auto; }
.automation-flow-studio.is-fullscreen .automation-flow-canvas-column { min-height: 0; display: flex; flex-direction: column; }
.automation-flow-studio.is-fullscreen .automation-flow-canvas { height: auto; min-height: 0; flex: 1 1 auto; }
.automation-flow-studio.is-fullscreen .automation-flow-triggers { display: none; }
.automation-flow-studio.is-fullscreen .automation-flow-footer { background: var(--bg-surface); }
.flow-trigger-block { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; padding: 10px 11px; border: 1px solid #dfe9e0; border-radius: 10px; background: #fff; }
.flow-trigger-block > div { flex: 1 1 160px; min-width: 120px; }
.flow-trigger-block strong, .flow-trigger-block small { display: block; }
.flow-trigger-block strong { color: var(--text); font-size: 11px; }
.flow-trigger-block small { margin-top: 2px; color: var(--text-dim); font-size: 9.5px; line-height: 1.35; }
.flow-trigger-block .input { min-width: 0; max-width: 150px; }
.flow-trigger-block code { flex: 1 1 180px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); font-size: 9px; }
.flow-trigger-block--runs { align-items: center; }
.automation-workflow-runs-list { grid-column: 1 / -1; border-top: 1px dashed #dfe9e0; padding-top: 10px; }
.automation-workflow-run-row { display: grid; grid-template-columns: 100px 100px 90px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid #edf2ed; color: var(--text-muted); font-size: 10px; }
.automation-workflow-run-row strong { text-transform: capitalize; color: var(--accent); font-size: 10px; }
.automation-workflow-run-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
.automation-workflow-run-card { margin-top: 12px; }
.automation-run-details summary { cursor: pointer; color: var(--accent); font-weight: 700; font-size: 11px; }

/* --- Settings ---------------------------------------------------------------- */
.settings-page { overflow-y: auto; }
.settings-header { flex-shrink: 0; }
.settings-header h2 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 9px; }
.settings-header h2 i { color: var(--accent); }
.settings-header > p { margin: 2px 0 14px; }

.settings-status {
    flex-shrink: 0;
    padding: 9px 14px;
    margin-bottom: 12px;
    background: var(--success-soft, #e7f6ef);
    border: 1px solid var(--border-light);
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--success);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 14px;
    align-items: start;
    flex-shrink: 0;
}
.settings-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
}
.settings-card h3 { font-size: 14.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.settings-card h3 i { color: var(--accent); }
.settings-blurb { font-size: 12px; color: var(--text-muted); margin: 2px 0 14px; }

.settings-field { margin-bottom: 13px; }
.settings-label {
    display: block;
    font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
    text-transform: uppercase; color: var(--text-muted);
    margin-bottom: 4px;
}
.settings-help { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.settings-help-inline { display: block; font-size: 11px; font-weight: 400; color: var(--text-muted); margin-top: 2px; }
.settings-boolean { font-size: 12.5px; }

.settings-test-box {
    margin-top: 14px; padding-top: 14px;
    border-top: 1px dashed var(--border);
}
.settings-test-row { display: flex; gap: 8px; }
.settings-test-row .input { flex: 1; }
.settings-test-row .btn { white-space: nowrap; }
#test-email-result { margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--success); }
#test-email-result .text-danger, #test-email-result .text-dim { color: var(--danger); }
#test-email-result .text-dim { color: var(--text-muted); }
#test-email-result:empty { display: none; }

.settings-footer {
    flex-shrink: 0;
    display: flex; align-items: center; gap: 14px;
    margin-top: 18px;
    padding: 14px 0 4px;
    position: sticky; bottom: 0;
    background: var(--bg);
}
.settings-hint { font-size: 12px; }

/* --- Settings control plane (tabbed) -------------------------------------- */
.settings-header--upgraded { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 17px; }
.settings-eyebrow, .settings-panel-kicker { display: block; color: var(--accent-deep); font: 700 9px/1.2 "IBM Plex Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.settings-eyebrow { margin-bottom: 7px; }
.settings-header--upgraded h2 { margin: 0 0 5px; font-size: 25px; letter-spacing: -.045em; }
.settings-header--upgraded > div:first-child > p { max-width: 650px; margin: 0; line-height: 1.55; }
.settings-search-wrap { display: flex; align-items: center; gap: 8px; width: 230px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-surface); box-shadow: 0 5px 18px rgba(26, 58, 43, .04); }
.settings-search-wrap > i { color: var(--text-dim); font-size: 13px; }
.settings-search-wrap .input { min-width: 0; width: 100%; padding: 4px 0; border: 0; outline: 0; background: transparent; box-shadow: none; font-size: 11px; }
.settings-search-wrap kbd { padding: 2px 5px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-dim); background: var(--bg-subtle); font: 600 9px "IBM Plex Mono", monospace; }
.settings-layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); align-items: start; gap: 14px; min-height: 0; }
.settings-sidebar { position: sticky; top: 0; padding: 11px; border: 1px solid #274c40; border-radius: 13px; background: var(--ra-forest, #0F2A1F); box-shadow: 0 2px 12px rgba(16, 42, 36, .08); }
.settings-sidebar-label { padding: 4px 9px 9px; color: #97b5a2; font: 700 9px "IBM Plex Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.settings-tabs { display: grid; gap: 4px; }
.settings-tab { display: grid; grid-template-columns: 29px minmax(0, 1fr) 14px; align-items: center; gap: 8px; width: 100%; padding: 9px; border: 1px solid transparent; border-radius: 9px; color: #aac4b3; background: transparent; text-align: left; cursor: pointer; transition: color .16s var(--ease), background .16s var(--ease), transform .16s var(--ease); }
.settings-tab:hover { color: #eff9e8; background: rgba(255,255,255,.06); transform: translateX(1px); }
.settings-tab.is-active { color: #172a21; background: var(--accent-loud); box-shadow: 0 7px 18px rgba(198, 237, 119, .15); }
.settings-tab:focus-visible { outline: 2px solid var(--accent-loud); outline-offset: 2px; }
.settings-tab-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 8px; color: var(--accent-loud); background: rgba(198,237,119,.12); font-size: 13px; }
.settings-tab.is-active .settings-tab-icon { color: #203a2d; background: rgba(255,255,255,.42); }
.settings-tab-copy { min-width: 0; }
.settings-tab-copy strong, .settings-tab-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-tab-copy strong { font-size: 11px; }
.settings-tab-copy small { margin-top: 3px; color: #7f9d8c; font-size: 9px; line-height: 1.3; }
.settings-tab.is-active .settings-tab-copy small { color: #52705e; }
.settings-tab-arrow { color: #658575; font-size: 10px; }
.settings-tab.is-active .settings-tab-arrow { color: #527125; }
.settings-sidebar-note { display: flex; align-items: flex-start; gap: 8px; margin: 13px 4px 2px; padding: 10px 7px 3px; border-top: 1px solid rgba(255,255,255,.1); color: #91af9d; }
.settings-sidebar-note > i { margin-top: 1px; color: var(--accent-loud); font-size: 13px; }
.settings-sidebar-note strong, .settings-sidebar-note small { display: block; }
.settings-sidebar-note strong { color: #d7ebd5; font-size: 10px; }
.settings-sidebar-note small { margin-top: 3px; font-size: 9px; line-height: 1.4; }
.settings-main { min-width: 0; }
.settings-health-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 12px; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--border); }
.settings-health-item { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 10px 12px; background: var(--bg-surface); }
.settings-health-item small, .settings-health-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-health-item small { color: var(--text-dim); font: 600 8px "IBM Plex Mono", monospace; letter-spacing: .05em; text-transform: uppercase; }
.settings-health-item strong { margin-top: 3px; color: var(--text); font-size: 11px; }
.settings-health-dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: #d8e1da; box-shadow: 0 0 0 3px #f0f4f0; }
.settings-health-dot.is-good { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.settings-panel { padding: 19px 21px 20px; border: 1px solid var(--border); border-radius: 13px; background: var(--bg-surface); box-shadow: 0 7px 24px rgba(26, 58, 43, .04); animation: settings-panel-in .2s ease both; }
.settings-panel[hidden] { display: none; }
@keyframes settings-panel-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.settings-panel-heading { display: flex; align-items: flex-start; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border-light); }
.settings-panel-mark { display: grid; place-items: center; width: 37px; height: 37px; flex-shrink: 0; border-radius: 10px; color: var(--accent-deep); background: var(--accent-soft); font-size: 16px; }
.settings-panel-heading h3 { margin: 4px 0 4px; color: var(--text); font-size: 17px; letter-spacing: -.03em; }
.settings-panel-heading p { max-width: 680px; margin: 0; color: var(--text-muted); font-size: 11.5px; line-height: 1.5; }
.settings-fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 17px; padding-top: 17px; }
.settings-fields-grid--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-field--wide { grid-column: 1 / -1; }
.settings-panel .settings-field { min-width: 0; margin-bottom: 15px; }
.settings-panel .settings-field .input { background: #fbfdfb; }
.settings-panel .settings-label { margin-bottom: 6px; }
.settings-panel .settings-help { max-width: 410px; font-size: 10px; line-height: 1.45; }
.settings-test-box--upgraded { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(250px, 1.2fr); gap: 13px 20px; align-items: end; margin-top: 5px; padding: 14px; border: 1px solid #dcead1; border-radius: 10px; background: #F5FAEB; }
.settings-test-box--upgraded strong { display: block; margin-top: 5px; font-size: 12px; }
.settings-test-box--upgraded .settings-help { margin-bottom: 0; }
.settings-footer--upgraded { justify-content: space-between; margin-top: 13px; padding: 12px 2px 3px; }
.settings-footer--upgraded > div { display: grid; gap: 3px; }
.settings-footer--upgraded strong { font-size: 11px; }
.settings-footer--upgraded .settings-hint { font-size: 10px; }
.settings-search-match { outline: 2px solid rgba(198,237,119,.7); outline-offset: 3px; border-radius: 4px; }
.settings-search-empty { padding: 24px; color: var(--text-muted); text-align: center; font-size: 12px; }

@media (max-width: 900px) {
    .settings-layout { grid-template-columns: 1fr; }
    .settings-sidebar { position: static; }
    .settings-tabs { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 2px; }
    .settings-tab { min-width: 180px; }
    .settings-sidebar-note { display: none; }
}
@media (max-width: 640px) {
    .settings-header--upgraded { align-items: stretch; flex-direction: column; gap: 12px; }
    .settings-search-wrap { width: 100%; }
    .settings-health-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settings-panel { padding: 16px 14px; }
    .settings-fields-grid, .settings-fields-grid--wide { grid-template-columns: 1fr; gap: 0; }
    .settings-field--wide { grid-column: auto; }
    .settings-test-box--upgraded { grid-template-columns: 1fr; }
    .settings-footer--upgraded { align-items: flex-start; flex-direction: column; }
    .settings-footer--upgraded .btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    .settings-panel { animation: none; }
    .settings-tab { transition: none; }
}

/* --- Spinner utilities ------------------------------------------------------- */
.btn-spinner {
    display: inline-block; width: 13px; height: 13px;
    border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
    border-radius: 50%; animation: spin .6s linear infinite;
    vertical-align: -2px; margin-right: 2px;
}
button:disabled { opacity: .65; cursor: not-allowed; }
button.htmx-request { opacity: .75; pointer-events: none; }
.spinner {
    display: inline-block; width: 14px; height: 14px;
    border: 2px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin .6s linear infinite;
    flex-shrink: 0;
}

/* --- Auth (login) page ------------------------------------------------------- */
.auth-page {
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(99, 102, 241, .18), transparent 60%),
        radial-gradient(700px 400px at -10% 110%, rgba(14, 165, 233, .14), transparent 60%),
        var(--bg);
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px;
}
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 34px 34px 30px;
    animation: toast-in .25s var(--ease);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.auth-brand .brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); font-size: 22px; border: none; }
.auth-brand .brand-name { font-size: 19px; color: var(--text); }
.auth-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 4px; }
.auth-sub { color: var(--text-muted); font-size: 13.5px; margin-bottom: 22px; }
.auth-card .field-label { margin-bottom: 6px; }
.auth-card .input { padding: 10px 13px; font-size: 14px; margin-bottom: 14px; }
.auth-error {
    background: var(--danger-soft); color: var(--danger);
    border: 1px solid var(--danger-border);
    padding: 10px 13px; border-radius: 9px;
    font-size: 12.5px; margin-bottom: 14px;
}
.auth-footer { margin-top: 20px; text-align: center; font-size: 12px; color: var(--text-dim); }

/* --- Auth / onboarding product shell -------------------------------------- */
.auth-page.auth-product {
    min-height: 100vh; padding: 0; display: block; overflow-x: hidden;
    background: #f3f6f0;
}
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .82fr) minmax(520px, 1.18fr); }
.auth-rail {
    display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
    min-height: 100vh; padding: 34px clamp(30px, 5vw, 82px) 38px;
    color: #eff9ed; background:
        radial-gradient(480px 360px at 20% 7%, rgba(198,237,119,.19), transparent 66%),
        var(--ra-forest, #0F2A1F);
    position: relative; overflow: hidden;
}
.auth-rail::after {
    content: ""; position: absolute; width: 340px; height: 340px; right: -160px; bottom: -130px;
    border: 1px solid rgba(198,237,119,.25); border-radius: 50%; box-shadow: 0 0 0 30px rgba(198,237,119,.04), 0 0 0 60px rgba(198,237,119,.025);
}
.auth-logo { display: inline-flex; align-items: center; gap: 11px; color: #f7fbf4; text-decoration: none; position: relative; z-index: 1; }
.auth-logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 35px; height: 35px; border-radius: 10px; background: var(--accent-loud); color: var(--sidebar-bg); font-size: 17px; }
.auth-logo strong { display: block; font-size: 16px; letter-spacing: .02em; line-height: 1; }
.auth-logo small { display: block; margin-top: 3px; color: #9bb7a6; font: 500 9px/1 "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.auth-rail-copy { max-width: 430px; margin: auto 0; position: relative; z-index: 1; }
.auth-overline, .auth-kicker { color: var(--accent-loud); font: 600 10px/1.2 "IBM Plex Mono", monospace; letter-spacing: .14em; }
.auth-rail-copy h2 { max-width: 460px; margin: 14px 0 16px; color: #f8fbf5; font-size: clamp(34px, 4vw, 58px); line-height: 1.03; letter-spacing: -.065em; }
.auth-rail-copy p { max-width: 365px; color: #b6cfc0; font-size: 14px; line-height: 1.7; }
.auth-rail-note { display: flex; align-items: flex-start; gap: 11px; max-width: 380px; position: relative; z-index: 1; padding-top: 17px; border-top: 1px solid rgba(255,255,255,.14); }
.auth-note-mark { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 27px; height: 27px; border-radius: 8px; background: rgba(198,237,119,.17); color: var(--accent-loud); }
.auth-rail-note strong, .auth-rail-note small { display: block; }
.auth-rail-note strong { color: #ecf7e8; font-size: 11.5px; }
.auth-rail-note small { margin-top: 3px; color: #8da99a; font-size: 10.5px; line-height: 1.45; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; padding: 28px clamp(24px, 6vw, 110px); }
.auth-topline { display: flex; justify-content: space-between; align-items: center; gap: 18px; width: min(100%, 520px); margin-bottom: 18px; color: var(--text-dim); font: 600 9.5px/1.3 "IBM Plex Mono", monospace; letter-spacing: .1em; }
.auth-topline a, .auth-topline > span:last-child a { color: var(--accent-deep); font: 700 11px/1.3 "Manrope", sans-serif; letter-spacing: 0; text-decoration: none; }
.auth-topline a:hover { color: var(--accent); }
.auth-topline i { margin-left: 2px; }
.auth-topline > span { min-width: 0; }
.auth-card--product { max-width: 520px; width: 100%; padding: clamp(25px, 4vw, 42px); border-radius: 18px; }
.auth-card-heading { margin-bottom: 24px; }
.auth-kicker-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); font: 700 9px/1 "IBM Plex Mono", monospace; letter-spacing: .04em; text-transform: uppercase; }
.auth-kicker-chip--lime { background: #eef8d8; color: #527125; }
.auth-card-heading h1 { margin: 16px 0 7px; font-size: clamp(26px, 4vw, 34px); line-height: 1.05; letter-spacing: -.055em; }
.auth-card-heading p { max-width: 430px; color: var(--text-muted); font-size: 13px; line-height: 1.65; }
.auth-form { display: grid; gap: 15px; }
.auth-field { display: grid; gap: 6px; }
.auth-field > label, .auth-label-row label { color: var(--text); font-size: 11px; font-weight: 800; letter-spacing: .01em; }
.auth-field .input { margin: 0; padding: 11px 13px; background: #fff; }
.auth-field input:not([type="checkbox"]):not([type="radio"]) { width: 100%; min-height: 43px; margin: 0; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--text); font: inherit; }
.auth-field input:not([type="checkbox"]):not([type="radio"]):focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
.auth-field .input:focus { border-color: var(--accent); box-shadow: var(--shadow-focus); }
.auth-field.has-error .input { border-color: var(--danger); }
.auth-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-label-row a { color: var(--accent); font-size: 10.5px; font-weight: 700; text-decoration: none; }
.auth-field-error { color: var(--danger); font-size: 10.5px; line-height: 1.35; }
.auth-help { color: var(--text-dim); font-size: 10.5px; }
.auth-check-row { display: flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 11px; cursor: pointer; }
.auth-checkbox { accent-color: var(--accent); }
.auth-submit { margin-top: 4px; justify-content: space-between; padding-left: 17px; padding-right: 14px; }
.auth-submit i { font-size: 16px; transition: transform .15s var(--ease); }
.auth-submit:hover i { transform: translateX(3px); }
.auth-alert { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 17px; padding: 10px 12px; border: 1px solid var(--info-border); border-radius: 9px; background: var(--info-soft); color: var(--info); font-size: 11.5px; line-height: 1.45; }
.auth-alert--error { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger); }
.auth-alert i { margin-top: 1px; }
.auth-divider { display: flex; align-items: center; gap: 11px; margin: 21px 0 13px; color: var(--text-dim); font: 500 9.5px/1 "IBM Plex Mono", monospace; white-space: nowrap; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--border-light); }
.auth-secondary-action { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px; color: var(--accent-deep); font-size: 11.5px; font-weight: 800; text-decoration: none; transition: border-color .15s var(--ease), background .15s var(--ease); }
.auth-secondary-action:hover { border-color: var(--accent); background: var(--accent-soft); }
.auth-secondary-action i { color: var(--accent); }
.auth-form-note { display: flex; align-items: flex-start; gap: 7px; margin-top: 18px; color: var(--text-dim); font-size: 10.5px; line-height: 1.45; }
.auth-form-note i { color: var(--accent); font-size: 13px; }
.auth-copy { color: var(--text-muted); font-size: 13px; line-height: 1.65; }
.auth-copy a { color: var(--accent-deep); font-weight: 700; }
.auth-email-list { display: grid; gap: 8px; margin: 0 0 20px; }
.auth-email-option { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--border-light); background: var(--surface); }
.auth-email-option input { margin-top: 3px; accent-color: var(--accent); }
.auth-email-option span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; font-size: 12px; }
.auth-email-option small { padding: 2px 5px; border: 1px solid var(--border-light); color: var(--text-dim); font: 600 8px/1.4 "IBM Plex Mono", monospace; letter-spacing: .04em; text-transform: uppercase; }
.auth-action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.auth-status-card, .preference-status { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-subtle); }
.auth-status-card { margin-bottom: 16px; }
.auth-status-icon { display: inline-flex; align-items: center; justify-content: center; width: 29px; height: 29px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.auth-status-card strong, .auth-status-card small, .preference-status strong, .preference-status small { display: block; }
.auth-status-card strong, .preference-status strong { font-size: 11.5px; }
.auth-status-card small, .preference-status small { margin-top: 2px; color: var(--text-muted); font-size: 10.5px; line-height: 1.45; }
.preference-status { margin-bottom: 14px; }
.preference-status > i { color: var(--warning); font-size: 16px; }
.preference-status.is-verified { border-color: var(--success-border); background: var(--success-soft); }
.preference-status.is-verified > i { color: var(--success); }
.preference-form { display: grid; gap: 8px; }
.preference-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease); }
.preference-row:hover { border-color: var(--accent); background: var(--accent-soft); }
.preference-row input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--accent); }
.preference-row-copy { display: flex; flex-direction: column; gap: 3px; }
.preference-row-copy strong { font-size: 11.5px; }
.preference-row-copy small { color: var(--text-muted); font-size: 10.5px; line-height: 1.45; }
.auth-legal { width: min(100%, 520px); margin-top: 15px; color: var(--text-dim); font-size: 9.5px; line-height: 1.5; text-align: center; }
.auth-logout-form { margin: 0; }
.auth-logout-form button { border: 0; padding: 0; background: transparent; color: var(--accent-deep); cursor: pointer; font: 700 11px/1.3 "Manrope", sans-serif; }
.auth-logout-form button:hover { color: var(--accent); }
.onboarding-existing { display: grid; gap: 12px; padding: 13px; border: 1px solid var(--accent); border-radius: 11px; background: var(--accent-soft); }
.onboarding-existing-copy { display: flex; align-items: flex-start; gap: 9px; }
.onboarding-icon { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; flex-shrink: 0; border-radius: 8px; background: #fff; color: var(--accent); }
.onboarding-existing-copy strong, .onboarding-existing-copy small { display: block; }
.onboarding-existing-copy strong { font-size: 11.5px; }
.onboarding-existing-copy small { margin-top: 2px; color: var(--text-muted); font-size: 10.5px; }
.onboarding-progress { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; gap: 7px; margin-top: 25px; color: var(--text-dim); }
.onboarding-progress > span { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 1px solid var(--border); border-radius: 50%; font: 600 10px/1 "IBM Plex Mono", monospace; }
.onboarding-progress > span.is-active { border-color: var(--accent); background: var(--accent); color: #fff; }
.onboarding-progress > i { height: 1px; background: var(--border); }
.onboarding-progress small { grid-column: 1 / -1; margin-top: 3px; font-size: 9.5px; }
.guide-list { display: grid; gap: 8px; }
.guide-step { display: flex; align-items: flex-start; gap: 11px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; color: inherit; text-decoration: none; transition: border-color .15s var(--ease), background .15s var(--ease), transform .15s var(--ease); }
.guide-step:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.guide-step-index { flex-shrink: 0; padding-top: 2px; color: var(--accent); font: 600 10px/1 "IBM Plex Mono", monospace; }
.guide-step-copy { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.guide-step-copy strong { font-size: 11.5px; }
.guide-step-copy small { color: var(--text-muted); font-size: 10.5px; line-height: 1.45; }
.guide-step > i { margin-top: 2px; color: var(--accent); font-size: 14px; }
.guide-complete-form { margin-top: 19px; }

/* --- Utility classes --------------------------------------------------------- */
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.ms-2 { margin-left: 8px; }
.tab-empty { padding: 16px 8px; color: var(--text-muted); font-size: 13px; }
.tab-empty p { margin-bottom: 10px; }
.th-center, .td-ok, .td-score { text-align: center; }

/* --- Onboarding (detail empty) ------------------------------------------------ */
.onboarding { text-align: center; padding: 24px 16px; }
.onboarding h3 { font-size: 17px; margin-bottom: 4px; }
.onboarding > p { margin-bottom: 16px; color: var(--text-muted); font-size: 13px; }
.onboarding-steps { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.onboard-step {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 10px 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: 9px;
}
.step-num {
    flex-shrink: 0;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent); color: #fff;
    border-radius: 50%;
    font-size: 12px; font-weight: 700;
}
.onboard-step strong { font-size: 13px; display: block; margin-bottom: 2px; }
.onboard-step .text-muted { font-size: 12px; }
.onboard-step .btn { margin-top: 6px; }

/* --- Responsive --------------------------------------------------------------- */
.app-shell.sidebar-compact .app-sidebar { width: 78px; flex-basis: 78px; }
.app-shell.sidebar-compact .sidebar-head { justify-content: center; position: relative; padding-left: 0; padding-right: 0; }
.app-shell.sidebar-compact .brand-copy,
.app-shell.sidebar-compact .sidebar-status span:not(.live-dot),
.app-shell.sidebar-compact .sidebar-section-label,
.app-shell.sidebar-compact .sidebar-link-label,
.app-shell.sidebar-compact .sidebar-subnav,
.app-shell.sidebar-compact .sidebar-submenu-toggle,
.app-shell.sidebar-compact .sidebar-user-copy { display: none; }
.app-shell.sidebar-compact .sidebar-collapse { position: absolute; right: -1px; top: 0; }
.app-shell.sidebar-compact .sidebar-status { justify-content: center; padding: 8px 0; }
.app-shell.sidebar-compact .sidebar-team-switcher { display: none; }
.app-shell.sidebar-compact .sidebar-link,
.app-shell.sidebar-compact .sidebar-logout { justify-content: center; padding-left: 0; padding-right: 0; position: relative; }
.app-shell.sidebar-compact .sidebar-badge { position: absolute; top: 3px; right: 7px; min-width: 15px; padding: 0 3px; font-size: 9px; }
.app-shell.sidebar-compact .sidebar-user { justify-content: center; padding-left: 0; padding-right: 0; }
.app-shell.sidebar-compact .sidebar-logout i { margin: 0; }

@media (max-width: 1280px) {
    .stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-body { grid-template-columns: minmax(0, 1fr) 500px; }
}
@media (max-width: 1024px) {
    .app-sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; flex-basis: 236px; transform: translateX(-102%); box-shadow: 18px 0 40px rgba(10, 24, 16, .2); }
    .app-shell.sidebar-open .app-sidebar { transform: translateX(0); }
    .app-shell.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(12, 25, 18, .38); }
    .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .sidebar-collapse { display: none; }
    .app-topbar { padding: 0 18px; }
    .app-main { height: calc(100vh - 68px); overflow: hidden; padding: 18px 18px 20px; }
    .dashboard-body { grid-template-columns: 1fr; }
    .dashboard-body > * { height: 50vh; }
    .detail-panel { position: static; }
    .discovery-layout { grid-template-columns: 1fr; }
    .discovery-config { max-height: none; }
    .page-content { height: 100%; }
    .team-control-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pipeline-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .panel-header { flex-direction: column; align-items: stretch; }
    .filter-bar { flex-direction: column; }
    .filter-bar .input, .filter-bar input[name="search"] { width: 100%; }
    .detail-actions { grid-template-columns: 1fr; }
    .panel-context { width: 100%; margin-left: 0; }
    .linkedin-list-panel { flex-basis: 280px; }
    .app-main { padding: 15px 12px 16px; }
    .app-topbar { height: 60px; flex-basis: 60px; padding: 0 12px; }
    .app-main { height: calc(100vh - 60px); }
    .topbar-search { min-width: 34px; width: 34px; justify-content: center; padding: 8px; }
    .topbar-search span, .topbar-search kbd, .topbar-live { display: none; }
    .dashboard-intro { align-items: flex-start; flex-direction: column; gap: 10px; }
    .dashboard-intro h1 { font-size: 22px; }
    .intro-signal { width: 100%; }
    .metric-rail { overflow-x: auto; margin: 0 -4px; padding-bottom: 2px; }
    .metric-rail span { padding: 0 12px; }
    .quick-actions { align-items: stretch; flex-direction: column; }
    .quick-actions-primary, .quick-actions-secondary { width: 100%; }
    .quick-actions-primary .btn { flex: 1; }
    .quick-actions-secondary { margin-left: 0; justify-content: space-between; }
    .automation-browser-header { padding: 18px 16px 14px; }
    .automation-browser-selection { padding: 12px 16px 14px; }
    .selection-mode-grid { grid-template-columns: 1fr; }
    .automation-browser-toolbar { padding: 10px 16px; align-items: flex-start; flex-direction: column; }
    .automation-selection-persist { margin-left: 0; }
    .automation-browser-footer { padding: 10px 16px; }
    .automation-runbar { margin-left: -18px; margin-right: -18px; }
    .automation-flow-header { align-items: flex-start; flex-direction: column; }
    .automation-flow-toolbar { width: 100%; justify-content: flex-start; }
    .automation-flow-workbench { grid-template-columns: 1fr; }
    .automation-flow-palette { border-right: 0; border-bottom: 1px solid #e1ebe3; display: flex; gap: 10px; overflow-x: auto; padding: 12px; }
    .flow-panel-heading, .flow-palette-label { display: none; }
    .flow-palette-group { display: flex; align-items: center; gap: 5px; padding: 0; border-top: 0; }
    .flow-palette-node { width: auto; min-width: 118px; grid-template-columns: 22px minmax(0, 1fr); padding: 7px; }
    .flow-palette-node em { display: none; }
    .flow-palette-node > i { width: 22px; height: 22px; }
    .automation-flow-inspector { border-left: 0; border-top: 1px solid #e1ebe3; min-height: 250px; }
    .automation-flow-footer { align-items: flex-start; flex-direction: column; }
    .automation-flow-triggers { grid-template-columns: 1fr; }
    .automation-workflow-runs-list { grid-column: auto; }
    .automation-workflow-run-row { grid-template-columns: 1fr 1fr; }
    .sidebar-team-switcher { margin-bottom: 13px; }
    .team-page-header { flex-direction: column; gap: 10px; }
    .team-current-pill { align-items: flex-start; width: 100%; }
    .team-card { padding: 14px; }
    .team-card-heading--spread { align-items: flex-start; }
    .team-invite-bar { grid-template-columns: 1fr; padding: 12px 14px; }
    .team-members-card > .team-card-heading { padding: 14px; }
    .team-members-table th, .team-members-table td { padding-left: 14px; padding-right: 14px; }
    .auth-layout { display: block; }
    .auth-rail { min-height: auto; padding: 22px 20px 24px; }
    .auth-rail-copy { margin: 35px 0 4px; }
    .auth-rail-copy h2 { max-width: 450px; margin-top: 10px; font-size: 31px; }
    .auth-rail-copy p, .auth-rail-note { display: none; }
    .auth-main { min-height: calc(100vh - 185px); padding: 22px 14px 28px; justify-content: flex-start; }
    .auth-topline { margin-bottom: 13px; }
    .auth-card--product { padding: 24px 20px; }
    .auth-legal { margin-top: 12px; }
}

/* --- Reduced motion ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ============================================================================
   Inbox — email chat workspace
   ============================================================================ */
.nav-badge {
    display: inline-flex; align-items: center;
    background: #ef4444; color: #fff;
    border-radius: 10px;
    padding: 0 6px; font-size: 10px; font-weight: 700;
    line-height: 1.7; min-width: 16px; justify-content: center;
    margin-left: 2px;
}

.inbox-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 14px;
    flex: 1; min-height: 0; overflow: hidden;
}
.inbox-side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.inbox-side-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 14px; border-bottom: 1px solid var(--border-light); flex-shrink: 0;
}
.start-convo {
    display: flex; gap: 6px;
    padding: 10px 12px; border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.conversation-list { flex: 1; overflow-y: auto; }
.convo-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background .12s var(--ease);
}
.convo-item:hover { background: var(--bg-subtle); }
.convo-item.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.company-avatar--sm { width: 34px; height: 34px; font-size: 11px; border-radius: 9px; }
.convo-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.convo-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-preview { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.convo-time { font-size: 10px; color: var(--text-dim); white-space: nowrap; }
.convo-unread {
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px;
    background: var(--accent); color: #fff;
    font-size: 10.5px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.convo-empty { text-align: center; color: var(--text-muted); padding: 36px 16px; font-size: 12.5px; }
.convo-empty i { font-size: 30px; color: var(--text-dim); display: block; margin-bottom: 8px; }

/* Chat panel */
.chat-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.thread-header {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-subtle);
    flex-shrink: 0;
}
.thread-header h3 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.thread-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.thread-messages {
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
    background: var(--bg-subtle);
}
.chat-bubble {
    max-width: 76%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.chat-bubble--outbound {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-bubble--inbound {
    align-self: flex-start;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.chat-bubble--failed { opacity: .75; border: 1px solid var(--danger-border); }
.bubble-meta {
    display: flex; justify-content: space-between; gap: 10px;
    font-size: 10.5px; margin-bottom: 4px;
    opacity: .75; font-weight: 600;
}
.chat-bubble--inbound .bubble-meta { color: var(--text-muted); }
.bubble-subject { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble-time { flex-shrink: 0; }
.bubble-body { line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.bubble-status { font-size: 11px; font-weight: 600; margin-top: 6px; display: flex; align-items: center; gap: 5px; }
.bubble-status--tracking { color: var(--text-dim); }
.thread-empty {
    margin: auto; text-align: center; color: var(--text-muted);
    font-size: 13px; padding: 24px;
}
.thread-empty i { font-size: 34px; color: var(--text-dim); display: block; margin-bottom: 8px; }
.thread-empty-panel {
    height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--text-muted); text-align: center; padding: 32px; gap: 8px;
}

/* Composer */
.composer { border-top: 1px solid var(--border-light); padding: 12px 14px; background: var(--bg-surface); flex-shrink: 0; }
.composer-mode { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.composer-toggle {
    font-family: inherit; font-size: 11.5px; font-weight: 600;
    padding: 5px 11px; border-radius: 16px;
    border: 1px solid var(--border); background: var(--bg-subtle);
    color: var(--text-muted); cursor: pointer;
    display: inline-flex; align-items: center; gap: 5px;
    transition: all .15s var(--ease);
}
.composer-toggle:hover { border-color: #c7d2fe; color: var(--text); }
.composer-toggle.active {
    background: var(--accent); border-color: var(--accent); color: #fff;
    box-shadow: 0 1px 3px rgba(79, 70, 229, .35);
}
.composer-imap-hint {
    margin-left: auto; font-size: 10.5px; color: var(--text-dim);
    display: inline-flex; align-items: center; gap: 4px;
}
.inbox-polling {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; margin-bottom: 10px;
    border-radius: 8px; font-size: 12px;
    background: var(--info-soft); border: 1px solid var(--info-border);
    color: var(--text);
}
.inbox-polling--done { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.inbox-polling--error { background: var(--danger-soft, #fef2f2); border-color: var(--danger-border, #fecaca); color: #b91c1c; }
.loading-spinner-sm {
    width: 14px; height: 14px; flex-shrink: 0;
    border: 2px solid rgba(8, 145, 178, .2);
    border-top-color: var(--info);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
.composer-subject { margin-bottom: 6px; }
.composer-body { margin-bottom: 8px; }
.composer-row { display: flex; align-items: center; gap: 10px; }
.composer-hint { font-size: 11px; color: var(--text-dim); flex: 1; }
.composer-blocked {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; border-radius: 8px;
    background: var(--warning-soft); border: 1px solid var(--warning-border);
    color: #92400e; font-size: 12.5px;
}

/* Chat inside the detail panel */
#tab-chat .chat-thread { height: 380px; }
#tab-chat .thread-header { padding: 10px 12px; }
#tab-chat .thread-messages { padding: 12px; }
#tab-chat .chat-bubble { max-width: 88%; }
.tab-dot {
    background: var(--accent); color: #fff;
    border-radius: 8px; font-size: 9.5px; font-weight: 700;
    padding: 1px 5px; line-height: 1.5;
}

/* ============================================================================
   Audit report v2
   ============================================================================ */
.audit-report .signal-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 10px 13px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-light);
}
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 600;
    padding: 3px 9px; border-radius: 14px;
    background: var(--bg-inset); color: var(--text-muted);
    border: 1px solid var(--border);
}
.chip--ok, .chip--good { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.chip--warn { background: var(--warning-soft); color: #b45309; border-color: var(--warning-border); }
.chip--bad { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.chip--info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }

.da-card {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px; margin-bottom: 12px;
    background: var(--bg-subtle); border: 1px solid var(--border-light);
    border-radius: var(--radius);
}
.da-score {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 62px; height: 62px; border-radius: 50%;
    border: 3px solid; flex-shrink: 0;
}
.da-score--good { border-color: var(--success); background: var(--success-soft); }
.da-score--warn { border-color: var(--warning); background: var(--warning-soft); }
.da-score--bad { border-color: var(--danger); background: var(--danger-soft); }
.da-number { font-size: 20px; font-weight: 800; line-height: 1; }
.da-score--good .da-number { color: var(--success); }
.da-score--warn .da-number { color: var(--warning); }
.da-score--bad .da-number { color: var(--danger); }
.da-label { font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.da-meta { flex: 1; min-width: 0; }

.keyword-row { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 13px; border-bottom: 1px solid var(--border-light); }

.offpage-block { padding: 6px 0; border-top: 1px solid var(--border-light); }
.offpage-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 13px;
}
.offpage-head h5 { font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.offpage-form { padding: 0 13px 10px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mini-table th {
    text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-muted);
    padding: 5px 13px; border-top: 1px solid var(--border-light);
}
.mini-table td { padding: 6px 13px; border-top: 1px solid var(--border-light); vertical-align: middle; }
.mention-list { list-style: none; padding: 4px 13px 10px; }
.mention-item {
    display: flex; align-items: flex-start; gap: 9px;
    padding: 8px 10px;
    border: 1px solid var(--border-light); border-radius: 8px;
    margin-bottom: 6px; font-size: 12.5px;
    background: var(--bg-subtle);
}
.mention-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mention-meta a { color: var(--text); font-weight: 600; text-decoration: none; }
.mention-meta a:hover { color: var(--accent); }
.mention-item .badge { margin-top: 2px; }

/* ============================================================================
   Demo proposal
   ============================================================================ */
.proposal-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.proposal-meta .btn { margin-left: auto; }
.proposal-body h3 { font-size: 16px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 8px; }
.proposal-intro { color: var(--text-muted); font-size: 13px; margin-bottom: 12px; line-height: 1.6; }
.proposal-body h4 {
    font-size: 12.5px; font-weight: 700; margin: 12px 0 6px;
    display: flex; align-items: center; gap: 6px; color: var(--text);
}
.proposal-body h4 i { color: var(--accent); }
.proposal-body ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.proposal-body ul li {
    padding: 7px 10px;
    background: var(--bg-subtle); border: 1px solid var(--border-light);
    border-radius: 8px; font-size: 12.5px;
}
.proposal-prompt { margin-top: 14px; }
.proposal-prompt summary {
    cursor: pointer; font-size: 12px; font-weight: 600;
    color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px;
}
.proposal-prompt summary:hover { color: var(--text); }
.proposal-prompt pre {
    margin-top: 8px; padding: 12px;
    background: var(--bg-inset); border: 1px solid var(--border);
    border-radius: 8px; font-size: 11px; line-height: 1.6;
    white-space: pre-wrap; word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text-muted); max-height: 220px; overflow-y: auto;
}
.proposal-edit .field-label { margin-top: 10px; }

/* --- Responsive: inbox ------------------------------------------------------- */
@media (max-width: 1024px) {
    .inbox-layout { grid-template-columns: 1fr; height: auto; overflow: visible; }
    .inbox-side { max-height: 45vh; }
    .chat-panel { height: 65vh; }
}

/* Lead scoring (AI-powered fit/priority) */
.badge-score.score-good { background: var(--success-soft); color: var(--success); }
.badge-score.score-warm { background: var(--warning-soft); color: var(--warning); }
.badge-score.score-cool { background: var(--warning-soft); color: var(--warning); }
.badge-score.score-bad  { background: var(--danger-soft); color: var(--danger); }
.badge-score.score-neutral { background: #f1f5f9; color: var(--text-muted); }

.score-card {
  margin: 10px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-surface);
}
.score-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.score-reasoning {
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
  flex: 1;
  min-width: 180px;
}
.score-factors { display: flex; flex-direction: column; gap: 4px; }
.score-factor {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.score-factor-name { width: 64px; text-align: right; color: var(--text-muted); font-weight: 600; text-transform: capitalize; }
.score-factor-bar { width: 52px; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.score-factor-fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.score-factor-note { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Email validation status dots */
.val-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  font-size: 9px; font-weight: 800; line-height: 1; margin-left: 4px;
  vertical-align: middle;
}
.val-ok { background: var(--success); color: #fff; }
.val-bad { background: var(--danger); color: #fff; }
.val-warn { background: var(--warning); color: #fff; }

/* Citations — local-SEO NAP tracking */
.cit-summary { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:10px; }
.cit-nap { font-size:11.5px; font-weight:600; color:var(--text-muted); }
.cit-missing { font-size:11.5px; font-weight:600; color:var(--danger); }
.cit-list { display:flex; flex-direction:column; gap:8px; }
.cit-row { border:1px solid var(--border); border-radius:8px; padding:8px 10px; background:var(--bg-surface); }
.cit-row-top { display:flex; justify-content:space-between; align-items:center; }
.cit-label { font-weight:700; font-size:12.5px; }
.cit-status { font-size:11px; color:var(--text-muted); display:flex; align-items:center; gap:4px; }
.cit-vd { font-size:9.5px; text-transform:uppercase; letter-spacing:.03em; background:var(--border); padding:1px 6px; border-radius:10px; }
.cit-nap-ok { background:var(--success-soft); color:var(--success); }
.cit-url { font-size:11px; margin:3px 0 5px; }
.cit-url a { color:var(--accent); }
.cit-controls { display:flex; gap:12px; font-size:11px; flex-wrap:wrap; }
.cit-check { display:inline-flex; align-items:center; gap:4px; color:var(--text-muted); cursor:pointer; }
.cit-url-edit input { width:100%; font-size:11px; margin-top:5px; padding:4px 7px; border:1px solid var(--border); border-radius:6px; }
.cit-checklist { margin-top:12px; border:1px solid var(--border); border-radius:8px; padding:10px 12px; background:var(--success-soft); }
.cit-checklist-title { font-weight:700; font-size:12px; margin-bottom:6px; }
.cit-checklist ul { margin-left:16px; font-size:11.5px; color:var(--text); }
.cit-checklist li { margin:2px 0; }

/* Settings textarea (email signature etc.) */
.settings-textarea { resize: vertical; font-family: inherit; line-height: 1.5; }

/* Composer AI assist */
.composer-ai-row { display:flex; align-items:center; gap:8px; margin:6px 0; }
.composer-ai-row[hidden] { display:none; }

/* --- Booked conversations inside the lead inspector ---------------------- */
.audits-page { overflow-y: auto; padding-bottom: 28px; }
.audit-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.audit-page-header h1 { display: flex; align-items: center; gap: 9px; font-size: 23px; letter-spacing: -.035em; }
.audit-page-header h1 i { color: var(--accent); }
.audit-page-header p { max-width: 720px; margin-top: 5px; color: var(--text-muted); font-size: 12px; }
.audit-messages { margin-bottom: 12px; }
.audit-ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface); box-shadow: var(--shadow-sm); }
.audit-ledger > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 15px 17px; border-right: 1px solid var(--border-light); }
.audit-ledger > div:last-child { border-right: 0; }
.audit-ledger small { color: var(--text-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.audit-ledger strong { font-size: 21px; font-variant-numeric: tabular-nums; }
.audit-ledger strong span { color: var(--text-dim); font-size: 10px; font-weight: 600; }
.audit-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.audit-results-card, .audit-queue-card { min-width: 0; }
.audit-results-card .card-header p, .audit-queue-card .card-header p { margin-top: 3px; font-size: 10.5px; }
.audit-table-wrap { overflow-x: auto; }
.audit-table { min-width: 920px; }
.audit-table td:first-child strong, .audit-table td:first-child a, .audit-table td:nth-last-child(2) span, .audit-table td:nth-last-child(2) small { display: block; }
.audit-table td:first-child a { max-width: 230px; margin-top: 2px; overflow: hidden; color: var(--text-muted); font-size: 9.5px; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.audit-table td:not(:first-child):not(:last-child) { font-size: 11px; font-variant-numeric: tabular-nums; }
.audit-table td:nth-last-child(2) small { color: var(--text-dim); font-size: 9px; }
.audit-score { display: inline-grid; min-width: 34px; height: 27px; place-items: center; border-radius: 7px; background: var(--warning-soft); color: var(--warning); font-weight: 800; }
.audit-score.is-good { background: var(--success-soft); color: var(--success); }
.audit-score.is-low { background: var(--danger-soft); color: var(--danger); }
.audit-queue { padding: 4px 14px 10px; }
.audit-queue-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.audit-queue-row:last-child { border-bottom: 0; }
.audit-queue-row .company-avatar { width: 30px; height: 30px; border-radius: 8px; background: var(--sidebar-bg); color: var(--accent-loud); }
.audit-queue-row > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; }
.audit-queue-row strong { overflow: hidden; font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.audit-queue-row small { overflow: hidden; color: var(--text-dim); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.audit-queue-empty { display: flex; min-height: 190px; align-items: center; justify-content: center; flex-direction: column; gap: 4px; color: var(--text-muted); text-align: center; }
.audit-queue-empty i { margin-bottom: 5px; color: var(--success); font-size: 25px; }
.audit-queue-empty span { font-size: 10.5px; }

.lead-bookings-section {
    margin: 16px 0 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.lead-bookings-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}
.lead-bookings-heading h4 {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -.01em;
}
.lead-bookings-heading h4 i { color: var(--accent); }
.lead-bookings-heading > small {
    color: var(--text-dim);
    font: 500 9px/1.2 "IBM Plex Mono", monospace;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}
.lead-booking-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-subtle);
    box-shadow: var(--shadow-sm);
}
.lead-booking-card + .lead-booking-card { margin-top: 9px; }
.lead-booking-card > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 11px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-surface);
}
.lead-booking-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.lead-booking-title > span:last-child { display: flex; min-width: 0; flex-direction: column; gap: 1px; }
.lead-booking-title strong { overflow: hidden; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.lead-booking-title small { color: var(--text-muted); font-size: 9.5px; }
.lead-booking-mark {
    display: inline-grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent-deep);
}
.lead-booking-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.lead-booking-grid > div {
    min-width: 0;
    padding: 9px 11px;
    border-bottom: 1px solid var(--border-light);
}
.lead-booking-grid > div:nth-child(odd) { border-right: 1px solid var(--border-light); }
.lead-booking-grid small,
.lead-booking-note small {
    display: block;
    margin-bottom: 3px;
    color: var(--text-dim);
    font: 600 8.5px/1.25 "IBM Plex Mono", monospace;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.lead-booking-grid strong,
.lead-booking-grid span,
.lead-booking-grid a {
    display: block;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 10.5px;
    line-height: 1.45;
    text-decoration: none;
}
.lead-booking-grid strong { font-weight: 750; }
.lead-booking-grid a { color: var(--accent-deep); }
.lead-booking-grid a:hover { text-decoration: underline; }
.lead-booking-when {
    background: var(--accent-soft);
    box-shadow: inset 3px 0 0 var(--accent);
}
.lead-booking-note { padding: 9px 11px; border-bottom: 1px solid var(--border-light); }
.lead-booking-note p { color: var(--text-muted); font-size: 10.5px; line-height: 1.5; }
.lead-booking-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    padding: 9px 11px;
    background: var(--bg-surface);
}
.lead-booking-actions form { margin: 0; }
.lead-booking-actions select {
    min-width: 112px;
    padding: 6px 26px 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text);
    font: 600 10px/1.2 inherit;
}
.lead-booking-actions a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent-deep);
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
}
.lead-booking-actions a:hover { text-decoration: underline; }

/* --- Appointment booking workspace -------------------------------------- */
.bookings-page { overflow-y: auto; padding-bottom: 28px; }
.bookings-page-header { align-items: flex-start; min-height: auto; }
.bookings-page-header h2 { margin-bottom: 4px; }.bookings-page-header p { max-width: 680px; }
.bookings-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bookings-messages { margin: 0 0 14px; }.booking-message { padding: 10px 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--success-soft); color: var(--success); font-size: 12px; }.booking-message--error { background: var(--danger-soft); color: var(--danger); }
.bookings-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.bookings-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 14px; align-items: start; }
.bookings-list-card { min-width: 0; }.bookings-list-card .card-header { align-items: flex-start; }.bookings-list-card .card-header p { margin-top: 4px; font-size: 11px; }
.booking-table-wrap { overflow-x: auto; }.booking-table { min-width: 770px; }.booking-table td:first-child strong, .booking-table td:first-child small, .booking-table td:nth-child(2) small, .booking-table td:nth-child(3) strong, .booking-table td:nth-child(3) small { display: block; }.booking-table td small { margin-top: 4px; color: var(--text-muted); font-size: 10px; }.booking-table td .meta-link { display: inline-block; margin-top: 5px; font-size: 10px; }.booking-status-form select { max-width: 120px; padding: 6px 7px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); color: var(--text); font-size: 10px; }
.booking-booker-cell { min-width: 260px; }.booker-heading { display: flex; align-items: center; gap: 9px; }.booker-avatar { display: inline-grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; background: var(--sidebar-bg); color: var(--accent-loud); font-size: 12px; font-weight: 800; }.booker-heading strong, .booker-heading a { display: block; }.booker-heading strong { font-size: 12px; }.booker-heading a { margin-top: 3px; color: var(--text-muted); font-size: 10px; text-decoration: none; }.booker-heading a:hover { color: var(--accent-deep); }.booker-company { display: block; margin: 7px 0 0 39px; color: var(--text-muted); font-size: 10px; }.booker-company i { color: var(--accent-deep); }.booker-details { margin: 8px 0 0 39px; }.booker-details summary { color: var(--accent-deep); cursor: pointer; font-size: 10px; list-style: none; }.booker-details summary::-webkit-details-marker { display: none; }.booker-details summary i { margin-right: 3px; }.booker-details[open] summary { color: var(--text); font-weight: 700; }.booker-detail-panel { width: min(390px, calc(100vw - 90px)); margin-top: 9px; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-subtle); box-shadow: 0 12px 30px rgba(24,34,33,.08); }.booker-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 15px; }.booker-detail-grid > div { min-width: 0; }.booker-detail-grid small, .booker-note small { display: block; margin: 0 0 3px; color: var(--text-muted); font: 500 9px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .05em; }.booker-detail-grid span, .booker-detail-grid a { display: block; overflow-wrap: anywhere; color: var(--text); font-size: 10.5px; text-decoration: none; }.booker-detail-grid a:hover { color: var(--accent-deep); }.booker-note { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }.booker-note p { margin: 0; color: var(--text); font-size: 10.5px; line-height: 1.5; }.booker-audit { display: flex; flex-wrap: wrap; gap: 7px 12px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 9.5px; }.booker-audit i { color: var(--accent-deep); }.booker-confirmed { color: var(--success); }.booker-warning { color: var(--danger); }.booker-lead-link { display: inline-block; margin-top: 11px; color: var(--accent-deep); font-size: 10px; text-decoration: none; }.booker-lead-link span { color: var(--text-muted); }.booker-lead-link:hover { text-decoration: underline; }.booker-muted { color: var(--text-muted)!important; }
.booking-empty-state { padding: 70px 25px; }.bookings-side-stack { min-width: 0; }.booking-settings-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; align-items: start; }.bookings-page .booking-config-card { flex: none; overflow: hidden; }.booking-config-card .card-header { padding-bottom: 13px; }.booking-config-card .card-header h3 { font-size: 14px; }.booking-config-card .card-header h3 i { margin-right: 5px; color: var(--accent); }.booking-config-card .card-header p { margin-top: 4px; font-size: 10.5px; }.booking-config-form { padding: 0 16px 15px; }.booking-config-form .field-label { display: block; margin-bottom: 11px; font-size: 10.5px; }.booking-config-form .input { margin-top: 5px; font-size: 11px; }.booking-config-form .form-row { gap: 8px; }.booking-config-form .check-label { margin: 8px 0; font-size: 11px; }.booking-config-form .btn { margin-top: 5px; }
.booking-specialist-layout { display: grid; grid-template-columns: minmax(0, 760px) minmax(260px, 1fr); gap: 14px; align-items: start; }
.booking-context-card { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface); box-shadow: var(--shadow); }
.booking-context-card h3 { margin-bottom: 6px; font-size: 16px; }
.booking-context-card > p { color: var(--text-muted); font-size: 11.5px; line-height: 1.6; }
.booking-context-card nav { display: grid; gap: 5px; margin-top: 16px; }
.booking-context-card nav a { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px; border: 1px solid var(--border-light); border-radius: 7px; color: var(--text-muted); font-size: 11px; font-weight: 700; text-decoration: none; }
.booking-context-card nav a:hover, .booking-context-card nav a.is-current { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); }
.booking-detail-panel { overflow: visible; }.booking-detail-placeholder { min-height: 300px; }.booking-detail-inner { padding: 18px; }.booking-detail-inner .detail-heading { min-width: 0; }.booking-detail-inner .detail-heading h3 { overflow-wrap: anywhere; }.booking-detail-avatar { display: grid; place-items: center; background: var(--sidebar-bg); color: var(--accent-loud); font-weight: 800; }.booking-detail-subtitle { display: block; margin-top: 3px; color: var(--text-muted); font-size: 10px; }.booking-detail-badges { margin-bottom: 13px; }.booking-detail-grid .it-value strong { font-weight: 800; }.booking-detail-note { margin-top: 13px; padding: 11px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 7px 7px 0; }.booking-detail-note .it-label { margin-bottom: 6px; }.booking-detail-note p { margin: 0; color: var(--text); font-size: 11.5px; line-height: 1.5; }.booking-linked-lead { display: flex; align-items: center; gap: 9px; margin-top: 13px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 8px; }.booking-linked-lead > i { color: var(--accent-deep); font-size: 16px; }.booking-linked-lead span { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }.booking-linked-lead small { color: var(--text-muted); font: 500 9px "IBM Plex Mono", monospace; text-transform: uppercase; }.booking-linked-lead strong { overflow-wrap: anywhere; font-size: 11px; }.booking-linked-lead a { color: var(--accent-deep); font-size: 10px; text-decoration: none; }.booking-linked-lead a:hover { text-decoration: underline; }.booking-detail-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--border); }.booking-detail-actions form { margin: 0; }.booking-detail-actions .field-label { display: block; font-size: 10.5px; }.booking-detail-actions .input { margin-top: 5px; font-size: 11px; }.booking-open-detail { margin-bottom: 6px; font-size: 10px; }.booking-status-form { display: block; }
.booking-type-row, .booking-block-row { display: flex; align-items: flex-start; gap: 9px; margin: 0 16px; padding: 10px 0; border-top: 1px solid var(--border); }.booking-type-row > div, .booking-block-row { min-width: 0; flex: 1; }.booking-type-row strong, .booking-type-row small, .booking-block-row strong, .booking-block-row small { display: block; }.booking-type-row strong, .booking-block-row strong { font-size: 11.5px; }.booking-type-row small, .booking-block-row small { margin-top: 3px; color: var(--text-muted); font-size: 10px; }.booking-type-row small a { color: var(--accent-deep); }.booking-type-state { color: var(--success); font: 500 9px "IBM Plex Mono", monospace; text-transform: uppercase; }.booking-color-dot { flex: 0 0 9px; width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; }.booking-rule-list { margin: 0 16px 8px; border-top: 1px solid var(--border); }.booking-rule-list > div { display: grid; grid-template-columns: 76px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 10px; }.booking-rule-list strong { font: 600 10px "IBM Plex Mono", monospace; }.booking-rule-list small { color: var(--text-muted); text-align: right; }.booking-rule-list p { padding: 11px 0; font-size: 10px; }.booking-side-empty { margin: 0 16px 15px; color: var(--text-muted); font-size: 10px; }
.booking-type-edit { margin-top: 7px; }.booking-type-edit summary { display: inline-block; color: var(--accent-deep); cursor: pointer; font-size: 10px; }.booking-type-edit .booking-config-form { margin-top: 10px; padding: 11px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-subtle); }.booking-type-edit .form-row { grid-template-columns: 1fr 1fr; }
@media (max-width: 1180px) { .bookings-workspace, .booking-specialist-layout, .audit-workspace { grid-template-columns: 1fr; }.booking-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }.booking-settings-grid .booking-config-card:first-child { grid-column: 1 / -1; } }
@media (max-width: 720px) { .bookings-stats, .booking-settings-grid, .audit-ledger { grid-template-columns: 1fr; }.audit-ledger > div { border-right: 0; border-bottom: 1px solid var(--border-light); }.audit-ledger > div:last-child { border-bottom: 0; }.audit-page-header { flex-direction: column; }.booking-settings-grid .booking-config-card:first-child { grid-column: auto; }.bookings-page-header { flex-direction: column; gap: 12px; }.bookings-header-actions { width: 100%; }.bookings-header-actions .btn { flex: 1; }.booking-table { min-width: 680px; }.lead-booking-grid { grid-template-columns: 1fr; }.lead-booking-grid > div:nth-child(odd) { border-right: 0; } }

/* --- Connected lead journey ------------------------------------------------- */
.lead-journey {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    flex-shrink: 0; overflow: hidden; margin: 0 0 14px;
    border: 1px solid var(--border); border-radius: 11px; background: rgba(255,254,250,.78);
    box-shadow: var(--shadow-sm);
}
.lead-journey-step {
    position: relative; display: flex; min-width: 0; align-items: center; gap: 9px;
    padding: 10px 12px; color: var(--text-muted); text-decoration: none;
    border-right: 1px solid var(--border-light); transition: background .15s var(--ease), color .15s var(--ease);
}
.lead-journey-step:last-child { border-right: 0; }
.lead-journey-step:hover { color: var(--text); background: var(--bg-subtle); }
.lead-journey-step.is-current { color: var(--accent-deep); background: var(--accent-soft); }
.lead-journey-step.is-current::after { content: ""; position: absolute; inset: auto 12px 0; height: 2px; background: var(--accent); }
.lead-journey-number { display: grid; width: 23px; height: 23px; flex: 0 0 23px; place-items: center; border: 1px solid var(--border); border-radius: 50%; background: #fff; font: 600 10px/1 "IBM Plex Mono", monospace; }
.lead-journey-step.is-current .lead-journey-number { border-color: var(--accent); color: #fff; background: var(--accent); }
.lead-journey-step > span:last-child { min-width: 0; }
.lead-journey-step strong, .lead-journey-step small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-journey-step strong { font-size: 10.5px; }
.lead-journey-step small { margin-top: 1px; color: var(--text-dim); font-size: 8.5px; }

.discovery-form-intro { padding: 2px 2px 7px; }
.discovery-form-intro h3 { margin-top: 3px; font-size: 17px; letter-spacing: -.025em; }
.discovery-form-intro p { max-width: 480px; margin-top: 3px; color: var(--text-muted); font-size: 11px; }
.config-section legend > span { display: inline-grid; width: 19px; height: 19px; margin-right: 4px; place-items: center; border-radius: 50%; color: #fff; background: var(--accent); font: 600 9px/1 "IBM Plex Mono", monospace; }
.config-section--primary { border-color: rgba(47,117,106,.28); background: var(--bg-surface); }
.discovery-locations { min-height: 86px; resize: vertical; line-height: 1.5; }
.discovery-safety-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 9px; padding: 9px 10px; border: 1px solid var(--success-border); border-radius: 8px; color: var(--text-muted); background: var(--success-soft); font-size: 10px; line-height: 1.45; }
.discovery-safety-note i { margin-top: 1px; color: var(--success); font-size: 14px; }
.discovery-safety-note strong { display: block; color: var(--text); }

.audit-row-actions { display: flex; gap: 4px; }
.automation-operating-model { display: grid; grid-template-columns: minmax(240px,.8fr) minmax(520px,1.8fr); gap: 18px; align-items: center; flex-shrink: 0; margin-bottom: 12px; padding: 13px 16px; border: 1px solid #cadfd1; border-radius: 12px; background: var(--bg-surface); }
.automation-operating-heading h3 { margin-top: 2px; font-size: 14px; }
.automation-operating-heading p { margin-top: 3px; color: var(--text-muted); font-size: 9.5px; line-height: 1.45; }
.automation-contract-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; }
.automation-contract-grid > div { display: flex; min-width: 0; align-items: center; gap: 7px; padding: 8px; border: 1px solid rgba(47,117,106,.12); border-radius: 8px; background: rgba(255,255,255,.78); }
.automation-contract-grid i { color: var(--accent); font-size: 15px; }
.automation-contract-grid span { min-width: 0; }
.automation-contract-grid strong, .automation-contract-grid small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.automation-contract-grid strong { font-size: 9.5px; }
.automation-contract-grid small { color: var(--text-dim); font-size: 8px; }
.flow-next-run { flex-basis: 100%; color: var(--accent) !important; }
.automation-workflow-runs-list { grid-column: 1 / -1; display: grid; gap: 7px; }
.automation-workflow-run-row { display: block; padding: 10px 11px; border: 1px solid var(--border); border-left: 3px solid var(--text-dim); border-radius: 8px; background: #fff; }
.automation-workflow-run-row.is-completed { border-left-color: var(--success); }
.automation-workflow-run-row.is-failed { border-left-color: var(--danger); }
.automation-workflow-run-row.is-waiting { border-left-color: var(--warning); }
.automation-run-summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.automation-run-summary strong { min-width: 72px; text-transform: capitalize; }
.automation-run-summary span, .automation-run-summary small { color: var(--text-muted); font-size: 9.5px; }
.automation-run-summary small { margin-left: auto; }
.automation-run-error { margin-top: 6px; color: var(--danger); font-size: 10px; }
.automation-run-problems { display: grid; gap: 3px; margin-top: 7px; padding: 7px 8px; border-radius: 6px; color: var(--text-muted); background: var(--bg-subtle); font-size: 9px; }
.automation-run-actions { display: flex; gap: 6px; margin-top: 8px; }
.workflow-run-source { display: flex; align-items: flex-start; gap: 9px; margin: 10px 0; padding: 10px; border: 1px solid var(--success-border); border-radius: 8px; color: var(--text-muted); background: var(--success-soft); }
.workflow-run-source i { margin-top: 1px; color: var(--accent); font-size: 16px; }
.workflow-run-source span { min-width: 0; }
.workflow-run-source strong, .workflow-run-source small { display: block; }
.workflow-run-source strong { color: var(--text); font-size: 11px; }
.workflow-run-source small { margin-top: 2px; font-size: 9.5px; line-height: 1.45; }
.workflow-run-source--empty { border-color: var(--warning-border); background: var(--warning-soft); }
.workflow-run-source--empty i { color: var(--warning); }

@media (max-width: 1100px) {
    .lead-journey-step small { display: none; }
    .automation-operating-model { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .lead-journey { grid-template-columns: repeat(5, minmax(48px,1fr)); }
    .lead-journey-step { justify-content: center; padding: 9px 5px; }
    .lead-journey-step > span:last-child { display: none; }
    .automation-contract-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* RadarAlfa visual system --------------------------------------------------
   Applied after the legacy shell styles so every existing screen inherits the
   same premium operations palette without changing routes or components. */
:root {
    --bg: var(--ra-canvas, #F6F8F1);
    --bg-surface: var(--ra-surface, #FFFFFF);
    --bg-subtle: #F1F4EC;
    --bg-inset: var(--ra-sage, #E5EADF);
    --text: var(--ra-text, #1F2A24);
    --text-muted: var(--ra-muted, #687B72);
    --text-dim: #8A9990;
    --border: var(--ra-border, #DCE4DB);
    --border-light: #E8EEE6;
    --accent: var(--ra-forest, #0F2A1F);
    --accent-hover: #1C4432;
    --accent-soft: #E6F0E1;
    --accent-deep: var(--ra-forest, #0F2A1F);
    --accent-loud: var(--ra-lime, #C7E96B);
    --sidebar-bg: var(--ra-sidebar, #192920);
    --header-bg: var(--ra-forest, #0F2A1F);
    --success: var(--ra-success, #246B46);
    --warning: var(--ra-warning, #A45B13);
    --danger: var(--ra-danger, #B33434);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(15,42,31,.04);
    --shadow: 0 2px 12px rgba(15,42,31,.045);
}
body { font-family: var(--ra-font, Inter, ui-sans-serif, system-ui, sans-serif); background: var(--ra-canvas, #F6F8F1); }
.app-topbar { background: var(--ra-surface, #fff) !important; color: var(--ra-text, #1F2A24); box-shadow: none; }
.app-sidebar { background: var(--ra-sidebar, #192920); }
.app-sidebar .brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--ra-lime, #C7E96B); box-shadow: none; }
.app-sidebar .brand-mark img { width: 22px; height: 22px; display: block; }
.auth-logo-mark { display: grid; place-items: center; background: var(--ra-lime, #C7E96B) !important; color: var(--ra-forest, #0F2A1F); border-radius: 8px; }
.auth-logo-mark img { width: 21px; height: 21px; }
.app-sidebar .brand-name { letter-spacing: -.03em; }
.sidebar-link.active { background: var(--ra-lime, #C7E96B); box-shadow: none; }
.btn-primary, .btn-success, .btn-danger { background: var(--ra-forest, #0F2A1F) !important; background-image: none !important; border-color: var(--ra-forest, #0F2A1F) !important; }
.btn-primary:hover:not(:disabled), .btn-success:hover:not(:disabled) { background: #1C4432 !important; }
.btn-accent, .btn-lime { background: var(--ra-lime, #C7E96B) !important; color: var(--ra-forest, #0F2A1F) !important; background-image: none !important; }
.card, .panel, .lead-list-panel, .detail-panel, .settings-sidebar, .settings-card { border-radius: 8px; box-shadow: var(--shadow-sm); }

/* Operational surfaces should read as a precise workbench, not floating
   consumer cards. Keep controls and status pills rounded, but tighten the
   main containers to a near-square 4px corner. */
.card, .panel, .lead-list-panel, .detail-panel, .settings-sidebar, .settings-card,
.app-shell .workspace-card, .app-shell .section-card { border-radius: 4px; }
.automation-operating-model, .config-section--primary, .settings-test-box--upgraded { background: var(--ra-surface, #fff) !important; background-image: none !important; }
.automation-flow-canvas { background-color: #EEF2EA; background-image: radial-gradient(#BFCDBE 1px, transparent 1px); }
.topbar-kicker, .eyebrow { font-family: "DM Mono", ui-monospace, monospace; }
:focus-visible { outline-color: var(--ra-focus, #496F2B); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
