/* ========================================
   Hub / Buyer Dashboard
   ======================================== */

.hub-dashboard {
    /* Top padding leaves clear space below the sticky .main-header
       (≈ 66px tall). Side padding gives every card / table room to
       breathe against the viewport edge (matches the reference design
       — content does not run flush to the right of the page). */
    padding: 28px 48px 40px;
    font-family: 'Open Sans', sans-serif;
    color: #222;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* When the global Bootstrap .container-fluid is also applied, override the
   default left/right padding so the dashboard has consistent breathing room. */
.hub-dashboard.container {
    padding-left: 48px;
    padding-right: 48px!important;
}

.hub-dashboard h1.hub-page-title {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    /* Push the title further down so it doesn't sit right under the
       sticky header bar. */
    margin: 12px 0 22px;
}

/* ---------- Top summary row ---------- */
.hub-summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
    gap: 20px;
    align-items: stretch;
    margin-bottom: 20px;
    min-width: 0;
}

.hub-summary-left {
    display: flex;
    align-items: center;
    gap: 22px;
    background: #fff;
    border-radius: 14px;
    padding: 16px 22px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.hub-total-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
}

.hub-total-block .label {
    font-size: 12px;
    color: #6B7280;
    font-weight: 500;
}

.hub-total-block .value {
    font-size: 26px;
    font-weight: 700;
    color: #111827;
}

.hub-status-pills {
    display: flex;
    gap: 14px;
    flex: 1;
    flex-wrap: wrap;
}

.hub-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 10px 16px;
    min-width: 130px;
    cursor: default;
}

