/**
 * @file        public/css/main.css
 * @module      SPA / Design System
 * @description Design system completo do CIGIP Pro.
 *              Organizado em camadas:
 *                1. Tokens CSS (custom properties) — fonte única de verdade
 *                2. Reset moderno
 *                3. Tipografia
 *                4. Layout (container, grid, flex utilities)
 *                5. Componentes base (button, input, card, badge, table)
 *                6. Utilitários
 *                7. Dark mode (variáveis preparadas — ativado via WBS 1.2.6)
 *                8. Animações e transições
 * @version     0.1.0
 * @author      Dypo / Cleberson Machado
 * @created     2026-05-29
 * @updated     2026-05-29
 *
 * Changelog:
 *   0.1.0 (2026-05-29) — Design system inicial: tokens, reset, tipografia,
 *                         layout, componentes base e utilitários
 */

/* =============================================================
   1. TOKENS CSS — Custom Properties
   Toda cor, tamanho e espaçamento deve vir daqui.
   Para mudar o visual global: altere apenas esta seção.
   ============================================================= */
:root {

  /* --- Paleta de cores base -------------------------------- */
  --color-primary-50:  #EFF6FF;
  --color-primary-100: #DBEAFE;
  --color-primary-200: #BFDBFE;
  --color-primary-300: #93C5FD;
  --color-primary-400: #60A5FA;
  --color-primary-500: #3B82F6;
  --color-primary-600: #2563EB;   /* principal */
  --color-primary-700: #1D4ED8;
  --color-primary-800: #1E40AF;
  --color-primary-900: #1E3A8A;

  --color-success-50:  #F0FDF4;
  --color-success-100: #DCFCE7;
  --color-success-500: #22C55E;
  --color-success-600: #16A34A;
  --color-success-700: #15803D;

  --color-warning-50:  #FFFBEB;
  --color-warning-100: #FEF3C7;
  --color-warning-500: #F59E0B;
  --color-warning-600: #D97706;
  --color-warning-700: #B45309;

  --color-danger-50:   #FFF1F2;
  --color-danger-100:  #FFE4E6;
  --color-danger-500:  #EF4444;
  --color-danger-600:  #DC2626;
  --color-danger-700:  #B91C1C;

  --color-neutral-0:   #FFFFFF;
  --color-neutral-50:  #F8FAFC;
  --color-neutral-100: #F1F5F9;
  --color-neutral-200: #E2E8F0;
  --color-neutral-300: #CBD5E1;
  --color-neutral-400: #94A3B8;
  --color-neutral-500: #64748B;
  --color-neutral-600: #475569;
  --color-neutral-700: #334155;
  --color-neutral-800: #1E293B;
  --color-neutral-900: #0F172A;
  --color-neutral-950: #020617;

  /* --- Tokens semânticos (modo claro) --------------------- */
  --bg-app:          var(--color-neutral-50);
  --bg-surface:      var(--color-neutral-0);
  --bg-surface-2:    var(--color-neutral-100);
  --bg-surface-3:    var(--color-neutral-200);

  --text-primary:    var(--color-neutral-900);
  --text-secondary:  var(--color-neutral-600);
  --text-muted:      var(--color-neutral-400);
  --text-inverse:    var(--color-neutral-0);
  --text-link:       var(--color-primary-600);
  --text-link-hover: var(--color-primary-700);

  --border-subtle:   var(--color-neutral-200);
  --border-default:  var(--color-neutral-300);
  --border-strong:   var(--color-neutral-400);
  --border-focus:    var(--color-primary-500);

  --shadow-sm:  0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md:  0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl:  0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.05);

  /* --- Sidebar -------------------------------------------- */
  --sidebar-bg:       var(--color-neutral-900);
  --sidebar-width:    240px;
  --sidebar-collapsed:64px;
  --sidebar-text:     var(--color-neutral-400);
  --sidebar-text-active: var(--color-neutral-0);
  --sidebar-item-hover: var(--color-neutral-800);
  --sidebar-item-active: var(--color-primary-600);

  /* --- Header --------------------------------------------- */
  --header-height:    56px;
  --header-bg:        var(--color-neutral-0);
  --header-border:    var(--border-subtle);

  /* --- Tipografia ----------------------------------------- */
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas',
               'Courier New', monospace;

  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */

  --leading-tight:  1.25;
  --leading-normal: 1.5;
  --leading-relaxed:1.625;

  --font-regular: 400;
  --font-medium:  500;
  --font-semibold:600;
  --font-bold:    700;

  /* --- Espaçamento (base 4px) ----------------------------- */
  --space-1:  0.25rem;   /* 4px  */
  --space-2:  0.5rem;    /* 8px  */
  --space-3:  0.75rem;   /* 12px */
  --space-4:  1rem;      /* 16px */
  --space-5:  1.25rem;   /* 20px */
  --space-6:  1.5rem;    /* 24px */
  --space-8:  2rem;      /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */

  /* --- Bordas e raios ------------------------------------- */
  --radius-sm:   0.25rem;   /* 4px  */
  --radius-md:   0.375rem;  /* 6px  */
  --radius-lg:   0.5rem;    /* 8px  */
  --radius-xl:   0.75rem;   /* 12px */
  --radius-2xl:  1rem;      /* 16px */
  --radius-full: 9999px;

  /* --- Transições ----------------------------------------- */
  --transition-fast:   150ms ease;
  --transition-base:   200ms ease;
  --transition-slow:   300ms ease;

  /* --- Z-index -------------------------------------------- */
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;

  /* --- Aliases de conveniência (compatibilidade) ---------- */
  --surface-1: var(--bg-surface);
  --surface-2: var(--bg-surface-2);
  --surface-3: var(--bg-surface-3);
  --border:    var(--border-default);
}

