/**
 * DESIGN SYSTEM - SOLANE OS
 * Arquivo de estilos centralizado
 * Segue metodologia BEM e Custom Properties CSS para fácil manutenção e temas
 */

:root {
    /* CORES - PALETA PRINCIPAL */
    --primary: #0a0f0d;
    --primary-hover: #1a2320;
    --accent: #10b981;
    --accent-hover: #059669;
    
    /* BACKGROUNDS */
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    
    /* TEXTOS */
    --text-main: #0f172a;
    --text-muted: #64748b;
    
    /* ELEMENTOS */
    --border: #e2e8f0;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* SOMBRAS */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    /*
     * Sem isso, o Chrome/WebView no Android às vezes recalcula e infla o
     * tamanho do texto sozinho (o famoso "text autosizer") quando o layout
     * muda perto de um elemento pequeno — dava a impressão de que as letras
     * "cresciam" por um instante e voltavam ao normal (relatado ao clicar
     * nos botões Sim/Não da garantia, mas podia acontecer em qualquer lugar
     * com reflow perto de fontes pequenas).
     */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background: var(--bg-body);
    color: var(--text-main);
    overflow: hidden;
    display: flex;
    line-height: 1.6;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 16px;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Button Variants */
.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover {
    background: var(--accent-hover);
}

.btn-outline {
    background: white;
    border: 1.5px solid var(--accent);
    color: var(--accent);
}

.btn-outline:hover {
    background: var(--bg-body);
    border-color: var(--accent-hover);
    color: var(--accent-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

/* ===== FORM ELEMENTS ===== */
.input-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    transition: all 0.2s;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-surface);
    color: var(--text-main);
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.input-group input:disabled,
.input-group textarea:disabled,
.input-group select:disabled {
    background: var(--bg-body);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ===== NOTIFICATIONS (TOAST) ===== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 16px 20px;
    border-radius: 8px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--accent);
    min-width: 320px;
    animation: slideIn 0.3s ease;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.toast.error {
    border-color: var(--danger);
}

.toast.success {
    border-color: var(--success);
}

.toast.warning {
    border-color: var(--warning);
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-main);
}

.toast-msg {
    font-size: 13px;
    color: var(--text-muted);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== AUTH VIEW ===== */
#auth-view {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-card {
    background: var(--bg-surface);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.3s ease;
}

.auth-card h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-card p {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
    font-size: 14px;
}

.remember-login-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -6px 0 16px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.remember-login-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===== APP LAYOUT ===== */
#app-layout {
    display: none;
    width: 100%;
    height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
}

.sidebar-nav {
    padding: 24px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    padding: 12px 16px;
    border-radius: 6px;
    color: #cbd5e1;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.nav-label {
    white-space: nowrap;
}

/* ===== TOPBAR: logo (mobile) + info do usuário + botão sair ===== */
.topbar-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-logo {
    display: none;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    flex-shrink: 0;
}

.topbar-user-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-user-info {
    text-align: right;
    font-size: 13px;
    line-height: 1.35;
}

.topbar-user-info > div:first-child {
    font-weight: 600;
    color: var(--text-main);
}

.topbar-user-role {
    color: var(--text-muted);
    font-size: 12px;
}

.btn-icon {
    padding: 10px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(16, 185, 129, 0.2);
    color: white;
    border-left-color: var(--accent);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
    overflow-y: auto;
}

.topbar {
    height: 70px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.topbar h3 {
    font-size: 18px;
    font-weight: 600;
}

.page-content {
    padding: 40px;
    flex: 1;
    overflow-y: auto;
}

/*
 * ===== PULL TO REFRESH (app do prestador) =====
 * Indicador fixo no topo, escondido fora da tela por padrão; um gesto de
 * arrastar pra baixo no topo da rolagem o traz à vista e gira o ícone
 * (ver setupPrestadorPullToRefresh em prestador.js). "armado" = já passou do
 * limiar pra soltar e atualizar; "carregando" = atualização em andamento.
 */
.pull-refresh-indicator {
    position: fixed;
    top: calc(6px + env(safe-area-inset-top));
    left: 50%;
    z-index: 950;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-surface);
    color: var(--text-muted);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translate(-50%, -60px);
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.pull-refresh-indicator.visivel {
    opacity: 1;
    transform: translate(-50%, 0);
}

.pull-refresh-indicator.armado {
    color: var(--accent);
}

.pull-refresh-indicator.carregando svg {
    animation: pull-refresh-spin 0.7s linear infinite;
}

@keyframes pull-refresh-spin {
    to { transform: rotate(360deg); }
}

/* ===== SECTIONS / VIEWS ===== */
.section-view {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== DASHBOARD METRICS ===== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--bg-surface);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
}

