/* =====================================================================
   CENTRAL DE DESPACHO — Estilos
   ===================================================================== */

/* =====================================================
   CARD BASE
   ===================================================== */
.os-card {
    position: relative;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    overflow: visible !important;   /* permite dropdown sair do card */
}

.os-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
    transform: translateY(-2px);
}

/* Barra lateral colorida com mais presença no hover */
.os-card > div:first-child {
    transition: width 0.2s ease;
}

.os-card:hover > div:first-child {
    width: 6px !important;
}

/* Card com dropdown aberto sobe acima dos outros */
.os-card:has(.dropdown-menu.show) {
    z-index: 100 !important;
}

/* Modo grade — mantém hover */
.os-card-grid {
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

/* =====================================================
   LISTA — respiro lateral e espaçamento entre cards
   ===================================================== */
#osCardsList {
    padding-left: 20px !important;
    padding-right: 20px !important;
    padding-top: 16px !important;
    padding-bottom: 16px !important;
}

#osCardsList .os-card {
    margin-bottom: 14px !important;
}

/* =====================================================
   GRID DE COLUNAS DO CARD (simetria fixa)
   ===================================================== */
.os-card-row {
    display: grid;
    grid-template-columns: 
        minmax(0, 1fr)    /* Coluna 1: Cliente */
        180px             /* Coluna 2: Técnico */
        140px             /* Coluna 3: SLA */
        110px             /* Coluna 4: Badge Esquecida */
        110px;            /* Coluna 5: Ações */
    align-items: center;
    gap: 20px;
    padding: 20px 24px 20px 28px;
    min-height: 84px;
}

/* Cada coluna */
.os-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}


.os-col-badge,
.os-col-actions {
    align-items: center;
}

.os-col-actions {
    align-items: flex-end;
}

/* Label uppercase das colunas */
.os-col-label {
    font-size: 0.6rem;
    letter-spacing: 1.2px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 8px;
    white-space: nowrap;
    line-height: 1;
}

/* =====================================================
   COLUNA 1 — Cliente / Serviço / Endereço
   ===================================================== */
