/* ══════════════════════════════════════════════════════════════════════
   core.css — SalesRep Design Tokens + Shared Styles
   v0.20.0 — CSS variable system for white-label branding

   Load order:  core.css → sidebar.css → template :root (Jinja2 overrides)
   Portal body classes:  .portal-admin | .portal-rep | .portal-cc
   ══════════════════════════════════════════════════════════════════════ */

/* ── 1. Design Tokens (defaults — overridden by Jinja2 :root in templates) ── */
:root {
    /* Brand colors */
    --brand-primary: #1a1a2e;
    --brand-nav-text: #a0c4ff;
    --brand-accent: #1a6fc4;
    --brand-button: #1a1a2e;
    --brand-secondary: #6c757d;

    /* Page colors */
    --brand-bg: #f4f4f4;
    --brand-text: #333333;
    --brand-text-muted: #888;

    /* Semantic colors */
    --brand-success: #28a745;
    --brand-warning: #ffc107;
    --brand-warning-text: #333;
    --brand-danger: #dc3545;

    /* Surfaces & borders */
    --brand-card-bg: #ffffff;
    --brand-border: #eee;
    --brand-border-light: #f0f0f0;
    --brand-hover-bg: #f9f9f9;

    /* Typography */
    --font-family: Arial, sans-serif;
    --font-family-mono: Courier New, monospace;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 5px;
    --radius-lg: 8px;
    --radius-pill: 10px;
}


/* ── 2. Reset & Base ─────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-family); background: var(--brand-bg); color: var(--brand-text); }


/* ── 3. Layout ───────────────────────────────────────────────────────── */
.container { max-width: 1400px; margin: 30px auto; padding: 0 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }
h2 { margin-bottom: 20px; font-size: 1.2rem; }
h3 { margin-bottom: 15px; font-size: 1rem; color: #555; }


/* ── 4. Buttons ──────────────────────────────────────────────────────── */
.btn { display: inline-block; padding: 8px 16px; border-radius: var(--radius-md); border: none; cursor: pointer; font-size: 0.9rem; text-decoration: none; transition: opacity 0.15s ease, transform 0.1s ease; }
.btn-primary { background: var(--brand-button); color: white; }
.btn-secondary { background: var(--brand-secondary); color: white; }
.btn-danger { background: var(--brand-danger); color: white; }
.btn-success { background: var(--brand-success); color: white; }
.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.97); }


/* ── 5. Cards ────────────────────────────────────────────────────────── */
.card { background: var(--brand-card-bg); border-radius: var(--radius-lg); padding: 25px; margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.1); transition: box-shadow 0.2s ease, transform 0.15s ease; }
.card:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.12); }


