/* bringga CRM — engineering-drawing aesthetic carried over from bringga.com:
   navy ink on paper, hairline rules, mono for annotation and numbers, and a
   single redline accent that only ever means "a problem". */

:root {
    --navy: #1e3a5f;
    --navy-deep: #16293f;
    --blue: #2d5f96;
    --blue-wash: #eaf0f7;
    --redline: #c1272d;
    --ink: #22303f;
    --muted: #6b7a8c;
    --hairline: #dfe3ea;
    --paper: #f4f6f9;
    --font-display: 'Archivo', 'Helvetica Neue', system-ui, sans-serif;
    --font-body: 'Schibsted Grotesk', system-ui, -apple-system, sans-serif;
    --font-mono: 'Spline Sans Mono', ui-monospace, 'SF Mono', monospace;
}

body {
    background: var(--paper);
    font-family: var(--font-body);
    color: var(--ink);
}

/* --- Header -------------------------------------------------------------- */
.app-header {
    border-bottom: 1px solid var(--hairline);
    padding-bottom: 14px;
}
.brand-display {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--navy);
}
.brand-sub {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.6px;
    color: var(--muted);
    margin-top: 2px;
}
.whoami {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
}
.app-footer {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    margin-top: 24px;
    padding: 14px 0 6px;
    border-top: 1px solid var(--hairline);
}

/* --- Panels -------------------------------------------------------------- */
.panel {
    background: #fff;
    border: 1px solid var(--hairline);
    border-radius: 6px;
    padding: 18px 20px;
}
.panel.h-100 { display: flex; flex-direction: column; }
.panel-header { margin-bottom: 14px; }
.panel-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 12px;
}

/* --- Stat strip ---------------------------------------------------------- */
.stat-strip {
    display: flex;
    background: #fff;
    border: 1px solid var(--hairline);
    border-radius: 6px;
    overflow: hidden;
}
.stat-strip-item {
    flex: 1 1 0;
    padding: 14px 18px;
    border-right: 1px solid var(--hairline);
    min-width: 0;
    transition: background 0.15s ease;
}
.stat-strip-item:last-child { border-right: none; }
.stat-strip-item:hover { background: #fafbfc; }
.stat-strip-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    margin-bottom: 6px;
}
.stat-strip-value {
    font-family: var(--font-display);
    font-size: 23px;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.05;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}
.stat-strip-value--accent { color: var(--blue); }
.stat-strip-value--warn { color: var(--redline); }
.stat-strip-hint {
    font-size: 10px;
    color: #9aa6b4;
    margin-top: 4px;
    line-height: 1.25;
}

/* --- Tables -------------------------------------------------------------- */
.dash-spreadsheet-inner table thead th {
    padding: 10px 14px !important;
    line-height: 1.3 !important;
    font-family: var(--font-body);
}
.dash-spreadsheet-inner table tbody td {
    padding: 9px 14px !important;
}
.column-header-name { padding-left: 14px !important; }
.column-header--sort {
    opacity: 0.35;
    transition: opacity 0.15s ease, color 0.15s ease;
}
th:hover .column-header--sort { opacity: 0.85 !important; }
.column-header--sort:has(.fa-sort-up),
.column-header--sort:has(.fa-sort-down) {
    opacity: 1 !important;
    color: var(--blue) !important;
}
.dash-cell a { text-decoration: none; color: var(--blue); }
.dash-cell a:hover { text-decoration: underline; }
/* Em-dash placeholder so a blank cell reads as "no value" not "not loaded" */
.dash-cell-value:empty::before { content: '—'; color: #c3cbd6; }

input[type="text"].form-control:focus,
input[type="password"].form-control:focus {
    box-shadow: 0 0 0 .15rem rgba(45, 95, 150, .15);
    border-color: var(--blue);
}

/* --- Segmented control --------------------------------------------------- */
.bg-segmented {
    display: flex;
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: 5px;
    padding: 3px;
    margin: 4px 0 10px;
}
.bg-seg {
    flex: 1 1 0;
    min-width: 0;
    padding: 5px 6px;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    color: var(--muted);
    background: transparent;
    border: none;
    border-radius: 3px;
    transition: background 0.12s ease, color 0.12s ease;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bg-seg:hover { background: var(--blue-wash); color: var(--blue); }
.bg-seg.is-active {
    background: #fff;
    color: var(--navy);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 30, 60, 0.10);
}

/* --- Chips / badges ------------------------------------------------------ */
.bg-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #c9d6e5;
    background: var(--blue-wash);
    color: var(--navy);
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
    line-height: 1;
}
.bg-chip:hover { background: #dde8f4; border-color: var(--blue); }
.bg-chip:active { transform: translateY(1px); }
.bg-chip i { font-size: 10px; opacity: 0.7; }

.bg-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    background: var(--paper);
    border: 1px solid var(--hairline);
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
    white-space: nowrap;
}
.bg-badge-mono {
    font-family: var(--font-mono);
    font-size: 10px;
    color: #9aa6b4;
}