.os-client-name {
    font-size: 1.05rem;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.os-card-meta {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 4px;
    line-height: 1.2;
}

.os-card-type {
    color: #64748b;
}

.os-card-dot {
    margin: 0 6px;
    color: #cbd5e1;
}

.os-card-id {
    color: #0ea5e9;
    font-weight: 800;
}

.os-card-address {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* =====================================================
   COLUNA 2 — Técnico (avatar + nome + status)
   ===================================================== */
.os-tech-block {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.os-tech-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 900;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
    overflow: hidden;
}

/* Avatar com foto */
.os-tech-avatar-photo {
    padding: 0;
    background: #f1f5f9;
}

.os-tech-avatar-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.os-tech-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.os-tech-name {
    font-weight: 800;
    font-size: 0.85rem;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.os-tech-status {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

/* =====================================================
   DROPDOWN DE AÇÕES
   ===================================================== */
.os-actions-dropdown {
    position: relative;
}

.os-actions-dropdown .dropdown-toggle {
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.75rem;
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    transition: all 0.2s;
    letter-spacing: 0.3px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.os-actions-dropdown .dropdown-toggle:hover,
.os-actions-dropdown .dropdown-toggle[aria-expanded="true"] {
    background: #1b1e24;
    color: white;
    border-color: #1b1e24;
}

.os-actions-dropdown .dropdown-toggle::after {
    margin-left: 4px;
}

/* Menu do dropdown — Z-INDEX ALTO pra ficar acima dos cards */
.os-actions-dropdown .dropdown-menu {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.18);
    padding: 6px;
    min-width: 220px;
    font-size: 0.85rem;
    z-index: 9999 !important;
    animation: dropdownFade 0.15s ease;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.os-actions-dropdown .dropdown-item {
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s;
    cursor: pointer;
    color: #334155;
    text-decoration: none;
}

.os-actions-dropdown .dropdown-item:hover {
    background: #f1f5f9;
}

.os-actions-dropdown .dropdown-item.danger {
    color: #dc2626;
}

.os-actions-dropdown .dropdown-item.danger:hover {
    background: #fef2f2;
}

.os-actions-dropdown .dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
}

.os-actions-dropdown .dropdown-divider {
    margin: 4px 0;
    opacity: 0.1;
}

/* =====================================================
   RESPONSIVO
   ===================================================== */
@media (max-width: 1200px) {
    .os-card-row {
        grid-template-columns: minmax(0, 1fr) 160px 130px 100px 100px;
        gap: 14px;
        padding: 16px 16px 16px 20px;
    }
}

@media (max-width: 992px) {
    .os-card-row {
        grid-template-columns: minmax(0, 1fr) 1fr;
        grid-template-areas:
            "main tech"
            "sla  badge"
            "actions actions";
        gap: 16px;
    }
    .os-col-main { grid-area: main; }
    .os-col-tech { grid-area: tech; }
    .os-col-sla { grid-area: sla; }
    .os-col-badge { grid-area: badge; }
    .os-col-actions { grid-area: actions; align-items: stretch; }
    .os-col-actions .os-actions-dropdown .dropdown-toggle {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .os-card-row {
        grid-template-columns: 1fr;
        grid-template-areas:
            "main"
            "tech"
            "sla"
            "badge"
            "actions";
    }
}

/* =====================================================
   MODAIS PREMIUM — Editar OS + Atribuir Técnico
   ===================================================== */

/* Labels dos modais */
.os-modal-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    display: block;
}

/* Inputs dos modais */
.os-modal-input {
    background: white !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    padding: 10px 14px !important;
    font-size: 0.9rem;
    color: #1e293b !important;
    transition: all 0.2s;
}

.os-modal-input:focus {
    border-color: #FF6B00 !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1) !important;
    outline: none !important;
}

/* 🎯 SELECT — preserva a setinha do Bootstrap */
select.os-modal-input,
select.os-modal-input.form-select {
    background-color: white !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23334155' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px 12px !important;
    padding-right: 40px !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Textarea */
textarea.os-modal-input {
    resize: vertical;
    min-height: 80px;
}

/* Card com info da OS (no modal de atribuir) */
.os-assign-header {
    background: white;
    border-radius: 14px;
    padding: 16px 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.os-assign-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #FF6B00 0%, #ea580c 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
    flex-shrink: 0;
}

/* Box de informação */
.os-assign-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 14px 16px;
}

/* Footer dos modais */
#editOSModal .modal-footer,
#assignTechModal .modal-footer {
    border-top: none !important;
    gap: 8px;
}

/* Botões arredondados */
#editOSModal .btn,
#assignTechModal .btn {
    font-size: 0.85rem;
    padding: 10px 20px;
    transition: all 0.2s;
}

#editOSModal .btn:hover,
#assignTechModal .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* =====================================================
   TÉCNICO READONLY (no modal Editar OS)
   ===================================================== */
.os-tech-readonly {
    background: #f1f5f9;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: #334155;
    display: flex;
    align-items: center;
    cursor: not-allowed;
    font-weight: 700;
}

.os-tech-hint {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 700;
    margin-top: 6px;
    letter-spacing: 0.3px;
    line-height: 1.4;
}

.os-tech-hint strong {
    color: #FF6B00;
}

/* =====================================================
   BLOCO DE AGENDAMENTO (Editar OS)
   ===================================================== */
.os-agendamento-block {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 16px;
}

.os-agendamento-header {
    font-weight: 900;
    font-size: 0.8rem;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #fcd34d;
}

/* Badge de agendamento no card */
.os-agendamento-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    margin-top: 6px;
    white-space: nowrap;
}

.os-agendamento-badge i {
    font-size: 0.65rem;
}

/* =====================================================
   TECH PANEL — Painel de comando do técnico
   ===================================================== */
.tech-panel {
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* HEADER */
.tech-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 6px;
    border-bottom: 1px solid #f1f5f9;
}

.tech-panel-title {
    font-size: 0.7rem;
    font-weight: 900;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tech-panel-count {
    background: #1b1e24;
    color: white;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 3px 10px;
    border-radius: 12px;
}

/* INFO */
.tech-panel-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tech-panel-client {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tech-panel-name {
    font-size: 1rem;
    font-weight: 900;
    color: #1e293b;
    letter-spacing: -0.3px;
}

.tech-panel-badge {
    font-size: 0.6rem;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tech-panel-badge.badge-urgent {
    background: #dc2626;
    color: white;
    animation: pulse 1.5s infinite;
}

.tech-panel-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 700;
}

.tech-panel-os {
    color: #0ea5e9;
    font-weight: 900;
}

.tech-panel-dot {
    color: #cbd5e1;
}

.tech-panel-address,
.tech-panel-schedule {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 700;
}

.tech-panel-address i {
    color: #dc2626;
}

.tech-panel-schedule i {
    color: #eab308;
}

/* EXPANSÍVEL */
.tech-panel-extra {
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px;
    border: 1px solid #e2e8f0;
}

.tech-panel-obs {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.75rem;
    color: #64748b;
    font-style: italic;
    font-weight: 600;
}

.tech-panel-obs i {
    color: #94a3b8;
    margin-top: 2px;
}

/* 4 AÇÕES RÁPIDAS */
.tech-panel-quick {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.tech-panel-quick-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 0.6rem;
    font-weight: 900;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.15s;
    cursor: pointer;
}

.tech-panel-quick-btn i {
    font-size: 1rem;
    color: #0ea5e9;
}

.tech-panel-quick-btn:active {
    background: #e2e8f0;
    transform: scale(0.96);
}

/* BOTÃO PRIMÁRIO */
.tech-panel-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 0.9rem;
    font-weight: 900;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    cursor: pointer;
    transition: all 0.15s;
}

.tech-panel-primary:active {
    transform: scale(0.98);
}

.tech-panel-primary.tech-panel-danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* BOTÃO SECUNDÁRIO FULL */
.tech-panel-secondary-full {
    background: #fef3c7;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: #92400e;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.tech-panel-secondary-full:active {
    background: #fde68a;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Linha de 2 botões lado a lado no painel do técnico */
.tech-panel-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tech-panel-row-2col .tech-panel-primary {
    padding: 12px 8px;
    font-size: 0.8rem;
}

/* Abas do histórico (nav-pills) */
#historyTabs .nav-link {
    color: #64748b;
    background: transparent;
    border: none;
    padding: 10px 16px;
    transition: all 0.15s;
}

#historyTabs .nav-link:hover {
    background: #f1f5f9;
    color: #334155;
}

#historyTabs .nav-link.active {
    background: linear-gradient(135deg, #FF6B00 0%, #e85d00 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

#historyTabs .nav-link i {
    font-size: 0.85rem;
}

#historyTabs .nav-link .badge {
    background: rgba(255,255,255,0.25) !important;
    color: white !important;
    font-weight: 900;
}

