/* CNC Dashboard — Layout, Header, Grid & Responsive */

/* Background watermark logo */
.bg-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    max-width: 900px;
    opacity: 0.025;
    z-index: 0;
    pointer-events: none;
    filter: brightness(0) invert(1);
}

.light-theme .bg-watermark {
    filter: brightness(0);
    opacity: 0.02;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem 3rem;
    position: relative;
    z-index: 1;
}

/* Header — background spans full viewport; content constrained to 2000px center */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 3rem;
    border-bottom: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: transparent;
    box-sizing: border-box;
}

.light-theme .header {
    background: rgba(248, 250, 252, 0.9);
    border-bottom-color: rgba(226, 232, 240, 0.6);
    box-shadow: 0 1px 0 rgba(226, 232, 240, 0.6);
}

/* Breadcrumb */
.header-breadcrumb {
    display: none;
}

.breadcrumb-item {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.breadcrumb-item[href]:hover {
    color: var(--accent);
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
}

.breadcrumb-sep {
    color: var(--text-muted);
    opacity: 0.5;
    margin: 0 0.25rem;
    font-size: 0.7rem;
}

/* Push container content below fixed header + always-visible subnav */
.container {
    padding-top: calc(2rem + 64px + 52px);
}

/* ═══════════════════════════════════════════ */
/* DETAIL SUB-NAVIGATION (customer name + tabs) */
/* ═══════════════════════════════════════════ */
.detail-subnav {
    position: fixed;
    top: 63px;
    /* sit right on top of header edge, no gap */
    left: 0;
    right: 0;
    width: 100%;
    z-index: 90;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.detail-subnav-inner {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 3rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.detail-subnav-customer {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    padding: 0.4rem 0;
}

/* Styled customer switcher select */
.customer-nav-select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(245, 206, 127, 0.12);
    border: 1px solid rgba(245, 206, 127, 0.4);
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    cursor: pointer;
    padding: 0.2rem 2rem 0.2rem 0.75rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23F5CE7F' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    outline: none;
    max-width: 280px;
    transition: background 0.2s, border-color 0.2s;
}

.customer-nav-select:hover,
.customer-nav-select:focus {
    background-color: rgba(245, 206, 127, 0.22);
    border-color: rgba(245, 206, 127, 0.7);
    color: var(--text-primary);
}

.customer-nav-select option {
    font-size: 0.95rem;
    font-weight: 500;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.light-theme .customer-nav-select option {
    background: #f8fafc;
}

.detail-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.detail-tabs::-webkit-scrollbar {
    display: none;
}

.detail-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.18s, border-color 0.18s;
    white-space: nowrap;
    margin-bottom: -1px;
}

.detail-tab .material-symbols-outlined {
    font-size: 1rem;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    transition: font-variation-settings 0.18s;
}

.detail-tab:hover {
    color: var(--text-primary);
}

.detail-tab.active {
    color: #2B2F3A;
    border-bottom-color: #F5CE7F;
    background: rgba(245, 206, 127, 0.15);
}

.light-theme .detail-tab.active {
    color: #2B2F3A;
}

.detail-tab.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* Customer tabs disabled/greyed when no customer is selected */
.detail-tabs.no-customer .customer-tab {
    opacity: 0.32;
    pointer-events: none;
    cursor: not-allowed;
}

/* CNC Dashboard home tab — #FBB300 yellow background pill */
.cnc-home-tab {
    background: #FBB300;
    color: #1a1a1a !important;
    border-radius: 999px;
    margin: 0.3rem 0.75rem 0.3rem 0;
    padding: 0.4rem 0.9rem;
    border-bottom: 2px solid transparent;
    border-right: none;
}

.cnc-home-tab:hover {
    background: #e6a200;
    color: #1a1a1a !important;
}

.cnc-home-tab .material-symbols-outlined {
    color: #1a1a1a;
}

/* Mobile-only elements: invisible on desktop */
.hamburger-btn {
    display: none;
}

.mobile-menu-actions {
    display: none;
}

.mobile-action-btn {
    display: none;
}

/* Mobile dropdown wrapper: transparent on desktop (children flow normally) */
.mobile-dropdown {
    display: contents;
}

.light-theme .detail-subnav {
    background: rgba(248, 250, 252, 0.95);
    border-bottom-color: rgba(226, 232, 240, 0.8);
}

/* Tab page sections — shown/hidden by switchDetailTab() */
.tab-page {
    display: none;
    width: 100%;
}

.tab-page.active-tab {
    display: block;
    width: 100%;
    /* Always tall enough to keep the scrollbar present — prevents KPI strip
       from shifting position when switching between short and tall tabs */
    min-height: calc(100vh - 64px - 52px - 4rem);
}


/* Ensure the grid inside any tab-page fills full width */
.tab-page>.detail-grid {
    width: 100%;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.header-logo {
    height: 32px;
    width: auto;
}

/* In dark mode invert, in light mode keep color */
.dark-theme .header-logo {
    filter: brightness(0) invert(1);
}

.header-brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.header-left h1 {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #06b6d4);
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 6s ease-in-out infinite;
    letter-spacing: -0.01em;
}

@keyframes shimmer {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.header-divider {
    opacity: 0.18;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.header-partner-logo {
    height: 20px;
    opacity: 0.75;
    filter: none;
}

.light-theme .header-partner-logo {
    filter: none;
}

.header-left .subtitle {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 0.1rem;
    letter-spacing: 0.01em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle,
.back-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2rem;
    padding: 0.4rem 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.82rem;
    font-family: inherit;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

/* Icon-only header buttons */
.theme-toggle.icon-btn {
    padding: 0.4rem 0.5rem;
    min-width: 36px;
    justify-content: center;
}

.theme-toggle .material-symbols-outlined {
    font-size: 1.05rem;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

.light-theme .theme-toggle,
.light-theme .back-btn {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(226, 232, 240, 0.8);
}

.theme-toggle:hover,
.back-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    color: var(--text-primary);
}


/* Detail View */
.detail-view {
    display: none;
}

.detail-view.active {
    display: block;
}

.portfolio-view.hidden {
    display: none;
}

/* Detail header — large name + badges above */
.detail-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.detail-customer-name {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-top: 0.4rem;
}

.detail-header-left {
    display: flex;
    flex-direction: column;
}

.detail-header-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.4rem;
}

.detail-inline-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1;
}

/* CNC Dashboard tab link cards */
.cnc-dash-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.cnc-dash-link:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.cnc-dash-disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.cnc-dash-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.6rem;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detail-inline-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.detail-inline-breadcrumb a:hover {
    color: var(--accent);
}

.detail-inline-sep {
    margin: 0 0.3rem;
    opacity: 0.45;
}

.detail-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.detail-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(245, 206, 127, 0.15);
    color: #2B2F3A;
    border: 1px solid rgba(245, 206, 127, 0.4);
    backdrop-filter: blur(6px);
}

.detail-badge.status {
    background: #89E185;
    color: #1a3318;
    border-color: #89E185;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.detail-badge.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: pulse 2s ease-in-out infinite;
}

.detail-badge.risk {
    background: rgba(251, 179, 0, 0.1);
    color: var(--orange);
    border-color: rgba(251, 179, 0, 0.25);
}

.detail-badge.churned {
    background: rgba(248, 113, 113, 0.1);
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.25);
}

/* Tier-specific badge colours */
.detail-badge.tier-1,
.detail-badge.tier-2 {
    background: rgba(245, 206, 127, 0.15);
    color: #2B2F3A;
    border-color: rgba(245, 206, 127, 0.4);
}

.detail-badge.tier-3 {
    background: #5ABFEC;
    color: #1a2b35;
    border-color: #5ABFEC;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.3);
    }
}

/* Detail sections — equal 2-column layout on desktop */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    align-items: start;
}

