﻿/* ============================================================
   ERP FINANCEIRO — Tema VB.NET WinForms XP Luna
   Cores sistema: ButtonFace #ECE9D8 | Caption #0A246A->A6CAF0
   Input border #7F9DB9 | Desktop #3A6EA5
   Font: Tahoma 8pt (11px)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: Tahoma, "MS Sans Serif", Arial, sans-serif;
    font-size: 11px;
    background: #3A6EA5;
    color: #000;
    overflow: hidden;
    height: 100vh;
    user-select: none;
}

/* ---- APP SHELL ---- */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #ECE9D8;
}

/* ---- TITLE BAR (Luna active caption) ---- */
#app-titlebar {
    background: linear-gradient(to right, #0A246A 0%, #3D6EA8 40%, #A6CAF0 100%);
    color: #fff;
    font-weight: bold;
    font-size: 11px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.6);
    border-bottom: 1px solid #0A246A;
}
#app-titlebar .app-icon { font-size: 15px; }
#app-titlebar .win-btns { margin-left: auto; display: flex; gap: 3px; }
#app-titlebar .win-btns button {
    width: 22px; height: 16px;
    font-size: 10px; line-height: 1;
    background: linear-gradient(180deg, #CADFF8 0%, #93B9E8 100%);
    border: 1px solid #7F9DB9;
    border-radius: 2px;
    cursor: pointer;
    color: #1a1a1a;
    font-weight: bold;
}
#app-titlebar .win-btns button:hover {
    background: linear-gradient(180deg, #ffeaea 0%, #e88080 100%);
    border-color: #b04040;
}

/* ---- MENU BAR ---- */
#menubar {
    background: #ECE9D8;
    border-bottom: 1px solid #ACA899;
    padding: 1px 2px;
    display: flex;
    position: relative;
    z-index: 500;
}
.menu-item {
    padding: 3px 9px;
    cursor: pointer;
    font-size: 11px;
    position: relative;
    color: #000;
    border-radius: 2px;
    border: 1px solid transparent;
}
.menu-item:hover, .menu-item.open {
    background: linear-gradient(180deg, #F3F8FD 0%, #D5E8FB 100%);
    border-color: #7F9DB9;
    color: #000;
}
.menu-item .underline { text-decoration: underline; }

/* ---- DROPDOWN ---- */
.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #7F9DB9;
    min-width: 180px;
    z-index: 9999;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.25);
    padding: 2px 0;
}
.dropdown.visible { display: block; }
.dropdown-item {
    padding: 5px 20px 5px 24px;
    cursor: pointer;
    font-size: 11px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #000;
}
.dropdown-item:hover {
    background: linear-gradient(90deg, #316AC5 0%, #4a7fd4 100%);
    color: #fff;
}
.dropdown-sep {
    height: 1px;
    background: #ACA899;
    margin: 3px 6px;
}

/* ---- WORKSPACE (MDI) ---- */
#workspace {
    flex: 1;
    position: relative;
    background: #7B9EBF;
    overflow: hidden;
}

/* ---- STATUS BAR ---- */
#statusbar {
    background: #ECE9D8;
    border-top: 1px solid #ACA899;
    padding: 2px 8px;
    font-size: 11px;
    display: flex;
    gap: 8px;
    align-items: center;
}
#statusbar .sb-panel {
    border: 1px solid #ACA899;
    padding: 1px 8px;
    min-width: 120px;
    background: #ECE9D8;
    font-size: 11px;
}

