:root {
    --bg: #0e1117;
    --surface: #161b27;
    --surface2: #1e2636;
    --border: #2a3347;
    --accent: #4f8ef7;
    --accent2: #38d9a9;
    --warn: #f6c23e;
    --danger: #e05c5c;
    --text: #e8eaf0;
    --muted: #7a8499;
    --radius: 12px;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'Sora', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 40px 24px;
  }

  /* ── LAYOUT ── */
  .app { max-width: 860px; margin: auto; }

  /* ── HEADER ── */
  .app-header {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 40px;
  }
  .app-header .logo {
    width: 44px; height: 44px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
  }
  .app-header h1 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.3px; }
  .app-header p  { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

  /* ── CARD ── */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
  }
  .card-title {
    font-size: 0.7rem; font-weight: 600; letter-spacing: 1.2px;
    text-transform: uppercase; color: var(--muted);
    margin-bottom: 18px;
    display: flex; align-items: center; gap: 8px;
  }
  .card-title::before {
    content: ''; display: block;
    width: 3px; height: 14px; border-radius: 2px;
    background: var(--accent);
  }

  /* ── FORM ── */
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .form-group { display: flex; flex-direction: column; gap: 7px; }
  .form-group.full { grid-column: 1 / -1; }
  label { font-size: 0.75rem; color: var(--muted); font-weight: 500; }
  input, select, textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'DM Mono', monospace;
    font-size: 0.82rem;
    padding: 10px 14px;
    outline: none;
    transition: border-color 0.2s;
  }
  input:focus, select:focus, textarea:focus { border-color: var(--accent); }
  textarea { resize: vertical; min-height: 80px; }
  select option { background: var(--surface2); }

  /* ── BOTÃO ── */
  .btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px; border-radius: 8px; border: none;
    font-family: 'Sora', sans-serif; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
  }
  .btn-primary {
    background: var(--accent); color: #fff;
  }
  .btn-primary:hover { background: #6ba3ff; transform: translateY(-1px); }
  .btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
  .btn-secondary {
    background: var(--surface2); color: var(--text);
    border: 1px solid var(--border);
  }
  .btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
  .btn-success {
    background: var(--accent2); color: #0e1117;
  }
  .btn-success:hover { background: #52eabb; }

  /* ── STATUS / LOG ── */
  .log {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; padding: 16px;
    font-family: 'DM Mono', monospace; font-size: 0.78rem;
    color: var(--muted); line-height: 1.7;
    max-height: 160px; overflow-y: auto;
    display: none;
  }
  .log.visible { display: block; }
  .log .ok   { color: var(--accent2); }
  .log .err  { color: var(--danger); }
  .log .info { color: var(--accent); }
  .log .warn { color: var(--warn); }

  /* ── TAREFAS ── */
  .etapas-aviso, .semana-aviso {
    background: #3d3010; color: var(--warn); border: 1px solid var(--warn);
    border-radius: 8px; padding: 10px 14px; font-size: 0.8rem; margin-bottom: 12px;
  }
  .tasks-list { display: flex; flex-direction: column; gap: 8px; }
  .task-item {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; padding: 14px 16px;
    display: grid; grid-template-columns: 1fr auto auto auto;
    gap: 12px; align-items: center;
  }
  .task-item:hover { border-color: var(--accent); }
  .task-child {
    margin-left: 24px;
    border-left: 2px solid var(--accent);
    background: #131825;
    border-radius: 0 8px 8px 0;
  }
  .task-name { font-size: 0.85rem; font-weight: 500; }
  .task-id   { font-family: 'DM Mono', monospace; font-size: 0.72rem; color: var(--muted); }
  .pill {
    padding: 3px 10px; border-radius: 50px;
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
    white-space: nowrap;
  }
  .pill-new    { background: #2a3347; color: var(--muted); }
  .pill-dev    { background: #3d3010; color: var(--warn); }
  .pill-ready  { background: #102036; color: var(--accent); }
  .pill-done   { background: #0e3028; color: var(--accent2); }
  .pill-block  { background: #3d1010; color: var(--danger); }
  .pill-prog   { background: #1a2d4a; color: #7ab8f5; }
  .pill-testing     { background: #2d1a4a; color: #c084fc; }
  .pill-ready-test  { background: #1a2d3a; color: #67e8f9; }
  .pill-info        { background: #2d1f0a; color: #fb923c; }

  .task-select select { font-size: 0.72rem; padding: 6px 8px; }

  /* ── GERÊNCIA HIGHLIGHT ── */
  .task-item.task-gerencia {
    border-color: #f59e0b;
    background: linear-gradient(90deg, #1e1a0a 0%, var(--surface2) 100%);
    box-shadow: 0 0 0 1px #f59e0b33;
  }
  .task-item.task-gerencia:hover { border-color: #fbbf24; }
  .badge-gerencia {
    display: inline-flex; align-items: center; gap: 4px;
    background: #78350f; color: #fde68a;
    font-size: 0.6rem; font-weight: 800; text-transform: uppercase;
    padding: 2px 8px; border-radius: 50px;
    border: 1px solid #f59e0b; letter-spacing: 0.5px;
    margin-left: 6px; vertical-align: middle;
  }

  /* ── BLOQUEADA (30/07/2026) ── */
  /* Declarado depois de .task-gerencia para vencer por ordem em tarefas que
     sejam bloqueadas E de gerência ao mesmo tempo */
  .task-item.task-blocked {
    border-color: #dc2626;
    background: linear-gradient(90deg, #2a1214 0%, var(--surface2) 100%);
    box-shadow: 0 0 0 1px #dc262633;
  }
  .task-item.task-blocked:hover { border-color: #ef4444; }
  .badge-blocked {
    display: inline-flex; align-items: center; gap: 4px;
    background: #7f1d1d; color: #fecaca;
    font-size: 0.6rem; font-weight: 800; text-transform: uppercase;
    padding: 2px 8px; border-radius: 50px;
    border: 1px solid #dc2626; letter-spacing: 0.5px;
    margin-left: 6px; vertical-align: middle;
  }

  /* ── SEÇÃO ETAPAS ── */
  .etapa-header {
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.8px; color: var(--muted);
    padding: 8px 0 6px; border-bottom: 1px solid var(--border);
    margin-bottom: 8px; margin-top: 16px;
  }
  .etapa-header:first-child { margin-top: 0; }

  /* ── ACTIONS ROW ── */
  .actions { display: flex; gap: 12px; flex-wrap: wrap; }

  /* ── HIDDEN REPORT ── */
  #report-container { display: none; }

  /* ── TOAST ── */
  .toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px 20px;
    font-size: 0.82rem; color: var(--text);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    transform: translateY(80px); opacity: 0;
    transition: all 0.3s; pointer-events: none; z-index: 999;
  }
  .toast.show { transform: translateY(0); opacity: 1; }

  /* ── METRICS ROW ── */
  .metrics-preview {
    display: grid; grid-template-columns: repeat(3,1fr); gap: 12px;
    margin-bottom: 20px;
  }
  .metric-mini {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; padding: 14px;
    text-align: center;
  }
  .metric-mini .mv { font-size: 1.6rem; font-weight: 700; }
  .metric-mini .ml { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; margin-top: 2px; }
  .accent-text { color: var(--accent); }
  .warn-text   { color: var(--warn); }
  .ok-text     { color: var(--accent2); }

  /* ── LINKS FIELD ── */
  .links-list { display: flex; flex-direction: column; gap: 8px; }
  .link-row {
    display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center;
  }
  .link-row input { margin: 0; }
  .btn-link-remove {
    background: transparent; border: 1px solid var(--border); color: var(--muted);
    border-radius: 6px; width: 32px; height: 32px; cursor: pointer; font-size: 14px;
    flex-shrink: 0; transition: border-color .15s, color .15s;
  }
  .btn-link-remove:hover { border-color: var(--danger); color: var(--danger); }
  .btn-link-add {
    background: transparent; border: 1px dashed var(--border); color: var(--muted);
    border-radius: 6px; padding: 7px 14px; cursor: pointer; font-size: 0.78rem;
    font-family: 'DM Mono', monospace; transition: border-color .15s, color .15s;
    margin-top: 4px; width: fit-content;
  }
  .btn-link-add:hover { border-color: var(--accent); color: var(--accent); }
