/* DiagnósticoPro & EditalPro - Estilos Multiplataforma V17 (Desktop Original Intacto + Mobile <= 768px) */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { display: flex; height: 100vh; background-color: #f8fafc; color: #334155; overflow: hidden; }

/* ELEMENTOS MOBILE: 100% OCULTOS NO NOTEBOOK E PC */
.mobile-topbar, .mobile-bottom-nav, .sidebar-backdrop { display: none !important; }

/* SIDEBAR (EXATAMENTE COMO NO LAYOUT ORIGINAL DO NOTEBOOK) */
.sidebar { width: 255px; background-color: #0f172a; color: white; display: flex; flex-direction: column; flex-shrink: 0; border-right: 1px solid #1e293b; z-index: 9200; }
.logo-area { padding: 18px 20px; font-size: 19px; font-weight: bold; border-bottom: 1px solid #1e293b; display: flex; align-items: center; gap: 10px; color: #38bdf8; text-decoration: none; }
.logo-area:hover { color: #7dd3fc; }
.menu { flex: 1; padding: 10px 0; overflow-y: auto; }
.menu-item { padding: 10px 20px; display: flex; align-items: center; gap: 11px; color: #94a3b8; transition: 0.15s; font-size: 13px; font-weight: 500; text-decoration: none; }
.menu-item:hover { background-color: #1e293b; color: #f8fafc; }
.menu-item.active { background-color: #1e293b; color: white; border-left: 4px solid #38bdf8; font-weight: 600; }
.menu-category { padding: 14px 20px 4px; font-size: 10px; text-transform: uppercase; color: #64748b; font-weight: bold; letter-spacing: 0.8px; }

/* MAIN CONTENT (EXATAMENTE COMO NO LAYOUT ORIGINAL DO NOTEBOOK) */
.main-content { flex: 1; overflow-y: auto; padding: 22px 26px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-title { color: #0f172a; font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.page-subtitle { color: #64748b; font-size: 13px; margin-top: 3px; }

/* CONTAINERS E GRIDS */
.search-container { background: white; padding: 18px 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 20px; border: 1px solid #e2e8f0; }
.painel-duplo { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
@media (max-width: 1100px) and (min-width: 769px) { .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(2, 1fr); } }

.input-group label { display: block; font-size: 11.5px; font-weight: 600; color: #475569; margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; outline: none; font-size: 12.5px; }
input:focus, select:focus, textarea:focus { border-color: #0284c7; box-shadow: 0 0 0 2px rgba(2,132,199,0.15); }

/* BOTOES */
.btn-primary { background: #0284c7; color: white; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 12.5px; transition: 0.15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn-primary:hover { background: #0369a1; }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }

.btn-outline { border: 1px solid #0284c7; color: #0284c7; background: white; padding: 6px 12px; border-radius: 6px; cursor: pointer; text-decoration: none; text-align: center; font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; transition: 0.15s; }
.btn-outline:hover { background: #f0f9ff; }
.btn-danger { background: #fee2e2; color: #ef4444; border: 1px solid #ef4444; }
.btn-danger:hover { background: #fecaca; }
.btn-success { background: #10b981; color: white; border: none; }
.btn-success:hover { background: #059669; }

/* CARDS */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card { background: white; border-radius: 8px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border-top: 4px solid #0284c7; border-left: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; display: flex; flex-direction: column; }

/* STATS */
.stat-box { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 11px; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.stat-box .valor { font-size: 16px; font-weight: bold; color: #0f172a; margin-top: 3px; }
.stat-box .rotulo { font-size: 10px; text-transform: uppercase; color: #64748b; font-weight: bold; }

/* BADGES */
.badge-status { padding: 3px 8px; border-radius: 12px; font-size: 10px; font-weight: 700; display: inline-block; }
.st-verde { background: #dcfce7; color: #15803d; }
.st-amarelo { background: #fef3c7; color: #b45309; }
.st-vermelho { background: #fee2e2; color: #b91c1c; }
.st-azul { background: #e0f2fe; color: #0369a1; }
.st-roxo { background: #f3e8ff; color: #7e22ce; }

/* TABELAS */
table.tbl-custom { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
table.tbl-custom th { background: #f8fafc; color: #475569; text-align: left; padding: 8px 10px; border-bottom: 2px solid #e2e8f0; font-size: 10.5px; text-transform: uppercase; }
table.tbl-custom td { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.tbl-custom tr:hover { background-color: #f8fafc; }

/* KANBAN (FUNIL) */
.kanban-board { display: flex; gap: 11px; overflow-x: auto; padding-bottom: 16px; min-height: 66vh; }
.kanban-col { background: #f1f5f9; border-radius: 9px; padding: 10px; width: 275px; flex-shrink: 0; display: flex; flex-direction: column; border: 1px solid #e2e8f0; }
.kanban-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; margin-bottom: 9px; border-bottom: 3px solid #cbd5e1; font-weight: 700; font-size: 12px; color: #1e293b; }
.kanban-badge-count { background: #e2e8f0; color: #334155; padding: 2px 7px; border-radius: 12px; font-size: 10.5px; font-weight: bold; }
.kanban-corpo { flex: 1; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; }

.k-card { background: white; padding: 12px; border-radius: 7px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border-left: 4px solid #0284c7; display: flex; flex-direction: column; gap: 6px; transition: 0.15s; }
.k-card:hover { transform: translateY(-2px); box-shadow: 0 4px 7px rgba(0,0,0,0.1); }
.k-card-top { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: #64748b; }
.k-card-title { font-size: 12.5px; font-weight: 700; color: #1e293b; line-height: 1.3; }
.k-card-obj { font-size: 11px; color: #475569; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.k-card-actions { display: flex; gap: 6px; margin-top: 4px; }

/* MODAL */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.72); display: none; justify-content: center; align-items: center; z-index: 9999; padding: 12px; }
.modal-overlay.ativo { display: flex; animation: fadeIn 0.15s; }
.modal-card { background: white; width: 100%; max-width: 1260px; height: 92vh; border-radius: 10px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3); display: flex; flex-direction: column; overflow: hidden; }
.modal-header { padding: 13px 20px; background: #0f172a; color: white; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; background: #f8fafc; border-top: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; }

/* CANVAS TOUCH DE ASSINATURA */
.signature-container { border: 2px dashed #0284c7; border-radius: 8px; background: #ffffff; text-align: center; padding: 8px; margin-top: 6px; }
canvas#signature-canvas, canvas#signature-canvas-retro { border: 1px solid #cbd5e1; border-radius: 6px; background: #ffffff; touch-action: none; cursor: crosshair; max-width: 100%; }

/* TABS E PAINÉIS */
.tab-btn-group { display: flex; gap: 6px; border-bottom: 2px solid #e2e8f0; padding-bottom: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tab-btn { background: #f1f5f9; border: 1px solid #cbd5e1; color: #475569; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 11.5px; font-weight: 600; transition: 0.15s; text-decoration: none; }
.tab-btn:hover { background: #e2e8f0; }
.tab-btn.ativo { background: #0284c7; color: white; border-color: #0284c7; }

.calc-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 11.5px; }
.box-ia { background: #ffffff; border: 1px solid #cbd5e1; padding: 14px; border-radius: 8px; font-size: 13px; line-height: 1.5; color: #1e293b; max-height: 400px; overflow-y: auto; }
.chat-box { background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 8px; padding: 10px; height: 250px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.msg-user { align-self: flex-end; background: #0284c7; color: white; padding: 7px 11px; border-radius: 11px 11px 2px 11px; max-width: 85%; }
.msg-ia { align-self: flex-start; background: white; color: #1e293b; border: 1px solid #e2e8f0; padding: 8px 12px; border-radius: 11px 11px 11px 2px; max-width: 92%; line-height: 1.45; }

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

/* =====================================================================
   MODO EXCLUSIVO PARA CELULAR ( <= 768px ) - NÃO AFETA O NOTEBOOK!
   ===================================================================== */
@media only screen and (max-width: 768px) {
    .mobile-topbar {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 54px;
        background: #0f172a;
        color: white;
        z-index: 9000;
        padding: 0 14px;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid #1e293b;
        box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    }
    .mobile-menu-btn {
        background: #1e293b;
        border: 1px solid #334155;
        color: #38bdf8;
        width: 38px;
        height: 38px;
        border-radius: 8px;
        font-size: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
    .mobile-brand {
        font-size: 16px;
        font-weight: 800;
        color: #38bdf8;
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: 7px;
    }
    .mobile-quick-os {
        background: #7c3aed;
        color: white;
        text-decoration: none;
        font-size: 11px;
        font-weight: 700;
        padding: 6px 10px;
        border-radius: 7px;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .sidebar-backdrop.aberto {
        display: block !important;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.65);
        z-index: 9100;
    }
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 58px;
        background: #ffffff;
        border-top: 1px solid #cbd5e1;
        z-index: 8900;
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
    }
    .mob-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #64748b;
        font-size: 10px;
        font-weight: 600;
        gap: 3px;
        flex: 1;
        height: 100%;
    }
    .mob-nav-item i { font-size: 15px; }
    .mob-nav-item.ativo { color: #0284c7; font-weight: 700; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        box-shadow: 10px 0 25px rgba(0,0,0,0.4);
    }
    .sidebar.aberta { transform: translateX(0); }
    .main-content {
        padding: 66px 12px 74px 12px !important;
        width: 100%;
    }
    .search-container { overflow-x: auto; }
    table.tbl-custom { min-width: 600px; }
    .painel-duplo, .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .page-header { flex-direction: column; align-items: stretch; }
    .modal-overlay { padding: 0; }
    .modal-card { height: 100vh !important; max-height: 100vh !important; border-radius: 0 !important; }
    .modal-body { display: flex !important; flex-direction: column !important; padding: 12px !important; }
    input, select, textarea { font-size: 16px !important; }
}
