/*
 * File overview:
 * Path: src/VCGL.EPM.Web/wwwroot/assets/css/vcgl-components.css
 * Purpose: Stylesheet responsible for the visual rules of vcgl-components.
 */

/* ============================================================
   VCGL Components â€” NotificaÃ§Ãµes, Perfil, Tabela
   ============================================================ */

/* ---- Avatar chip (partilhado entre Gantt, Kanban, Projetos) ---- */
.av-chip {
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .58rem; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* ============================================================
   PAINEL DE NOTIFICAÃ‡Ã•ES (Offcanvas)
   ============================================================ */
.vcgl-notifications .offcanvas-header {
  background: linear-gradient(135deg, var(--vcgl-primary), #2a5888);
  color: #fff;
  border-bottom: none;
  padding: 1.1rem 1.25rem;
}
.vcgl-notifications .offcanvas-header .btn-close {
  filter: invert(1) brightness(2);
  opacity: .8;
}
.vcgl-notifications .offcanvas-title { font-size: .95rem; font-weight: 600; }
.vcgl-notifications .offcanvas-body { padding: 0; background: var(--app-bg); }

.notif-tabs {
  display: flex;
  border-bottom: 1px solid var(--app-border);
  background: var(--card-bg);
  padding: 0 1rem;
}
.notif-tab {
  border: none; background: none;
  padding: .65rem .75rem;
  font-size: .82rem; font-weight: 500;
  color: var(--app-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .2s;
}
.notif-tab.active { color: var(--vcgl-primary); border-bottom-color: var(--vcgl-primary); }

.notif-list { overflow-y: auto; max-height: calc(100vh - 160px); }

.notif-item {
  display: flex; gap: .75rem;
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--app-border);
  background: var(--card-bg);
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
}
.notif-item:hover { background: var(--app-bg); }
.notif-item.unread { background: rgba(26,60,94,.04); }
[data-theme="dark"] .notif-item.unread { background: rgba(26,60,94,.25); }

.notif-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; flex-shrink: 0;
}
.notif-body { flex: 1; min-width: 0; }
.notif-title {
  font-size: .83rem; font-weight: 600;
  color: var(--app-text); margin-bottom: .15rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-desc { font-size: .78rem; color: var(--app-text-muted); line-height: 1.4; }
.notif-time { font-size: .72rem; color: var(--app-text-muted); margin-top: .2rem; }
.notif-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--vcgl-primary); flex-shrink: 0; margin-top: .4rem;
}

.notif-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--app-border);
  text-align: center;
  background: var(--card-bg);
}
.notif-footer a {
  font-size: .8rem; font-weight: 500;
  color: var(--vcgl-primary); text-decoration: none;
}
.notif-footer a:hover { text-decoration: underline; }

/* Badge no sino */
.navbar-btn .notif-count {
  position: absolute; top: 4px; right: 4px;
  background: #e8a020; color: #fff;
  font-size: .6rem; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--navbar-bg);
}

/* ============================================================
   MODAL DETALHE DE ENCOMENDA
   ============================================================ */
.order-detail-section { margin-bottom: 1.25rem; }
.order-detail-section-title {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--app-text-muted);
  margin-bottom: .6rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--app-border);
}
.order-detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .75rem;
}
.order-detail-item label {
  display: block; font-size: .72rem;
  color: var(--app-text-muted); margin-bottom: .1rem;
}
.order-detail-item span {
  font-size: .84rem; font-weight: 500; color: var(--app-text);
}
.order-products-list { display: flex; flex-direction: column; gap: .5rem; }
.order-product-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem .75rem;
  background: var(--app-bg); border-radius: 8px;
}
.order-product-icon {
  width: 32px; height: 32px; border-radius: 6px;
  background: rgba(26,60,94,.1); color: var(--vcgl-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0;
}
.order-product-name { font-size: .84rem; font-weight: 500; color: var(--app-text); }
.order-product-sub  { font-size: .75rem; color: var(--app-text-muted); }
.order-product-price { font-size: .84rem; font-weight: 600; color: var(--app-text); margin-left: auto; }

/* Timeline */
.order-timeline { display: flex; flex-direction: column; gap: 0; }
.order-timeline-item {
  display: flex; gap: .75rem; position: relative;
  padding-bottom: .85rem;
}
.order-timeline-item:last-child { padding-bottom: 0; }
.order-timeline-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0; margin-top: .3rem; position: relative; z-index: 1;
}
.order-timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 4px; top: 14px;
  width: 2px; height: calc(100% - 10px);
  background: var(--app-border);
}
.order-timeline-text { font-size: .82rem; color: var(--app-text); font-weight: 500; }
.order-timeline-date { font-size: .75rem; color: var(--app-text-muted); }

/* ============================================================
   TABELA REUTILIZÃVEL â€” OrdenaÃ§Ã£o + PaginaÃ§Ã£o
   ============================================================ */
