/* Reference layout styling. Uses the CRM's existing table, controls and data. */
.cdtc-task-panel {
    background: #fff;
    border: 1px solid #e2e6ea;
    border-radius: 7px;
    box-shadow: 0 2px 5px rgba(15, 23, 42, .08);
    overflow: hidden;
}

.cdtc-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cdtc-reference-table {
    width: 100% !important;
    margin: 0 !important;
    border-collapse: collapse !important;
    border-spacing: 0;
    color: #475569;
    font-size: 14px;
    background: #fff;
}

.cdtc-reference-table thead th {
    background: #f6f7f9 !important;
    color: #374151 !important;
    font-weight: 600;
    border-top: 1px solid #e5e7eb !important;
    border-bottom: 1px solid #e5e7eb !important;
    border-right: 1px solid #e8ebef !important;
    padding: 12px 10px !important;
    vertical-align: middle;
    white-space: nowrap;
}

.cdtc-reference-table thead th:last-child { border-right: 0 !important; }

.cdtc-reference-table tbody td {
    background: #fff;
    color: #566174;
    padding: 11px 10px !important;
    border-top: 1px solid #e8ebef !important;
    border-bottom: 0 !important;
    vertical-align: top;
    line-height: 1.45;
}

.cdtc-reference-table tbody tr:hover td { background: #fbfcfe; }
.cdtc-reference-table .label,
.cdtc-reference-table .task-status,
.cdtc-reference-table .badge {
    display: inline-block;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
}

/* Keep the native CRM toolbar, page-size selector, search and pagination visible. */
.cdtc-task-panel .dataTables_wrapper .dataTables_length,
.cdtc-task-panel .dataTables_wrapper .dataTables_filter,
.cdtc-task-panel .dataTables_wrapper .dataTables_info,
.cdtc-task-panel .dataTables_wrapper .dataTables_paginate {
    color: #667085;
    font-size: 13px;
}

.cdtc-task-panel .dataTables_wrapper .dataTables_filter input,
.cdtc-task-panel .dataTables_wrapper .dataTables_length select,
.cdtc-task-panel select,
.cdtc-task-panel input[type="search"] {
    border: 1px solid #cfd5df;
    border-radius: 6px;
    min-height: 32px;
    box-shadow: none;
}

.cdtc-task-panel .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #e9ebef !important;
    border: 0 !important;
    border-radius: 8px;
}

@media (max-width: 767px) {
    .cdtc-reference-table { min-width: 760px; }
    .cdtc-reference-table thead th,
    .cdtc-reference-table tbody td { padding: 9px 8px !important; }
}


/* Keep the task table within the project content area on desktop. */
.cdtc-task-panel,
.cdtc-task-panel .dataTables_wrapper,
.cdtc-task-panel .table-responsive,
.cdtc-table-wrap {
    max-width: 100% !important;
    min-width: 0 !important;
}

.cdtc-table-wrap,
.cdtc-task-panel .table-responsive {
    overflow-x: hidden !important;
}

.cdtc-reference-table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
}

.cdtc-reference-table th,
.cdtc-reference-table td {
    min-width: 0 !important;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: normal !important;
}

.cdtc-reference-table th:last-child,
.cdtc-reference-table td:last-child {
    overflow-wrap: normal;
}

/* On narrow screens, allow the page to scroll naturally rather than showing
   an extra scrollbar at the bottom of the table panel. */
@media (max-width: 767px) {
    .cdtc-table-wrap,
    .cdtc-task-panel .table-responsive {
        overflow-x: auto !important;
    }

    .cdtc-reference-table {
        min-width: 700px !important;
        table-layout: auto !important;
    }
}


/* Version 1.1.0: status summary tabs replacing the Filter by dropdown. */
.cdtc-legacy-filter-hidden { display: none !important; }
.cdtc-status-tabs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    margin: 0 0 18px;
    padding: 0;
}
.cdtc-status-tab {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    min-height: 72px;
    padding: 12px 14px;
    border: 1px solid #d8dee8;
    border-radius: 9px;
    background: #fff;
    color: #344054;
    text-align: left;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.cdtc-status-tab:hover { border-color: #9dbbff; background: #fbfdff; }
.cdtc-status-tab.is-active {
    border-color: #377dff;
    box-shadow: 0 0 0 2px rgba(55, 125, 255, .12);
    background: #f8fbff;
}
.cdtc-tab-count { font-size: 16px; font-weight: 700; line-height: 1.2; color: #344054; }
.cdtc-tab-label { font-size: 13px; font-weight: 500; line-height: 1.3; color: #526071; overflow-wrap: anywhere; }
.cdtc-status-tab[data-status="Not Started"] .cdtc-tab-label { color: #667085; }
.cdtc-status-tab[data-status="In Progress"] .cdtc-tab-label { color: #2563eb; }
.cdtc-status-tab[data-status="Testing"] .cdtc-tab-label { color: #7c3aed; }
.cdtc-status-tab[data-status="Awaiting Client Feedback"] .cdtc-tab-label { color: #ca8a04; }
.cdtc-status-tab[data-status="Complete"] .cdtc-tab-label { color: #16a34a; }
@media (max-width: 1100px) {
    .cdtc-status-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .cdtc-status-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
    .cdtc-status-tab { min-height: 64px; padding: 10px; }
    .cdtc-tab-label { font-size: 12px; }
}


/* v1.1.1: status tabs belong directly above the task table, not above
   the project navigation. Keep the tab row within the task content width. */
.cdtc-status-tabs {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin: 0 0 14px;
    position: relative;
    z-index: 1;
}
.cdtc-status-tab {
    min-width: 0;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid #d7deea;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    text-align: left;
    cursor: pointer;
    font: inherit;
}
.cdtc-status-tab:hover { border-color: #9bbcff; background: #f8fbff; }
.cdtc-status-tab.is-active {
    border-color: #3478f6;
    box-shadow: 0 0 0 1px rgba(52,120,246,.12);
    background: #f8fbff;
}
.cdtc-tab-count { font-size: 16px; font-weight: 700; line-height: 1.2; }
.cdtc-tab-label { font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.cdtc-legacy-filter-hidden { display: none !important; }
@media (max-width: 767px) {
    .cdtc-status-tabs { flex-wrap: wrap; gap: 6px; }
    .cdtc-status-tab { flex: 1 1 calc(50% - 6px); }
}