.hub-pill .pill-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.hub-pill.pending  .pill-icon { color: #9CA3AF; }
.hub-pill.testing  .pill-icon { color: #F59E0B; }
.hub-pill.complete .pill-icon { color: #22C55E; }

.hub-pill .pill-label {
    font-size: 13px;
    color: #4B5563;
    font-weight: 500;
}

.hub-pill .pill-value {
    margin-left: auto;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

/* Overall compliance card */
.hub-compliance-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hub-compliance-card .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hub-compliance-card .title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.hub-compliance-card .percent {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}

.hub-compliance-card .bar {
    height: 10px;
    width: 100%;
    background: #F3F4F6;
    border-radius: 999px;
    overflow: hidden;
}

.hub-compliance-card .bar > div {
    height: 100%;
    background: linear-gradient(90deg, #34D399, #10B981);
    transition: width .3s ease;
}

.hub-compliance-card .footer {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ---------- Communities table ---------- */
.hub-community-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.hub-community-table th,
.hub-community-table td {
    /* Larger vertical padding so each community row reads as its own
       card-like band with clear breathing room above and below the
       content (matches the reference design). */
    padding: 20px 18px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid #E5E7EB;
    vertical-align: middle;
}

/* The expanded community row + its expanded-sub row form a single
   purple-bordered card, so we suppress the regular row separator
   between them. The sub-row supplies its own bottom border. */
.hub-community-table tbody tr.expanded + tr.expanded-sub td { border-top: none; }

.hub-community-table thead th {
    font-size: 12px;
    color: #6B7280;
    font-weight: 600;
    background: #F9FAFB;
    text-transform: none;
}

.hub-community-table tbody tr {
    cursor: pointer;
    transition: background .15s;
}

.hub-community-table tbody tr:hover { background: #FAFAFA; }

/* Expanded community: 4-side #2968E9 border wrapping the main row AND
   its expanded sub-row. Because tables are border-collapse:separate
   the visual border is built up across the two <tr>s via per-cell
   border edges. The first/last cells round the top corners so the
   box reads as a single rounded rectangle. */
.hub-community-table tbody tr.expanded td {
    background: #fff;
    color: #2968E9;
    font-weight: 600;
    border-top: 2px solid #2968E9;
    border-bottom: none;
}

.hub-community-table tbody tr.expanded td:first-child {
    border-left: 2px solid #2968E9;
    border-top-left-radius: 10px;
}

.hub-community-table tbody tr.expanded td:last-child {
    border-right: 2px solid #2968E9;
    border-top-right-radius: 10px;
}

.hub-community-table tbody tr.expanded td .community-name {
    color: #2968E9;
    font-weight: 600;
}

.hub-community-table tbody tr.expanded .chev {
    color: #2968E9;
}

/* Expanded sub-row (transaction-cycle list under the community). */
.hub-community-table tbody tr.expanded-sub td {
    background: #fff;
    border-left: 2px solid #2968E9;
    border-right: 2px solid #2968E9;
    border-bottom: 2px solid #2968E9;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

/* Transaction cycle title sits in the expanded-sub row. It renders
   in the default dark text color (NOT #2968E9) — the purple is
   reserved for the parent community row's identity text. */
.hub-community-table tbody tr.expanded-sub td,
.hub-community-table tbody tr.expanded-sub .hub-cycle-name,
.hub-community-table tbody tr.expanded-sub .hub-cycle-name span {
    color: #1f2937;
}

/* Each bucket label keeps its segment color in both the collapsed
   and expanded states (grey / orange / green) — never overridden
   to purple, so the % under each segment always matches the segment. */

.community-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.community-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #E0E7FF;
    color: #6366F1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.chev {
    margin-left: auto;
    color: #2968E9;
    font-size: 14px;
    transition: transform .2s;
}

.chev.rotated { transform: rotate(180deg); }

/* Sortable headers on the Communities table (mirrors the supplier table). */
.hub-community-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.hub-community-table thead th.sortable:hover { color: #2968E9; }

.hub-community-table thead th.sortable i {
    margin-left: 6px;
    font-size: 10px;
    color: #9CA3AF;
}

.hub-community-table thead th.sortable:hover i,
.hub-community-table thead th.sortable i.fa-sort-up,
.hub-community-table thead th.sortable i.fa-sort-down {
    color: #2968E9;
}

/* Stacked progress bar — bucket-per-column layout.
   Each .bucket flex column holds its colored segment on top and
   its percentage label directly below. The whole column shares
   the same flex-grow as the bucket's value so the label always
   sits under its own segment and reads in the segment's color. */
.hub-stacked-bar {
    display: flex;
    gap: 4px;
    align-items: stretch;
    min-width: 220px;
}

.hub-stacked-bar .bucket {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 18px;
    cursor: pointer;
    transition: transform .12s ease;
}

.hub-stacked-bar .bucket:hover { transform: translateY(-1px); }

.hub-stacked-bar .seg {
    height: 6px;
    border-radius: 4px;
    display: block;
}

.hub-stacked-bar .seg.pending  { background: #9CA3AF; }
.hub-stacked-bar .seg.testing  { background: #F59E0B; }
.hub-stacked-bar .seg.complete { background: #22C55E; }

.hub-stacked-bar .lbl {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.hub-stacked-bar .lbl.pending  { color: #6B7280; }
.hub-stacked-bar .lbl.testing  { color: #D97706; }
.hub-stacked-bar .lbl.complete { color: #15803D; }

/* Transaction cycle sub-rows */
.hub-cycle-row td {
    background: #FAFAFE;
    border-top: 1px dashed #E5E7EB;
}

.hub-cycle-name {
    color: #1f2937;
    font-size: 12.5px;
    font-weight: 500;
    padding-left: 36px;
}

/* ---------- Supplier details panel ---------- */
.hub-supplier-panel {
    margin-top: 22px;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.hub-supplier-panel .panel-title {
    background: #1E1B4B;
    color: #fff;
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.hub-supplier-panel .panel-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, .12);
    border-radius: 6px;
    padding: 6px 10px;
    min-width: 260px;
}

.hub-supplier-panel .panel-search i {
    color: rgba(255, 255, 255, .7);
    font-size: 12px;
}

.hub-supplier-panel .panel-search input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .2px;
    text-transform: none;
    flex: 1;
    min-width: 0;
}

.hub-supplier-panel .panel-search input::placeholder {
    color: rgba(255, 255, 255, .55);
    text-transform: none;
}

/* Cap the supplier table height and scroll vertically.
   The thead stays sticky so column headers remain visible. */
.hub-supplier-scroll {
    max-height: 420px;
    overflow-y: auto;
}

.hub-supplier-scroll .hub-supplier-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #F9FAFB;
}

.hub-supplier-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.hub-supplier-table th,
.hub-supplier-table td {
    padding: 14px 18px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid #F3F4F6;
    vertical-align: middle;
}

.hub-supplier-table thead th {
    font-size: 12px;
    color: #6B7280;
    font-weight: 600;
    background: #F9FAFB;
}

.hub-supplier-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.hub-supplier-table thead th.sortable:hover {
    color: #2968E9;
}

.hub-supplier-table thead th.sortable i {
    margin-left: 6px;
    font-size: 10px;
    color: #9CA3AF;
}

.hub-supplier-table thead th.sortable:hover i,
.hub-supplier-table thead th.sortable i.fa-sort-up,
.hub-supplier-table thead th.sortable i.fa-sort-down {
    color: #2968E9;
}

.hub-supplier-table tbody tr { cursor: pointer; transition: background .15s; }
.hub-supplier-table tbody tr:hover { background: #FAFAFA; }

.supplier-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.supplier-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #F3F4F6;
    color: #6B7280;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.supplier-id {
    font-size: 11px;
    color: #9CA3AF;
}

.status-cell {
    font-weight: 600;
    font-size: 12.5px;
}
.status-cell.pending  { color: #6B7280; }
.status-cell.testing  { color: #D97706; }
.status-cell.complete { color: #15803D; }

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 12px;
    color: #2968E9;
}

.row-actions i {
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

/* the collaboration icon is styled as a button elsewhere; neutralise that
   padding/size here so all three row icons sit on the same baseline */
.row-actions .collab-msg-icon {
    padding: 0;
    font-size: 16px;
}

/* Supplier-row 3-dot dropdown — a single shared menu rendered outside the
   table's scroll container and fixed-positioned (coords set from JS). */
.row-actions-menu {
    position: fixed;
    width: 220px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 12500;
    padding: 8px 0;
    margin: 0;
    list-style: none;
}

    .row-actions-menu li {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 16px;
        cursor: pointer;
        font-size: 14px;
        color: #374151;
        white-space: nowrap;
    }

        .row-actions-menu li:hover {
            background: #F3F4F6;
        }

        .row-actions-menu li i {
            width: 16px;
            color: #6B7280;
        }

/* ---------- Activity Details drawer ---------- */
.hub-activity-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .35);
    z-index: 1040;
}

.hub-activity-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    /* Prefer ~70% of viewport, with a generous floor and ceiling so
       the Pre-Testing table and Testing scenario cards have room to
       stretch full-width on any reasonable monitor. */
    width: clamp(820px, 70vw, 1280px);
    max-width: 98vw;
    background: #fff;
    z-index: 1050;
    box-shadow: -8px 0 24px rgba(0,0,0,.08);
    padding: 22px 32px;
    overflow-y: auto;
    animation: slideInDrawer .25s ease;
    box-sizing: border-box;
}

/* Inner content fills the drawer. */
.hub-activity-drawer > div { width: 100%; }
.hub-activity-drawer .hub-pre-table,
.hub-activity-drawer .hub-cycle-card { width: 100%; }

@keyframes slideInDrawer {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.hub-activity-drawer .drawer-close {
    background: none;
    border: none;
    font-size: 14px;
    color: #2968E9;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin-bottom: 18px;
    cursor: pointer;
}

.hub-activity-drawer .drawer-close i { color: #2968E9; }

.hub-activity-drawer h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 16px;
    color: #111827;
}

.hub-activity-tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid #E5E7EB;
    margin-bottom: 16px;
}

.hub-activity-tabs .tab {
    background: none;
    border: none;
    padding: 10px 0;
    font-size: 14px;
    color: #2968E9;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid transparent;
}

.hub-activity-tabs .tab.active {
    color: #2968E9;
    border-bottom-color: #2968E9;
    font-weight: 600;
}

.hub-activity-tabs .tab i { font-size: 12px; }

/* Pre-testing table */
.hub-pre-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.hub-pre-table thead th {
    font-size: 12px;
    color: #6B7280;
    font-weight: 600;
    padding: 10px 16px;
    background: #F9FAFB;
}

.hub-pre-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.hub-pre-table thead th.sortable:hover { color: #2968E9; }

.hub-pre-table thead th.sortable i {
    margin-left: 6px;
    font-size: 10px;
    color: #9CA3AF;
}

.hub-pre-table thead th.sortable:hover i,
.hub-pre-table thead th.sortable i.fa-sort-up,
.hub-pre-table thead th.sortable i.fa-sort-down {
    color: #2968E9;
}

.hub-pre-table tbody tr td {
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #F3F4F6;
    font-size: 13px;
}

.hub-pre-table tbody tr.pending td { color: #9CA3AF; }

.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #22C55E;
    color: #fff;
    font-size: 11px;
}

.status-icon.pending {
    background: #fff;
    border: 1.5px dashed #9CA3AF;
    color: transparent;
}

/* Testing Activities — mirrors supplier-side ComplianceTest/Index card */
.hub-cycle-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
    transition: border-color .2s, box-shadow .2s;
    scroll-margin-top: 12px;
}

/* Scenario whose chat is currently open — highlighted so the buyer can see
   exactly which scenario the conversation belongs to. */
.hub-cycle-card.chat-active {
    border-color: #2968E9;
    box-shadow: 0 0 0 2px rgba(41, 104, 233, .25);
}

.hub-cycle-card.chat-active .hub-cycle-card-header {
    background: #EFF4FE;
}

.hub-cycle-card-header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 18px;
    cursor: pointer;
    background: #fff;
    border-bottom: 1px solid transparent;
    transition: background .15s;
}

.hub-cycle-card.expanded .hub-cycle-card-header {
    border-bottom-color: #F3F4F6;
}

.hub-cycle-card-header:hover { background: #FAFAFA; }

.hub-cycle-card-header .cycle-info {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.hub-cycle-card-header .cycle-number {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.hub-cycle-card-header .cycle-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.hub-cycle-card-header .cycle-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}

.hub-cycle-card-header .cycle-percentage {
    font-size: 12.5px;
    font-weight: 600;
    color: #15803D;
    min-width: 36px;
    text-align: right;
}

.hub-cycle-card-header .cycle-progress-bar {
    flex: 1;
    height: 6px;
    background: #E5E7EB;
    border-radius: 999px;
    overflow: hidden;
}

.hub-cycle-card-header .cycle-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #34D399, #10B981);
    transition: width .3s ease;
}

.hub-cycle-card-header .cycle-expand-btn {
    background: transparent;
    border: none;
    color: #2968E9;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.hub-cycle-card-header .cycle-expand-btn:hover {
    background: #EFF4FE;
    color: #2968E9;
}

.hub-cycle-card-body {
    padding: 6px 18px 14px;
}

/* Top sortable header above the cycle cards on the Testing tab.
   The column widths are kept in sync with the .hub-test-case-card
   columns below so headers align with their values. */
.hub-testing-header {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    background: #F9FAFB;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #6B7280;
}

.hub-testing-header .th { display: inline-flex; align-items: center; }
.hub-testing-header .th-activity { flex: 1.2; min-width: 0; }
.hub-testing-header .th-date     { flex: 0 0 160px; }
.hub-testing-header .th-status   { flex: 0 0 380px; justify-content: flex-end; }

.hub-testing-header .sortable { cursor: pointer; user-select: none; }
.hub-testing-header .sortable i {
    margin-left: 6px;
    font-size: 10px;
    color: #9CA3AF;
}
.hub-testing-header .sortable:hover,
.hub-testing-header .sortable:hover i,
.hub-testing-header .sortable i.fa-sort-up,
.hub-testing-header .sortable i.fa-sort-down { color: #2968E9; }

/* 3-column flex layout: Activity | Activity Date | Status */
.hub-test-case-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid #F3F4F6;
}

.hub-test-case-card:first-child { border-top: none; }

.hub-test-case-card .test-case-info {
    flex: 1.2;
    min-width: 0;
}

.hub-test-case-card .test-case-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hub-test-case-card .test-case-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #E8F0FE;
    color: #2968E9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.hub-test-case-card .test-case-number {
    color: #2968E9;
    font-weight: 600;
    font-size: 13px;
}

.hub-test-case-card .test-case-name {
    color: #111827;
    font-weight: 600;
    font-size: 13px;
}

.hub-test-case-card .test-case-description {
    color: #6B7280;
    font-size: 12px;
    margin-top: 4px;
    margin-left: 38px;
}

.hub-test-case-card .test-case-date {
    flex: 0 0 160px;
    color: #374151;
    font-size: 12.5px;
}

.hub-test-case-card .test-case-status {
    /* Wider column — needs to fit the file pill, status badge, and
       review icon side-by-side now that the file pill lives here
       instead of under the test case description. */
    flex: 0 0 380px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: nowrap;
}

/* File pill sits inline with the badge inside the status column, so
   the older below-description margins no longer apply. */
.hub-test-case-card .test-case-status .file-pill {
    margin-top: 0;
    margin-left: 0;
    flex-shrink: 1;
    min-width: 0;
}

.hub-test-case-card .test-case-status .muted {
    color: #9CA3AF;
    font-style: italic;
    font-size: 12px;
}

.file-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #F3F4F6;
    color: #374151;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    max-width: 240px;
    margin-top: 8px;
    margin-left: 38px;
}

.file-pill .file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.file-status-badge.passed  { background: #DCFCE7; color: #166534; }
.file-status-badge.errors  { background: #FEE2E2; color: #B91C1C; }
.file-status-badge.pending { background: #FEF3C7; color: #B45309; }

/* Icon-only Review Results action (replaces the previous text link). */
.review-icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #2968E9;
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.review-icon-btn:hover {
    background: #EFF4FE;
    text-decoration: none;
}

/* Empty/loading states */
.hub-empty {
    padding: 28px;
    text-align: center;
    color: #9CA3AF;
    font-size: 13px;
}

.hub-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #E5E7EB;
    border-top-color: #6366F1;
    border-radius: 50%;
    animation: hub-spin .8s linear infinite;
}

@keyframes hub-spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */

/* Horizontal-scroll wrapper around community + supplier tables.
   We deliberately do NOT set display:block on the table itself —
   that splits thead/tbody into independent display:table contexts
   and they compute column widths independently, making the header
   columns drift out of alignment with the body cells. */
.hub-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.hub-community-table,
.hub-supplier-table {
    table-layout: fixed;
}

/* Communities table column widths */
.hub-community-table th:nth-child(1) { width: 26%; }
.hub-community-table th:nth-child(2) { width: 14%; }
.hub-community-table th:nth-child(3) { width: 10%; }
.hub-community-table th:nth-child(4) { width: 14%; }
.hub-community-table th:nth-child(5) { width: auto; }
.hub-community-table th:nth-child(6) { width: 40px; }

/* Supplier table column widths */
.hub-supplier-table th:nth-child(1) { width: 22%; }
.hub-supplier-table th:nth-child(2) { width: 12%; }
.hub-supplier-table th:nth-child(3) { width: 12%; }
.hub-supplier-table th:nth-child(4) { width: 10%; }
.hub-supplier-table th:nth-child(5) { width: 12%; }
.hub-supplier-table th:nth-child(6) { width: 8%; }
.hub-supplier-table th:nth-child(7) { width: 8%; }
.hub-supplier-table th:nth-child(8) { width: 8%; }
.hub-supplier-table th:nth-child(9) { width: 120px; }

/* actions cell must never wrap/clip its icon row */
.hub-supplier-table td:last-child,
.hub-supplier-table th:last-child {
    overflow: visible;
    white-space: nowrap;
}

.hub-community-table td,
.hub-supplier-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1200px) {
    .hub-summary-row {
        grid-template-columns: 1fr;
    }
    .hub-summary-left {
        flex-wrap: wrap;
    }
    .hub-stacked-bar {
        min-width: 160px;
    }
    .hub-stacked-bar .legend {
        display: none;
    }
}

@media (max-width: 992px) {
    .hub-dashboard,
    .hub-dashboard.container-fluid {
        padding-left: 16px;
        padding-right: 16px;
    }
    .hub-pill {
        min-width: 110px;
        padding: 8px 12px;
    }
    .hub-pill .pill-value { font-size: 16px; }

    .hub-summary-left {
        gap: 12px;
        padding: 14px 16px;
    }

    .hub-community-table th,
    .hub-community-table td,
    .hub-supplier-table th,
    .hub-supplier-table td {
        padding: 10px 12px;
        font-size: 12.5px;
    }

    .hub-activity-drawer {
        width: 100vw;
        padding: 18px 18px;
    }
}

@media (max-width: 720px) {
    .hub-dashboard h1.hub-page-title {
        font-size: 22px;
    }
    .hub-summary-left {
        flex-direction: column;
        align-items: flex-start;
    }
    .hub-status-pills {
        width: 100%;
    }
    .hub-pill {
        flex: 1 1 calc(33% - 10px);
        min-width: 0;
    }
    .hub-pill .pill-value {
        margin-left: auto;
    }
    .hub-supplier-table {
        font-size: 11px;
    }
}

/* ---------- Bucket drawer (click on a bar segment) ----------
   Right-side slide-in panel that mirrors .hub-activity-drawer so
   the bucket view feels consistent with the Testing Activities
   experience the user is already familiar with. */
.hub-bucket-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: clamp(560px, 55vw, 920px);
    max-width: 98vw;
    background: #fff;
    z-index: 1050;
    box-shadow: -8px 0 24px rgba(0,0,0,.08);
    padding: 22px 32px;
    overflow-y: auto;
    animation: slideInDrawer .25s ease;
    box-sizing: border-box;
}

.hub-bucket-drawer .drawer-close {
    background: none;
    border: none;
    font-size: 14px;
    color: #2968E9;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin-bottom: 14px;
    cursor: pointer;
}

.hub-bucket-drawer .drawer-close i { color: #2968E9; }

.hub-bucket-drawer .bucket-drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.hub-bucket-drawer .bucket-drawer-title h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: #111827;
}

.hub-bucket-drawer .bucket-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.hub-bucket-drawer .bucket-dot.pending  { background: #9CA3AF; }
.hub-bucket-drawer .bucket-dot.testing  { background: #F59E0B; }
.hub-bucket-drawer .bucket-dot.complete { background: #22C55E; }

.hub-bucket-drawer.bucket-pending  .bucket-drawer-title h2 { color: #6B7280; }
.hub-bucket-drawer.bucket-testing  .bucket-drawer-title h2 { color: #D97706; }
.hub-bucket-drawer.bucket-complete .bucket-drawer-title h2 { color: #15803D; }

.hub-bucket-drawer .bucket-subtitle {
    font-size: 13px;
    color: #6B7280;
    flex-basis: 100%;
}

/* Search bar — visually matches the supplier-panel search but lives
   on a light background, so we flip the colors to dark-on-light. */
.hub-bucket-drawer .bucket-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 16px;
}

.hub-bucket-drawer .bucket-search-wrap i {
    color: #6B7280;
    font-size: 13px;
}

.hub-bucket-drawer .bucket-search-wrap input {
    background: transparent;
    border: none;
    outline: none;
    font-size: 13px;
    color: #111827;
    flex: 1;
    min-width: 0;
}

.hub-bucket-drawer .bucket-search-wrap input::placeholder {
    color: #9CA3AF;
}

/* Supplier card — mirrors .hub-cycle-card structure (header that
   toggles, body that lists rows) so the layout is visually
   continuous with the Testing Activities tab. */
.hub-bucket-drawer .bucket-supplier-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.hub-bucket-drawer .bucket-supplier-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    cursor: pointer;
    background: #fff;
    border-bottom: 1px solid transparent;
    transition: background .15s;
}

.hub-bucket-drawer .bucket-supplier-card.expanded .bucket-supplier-header {
    border-bottom-color: #F3F4F6;
}

.hub-bucket-drawer .bucket-supplier-header:hover { background: #FAFAFA; }

.hub-bucket-drawer .bucket-supplier-info {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}

.hub-bucket-drawer .bucket-supplier-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.hub-bucket-drawer .bucket-supplier-id {
    font-size: 11.5px;
    color: #9CA3AF;
    font-weight: 500;
}

.hub-bucket-drawer .bucket-case-count {
    font-size: 12px;
    color: #6B7280;
    background: #F3F4F6;
    padding: 3px 10px;
    border-radius: 999px;
}

.hub-bucket-drawer.bucket-pending  .bucket-case-count { color: #6B7280; background: #F3F4F6; }
.hub-bucket-drawer.bucket-testing  .bucket-case-count { color: #D97706; background: #FEF3C7; }
.hub-bucket-drawer.bucket-complete .bucket-case-count { color: #15803D; background: #DCFCE7; }

.hub-bucket-drawer .cycle-expand-btn {
    background: transparent;
    border: none;
    color: #2968E9;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.hub-bucket-drawer .cycle-expand-btn:hover { background: #EFF4FE; color: #2968E9; }

.hub-bucket-drawer .bucket-supplier-body {
    padding: 6px 18px 14px;
}

.hub-bucket-drawer .bucket-case-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid #F3F4F6;
    font-size: 13px;
    color: #374151;
}

.hub-bucket-drawer .bucket-case-row:first-child { border-top: none; }

.hub-bucket-drawer .bucket-case-row .test-case-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #E8F0FE;
    color: #2968E9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.hub-bucket-drawer .bucket-case-num {
    color: #2968E9;
    font-weight: 600;
    flex-shrink: 0;
}

.hub-bucket-drawer .bucket-case-name {
    color: #111827;
    font-weight: 500;
}

.hub-bucket-drawer .bucket-case-cycle {
    color: #9CA3AF;
    font-size: 12px;
    margin-left: auto;
}