.saved-views-leader {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
}

.company-pill {
    display: inline-flex;
    align-items: center;
    background: var(--navy);
    color: #fff;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 3px;
}
.pill-clear {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    margin-left: 8px;
    padding: 0;
    opacity: 0.8;
}
.pill-clear:hover { opacity: 1; }

/* --- Outreach performance table ----------------------------------------- */
.camp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.camp-table thead th {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 500;
    color: var(--muted);
    text-align: right;
    padding: 0 12px 8px 12px;
    border-bottom: 1px solid var(--hairline);
    white-space: nowrap;
}
.camp-table thead th:first-child { text-align: left; }
.camp-table tbody td {
    padding: 9px 12px;
    color: var(--ink);
    border-bottom: 1px solid #f0f2f6;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.camp-table .camp-name { text-align: left; font-weight: 500; }
.camp-table .camp-num { text-align: right; }
.camp-table .camp-seg,
.camp-table .camp-dates {
    text-align: left;
    color: var(--muted);
    font-size: 0.86em;
    white-space: nowrap;
}
.camp-table .camp-pct--warn { color: var(--redline); font-weight: 600; }
.camp-table .camp-total-row td {
    border-top: 1px solid var(--hairline);
    border-bottom: none;
    font-weight: 600;
    color: var(--navy);
}
.camp-table tbody tr:last-child td { border-bottom: none; }
.camp-foot {
    margin-top: 12px;
    font-size: 12px;
    color: var(--muted);
}
.camp-foot-sep { color: #c3cbd6; }

/* --- List lines (recent emails, needs attention) ------------------------- */
.list-line {
    padding: 8px 0;
    border-bottom: 1px solid #f0f2f6;
    font-size: 13px;
}
.list-line:last-child { border-bottom: none; }
.hint-mono {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: 3px;
    padding: 7px 10px;
    margin-top: 12px;
    overflow-x: auto;
    white-space: nowrap;
}

/* --- Activity feed ------------------------------------------------------- */
.activity-feed-text {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}
.activity-mode-btn {
    margin-left: auto;
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
    font-size: 11px;
    opacity: 0.35;
    transition: opacity 0.15s ease;
}
.activity-mode-btn:hover { opacity: 1; color: var(--blue); }

/* --- Empty state --------------------------------------------------------- */
.empty-state-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
}
.empty-state-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    background: var(--blue-wash);
    border: 1px solid #c9d6e5;
    color: var(--navy);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
}

/* --- Buttons ------------------------------------------------------------- */
.btn-primary {
    background-color: var(--navy);
    border-color: var(--navy);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--navy-deep) !important;
    border-color: var(--navy-deep) !important;
    color: #fff !important;
}
.btn-primary:focus { box-shadow: 0 0 0 .2rem rgba(30, 58, 95, .35) !important; }
.btn-light {
    border-color: var(--hairline);
    color: #45566a;
    font-size: 13px;
    font-weight: 500;
}
.btn-light:hover {
    background: var(--blue-wash);
    border-color: #c9d6e5;
    color: var(--navy);
}
#more-filters-toggle .fa-chevron-up { color: var(--blue); }

/* --- Loading indicator --------------------------------------------------- */
body.app-loading::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        rgba(30, 58, 95, 0)   0%,
        rgba(45, 95, 150, .7) 30%,
        rgba(45, 95, 150,  1) 50%,
        rgba(45, 95, 150, .7) 70%,
        rgba(30, 58, 95, 0) 100%
    );
    background-size: 50% 100%;
    background-repeat: no-repeat;
    z-index: 10001;
    pointer-events: none;
    animation: bg-scan 1.05s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes bg-scan {
    0%   { background-position: -50% 0; }
    100% { background-position: 150% 0; }
}
body.app-loading #contacts-table,
body.app-loading #companies-table {
    transition: opacity 0.2s ease;
    opacity: 0.55;
}

@media (prefers-reduced-motion: reduce) {
    body.app-loading::before { animation: none; opacity: 0.6; }
    .bg-chip, .bg-seg, .stat-strip-item { transition: none; }
}

/* Sub-heading inside a panel that holds two lists (replies, then follow-ups) */
.sub-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: var(--muted);
    margin: 14px 0 4px;
    padding-top: 12px;
    border-top: 1px solid var(--hairline);
}