#historyTabs .nav-link:not(.active) .badge {
    background: #e2e8f0 !important;
    color: #475569 !important;
}

/* ═══════════════════════════════════════════════════════
   POPUP DO MAPA — APP DO TÉCNICO
   ═══════════════════════════════════════════════════════ */
.tech-popup {
    min-width: 260px;
    max-width: 340px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    padding: 4px;
}

/* Cabeçalho */
.tech-popup-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.tech-popup-title {
    font-weight: 900;
    color: #1e293b;
    font-size: 0.9rem;
    line-height: 1.2;
    text-transform: uppercase;
}

.tech-popup-badge {
    background: #0ea5e9;
    color: white;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Endereço e agendamento */
.tech-popup-address,
.tech-popup-schedule {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
}

.tech-popup-address i {
    color: #dc2626;
    margin-top: 2px;
    flex-shrink: 0;
}

.tech-popup-schedule i {
    color: #eab308;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Histórico de tentativas */
.tech-popup-history {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 10px;
    margin-top: 10px;
}

.tech-popup-history-title {
    font-size: 0.68rem;
    font-weight: 900;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.tech-popup-history-item {
    background: white;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border-left: 3px solid #f59e0b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.tech-popup-history-item:last-child {
    margin-bottom: 0;
}

.tech-popup-history-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.tech-popup-history-icon {
    font-size: 0.9rem;
}

.tech-popup-history-date {
    font-weight: 800;
    color: #475569;
}

.tech-popup-history-tech {
    background: #f1f5f9;
    color: #475569;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.65rem;
    margin-left: auto;
    text-transform: uppercase;
}

.tech-popup-history-obs {
    font-size: 0.72rem;
    color: #64748b;
    font-style: italic;
    font-weight: 600;
    padding-left: 20px;
    line-height: 1.3;
    word-break: break-word;
}

/* ═══════════════════════════════════════════════════════
   SEPARADOR DE SEÇÃO — EM CAMPO / DEMAIS
   ═══════════════════════════════════════════════════════ */
.os-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 16px 0 8px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 12px;
    font-weight: 900;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    color: #64748b;
    text-transform: uppercase;
    border-left: 4px solid #94a3b8;
}

.os-section-header.os-section-campo {
    background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
    color: #9a3412;
    border-left-color: #ea580c;
    animation: pulse-campo 2s infinite;
}

.os-section-header i {
    font-size: 1rem;
}

.os-section-header.os-section-campo i {
    color: #ea580c;
}

.os-section-count {
    margin-left: auto;
    background: white;
    color: #1e293b;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 900;
    font-size: 0.7rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

@keyframes pulse-campo {
    0%, 100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(234, 88, 12, 0); }
}