.detail-grid.two-col {
    grid-template-columns: 1fr 1fr;
}

.detail-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 0;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-glass);
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.detail-card:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.detail-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
}

.detail-card-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.detail-card-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.detail-card-icon.red-icon {
    background: rgba(248, 113, 113, 0.12);
    color: var(--red);
}

.detail-card-icon.blue-icon {
    background: rgba(90, 191, 236, 0.12);
    color: var(--accent);
}

.detail-card-icon.green-icon {
    background: rgba(137, 225, 133, 0.12);
    color: var(--green);
}

.detail-card-icon.orange-icon {
    background: rgba(251, 179, 0, 0.12);
    color: var(--orange);
}

.detail-card-icon.purple-icon {
    background: rgba(167, 213, 240, 0.12);
    color: var(--purple);
}

.detail-card-icon.accent-icon {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent);
}


.detail-card-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.detail-card-link {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
    background: rgba(90, 191, 236, 0.08);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.detail-card-link:hover {
    background: rgba(90, 191, 236, 0.16);
}

.detail-card-body {
    padding: 1.5rem;
}

/* Legacy support: detail-card h3 for cards that haven't been refactored yet */
.detail-card h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1.5rem 0;
}

.detail-card h3 a {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--accent);
    text-decoration: none;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}

