/* ═══════════════════════════════════════════════
   GIL — Module-specific Styles
   ═══════════════════════════════════════════════ */

/* ── Dashboard KPI Summary Row ── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.kpi-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.kpi-box .value {
  font-size: 28px; font-weight: 800; letter-spacing: -0.5px;
}
.kpi-box .label {
  font-size: 11px; color: var(--text-muted); margin-top: 2px;
}

/* ── Movimentacoes Board ── */
.board {
  display: flex; gap: 16px; overflow-x: auto;
  padding-bottom: 8px;
}

/* ── Vistorias Detail ── */
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}
.detail-item label {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.detail-item .val {
  font-size: 14px; font-weight: 500; margin-top: 2px;
}

/* ── Financeiro Summary ── */
.fin-summary {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 16px; margin-bottom: 24px;
}
.fin-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; text-align: center;
}
.fin-card .amount {
  font-size: 24px; font-weight: 800; letter-spacing: -0.5px;
}
.fin-card .desc {
  font-size: 11px; color: var(--text-muted); margin-top: 4px;
}

/* ── Projecao Grid ── */
.proj-table {
  width: 100%;
}
.proj-table input {
  width: 100%; padding: 6px 8px;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 13px; font-family: inherit; text-align: right;
}
.proj-table input:focus { border-color: var(--border-focus); outline: none; }
.proj-total { font-weight: 800; }

/* ── Seguros / Sinistros Timeline ── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item {
  position: relative; padding-bottom: 20px;
}
.timeline-item::before {
  content: ''; position: absolute; left: -20px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--blue); border: 2px solid var(--bg-body);
}
.timeline-item .ts {
  font-size: 11px; color: var(--text-muted);
}
.timeline-item .desc {
  font-size: 13px; margin-top: 4px;
}

/* ── Migration Page ── */
.migrate-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px;
}
.migrate-section h3 { margin-bottom: 12px; }
.migrate-progress {
  height: 8px; background: var(--border); border-radius: 4px;
  overflow: hidden; margin-top: 12px;
}
.migrate-progress-bar {
  height: 100%; background: var(--green); border-radius: 4px;
  transition: width 0.3s ease;
}
.migrate-log {
  background: var(--bg-body); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px; margin-top: 12px;
  font-family: monospace; font-size: 12px; color: var(--text-secondary);
  max-height: 200px; overflow-y: auto;
}

/* ═══════════════════════════════════════════════
   Triagem e Apropriacao Financeira (TAF) Module
   ═══════════════════════════════════════════════ */