.vcgl-table th.sortable { cursor: pointer; user-select: none; }
.vcgl-table th.sortable:hover { color: var(--app-text-muted); }
.vcgl-table th .sort-icon {
  font-size: .65rem; margin-left: .3rem;
  color: var(--app-border); transition: color .2s;
}
.vcgl-table th.sort-asc  .sort-icon,
.vcgl-table th.sort-desc .sort-icon { color: var(--vcgl-primary); }

/* Redimensionamento de colunas */
.vcgl-table th { position: relative; text-align: center; }
.vcgl-col-resizer {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 6px; cursor: col-resize; z-index: 1;
  user-select: none;
}
.vcgl-col-resizer::after {
  content: ''; position: absolute;
  right: 2px; top: 15%; bottom: 15%;
  width: 1px; background: rgba(148,163,184,.35);
  transition: background .15s;
}
.vcgl-col-resizer:hover::after,
.vcgl-col-resizer.resizing::after { background: rgba(148,163,184,.75); }

/* Menu de contexto (botão direito na tabela) */
.vcgl-ctx-menu {
  position: fixed; z-index: 9999;
  /* --card-bg (nosso) e não --bs-body-bg: o fundo tem de seguir o tema da app, senão em modo nocturno
     o menu ficava branco com o texto claro por cima — ilegível. */
  background: var(--card-bg, #fff);
  color: var(--app-text);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.13);
  padding: .35rem 0;
  min-width: 200px;
  display: none;
}
.vcgl-ctx-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .42rem 1rem;
  font-size: .83rem;
  cursor: pointer;
  color: var(--app-text);
  user-select: none;
  white-space: nowrap;
}
.vcgl-ctx-item:hover { background: rgba(26,60,94,.06); }
.vcgl-ctx-item.warning { color: #d97706; }
.vcgl-ctx-item.warning:hover { background: rgba(217,119,6,.07); }
.vcgl-ctx-item.success { color: #10b981; }
.vcgl-ctx-item.success:hover { background: rgba(16,185,129,.07); }
/* Destrutivo a vermelho (convenção de cores) — faltava, pelo que "Remover" saía com a cor normal. */
.vcgl-ctx-item.danger { color: #dc2626; }
.vcgl-ctx-item.danger:hover { background: rgba(220,38,38,.07); }
.vcgl-ctx-divider { border: none; border-top: 1px solid var(--app-border); margin: .3rem 0; }
/* Nocturno: o realce escuro do modo diurno desaparece sobre fundo escuro — usa-se um véu claro.
   As cores semânticas (aviso/sucesso/perigo) são clareadas para manterem contraste. */
[data-theme="dark"] .vcgl-ctx-item:hover { background: rgba(255,255,255,.08); }
[data-theme="dark"] .vcgl-ctx-item.warning { color: #fbbf24; }
[data-theme="dark"] .vcgl-ctx-item.warning:hover { background: rgba(251,191,36,.12); }
[data-theme="dark"] .vcgl-ctx-item.success { color: #34d399; }
[data-theme="dark"] .vcgl-ctx-item.success:hover { background: rgba(52,211,153,.12); }
[data-theme="dark"] .vcgl-ctx-item.danger { color: #f87171; }
[data-theme="dark"] .vcgl-ctx-item.danger:hover { background: rgba(248,113,113,.12); }

/* Linha inactiva: opacidade só nas células de conteúdo, nunca na coluna de acções */
.vcgl-table tr.row-inactive > td:not(:last-child) { opacity: .5; }

/* Ações de linha — só ícone, sem borda */
.vcgl-row-action {
  background: none; border: none; padding: 0;
  font-size: 1rem; color: var(--app-text-muted);
  cursor: pointer; line-height: 1;
  transition: color .15s, opacity .15s;
  text-decoration: none;
}
.vcgl-row-action:hover { color: var(--vcgl-primary); opacity: 1; }

.table-pagination {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--app-border);
  flex-wrap: wrap; gap: .5rem;
}
/* Select com seta visÃ­vel em qualquer tema */
.vcgl-select {
  width: auto !important;
  border: 1.5px solid var(--app-border) !important;
  border-radius: 8px !important;
  color: var(--app-text) !important;
  font-size: .85rem !important;
  padding: .45rem 1.75rem .45rem .6rem !important;
  /* Manter o background-image da seta do Bootstrap, apenas mudar a cor de fundo */
  background-color: var(--app-bg) !important;
  transition: border-color .2s, background-color .2s;
}
.vcgl-select:focus {
  border-color: var(--vcgl-primary) !important;
  box-shadow: 0 0 0 3px rgba(26,60,94,.1) !important;
  background-color: var(--card-bg) !important;
}
[data-theme="dark"] .vcgl-select {
  /* Seta branca no tema escuro */
  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='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

.table-pagination-info { font-size: .8rem; color: var(--app-text-muted); }
.table-pagination-pages { display: flex; gap: .25rem; }
.page-btn {
  border: 1px solid var(--app-border);
  background: transparent; color: var(--app-text-muted);
  font-size: .8rem; font-weight: 500;
  padding: .25rem .6rem; border-radius: 6px;
  cursor: pointer; transition: all .15s; min-width: 32px;
}
.page-btn:hover:not(:disabled) { border-color: var(--vcgl-primary); color: var(--vcgl-primary); }
.page-btn.active { background: var(--vcgl-primary); border-color: var(--vcgl-primary); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   PÃGINA DE PERFIL
   ============================================================ */
.profile-avatar-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: .75rem; padding: 1.5rem;
  border-right: 1px solid var(--app-border);
}
.profile-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--vcgl-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; color: #fff;
  position: relative; cursor: pointer;
}
.profile-avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s; color: #fff; font-size: 1.1rem;
}
.profile-avatar:hover .profile-avatar-overlay { opacity: 1; }
.profile-name { font-size: 1rem; font-weight: 700; color: var(--app-text); }
.profile-role { font-size: .8rem; color: var(--app-text-muted); }
.profile-stats {
  display: flex; gap: 1.5rem; margin-top: .5rem;
  border-top: 1px solid var(--app-border);
  padding-top: .75rem; width: 100%;
}
.profile-stat { text-align: center; flex: 1; }
.profile-stat-value { font-size: 1.1rem; font-weight: 700; color: var(--app-text); }
.profile-stat-label { font-size: .72rem; color: var(--app-text-muted); }

.profile-section-title {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--app-text-muted); margin-bottom: 1rem;
  padding-bottom: .5rem; border-bottom: 1px solid var(--app-border);
}
.form-label-vcgl {
  font-size: .82rem; font-weight: 500; color: var(--app-text); margin-bottom: .35rem;
}
.form-control-vcgl {
  background: var(--app-bg); border: 1.5px solid var(--app-border);
  border-radius: 8px; color: var(--app-text);
  font-size: .875rem; padding: .55rem .875rem;
  transition: border-color .2s, background .2s; width: 100%;
}
.form-control-vcgl:focus {
  outline: none; border-color: var(--vcgl-primary);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(26,60,94,.1);
}
.btn-vcgl-save {
  background: var(--vcgl-primary); color: #fff;
  border: none; border-radius: 8px;
  padding: .6rem 1.5rem; font-size: .875rem; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.btn-vcgl-save:hover { background: #122d47; transform: translateY(-1px); }
.btn-vcgl-outline {
  background: transparent; color: var(--app-text-muted);
  border: 1.5px solid var(--app-border); border-radius: 8px;
  padding: .6rem 1.25rem; font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: all .2s;
}
.btn-vcgl-outline:hover { border-color: var(--vcgl-primary); color: var(--vcgl-primary); }

/* PreferÃªncias toggle */
.pref-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem 0; border-bottom: 1px solid var(--app-border);
}
.pref-row:last-child { border-bottom: none; }
.pref-label { font-size: .85rem; color: var(--app-text); }
.pref-desc  { font-size: .75rem; color: var(--app-text-muted); }
.form-switch .form-check-input { width: 2.2em; }
.form-check-input:checked { background-color: var(--vcgl-primary); border-color: var(--vcgl-primary); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#vcgl-toast-container {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 9999;
  display: flex; flex-direction: column; gap: .6rem;
  max-width: 360px; width: calc(100vw - 3rem);
  pointer-events: none;
}

.vcgl-toast {
  display: flex; align-items: flex-start; gap: .75rem;
  background: var(--card-bg);
  border: 1px solid var(--app-border);
  border-radius: 10px;
  padding: .85rem 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,.14);
  pointer-events: all;
  position: relative; overflow: hidden;
  opacity: 0; transform: translateX(24px);
  transition: opacity .25s ease, transform .25s ease;
}
.vcgl-toast.visible  { opacity: 1; transform: translateX(0); }
.vcgl-toast.hiding   { opacity: 0; transform: translateX(24px); }

.vcgl-toast-icon {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.vcgl-toast-body  { flex: 1; min-width: 0; padding-top: .1rem; }
.vcgl-toast-title { font-size: .84rem; font-weight: 600; color: var(--app-text); margin-bottom: .15rem; }
.vcgl-toast-msg   { font-size: .8rem; color: var(--app-text-muted); line-height: 1.4; }
.vcgl-toast-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.vcgl-toast-action {
  background: none; border: 1px solid var(--app-border);
  border-radius: 6px; padding: .2rem .6rem;
  font-size: .75rem; font-weight: 600; color: var(--vcgl-primary);
  cursor: pointer; transition: background .15s;
}
.vcgl-toast-action:hover { background: var(--app-bg); }

.vcgl-toast-close {
  background: none; border: none; color: var(--app-text-muted);
  font-size: 1rem; cursor: pointer; padding: 0; line-height: 1;
  flex-shrink: 0; margin-top: .1rem; transition: color .15s;
}
.vcgl-toast-close:hover { color: var(--app-text); }

/* Barra de progresso */
.vcgl-toast-progress {
  position: absolute; bottom: 0; left: 0;
  height: 3px; background: currentColor; opacity: .3;
  width: 100%;
  animation: toastProgress linear forwards;
  transform-origin: left;
}
@keyframes toastProgress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ============================================================
   MODAL DE CONFIRMAÃ‡ÃƒO
   ============================================================ */
.vcgl-confirm-content {
  background: var(--card-bg) !important;
  border: 1px solid var(--app-border) !important;
  border-radius: 14px !important;
  overflow: hidden;
}
.vcgl-confirm-body { padding: 1.75rem 1.5rem 1.5rem; text-align: center; }

.vcgl-confirm-icon-wrap {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin: 0 auto 1rem;
}
.vcgl-confirm-title {
  font-size: .95rem; font-weight: 700; color: var(--app-text);
  margin-bottom: .4rem;
}
.vcgl-confirm-msg {
  font-size: .82rem; color: var(--app-text-muted);
  margin-bottom: 1.25rem; line-height: 1.5;
}
.vcgl-confirm-actions { display: flex; flex-direction: row-reverse; gap: .5rem; }
.vcgl-confirm-ok, .vcgl-confirm-cancel { flex: 1; }
.vcgl-confirm-ok {
  border-radius: 8px; padding: .55rem 1rem;
  font-size: .875rem; font-weight: 600; cursor: pointer;
  transition: filter .15s, transform .1s;
}
.vcgl-confirm-ok:hover { filter: brightness(1.1); transform: translateY(-1px); }
.vcgl-confirm-cancel {
  background: transparent; border: 1.5px solid var(--app-border);
  border-radius: 8px; padding: .5rem 1rem;
  font-size: .875rem; font-weight: 500; color: var(--app-text-muted);
  cursor: pointer; transition: border-color .15s, color .15s;
}
.vcgl-confirm-cancel:hover { border-color: var(--app-text-muted); color: var(--app-text); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.vcgl-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 3.5rem 2rem; text-align: center;
}
.vcgl-empty-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--app-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; color: var(--app-text-muted);
  margin-bottom: 1rem; opacity: .7;
}
.vcgl-empty-title {
  font-size: .95rem; font-weight: 600; color: var(--app-text);
  margin-bottom: .35rem;
}
.vcgl-empty-desc {
  font-size: .82rem; color: var(--app-text-muted);
  max-width: 280px; line-height: 1.5; margin-bottom: 1.25rem;
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--app-border) 25%,
    var(--app-bg) 50%,
    var(--app-border) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
  display: block;
}
.skeleton-text  { height: .85rem; margin-bottom: .4rem; }
.skeleton-title { height: 1.2rem; width: 60%; margin-bottom: .75rem; }
.skeleton-circle { border-radius: 50%; }
.skeleton-btn   { height: 2rem; width: 100px; border-radius: 8px; }

/* Linhas de tabela skeleton */
.skeleton-row td { padding: .75rem 1rem; }
.skeleton-row .skeleton { height: .8rem; }

/* Skeleton line gerada pelo VCGLTable */
.skeleton-line {
  display: block; height: .75rem; border-radius: 4px;
  background: linear-gradient(90deg,
    var(--app-border) 25%, var(--app-bg) 50%, var(--app-border) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
}

/* ============================================================
   EMPTY STATE (dentro da tabela)
   ============================================================ */
.vcgl-empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 3rem 2rem; text-align: center;
}
.vcgl-empty-row td { padding: 0; border-bottom: none !important; }

/* ============================================================
   BULK ACTIONS BAR
   ============================================================ */
.bulk-action-bar {
  display: none;
  align-items: center; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap;
  padding: .65rem 1.25rem;
  background: var(--vcgl-primary);
  border-radius: var(--card-radius);
  margin-bottom: .75rem;
  animation: fadeIn .2s ease;
}
.bulk-action-bar.visible { display: flex; }

.bulk-count {
  font-size: .82rem; font-weight: 600; color: rgba(255,255,255,.9);
}
.bulk-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.bulk-btn {
  background: rgba(255,255,255,.15); color: #fff;
  border: 1px solid rgba(255,255,255,.25); border-radius: 6px;
  padding: .3rem .75rem; font-size: .78rem; font-weight: 500;
  cursor: pointer; transition: background .15s;
  display: inline-flex; align-items: center; gap: .3rem;
}
.bulk-btn:hover  { background: rgba(255,255,255,.28); }
.bulk-btn.danger { background: rgba(220,38,38,.3); border-color: rgba(220,38,38,.5); }
.bulk-btn.danger:hover { background: rgba(220,38,38,.5); }
.bulk-btn.ghost  { background: transparent; }
.bulk-btn.ghost:hover { background: rgba(255,255,255,.1); }

/* ============================================================
   DATE RANGE FILTER
   ============================================================ */
.date-filter-wrap {
  display: flex; align-items: center; gap: .4rem; flex: none;
}
.date-filter-wrap label {
  font-size: .78rem; color: var(--app-text-muted); white-space: nowrap;
}
.date-filter-wrap input[type="date"] {
  background: var(--app-bg); border: 1.5px solid var(--app-border);
  border-radius: 8px; color: var(--app-text);
  font-size: .82rem; padding: .42rem .6rem;
  transition: border-color .2s; cursor: pointer;
}
.date-filter-wrap input[type="date"]:focus {
  outline: none; border-color: var(--vcgl-primary);
  box-shadow: 0 0 0 3px rgba(26,60,94,.1);
}
[data-theme="dark"] .date-filter-wrap input[type="date"] {
  color-scheme: dark;
}

/* ============================================================
   MOBILE â€” Melhorias especÃ­ficas de componentes
   ============================================================ */
@media (max-width: 767px) {
  .bulk-action-bar.visible {
    position: fixed; bottom: 0; left: 0; right: 0;
    border-radius: 0; z-index: 1050;
    border-top: 1px solid rgba(255,255,255,.15);
  }
  .date-filter-wrap { flex: 1 1 100%; }
  .date-filter-wrap input[type="date"] { flex: 1; }
}

/* ============================================================
   PRINT
   ============================================================ */
/* As regras de impressão mudaram-se para wwwroot/assets/css/vcgl-print.css, que é carregado depois
   desta folha. Estavam aqui, e ao mesmo tempo no _Layout e na página das evidências: três blocos que
   não sabiam uns dos outros, e um documento impresso corrigido só num deles. */

/* ============================================================
   VCGL SEARCH â€” Overlay global (Ctrl+K)
   ============================================================ */
#vcgl-search-overlay {
  position: fixed; inset: 0; z-index: 9998;
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 10vh;
}
#vcgl-search-overlay.visible { display: flex; }

.vcgl-search-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  animation: fadeIn .15s ease;
}