.metric-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.metric-title {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
}

/* ===== TABLES ===== */
.table-container {
    background: var(--bg-surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--bg-body);
    padding: 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.5px;
}

td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: rgba(16, 185, 129, 0.05);
}

/* ===== LISTA DE CARTÕES (Meus Chamados do prestador) =====
   Alternativa à tabela pra listas que precisam ficar legíveis em telas
   estreitas (app do prestador) sem rolagem horizontal — cada chamado vira
   um cartão separado, com status sempre visível. */
.chamado-card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chamado-card-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: box-shadow .15s, transform .15s;
}

.chamado-card-item:hover {
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10);
    transform: translateY(-1px);
}

.chamado-card-item.is-urgente {
    border-color: #fecaca;
    box-shadow: inset 4px 0 0 #ef4444;
}

.chamado-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.chamado-card-codigo {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-muted);
}

.chamado-card-titulo {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 10px;
}

.chamado-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
}

.chamado-card-data {
    font-size: 12px;
    color: var(--text-muted);
}

.chamado-card-endereco {
    background: var(--bg-body);
    border-radius: 8px;
    padding: 8px 10px;
    margin: 8px 0;
    font-size: 12px;
    color: var(--text-muted);
}

.chamado-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* Alterna entre tabela (telas largas) e cartões (telas estreitas) na lista
   de chamados da imobiliária, evitando rolagem horizontal no celular. */
.chamado-card-list.chamados-cards-view {
    display: none;
}

/* ===== BADGES ===== */
.badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-block;
}

.badge.open {
    background: #fee2e2;
    color: #991b1b;
}

.badge.progress {
    background: #fef3c7;
    color: #92400e;
}

.badge.done {
    background: #d1fae5;
    color: #065f46;
}

.badge.pending {
    background: #e0e7ff;
    color: #3730a3;
}

.badge.approved {
    background: #cffafe;
    color: #155e75;
}

.badge.rejected {
    background: #fee2e2;
    color: #b91c1c;
}

