/* ==========================================================================
   1. CONFIGURAÇÃO GLOBAL E VARIÁVEIS
   ========================================================================== */
:root {
    --bg: #0b0d10;
    --surface: rgba(255, 255, 255, 0.04);
    --card-border: rgba(255, 255, 255, 0.12);
    --text: #e6e6e6;
    --muted: #9aa0a6;
    --brand: #7aa2ff;
    --brand-strong: #5a86ff;
    --inner-card-bg: #10141c;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    --shadow: 0 10px 35px rgba(0, 0, 0, .5);
    --radius: 18px;
    --blur: 16px;
    --transition: 260ms cubic-bezier(.2, .8, .2, 1);
    --z-base: 0;
    --z-fg: 1;
    --z-overlay: 10;
    --z-sticky: 20;
    --z-modal: 30;
    --z-max: 999;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;
    --font-xs: 12px;
    --font-sm: 13px;
    --font-md: 14px;
    --font-lg: 16px;
    --font-xl: 18px;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 14px;
    --bp-lg: 1200px;
    --bp-md: 900px;
    --bp-sm: 600px;
}

/* ==========================================================================
   2. ESTILOS DE BASE (MOBILE-FIRST)
   ========================================================================== */
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    min-height: 100dvh;
    overflow: hidden;
}

.glow {
    position: fixed;
    inset: -20% -20% auto auto;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(closest-side at 40% 40%, rgba(94, 129, 255, .12), rgba(0, 0, 0, 0));
    filter: blur(40px);
    pointer-events: none;
    z-index: 0;
}

/* ==========================================================================
   3. LAYOUT PRINCIPAL (MOBILE-FIRST)
   ========================================================================== */
.app {
    position: relative;
    z-index: var(--z-fg);
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    gap: 8px;
    height: 100dvh;
    padding: 8px 8px 16px;
    opacity: 1;
    transition: opacity 400ms ease-in-out, filter 300ms ease, transform 300ms ease;
}

body.is-loading .app,
body.is-loading .desktop-app {
    opacity: 0;
}

.app.sidebar-open {
    filter: blur(5px);
    transform: scale(0.98);
}

.top.panel {
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    min-height: 54px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 95vw;
    margin: 0 auto;
}

.top-left,
.top-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Widget de cronômetro centralizado no header */
.header-timer-center {
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    margin: 0 auto;
}

/* Em telas maiores, centralizar absolutamente */
@media (min-width: 420px) {
    .header-timer-center {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin: 0;
    }
}

.header-timer-center:hover {
    transform: scale(1.1);
    background: rgba(94, 129, 255, 0.25);
}

@media (min-width: 420px) {
    .header-timer-center:hover {
        transform: translateX(-50%) scale(1.1);
    }
}

.header-timer-center i {
    font-size: 20px;
    color: var(--text-muted);
}

.header-timer-center.active {
    background: rgba(52, 199, 89, 0.25);
    animation: pulse-timer 2s infinite;
}

.header-timer-center.active i {
    color: #34c759;
}

@keyframes pulse-timer {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ==========================================================================
   4. SIDEBAR (MOBILE-FIRST)
   ========================================================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 260px;
    background: #10141c;
    z-index: var(--z-modal);
    transition: transform 300ms ease-in-out;
    transform: translateX(-100%);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar .sidebar-header {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--card-border);
}

.sidebar .sidebar-logo {
    height: 80px;
}

.sidebar .nav-links {
    list-style: none;
    padding: 20px 10px;
    margin: 0;
    flex-grow: 1;
}

.sidebar .nav-links li a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text);
    transition: background-color 200ms ease, color 200ms ease;
    position: relative;
}

.sidebar .nav-links li a:hover {
    background-color: var(--surface);
}

.sidebar .nav-links li a.active {
    background-color: var(--brand-strong);
    color: #fff;
}

.sidebar .nav-links li a.active .bx,
.sidebar .nav-links li a.active .link-name {
    color: #fff;
}

.sidebar .nav-links li a .bx {
    font-size: 22px;
    margin-right: 20px;
    color: var(--muted);
    transition: color 200ms ease;
}

.sidebar .sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--card-border);
}