/* ---- MDI WINDOW (WinForms dialog) ---- */
.mdi-win {
    position: absolute;
    background: #ECE9D8;
    border: 1px solid #7F9DB9;
    min-width: 320px;
    box-shadow: 3px 4px 10px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
}
.mdi-win.inactive .mdi-titlebar {
    background: linear-gradient(to right, #7A96DF 0%, #B5CBEF 60%, #C4D4F0 100%);
}
.mdi-titlebar {
    background: linear-gradient(to right, #0A246A 0%, #3D6EA8 40%, #A6CAF0 100%);
    color: #fff;
    font-weight: bold;
    font-size: 11px;
    padding: 4px 5px 3px;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: move;
    flex-shrink: 0;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.55);
}
.mdi-titlebar .mdi-icon { font-size: 13px; }
.mdi-titlebar .mdi-title { flex: 1; }
.mdi-close {
    width: 20px; height: 16px;
    background: linear-gradient(180deg, #CADFF8 0%, #93B9E8 100%);
    border: 1px solid #7F9DB9;
    border-radius: 2px;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    display: flex; align-items: center; justify-content: center;
    color: #1a1a1a;
    flex-shrink: 0;
}
.mdi-close:hover {
    background: linear-gradient(180deg, #ffeaea 0%, #e07070 100%);
    border-color: #b04040;
}
.mdi-close:active { transform: scale(0.95); }

.mdi-body { padding: 10px 12px; flex: 1; }
.mdi-content { flex: 1; overflow: hidden; min-height: 0; display: flex; flex-direction: column; }

/* ---- TOOLBAR ---- */
.win-toolbar {
    background: #ECE9D8;
    border-bottom: 1px solid #ACA899;
    padding: 3px 5px;
    display: flex;
    align-items: center;
    gap: 3px;
}
.tbtn {
    background: linear-gradient(180deg, #FAFAFA 0%, #E8E4D8 100%);
    border: 1px solid #ACA899;
    border-radius: 2px;
    padding: 3px 8px;
    font-family: Tahoma, Arial; font-size: 11px;
    cursor: pointer;
    display: flex; align-items: center; gap: 5px;
    white-space: nowrap;
    color: #000;
}
.tbtn:hover {
    background: linear-gradient(180deg, #F3F8FD 0%, #D5E8FB 100%);
    border-color: #7F9DB9;
}
.tbtn:active {
    background: linear-gradient(180deg, #D5E8FB 0%, #F3F8FD 100%);
    transform: translateY(1px);
}
.tbtn:disabled, .tbtn[disabled] { color: #ACA899; cursor: default; }

/* ---- FORMULARIO ---- */
.form-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    gap: 5px;
}
.form-row label {
    width: 106px;
    text-align: right;
    flex-shrink: 0;
    font-size: 11px;
    color: #000;
}
.inp {
    border: 1px solid #7F9DB9;
    background: #fff;
    font-family: Tahoma, Arial; font-size: 11px;
    padding: 2px 5px;
    height: 21px;
    flex: 1;
    outline: none;
    color: #000;
}
.inp:focus {
    border-color: #316AC5;
    background: #fff;
    outline: none;
}
.inp-sm { flex: none; width: 80px; }
select.inp { height: 21px; cursor: pointer; }
textarea.inp { height: auto; padding: 3px 5px; resize: vertical; }

/* ---- BOTOES WINFORMS XP ---- */
.btn-row {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #ACA899;
}
.btn-win {
    background: linear-gradient(180deg, #FAFAFA 0%, #E8E4D8 100%);
    border: 1px solid #7F9DB9;
    border-radius: 2px;
    padding: 4px 0;
    font-family: Tahoma, Arial; font-size: 11px;
    cursor: pointer;
    min-width: 80px;
    text-align: center;
    display: flex; align-items: center; justify-content: center; gap: 5px;
    color: #000;
}
.btn-win:hover {
    background: linear-gradient(180deg, #F3F8FD 0%, #D5E8FB 100%);
    border-color: #316AC5;
}
.btn-win:active {
    background: linear-gradient(180deg, #D5E8FB 0%, #F3F8FD 100%);
    transform: translateY(1px);
}
.btn-win:focus { outline: 1px dotted #000; outline-offset: -3px; }

/* ---- GRID / DATAGRIDVIEW ---- */
.grid-wrap {
    border: 1px solid #7F9DB9;
    background: #fff;
    overflow: auto;
}
.grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.grid thead th {
    background: linear-gradient(180deg, #EBE8D7 0%, #DDD9C8 100%);
    border-right: 1px solid #ACA899;
    border-bottom: 1px solid #ACA899;
    padding: 3px 6px;
    text-align: left;
    font-weight: bold;
    white-space: nowrap;
    color: #000;
    font-size: 11px;
}
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: #EAF1FB; }
.grid tbody tr.selected { background: #316AC5; color: #fff; }
.grid tbody td {
    padding: 2px 6px;
    border-bottom: 1px solid #E8E5D8;
    white-space: nowrap;
    overflow: hidden;
    max-width: 200px;
    text-overflow: ellipsis;
}

/* ---- PESQUISA ---- */
.search-inp-row {
    display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
}
.search-inp-row label { font-size: 11px; white-space: nowrap; }
.search-inp-row .inp { flex: 1; }

/* ---- SEPARADOR ---- */
.sep-h {
    border: none;
    border-top: 1px solid #ACA899;
    margin: 8px 0;
}

/* ---- TABS (TabControl XP) ---- */
.tabs {
    display: flex;
    border-bottom: 1px solid #7F9DB9;
    margin-bottom: 8px;
}
.tab {
    padding: 4px 12px;
    border: 1px solid #7F9DB9;
    border-bottom: none;
    margin-right: 2px;
    cursor: pointer;
    font-size: 11px;
    background: linear-gradient(180deg, #DDD9C8 0%, #C8C4B4 100%);
    border-radius: 2px 2px 0 0;
    color: #444;
    position: relative;
    top: 1px;
}
.tab.active {
    background: #ECE9D8;
    border-bottom: 1px solid #ECE9D8;
    top: 0;
    font-weight: bold;
    color: #000;
}

/* ---- CHECKBOX ---- */
.chk-row { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.chk-row label { font-size: 11px; cursor: pointer; }
.chk-row input[type=checkbox] { width: 13px; height: 13px; accent-color: #316AC5; cursor: pointer; }

/* ---- GROUPBOX ---- */
.groupbox {
    border: 1px solid #ACA899;
    border-radius: 2px;
    padding: 12px 8px 8px;
    position: relative;
    margin-bottom: 8px;
}
.groupbox legend {
    font-size: 11px;
    padding: 0 4px;
    color: #000;
    font-weight: bold;
}

/* ---- BADGES ---- */
.badge-aberto    { color: #316AC5; font-weight: bold; }
.badge-encerrado { color: #808080; }

/* ---- Autocomplete genérico (empresa, etc.) ---- */
.erp-ac-wrap { position: relative; flex: 1; min-width: 0; }
.erp-ac-wrap .inp { width: 100%; box-sizing: border-box; }
.erp-ac-drop {
    position: absolute; z-index: 9999; top: 100%; left: 0; right: 0;
    background: #fff; border: 1px solid #7F9DB9; max-height: 200px; overflow-y: auto;
    display: none; box-shadow: 2px 2px 4px rgba(0,0,0,.2);
}
.erp-ac-drop div { padding: 3px 6px; cursor: pointer; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erp-ac-drop div:hover, .erp-ac-drop div.erp-ac-sel { background: #316AC5; color: #fff; }