.vcgl-search-box {
  position: relative; z-index: 1;
  width: 100%; max-width: 560px;
  background: var(--card-bg);
  border: 1px solid var(--app-border);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  overflow: hidden;
  animation: searchSlideIn .18s ease;
  margin: 0 1rem;
}

@keyframes searchSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)     scale(1);   }
}

.vcgl-search-input-wrap {
  display: flex; align-items: center; gap: .75rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--app-border);
}
.vcgl-search-icon { font-size: 1.1rem; color: var(--app-text-muted); flex-shrink: 0; }

.vcgl-search-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 1rem; color: var(--app-text);
  font-family: inherit;
}
.vcgl-search-input::placeholder { color: var(--app-text-muted); }

.vcgl-search-esc-badge {
  background: var(--app-bg); border: 1px solid var(--app-border);
  border-radius: 5px; padding: .15rem .5rem;
  font-size: .7rem; color: var(--app-text-muted);
  font-family: inherit;
}

.vcgl-search-results {
  max-height: 360px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--app-border) transparent;
}

.vcgl-search-group { padding: .4rem 0; }
.vcgl-search-group + .vcgl-search-group { border-top: 1px solid var(--app-border); }

.vcgl-search-group-label {
  padding: .5rem 1.1rem .25rem;
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px;
  color: var(--app-text-muted);
}