/* =============================================================
   2. RESET MODERNO
   ============================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--text-link);
  text-decoration: none;
}
a:hover {
  color: var(--text-link-hover);
  text-decoration: underline;
}

ul, ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* =============================================================
   3. TIPOGRAFIA
   ============================================================= */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl);  }
h4 { font-size: var(--text-lg);  }
h5 { font-size: var(--text-base);}
h6 { font-size: var(--text-sm);  }

p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

small {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-surface-2);
  border-radius: var(--radius-sm);
}

code {
  padding: 0.1em 0.35em;
}

pre {
  padding: var(--space-4);
  overflow-x: auto;
}

/* =============================================================
   4. LAYOUT
   ============================================================= */

/* --- App shell --------------------------------------------- */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- Sidebar ----------------------------------------------- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition-slow);
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

/* Sidebar colapsada: ocultar labels, centralizar ícones */
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-section-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: var(--space-3);
  position: relative;
}

.sidebar.collapsed .sidebar-logo {
  justify-content: center;
}

/* Tooltip quando colapsado */
.sidebar.collapsed .sidebar-item::after {
  content: attr(aria-label);
  position: absolute;
  left: calc(var(--sidebar-collapsed) + var(--space-2));
  background: var(--color-neutral-800);
  color: var(--color-neutral-0);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: var(--z-dropdown);
  box-shadow: var(--shadow-md);
}

.sidebar.collapsed .sidebar-item:hover::after {
  opacity: 1;
  transform: translateX(0);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4);
  height: var(--header-height);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: var(--color-neutral-0);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-3) 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border-radius: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
}

.sidebar-item:hover {
  background: var(--sidebar-item-hover);
  color: var(--sidebar-text-active);
}

.sidebar-item.active {
  background: var(--sidebar-item-active);
  color: var(--sidebar-text-active);
}

.sidebar-item .icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.sidebar-item.active .icon {
  opacity: 1;
}

.sidebar-section-label {
  padding: var(--space-4) var(--space-4) var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-neutral-600);
  white-space: nowrap;
  overflow: hidden;
}

/* --- Área principal --------------------------------------- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Header ----------------------------------------------- */
.app-header {
  height: var(--header-height);
  min-height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  box-shadow: var(--shadow-sm);
  z-index: var(--z-sticky);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.breadcrumb-item {
  color: var(--text-muted);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: var(--font-medium);
}

.breadcrumb-sep {
  color: var(--border-default);
}

/* --- Área de conteúdo ------------------------------------- */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

/* --- Container -------------------------------------------- */
.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
}

/* --- Grid ------------------------------------------------- */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }

/* =============================================================
   5. COMPONENTES BASE
   ============================================================= */

/* --- Card ------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}

/* --- Botões ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: 1.5;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast),
              box-shadow var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Variantes */