.detail-card h3 a:hover {
    text-decoration: underline;
}

.detail-card.full-width {
    grid-column: 1 / -1;
}

/* ════════════════════════════════════════════
   RESPONSIVE — matching Stitch mockup breakpoints
   ════════════════════════════════════════════ */

/* Tablet (max 1024px): detail grid collapses to single col */
@media (max-width: 1024px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid.two-col {
        grid-template-columns: 1fr;
    }

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

/* Tablet/large phone (max 900px): 2-col KPI, reduced padding */
@media (max-width: 900px) {
    .container {
        padding: 1rem 1.5rem;
        padding-top: calc(1rem + 64px + 52px);
    }

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

    .charts-row {
        grid-template-columns: 1fr;
    }

    .detail-customer-name {
        font-size: 1.75rem;
    }

    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header {
        padding: 1rem 1.25rem;
        overflow-x: hidden;
    }

    .header-brand-name {
        display: none;
    }

    /* Hide less critical table columns */
    .customer-table th:nth-child(3),
    .customer-table td:nth-child(3),
    .customer-table th:nth-child(5),
    .customer-table td:nth-child(5),
    .customer-table th:nth-child(6),
    .customer-table td:nth-child(6) {
        display: none;
    }
}

/* Phone (max 600px): hamburger-based mobile navigation */
@media (max-width: 600px) {

    /* ── Hamburger button: hidden on desktop, golden pill on mobile ── */
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        flex-shrink: 0;
        border: none;
        border-radius: 999px;
        background: #F5CE7F;
        color: #2B2F3A;
        cursor: pointer;
        padding: 0;
        transition: background 0.2s, transform 0.1s;
    }

    .hamburger-btn:hover {
        background: #e8b85a;
        transform: scale(1.05);
    }

    .hamburger-btn .material-symbols-outlined {
        font-size: 1.2rem;
    }

    /* ── Main header: hide all right-side buttons (in hamburger now) ── */
    .header {
        padding: 0.85rem 1rem;
        overflow: hidden;
    }

    .header-partner-logo,
    .header-divider {
        display: none;
    }

    /* Hide header-right buttons — they're in the hamburger menu */
    .header-right .theme-toggle,
    .header-right .user-badge {
        display: none;
    }

    /* Keep Back button visible in header */
    .header-right .back-btn {
        display: inline-flex;
    }

    /* ── Subnav: single compact row ── */
    .detail-subnav {
        top: 62px;
        overflow: visible;
    }

    .detail-subnav-inner {
        flex-direction: row;
        align-items: center;
        padding: 0.5rem 1rem;
        gap: 0.75rem;
    }

    .detail-subnav-customer {
        flex: 1;
        padding: 0;
        border: none;
        gap: 0.5rem;
        min-width: 0;
    }

    .customer-nav-select {
        flex: 1;
        min-width: 0;
        max-width: 100%;
        font-size: 0.88rem;
    }

    /* ── Mobile dropdown: absolute panel below subnav ── */
    .mobile-dropdown {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        flex-direction: column;
        z-index: 89;
        background: var(--glass-bg);
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
        border-bottom: 2px solid var(--glass-border);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    }

    .light-theme .mobile-dropdown {
        background: rgba(248, 250, 252, 0.98);
    }

    .mobile-dropdown.mobile-open {
        display: flex;
    }

    /* Tabs inside dropdown: vertical list */
    .detail-tabs {
        display: flex;
        flex-direction: column;
        padding: 0.5rem;
        gap: 0;
        border-bottom: 1px solid var(--border);
    }

    .detail-tab {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
        text-align: left;
        justify-content: flex-start;
        width: 100%;
        border-radius: 0.5rem;
        border-bottom: 1px solid var(--border);
        white-space: nowrap;
    }

    .detail-tab:last-child {
        border-bottom: none;
    }

    /* Active tab in mobile dropdown: solid golden background like CNC Dashboard button */
    .detail-tab.active {
        background: #F5CE7F;
        color: #2B2F3A;
        border-bottom-color: rgba(0, 0, 0, 0.08);
        font-weight: 700;
    }

    .detail-tab.active .material-symbols-outlined {
        color: #2B2F3A;
    }

    /* CNC Dashboard home button: plain on mobile (no yellow pill) */
    .cnc-home-tab {
        background: transparent;
        color: var(--text-primary) !important;
        border-radius: 0.5rem;
        margin: 0;
        padding: 0.8rem 1rem;
        border-bottom: 1px solid var(--border);
    }

    .cnc-home-tab:hover {
        background: var(--bg-secondary);
        color: var(--text-primary) !important;
    }

    .cnc-home-tab .material-symbols-outlined {
        color: var(--text-primary);
    }

    .detail-tab .material-symbols-outlined {
        display: inline-flex;
        font-size: 1.1rem;
    }

    /* ── Actions section ── */
    .mobile-menu-actions {
        display: flex;
        flex-direction: column;
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .mobile-menu-user {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-muted);
        border-bottom: 1px solid var(--border);
        margin-bottom: 0.25rem;
    }

    .mobile-action-btn {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        font-family: inherit;
        border: none;
        border-radius: 0.5rem;
        background: transparent;
        color: var(--text-primary);
        cursor: pointer;
        text-align: left;
        width: 100%;
        transition: background 0.15s;
    }

    .mobile-action-btn:hover {
        background: var(--bg-secondary);
    }

    .mobile-action-btn.danger {
        color: var(--red);
    }

    .mobile-action-btn .material-symbols-outlined {
        font-size: 1.2rem;
        opacity: 0.7;
    }

    /* ── Container offset ── */
    .container {
        padding: 0.75rem 1rem;
        padding-top: 130px;
    }

    /* Force single-column: auto-fit minmax(220px) still fits 2 cols at ~440px */
    .kpi-grid,
    .detail-kpi-grid {
        grid-template-columns: 1fr !important;
    }

    /* Hide top KPI cards on mobile except on the overview tab */
    #detailKpis {
        display: none;
    }

    #detailView[data-tab="overview"] #detailKpis,
    #detailView:not([data-tab]) #detailKpis {
        display: grid;
    }

    /* Reorder detail view on mobile: header first, KPIs second, content third */
    .detail-view.active {
        display: flex;
        flex-direction: column;
    }

    #detailKpis {
        order: 2;
    }

    #detailHeader {
        order: 1;
    }

    #detailGrid {
        order: 3;
    }

    /* Period buttons: wrap so they don't bleed outside the card */
    .kpi-card .period-toggle,
    [class*="period"] {
        flex-wrap: wrap;
    }

    .period-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .detail-customer-name {
        font-size: 1.4rem;
    }

    .customer-table th:nth-child(4),
    .customer-table td:nth-child(4),
    .customer-table th:nth-child(7),
    .customer-table td:nth-child(7) {
        display: none;
    }

    .scan-scores {
        flex-direction: column;
    }

    .scan-gauges-col,
    .scan-breakdown-col {
        flex: 1 1 100%;
        width: 100%;
        min-width: unset;
        padding-right: 0;
        align-items: flex-start;
    }

    /* ── Jira support: fully responsive on mobile ── */
    /* Hide column header row */
    .jira-ticket-header {
        display: none !important;
    }

    /* Remove height cap that was forcing a scrollable inner box */
    .jira-tickets-list {
        max-height: none !important;
        overflow: visible !important;
    }

    /* 3-column layout: key | summary | status */
    .jira-ticket {
        grid-template-columns: auto 1fr auto !important;
        gap: 0.4rem 0.75rem;
        padding: 0.75rem 1.5rem;
    }

    .jira-summary {
        padding: 0 0.5rem;
    }

    /* Hide reporter, assignee, date by class (reliable on all devices) */
    .jira-person,
    .jira-date {
        display: none !important;
    }

    /* Truncate long summaries */
    .jira-ticket-summary {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.82rem;
    }

    .jira-key {
        font-size: 0.75rem;
        white-space: nowrap;
    }

    /* Status + count pills wrap */
    .jira-summary {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
}

/* Very small phone (max 400px) */
@media (max-width: 400px) {
    .kpi-card {
        padding: 1rem;
    }

    .kpi-icon-box {
        width: 40px;
        height: 40px;
    }

    .kpi-value {
        font-size: 1.4rem;
    }
}