.vcgl-search-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1.1rem;
  text-decoration: none; color: var(--app-text);
  transition: background .1s;
  cursor: pointer;
}
.vcgl-search-item:hover,
.vcgl-search-item.active { background: var(--app-bg); }

.vcgl-search-item-icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: rgba(26,60,94,.1); color: var(--vcgl-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
}
[data-theme="dark"] .vcgl-search-item-icon { background: rgba(255,255,255,.07); color: #94a3b8; }

.vcgl-search-item-body { flex: 1; min-width: 0; }
.vcgl-search-item-label { font-size: .875rem; font-weight: 500; }
.vcgl-search-item-desc  { font-size: .75rem; color: var(--app-text-muted); }

.vcgl-search-mark {
  background: rgba(232,160,32,.3); color: inherit;
  border-radius: 2px; padding: 0 1px;
}

.vcgl-search-enter-icon {
  font-size: .8rem; color: var(--app-text-muted);
  opacity: 0; transition: opacity .1s;
}
.vcgl-search-item.active .vcgl-search-enter-icon { opacity: 1; }

.vcgl-search-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 2.5rem 1rem; gap: .6rem; color: var(--app-text-muted);
  font-size: .875rem;
}
.vcgl-search-empty i { font-size: 2rem; opacity: .4; }

