/* ================================================================
   bfount Lead Portal — Design System v4
   Professional · Responsive · Mobile-first
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── RESET & BASE ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --brand:        #E8600A;
    --brand-dark:   #c44e08;
    --brand-light:  #fff4ef;
    --navy:         #1A3A5C;
    --navy-dark:    #0f2337;
    --navy-mid:     #254e7a;
    --text:         #111827;
    --text-2:       #6B7280;
    --text-3:       #9CA3AF;
    --border:       #E5E7EB;
    --border-2:     #F3F4F6;
    --surface:      #fff;
    --bg:           #F9FAFB;
    --bg-2:         #F3F4F6;
    --success:      #059669;
    --success-bg:   #D1FAE5;
    --warning:      #D97706;
    --warning-bg:   #FEF3C7;
    --danger:       #DC2626;
    --danger-bg:    #FEE2E2;
    --info:         #2563EB;
    --info-bg:      #DBEAFE;
    --purple:       #7C3AED;
    --purple-bg:    #EDE9FE;
    --radius:       10px;
    --radius-lg:    14px;
    --radius-sm:    7px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow:       0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg:    0 20px 50px rgba(0,0,0,.15), 0 8px 20px rgba(0,0,0,.08);
    --sidebar-w:    230px;
    --topbar-h:     60px;
}

html { font-size: 15px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px; background: var(--bg); color: var(--text);
    line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ── ADMIN LAYOUT ─────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w); min-width: var(--sidebar-w);
    background: linear-gradient(180deg, #0d1f35 0%, #162d4a 40%, #1A3A5C 100%);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 300; overflow-y: auto; overflow-x: hidden;
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,.22);
}
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 299; backdrop-filter: blur(2px);
}
.main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* Mobile topbar for admin */
.mob-topbar {
    display: none; align-items: center; justify-content: space-between;
    padding: 0 16px; height: 56px;
    background: var(--navy); position: sticky; top: 0; z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.mob-topbar img { height: 30px; border-radius: 5px; background: #fff; padding: 2px 5px; }
.hamburger {
    width: 38px; height: 38px; border: none; background: rgba(255,255,255,.1);
    border-radius: 8px; cursor: pointer; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 5px;
}
.hamburger span { width: 18px; height: 2px; background: #fff; border-radius: 2px; display: block; transition: all .2s; }

.page { padding: 28px 32px; flex: 1; }

/* Sidebar internals */
.sb-logo {
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex; flex-direction: column; gap: 4px;
}
.sb-logo img { height: 36px; width: auto; border-radius: 6px; background: #fff; padding: 3px 7px; }
.sb-sub { color: rgba(255,255,255,.3); font-size: 10px; font-weight: 600;
          text-transform: uppercase; letter-spacing: .8px; }
.sb-section {
    padding: 16px 18px 5px; color: rgba(255,255,255,.25);
    font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 18px; color: rgba(255,255,255,.55);
    font-size: 13px; font-weight: 500; cursor: pointer;
    border-left: 3px solid transparent;
    transition: all .15s; text-decoration: none; position: relative;
    margin: 1px 0;
}
.nav-item:hover { background: rgba(255,255,255,.10); color: #fff; }
.nav-item.active {
    background: linear-gradient(90deg, rgba(232,96,10,.28) 0%, rgba(232,96,10,.08) 100%);
    color: #fff;
    border-left-color: var(--brand); font-weight: 700;
}
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-notif {
    position: absolute; right: 12px;
    background: var(--brand); color: #fff;
    border-radius: 20px; font-size: 10px; font-weight: 700;
    padding: 1px 6px; min-width: 18px; text-align: center;
}
.sb-footer {
    padding: 16px 18px; border-top: 1px solid rgba(255,255,255,.08);
    margin-top: auto;
}

/* ── PAGE STRUCTURE ───────────────────────────────────────────────── */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 24px; gap: 12px; flex-wrap: wrap;
}
.page-title  { font-size: 24px; font-weight: 800; letter-spacing: -.4px; color: #0F172A; }
.page-sub    { font-size: 12px; color: var(--text-2); margin-top: 3px; }

/* ── STAT CARDS ──────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px; margin-bottom: 24px;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 18px 20px;
    display: flex; flex-direction: column; gap: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
    position: relative; overflow: hidden;
    transition: box-shadow .15s, transform .15s;
}
.stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.1); transform: translateY(-2px); }
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--brand), #f58b3e);
}
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, #2563EB, #60A5FA); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, #059669, #34D399); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, #7C3AED, #A78BFA); }
.stat-num   { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.stat-label { font-size: 11px; color: var(--text-2); font-weight: 600;
              text-transform: uppercase; letter-spacing: .5px; }
.stat-sub   { font-size: 11px; color: var(--text-3); }
.color-orange { color: var(--brand); }
.color-blue   { color: var(--navy); }
.color-green  { color: var(--success); }
.color-purple { color: var(--purple); }

/* ── CARDS ───────────────────────────────────────────────────────── */
.card {
    background: var(--surface); border: 1px solid #E8ECF2;
    border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.04);
}
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: #0F172A; }
.card-desc  { font-size: 12px; color: var(--text-2); margin-top: -10px; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── BUTTONS ─────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; border: 1px solid #D1D5DB;
    background: var(--surface); color: #374151; cursor: pointer;
    font-family: inherit; transition: all .15s; text-decoration: none;
    white-space: nowrap; line-height: 1;
}
.btn:hover { background: #F8FAFC; border-color: #9CA3AF; color: #111827; }
.btn:active { transform: scale(.98); }
.btn-primary {
    background: linear-gradient(135deg, #E8600A 0%, #d4540a 100%);
    color: #fff; border-color: #E8600A;
    box-shadow: 0 2px 6px rgba(232,96,10,.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #d4540a 0%, #c04808 100%);
    border-color: #c04808; color: #fff;
    box-shadow: 0 3px 10px rgba(232,96,10,.4);
}
.btn-dark    { background: var(--navy); color: #fff; border-color: var(--navy);
               box-shadow: 0 2px 6px rgba(26,58,92,.25); }
.btn-dark:hover { background: var(--navy-dark); color: #fff; border-color: var(--navy-dark); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #047857; color: #fff; }
.btn-danger  { color: var(--danger); border-color: #FECACA; background: #FEF2F2; }
.btn-danger:hover { background: #FEE2E2; border-color: var(--danger); color: #991B1B; }
.btn-ghost   { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--text); border-color: var(--border); }
.btn-sm  { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-xs  { padding: 4px 9px; font-size: 11px; border-radius: 6px; }
.btn-block { width: 100%; padding: 11px; font-size: 14px; }
button.btn { cursor: pointer; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── FORMS ───────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 14px; }
.form-label  { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--text-2); }
.req         { color: var(--brand); }
.form-control {
    width: 100%; padding: 9px 12px;
    border: 1.5px solid #D1D5DB; border-radius: var(--radius-sm);
    font-size: 13px; font-family: inherit;
    background: var(--surface); color: var(--text); outline: none;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
}
.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(232,96,10,.12);
}
.form-control::placeholder { color: #9CA3AF; }
textarea.form-control { resize: vertical; min-height: 72px; line-height: 1.5; }
select.form-control   { cursor: pointer; }
.form-control:disabled { background: var(--bg-2); color: var(--text-3); cursor: not-allowed; }
.form-hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* ── BADGES & TAGS ───────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 4px 11px; border-radius: 20px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
    letter-spacing: .2px;
}
.badge-info         { background: #2563EB; color: #fff; }
.badge-warning      { background: #D97706; color: #fff; }
.badge-success      { background: #059669; color: #fff; }
.badge-success-soft { background: #0891B2; color: #fff; }
.badge-danger       { background: #DC2626; color: #fff; }
.badge-purple       { background: #7C3AED; color: #fff; }
.badge-approved     { background: #059669; color: #fff; }
.tag {
    display: inline-flex; align-items: center;
    padding: 3px 9px; border-radius: 6px;
    font-size: 11px; font-weight: 500;
    background: var(--bg-2); color: var(--text-2);
    border: 1px solid var(--border);
}

/* ── TABLE ───────────────────────────────────────────────────────── */
.table-wrap {
    border: 1px solid #E2E8F0; border-radius: var(--radius-lg);
    overflow: hidden; overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.04);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 380px; }
th {
    text-align: left; padding: 11px 14px;
    background: #F1F5F9; color: #475569;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .7px; border-bottom: 2px solid #E2E8F0;
    white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid #F1F5F9; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #F0F6FF; }
tbody tr { transition: background .1s; }

/* ── ALERTS ──────────────────────────────────────────────────────── */
.alert {
    padding: 13px 16px; border-radius: var(--radius);
    margin-bottom: 16px; font-size: 13px; line-height: 1.6;
    display: flex; align-items: flex-start; gap: 10px;
    border-left: 4px solid;
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #F0FDF4; color: #14532D; border-color: #059669; }
.alert-danger  { background: #FEF2F2; color: #7F1D1D; border-color: #DC2626; }
.alert-info    { background: #EFF6FF; color: #1E3A8A; border-color: #2563EB; }
.alert-warning { background: #FFFBEB; color: #78350F; border-color: #D97706; }

/* ── PROGRESS ────────────────────────────────────────────────────── */
.progress      { height: 6px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg,var(--brand),var(--navy-mid)); transition: width .4s; }

/* ── FILTER ROW ──────────────────────────────────────────────────── */
.filter-row {
    display: flex; gap: 8px; margin-bottom: 18px;
    flex-wrap: wrap; align-items: flex-end;
    background: var(--surface); padding: 14px 16px;
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.filter-row .form-control { flex: 1 1 130px; min-width: 100px; max-width: 200px; }
.filter-row .btn { flex-shrink: 0; }

/* ── PAGINATION ──────────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.page-btn {
    min-width: 34px; height: 34px; display: flex; align-items: center;
    justify-content: center; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
    color: var(--text-2); background: var(--surface); cursor: pointer;
    text-decoration: none; transition: all .12s;
}
.page-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ── DETAIL ROWS ─────────────────────────────────────────────────── */
.detail-row {
    display: flex; padding: 9px 0;
    border-bottom: 1px solid var(--border-2); font-size: 13px;
    gap: 12px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-2); width: 170px; flex-shrink: 0; font-weight: 500; }
.detail-value { font-weight: 600; min-width: 0; word-break: break-word; }

/* ── FIELD BUILDER ───────────────────────────────────────────────── */
.field-item {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 11px 14px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: 7px; transition: border-color .12s;
}
.field-item:hover { border-color: #D1D5DB; }
.drag-handle  { cursor: grab; color: var(--text-3); font-size: 15px; flex-shrink: 0; padding-top: 2px; }
.field-type-tag {
    font-size: 10px; padding: 3px 8px; border-radius: 5px;
    background: var(--info-bg); color: var(--info);
    font-weight: 700; text-transform: uppercase; letter-spacing: .3px; flex-shrink: 0;
}
.opt-row { display: flex; gap: 7px; margin-bottom: 7px; align-items: center; }
.toggle-row { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12px; color: var(--text-2); user-select: none; }
.toggle {
    width: 30px; height: 17px; border-radius: 9px;
    background: var(--border); position: relative;
    transition: background .15s; flex-shrink: 0; display: inline-block;
}
.toggle.on { background: var(--brand); }
.toggle::after {
    content: ''; position: absolute; top: 2.5px; left: 2.5px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #fff; transition: left .15s;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.toggle.on::after { left: 15.5px; }

/* ── MESSAGES ────────────────────────────────────────────────────── */
.msg-thread {
    display: flex; flex-direction: column; gap: 10px;
    max-height: 340px; overflow-y: auto; padding: 6px 4px;
    margin-bottom: 14px; scroll-behavior: smooth;
}
.msg-thread::-webkit-scrollbar { width: 4px; }
.msg-thread::-webkit-scrollbar-track { background: transparent; }
.msg-thread::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.msg-admin {
    align-self: flex-end; background: var(--navy);
    color: #fff; padding: 10px 14px;
    border-radius: 16px 16px 3px 16px;
    font-size: 13px; max-width: 80%; line-height: 1.55;
    box-shadow: 0 2px 6px rgba(26,58,92,.2);
}
.msg-cc {
    align-self: flex-start; background: var(--surface);
    color: var(--text); padding: 10px 14px;
    border-radius: 16px 16px 16px 3px;
    font-size: 13px; max-width: 80%;
    border: 1px solid var(--border); line-height: 1.55;
    box-shadow: var(--shadow-sm);
}
.msg-time { font-size: 10px; color: var(--text-3); margin-top: 4px; }

/* ── LEAD / CAMP CARDS ───────────────────────────────────────────── */
.lead-card {
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
    transition: border-color .15s, box-shadow .15s;
}
.lead-card:hover { border-color: #D1D5DB; box-shadow: var(--shadow); }
.camp-card {
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin-bottom: 10px;
    transition: border-color .15s, box-shadow .15s;
}
.camp-card:hover { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(232,96,10,.07); }
.camp-card-inner  { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.camp-card-body   { flex: 1; min-width: 0; }
.camp-card-title  { font-size: 14px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.camp-card-desc   { font-size: 13px; color: var(--text-2); margin-bottom: 8px; line-height: 1.5; }
.camp-card-meta   { font-size: 11px; color: var(--text-3); }
.camp-card-action { flex-shrink: 0; padding-top: 2px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

/* ── COMMENTS ────────────────────────────────────────────────────── */
.comment-thread { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.comment        { display: flex; flex-direction: column; max-width: 84%; }
.comment.admin  { align-self: flex-end;   align-items: flex-end; }
.comment.cc     { align-self: flex-start; align-items: flex-start; }
.comment-bubble {
    padding: 10px 14px; border-radius: 14px;
    font-size: 13px; line-height: 1.55; word-break: break-word;
}
.comment.admin .comment-bubble {
    background: var(--navy); color: #fff;
    border-radius: 14px 14px 3px 14px;
    box-shadow: 0 2px 6px rgba(26,58,92,.15);
}
.comment.cc .comment-bubble {
    background: var(--surface); color: var(--text);
    border: 1.5px solid var(--border); border-radius: 14px 14px 14px 3px;
    box-shadow: var(--shadow-sm);
}
.comment-meta { font-size: 10px; color: var(--text-3); margin-top: 4px; }
.comment-box  { border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 14px; transition: border-color .15s; }
.comment-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(232,96,10,.08); }
.comment-box textarea {
    width: 100%; border: none; outline: none; resize: none;
    padding: 12px 14px; font-size: 13px; font-family: inherit;
    background: var(--bg); min-height: 70px; color: var(--text);
}
.comment-box-footer {
    display: flex; justify-content: flex-end; align-items: center;
    padding: 8px 12px; background: var(--bg-2);
    border-top: 1px solid var(--border); gap: 10px;
}

/* ── LOGIN PAGE ──────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-mid) 100%);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-box {
    background: var(--surface); border-radius: 18px;
    padding: 36px 34px; width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: loginIn .3s ease;
}
@keyframes loginIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .sub { font-size: 12px; color: var(--text-2); margin-top: 6px; }
.login-tabs {
    display: flex; background: var(--bg-2); border-radius: var(--radius-sm);
    padding: 3px; margin-bottom: 20px; gap: 3px;
}
.login-tab {
    flex: 1; text-align: center; padding: 9px;
    border-radius: 7px; cursor: pointer; font-size: 13px;
    font-weight: 600; color: var(--text-2);
    background: transparent; border: none; font-family: inherit;
    transition: all .15s;
}
.login-tab.active {
    background: var(--surface); color: var(--navy);
    box-shadow: 0 1px 4px rgba(0,0,0,.1); font-weight: 700;
}
.login-divider { text-align:center; color:var(--text-3); font-size:11px; margin:14px 0; position:relative; }
.login-divider::before { content:''; position:absolute; top:50%; left:0; right:0; height:1px; background:var(--border); }
.login-divider span { background:var(--surface); padding:0 10px; position:relative; }

/* ── MISC ────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 52px 20px; color: var(--text-3); }
.hidden-repush { display: none; }
.empty-icon  { font-size: 44px; margin-bottom: 12px; }
.empty-title { font-size: 15px; font-weight: 700; color: var(--text-2); margin-bottom: 5px; }
.divider     { border: none; border-top: 1px solid var(--border-2); margin: 16px 0; }
.text-muted  { color: var(--text-2); }
.fs-12 { font-size: 12px; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-0  { margin-bottom: 0; }
.gap-8 { gap: 8px; }

/* ── TOAST NOTIFICATIONS ─────────────────────────────────────────── */
#toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none; max-width: 360px; width: calc(100vw - 40px);
}
.toast {
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--surface); border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.08);
    padding: 14px 16px; border-left: 4px solid var(--brand);
    pointer-events: all; cursor: pointer;
    animation: toastIn .3s cubic-bezier(.21,1.02,.73,1) forwards;
    font-size: 13px; line-height: 1.5; position: relative; overflow: hidden;
}
.toast-message { border-color: var(--navy); }
.toast-success { border-color: var(--success); }
.toast-error   { border-color: var(--danger); }
.toast-info    { border-color: var(--info); }
.toast-comment { border-color: var(--purple); }
.toast-icon    { font-size: 20px; flex-shrink: 0; line-height: 1; margin-top: 1px; }
.toast-title   { font-weight: 700; color: var(--text); margin-bottom: 2px; }
.toast-body    { color: var(--text-2); font-size: 12px; }
.toast-close   {
    position: absolute; top: 10px; right: 10px;
    background: none; border: none; cursor: pointer;
    color: var(--text-3); font-size: 18px; line-height: 1;
    padding: 2px 5px; border-radius: 4px;
}
.toast-close:hover { color: var(--text); background: var(--bg-2); }
.toast-progress {
    position: absolute; bottom: 0; left: 0; height: 3px;
    background: currentColor; opacity: .2; border-radius: 0 0 12px 12px;
    animation: toastProg linear forwards; width: 100%;
}
.toast-out { animation: toastOut .3s ease forwards; }
@keyframes toastIn   { from { opacity:0; transform:translateX(60px) scale(.95); } to { opacity:1; transform:none; } }
@keyframes toastOut  { from { opacity:1; transform:none; } to { opacity:0; transform:translateX(60px) scale(.95); } }
@keyframes toastProg { from { width:100%; } to { width:0; } }

/* ── RESPONSIVE — TABLET (≤900px) ──────────────────────────────── */
@media (max-width: 900px) {
    :root { --sidebar-w: 0px; }

    /* Admin sidebar: off-canvas */
    .sidebar { transform: translateX(-260px); width: 260px; min-width: 260px; }
    .sidebar.open { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,.3); }
    .sidebar-overlay.open { display: block; }
    .mob-topbar { display: flex; }
    .main { margin-left: 0; }
    .page { padding: 20px 18px 80px; } /* 80px bottom for admin mobile nav */

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }

    /* CC portal: hide sidebar, show bottom tab bar */
    .cc-sidebar     { display: none !important; }
    .cc-mob-nav     { display: grid !important; grid-template-columns: repeat(5, 1fr); }
    .cc-content     { padding: 18px 16px 84px !important; }
    .cc-wrapper     { flex-direction: column; }
    .cc-topbar      { padding: 0 16px; }
    .cc-topbar-signout { display: none; }
}

/* ── RESPONSIVE — MOBILE (≤600px) ──────────────────────────────── */
@media (max-width: 600px) {
    html, body { overflow-x: hidden; -webkit-text-size-adjust: 100%; }

    /* ─ Admin layout ─ */
    .page       { padding: 16px 14px 80px; min-height: calc(100vh - 56px); }
    .page-title { font-size: 19px; }
    .page-sub   { font-size: 12px; }
    .page-header { flex-direction: column; gap: 10px; align-items: stretch; margin-bottom: 16px; }
    .page-header .actions { display: flex; gap: 6px; flex-wrap: wrap; }
    .page-header .actions .btn { flex: 1 1 auto; justify-content: center; min-width: 120px; font-size: 13px; }
    .page-title { color: var(--text); }   /* ensure title readable in dark */

    /* ─ Stat cards: 2 columns, compact ─ */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
    .stat-card  { padding: 12px 12px; }
    .stat-num   { font-size: 22px; }
    .stat-label { font-size: 9px; letter-spacing: .3px; }
    .stat-sub   { font-size: 10px; }
    .grid-3     { grid-template-columns: 1fr; }
    .card       { padding: 13px 12px; margin-bottom: 12px; }
    .card-title { font-size: 13px; margin-bottom: 12px; }

    /* ─ Mobile topbar (admin) ─ */
    .mob-topbar     { height: 54px; padding: 0 12px; }
    .mob-topbar img { height: 26px; padding: 2px 5px; }

    /* ─ Tables: horizontal scroll container ─ */
    .table-wrap {
        border-radius: var(--radius);
        margin-left: 0; margin-right: 0;
        border: 1px solid var(--border);
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }
    th, td { padding: 9px 10px; font-size: 11px; white-space: nowrap; }
    th     { font-size: 9px; }

    /* ─ Filters ─ */
    .filter-row { flex-direction: column; padding: 10px 12px; gap: 8px; background: var(--surface); border-radius: var(--radius); margin-bottom: 12px; }
    .filter-row .form-control { width: 100%; max-width: 100%; flex: none; min-height: 42px; }
    .filter-row .btn { width: 100%; justify-content: center; min-height: 42px; }

    /* ─ Forms: 16px prevents iOS zoom-in ─ */
    .form-control { padding: 12px 13px; font-size: 16px !important; border-radius: 10px; }
    .form-control:focus { font-size: 16px !important; }
    .form-label   { font-size: 13px; margin-bottom: 6px; font-weight: 600; }
    .form-group   { margin-bottom: 16px; }
    .btn-block    { padding: 14px; font-size: 15px; font-weight: 700; border-radius: 10px; }

    /* ─ Login page — full-screen native app feel ─ */
    .login-page {
        align-items: flex-start; justify-content: flex-start;
        padding: 0; overflow-y: auto;
        min-height: 100vh; min-height: 100dvh;
        background: var(--bg);
    }
    .login-box {
        border-radius: 0; padding: 0; max-width: 100%; width: 100%;
        min-height: 100vh; min-height: 100dvh;
        display: flex; flex-direction: column; box-shadow: none;
        background: var(--surface);
    }
    .login-brand {
        background: linear-gradient(160deg, #0a1929 0%, #1A3A5C 60%, #254e7a 100%);
        padding: 48px 24px 32px; margin-bottom: 0; border-radius: 0;
    }
    .login-brand img  { height: 50px; border-radius: 10px; display: block; margin: 0 auto 10px; }
    .login-brand .sub { color: rgba(255,255,255,.55); font-size: 13px; margin-top: 6px; }
    .login-form-area  { flex: 1; padding: 24px 20px 40px; }
    .login-tabs       { margin-bottom: 20px; }
    .login-tab        { padding: 11px; font-size: 14px; }
    .login-divider    { margin: 16px 0; }
    .pwa-hint         { display: none; }
    #install-app-btn  { display: none !important; }

    /* ─ CC topbar ─ */
    .cc-topbar         { height: 54px; padding: 0 14px; }
    .cc-topbar img     { height: 26px; }
    .cc-user           { display: none; }
    .cc-topbar-signout { display: none; }
    .cc-content        { padding: 14px 12px 84px !important; }
    .cc-mob-nav        { display: grid !important; grid-template-columns: repeat(5, 1fr); }

    /* ─ Messages ─ */
    .comment     { max-width: 90%; }
    .msg-admin, .msg-cc { max-width: 84%; font-size: 13px; }
    .msg-thread  { max-height: 280px; }

    /* ─ Toasts: above bottom tab bar ─ */
    #toast-container {
        top: auto !important; bottom: 76px;
        right: 12px; left: 12px; width: auto;
    }
    .toast { padding: 11px 13px; font-size: 13px; }

    /* ─ Detail rows ─ */
    .detail-row { flex-direction: column; gap: 2px; padding: 8px 0; }
    .detail-label { width: auto; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
    .detail-value { font-size: 13px; font-weight: 600; }

    /* ─ Cards ─ */
    .camp-card, .lead-card { padding: 12px; }
    .camp-card-inner { gap: 10px; }
    .field-item { flex-wrap: wrap; }

    /* ─ Buttons in actions ─ */
    .actions { flex-wrap: wrap; gap: 6px; }
    .btn-xs, .btn-sm { min-height: 34px; padding: 6px 12px; font-size: 12px; }

    /* ─ Grid 2 with small gap ─ */
    .grid-2 { gap: 10px; }

    /* ─ update banner below topbar ─ */
    #update-banner { top: 54px; }

    /* ─ Modal: bottom sheet on mobile ─ */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal {
        border-radius: 18px 18px 0 0; max-width: 100%; width: 100%;
        max-height: 90vh; overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
        animation: slideUpModal .28s ease;
    }
    @keyframes slideUpModal { from { transform: translateY(100%); } to { transform: translateY(0); } }
}

/* ── VERY SMALL (≤380px — iPhone SE, Galaxy A series) ──────────── */
@media (max-width: 380px) {
    .page       { padding: 10px 10px 76px; }
    .stats-grid { gap: 6px; }
    .stat-num   { font-size: 20px; }
    .stat-label { font-size: 8.5px; }
    .cc-mob-tab { font-size: 9px; padding: 7px 2px 6px; min-height: 52px; }
    .cc-mob-tab .tab-icon { font-size: 18px; }
    .card { padding: 11px 10px; }
    th, td { padding: 8px 8px; font-size: 10px; }
}

/* ── SAFE AREA (notch / home bar) ───────────────────────────────── */
body { padding-bottom: env(safe-area-inset-bottom); }

@media (display-mode: standalone) {
    .cc-topbar   { padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
    .mob-topbar  { padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
    .cc-mob-nav  { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── SCROLLBAR ───────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #D1D5DB; }

/* ── PRINT ───────────────────────────────────────────────────────── */
@media print {
    .sidebar, .mob-topbar, .cc-sidebar, .cc-mob-nav,
    .cc-topbar, #toast-container, .actions, .btn { display: none !important; }
    .main { margin-left: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ================================================================
   bfount PWA — Advanced App Features v2.0
   ================================================================ */

/* ── PWA INSTALL BANNER ──────────────────────────────────────────── */
#pwa-install-banner {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 8000;
    background: var(--navy); color: #fff;
    padding: 14px 20px; align-items: center; gap: 14px;
    box-shadow: 0 -4px 20px rgba(0,0,0,.25);
    transform: translateY(100%); transition: transform .35s cubic-bezier(.21,1.02,.73,1);
    padding-bottom: max(14px, env(safe-area-inset-bottom));
}
#pwa-install-banner.show { transform: translateY(0); }
#pwa-install-banner .pwa-icon {
    width: 44px; height: 44px; border-radius: 10px;
    background: rgba(255,255,255,.12); display: flex; align-items: center;
    justify-content: center; font-size: 22px; flex-shrink: 0;
}
#pwa-install-banner .pwa-text { flex: 1; }
#pwa-install-banner .pwa-text strong { display: block; font-size: 14px; font-weight: 700; }
#pwa-install-banner .pwa-text span   { font-size: 12px; color: rgba(255,255,255,.6); }
#pwa-install-banner .pwa-actions     { display: flex; gap: 8px; flex-shrink: 0; }
#pwa-install-banner .btn-install {
    background: var(--brand); color: #fff; border: none;
    padding: 9px 18px; border-radius: 8px; font-size: 13px;
    font-weight: 700; cursor: pointer; font-family: inherit;
}
#pwa-install-banner .btn-dismiss {
    background: rgba(255,255,255,.1); color: rgba(255,255,255,.7);
    border: none; padding: 9px 12px; border-radius: 8px;
    font-size: 13px; cursor: pointer; font-family: inherit;
}

/* iOS Install Guide */
#ios-install-guide {
    position: fixed; bottom: 0; left: 50%; right: auto; z-index: 8001;
    background: var(--surface); border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0; padding: 24px 20px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    box-shadow: 0 -10px 40px rgba(0,0,0,.15);
    width: 100%; max-width: 480px;
    transform: translateX(-50%) translateY(100%);
    transition: transform .3s ease;
}
#ios-install-guide.show {
    transform: translateX(-50%) translateY(0);
}
#ios-install-guide h3 { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
#ios-install-guide p  { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }
.ios-steps { display: flex; flex-direction: column; gap: 12px; }
.ios-step  { display: flex; align-items: flex-start; gap: 12px; font-size: 13px; }
.ios-step-num {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--navy); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.ios-step-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.ios-step code {
    background: var(--bg-2); padding: 2px 6px;
    border-radius: 5px; font-size: 12px; font-family: inherit; font-weight: 600;
}

/* ── UPDATE BANNER ───────────────────────────────────────────────── */
#update-banner {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%) translateY(-80px);
    z-index: 9500; background: var(--navy); color: #fff;
    padding: 12px 20px; border-radius: 40px;
    align-items: center; gap: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.25); font-size: 13px;
    transition: transform .3s ease; white-space: nowrap;
}
#update-banner.show { transform: translateX(-50%) translateY(0); animation: none; }
@keyframes slideDown { from { opacity:0; transform: translateX(-50%) translateY(-20px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }
#update-banner button {
    background: var(--brand); color: #fff; border: none;
    padding: 6px 14px; border-radius: 20px; font-size: 12px;
    font-weight: 700; cursor: pointer; font-family: inherit;
}

/* ── OFFLINE INDICATOR ───────────────────────────────────────────── */
#offline-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 9000;
    background: #374151; color: #fff; padding: 10px 20px;
    text-align: center; font-size: 13px; font-weight: 600;
    align-items: center; justify-content: center; gap: 8px;
    transform: translateY(-100%); transition: transform .3s;
}
#offline-bar.show { transform: translateY(0); }

/* ── PULL TO REFRESH ─────────────────────────────────────────────── */
#pull-indicator {
    position: fixed; top: -60px; left: 50%;
    transform: translateX(-50%); z-index: 500;
    background: var(--surface); border-radius: 50%;
    width: 44px; height: 44px; display: flex; align-items: center;
    justify-content: center; box-shadow: var(--shadow);
    transition: top .3s ease, opacity .3s;
    font-size: 20px; opacity: 0;
}
#pull-indicator.visible { top: 20px; opacity: 1; }
#pull-indicator.releasing { animation: spin .5s linear; }
@keyframes spin { from { transform: translateX(-50%) rotate(0); } to { transform: translateX(-50%) rotate(360deg); } }

/* ── CHART ENHANCEMENTS ──────────────────────────────────────────── */
.chart-bar-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.chart-bar-label { font-size: 12px; color: var(--text-2); width: 110px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-bar-track { flex: 1; height: 10px; background: var(--bg-2); border-radius: 5px; overflow: hidden; }
.chart-bar-fill  { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--brand), #f97316); transition: width .7s cubic-bezier(.4,0,.2,1); }
.chart-bar-val   { font-size: 12px; font-weight: 700; color: var(--text); width: 32px; text-align: right; flex-shrink: 0; }

/* Sparkline */
.sparkline-wrap { display: flex; align-items: flex-end; gap: 4px; height: 40px; }
.sparkline-bar  { flex: 1; background: rgba(232,96,10,.2); border-radius: 3px 3px 0 0; transition: height .5s ease; position: relative; cursor: default; min-height: 4px; }
.sparkline-bar:hover { background: var(--brand); }
.sparkline-bar[data-today="1"] { background: rgba(232,96,10,.5); }
.sparkline-bar:hover::after {
    content: attr(data-label);
    position: absolute; bottom: calc(100% + 6px); left: 50%;
    transform: translateX(-50%); background: #111827; color: #fff;
    font-size: 10px; padding: 4px 8px; border-radius: 5px; white-space: nowrap;
    pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* ── KEYBOARD SHORTCUTS OVERLAY ──────────────────────────────────── */
#shortcuts-modal {
    position: fixed; inset: 0; z-index: 9800;
    background: rgba(0,0,0,.5); align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    opacity: 0; transition: opacity .2s;
}
#shortcuts-modal.open { opacity: 1; }
#shortcuts-panel {
    background: var(--surface); border-radius: 18px;
    padding: 28px; width: 100%; max-width: 460px; max-height: 80vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: loginIn .2s ease;
}
#shortcuts-panel h3 { font-size: 16px; font-weight: 800; margin-bottom: 18px; }
.shortcut-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 0; border-bottom: 1px solid var(--border-2); font-size: 13px;
}
.shortcut-item:last-child { border-bottom: none; }
.shortcut-keys { display: flex; gap: 5px; }
kbd {
    background: var(--bg-2); border: 1px solid var(--border);
    border-bottom: 2px solid #D1D5DB; border-radius: 5px;
    padding: 3px 8px; font-size: 11px; font-weight: 700;
    font-family: inherit; color: var(--text);
}

/* ── QUICK SEARCH SPOTLIGHT ──────────────────────────────────────── */
#spotlight {
    position: fixed; inset: 0; z-index: 9900;
    background: rgba(0,0,0,.5);
    align-items: flex-start; justify-content: center;
    padding-top: 15vh; backdrop-filter: blur(4px);
    opacity: 0; transition: opacity .2s;
}
#spotlight.open { opacity: 1; }
#spotlight-box {
    background: var(--surface); border-radius: 16px;
    width: 100%; max-width: 560px;
    box-shadow: 0 30px 80px rgba(0,0,0,.3);
    overflow: hidden; animation: loginIn .2s ease;
}
#spotlight-input {
    width: 100%; border: none; outline: none;
    padding: 16px 20px; font-size: 16px; font-family: inherit;
    background: transparent; color: var(--text);
    border-bottom: 1px solid var(--border);
}
#spotlight-results { max-height: 360px; overflow-y: auto; }
.spotlight-result {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px; cursor: pointer; font-size: 13px;
    transition: background .1s;
}
.spotlight-result:hover, .spotlight-result.selected { background: var(--brand-light); }
.spotlight-result-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.spotlight-result-text strong { display: block; font-weight: 700; color: var(--text); font-size: 13px; }
.spotlight-result-text span   { font-size: 11px; color: var(--text-2); }
.spotlight-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ── MODAL ENHANCEMENTS ──────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 700; display: none; align-items: center; justify-content: center;
    padding: 20px; backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface); border-radius: var(--radius-lg);
    width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: loginIn .25s ease;
}
.modal-header {
    padding: 20px 22px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title { font-size: 16px; font-weight: 800; }
.modal-close {
    width: 32px; height: 32px; border: none; background: var(--bg-2);
    border-radius: 8px; cursor: pointer; font-size: 18px; color: var(--text-2);
    display: flex; align-items: center; justify-content: center;
    transition: all .12s;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body   { padding: 20px 22px; }
.modal-footer {
    padding: 14px 22px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
    position: sticky; bottom: 0; background: var(--surface);
}

/* ── LOADING STATES ──────────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--bg-2) 25%, #e8eaed 50%, var(--bg-2) 75%);
    background-size: 200% 100%; animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.spinner {
    width: 20px; height: 20px; border: 2px solid var(--border);
    border-top-color: var(--brand); border-radius: 50%;
    animation: spin .6s linear infinite; display: inline-block;
}

/* ── NOTIFICATION BADGE ──────────────────────────────────────────── */
.notif-badge {
    position: absolute; top: -4px; right: -4px;
    background: var(--danger); color: #fff;
    width: 18px; height: 18px; border-radius: 50%;
    font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--surface);
}

/* ── DARK MODE SUPPORT ───────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    :root {
        --text:        #F3F4F6;
        --text-2:      #9CA3AF;
        --text-3:      #6B7280;
        --border:      #2D3748;
        --border-2:    #1A2535;
        --surface:     #1E2A3A;
        --bg:          #111827;
        --bg-2:        #1A2535;
        --brand-light: rgba(232,96,10,.18);
        --info-bg:     rgba(59,130,246,.15);
        --warning-bg:  rgba(245,158,11,.15);
        --danger-bg:   rgba(239,68,68,.15);
        --success-bg:  rgba(16,185,129,.15);
    }

    /* ─ Core surfaces ─ */
    body               { background: var(--bg); color: var(--text); }
    .sidebar           { background: #0D1B2A; border-right-color: #1A2535; }
    .sb-logo           { border-bottom-color: #1A2535; }
    .sb-footer         { border-top-color: #1A2535; }
    .mob-topbar        { background: #0D1B2A; border-bottom: 1px solid #1A2535; }
    .cc-topbar         { background: #0D1B2A; }
    .cc-mob-nav        { background: #1E2A3A; border-top-color: #2D3748; }

    /* ─ Cards ─ */
    .card              { background: #1E2A3A; border-color: #2D3748; }
    .stat-card         { background: #1E2A3A; border-color: #2D3748; }

    /* ─ Tables ─ */
    .table-wrap        { background: #1E2A3A; border-color: #2D3748; }
    table th           { background: #162030; color: #9CA3AF; border-color: #2D3748; }
    table td           { border-color: #1A2535; color: var(--text); }
    tr:hover td        { background: #243040; }   /* readable dark hover */

    /* ─ Filters / Forms ─ */
    .filter-row        { background: #1A2535; border-color: #2D3748; }
    .form-control      { background: #162030; border-color: #2D3748; color: var(--text); }
    .form-control:focus{ border-color: var(--brand); background: #162030; }
    .form-control::placeholder { color: #4B5563; }
    select.form-control option { background: #1E2A3A; color: var(--text); }

    /* ─ Login ─ */
    .login-box         { background: #1E2A3A; }
    .login-tabs        { background: #162030; border-color: #2D3748; }
    .login-tab         { color: var(--text-2); }
    .login-tab.active  { background: var(--surface); color: var(--text); }

    /* ─ Alerts ─ */
    .alert-danger      { background: rgba(239,68,68,.12);  border-color: rgba(239,68,68,.3);  color: #FCA5A5; }
    .alert-warning     { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); color: #FCD34D; }
    .alert-info        { background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.3); color: #93C5FD; }
    .alert-success     { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.3); color: #6EE7B7; }

    /* ─ Badges: keep readable on dark bg ─ */
    .badge-success     { background: rgba(16,185,129,.2);  color: #6EE7B7; }
    .badge-success-soft{ background: rgba(16,185,129,.15); color: #34D399; }
    .badge-warning     { background: rgba(245,158,11,.2);  color: #FCD34D; }
    .badge-danger      { background: rgba(239,68,68,.2);   color: #FCA5A5; }
    .badge-info        { background: rgba(59,130,246,.2);  color: #93C5FD; }
    .badge-purple      { background: rgba(139,92,246,.2);  color: #C4B5FD; }

    /* ─ Buttons ─ */
    .btn               { border-color: #2D3748; color: var(--text-2); background: transparent; }
    .btn:hover         { background: #243040; color: var(--text); border-color: #374151; }
    .btn-ghost         { border-color: transparent; color: var(--text-2); }
    .btn-ghost:hover   { background: #243040; color: var(--text); border-color: #2D3748; }
    .btn-dark          { background: #0D1B2A; border-color: #0D1B2A; color: #fff; }
    .btn-dark:hover    { background: #162030; border-color: #162030; color: #fff; }

    /* ─ Navigation ─ */
    .cc-nav-item       { color: var(--text-2); }
    .cc-nav-item:hover { background: #243040; color: var(--text); }
    .cc-mob-tab        { color: #6B7280; }
    .cc-mob-tab.active { color: var(--brand); }
    .cc-mob-badge      { border-color: #1E2A3A; }

    /* ─ Modals ─ */
    .modal             { background: #1E2A3A; }
    .modal-header      { background: #1E2A3A; border-color: #2D3748; }
    .modal-footer      { background: #1E2A3A; border-color: #2D3748; }

    /* ─ Comment / messages ─ */
    .comment-box       { background: #162030; border-color: #2D3748; }
    .comment-box textarea { background: #162030; color: var(--text); border-color: #2D3748; }
    .comment.admin .comment-bubble { background: #243040; border-color: #2D3748; color: var(--text); }
    .comment.cc .comment-bubble    { background: #162030; border-color: #2D3748; color: var(--text); }
    .msg-admin         { background: #243040; border-color: #2D3748; }
    .msg-cc            { background: #162030; border-color: #2D3748; }

    /* ─ Tags ─ */
    .tag               { background: #243040; color: #9CA3AF; border-color: #2D3748; }

    /* ─ Misc interactive ─ */
    kbd                { background: #243040; border-color: #374151; color: var(--text); }
    .pagination .page-btn       { background: #1E2A3A; border-color: #2D3748; color: var(--text-2); }
    .pagination .page-btn:hover { background: #243040; color: var(--text); }
    .pagination .page-btn.active{ background: var(--brand); color: #fff; border-color: var(--brand); }

    /* ─ Charts ─ */
    .chart-bar-track   { background: #243040; }
    .sparkline-bar     { background: rgba(232,96,10,.25); }

    /* ─ Camp cards ─ */
    .camp-card         { background: #1E2A3A; border-color: #2D3748; }
    .camp-card:hover   { border-color: var(--brand); }

    /* ─ Sidebar nav active ─ */
    .nav-item.active           { background: rgba(232,96,10,.18); color: #FB923C; }
    .nav-item.active .icon     { filter: none; }
    .nav-item:hover            { background: rgba(255,255,255,.08); color: #fff; }

    /* ─ Stats ─ */
    .stat-card         { border-left-color: rgba(232,96,10,.4); }
}

/* ── SAFE AREA (iPhone notch/home bar) ───────────────────────────── */
body { padding-bottom: env(safe-area-inset-bottom); }
.cc-topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
.sidebar   { padding-top: env(safe-area-inset-top); }
@media (display-mode: standalone) {
    .mob-topbar { padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
    .sidebar    { top: env(safe-area-inset-top); }
}

/* ── HAPTIC FEEDBACK VISUAL ──────────────────────────────────────── */
.btn:active { transform: scale(.97); }
.btn-primary:active { transform: scale(.97); box-shadow: 0 0 0 3px rgba(232,96,10,.3); }

/* ── SWIPE GESTURE HINT ──────────────────────────────────────────── */
.swipe-hint {
    text-align: center; color: var(--text-3);
    font-size: 11px; padding: 6px; display: none;
}
@media (max-width: 600px) { .swipe-hint { display: block; } }

/* ── BOTTOM SHEET (mobile modals) ────────────────────────────────── */
@media (max-width: 600px) {
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal {
        max-width: 100%; border-radius: 20px 20px 0 0;
        max-height: 92vh;
        padding-bottom: env(safe-area-inset-bottom);
        animation: slideUp .3s ease;
    }
    @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
}


/* ── BUTTONS ON DARK BACKGROUNDS ───────────────────────────────── */
.sidebar .btn,
.cc-topbar .btn,
.mob-topbar .btn {
    color: rgba(255,255,255,.7);
    border-color: rgba(255,255,255,.2);
    background: rgba(255,255,255,.08);
}
.sidebar .btn:hover,
.cc-topbar .btn:hover,
.mob-topbar .btn:hover {
    color: #fff;
    background: rgba(255,255,255,.15);
    border-color: rgba(255,255,255,.35);
}

/* ── CC PORTAL LAYOUT ────────────────────────────────────────────── */
.cc-topbar {
    position: sticky; top: 0; z-index: 200;
    background: var(--navy); color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: var(--topbar-h);
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
    flex-shrink: 0;
}
.cc-topbar-left { display: flex; align-items: center; gap: 12px; }
.cc-topbar-left img { height: 32px; border-radius: 6px; background: #fff; padding: 3px 8px; }
.cc-topbar-right { display: flex; align-items: center; gap: 12px; }
.cc-topbar-signout {
    color: rgba(255,255,255,.55); font-size: 12px; font-weight: 600;
    border: 1px solid rgba(255,255,255,.2); border-radius: 7px;
    padding: 5px 12px; text-decoration: none; background: rgba(255,255,255,.07);
    transition: all .15s;
}
.cc-topbar-signout:hover { background: rgba(255,255,255,.15); color: #fff; }
.cc-user { font-size: 13px; color: rgba(255,255,255,.7); font-weight: 500; }

.cc-wrapper { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.cc-sidebar {
    width: 210px; min-width: 210px; background: var(--surface);
    border-right: 1px solid var(--border);
    position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
    overflow-y: auto; display: flex; flex-direction: column;
    flex-shrink: 0;
}
.cc-content {
    flex: 1; min-width: 0; padding: 24px 28px; overflow-x: hidden;
    /* On desktop: full height, scroll internally */
    min-height: calc(100vh - var(--topbar-h));
}

.cc-nav { padding: 12px 0; }
.cc-nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 18px; font-size: 13px; font-weight: 600;
    color: var(--text-2); text-decoration: none;
    transition: all .12s; position: relative;
}
.cc-nav-item:hover  { background: var(--bg-2); color: var(--text); border-left-color: var(--border); }
.cc-nav-item.active { background: var(--brand-light); color: var(--brand); }
.cc-nav-item.active::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--brand); border-radius:0 2px 2px 0; }
.cc-nav-icon  { font-size: 16px; width: 20px; text-align: center; }
.cc-nav-badge { background: var(--danger); color: #fff; border-radius: 10px; font-size: 10px; font-weight: 700; padding: 1px 6px; margin-left: auto; }
.cc-sidebar-footer {
    padding: 14px 16px; margin-top: auto; border-top: 1px solid var(--border);
}
.cc-sidebar-name  { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-sidebar-email { font-size: 11px; color: var(--text-3); margin-bottom: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-sidebar-logout { width: 100%; justify-content: center; font-size: 11px; }

/* ── MOBILE BOTTOM TAB BAR ────────────────────────────────────────
   This is the core of the mobile experience.
   display:none by default, JS/media query sets it to grid
   ────────────────────────────────────────────────────────────── */
.cc-mob-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 9999;
    background: var(--surface);
    border-top: 1.5px solid var(--border);
    box-shadow: 0 -4px 24px rgba(0,0,0,.08);
    grid-template-columns: repeat(5, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    isolation: isolate;
    /* Subtle background for depth */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
/* Show on mobile screens */
@media (max-width: 900px) {
    .cc-mob-nav { display: grid !important; }
}

.cc-mob-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 2px 7px;
    gap: 3px;
    min-height: 58px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .15px;
    color: var(--text-3);
    text-decoration: none;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: color .18s ease, background .18s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    border: none;
    outline: none;
    background: transparent;
}
.cc-mob-tab .tab-icon {
    font-size: 22px;
    line-height: 1;
    display: block;
    margin-bottom: 1px;
    transition: transform .18s cubic-bezier(.34,1.56,.64,1);
}
.tab-label {
    display: block;
    line-height: 1.2;
    font-size: 10px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    padding: 0 2px;
}

/* Hover state — visible colour shift */
.cc-mob-tab:hover { color: var(--text-2); }

/* Active (tap) animation */
.cc-mob-tab:active .tab-icon { transform: scale(.80); }

/* Active tab — brand colour + scale icon */
.cc-mob-tab.active { color: var(--brand); }
.cc-mob-tab.active .tab-icon {
    transform: scale(1.12);
    filter: drop-shadow(0 2px 4px rgba(232,96,10,.25));
}
/* Top indicator line */
.cc-mob-tab.active::after {
    content: '';
    position: absolute;
    top: 0; left: 15%; right: 15%;
    height: 3px;
    background: var(--brand);
    border-radius: 0 0 3px 3px;
}

/* Sign out tab — subtle red */
.cc-mob-tab-logout { color: #9CA3AF; }
.cc-mob-tab-logout:hover { color: #EF4444; }
.cc-mob-tab-logout.active { color: #EF4444; }

/* Notification badge */
.cc-mob-badge {
    position: absolute;
    top: 5px;
    left: calc(50% + 5px);
    background: var(--danger);
    color: #fff;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 4px;
    min-width: 15px;
    text-align: center;
    border: 2px solid var(--surface);
    line-height: 1.4;
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(220,38,38,.3);
}

/* Admin bottom nav: column count set via inline style per role */
#admin-mob-nav { grid-template-columns: unset; } /* inline style takes priority */
#admin-mob-nav .cc-mob-tab { font-size: 9px; min-height: 54px; }
#admin-mob-nav .cc-mob-tab .tab-icon { font-size: 18px; }
@media (max-width: 900px) {
    /* Override the repeat(5,1fr) from cc-mob-nav for admin nav */
    #admin-mob-nav { grid-template-columns: unset !important; }
}

/* ── CAMPAIGN FIELDS LIST (CC portal cards) ─────────────────────── */
.camp-fields-list {
    display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px;
}
.camp-field-pill {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: 6px; padding: 3px 9px;
    font-size: 11px; color: var(--text-2); font-weight: 600;
    white-space: nowrap;
}
.camp-field-pill.required { border-color: rgba(232,96,10,.3); color: var(--brand); }

/* ════════════════════════════════════════════════════════════════
   LEADS PAGE — new components
   ════════════════════════════════════════════════════════════════ */

/* Lead detail header */
.lead-detail-header {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 18px; flex-wrap: wrap;
}
.lead-detail-title {
    font-size: 18px; font-weight: 800; color: #0F172A;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* empty-desc (used in empty-state) */
.empty-desc { font-size: 13px; color: var(--text-3); margin-top: 4px; }

/* Mobile lead card list — shown only on small screens */
.lead-card-list  { display: none; }
.lead-card-mobile {
    display: block; text-decoration: none; color: var(--text);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 13px 14px; margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    transition: border-color .15s, box-shadow .15s;
}
.lead-card-mobile:hover { border-color: var(--brand); box-shadow: 0 2px 8px rgba(232,96,10,.12); }
.lead-card-mobile-top {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; margin-bottom: 6px;
}
.lead-card-mobile-meta {
    display: flex; flex-wrap: wrap; gap: 5px;
    font-size: 11px; color: var(--text-3); align-items: center;
}

/* Responsive: on mobile show cards, hide table */
@media (max-width: 700px) {
    .leads-table    { display: none; }
    .lead-card-list { display: block; }
    .lead-detail-header { margin-bottom: 12px; }
    .lead-detail-title  { font-size: 15px; }
    .lead-detail-grid.grid-2 { grid-template-columns: 1fr !important; }
}

/* ════════════════════════════════════════════════════════════════
   FILTER ROW — search icon parent fix
   ════════════════════════════════════════════════════════════════ */
.filter-row {
    display: flex; gap: 8px; flex-wrap: wrap;
    align-items: center; margin-bottom: 16px;
}
.filter-row .form-control { min-width: 0; }

/* ════════════════════════════════════════════════════════════════
   DARK MODE — new components
   ════════════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
    .lead-card-mobile         { background: #1E2A3A; border-color: #2D3748; }
    .lead-card-mobile:hover   { border-color: var(--brand); }
    .lead-detail-title        { color: var(--text); }
}