.btn-primary {
  background: var(--color-primary-600);
  color: var(--color-neutral-0);
  border-color: var(--color-primary-600);
}
.btn-primary:hover {
  background: var(--color-primary-700);
  border-color: var(--color-primary-700);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover {
  background: var(--bg-surface-2);
}

.btn-danger {
  background: var(--color-danger-600);
  color: var(--color-neutral-0);
  border-color: var(--color-danger-600);
}
.btn-danger:hover {
  background: var(--color-danger-700);
  border-color: var(--color-danger-700);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.btn-success {
  background: var(--color-success-600);
  color: var(--color-neutral-0);
  border-color: var(--color-success-600);
}
.btn-success:hover {
  background: var(--color-success-700);
  border-color: var(--color-success-700);
}

/* Tamanhos */
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

.btn-icon {
  padding: var(--space-2);
  width: 36px;
  height: 36px;
}

/* --- Inputs ----------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.form-label.required::after {
  content: ' *';
  color: var(--color-danger-500);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--color-danger-500);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger-600);
}

/* --- Badge ------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.125rem var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-primary {
  background: var(--color-primary-100);
  color: var(--color-primary-700);
}
.badge-success {
  background: var(--color-success-100);
  color: var(--color-success-700);
}
.badge-warning {
  background: var(--color-warning-100);
  color: var(--color-warning-700);
}
.badge-danger {
  background: var(--color-danger-100);
  color: var(--color-danger-700);
}
.badge-neutral {
  background: var(--color-neutral-100);
  color: var(--color-neutral-700);
}

/* Badges de status de projeto */
.badge-planejamento { background: var(--color-neutral-100);  color: var(--color-neutral-700); }
.badge-em-andamento { background: var(--color-primary-100);  color: var(--color-primary-700); }
.badge-concluido    { background: var(--color-success-100);  color: var(--color-success-700); }
.badge-suspenso     { background: var(--color-warning-100);  color: var(--color-warning-700); }
.badge-cancelado    { background: var(--color-danger-100);   color: var(--color-danger-700);  }

/* --- Tabela ----------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  font-size: var(--text-sm);
}

.table thead {
  background: var(--bg-surface-2);
}

.table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table td {
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover td {
  background: var(--bg-surface-2);
}

.table-empty {
  text-align: center;
  padding: var(--space-12);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* --- Alerts / Avisos -------------------------------------- */
.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-sm);
}

.alert-info    { background: var(--color-primary-50); border-color: var(--color-primary-200); color: var(--color-primary-800); }
.alert-success { background: var(--color-success-50); border-color: var(--color-success-100); color: var(--color-success-700); }
.alert-warning { background: var(--color-warning-50); border-color: var(--color-warning-100); color: var(--color-warning-700); }
.alert-danger  { background: var(--color-danger-50);  border-color: var(--color-danger-100);  color: var(--color-danger-700);  }

/* --- Divisor ---------------------------------------------- */
.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-4) 0;
}

/* --- Spinner ---------------------------------------------- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-top-color: var(--color-primary-600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

/* --- Splash screen --------------------------------------- */
#splash-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  height: 100vh;
  background: var(--bg-app);
  color: var(--text-muted);
  font-size: var(--text-base);
}

/* =============================================================
   6. UTILITÁRIOS
   ============================================================= */

/* Display */
.hidden   { display: none !important; }
.flex     { display: flex; }
.inline-flex { display: inline-flex; }
.block    { display: block; }
.grid-display { display: grid; }

/* Flexbox */
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-between{ justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end    { justify-content: flex-end; }
.flex-1         { flex: 1; }
.flex-wrap      { flex-wrap: wrap; }
.flex-col       { flex-direction: column; }
.gap-1  { gap: var(--space-1); }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }

