/* Contact Reconciliation Campaign (Tech subtab)
   tab-content is overflow:hidden + flex column; this panel must be the
   scroll container so list/detail stay inside the viewport. */

#tab-campaign {
    padding: 0;
    min-height: 0;
    overflow: hidden;
}

.cc-root {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    padding: 6px 10px 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cc-list,
.cc-detail {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cc-detail { display: none; }
.cc-root.cc-show-detail .cc-list { display: none; }
.cc-root.cc-show-detail .cc-detail { display: flex; }

.cc-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 6px;
    flex: 0 0 auto;
}
.cc-header h2 { margin: 0 0 2px; font-size: 1.15rem; }
.cc-progress-wrap { min-width: 200px; flex: 1; max-width: 560px; }
.cc-progress-label { font-size: 0.85rem; margin-bottom: 3px; }
.cc-progress-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: #d0d5dd; }
body.dark-mode .cc-progress-bar { background: #3a3f4b; }
.cc-progress-bar span { display: block; height: 100%; }
.cc-prog-done { background: #2f9e44; }
.cc-prog-prog { background: #f59f00; }
.cc-prog-todo { background: #adb5bd; }
.cc-caller-break { font-size: 0.8rem; margin-top: 3px; }
.cc-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cc-filters { margin-bottom: 6px; flex: 0 0 auto; gap: 8px; }

.cc-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e2e4ea;
    border-radius: 6px;
    background: #fff;
}
body.dark-mode .cc-table-wrap { border-color: #3a3f4b; background: transparent; }

.cc-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.cc-table th, .cc-table td { padding: 4px 6px; border-bottom: 1px solid #e2e4ea; text-align: left; vertical-align: top; }
body.dark-mode .cc-table th, body.dark-mode .cc-table td { border-bottom-color: #3a3f4b; }
/* Beat global table th / .detail-table thead th (white text) so headers stay readable. */
#tab-campaign .cc-table th,
#tab-campaign .cc-table thead th {
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
    background: #e8eef5;
    color: #1a202c;
    border-right-color: #c5ccd6;
}
#tab-campaign .cc-table thead th:hover,
#tab-campaign .cc-table th:hover {
    background: #d7e0ea;
    color: #1a202c;
}
body.dark-mode #tab-campaign .cc-table th,
body.dark-mode #tab-campaign .cc-table thead th {
    background: #2d3748 !important;
    color: #f7fafc !important;
    border-color: #4a5568 !important;
    border-right-color: #4a5568 !important;
}
body.dark-mode #tab-campaign .cc-table thead th:hover,
body.dark-mode #tab-campaign .cc-table th:hover {
    background: #3d4a5c !important;
    color: #f7fafc !important;
}
.cc-table tbody tr { cursor: pointer; }
.cc-table tbody tr:hover { background: rgba(47, 110, 180, 0.08); }
.cc-table.cc-contacts-table tbody tr { cursor: default; }

.cc-name { font-weight: 600; color: inherit; text-decoration: none; }
.cc-pill { display: inline-block; padding: 0 7px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.cc-pill-todo { background: #e9ecef; color: #495057; }
.cc-pill-prog { background: #fff3bf; color: #7c4a00; }
.cc-pill-done { background: #d3f9d8; color: #1b6b2a; }
body.dark-mode .cc-pill-todo { background: #3a3f4b; color: #ddd; }
body.dark-mode .cc-pill-prog { background: #5c4a14; color: #ffe8a3; }
body.dark-mode .cc-pill-done { background: #1b4d28; color: #b2f2bb; }
.cc-badge { display: inline-block; padding: 0 6px; margin-right: 4px; border-radius: 4px; font-size: 0.72rem; font-weight: 700; }
.cc-badge-tta { background: #d0ebff; color: #1864ab; }
.cc-badge-ps { background: #e5dbff; color: #5f3dc4; }
body.dark-mode .cc-badge-tta { background: #185078; color: #d0ebff; }
body.dark-mode .cc-badge-ps { background: #4c3a7a; color: #e5dbff; }

.cc-notes { color: #555; font-size: 0.8rem; }
body.dark-mode .cc-notes { color: #bbb; }
.cc-notes-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 280px;
    font-size: 0.78rem;
    color: #555;
    line-height: 1.3;
}
body.dark-mode .cc-notes-preview { color: #bbb; }

.cc-pager { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex: 0 0 auto; }
.cc-status, .cc-error { margin: 4px 0; flex: 0 0 auto; }
.cc-error, #ccStatus.cc-error { color: #c92a2a; text-shadow: none; }

.cc-detail-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 12px;
    margin-bottom: 8px;
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 2;
    background: inherit;
    padding: 2px 0 6px;
}
.cc-detail-heading { flex: 1 1 220px; min-width: 0; }
.cc-detail-heading h2 { margin: 0 0 2px; font-size: 1.15rem; line-height: 1.25; }
.cc-meta { margin: 0; line-height: 1.35; font-size: 0.85rem; }
.cc-detail-toolbar .cc-meta { margin: 0; }

/* Title, progress, and detail heading sit on the portal's dark blue chrome. */
.cc-header h2,
.cc-detail-heading h2,
.cc-detail-toolbar .cc-meta,
.cc-progress-label,
.cc-caller-break,
.cc-list > .cc-header ~ .cc-status,
#ccStatus {
    color: #ffffff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}
body.dark-mode .cc-header h2,
body.dark-mode .cc-detail-heading h2,
body.dark-mode .cc-detail-toolbar .cc-meta,
body.dark-mode .cc-progress-label,
body.dark-mode .cc-caller-break,
body.dark-mode .cc-list > .cc-header ~ .cc-status,
body.dark-mode #ccStatus {
    color: #f7fafc;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.cc-detail-grid {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(340px, 1.25fr);
    gap: 10px;
    align-items: start;
    padding-bottom: 16px;
}
.cc-detail-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cc-card-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 1100px) {
    .cc-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .cc-card-row { grid-template-columns: 1fr; }
}

.cc-card { border: 1px solid #e2e4ea; border-radius: 6px; padding: 8px 10px; background: #fff; }
body.dark-mode .cc-card { border-color: #3a3f4b; background: transparent; }
.cc-card h3 { margin: 0 0 4px; font-size: 0.95rem; }
.cc-card h4 { margin: 8px 0 4px; font-size: 0.85rem; }
.cc-card .cc-meta { margin: 0 0 6px; }
.cc-card > .cc-notes { margin: 0 0 6px; }

.cc-form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 6px; }
.cc-form-row:last-child { margin-bottom: 0; }
.cc-form-row label { display: flex; flex-direction: column; font-size: 0.8rem; gap: 2px; min-width: 0; }
.cc-form-row label.cc-grow { flex: 1 1 100%; }
.cc-form-row textarea,
.cc-overall-notes {
    font: inherit;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    resize: vertical;
}
.cc-overall-notes { min-height: 120px; }
.cc-notes-actions { align-items: center; }
#ccNotesMeta { flex: 1 1 180px; color: #555; }
body.dark-mode #ccNotesMeta { color: #bbb; }
body.dark-mode .cc-form-row textarea,
body.dark-mode .cc-overall-notes { border-color: #3a3f4b; background: #1a1f2a; color: inherit; }

.cc-history { list-style: none; margin: 0; padding: 0; }
.cc-history li { border-top: 1px solid #e2e4ea; padding: 6px 0; font-size: 0.85rem; }
body.dark-mode .cc-history li { border-top-color: #3a3f4b; }
.cc-empty { padding: 12px; color: #666; }
.cc-chip { border: 1px solid #adb5bd; background: transparent; border-radius: 14px; padding: 2px 10px; cursor: pointer; font-size: 0.85rem; }
.cc-chip.on { background: #1864ab; color: #fff; border-color: #1864ab; }

.cc-src { display: inline-block; margin-left: 6px; font-size: 0.72rem; font-weight: 600; color: #555; }
body.dark-mode .cc-src { color: #bbb; }
.cc-add-contacts { margin-top: 8px; }
.cc-contact-row, .cc-printer-history { margin-top: 4px; }
.cc-contact-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 4px 6px;
    margin-bottom: 4px;
    align-items: end;
}
@media (max-width: 700px) {
    .cc-contact-grid { grid-template-columns: 1fr 1fr; }
}
.cc-contact-grid label { display: flex; flex-direction: column; font-size: 0.72rem; gap: 2px; min-width: 0; }
.cc-contact-grid input, .cc-contact-grid textarea, .cc-printer-status, .cc-printer-notes {
    font: inherit; padding: 3px 5px; border: 1px solid #cbd5e0; border-radius: 4px; width: 100%; box-sizing: border-box;
}
.cc-actions-cell { white-space: nowrap; }
.cc-actions-cell button { margin-right: 4px; }
.cc-printer-save-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; }
.cc-printer-history { font-size: 0.78rem; color: #555; }
body.dark-mode .cc-printer-history { color: #bbb; }

/* Compact printer table inside the side column */
.cc-detail-side .cc-table { font-size: 0.78rem; }
.cc-detail-side .cc-table th, .cc-detail-side .cc-table td { padding: 3px 5px; }
.cc-detail-side { overflow-x: auto; }

@media (max-width: 768px) {
    .cc-root { padding: 4px 6px 8px; }
    .cc-header h2, .cc-detail-heading h2 { font-size: 1.05rem; }
    /* Header + stacked filters can exceed the viewport; scroll the whole
       list/detail instead of trapping the table in a zero-height pane. */
    .cc-list, .cc-detail {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
    .cc-table-wrap {
        flex: 0 0 auto;
        overflow: visible;
        border: 0;
        border-radius: 0;
    }
    .cc-detail-grid {
        overflow: visible;
        flex: 0 0 auto;
    }
    .cc-form-row .btn, .cc-notes-actions .btn { min-height: 36px; }
}