.sidebar .sidebar-footer .logout {
    font-family: var(--font-sans);
    font-size: var(--font-md);
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar .sidebar-footer .logout:hover {
    border-color: rgba(255, 69, 58, .6);
    background-color: rgba(255, 69, 58, .1);
}

.sidebar .sidebar-footer .logout .bx {
    margin-left: 10px;
    font-size: 20px;
}

/* ==========================================================================
   5. CONTEÚDO PRINCIPAL (MOBILE-FIRST)
   ========================================================================== */
.main-card {
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    height: calc(100dvh - 78px);
    width: 95vw;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    margin-bottom: 16px;
}

.inner-card {
    background: var(--inner-card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.main-card .inner-card:first-child {
    height: 60%;
}

.main-card .inner-card:last-child {
    height: 40%;
}

.card-title {
    text-align: center;
    font-size: var(--font-md);
    font-weight: 600;
    margin: -6px 0;
    flex-shrink: 0;
}

.card-content {
    border-radius: 10px;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 0;
}

/* --- Chamados --- */
.chamados-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chamado-item {
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-bottom: var(--space-2);
    display: grid;
    gap: 4px;
}

.chamado-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 2px;
}

.chamado-label {
    font-size: var(--font-xs);
    color: var(--muted);
    margin-bottom: 2px;
}

.chamado-id-link {
    font-size: var(--font-sm);
    color: var(--brand);
    text-decoration: none;
    display: block;
}

.chamado-id-link:hover {
    text-decoration: underline;
}

.chamado-value {
    font-size: var(--font-sm);
}

.chamado-progress {
    display: grid;
    gap: 4px;
    font-size: var(--font-sm);
}

.progress-bar {
    background: var(--surface);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    flex-grow: 1;
}

.progress {
    background: var(--brand);
    height: 100%;
}

/* --- Projetos --- */
.projects-list {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: 15px;
    overscroll-behavior-x: contain;
}

.project-item {
    flex: 0 0 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    padding: 0 5px;
}

.project-card-refined {
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 10px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
}

.project-header-refined {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.project-name-refined {
    font-size: var(--font-md);
    font-weight: 700;
}

.project-pct-refined {
    font-size: var(--font-sm);
    font-weight: 700;
    background-color: transparent;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    min-width: 50px;
    padding: 8px 4px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.project-body-refined {
    margin-bottom: 6px;
}

.project-description-refined {
    font-size: var(--font-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    max-height: calc(var(--font-sm) * 1.4 * 2);
    min-height: calc(var(--font-sm) * 1.4 * 2);
}

.project-footer-refined {
    font-size: var(--font-sm);
}

.project-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px var(--space-2);
    margin-bottom: 6px;
}

.project-details-grid .detail-label {
    font-weight: 600;
    color: var(--muted);
}

.project-details-grid .detail-value {
    font-weight: 400;
    color: var(--text);
}

/* --- Ticket Details Mobile --- */
.ticket-details-mobile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.ticket-details-main-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ticket-id {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--brand);
}

.prazo-pct {
    font-size: var(--font-sm);
    font-weight: 700;
    background: var(--surface);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-border);
}

.details-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: var(--font-xs);
    color: var(--muted);
}

.detail-value {
    font-size: var(--font-sm);
    color: var(--text);
}

.details-tabs {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 4px;
    /* Reduzido de 8px */
}

.tab-link {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: var(--font-sm);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.tab-link:hover {
    color: var(--text);
    background: var(--surface);
}

.tab-link.active {
    background: var(--surface);
    color: var(--brand);
    font-weight: 600;
}


.tab-content {
    flex-grow: 1;
    overflow: hidden;
    /* Remove scroll externo daqui */
    display: flex;
    flex-direction: column;
    padding-top: 4px;
    /* Reduzido de 12px */
}

.content-wrapper {
    font-size: var(--font-sm);
    line-height: 1.5;
    color: var(--text);
    padding: 12px;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    margin-top: 0;
    /* Removido margin top */
    background: transparent;

    /* Configuração de Rolagem Interna */
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
    /* Importante para flexbox scroll */

    /* Scrollbar Discreta (Firefox) */
    scrollbar-width: thin;
    scrollbar-color: var(--card-border) transparent;
}

/* Scrollbar Discreta (Webkit) */
.content-wrapper::-webkit-scrollbar {
    width: 4px;
}

.content-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.content-wrapper::-webkit-scrollbar-thumb {
    background-color: var(--card-border);
    border-radius: 4px;
}

.content-wrapper p {
    margin-bottom: 8px;
}

.content-wrapper strong {
    font-weight: 700;
    color: var(--text);
    /* Garante que o título tenha a mesma cor */
    display: block;
    /* Garante que quebre linha se estiver solto */
    margin-bottom: 4px;
}

/* ==========================================================================
   Desktop Layout
   ========================================================================== */

.mobile-app {
    display: block;
}

.desktop-app {
    display: none;
}

@media (min-width: 901px) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* Desktop: mantém espaçamento original dos cards de projetos */
    .project-card-refined {
        justify-content: space-between;
        gap: 0;
    }

    .project-body-refined {
        margin-bottom: 12px;
    }

    .project-details-grid {
        gap: 2px var(--space-3);
        margin-bottom: 10px;
    }

    .mobile-app {
        display: none;
    }

    .desktop-app {
        display: grid;
        width: min(98vw, 1600px);
        height: min(95dvh, 920px);
        border-radius: 20px;
        padding: 12px;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
        border: 1px solid var(--card-border);
        box-shadow: var(--shadow);
        backdrop-filter: blur(var(--blur));
        grid-template-columns: 260px 1fr;
        grid-template-rows: 1fr;
        gap: 12px;
        opacity: 1;
        transition: opacity 400ms ease-in-out;
    }

    .desktop-sidebar {
        padding: 14px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        background: var(--surface);
        border: 1px solid var(--card-border);
        border-radius: 14px;
    }

    .desktop-sidebar-header {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 10px;
    }

    .desktop-sidebar-logo {
        height: 100px;
    }

    .desktop-nav {
        display: grid;
        gap: 8px;
    }

    .desktop-nav-link {
        text-align: left;
        background: transparent;
        border: 1px solid transparent;
        padding: 12px 15px;
        border-radius: 12px;
        color: var(--muted);
        cursor: pointer;
        transition: all 0.2s ease-in-out;
        font-family: var(--font-sans);
        font-size: 15px;
        font-weight: 500;
        display: flex;
        align-items: center;
        gap: 12px;
        text-decoration: none;
        position: relative;
    }

    .desktop-nav-link:hover {
        background: var(--surface);
        color: var(--text);
        border-color: var(--card-border);
    }

    .desktop-nav-link.active {
        background: var(--brand);
        color: #fff;
        font-weight: 600;
        border-color: var(--brand);
    }

    .desktop-nav-link.active i {
        color: #fff;
    }

    .desktop-sidebar-footer {
        padding: 0;
        border-top: none;
        margin-top: auto;
    }

    .desktop-sidebar-footer .logout {
        font-family: var(--font-sans);
        font-size: var(--font-sm);
        background: var(--surface);
        border: 1px solid var(--card-border);
        color: var(--muted);
        padding: 10px 15px;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.2s ease;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .desktop-sidebar-footer .logout:hover {
        border-color: rgba(255, 69, 58, .6);
        background-color: rgba(255, 69, 58, .1);
        color: rgba(255, 109, 98, 1);
    }

    .desktop-main {
        display: grid;
        grid-template-rows: 64px 1fr;
        gap: 12px;
        overflow: hidden;
        height: 100%;
        min-height: 0;
    }

    .desktop-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: var(--surface);
        border: 1px solid var(--card-border);
        border-radius: 10px;
        padding: 0 12px;
    }

    .desktop-header-left,
    .desktop-header-right {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    .desktop-content-grid {
        display: grid;
        gap: 12px;
        grid-template-columns: repeat(12, 1fr);
        grid-template-rows: 1fr 1fr;
        min-height: 0;
    }

    .desktop-card {
        background: #10141c;
        border: 1px solid var(--card-border);
        border-radius: 14px;
        padding: 14px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        overflow: hidden;
    }

    .desktop-card-title {
        font-size: 14px;
        color: var(--muted);
        font-weight: 600;
        letter-spacing: .3px;
        margin: 0;
    }

    .desktop-card-chamados {
        grid-column: span 6;
        grid-row: 1;
    }

    .desktop-card-graphics {
        grid-column: span 6;
        grid-row: 1;
        padding: 0;
    }

    .graphics-card-content {
        display: flex;
        height: 100%;
        width: 100%;
    }

    .graphics-subplot {
        flex-basis: 60%;
        padding: 14px;
        display: grid;
        /* Use Grid for more control */
        grid-template-rows: auto 1fr;
        /* Title row, and content row that fills space */
        gap: 12px;
        min-width: 0;
        /* Prevent flex item from overflowing */
    }

    .ticket-description-subplot {
        flex-basis: 40%;
        padding: 14px;
        display: flex;
        flex-direction: column;
    }

    .divider {
        width: 1px;
        background-color: var(--card-border);
        margin: 14px 0;
    }

    .subplot-title {
        font-size: var(--font-md);
        font-weight: 600;
        color: var(--text);
        /* No margin needed with grid gap */
    }

    .chart-container {
        width: 100%;
        height: 100%;
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: 1fr auto;
        gap: 4px 8px;
        min-height: 0;
        /* Critical for nested grids/flex */
    }

    .description-content {
        flex-grow: 1;
        overflow-y: auto;
        font-size: var(--font-sm);
        line-height: 1.6;
    }

    .description-content .placeholder-text {
        color: var(--muted);
        font-size: var(--font-sm);
        text-align: center;
        margin-top: 20px;
    }

    .description-content h4 {
        font-size: var(--font-lg);
        color: var(--brand);
        margin-bottom: 12px;
    }

    .description-content p {
        margin-bottom: 8px;
    }

    .description-content strong {
        color: var(--muted);
        font-weight: 500;
    }

    .description-content hr {
        border: none;
        border-top: 1px solid var(--card-border);
        margin: 12px 0;
    }

    .chart-wrapper {
        grid-column: 2;
        grid-row: 1;
        position: relative;
        /* New context for the SVG */
        overflow: hidden;
        /* Clip the SVG */
        border-left: 1px solid var(--card-border);
        border-bottom: 1px solid var(--card-border);
    }

    .chart-wrapper svg {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    .y-axis-labels {
        grid-column: 1;
        grid-row: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        font-size: 10px;
        color: var(--muted);
        text-align: right;
        padding-bottom: 10px;
        /* Align with bottom of chart */
    }

    .x-axis-labels {
        grid-column: 2;
        grid-row: 2;
        display: flex;
        justify-content: space-between;
        font-size: 10px;
        color: var(--muted);
    }

    .y-axis-title {
        grid-column: 1;
        grid-row: 1;
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        text-align: center;
        font-size: 10px;
        color: var(--muted);
        display: flex;
        align-items: center;
        justify-content: flex-end;
        /* Align to the bottom of the chart */
        gap: 4px;
        padding-right: 4px;
    }

    .y-axis-title .arrow {
        font-size: 12px;
    }

    .desktop-tickets-table tbody tr.active {
        background-color: rgba(122, 162, 255, .15);
    }

    .desktop-card-projetos {
        grid-column: span 12;
        grid-row: 2;
    }

    /* --- Desktop Content --- */
    .desktop-card .desktop-card-content {
        overflow-y: auto;
        flex-grow: 1;
        min-height: 0;
    }

    /* --- Chamados Card Scrollbar (JS-controlled) --- */
    .desktop-card-chamados .desktop-card-content {
        scrollbar-width: thin;
        scrollbar-color: transparent transparent;
        /* Hidden by default */
    }

    .desktop-card-chamados .desktop-card-content.is-scrolling {
        scrollbar-color: var(--muted) transparent;
        /* Visible when scrolling */
    }

    .desktop-card-chamados .desktop-card-content::-webkit-scrollbar {
        width: 5px;
    }

    .desktop-card-chamados .desktop-card-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .desktop-card-chamados .desktop-card-content::-webkit-scrollbar-thumb {
        background-color: transparent;
        /* Hidden by default */
        border-radius: 3px;
    }

    .desktop-card-chamados .desktop-card-content.is-scrolling::-webkit-scrollbar-thumb {
        background-color: var(--muted);
        /* Visible when scrolling */
    }

    /* --- Disable vertical scroll on Projetos card --- */
    .desktop-card-projetos .desktop-card-content {
        overflow-y: hidden;
    }

    .desktop-tickets-table {
        width: 100%;
        border-collapse: collapse;
        font-size: var(--font-xs);
        table-layout: fixed;
    }

    .desktop-tickets-table th,
    .desktop-tickets-table td {
        padding: 8px;
        text-align: left;
        border-bottom: 1px solid var(--card-border);
        vertical-align: middle;
        overflow: hidden;
    }

    .ponto-encontro-cell {
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .desktop-tickets-table th {
        font-weight: 600;
        color: var(--muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .5px;
        position: sticky;
        top: 0;
        background: #10141c;
        white-space: nowrap;
    }

    /* Column Widths */
    .desktop-tickets-table .col-id {
        width: 12%;
    }

    .desktop-tickets-table .col-data {
        width: 12%;
    }

    .desktop-tickets-table .col-ponto {
        width: 18%;
    }

    .desktop-tickets-table .col-dupla {
        width: 13%;
    }

    .desktop-tickets-table .col-conclusao {
        width: 22.5%;
    }

    .desktop-tickets-table .col-prazo {
        width: 22.5%;
    }

    /* Responsive Column Headers */
    .desktop-tickets-table th span::before {
        content: attr(data-full);
    }

    .desktop-tickets-table th span {
        font-size: 0;
    }

    .desktop-tickets-table th span::before {
        font-size: 11px;
    }
}

/* Responsive Column Header Names - Abbreviated on smaller screens */
@media (min-width: 901px) and (max-width: 1200px) {
    .desktop-tickets-table th span::before {
        content: attr(data-short);
    }
}

@media (min-width: 901px) {
    .desktop-tickets-table tbody tr:hover {
        background-color: var(--surface);
    }

    .progress-bar-container {
        display: flex;
        align-items: center;
        gap: 4px;
        min-width: 100px;
    }

    .progress-bar-container span {
        flex-shrink: 0;
    }

    .desktop-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-shrink: 0;
    }

    .carousel-controls {
        display: flex;
        gap: 4px;
    }

    .arrow-btn {
        background: var(--surface);
        border: 1px solid var(--card-border);
        color: var(--muted);
        width: 28px;
        height: 28px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .arrow-btn:hover {
        background: var(--brand);
        color: #fff;
        border-color: var(--brand);
    }

    .arrow-btn .bx {
        font-size: 22px;
    }

    .desktop-projects-container {
        display: flex;
        gap: 12px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        padding-bottom: 12px;
    }

    .desktop-project-item {
        flex: 0 0 300px;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        height: 200px;
    }

    .desktop-project-item.project-card-refined {
        display: flex;
        flex-direction: column;
        height: 200px;
        overflow: hidden;
    }

    /* --- Projetos Card Scrollbar (Always Visible) --- */
    .desktop-projects-container {
        scrollbar-width: thin;
        scrollbar-color: var(--muted) var(--surface);
    }

    .desktop-projects-container::-webkit-scrollbar {
        height: 6px;
    }

    .desktop-projects-container::-webkit-scrollbar-track {
        background: var(--surface);
        border-radius: 3px;
    }

    .desktop-projects-container::-webkit-scrollbar-thumb {
        background-color: var(--muted);
        border-radius: 3px;
    }

    /* --- Chamados View Layout --- */
    .chamados-view {
        display: none;
        gap: 8px;
        grid-template-columns: repeat(12, 1fr);
        grid-template-rows: 2.8fr 7.2fr;
        /* ~28/72 split */
        min-height: 0;
        height: 100%;
    }

    body.chamados-view-active .chamados-view {
        display: grid;
    }

    body.chamados-view-active .desktop-content-grid {
        display: none;
    }

    .desktop-card-chamados-full {
        grid-column: span 12;
        grid-row: 1;
        min-height: 0;
        overflow: hidden;
    }

    .desktop-card-details {
        grid-column: span 12;
        grid-row: 2;
        min-height: 0;
        display: flex;
        flex-direction: column;
        height: 100%;
        /* Force height to match grid row */
    }

    .desktop-card-details .desktop-card-content {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
        /* Ensure internal scroll works */
    }

    /* --- Projects View Layout (Mirrored) --- */
    .projetos-view {
        display: none;
        gap: 7px;
        grid-template-columns: repeat(12, 1fr);
        grid-template-rows: 2.9fr 7.1fr;
        /* ~30/70 split - same as chamados */
        min-height: 0;
        height: 100%;
    }

    body.projetos-view-active .projetos-view {
        display: grid;
    }

    body.projetos-view-active .desktop-content-grid {
        display: none;
    }

    .desktop-card-projetos-full {
        grid-column: span 12;
        grid-row: 1;
        min-height: 0;
        overflow: hidden;
    }

    .desktop-card-projetos-details {
        grid-column: span 12;
        grid-row: 2;
        min-height: 0;
        display: flex;
        flex-direction: column;
        height: 100%;
        /* Force height */
    }

    .desktop-card-projetos-details .desktop-card-content {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    /* --- Desktop Project Details (Vertical Tabs) --- */
    .project-details-desktop {
        display: flex;
        flex-direction: column;
        gap: 16px;
        height: 100%;
    }

    /* --- Desktop Ticket Details (Vertical Tabs) --- */
    .ticket-details-desktop {
        display: flex;
        flex-direction: column;
        gap: 16px;
        height: 100%;
    }

    .details-header-desktop {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--card-border);
    }

    .header-left {
        display: flex;
        align-items: baseline;
        gap: 12px;
    }

    .ticket-meetpoint {
        font-size: var(--font-sm);
        color: var(--muted);
    }

    .header-right {
        display: flex;
        gap: 24px;
    }

    .progress-indicator {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: var(--font-xs);
    }

    .progress-label {
        color: var(--muted);
        min-width: 60px;
    }

    .progress-bar-desktop {
        width: 80px;
        height: 6px;
        background: var(--surface);
        border-radius: 4px;
        overflow: hidden;
    }

    .progress-value {
        font-weight: 600;
        min-width: 40px;
        text-align: right;
    }

    .details-info-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 16px 32px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--card-border);
    }

    .info-item {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .info-label {
        font-size: var(--font-xs);
        color: var(--muted);
    }

    .info-value {
        font-size: var(--font-sm);
        color: var(--text);
    }

    .details-body-desktop {
        display: flex;
        gap: 16px;
        flex-grow: 1;
        min-height: 0;
    }

    .details-tabs-vertical {
        display: flex;
        flex-direction: column;
        gap: 4px;
        flex-shrink: 0;
        width: 130px;
        /* Fixed width to prevent shifting */
        padding-right: 16px;
        border-right: 1px solid var(--card-border);
        overflow-y: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .details-tabs-vertical::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari and Opera */
    }

    .tab-link-vertical {
        background: transparent;
        border: none;
        border-left: 3px solid transparent;
        /* Reserve space for active border */
        color: var(--muted);
        font-size: var(--font-sm);
        padding: 10px 14px;
        border-radius: var(--radius-sm);
        cursor: pointer;
        text-align: left;
        transition: all 0.2s ease;
        white-space: nowrap;
        /* Prevent text wrapping */
    }

    .tab-link-vertical:hover {
        color: var(--text);
        background: var(--surface);
    }

    .tab-link-vertical.active {
        background: var(--surface);
        color: var(--brand);
        font-weight: 600;
        border-left: 3px solid var(--brand);
    }

    .tab-content-desktop {
        flex-grow: 1;
        overflow-y: auto;
        min-height: 0;
    }

    .content-wrapper-desktop {
        font-size: var(--font-sm);
        line-height: 1.6;
        color: var(--text);
    }

    .content-wrapper-desktop strong {
        color: var(--muted);
        font-weight: 500;
    }

    .content-wrapper-desktop p {
        margin-bottom: 8px;
    }

    /* --- Status Pills --- */
    .status-pill {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 999px;
        font-size: 10px;
        font-weight: 500;
        text-transform: capitalize;
        border: 1px solid transparent;
        white-space: nowrap;
    }

    /* 1: Aguardando materiais (Yellow/Warning) */
    .status-1 {
        background-color: rgba(255, 193, 7, 0.15);
        color: #ffc107;
        border-color: rgba(255, 193, 7, 0.3);
    }

    /* 2: Iniciando (Blue/Info) */
    .status-2 {
        background-color: rgba(23, 162, 184, 0.15);
        color: #17a2b8;
        border-color: rgba(23, 162, 184, 0.3);
    }

    /* 3: Em andamento (Royal Blue/Primary) */
    .status-3 {
        background-color: rgba(0, 123, 255, 0.15);
        color: #5a86ff;
        border-color: rgba(0, 123, 255, 0.3);
    }

    /* 4: Concluindo (Green/Success) */
    .status-4 {
        background-color: rgba(40, 167, 69, 0.15);
        color: #28a745;
        border-color: rgba(40, 167, 69, 0.3);
    }
}

/* ============================= */
/* ANOTAÇÕES TAB                 */
/* ============================= */

.anotacoes-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    padding: 0.5rem;
}

.anotacoes-header-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.btn-new-anotacao {
    background: var(--brand);
    border: none;
    color: #fff;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(122, 162, 255, 0.3);
}

.btn-new-anotacao:hover {
    background: var(--brand-strong);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(122, 162, 255, 0.4);
}

.btn-new-anotacao i {
    font-size: 1.1rem;
}

.anotacoes-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    margin-bottom: 0.5rem;
}

.anotacoes-form textarea {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 0.75rem;
    border-radius: 6px;
    resize: none;
    font-size: 0.9rem;
    width: 100%;
    font-family: inherit;
    min-height: 60px;
}

.anotacoes-form textarea:focus {
    outline: none;
    border-color: var(--brand);
}

.anotacoes-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-count {
    font-size: 0.8rem;
    color: var(--muted);
}

.btn-add-anotacao,
.btn-cancel-anotacao {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    border: none;
    transition: all 0.2s;
}

.btn-add-anotacao {
    background: var(--brand);
    color: #fff;
}

.btn-add-anotacao:hover {
    background: var(--brand-strong);
}

.btn-cancel-anotacao {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--card-border);
}

.btn-cancel-anotacao:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.anotacoes-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    overflow-y: auto;
    flex-grow: 1;
    max-height: 50vh;
    padding-right: 0.25rem;
}