.vcgl-search-footer {
  display: flex; gap: 1.25rem; justify-content: center;
  padding: .6rem 1.1rem;
  border-top: 1px solid var(--app-border);
  background: var(--app-bg);
}
.vcgl-search-footer span { font-size: .72rem; color: var(--app-text-muted); display: flex; align-items: center; gap: .3rem; }
.vcgl-search-footer kbd {
  background: var(--card-bg); border: 1px solid var(--app-border);
  border-radius: 4px; padding: .1rem .4rem;
  font-size: .65rem; font-family: inherit; color: var(--app-text-muted);
}

/* ============================================================
   VCGL DRAWER â€” Painel lateral deslizante
   ============================================================ */
.vcgl-drawer-backdrop {
  position: fixed; inset: 0; z-index: 1045;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.vcgl-drawer-backdrop.visible { opacity: 1; pointer-events: all; }

.vcgl-drawer {
  position: fixed; top: 0; bottom: 0; right: 0;
  z-index: 1046;
  width: 440px; max-width: 100vw;
  background: var(--card-bg);
  border-left: 1px solid var(--app-border);
  box-shadow: -8px 0 32px rgba(0,0,0,.15);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.vcgl-drawer.open { transform: translateX(0); }

.vcgl-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--app-border);
  background: linear-gradient(135deg, var(--vcgl-primary), #2a5888);
  flex-shrink: 0;
}
.vcgl-drawer-title { font-size: .95rem; font-weight: 700; color: #fff; margin: 0; }
.vcgl-drawer-close {
  background: rgba(255,255,255,.15); border: none;
  border-radius: 6px; color: #fff;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s; flex-shrink: 0;
}
.vcgl-drawer-close:hover { background: rgba(255,255,255,.28); }

.vcgl-drawer-body {
  flex: 1; overflow-y: auto; padding: 1.25rem;
  scrollbar-width: thin; scrollbar-color: var(--app-border) transparent;
}

.vcgl-drawer-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--app-border);
  background: var(--app-bg);
  display: flex; gap: .5rem; justify-content: flex-end;
  flex-shrink: 0;
}

