/* ─── RESET & BASE ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0e0f14;
  --bg-card:   #1a1d28;
  --bg-hover:  #1f2333;
  --border:    rgba(255,255,255,.07);
  --border-md: rgba(255,255,255,.13);

  --text:      #f0f1f6;
  --text-dim:  #8b8fa8;
  --text-muted:#555870;

  --orange:    #f97316;
  --orange-dim:rgba(249,115,22,.14);
  --green:     #22c55e;
  --green-dim: rgba(34,197,94,.12);
  --blue:      #38bdf8;
  --blue-dim:  rgba(56,189,248,.12);
  --red:       #f87171;
  --red-dim:   rgba(248,113,113,.12);
  --yellow:    #facc15;
  --purple:    #a78bfa;

  --radius:    14px;
  --radius-sm: 8px;
  --font:      'IBM Plex Sans', sans-serif;
  --mono:      'IBM Plex Mono', monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  padding: 28px;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2d3e; border-radius: 99px; }

/* ─── HEADER ────────────────────────────────── */
.okr-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}
.okr-title   { font-size: 24px; font-weight: 700; line-height: 1.2; }
.okr-subtitle { font-size: 14px; color: var(--text-dim); margin-top: 4px; }

.okr-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ─── SELETOR DE TRIMESTRE ──────────────────── */
.quarter-selector {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.q-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  transition: background .18s, color .18s;
  border-right: 1px solid var(--border);
}
.q-btn:last-child { border-right: none; }
.q-btn:hover  { background: rgba(255,255,255,.05); color: var(--text); }
.q-btn.active { background: var(--orange-dim); color: var(--orange); }

/* ─── RESUMO DO TRIMESTRE ───────────────────── */
.quarter-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 2fr;
  gap: 14px;
  margin-bottom: 32px;
}
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.summary-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.summary-value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
}
.summary-progress-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}
.summary-progress-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
}
.summary-progress-bar {
  height: 8px;
  background: rgba(255,255,255,.06);
  border-radius: 99px;
  overflow: hidden;
}
.summary-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), #fbbf24);
  border-radius: 99px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.summary-progress-pct {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--orange);
  font-weight: 500;
  align-self: flex-end;
}

/* ─── GRID DE CARDS OKR ─────────────────────── */
.okr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* ─── CARD OKR ──────────────────────────────── */
.okr-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, transform .2s;
  animation: cardIn .3s ease both;
}
@keyframes cardIn {
  from { opacity:0; transform: translateY(12px); }
  to   { opacity:1; transform: translateY(0); }
}
.okr-card:hover { border-color: var(--border-md); transform: translateY(-2px); }