/* Espaçamento */
.p-4  { padding: var(--space-4); }
.p-6  { padding: var(--space-6); }
.px-4 { padding-inline: var(--space-4); }
.py-2 { padding-block: var(--space-2); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.ml-auto { margin-left: auto; }

/* Texto */
.text-xs      { font-size: var(--text-xs); }
.text-sm      { font-size: var(--text-sm); }
.text-base    { font-size: var(--text-base); }
.text-lg      { font-size: var(--text-lg); }
.text-xl      { font-size: var(--text-xl); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary-color { color: var(--color-primary-600); }
.text-danger  { color: var(--color-danger-600); }
.text-success { color: var(--color-success-600); }
.font-medium  { font-weight: var(--font-medium); }
.font-semibold{ font-weight: var(--font-semibold); }
.font-bold    { font-weight: var(--font-bold); }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

/* Bordas */
.rounded     { border-radius: var(--radius-md); }
.rounded-lg  { border-radius: var(--radius-lg); }
.rounded-full{ border-radius: var(--radius-full); }
.border      { border: 1px solid var(--border-default); }

/* Largura */
.w-full { width: 100%; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* =============================================================
   7. DARK MODE
   Ativado adicionando [data-theme="dark"] ao <html>.
   Implementado em WBS 1.2.6 (toggle + localStorage).
   ============================================================= */
[data-theme="dark"] {
  --bg-app:        var(--color-neutral-950);
  --bg-surface:    var(--color-neutral-900);
  --bg-surface-2:  var(--color-neutral-800);
  --bg-surface-3:  var(--color-neutral-700);

  --text-primary:  var(--color-neutral-50);
  --text-secondary:var(--color-neutral-400);
  --text-muted:    var(--color-neutral-600);

  --border-subtle: var(--color-neutral-800);
  --border-default:var(--color-neutral-700);
  --border-strong: var(--color-neutral-600);

  --header-bg:     var(--color-neutral-900);
  --header-border: var(--color-neutral-800);

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
}

/* =============================================================
   8. ANIMAÇÕES
   ============================================================= */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in-right {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slide-in-left {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

.animate-fade-in    { animation: fade-in 200ms ease forwards; }
.animate-slide-right{ animation: slide-in-right 250ms ease forwards; }

/* =============================================================
   9. RESPONSIVIDADE
   ============================================================= */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: var(--z-overlay);
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .page-content {
    padding: var(--space-4);
  }

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

/* =============================================================
   PAGE HEADER — padrão de cabeçalho de página
   Uso: <div class="page-header"><div class="page-header-info">
          <h1>Projetos</h1><p>Descrição</p></div>
        <div class="page-header-actions"><button>...</button></div></div>
   ============================================================= */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.page-header-info h1 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

.page-header-info p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* --- Stats cards ------------------------------------------- */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.stat-delta {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.stat-delta.up   { color: var(--color-success-600); }
.stat-delta.down { color: var(--color-danger-600); }

/* --- Tema claro/escuro — ícone do botão ------------------- */
[data-theme="dark"] #btn-theme .icon-moon  { display: none; }
[data-theme="dark"] #btn-theme .icon-sun   { display: block; }
#btn-theme .icon-sun { display: none; }
#btn-theme .icon-moon { display: block; }

/* =============================================================
   COMPONENTES JS — Toast, Modal, Loader
   Estilos dos componentes em public/js/components.js
   ============================================================= */

/* --- Toast ------------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
  max-width: 380px;
  width: calc(100vw - var(--space-12));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  box-shadow: var(--shadow-lg);
  background: var(--bg-surface);
  pointer-events: all;
  opacity: 0;
  transform: translateX(110%);
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.toast.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast.toast-hiding {
  opacity: 0;
  transform: translateX(110%);
}

.toast-success {
  border-color: var(--color-success-100);
  background: var(--color-success-50);
  color: var(--color-success-700);
}
.toast-error {
  border-color: var(--color-danger-100);
  background: var(--color-danger-50);
  color: var(--color-danger-700);
}
.toast-warning {
  border-color: var(--color-warning-100);
  background: var(--color-warning-50);
  color: var(--color-warning-700);
}
.toast-info {
  border-color: var(--color-primary-200);
  background: var(--color-primary-50);
  color: var(--color-primary-700);
}

.toast-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.toast-icon svg { width: 18px; height: 18px; }

.toast-message {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: var(--leading-normal);
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  opacity: 0.5;
  color: inherit;
  border-radius: var(--radius-sm);
  transition: opacity var(--transition-fast);
}
.toast-close:hover { opacity: 1; }
.toast-close svg { width: 14px; height: 14px; }

/* --- Modal ------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-overlay.modal-open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(-8px);
  transition: transform var(--transition-base);
}

.modal-overlay.modal-open .modal {
  transform: scale(1) translateY(0);
}

/* Tamanhos */
.modal-sm { max-width: 400px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* Impede scroll do body quando modal aberto */
body.modal-active { overflow: hidden; }

/* --- Chooser de tipo de projeto (F1 — WBS 1.6.6) ----------- */
.chooser-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  text-align: center;
  color: var(--text-primary);
  font-family: inherit;
}
.chooser-card:hover,
.chooser-card:focus-visible {
  border-color: var(--color-primary-500);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--color-primary-100);
  outline: none;
}
.chooser-card .chooser-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-primary-50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-600);
  margin-bottom: var(--space-1);
}
.chooser-card strong {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}
.chooser-card span {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.4;
}

/* --- Loader overlay ---------------------------------------- */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(1px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.loader-overlay.loader-visible {
  opacity: 1;
  visibility: visible;
}

.loader-box {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-8) var(--space-10);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  min-width: 180px;
}

.loader-message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
}

/* =============================================================
   Filtros e paginação (módulos de listagem)
   ============================================================= */
.filter-bar {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.filter-bar .form-input,
.filter-bar .form-select {
  height: 36px;
  padding-top: 0;
  padding-bottom: 0;
}

.filter-bar .filter-search {
  flex: 1;
  min-width: 200px;
}

.filter-bar .filter-select {
  width: 180px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Coluna de ações em tabelas */
.table .col-actions {
  width: 100px;
  text-align: right;
  white-space: nowrap;
}

/* Badge de status ativo/inativo */
.badge-active   { background: var(--color-success-100); color: var(--color-success-700); }
.badge-inactive { background: var(--color-neutral-100); color: var(--color-neutral-500); }

/* =============================================================
   TAB NAV — Barra de navegação de abas do projeto (WBS 1.6.8)
   ============================================================= */

.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE/Edge */
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;          /* sobrepõe a borda do .tab-nav */
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
  white-space: nowrap;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-btn:hover {
  color: var(--text-primary);
  background: var(--surface-2);
}
.tab-btn.active {
  color: var(--color-primary-600);
  border-bottom-color: var(--color-primary-600);
  font-weight: var(--font-semibold);
}

/* Painel de conteúdo de aba */
.tab-panel {
  outline: none;
}

/* =============================================================
   TASK TABLE — Tabela editável de tarefas (WBS 1.7.5)
   ============================================================= */

/* Hover na linha */
.task-table tbody tr:hover { background: var(--surface-2); }

/* Linha crítica — borda esquerda vermelha */
.task-row--critical { border-left: 3px solid var(--color-danger-500); }

/* Linha de tarefa-resumo — negrito + fundo leve */
.task-row--summary  { font-weight: var(--font-semibold); background: var(--surface-2); }

/* Linha de marco — borda esquerda âmbar */
.task-row--milestone { border-left: 3px solid var(--color-warning-500, #f59e0b); }
.task-row--milestone:hover { background: var(--color-warning-50, #fffbeb); }

/* Data de marco — âmbar semibold */
.milestone-date {
  font-weight: var(--font-semibold);
  color: var(--color-warning-700, #b45309);
}

/* Botões de indentação — visíveis apenas ao passar o mouse na linha */
.task-indent-btn,
.task-outdent-btn {
  opacity: 0;
  transition: opacity 150ms ease;
  color: var(--text-muted);
  padding: 2px 4px !important;
  font-size: var(--text-sm);
}
.task-table tbody tr:hover .task-indent-btn,
.task-table tbody tr:hover .task-outdent-btn {
  opacity: 1;
}
.task-indent-btn:hover,
.task-outdent-btn:hover { color: var(--color-primary-600); }

/* Célula base */
.task-cell {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
  overflow: hidden;
}

/* Célula editável — cursor de texto + highlight no hover */
.task-cell--editable { cursor: text; }
.task-cell--editable:hover { background: var(--color-primary-50); }

/* Célula desabilitada (ex: duração de marco, datas de resumo) */
.task-cell--disabled { color: var(--text-muted); cursor: default; }

/* Input/Select de edição inline */
.task-cell-input {
  width: 100%;
  border: 1px solid var(--color-primary-400);
  border-radius: var(--radius-sm);
  padding: 2px var(--space-2);
  font-size: var(--text-sm);
  font-family: inherit;
  background: var(--surface-1);
  color: var(--text-primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--color-primary-100);
}
select.task-cell-input { cursor: pointer; }

/* =============================================================
   Aba Calendário (G4 — WBS 1.8.3)
   ============================================================= */

/* Grade mensal */
.cal-grid-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  table-layout: fixed;
}
.cal-dow {
  text-align: center;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: var(--space-2) 0;
}
.cal-day {
  text-align: center;
  vertical-align: top;
  height: 52px;
  padding: var(--space-1);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: background 120ms ease;
}
.cal-day--empty   { background: transparent; border-color: transparent; }
.cal-day--weekend { background: var(--surface-2); color: var(--text-muted); }
.cal-day--holiday {
  background: var(--color-danger-50, #fef2f2);
  border-color: var(--color-danger-200, #fecaca);
}
.cal-day--exc-off {
  background: var(--color-warning-50, #fffbeb);
  border-color: var(--color-warning-300, #fcd34d);
}
.cal-day--exc-on  { background: #f0fdf4; border-color: #bbf7d0; }
.cal-day--today   {
  font-weight: var(--font-bold);
  outline: 2px solid var(--color-primary-500);
  outline-offset: -2px;
}
.cal-day-num {
  font-size: var(--text-sm);
  display: block;
  line-height: 1.8;
}

/* Pontos de legenda abaixo do número do dia */
.cal-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 2px;
}
.cal-dot--holiday { background: var(--color-danger-500, #ef4444); }
.cal-dot--exc-off { background: var(--color-warning-500, #f59e0b); }
.cal-dot--exc-on  { background: #22c55e; }

/* =============================================================
   Aba Gantt (H1 — WBS 1.10.1 + 1.10.2)
   ============================================================= */

/* Layout split: nomes (esq.) | SVG timeline (dir.) */
.gantt-wrap {
  display:    flex;
  border:     1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow:   hidden;
  max-height: calc(100vh - 270px);   /* H3 — scroll vertical */
}

/* Painel esquerdo — lista de nomes */
.gantt-left {
  width:          280px;
  flex-shrink:    0;
  border-right:   2px solid var(--border-default);
  background:     var(--bg-surface);
  overflow:       hidden;
  display:        flex;              /* H3 — scroll sync */
  flex-direction: column;
}
.gantt-left-hdr {
  height:       44px;               /* igual a GANTT_HDR_H no JS */
  flex-shrink:  0;                  /* H3 — cabeçalho fixo */
  display:      flex;
  align-items:  center;
  gap:          var(--space-2);
  padding:      0 var(--space-3);
  background:   var(--bg-surface-2);
  border-bottom: 1px solid var(--border-default);
}
/* H3 — container das linhas de tarefa; sobe via transform no scroll */
.gantt-left-rows {
  flex:     1;
  overflow: hidden;               /* conteúdo clipado; translação via JS */
}
.gantt-name-row {
  height: 36px;           /* igual a GANTT_ROW_H no JS */
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  overflow: hidden;
}
.gantt-name-row--milestone {
  border-left: 3px solid var(--color-warning-500, #f59e0b);
}
.gantt-wbs {
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 36px;
}
.gantt-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* Painel direito — contêiner raiz (não rola; divide-se em header + body) */
.gantt-right {
  flex:            1;
  display:         flex;
  flex-direction:  column;
  overflow:        hidden;        /* os filhos que rolam */
  background:      var(--bg-surface);
}
/* Cabeçalho de datas — fixo (não rola verticalmente) */
/* overflow:hidden permite scrollLeft programático mas oculta a barra */
.gantt-right-hdr {
  flex-shrink:     0;
  overflow:        hidden;
  height:          44px;          /* GANTT_HDR_H */
  border-bottom:   1px solid var(--border-default);
}
/* Corpo — rola em ambas as direções */
.gantt-right-body {
  flex:            1;
  overflow:        auto;
  cursor:          default;
}

/* Tipografia dos textos SVG (font-family via CSS) */
.gantt-right-hdr  svg text,
.gantt-right-body svg text { font-family: var(--font-sans); }

/* Elementos SVG — preenchimento via classes (compatível com dark mode) */
.gantt-hdr-bg      { fill: var(--bg-surface-2); }
.gantt-we-hdr-bg   { fill: var(--bg-surface-3); opacity: .7; }
.gantt-we-body-bg  { fill: var(--bg-surface-2); opacity: .6; }
.gantt-hdr-sep     { stroke: var(--border-default);  stroke-width: 1;   fill: none; }
.gantt-hdr-sep-sub { stroke: var(--border-subtle);   stroke-width: 0.5; fill: none; }
.gantt-row-line    { stroke: var(--border-subtle);   stroke-width: 0.5; fill: none; }
.gantt-text-month  { fill: var(--text-secondary); font-size: 11px; font-weight: 600; }
.gantt-text-sub    { fill: var(--text-muted);     font-size: 9px;  }
.gantt-text-day    { fill: var(--text-secondary); font-size: 10px; text-anchor: middle; }
.gantt-text-day--we{ fill: var(--text-muted);     font-size: 10px; text-anchor: middle; }

/* Barras SVG — cor base (H1) */
.gantt-bar         { fill: var(--color-primary-500); }
.gantt-bar-summary { fill: var(--color-neutral-700); }
.gantt-bar-milestone {
  fill:   var(--color-warning-500, #f59e0b);
  stroke: var(--color-warning-700, #b45309);
  stroke-width: 1;
}

/* =============================================================
   Gantt H2 — WBS 1.10.3 + 1.10.4 + 1.10.5
   ============================================================= */

/* Cores por status (H2 — WBS 1.10.3) */
.gantt-bar--nao-iniciada { fill: var(--color-neutral-400); }
.gantt-bar--em-andamento { fill: var(--color-primary-500); }
.gantt-bar--concluida    { fill: var(--color-success-600,  #16a34a); }
.gantt-bar--suspensa     { fill: var(--color-warning-500,  #f59e0b); }
.gantt-bar--cancelada    { fill: var(--color-danger-400,   #f87171); }

/* Fundo da barra (parte não concluída — mesma cor do status, mais transparente) */
.gantt-bar-bg { opacity: 0.28; }

/* Linha "hoje" (H2 — WBS 1.10.4) */
.gantt-today-line {
  stroke:           var(--color-danger-500, #ef4444);
  stroke-width:     1.5;
  stroke-dasharray: 5 3;
}
.gantt-today-label {
  fill:        var(--color-danger-500, #ef4444);
  font-size:   9px;
  font-weight: 600;
}

/* Controles de zoom (H2 — WBS 1.10.5) */
.gantt-zoom-controls {
  display:     flex;
  align-items: center;
  gap:         var(--space-1);
}
.gantt-zoom-btns {
  display:       flex;
  border:        1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow:      hidden;
}
.gantt-zoom-btns .btn {
  border-radius: 0;
  border-right:  1px solid var(--border-subtle);
  padding:       4px 10px;
  font-size:     var(--text-xs);
}
.gantt-zoom-btns .btn:last-child { border-right: none; }

/* =============================================================
   Gantt H3 — WBS 1.10.6 + 1.10.7
   ============================================================= */

/* Linhas de dependência FS (H3 — WBS 1.10.7) */
.gantt-dep-line {
  stroke:       var(--color-neutral-400, #9ca3af);
  stroke-width: 1.5;
  fill:         none;
}
/* Ponta de seta triangular */
.gantt-dep-arrow {
  fill:   var(--color-neutral-400, #9ca3af);
  stroke: none;
}

/* =============================================================
   Gantt H4 — WBS 1.10.8 + 1.10.9 + 1.10.10
   ============================================================= */

/* =============================================================
   Gantt I1 — WBS 1.11.5 (overlay de baseline)
   ============================================================= */

/* Barra de baseline: cor roxa distinta, abaixo da barra real */
.gantt-bar-baseline {
  fill:    var(--color-primary-300, #93c5fd);
  opacity: 0.85;
  stroke:  var(--color-primary-500, #3b82f6);
  stroke-width: 0.5;
}

/* =============================================================
   Aba Baseline — WBS 1.11.6
   ============================================================= */

/* Seletor de baseline (botões de revisão) */
.bl-selector {
  display:       flex;
  border:        1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow:      hidden;
  flex-wrap:     wrap;
}
.bl-selector .btn {
  border-radius: 0;
  border-right:  1px solid var(--border-subtle);
  padding:       4px 12px;
  font-size:     var(--text-xs);
}
.bl-selector .btn:last-child { border-right: none; }

/* Linha de tarefa deletada */
.bl-row-deleted td { opacity: .5; }

/* Overlay do Caminho Crítico (H4 — WBS 1.10.8) */
.gantt-bar--critical-overlay {
  fill:         none;
  stroke:       var(--color-danger-500, #ef4444);
  stroke-width: 2;
}

/* Filtros rápidos (H4 — WBS 1.10.10) */
.gantt-filter-btns {
  display:       flex;
  border:        1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow:      hidden;
}
.gantt-filter-btns .btn {
  border-radius: 0;
  border-right:  1px solid var(--border-subtle);
  padding:       4px 10px;
  font-size:     var(--text-xs);
}
.gantt-filter-btns .btn:last-child { border-right: none; }

/* Filtro sem resultados (H4 fix) */
.gantt-filter-empty {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  justify-content: center;
  gap:            var(--space-2);
  text-align:     center;
  padding:        var(--space-12) var(--space-6);
  border:         1px solid var(--border-subtle);
  border-radius:  var(--radius-lg);
  background:     var(--bg-surface);
  min-height:     200px;
}

/* Toggle Caminho Crítico */
.gantt-critical-toggle {
  display:     flex;
  align-items: center;
  gap:         var(--space-2);
  font-size:   var(--text-sm);
  color:       var(--text-secondary);
  cursor:      pointer;
  user-select: none;
}
.gantt-critical-toggle input[type="checkbox"] {
  accent-color: var(--color-danger-500, #ef4444);
  width:  14px;
  height: 14px;
  cursor: pointer;
}

/* Tooltip hover (H4 — WBS 1.10.9) */
.gantt-tooltip {
  position:      fixed;
  z-index:       9999;
  background:    var(--bg-surface);
  border:        1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding:       var(--space-2) var(--space-3);
  box-shadow:    0 4px 16px rgba(0,0,0,.15);
  font-size:     var(--text-xs);
  min-width:     200px;
  max-width:     260px;
  pointer-events: none;
}
.gantt-tt-title {
  font-weight:    var(--font-semibold);
  color:          var(--text-primary);
  font-size:      var(--text-sm);
  margin-bottom:  var(--space-1);
  overflow:       hidden;
  text-overflow:  ellipsis;
  white-space:    nowrap;
}
.gantt-tt-row {
  display:         flex;
  justify-content: space-between;
  gap:             var(--space-3);
  color:           var(--text-secondary);
  margin-top:      2px;
  line-height:     1.5;
}
.gantt-tt-row span:first-child { color: var(--text-muted); }
.gantt-tt-critical {
  margin-top:  var(--space-1);
  padding-top: var(--space-1);
  border-top:  1px solid var(--border-subtle);
  color:       var(--color-danger-600, #dc2626);
  font-weight: var(--font-semibold);
}

/* =============================================================
   Histograma de Recursos — I3 (WBS 1.12.7)
   ============================================================= */

/* Barras SVG por tipo de recurso */
.hist-bar-work     { fill: #60a5fa; }   /* azul — Trabalho    */
.hist-bar-material { fill: #fbbf24; }   /* âmbar — Material   */
.hist-bar-cost     { fill: #a78bfa; }   /* violeta — Custo Fixo */

/* Estrutura do cabeçalho e linhas de grade */
.hist-hdr-bg   { fill: var(--bg-surface-2); }
.hist-hdr-line { stroke: var(--border-default); stroke-width: 1; fill: none; }
.hist-row-line { stroke: var(--border-subtle);  stroke-width: 0.5; fill: none; }
.hist-text     { fill: var(--text-muted); font-size: 10px; font-family: var(--font-sans); }

/* =============================================================
   Calendário individual de ausências — I4 (WBS 1.13.4)
   ============================================================= */

.team-cal-table {
  width:           100%;
  border-collapse: separate;
  border-spacing:  3px;
}
.team-cal-th {
  text-align:  center;
  font-size:   var(--text-xs);
  font-weight: var(--font-semibold);
  color:       var(--text-muted);
  padding:     var(--space-1) 0;
}
.team-cal-day {
  text-align:    center;
  font-size:     var(--text-xs);
  padding:       6px 2px;
  border-radius: var(--radius-sm);
  border:        2px solid transparent;
  cursor:        default;
  min-width:     32px;
}
.team-cal-today {
  font-weight: var(--font-semibold);
  color:       var(--color-primary-600, #2563eb);
}
.team-cal-empty {
  min-width: 32px;
}

/* Células do calendário da equipe (I5 — maior, com badges de membros) */
.team-tcal-day {
  vertical-align: top;
  padding:        4px 3px;
  min-width:      70px;
  min-height:     56px;
  border:         1px solid var(--border-subtle);
  border-radius:  var(--radius-sm);
}
.team-tcal-has-leaves {
  background: var(--bg-surface-2);
}