.anotacao-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem;
    border-left: 3px solid var(--brand);
}

.anotacao-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    min-height: 28px;
    gap: 0.5rem;
}

.anotacao-author {
    color: var(--brand);
    font-weight: 600;
    font-size: 0.9rem;
}

.anotacao-text {
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}

.anotacao-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.anotacao-date {
    font-size: 0.75rem;
    color: var(--muted);
    font-style: italic;
}

.anotacao-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.btn-edit-anotacao,
.btn-delete-anotacao {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--muted);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-edit-anotacao:hover {
    background: var(--brand);
    color: #fff;
}

.btn-delete-anotacao:hover {
    background: #ff4d4d;
    color: #fff;
}

.no-anotacoes {
    text-align: center;
    color: var(--muted);
    font-style: italic;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.loading-text,
.loading-container {
    text-align: center;
    color: var(--muted);
    padding: 1.5rem;
    width: 100%;
}

.loading-container i,
.loading-text i {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

/* Mobile Responsiveness for Anotações */
@media (max-width: 768px) {
    .anotacoes-container {
        padding: 0;
        position: relative;
    }

    .anotacoes-header-actions {
        position: absolute;
        top: -2px;
        right: 0;
        z-index: 10;
        margin: 0;
    }

    .btn-new-anotacao {
        width: 28px;
        height: 28px;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
        justify-content: center;
        box-shadow: none;
    }

    .btn-new-anotacao i {
        font-size: 1rem;
        margin: 0;
    }

    .anotacoes-form {
        padding: 0.75rem;
    }

    .anotacoes-list {
        max-height: 40vh;
    }

    .anotacao-item {
        padding: 0.75rem;
    }

    .anotacao-header {
        flex-wrap: wrap;
    }

    .anotacao-author {
        font-size: 0.85rem;
    }

    .anotacao-text {
        font-size: 0.85rem;
    }

    .anotacao-footer {
        margin-top: 0.5rem;
    }
}

/* ==========================================================================
   MOBILE/TABLET LANDSCAPE - Hide Graphics Card Completely
   ========================================================================== */
@media (max-width: 1024px) and (orientation: landscape) {
    .desktop-card-graphics {
        display: none !important;
    }

    .desktop-card-chamados {
        grid-column: span 12;
    }
}

/* ==========================================================================
   MODAL: NENHUMA ATIVIDADE ATIVA
   ========================================================================== */
.no-activity-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.no-activity-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.no-activity-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.no-activity-modal {
    background: #1a1d28;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    max-width: 320px;
    animation: modal-in 0.2s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.no-activity-modal i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.no-activity-modal h3 {
    margin: 0 0 12px;
    color: var(--text);
    font-size: 18px;
}

.no-activity-modal p {
    margin: 0 0 24px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
}

.no-activity-close-btn {
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.no-activity-close-btn:hover {
    background: var(--brand-strong);
}

@keyframes modal-in {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}