@media (max-width: 575px) {
  .vcgl-drawer { width: 100vw !important; border-left: none; }
}

/* ============================================================
   AVATAR GROUP + BADGES
   ============================================================ */
.avatar-group {
  display: flex; align-items: center;
}
.avatar-group .avatar-item {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--vcgl-primary); color: #fff;
  font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--card-bg);
  margin-left: -8px; flex-shrink: 0;
  transition: transform .15s, z-index 0s;
  position: relative; cursor: default;
}
.avatar-group .avatar-item:first-child { margin-left: 0; }
.avatar-group .avatar-item:hover { transform: translateY(-3px); z-index: 1; }
.avatar-group .avatar-item.avatar-more {
  background: var(--app-bg); color: var(--app-text-muted);
  border-color: var(--app-border); font-size: .68rem;
}

/* Avatar sizes */
.avatar-sm .avatar-item { width: 24px; height: 24px; font-size: .6rem; }
.avatar-lg .avatar-item { width: 40px; height: 40px; font-size: .8rem; }
.avatar-xl .avatar-item { width: 48px; height: 48px; font-size: .9rem; }

/* Avatar colour variants */
.avatar-green  { background: #16a34a !important; }
.avatar-orange { background: #d97706 !important; }
.avatar-red    { background: #dc2626 !important; }
.avatar-purple { background: #7c3aed !important; }
.avatar-teal   { background: #0d9488 !important; }

/* Status dot on avatar */
.avatar-status-wrap { position: relative; display: inline-flex; }
.avatar-status {
  position: absolute; bottom: 1px; right: 1px;
  width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid var(--card-bg);
}
.avatar-status.online  { background: #16a34a; }
.avatar-status.away    { background: #d97706; }
.avatar-status.offline { background: var(--app-border); }
.avatar-status.busy    { background: #dc2626; }

/* ---- Badges ---- */
.vcgl-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .72rem; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; line-height: 1.4;
  white-space: nowrap;
}
.vcgl-badge-primary { background: rgba(26,60,94,.12);  color: var(--vcgl-primary); }
.vcgl-badge-success { background: rgba(22,163,74,.12);  color: #16a34a; }
.vcgl-badge-warning { background: rgba(217,119,6,.12);  color: #d97706; }
.vcgl-badge-danger  { background: rgba(220,38,38,.12);  color: #dc2626; }
.vcgl-badge-info    { background: rgba(37,99,235,.12);  color: #2563eb; }
.vcgl-badge-neutral { background: var(--app-bg); color: var(--app-text-muted); border: 1px solid var(--app-border); }

/* Counter badge (nÃºmero num elemento) */
.vcgl-counter {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: 9px;
  padding: 0 4px; font-size: .65rem; font-weight: 700; line-height: 1;
  background: #dc2626; color: #fff;
}
.vcgl-counter.primary { background: var(--vcgl-primary); }
.vcgl-counter.warning { background: #d97706; }

/* ============================================================
   MASTER-DETAIL PATTERN
   ============================================================ */

/* Master — zona de scroll da tabela */
.vcgl-master-scroll {
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--app-border) transparent;
}
.vcgl-master-scroll::-webkit-scrollbar       { width: 5px; }
.vcgl-master-scroll::-webkit-scrollbar-thumb { background: var(--app-border); border-radius: 3px; }

/* Linha seleccionada */
.vcgl-md-row { cursor: pointer; }
.vcgl-md-selected td {
  background: rgba(26,60,94,0.06) !important;
}
.vcgl-md-selected td:first-child {
  border-left: 3px solid var(--vcgl-primary);
  padding-left: calc(1rem - 3px);
}
[data-theme="dark"] .vcgl-md-selected td { background: rgba(26,60,94,0.25) !important; }

/* Detail panel */
.vcgl-detail-panel { display: none; }
.vcgl-detail-panel.is-open {
  display: block;
  animation: vcglDetailIn 0.22s ease;
}
@keyframes vcglDetailIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Skeleton genérico (usado no loading do detail) */
.vcgl-skel {
  background: linear-gradient(90deg,
    var(--app-border) 25%,
    color-mix(in srgb, var(--app-border) 60%, var(--card-bg)) 50%,
    var(--app-border) 75%);
  background-size: 200% 100%;
  animation: vcglSkelShimmer 1.4s infinite linear;
  border-radius: 4px;
}
@keyframes vcglSkelShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
.vcgl-counter.success { background: #16a34a; }

/* ============================================================
   DIAS DE USO (alocação de recurso a uma tarefa)
   Chip na linha da alocação + mini-calendário de marcação. Estilos em CSS (e não inline no JS) para
   seguirem o tema — no modo nocturno os tons claros ficavam ilegíveis.
   ============================================================ */
.vcgl-chip-dias-uso {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 12px; padding: 2px 9px; font-size: 11px;
  background: var(--app-bg); color: var(--app-text-muted);
  border: 1px solid var(--app-border);
  cursor: pointer;
}
.vcgl-chip-dias-uso.marcado { background: #e7f0ff; color: #1a3c5e; border-color: #cfe0f7; font-weight: 600; }
.vcgl-chip-dias-uso.inactivo { cursor: not-allowed; opacity: .65; }
/* O chip é clicável: escurece ligeiramente ao passar o rato, como os botões. */
.vcgl-chip-dias-uso:not(.inactivo):hover { background: #e4e9f0; }
.vcgl-chip-dias-uso.marcado:not(.inactivo):hover { background: #d3e3fa; border-color: #b9d4f5; }
[data-theme="dark"] .vcgl-chip-dias-uso { background: rgba(255,255,255,.05); }
[data-theme="dark"] .vcgl-chip-dias-uso:not(.inactivo):hover { background: rgba(255,255,255,.12); }
[data-theme="dark"] .vcgl-chip-dias-uso.marcado { background: rgba(59,130,246,.18); color: #93c5fd; border-color: rgba(59,130,246,.4); }
[data-theme="dark"] .vcgl-chip-dias-uso.marcado:not(.inactivo):hover { background: rgba(59,130,246,.30); border-color: rgba(59,130,246,.55); }

.vcgl-dias-uso-popover {
  position: fixed; z-index: 1080;
  background: var(--card-bg, #fff); color: var(--app-text);
  border: 1px solid var(--app-border);
  border-radius: 8px; padding: 14px;
  min-width: 280px; max-width: 340px; max-height: 420px;
  overflow: auto; font-size: 13px;
}
/* Fundo da marcacao de dias: enquanto a janelinha esta aberta, o resto do ecra nao aceita cliques (z-index
   logo abaixo do popover, e acima do modal do Bootstrap, que fica em 1055). Marcar dias sao muitos cliques
   e antes um deles ao lado apagava a marcacao inteira em silencio. O escurecimento e leve: e um sub-dialogo
   dentro de um modal, nao um modal novo. */
.vcgl-du-fundo { position: fixed; inset: 0; z-index: 1079; background: rgba(0,0,0,.10); }
[data-theme="dark"] .vcgl-du-fundo { background: rgba(0,0,0,.28); }
.vcgl-du-grelha { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; font-size: 11px; }
.vcgl-du-dia {
  text-align: center; padding: 5px 0; border-radius: 5px; cursor: pointer;
  background: var(--app-bg); color: var(--app-text);
}
.vcgl-du-dia.on { background: #1a3c5e; color: #fff; font-weight: 600; }
.vcgl-du-dia.fora { background: transparent; color: var(--app-text-muted); opacity: .45; cursor: not-allowed; }
.vcgl-du-contagem { background: #e7f0ff; color: #1a3c5e; font-weight: 600; }
/* Contagem que ainda nao fecha com o alvo (ex.: 10 de 16 dias): ambar, a par da nota que diz quantos faltam.
   Azul em "10 / 16" lia-se como se estivesse tudo bem e o "Aplicar" travado parecia avaria. */
.vcgl-du-contagem.incompleta { background: #fef3c7; color: #92400e; }
[data-theme="dark"] .vcgl-du-contagem.incompleta { background: rgba(245,158,11,.20); color: #fcd34d; }
/* Cores pelas variáveis --bs-btn-* (e não por background/color directos): é assim que o .btn do Bootstrap
   resolve TODOS os estados. Com o fundo escrito à mão o :hover caía numa variável inexistente e o botão
   ficava transparente — lia-se como "ficou branco" — em vez de escurecer como os outros botões. */
.vcgl-du-seguidos {
  --bs-btn-color: #1a3c5e;            --bs-btn-bg: #e7f0ff;            --bs-btn-border-color: #cfe0f7;
  --bs-btn-hover-color: #14304c;      --bs-btn-hover-bg: #d3e3fa;      --bs-btn-hover-border-color: #b9d4f5;
  --bs-btn-active-color: #14304c;     --bs-btn-active-bg: #c2d8f7;     --bs-btn-active-border-color: #a9c9f2;
  font-weight: 600; white-space: normal;
}
[data-theme="dark"] .vcgl-du-dia { background: rgba(255,255,255,.06); }
[data-theme="dark"] .vcgl-du-dia:hover:not(.fora) { background: rgba(255,255,255,.14); }
[data-theme="dark"] .vcgl-du-dia.on { background: #3b82f6; color: #fff; }
[data-theme="dark"] .vcgl-du-contagem { background: rgba(59,130,246,.18); color: #93c5fd; }
[data-theme="dark"] .vcgl-du-seguidos {
  --bs-btn-color: #93c5fd;            --bs-btn-bg: rgba(59,130,246,.15); --bs-btn-border-color: rgba(59,130,246,.40);
  --bs-btn-hover-color: #bfdbfe;      --bs-btn-hover-bg: rgba(59,130,246,.28); --bs-btn-hover-border-color: rgba(59,130,246,.55);
  --bs-btn-active-color: #dbeafe;     --bs-btn-active-bg: rgba(59,130,246,.36); --bs-btn-active-border-color: rgba(59,130,246,.65);
}

/* ── Elevador nas tabelas longas ─────────────────────────────────────────────────
   Uma tabela dentro de .tabela-scroll rola DENTRO do seu cartao, em vez de obrigar a
   correr a pagina inteira para chegar ao que vem depois (queixa do utilizador em
   2026-08-09, no Cashflow). O cabecalho fica preso no topo do elevador e o rodape com
   os totais preso no fundo, para as colunas e a soma continuarem legiveis ao rolar. */
.tabela-scroll { max-height: 22rem; overflow-y: auto; }
.tabela-scroll-alta { max-height: 34rem; }

/* NAO mexer no fundo do cabecalho. O .vcgl-table th ja tem fundo proprio e opaco (azul escuro, com texto
   claro por cima), portanto nao ha linhas a passar por tras. Uma primeira versao deste bloco punha aqui
   background: var(--card-bg), que por ter mais especificidade tapava o azul e deixava o texto claro do
   cabecalho quase branco sobre branco — lia-se como "a fonte esta muito clara". */
.tabela-scroll > table > thead > tr > th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.tabela-scroll > table > tfoot > tr > td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--card-bg);
  box-shadow: 0 -1px 0 var(--app-border);
}

/* ── Sufixo da unidade na quantidade de uma alocacao ─────────────────────────────
   O "h" / "dias" / "un." ao lado da quantidade, dentro de uma celula de tabela
   estreita. Padding e fonte apertados porque ali dentro tambem vivem os digitos e
   as setas do campo numerico - com o padding normal do Bootstrap, uma quantidade de
   tres digitos aparecia cortada. */
.qtd-unidade {
  padding-left: .4rem;
  padding-right: .4rem;
  font-size: .78rem;
}

/* ── Origem dos valores do cashflow ──────────────────────────────────────────────
   Colunas "Origem das entradas" / "Origem das saidas" no detalhe por periodo: uma
   linha por origem dentro da propria celula. Fica na linha do periodo de proposito —
   num portatil, um cartao de detalhe a parte obrigava a saltar na pagina a cada
   periodo que se quisesse ler. */
.cf-origens { font-size: .78rem; line-height: 1.4; }

.cf-mov { display: flex; align-items: baseline; gap: .4rem; }

/* A celula diz a NATUREZA e o NOME do que originou o movimento - tarefa, marco, recebimento
   ou despesa. Sem quem executa (varios recursos de uma tarefa aparecem como a tarefa) e sem
   valor, que esta na coluna ao lado. O nome corta com reticencias e o title leva o completo. */
.cf-mov-tipo { flex: 0 0 auto; font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; }
.cf-mov-nome { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Periodo com varias origens: a celula fecha-se num resumo por natureza ("2 despesas + 12
   tarefas") e a linha abre nas suas parcelas. */
.cf-resumo { display: inline-flex; align-items: baseline; }
.cf-abrivel { cursor: pointer; }

/* Linhas-filhas: os movimentos do periodo, um por linha, na mesma grelha da linha-mae para os
   valores ficarem debaixo dos totais que compoem. Fundo da pagina (nao do cartao) para se
   perceber que sao detalhe de quem esta acima, nos dois temas. */
.cf-filha > td { background: var(--app-bg); font-size: .78rem; padding-top: .2rem; padding-bottom: .2rem; }
.cf-filha > td:first-child { padding-left: 1.75rem; color: var(--text-muted, #64748b); }
.cf-filha-data { white-space: nowrap; font-variant-numeric: tabular-nums; }