/* ── 6. Flash Messages ───────────────────────────────────────────────── */
.flash { padding: 10px 15px; margin-bottom: 20px; border-radius: var(--radius-md); animation: slideDown 0.3s ease-out; }
.flash.success { background: #d4edda; color: #155724; }
.flash.error { background: #f8d7da; color: #721c24; }


/* ── 7. Tables ───────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; background: var(--brand-card-bg); }
th { background: var(--brand-primary); color: white; padding: 12px 15px; text-align: left; }
td { padding: 10px 15px; border-bottom: 1px solid var(--brand-border); }
tr { transition: background 0.12s ease; }
tr:hover { background: var(--brand-hover-bg); }


/* ── 8. Forms ────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-weight: bold; margin-bottom: 5px; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 10px; border: 1px solid #ccc; border-radius: var(--radius-md); font-size: 0.9rem; }


/* ── 9. Badges & Status ──────────────────────────────────────────────── */
.status-badge {
    display: inline-block; padding: 2px 9px; border-radius: var(--radius-pill);
    font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.badge { display: inline-block; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 600; }
.badge-green  { background: #d4edda; color: #155724; }
.badge-yellow { background: #fff3cd; color: #856404; }
.badge-red    { background: #f8d7da; color: #721c24; }
.badge-blue   { background: #cce5ff; color: #004085; }
.badge-grey   { background: #e2e3e5; color: #495057; }


/* ── 10. Header (Call Center portal — still uses <header>) ───────────── */
header {
    background: var(--brand-primary); color: white;
    padding: 0 24px; display: flex; align-items: center;
    justify-content: space-between; height: 52px;
}
header h1 { font-size: 1.4rem; }
header a { color: var(--brand-nav-text); text-decoration: none; font-size: 0.9rem; }
.hdr-brand {
    text-decoration: none; color: inherit; display: flex;
    align-items: center; gap: 10px;
}
.hdr-brand img { height: 30px; width: auto; object-fit: contain; }
.hdr-brand span { font-size: 1.2rem; font-weight: 700; }
nav { display: flex; align-items: center; gap: 2px; }
nav a {
    color: var(--brand-nav-text); text-decoration: none; font-size: 0.85rem;
    padding: 8px 12px; border-radius: var(--radius-md); transition: background 0.15s ease;
}
nav a:hover, nav a.active { background: rgba(255,255,255,0.12); }
nav .sep { color: #555; margin: 0 4px; }
nav .user-tag { color: #ccc; font-size: 0.82rem; padding: 8px 6px; }
nav a.logout-link { color: #ff9999; }


/* ── 11. Admin Nav Dropdown System ───────────────────────────────────── */
.nav-group { position: relative; display: inline-flex; align-items: center; }
.nav-group-btn {
    display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: var(--radius-md);
    color: var(--brand-nav-text); font-size: 0.85rem; cursor: pointer; border: none; background: none;
    text-decoration: none; transition: background 0.15s; white-space: nowrap;
}
.nav-group-btn:hover, .nav-group-btn.active { background: rgba(255,255,255,0.12); color: #fff; }
.nav-group-btn .ng-caret { font-size: 0.5rem; opacity: 0.6; margin-left: 1px; transition: transform 0.15s; }
.nav-group.open .ng-caret { transform: rotate(180deg); }
.nav-panel { display: none; position: absolute; top: 100%; left: 0; padding-top: 4px; z-index: 10002; }
.nav-group.open > .nav-panel { display: block; }
.nav-panel-inner {
    background: #fff; border: 1px solid #e0e0e0; border-radius: var(--radius-lg); min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18); overflow: hidden; animation: slideDown 0.15s ease-out;
}
.nav-panel a {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 16px;
    font-size: 0.84rem; color: #333; text-decoration: none; transition: background 0.12s;
}
.nav-panel a:hover { background: #f5f7fa; }
.nav-panel a.np-active { background: #eef2ff; font-weight: 600; color: var(--brand-primary); }
.nav-panel .np-icon { font-size: 0.95rem; width: 20px; text-align: center; flex-shrink: 0; }
.np-divider { height: 1px; background: var(--brand-border-light); margin: 0; }
.nav-direct {
    color: var(--brand-nav-text); text-decoration: none; font-size: 0.85rem;
    padding: 8px 12px; border-radius: var(--radius-md); transition: background 0.15s; white-space: nowrap;
}
.nav-direct:hover, .nav-direct.active { background: rgba(255,255,255,0.12); color: #fff; }
.nav-right { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-gear-btn {
    display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
    border-radius: 50%; border: none; background: none; color: var(--brand-nav-text); font-size: 1.1rem;
    cursor: pointer; transition: background 0.15s;
}
.nav-gear-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-group.open .nav-gear-btn { background: rgba(255,255,255,0.12); color: #fff; }
.nav-group.right-align > .nav-panel { left: auto; right: 0; }
.nav-avatar {
    display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;
    border-radius: 50%; font-size: 0.72rem; font-weight: 700; cursor: pointer;
    border: 2px solid rgba(255,255,255,0.2); transition: border-color 0.15s;
    letter-spacing: 0.5px; user-select: none;
}
.nav-avatar:hover, .nav-group.open .nav-avatar { border-color: rgba(255,255,255,0.6); }
.ud-header { padding: 12px 16px; border-bottom: 1px solid var(--brand-border-light); }
.ud-header .ud-name { font-size: 0.88rem; font-weight: 600; color: var(--brand-primary); }
.ud-header .ud-role { font-size: 0.72rem; color: var(--brand-text-muted); text-transform: capitalize; margin-top: 2px; }
.ud-divider { height: 1px; background: var(--brand-border-light); margin: 0; }
.nav-panel .ud-logout { color: var(--brand-danger); }
.nav-hamburger { display: none; background: none; border: none; color: var(--brand-nav-text); font-size: 1.5rem; cursor: pointer; padding: 4px 8px; }


/* ── 12. Rep/CC User Dropdown ────────────────────────────────────────── */
.user-dropdown { position: relative; display: inline-flex; align-items: center; }
.user-dropdown-btn {
    display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--radius-md);
    color: #ccc; font-size: 0.85rem; cursor: pointer; border: none; background: none;
    text-decoration: none; transition: background 0.15s;
}
.user-dropdown-btn:hover, .user-dropdown:focus-within .user-dropdown-btn { background: rgba(255,255,255,0.12); color: #fff; }
.user-dropdown-btn .ud-caret { font-size: 0.55rem; opacity: 0.7; margin-left: 2px; transition: transform 0.15s; }
.user-dropdown:focus-within .ud-caret, .user-dropdown:hover .ud-caret { transform: rotate(180deg); }
.user-dropdown-menu { display: none; position: absolute; top: 100%; right: 0; padding-top: 4px; z-index: 10002; }
.user-dropdown-menu > .ud-inner {
    background: #fff; border: 1px solid #e0e0e0; border-radius: var(--radius-lg); min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18); overflow: hidden; animation: slideDown 0.15s ease-out;
}
.user-dropdown:hover > .user-dropdown-menu,
.user-dropdown:focus-within > .user-dropdown-menu { display: block; }
.user-dropdown-menu a {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 16px;
    font-size: 0.84rem; color: #333; text-decoration: none; border: none; background: none;
    cursor: pointer; text-align: left; transition: background 0.12s;
}
.user-dropdown-menu a:hover { background: #f5f7fa; }
.user-dropdown-menu .ud-icon { font-size: 0.95rem; width: 20px; text-align: center; flex-shrink: 0; }
.user-dropdown-menu .ud-logout { color: var(--brand-danger); }


/* ── 13. Rep-specific Styles ─────────────────────────────────────────── */
.mgr-label {
    font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: #c9b3ff; background: rgba(201,179,255,0.15); padding: 2px 6px; border-radius: 3px;
    margin-left: 4px;
}
nav a.mgr-link { color: #c9b3ff; }
nav a.mgr-link:hover, nav a.mgr-link.active { background: rgba(201,179,255,0.18); color: #e0d4ff; }

/* Impersonation read-only mode */
body.impersonation-mode button[type="submit"],
body.impersonation-mode input[type="submit"],
body.impersonation-mode .btn-success,
body.impersonation-mode .btn-primary,
body.impersonation-mode form:not(.exit-form) button:not(.t-close):not(.kb-close) {
    opacity: 0.4 !important; pointer-events: none !important; cursor: not-allowed !important;
}

/* Quick Capture FAB (mobile rep portal) */
.qc-fab { display: none; position: fixed; bottom: 24px; right: 20px; z-index: 9000; }
.qc-fab-btn {
    width: 56px; height: 56px; border-radius: 50%; background: var(--brand-primary); color: #fff; border: none;
    font-size: 1.5rem; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,0.3); transition: transform .2s;
    display: flex; align-items: center; justify-content: center;
}
.qc-fab-btn:hover { transform: scale(1.08); }
.qc-fab-btn.open { transform: rotate(45deg); background: var(--brand-danger); }
.qc-fab-menu { position: absolute; bottom: 66px; right: 0; display: none; flex-direction: column; gap: 8px; align-items: flex-end; }
.qc-fab-menu.open { display: flex; }
.qc-fab-item { display: flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.qc-fab-item span.qc-label {
    background: #fff; color: #333; padding: 6px 12px; border-radius: 6px; font-size: 0.8rem;
    font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.qc-fab-item span.qc-icon {
    width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.1rem; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}


/* ── 14. Toast Notifications ─────────────────────────────────────────── */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 280px; max-width: 420px; padding: 12px 16px; border-radius: var(--radius-lg); font-size: 0.85rem; line-height: 1.4; box-shadow: 0 4px 16px rgba(0,0,0,0.15); display: flex; align-items: flex-start; gap: 10px; animation: toastIn 0.3s ease-out; }
.toast.hiding { animation: toastOut 0.25s ease-in forwards; }
.toast-success { background: var(--brand-success); color: white; }
.toast-error   { background: var(--brand-danger); color: white; }
.toast-info    { background: var(--brand-primary); color: white; }
.toast-warning { background: var(--brand-warning); color: var(--brand-warning-text); }
.toast .t-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast .t-msg  { flex: 1; }
.toast .t-close { background: none; border: none; color: inherit; opacity: 0.7; cursor: pointer; font-size: 1rem; padding: 0 0 0 8px; flex-shrink: 0; }
.toast .t-close:hover { opacity: 1; }


/* ── 15. Loading Spinner ─────────────────────────────────────────────── */
#global-spinner { display: none; position: fixed; inset: 0; background: rgba(255,255,255,0.6); z-index: 9999; align-items: center; justify-content: center; }
#global-spinner.active { display: flex; }
.spinner-ring { width: 44px; height: 44px; border: 4px solid #e0e0e0; border-top-color: var(--brand-primary); border-radius: 50%; animation: spin 0.7s linear infinite; }


/* ── 16. Keyboard Shortcut Help ──────────────────────────────────────── */
#kb-help { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 10001; align-items: center; justify-content: center; }
#kb-help.active { display: flex; }
#kb-help .kb-panel { background: white; border-radius: var(--radius-pill); padding: 28px 32px; max-width: 420px; width: 90%; box-shadow: 0 8px 32px rgba(0,0,0,0.2); animation: slideDown 0.25s ease-out; }
#kb-help h3 { margin-bottom: 14px; font-size: 1rem; color: var(--brand-primary); }
#kb-help .kb-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--brand-border-light); font-size: 0.84rem; }
#kb-help .kb-key { display: inline-block; background: var(--brand-bg); border: 1px solid #ddd; border-radius: var(--radius-sm); padding: 2px 8px; font-family: monospace; font-size: 0.8rem; font-weight: 600; min-width: 28px; text-align: center; }
#kb-help .kb-close { float: right; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--brand-text-muted); }
#kb-help .kb-close:hover { color: var(--brand-text); }


/* ── 17. Tooltips & Help Icons ───────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
    content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px); left: 50%;
    transform: translateX(-50%); padding: 5px 10px; border-radius: var(--radius-sm); font-size: 0.72rem;
    background: var(--brand-primary); color: #fff; white-space: nowrap; pointer-events: none;
    opacity: 0; transition: opacity 0.15s; z-index: 1000; line-height: 1.3; max-width: 260px; white-space: normal;
}
[data-tooltip]:hover::after, [data-tooltip]:focus::after { opacity: 1; }
.help-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
    border-radius: 50%; background: #e0e0e0; color: #666; font-size: 0.65rem; font-weight: 700;
    cursor: help; margin-left: 4px; vertical-align: middle; line-height: 1;
}
.help-icon:hover { background: var(--brand-primary); color: #fff; }


/* ── 18. Breadcrumbs ─────────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 10px 0; margin-bottom: 8px; font-size: 0.82rem; color: #666; }
.breadcrumb a { color: var(--brand-primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .bc-sep { margin: 0 2px; color: var(--brand-text-muted); font-size: 0.7rem; }
.breadcrumb .bc-current { color: var(--brand-text); font-weight: 600; }


/* ── 19. Accessibility ───────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.sr-only:focus { position: static; width: auto; height: auto; padding: 8px 16px; margin: 0; overflow: visible; clip: auto; white-space: normal; background: var(--brand-primary); color: #fff; z-index: 99999; }
:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
button:focus-visible, .btn:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }


/* ── 20. Animations ──────────────────────────────────────────────────── */
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn  { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }
@keyframes spin { to { transform: rotate(360deg); } }


/* ── 21. Sortable Table Headers ──────────────────────────────────────── */
.data-table-wrap th.sortable,
.tbl-scroll-wrap th.sortable,
.turf-scroll-wrap th.sortable,
.scroll-wrap th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.data-table-wrap th.sortable:hover,
.tbl-scroll-wrap th.sortable:hover,
.turf-scroll-wrap th.sortable:hover,
.scroll-wrap th.sortable:hover { background: rgba(255,255,255,0.12); }
th .sort-arrow { font-size: 0.65rem; margin-left: 4px; opacity: 0.5; }
th.sort-asc .sort-arrow, th.sort-desc .sort-arrow { opacity: 1; }


/* ══════════════════════════════════════════════════════════════════════
   22. Portal-Specific Overrides
   Rep and CC portals use slightly tighter spacing/sizing
   ══════════════════════════════════════════════════════════════════════ */

.portal-rep .container,
.portal-cc .container { margin: 28px auto; }

.portal-rep .btn,
.portal-cc .btn { padding: 7px 15px; font-size: 0.85rem; font-weight: 600; }

.portal-rep .card,
.portal-cc .card { padding: 20px; margin-bottom: 18px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.portal-rep .flash,
.portal-cc .flash { font-size: 0.85rem; margin-bottom: 16px; border-radius: 6px; }
.portal-rep .flash.success,
.portal-cc .flash.success { border: 1px solid #c3e6cb; }
.portal-rep .flash.error,
.portal-cc .flash.error { border: 1px solid #f5c6cb; }

.portal-rep table,
.portal-cc table { border-radius: var(--radius-lg); overflow: hidden; }
.portal-rep th,
.portal-cc th { padding: 10px 14px; font-size: 0.8rem; }
.portal-rep td,
.portal-cc td { padding: 9px 14px; border-bottom: 1px solid var(--brand-border-light); font-size: 0.85rem; }
.portal-rep tr:last-child td,
.portal-cc tr:last-child td { border-bottom: none; }
.portal-rep tr:hover td,
.portal-cc tr:hover td { background: #fafafa; }

.portal-rep h3,
.portal-cc h3 { font-size: 0.95rem; margin-bottom: 12px; }


/* ══════════════════════════════════════════════════════════════════════
   23. Responsive
   ══════════════════════════════════════════════════════════════════════ */

/* ── Admin nav mobile (900px — matches sidebar breakpoint) ─── */
@media (max-width: 900px) {
    .nav-hamburger { display: block; }
    .nav-items {
        display: none; position: absolute; top: 100%; left: 0; right: 0;
        background: var(--brand-primary); flex-direction: column; padding: 8px 16px 16px;
        gap: 2px; z-index: 10001; box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    }
    .nav-items.mobile-open { display: flex; }
    .nav-group, .nav-direct { width: 100%; }
    .nav-group-btn, .nav-direct { width: 100%; justify-content: flex-start; }
    .nav-panel { position: static; padding-top: 0; width: 100%; }
    .nav-panel-inner { box-shadow: none; border: none; border-radius: 0; background: rgba(255,255,255,0.05); }
    .nav-panel a { color: #ccc; }
    .nav-panel a:hover { background: rgba(255,255,255,0.1); }
    .nav-right { width: 100%; justify-content: flex-end; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.1); }
    .nav-group.right-align > .nav-panel { position: absolute; right: 0; left: auto; width: auto; min-width: 260px; }
    /* Rep FAB visible on mobile */
    .qc-fab { display: block; }
}

/* ── Tablet (768px) ─── */
@media (max-width: 768px) {
    /* Admin portal overrides */
    .portal-admin header { flex-wrap: wrap; padding: 10px 15px; gap: 8px; }
    .portal-admin header a[style*="gap:10px"] { padding: 5px 0; }
    .portal-admin header a[style*="gap:10px"] span { font-size: 1.1rem; }
    .portal-admin nav { flex-wrap: wrap; gap: 2px; justify-content: center; width: 100%; }
    .portal-admin nav a, .portal-admin nav span, .portal-admin .nav-group-btn, .portal-admin .nav-direct { font-size: 0.75rem !important; padding: 6px 8px !important; }

    /* Rep/CC portal overrides */
    .portal-rep header, .portal-cc header { flex-wrap: wrap; padding: 8px 12px; height: auto; gap: 6px; }
    .portal-rep .hdr-brand span, .portal-cc .hdr-brand span { font-size: 1rem; }
    .portal-rep nav, .portal-cc nav { flex-wrap: wrap; gap: 2px; justify-content: center; width: 100%; }
    .portal-rep nav a, .portal-cc nav a { font-size: 0.75rem; padding: 6px 8px; }
    .portal-rep nav .user-tag, .portal-cc nav .user-tag { font-size: 0.72rem; }
    .portal-rep .badge, .portal-cc .badge { font-size: 0.7rem; padding: 2px 7px; }

    /* Shared mobile styles */
    .container { margin: 15px auto; padding: 0 12px; }
    .card { padding: 15px; margin-bottom: 12px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    th, td { white-space: nowrap; padding: 8px 10px; font-size: 0.8rem; }
    .portal-rep th, .portal-cc th { font-size: 0.72rem; }
    .portal-rep th, .portal-rep td, .portal-cc th, .portal-cc td { padding: 7px 10px; font-size: 0.78rem; }
    h2 { font-size: 1.05rem; }
    .btn { padding: 7px 12px; font-size: 0.82rem; }
    .portal-rep .btn, .portal-cc .btn { padding: 6px 12px; font-size: 0.8rem; }
    .form-group input, .form-group select, .form-group textarea { font-size: 16px; }
    .toast { min-width: 240px; max-width: calc(100vw - 40px); }
    #toast-container { right: 10px; left: 10px; align-items: stretch; }
    .user-dropdown-menu { right: -10px; min-width: 180px; }
}

/* ── Small phone (480px) ─── */
@media (max-width: 480px) {
    .portal-admin header { padding: 8px 10px; }
    .portal-admin nav a, .portal-admin nav span { font-size: 0.7rem !important; padding: 5px 6px !important; }
    .portal-rep header, .portal-cc header { padding: 6px 8px; }
    .portal-rep .hdr-brand span, .portal-cc .hdr-brand span { font-size: 0.9rem; }
    .portal-rep nav a, .portal-cc nav a { font-size: 0.7rem; padding: 5px 6px; }
    .breadcrumb { font-size: 0.75rem; padding: 6px 0; }
    .container { padding: 0 8px; }
    .card { padding: 12px; }
    th, td { padding: 6px 8px; font-size: 0.75rem; }
    .portal-rep th, .portal-rep td, .portal-cc th, .portal-cc td { padding: 5px 7px; font-size: 0.72rem; }
}


/* ══════════════════════════════════════════════════════════════════════
   24. Print
   ══════════════════════════════════════════════════════════════════════ */
/* ── DO NOT CONTACT — row-level warning treatment ────────────── */
/* Applied when cc_status = 'DO NOT CONTACT'. Whole row reads red,
   contact icons are grey-ed and locked, phone/email are censored. */
.row-do-not-contact,
.row-do-not-contact td,
.row-do-not-contact td a,
.row-do-not-contact td span {
    color: #c0392b !important;
}
.row-do-not-contact td {
    font-weight: 500;
}
.row-do-not-contact .dnc-disabled,
.row-do-not-contact a.dnc-disabled,
.row-do-not-contact button.dnc-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}
.dnc-censored {
    font-family: ui-monospace, monospace;
    letter-spacing: 0.5px;
}

@media print {
    header, nav, .btn, .flash, .no-print, #toast-container, #global-spinner, #kb-help, .breadcrumb { display: none !important; }
    body { background: white; font-size: 11pt; }
    .container { max-width: 100%; margin: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    table { font-size: 9pt; }
    th { background: #eee !important; color: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a { color: #333; text-decoration: none; }
}
