/* ═══════════════════════════════════════════════
   PATCHES WEB - Ajustes para versão web
   (remove -webkit-app-region do Electron)
   ═══════════════════════════════════════════════ */

/* Remove drag region do Electron */
.top-header { -webkit-app-region: none !important; }
.top-header button, .top-header a, .top-header input { -webkit-app-region: none !important; }

/* Remove controles de janela do Electron */
.window-controls { display: none !important; }

/* Body scrollable na web */
body { overflow: auto !important; }
#app-root { height: auto !important; min-height: 100vh; }

/* Page content flex grow */
#page-content { flex: 1; display: flex; flex-direction: column; }

/* Kanban card styles */
.kanban-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: grab;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.kanban-card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-sm);
}
.kanban-card:active { cursor: grabbing; }

.card-avatar {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--green-3);
  border: 1px solid var(--green-2);
  color: var(--green);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-body { flex: 1; min-width: 0; }
.card-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-preview { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-footer { display: flex; gap: 6px; align-items: center; margin-top: 5px; flex-wrap: wrap; }
.card-time { font-size: 11px; color: var(--muted); }
.card-instance { font-size: 10px; color: var(--muted); background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.card-tags { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.tag {
  font-size: 10px; padding: 2px 7px; border-radius: 20px;
  background: var(--green-3); color: var(--green);
  border: 1px solid var(--green-2);
}

.kanban-empty {
  font-size: 12px; color: var(--muted);
  text-align: center; padding: 20px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  margin: 4px;
}

/* Form helpers */
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; color: var(--muted); font-weight: 500; }

/* Instance rows */
.instance-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border-2);
}
.instance-row:last-child { border-bottom: none; }
.instance-left { display: flex; align-items: center; gap: 12px; }
.instance-name { font-size: 13px; font-weight: 600; }
.instance-meta { display: flex; gap: 6px; margin-top: 3px; align-items: center; }
.instance-actions { display: flex; gap: 6px; }

.avatar {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: var(--green-3);
  border: 1px solid var(--green-2);
  color: var(--green);
  font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.dashboard-hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--green);
  background: var(--green-3); border: 1px solid var(--green-2);
  border-radius: 999px; padding: 4px 10px; margin-bottom: 14px; font-weight: 600;
}
.dashboard-hero-badge::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px var(--green-2);
}

/* Toast animation */
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Btn sm */
.btn-sm { height: 28px !important; padding: 0 10px !important; font-size: 12px !important; }

/* ── Painel de chat lateral ── */
#chat-panel {
  background: var(--bg);
}
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

#chat-input:focus { outline: none; border-color: var(--green); }

/* Kanban col-body precisa de data-col-id para o drag funcionar */
.kanban-col-body { min-height: 80px; }

/* Destaque de novo card no kanban */
.kanban-card {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ── Flow Editor ── */
#flow-editor-root * { box-sizing: border-box; }

.flow-node-palette:hover {
  border-color: var(--green) !important;
  background: var(--green-3) !important;
}

.flow-port-in:hover, .flow-port-out:hover {
  transform: translateY(-50%) scale(1.3) !important;
  border-color: var(--green) !important;
}

#flow-canvas-wrapper {
  background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 24px 24px;
}

[data-node-id]:hover {
  border-color: var(--green) !important;
  box-shadow: 0 0 0 2px var(--green-2) !important;
}

#flow-props-inner .input {
  width: 100%;
  font-size: 12px;
}

#flow-name-input:hover {
  background: rgba(255,255,255,0.04) !important;
  border-radius: 6px;
  padding: 2px 6px;
}

/* ══════════════════════════════════════════════
   FIX CRÍTICO: select com classe .input
   O CSS original só estiliza select.select,
   mas usamos select.input no código web.
   ══════════════════════════════════════════════ */
select.input {
  color-scheme: dark;
  appearance: auto;
  cursor: pointer;
}
select.input option,
select.input optgroup {
  background-color: #0d1117;
  color: var(--text);
}

html[data-theme="light"] select.input {
  color-scheme: light;
  background: #ffffff;
}
html[data-theme="light"] select.input option,
html[data-theme="light"] select.input optgroup {
  background-color: #ffffff;
  color: rgba(15,23,42,0.92);
}

/* Fix textarea sem classe .textarea mas com .input */
textarea.input {
  height: auto;
  padding: 10px 12px;
  line-height: 1.45;
  resize: vertical;
  min-height: 80px;
}

/* Fix: input type=time e type=number no tema escuro */
input[type="time"].input,
input[type="number"].input,
input[type="text"].input {
  color-scheme: dark;
}
html[data-theme="light"] input[type="time"].input,
html[data-theme="light"] input[type="number"].input,
html[data-theme="light"] input[type="text"].input {
  color-scheme: light;
}

/* Fix botões ghost no tema claro (fundo branco + texto branco) */
html[data-theme="light"] .btn-ghost {
  background: rgba(15,23,42,0.05);
  color: rgba(15,23,42,0.92);
  border-color: var(--border);
}
html[data-theme="light"] .btn-ghost:hover {
  background: rgba(15,23,42,0.09);
}
html[data-theme="light"] .btn {
  color: rgba(15,23,42,0.92);
}

/* Fix painel flow props no light mode */
html[data-theme="light"] #flow-props-panel,
html[data-theme="light"] #flow-sidebar {
  background: #f8fafc;
}

/* ── Animações globais do sistema ── */
@keyframes wd-spin {
  to { transform: rotate(360deg); }
}
@keyframes wd-fadein {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes wd-fadeout {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes wd-slidein {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Simulador iPhone */
#flow-simulator-overlay {
  animation: wd-fadein .2s ease;
}
#sim-messages::-webkit-scrollbar { width: 3px; }
#sim-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 2px; }
#sim-input:focus { box-shadow: 0 0 0 2px #25d366; }

/* ── Tag button hover no card ── */
.kanban-card:hover .card-tag-btn { opacity: 0.7 !important; }
.card-tag-btn:hover { opacity: 1 !important; color: var(--green) !important; }

/* ── Tags no chat panel header ── */
#chat-panel-status .tag { font-size: 10px; padding: 1px 6px; }

/* ── Datalist styling (autocomplete tags) ── */
#new-tag-input { color-scheme: dark; }
html[data-theme="light"] #new-tag-input { color-scheme: light; }
