/* VclWeb - tema padrao */
:root { --accent: #2563eb; --line: #c9d0da; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #e8ecf2; }
body { display: flex; justify-content: center; align-items: flex-start; padding: 24px 16px; font-family: 'Segoe UI', system-ui, sans-serif; }
.vw-busy, .vw-busy * { cursor: progress !important; }

.vw-window { background: #fff; border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, .18); overflow: hidden; flex: none; }
.vw-titlebar { height: 34px; display: flex; align-items: center; gap: 12px; padding: 0 12px; background: #111827; color: #e5e7eb; font: 600 13px 'Segoe UI', sans-serif; }
.vw-dots { display: flex; gap: 6px; }
.vw-dots i { width: 11px; height: 11px; border-radius: 50%; background: #4b5563; display: block; }
.vw-dots i:first-child { background: #ef4444; } .vw-dots i:nth-child(2) { background: #f59e0b; } .vw-dots i:last-child { background: #22c55e; }
.vw-client { position: relative; overflow: hidden; }

.vw-c { position: absolute; margin: 0; }
.vw-label { white-space: nowrap; line-height: 1.25; }
.vw-label.wrap { white-space: normal; }

input.vw-c, textarea.vw-c, select.vw-c { font: inherit; color: #111827; border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; background: #fff; outline: none; }
textarea.vw-c { resize: none; }
input.vw-c:focus, textarea.vw-c:focus, select.vw-c:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37, 99, 235, .18); }
input.vw-c[readonly], textarea.vw-c[readonly] { background: #f3f4f6; color: #4b5563; }
.vw-editing { background: #fffbea !important; border-color: #f59e0b !important; }

button.vw-c, .vw-nav button { font: inherit; color: #111827; border: 1px solid var(--line); border-radius: 4px; background: linear-gradient(#fff, #eef1f5); cursor: pointer; }
button.vw-c:hover:not(:disabled), .vw-nav button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }

.vw-check { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.vw-check input { margin: 0; }

.vw-panel { overflow: hidden; }
.vw-pcap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.vw-group .vw-frame { position: absolute; left: 0; right: 0; top: 7px; bottom: 0; border: 1px solid #d5dbe3; border-radius: 6px; }
.vw-group .vw-legend { position: absolute; left: 8px; top: -1px; padding: 0 4px; font-weight: 600; line-height: 15px; }

.vw-pages .vw-tabs { position: absolute; left: 0; right: 0; top: 0; height: 26px; display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.vw-tab { padding: 4px 12px; border: 1px solid transparent; border-bottom: none; border-radius: 4px 4px 0 0; cursor: pointer; }
.vw-tab.act { background: #fff; border-color: var(--line); margin-bottom: -1px; }
.vw-sheet { position: absolute; left: 4px; top: 28px; right: 4px; bottom: 4px; }

.vw-grid { overflow: auto; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.vw-grid:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37, 99, 235, .15); }
.vw-grid table { border-collapse: collapse; table-layout: fixed; width: max-content; min-width: 100%; }
.vw-grid th { position: sticky; top: 0; z-index: 1; background: #f3f5f8; font-weight: 600; text-align: left; padding: 4px 6px; border-bottom: 1px solid #d5dbe3; border-right: 1px solid #e5e8ed; white-space: nowrap; overflow: hidden; }
.vw-grid td { padding: 3px 6px; border-bottom: 1px solid #eef0f3; border-right: 1px solid #f2f3f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-grid .r { text-align: right; }
.vw-grid .ind { width: 18px; padding: 0; text-align: center; color: var(--accent); }
.vw-grid tbody tr { cursor: pointer; }
.vw-grid tbody tr:hover { background: #f4f7ff; }
.vw-grid tr.sel { background: #dbe7ff; }
.vw-grid.editing tr.sel { background: #fff4c7; }

.vw-nav { display: flex; }
.vw-nav button { flex: 1; border-radius: 0; margin-left: -1px; font-size: 13px; padding: 0; }
.vw-nav button:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.vw-nav button:last-child { border-radius: 0 4px 4px 0; }

.vw-unk { border: 1px dashed #e11d48; color: #e11d48; background: #fff1f2; font-size: 11px; display: flex; align-items: center; justify-content: center; }

.vw-modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.vw-form-modal { z-index: 50; }
.vw-modal-win { box-shadow: 0 20px 48px rgba(0, 0, 0, .3); }
.vw-titlebar .vw-title { flex: 1; }
.vw-close { border: none; background: transparent; color: #9ca3af; font-size: 14px; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; }
.vw-close:hover { background: #ef4444; color: #fff; }
.vw-modal { background: #fff; border-radius: 10px; min-width: 300px; max-width: 480px; box-shadow: 0 16px 40px rgba(0, 0, 0, .25); overflow: hidden; font-size: 14px; }
.vw-modal-title { padding: 10px 16px; background: #111827; color: #fff; font-weight: 600; font-size: 13px; }
.vw-modal-body { padding: 18px 16px; white-space: pre-line; color: #111827; }
.vw-modal-foot { padding: 0 16px 14px; text-align: right; }
.vw-modal-foot button { font: inherit; padding: 6px 22px; border: none; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }

/* OnClick em panel/label/imagem */
.vw-click { cursor: pointer; }
.vw-click:hover { filter: brightness(1.08); }

/* TMainMenu */
.vw-menubar { display: flex; flex-wrap: wrap; min-height: 28px; box-sizing: border-box; background: #fff; border-bottom: 1px solid var(--line); font-size: 13px; user-select: none; position: relative; z-index: 20; }
.vw-mi { position: relative; padding: 5px 12px; cursor: default; white-space: nowrap; }
.vw-mi.top:hover, .vw-mi.sub:hover { background: #e8f0fe; }
.vw-mi:not(.top):not(.sub):hover { background: #e8f0fe; }
.vw-mi.dis { color: #999; }
.vw-mi.sub::after { content: '\25B8'; position: absolute; right: 6px; color: #888; }
.vw-msub { display: none; position: absolute; left: 0; top: 100%; min-width: 200px; background: #fff; border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.15); padding: 3px 0; }
.vw-msub .vw-msub { left: 100%; top: -4px; }
.vw-mi:hover > .vw-msub { display: block; }
.vw-menubar.closed .vw-msub { display: none !important; }
.vw-msub .vw-mi { padding: 5px 24px 5px 14px; }
.vw-msep { height: 1px; background: var(--line); margin: 3px 0; }

/* WindowState = wsMaximized: ocupa o navegador (o servidor ja ajustou ClientWidth/Height) */
.vw-window.vw-max { position: fixed; inset: 0; border-radius: 0; box-shadow: none; overflow: hidden; z-index: 10; }
.vw-window.vw-max .vw-client { max-width: none; }
.vw-wbtn { font-size: 15px; }
.vw-wbtn:hover { background: #374151; color: #fff; }

/* rodape do TDBGridEh (totalizadores) */
.vw-grid tfoot td { position: sticky; bottom: 0; background: #f3f5f8; font-weight: 600; padding: 3px 6px; border-top: 1px solid #d5dbe3; border-right: 1px solid #e5e8ed; white-space: nowrap; overflow: hidden; }
/* coluna booleana: checkbox clicavel (TBooleanField) */
.vw-grid td[onclick] { cursor: pointer; text-align: center; font-size: 15px; line-height: 1; }

/* seletor de arquivo (TOpenDialog) */
.vw-pick-file { width: 100%; min-width: 320px; padding: 6px 0; font: inherit; }

/* campos de data com o calendario do navegador */
input.vw-c[type=date], input.vw-c[type=time], input.vw-c[type=datetime-local] { padding: 0 4px; font: inherit; }