/* Stripe colorida no topo */
.okr-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.okr-card[data-cat="Crescimento"]::before  { background: linear-gradient(90deg,#f97316,#fbbf24); }
.okr-card[data-cat="Financeiro"]::before   { background: linear-gradient(90deg,#22c55e,#16a34a); }
.okr-card[data-cat="Clientes"]::before     { background: linear-gradient(90deg,#38bdf8,#6366f1); }
.okr-card[data-cat="Produto"]::before      { background: linear-gradient(90deg,#a78bfa,#ec4899); }
.okr-card[data-cat="Equipe"]::before       { background: linear-gradient(90deg,#f472b6,#fb7185); }
.okr-card[data-cat="Operacional"]::before  { background: linear-gradient(90deg,#facc15,#fb923c); }

/* Cabeçalho do card */
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-top: 8px;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.card-quarter {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--orange);
  background: var(--orange-dim);
  padding: 2px 8px;
  border-radius: 4px;
}
.card-cat {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,.05);
  padding: 2px 8px;
  border-radius: 4px;
}
.card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.card-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.card-btn:hover { background: rgba(255,255,255,.07); color: var(--text); }
.card-btn--del:hover { background: var(--red-dim); color: var(--red); border-color: var(--red-dim); }

/* Título do objetivo */
.card-objetivo {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
}

/* Deadline */
.card-deadline {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 20px;
}
.card-deadline.soon  { color: var(--yellow); }
.card-deadline.late  { color: var(--red); }
.card-deadline svg   { width: 13px; height: 13px; }

/* Barra de progresso principal */
.card-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.card-progress-pct {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--text);
}
.card-progress-bar {
  height: 7px;
  background: rgba(255,255,255,.06);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 20px;
}
.card-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
/* Cores da barra por progresso */
.fill-low    { background: linear-gradient(90deg,#f87171,#fb923c); }
.fill-mid    { background: linear-gradient(90deg,#facc15,#fb923c); }
.fill-high   { background: linear-gradient(90deg,#22c55e,#16a34a); }
.fill-done   { background: linear-gradient(90deg,#22c55e,#4ade80); }

/* Key Results */
.kr-list { display: flex; flex-direction: column; gap: 10px; }

.kr-item {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: background .18s, border-color .18s;
}
.kr-item:hover {
  background: rgba(255,255,255,.055);
  border-color: var(--border-md);
}
.kr-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.kr-nome {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}
.kr-pct {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}
.kr-bar {
  height: 4px;
  background: rgba(255,255,255,.06);
  border-radius: 99px;
  overflow: hidden;
}
.kr-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}

/* ─── EMPTY STATE ───────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.empty-icon { font-size: 52px; line-height: 1; }
.empty-state h3 { font-size: 20px; font-weight: 700; }
.empty-state p  { font-size: 14px; color: var(--text-dim); max-width: 380px; }

/* ─── MODAL ─────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85);
  display: none; align-items: center; justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 28px 32px;
  width: 520px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-sm { width: 380px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.btn-close {
  background: none; border: none;
  color: var(--text-dim); font-size: 16px;
  cursor: pointer; padding: 4px 8px;
  border-radius: 6px; transition: background .15s;
}
.btn-close:hover { background: rgba(255,255,255,.07); color: var(--text); }

/* ─── FORM ──────────────────────────────────── */
.form-group {
  display: flex; flex-direction: column;
  gap: 8px; margin-bottom: 16px;
}
.form-group label { font-size: 13px; color: var(--text-dim); }
.label-hint { color: var(--text-muted); font-size: 12px; font-style: italic; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

input[type="text"], input[type="date"], input[type="number"],
input[type="range"], select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color .18s;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--orange); }

/* ─── KR NO FORMULÁRIO ──────────────────────── */
.kr-section { margin-bottom: 16px; }
.kr-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.kr-section-header label { font-size: 13px; color: var(--text-dim); }
.btn-add-kr {
  background: var(--orange-dim);
  color: var(--orange);
  border: 1px solid rgba(249,115,22,.25);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s;
}
.btn-add-kr:hover { background: rgba(249,115,22,.22); }

/* ── KR INPUT ROW — estrutura nova SMART ─── */
.kr-input-row {
  background: rgba(255,255,255,.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .18s;
}
.kr-input-row:focus-within { border-color: var(--border-md); }

.kr-input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Seletor de tipo */
.kr-tipo-selector {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.kr-tipo-btn {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.kr-tipo-btn:hover { background: rgba(255,255,255,.07); color: var(--text-dim); }
.kr-tipo-btn.active {
  background: var(--orange-dim);
  color: var(--orange);
  border-color: rgba(249,115,22,.3);
}

.btn-remove-kr {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.btn-remove-kr:hover {
  background: var(--red-dim);
  color: var(--red);
  border-color: transparent;
}

.kr-nome-input { width: 100%; }

/* Campos extras (numérico / percentual) */
.kr-campos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}
.kr-campo-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kr-campo-group label { font-size: 12px; color: var(--text-muted); }
.kr-campo-group input { padding: 7px 10px; font-size: 13px; }

.kr-campo-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
  padding-top: 2px;
  grid-column: 1;
}
.kr-campo-hint--full { grid-column: span 2; }
.kr-campo-hint em { color: var(--text-dim); font-style: normal; }

/* Binário — hint inline */
.kr-campos--binario {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── KR na visualização — badge de tipo ───── */
.kr-tipo-badge { font-size: 13px; margin-right: 4px; }

.kr-detalhe {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
  font-family: var(--mono);
}
.kr-empty {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 8px;
}

/* ── MODAL PROGRESSO — controles SMART ───── */
.prog-kr-nome {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 20px;
  line-height: 1.5;
}

.prog-tipo { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* Binário */
.binary-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 20px;
}
.binary-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
  transition: color .2s;
}
.binary-toggle {
  width: 54px; height: 28px;
  border-radius: 99px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background .25s, border-color .25s;
  flex-shrink: 0;
}
.binary-toggle.is-done {
  background: var(--green);
  border-color: var(--green);
}
.binary-knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.binary-toggle.is-done .binary-knob { transform: translateX(26px); }

/* Numérico / Percentual */
.prog-num-wrap {
  padding: 8px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.prog-num-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.prog-num-label { font-size: 13px; color: var(--text-dim); }
.prog-num-meta  { font-size: 12px; color: var(--text-muted); font-family: var(--mono); }

.prog-num-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.num-btn {
  background: rgba(255,255,255,.04);
  border: none;
  color: var(--text-dim);
  width: 44px; height: 44px;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.num-btn:hover { background: rgba(255,255,255,.08); color: var(--text); }
.num-input {
  flex: 1;
  background: none;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-radius: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  padding: 8px 12px;
  color: var(--text);
  outline: none;
}
.num-input:focus { border-color: var(--orange); }

.prog-bar-preview {
  height: 8px;
  background: rgba(255,255,255,.06);
  border-radius: 99px;
  overflow: hidden;
}
.prog-bar-preview-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), #fbbf24);
  border-radius: 99px;
  transition: width .3s ease;
}
.prog-bar-preview-pct {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--orange);
  align-self: flex-end;
}

/* ─── MENSAGEM DE ERRO ──────────────────────── */
.msg-erro {
  background: var(--red-dim);
  border: 1px solid rgba(248,113,113,.25);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 4px;
}

/* ─── AÇÕES DO MODAL ────────────────────────── */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* ─── BOTÕES ────────────────────────────────── */
.btn-primary {
  background: var(--orange);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: opacity .18s;
  white-space: nowrap;
}
.btn-primary:hover    { opacity: .88; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  transition: border-color .18s, color .18s;
}
.btn-ghost:hover { border-color: var(--border-md); color: var(--text); }

/* ─── CORES UTILITÁRIAS ─────────────────────── */
.text-green  { color: var(--green);  }
.text-blue   { color: var(--blue);   }
.text-orange { color: var(--orange); }
.text-red    { color: var(--red);    }
.text-yellow { color: var(--yellow); }

/* ─── RESPONSIVO ────────────────────────────── */
@media (max-width: 900px) {
  .quarter-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .summary-progress-wrap { grid-column: span 2; }
}
@media (max-width: 560px) {
  body { padding: 16px; }
  .okr-header { flex-direction: column; }
  .quarter-summary { grid-template-columns: 1fr 1fr; }
  .okr-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
/* ── KR no modal de edição — progresso atual ── */
.kr-input-row--existente {
  border-color: rgba(249, 115, 22, 0.15);
}

.kr-input-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-atualizar-kr {
  background: var(--orange-dim);
  color: var(--orange);
  border: 1px solid rgba(249, 115, 22, 0.25);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.btn-atualizar-kr:hover { background: rgba(249, 115, 22, 0.22); }

/* Bloco de progresso atual dentro do modal de edição */
.kr-progresso-atual {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kr-progresso-topo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kr-progresso-icone { font-size: 13px; }

.kr-progresso-detalhe {
  flex: 1;
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.kr-progresso-pct {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.kr-progresso-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}

.kr-progresso-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}

/* KR no card — hint de atualização */
.kr-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.kr-update-hint {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity .18s;
}

.kr-item:hover .kr-update-hint { opacity: 1; }