.badge.cancelled {
    background: #e2e8f0;
    color: #475569;
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===== PRIORIDADE URGENTE / INCENTIVOS ===== */
@keyframes pulseUrgente {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
    70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.badge.urgente-pulse {
    background: #ef4444;
    color: #ffffff;
    animation: pulseUrgente 1.4s infinite;
}

tr.linha-urgente {
    background: #fef2f2;
    box-shadow: inset 4px 0 0 #ef4444;
}

.badge-valor-pre-aprovado {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #dcfce7;
    color: #15803d;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.prazo-aceite {
    font-size: 12px;
    margin-top: 4px;
    color: var(--text-muted);
}

.prazo-aceite.vencido {
    color: #b91c1c;
    font-weight: 700;
}

/* ===== SCROLLBAR CUSTOMIZATION ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }

    .page-content {
        padding: 24px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
    }

    #app-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar-header {
        width: 100%;
        padding: 16px;
    }

    .sidebar-nav {
        flex: none;
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: visible;
        padding: 8px 12px;
        gap: 8px;
    }

    .nav-item {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .nav-item.active {
        border-left-color: transparent;
        border-bottom-color: var(--accent);
    }

    .main-content {
        height: auto;
        overflow-y: visible;
    }

    .topbar {
        flex-direction: column;
        height: auto;
        padding: 16px;
        gap: 16px;
        align-items: stretch;
    }

    .page-content {
        padding: 16px;
    }

    .auth-card {
        margin: 16px;
    }

    .card-grid {
        grid-template-columns: 1fr 1fr;
    }

    .table-container {
        overflow-x: auto;
    }

    table {
        min-width: 640px;
    }

    .chamados-table-view {
        display: none;
    }

    .chamado-card-list.chamados-cards-view {
        display: flex;
    }

    .modal-card {
        padding: 20px;
    }

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

    /*
     * ===== APP DO PRESTADOR (mobile-prestador, Capacitor) + PORTAL DA
     * IMOBILIÁRIA (portal/index.html) =====
     * Escopado em .app-prestador / .app-imobiliaria: o menu lateral vira
     * uma barra de abas fixa embaixo (com ícone), o logo/nome/sair saem do
     * rodapé da sidebar e vão pro topo, e o env(safe-area-inset-*) evita
     * que a barra de status/gestos do celular sobreponha o conteúdo.
     * Antes disso a imobiliária tinha logo + abas (com rolagem horizontal
     * escondendo abas) + nome/sair empilhados em cima da tela, antes do
     * próprio conteúdo — confuso e exigia arrastar pro lado pra navegar.
     */
    .app-prestador .sidebar,
    .app-imobiliaria .sidebar {
        width: 100%;
        height: auto;
        flex-direction: column;
        flex-wrap: nowrap;
        border-right: none;
        border-bottom: none;
    }

    .app-prestador .sidebar-header,
    .app-imobiliaria .sidebar-header {
        display: none;
    }

    .app-prestador .sidebar-nav,
    .app-imobiliaria .sidebar-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 900;
        flex: none;
        flex-direction: row;
        justify-content: space-around;
        overflow: visible;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        gap: 2px;
        background: var(--primary);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
        transform: translateY(0);
        transition: transform 0.2s ease;
    }

    /*
     * Com o teclado aberto, a barra de abas fixa no rodapé recalcula contra
     * a altura visível (menor) e some flutuando em cima do teclado — em
     * telas onde o campo focado fica mais pra baixo (ex: "Solução para o
     * problema" no formulário de orçamento), ela chega a cobrir o próprio
     * texto sendo digitado. `.teclado-aberto` é ligada/desligada via
     * focusin/focusout em setupPrestadorTecladoOculto() (prestador.js).
     */
    body.app-prestador.teclado-aberto .sidebar-nav {
        transform: translateY(150%);
    }

    .app-prestador .nav-item,
    .app-imobiliaria .nav-item {
        flex: 1;
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        padding: 6px 2px;
        border-left: none;
        border-bottom: none;
        border-radius: 10px;
        font-size: 10.5px;
        text-align: center;
        white-space: normal;
    }

    .app-prestador .nav-item.active,
    .app-imobiliaria .nav-item.active {
        border-bottom-color: transparent;
        background: rgba(16, 185, 129, 0.3);
    }

    .app-prestador .main-content,
    .app-imobiliaria .main-content {
        height: auto;
        overflow-y: visible;
        padding-bottom: 78px;
    }

    .app-imobiliaria .topbar {
        flex-direction: row;
        height: auto;
        min-height: 56px;
        padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
        gap: 10px;
        align-items: center;
        justify-content: space-between;
    }

    .app-imobiliaria .topbar h3 {
        font-size: 16px;
    }

    .app-imobiliaria .topbar-logo {
        display: block;
    }

    .app-imobiliaria .topbar-user-info {
        display: none;
    }

    .app-imobiliaria .topbar-user-group {
        gap: 8px;
    }

    .app-imobiliaria .topbar-user-group .btn-accent {
        padding: 8px 12px;
        font-size: 13px;
    }

    /*
     * O prestador não tem mais o header/topbar fixo (removido junto com o
     * logo, nome da aba e botões de atualizar/sair que ficavam repetidos em
     * toda tela — ver setupPrestadorPullToRefresh em prestador.js). Sem o
     * topbar, ninguém mais compensa o notch/status bar do celular, então o
     * padding-top do próprio conteúdo assume esse papel aqui.
     */
    .app-prestador .page-content {
        padding-top: calc(16px + env(safe-area-inset-top));
    }

    .app-prestador .auth-card,
    .app-imobiliaria .auth-card {
        margin-top: env(safe-area-inset-top);
    }

    /*
     * No app do prestador (tela estreita), a barra de sub-abas de Chamados
     * (Disponíveis / Orçamento Pendente / Agendado / etc.) fica fixa no
     * topo da tela (gruda ao rolar a lista), com ícone + nome curto em
     * cada aba. Não cabem as 6 de uma vez numa tela de celular sem ficar
     * apertado, então a barra rola pro lado — cada aba mantém um tamanho
     * confortável em vez de espremer tudo pra caber.
     */
    .app-prestador .tab-pills {
        position: sticky;
        top: 0;
        z-index: 40;
        background: var(--bg-body);
        margin: -16px -16px 16px;
        padding: 8px 12px calc(8px + env(safe-area-inset-top)) 12px;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
        gap: 6px;
    }

    .app-prestador .tab-pill {
        flex-direction: column;
        gap: 2px;
        padding: 5px 10px;
        border-radius: 12px;
        border-color: transparent;
        background: transparent;
        flex-shrink: 0;
        min-width: 64px;
        position: relative;
    }

    .app-prestador .tab-pill.active {
        background: rgba(16, 185, 129, 0.12);
        color: var(--accent);
        border-color: transparent;
    }

    .app-prestador .tab-pill-label {
        font-size: 10.5px;
        white-space: nowrap;
    }

    .app-prestador .tab-pill-count {
        position: absolute;
        top: -4px;
        right: 4px;
        background: var(--text-muted);
        color: white;
        min-width: 16px;
        height: 16px;
        line-height: 16px;
        font-size: 10px;
        padding: 0 4px;
    }

    .app-prestador .tab-pill.active .tab-pill-count {
        background: var(--accent);
    }

}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== MODAL (compartilhado entre portais) ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
}