/* ── Layout: Main + Side Drawer ── */
.taf-layout {
  display: flex;
  min-height: calc(100vh - 60px);
}
.taf-main {
  flex: 1;
  transition: width 0.3s ease;
  overflow-y: auto;
  padding: 0 16px;
  min-width: 0;
}
.taf-drawer {
  width: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  background: #0d1117;
  border-left: 1px solid #30363d;
}
.taf-layout.drawer-open .taf-main { width: 60%; flex: none; }
.taf-layout.drawer-open .taf-drawer {
  width: 40%; padding: 16px; overflow-y: auto;
}
.taf-drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #30363d;
  padding-bottom: 12px; margin-bottom: 16px;
}
.taf-drawer-close {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid #30363d; background: transparent;
  color: #8b949e; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
}
.taf-drawer-close:hover { border-color: #f85149; color: #f85149; background: rgba(248,81,73,0.08); }
.taf-drawer-block {
  background: #161b22; border: 1px solid #30363d;
  border-radius: 6px; padding: 12px; margin-bottom: 12px;
}
.taf-drawer-block h4 {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: #8b949e; margin-bottom: 8px;
}
.taf-drawer-field { margin-bottom: 10px; }
.taf-drawer-field label {
  display: block; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: #8b949e; margin-bottom: 2px;
}
.taf-drawer-field .val {
  font-size: 12px; color: #e6edf3;
}

/* ── Toolbar (search + filters + actions) ── */
.taf-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.taf-search {
  width: 250px; height: 32px; border-radius: 6px;
  background: #0d1117; border: 1px solid #30363d;
  color: #e6edf3; padding: 0 10px; font-size: 12px;
  font-family: inherit; outline: none;
  transition: border-color 0.15s;
}
.taf-search::placeholder { color: #8b949e; }
.taf-search:focus { border-color: #388bfd; }
.taf-toolbar-actions {
  margin-left: auto; display: flex; gap: 6px;
}

/* ── Tabs ── */
.taf-tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  border-bottom: 1px solid #30363d; padding-bottom: 8px;
}
.taf-tab {
  padding: 8px 18px; border-radius: 6px 6px 0 0;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; border: 1px solid transparent;
  background: transparent; color: #8b949e;
  transition: all 0.15s ease;
}
.taf-tab:hover { color: #e6edf3; background: #161b22; }
.taf-tab.active {
  color: #e6edf3; background: #161b22;
  border-color: #30363d; border-bottom-color: #0d1117;
}

/* ── KPI Cards (compact) ── */
.taf-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px; margin-bottom: 12px;
}
.taf-kpi {
  background: #161b22; border: 1px solid #30363d;
  border-radius: 6px; padding: 8px 10px;
  cursor: pointer; transition: all 0.18s ease;
  position: relative; overflow: hidden;
}
.taf-kpi::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(56,139,253,0.06) 0%, transparent 60%);
  opacity: 0; transition: opacity 0.18s;
}
.taf-kpi:hover {
  border-color: #388bfd; transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.taf-kpi:hover::before { opacity: 1; }
.taf-kpi.active { border-color: #388bfd; background: #161b22; }
.taf-kpi-val { font-size: 18px; font-weight: 700; line-height: 1; position: relative; }
.taf-kpi-label {
  font-size: 9px; color: #8b949e; margin-top: 2px;
  text-transform: uppercase; letter-spacing: 0.04em;
  position: relative;
}

/* ── Filter Chips ── */
.taf-filters { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.taf-chip {
  padding: 5px 14px; border-radius: 16px;
  font-size: 12px; font-weight: 600; font-family: inherit;
  border: 1px solid #30363d; background: transparent;
  color: #8b949e; cursor: pointer;
  transition: all 0.15s ease;
}
.taf-chip:hover { color: #e6edf3; border-color: #8b949e; }
.taf-chip.active {
  background: #388bfd; color: #fff; border-color: #388bfd;
}

/* ── Table Layout ── */
.taf-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.taf-thead {
  position: sticky; top: 0; z-index: 10;
  background: #0d1117;
  border-bottom: 2px solid #30363d;
}
.taf-thead th {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: #8b949e; padding: 8px;
  text-align: left; white-space: nowrap;
}

/* ── Table Row ── */
.taf-tr {
  max-height: 44px; height: 44px;
  border-bottom: 1px solid #30363d;
  background: #161b22;
  transition: background 0.12s ease;
  cursor: pointer;
}
.taf-tr:hover { background: #1f2937; }
.taf-tr td {
  padding: 4px 8px;
  font-size: 12px;
  vertical-align: middle;
  color: #e6edf3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Status-based row styles ── */
.taf-tr-classificado { border-left: 3px solid #7ee787; opacity: 0.8; }
.taf-tr-integrado { opacity: 0.5; }
.taf-tr-descartado { opacity: 0.3; pointer-events: none; }
.taf-tr-duplicado { border-left: 3px solid #d29922; }
.taf-tr-divergente { border-left: 3px solid #f85149; }

/* ── Checkbox ── */
.taf-checkbox {
  width: 16px; height: 16px; border-radius: 4px;
  border: 2px solid #30363d; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: transparent; transition: all 0.12s;
}
.taf-checkbox:hover { border-color: #8b949e; }
.taf-checkbox.checked {
  background: #388bfd; border-color: #388bfd; color: #fff;
}

/* ── Date Column ── */
.taf-td-date {
  font-family: 'Courier New', monospace;
  line-height: 1.3; white-space: normal;
}
.taf-td-date .taf-date-line {
  display: block; font-size: 11px; font-weight: 600; color: #e6edf3;
}
.taf-td-date .taf-time-line {
  display: block; font-size: 10px; color: #8b949e;
}

/* ── Type Badges ── */
.taf-type-badge {
  display: inline-block; font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px; text-transform: uppercase;
  letter-spacing: 0.03em; white-space: nowrap;
}
.taf-type-pix_enviado   { background: rgba(248,81,73,0.15); color: #f85149; border: 1px solid rgba(248,81,73,0.3); }
.taf-type-pix_recebido  { background: rgba(126,231,135,0.12); color: #7ee787; border: 1px solid rgba(126,231,135,0.25); }
.taf-type-transferencia  { background: rgba(56,139,253,0.12); color: #79c0ff; border: 1px solid rgba(56,139,253,0.25); }
.taf-type-pagamento     { background: rgba(210,153,34,0.12); color: #d29922; border: 1px solid rgba(210,153,34,0.25); }
.taf-type-tarifa        { background: rgba(139,148,158,0.12); color: #8b949e; border: 1px solid rgba(139,148,158,0.25); }

/* ── Favorecido Column ── */
.taf-td-fav { text-align: left; min-width: 0; }
.taf-fav-name {
  font-size: 12px; font-weight: 600; color: #e6edf3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block;
}
.taf-fav-doc {
  font-size: 10px; color: #8b949e; font-family: 'Courier New', monospace;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Value Column ── */
.taf-td-val {
  text-align: right; font-family: 'Courier New', monospace;
  white-space: nowrap;
}
.val-neg { color: #e88a7a; font-family: 'Courier New', monospace; font-size: 12px; font-weight: 600; }
.val-pos { color: #7ee787; font-family: 'Courier New', monospace; font-size: 12px; font-weight: 600; }
.val-zero { color: #8b949e; font-family: 'Courier New', monospace; font-size: 12px; }

/* ── Category Pill ── */
.taf-pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 9px; font-weight: 600; padding: 2px 6px;
  border-radius: 4px; background: #0d1117;
  border: 1px solid #30363d; color: #8b949e;
  white-space: nowrap; max-width: 85px; overflow: hidden; text-overflow: ellipsis;
}
.taf-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

/* ── Placa Badge ── */
.taf-placa-badge {
  font-family: 'Courier New', monospace; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
  background: rgba(56,139,253,0.15); color: #79c0ff;
  border: 1px solid rgba(56,139,253,0.25);
  letter-spacing: 0.5px; white-space: nowrap;
}

/* ── IA Column ── */
.taf-td-ia { min-width: 0; }
.taf-ia-text {
  font-size: 10px; font-style: italic; color: #8b949e;
  max-width: 70px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  display: block;
}

/* ── Status Badge (emoji only) ── */
.taf-status-badge {
  font-size: 14px; line-height: 1;
  display: inline-block; text-align: center;
}

/* ── Actions Column ── */
.taf-td-actions {
  display: flex; flex-direction: row; gap: 2px;
  align-items: center;
}

/* ── Icon Buttons (inline, no text) ── */
.taf-icon-btn {
  width: 24px; height: 24px; border-radius: 4px;
  border: 1px solid #30363d; background: transparent;
  color: #8b949e; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; transition: all 0.12s;
  padding: 0; line-height: 1; flex-shrink: 0;
}
.taf-icon-btn:hover { background: #30363d; color: #e6edf3; }
.taf-icon-btn[data-qconfirm]:hover { border-color: #7ee787; color: #7ee787; background: rgba(126,231,135,0.08); }
.taf-icon-btn[data-qarch]:hover    { border-color: #d29922; color: #d29922; background: rgba(210,153,34,0.08); }
.taf-icon-btn[data-qspam]:hover    { border-color: #f85149; color: #f85149; background: rgba(248,81,73,0.08); }
.taf-icon-btn[data-qedit]:hover    { border-color: #388bfd; color: #79c0ff; background: rgba(56,139,253,0.08); }

/* ── Placa Input (for drawer form) ── */
.taf-placa-input {
  height: 26px; padding: 2px 6px; border: 1px solid #30363d;
  border-radius: 4px; font-family: 'Courier New', monospace; font-size: 13px; font-weight: 700;
  background: #0d1117; color: #e6edf3;
  width: 100%; max-width: 100px; outline: none; transition: all 0.12s; text-transform: uppercase;
  box-sizing: border-box; text-align: center; letter-spacing: 1px;
}
.taf-placa-input::placeholder { font-size: 11px; letter-spacing: 0; font-weight: 400; color: #8b949e; }
.taf-placa-input:focus { border-color: #388bfd; box-shadow: 0 0 0 2px rgba(56,139,253,0.25); }
.taf-placa-input.filled { background: #388bfd; color: #fff; border-color: #388bfd; }
.taf-placa-input.warn { border-color: #d29922; }

/* ── Placa Autocomplete Dropdown ── */
.taf-placa-wrapper { position: relative; }
.taf-placa-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  z-index: 50; background: #161b22; border: 1px solid #30363d;
  border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  max-height: 180px; overflow-y: auto; margin-top: 2px;
  display: none;
}
.taf-placa-dropdown.open { display: block; }
.taf-placa-option {
  padding: 6px 10px; font-size: 12px; font-family: monospace;
  color: #e6edf3; cursor: pointer; transition: background 0.1s;
}
.taf-placa-option:hover { background: #30363d; }
.taf-placa-option .taf-placa-meta {
  font-size: 10px; color: #8b949e; font-family: inherit;
}

/* ── Destino Radio Buttons ── */
.taf-destino-group { display: flex; gap: 8px; flex-wrap: wrap; }
.taf-destino-radio { display: none; }
.taf-destino-label {
  padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 600;
  border: 1px solid #30363d; background: transparent; color: #8b949e;
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.taf-destino-label:hover { border-color: #8b949e; color: #e6edf3; }
.taf-destino-radio:checked + .taf-destino-label {
  background: #388bfd; color: #fff; border-color: #388bfd;
}

/* ── Confirmation Button ── */
.taf-confirm-btn {
  padding: 10px 28px; border-radius: 8px; font-size: 14px; font-weight: 700;
  font-family: inherit; border: none; cursor: pointer;
  background: #238636; color: #fff;
  box-shadow: 0 2px 8px rgba(35,134,54,0.3);
  transition: all 0.15s ease;
}
.taf-confirm-btn:hover {
  background: #2ea043; box-shadow: 0 4px 14px rgba(35,134,54,0.4);
  transform: translateY(-1px);
}
.taf-confirm-btn:active { transform: translateY(0); }
.taf-confirm-btn:disabled {
  opacity: 0.5; cursor: not-allowed; transform: none;
  box-shadow: none;
}

/* ── Notices ── */
.taf-notice {
  padding: 10px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 500; line-height: 1.5; margin-bottom: 10px;
}
.taf-notice-danger { background: rgba(248,81,73,0.08); border: 1px solid rgba(248,81,73,0.3); color: #f85149; }
.taf-notice-warn   { background: rgba(210,153,34,0.08); border: 1px solid rgba(210,153,34,0.3); color: #d29922; }
.taf-notice-info   { background: rgba(56,139,253,0.08); border: 1px solid rgba(56,139,253,0.3); color: #79c0ff; }

/* ── Bulk Action Bar (sticky bottom) ── */
.taf-bulk {
  position: sticky; bottom: 0; z-index: 20;
  background: #161b22; border: 1px solid #30363d;
  padding: 10px 16px; display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 500; color: #e6edf3;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
  border-radius: 8px 8px 0 0; margin-bottom: 0;
}
.taf-bulk.hidden { display: none; }
.taf-bulk-count { font-weight: 700; color: #79c0ff; }
.taf-bulk .btn { font-size: 12px; }

/* ── Dashboard Grid ── */
.taf-dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.taf-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.taf-bar-label { width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8b949e; }
.taf-bar-track { flex: 1; height: 6px; border-radius: 3px; background: #30363d; }
.taf-bar-fill { height: 6px; border-radius: 3px; transition: width 0.4s; }
.taf-bar-val { width: 90px; text-align: right; font-family: monospace; font-size: 11px; font-weight: 600; }
.taf-sp-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #30363d; font-size: 12px; }
.taf-sp-row:last-child { border-bottom: none; }

/* ── Plano Rows ── */
.taf-plano-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid #30363d; font-size: 12px; }
.taf-plano-row:last-child { border-bottom: none; }
.taf-plano-row span { display: flex; align-items: center; gap: 6px; }

/* ── Account Row ── */
.taf-acc-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid #30363d;
}
.taf-acc-row:last-child { border-bottom: none; }
.taf-acc-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.taf-acc-info { flex: 1; min-width: 0; }
.taf-acc-name { font-size: 13px; font-weight: 600; color: #e6edf3; }
.taf-acc-email { font-size: 11px; color: #8b949e; font-family: monospace; }

/* ── Code Box ── */
.taf-code-box {
  background: #0d1117; border: 1px solid #30363d;
  border-radius: 6px; padding: 12px; font-family: monospace;
  font-size: 10px; line-height: 1.7; color: #8b949e;
  white-space: pre; overflow-x: auto; max-height: 250px; overflow-y: auto;
}

/* ── Medium screens ── */
@media (max-width: 1100px) {
  .taf-td-acc { display: none; }
  .taf-thead th.taf-th-acc { display: none; }
  .taf-layout.drawer-open .taf-main { width: 50%; }
  .taf-layout.drawer-open .taf-drawer { width: 50%; }
  .taf-kpis { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
  .taf-kpis { grid-template-columns: repeat(2, 1fr); }
  .taf-layout { flex-direction: column; }
  .taf-layout.drawer-open .taf-main { width: 100%; }
  .taf-layout.drawer-open .taf-drawer {
    width: 100%; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100; padding: 16px; overflow-y: auto;
  }
  .taf-table { display: block; overflow-x: auto; white-space: nowrap; }
  .taf-thead { display: table-header-group; }
  .taf-tabs { overflow-x: auto; }
  .taf-bulk { flex-wrap: wrap; }
  .taf-search { width: 100%; }
  .taf-toolbar { flex-direction: column; align-items: stretch; }
  .taf-toolbar-actions { margin-left: 0; }
  .taf-dash-grid { grid-template-columns: 1fr; }
  .taf-destino-group { flex-direction: column; }
}