.modal-card {
    width: min(640px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 28px;
    position: relative;
}

.modal-card.modal-card-lg {
    width: min(820px, 100%);
}

.modal-card h3 { margin-bottom: 16px; font-size: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.modal-close { position: absolute; top: 18px; right: 18px; border: none; background: transparent; font-size: 20px; cursor: pointer; color: var(--text-muted); }

/* ===== TELA DE DETALHE DO CHAMADO (prestador) =====
   Antes era um modal por cima da lista; agora é uma "tela" própria que
   substitui o conteúdo da página (mesmo padrão de navegação das outras
   abas), com um botão "Voltar" no lugar do X de fechar modal. */
.chamado-detalhe-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    max-width: 820px;
}

.btn-voltar-chamado {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
}

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.detail-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.detail-field div { font-size: 14px; color: var(--text-main); }

.orcamento-total { font-size: 18px; font-weight: 700; text-align: right; margin-top: 12px; }

/*
 * Cartão de item do orçamento (builder do prestador). Usa flexbox com wrap
 * em vez de grid de colunas fixas — grid/flex items têm min-width:auto por
 * padrão, então colunas fixas (ex: 80px) somadas ao conteúdo real do input
 * furavam a largura da tela e forçavam rolagem horizontal pra ver o botão
 * de remover ou o valor. Com flex-wrap + min-width:0 nos campos, cada campo
 * simplesmente quebra pra próxima linha se não couber, em qualquer largura.
 */
.orcamento-item-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--bg-body); }
.oi-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.oi-card-header .oi-desc { flex: 1; min-width: 0; width: auto; }
.oi-card-header .oi-remove { flex: 0 0 auto; padding: 8px 10px; }
.oi-card-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.oi-field { display: flex; flex-direction: column; flex: 1 1 110px; min-width: 90px; gap: 4px; }
.oi-field-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.oi-field-subtotal { flex: 1 1 130px; }
.oi-field-subtotal strong { font-size: 15px; }

.orcamento-item-card input,
.orcamento-item-card select {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

/* Lista somente-leitura do orçamento (visão do prestador depois de enviado) —
   div's em vez de <table> pra não herdar o min-width:640px da regra mobile
   de tabelas (ver @media 768px), que forçava rolagem horizontal na tela
   inteira do chamado pra só ver o valor do orçamento. */
.orcamento-itens-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.orcamento-item-view { padding: 10px 12px; background: var(--bg-body); border-radius: 8px; font-size: 14px; }
.orcamento-item-view .oi-view-desc { font-weight: 500; margin-bottom: 4px; }
.orcamento-item-view .oi-view-valores { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-muted); font-size: 13px; }
.orcamento-item-view .oi-view-subtotal { font-weight: 600; color: var(--text-main); }

.garantia-toggle { display: flex; gap: 10px; padding: 4px 0; }
.garantia-toggle .btn { min-width: 90px; }

/*
 * Campo de data/horário (visita, agendamento) com um texto de instrução
 * escrito dentro do próprio campo ("Toque aqui para..."), em vez de deixar
 * só o hint nativo do <input type="datetime-local"> (que em alguns
 * navegadores/versões some ou fica pouco visível, deixando o campo parecer
 * vazio e não-clicável). O texto real do input fica transparente enquanto
 * vazio — a cor volta ao normal assim que uma data é escolhida — e o texto
 * de instrução some junto, dando lugar à data preenchida.
 */
.input-data-wrapper { position: relative; }

.input-data-wrapper input[type="datetime-local"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    color: transparent;
}

.input-data-wrapper input[type="datetime-local"].input-data-preenchido {
    color: var(--text-main);
}

.input-data-placeholder {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.foto-thumb { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.foto-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

.alert-box { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-box.warning { background: #fef3c7; color: #92400e; }
.alert-box.info { background: #e0e7ff; color: #3730a3; }

.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

/* ===== SUB-ABAS EM PÍLULA (ex: Chamados do prestador: Disponíveis /
   Orçamento Pendente / Agendado / etc.) ===== */
.tab-pills {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bg-body);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid var(--border);
    transition: all 0.15s;
    flex-shrink: 0;
}

.tab-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tab-pill.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.tab-pill-icon {
    display: flex;
    align-items: center;
}

.tab-pill-count {
    opacity: 0.85;
    background: rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    padding: 0 6px;
    min-width: 18px;
    text-align: center;
    font-size: 11px;
    line-height: 16px;
}

.tab-pill.active .tab-pill-count {
    background: rgba(255, 255, 255, 0.25);
}
