:root {
  --bg: #050810;
  --bg-2: #090d1a;
  --surface: #0e1526;
  --surface-2: #141c30;
  --border: #1e2740;
  --border-light: #2a3452;
  --text: #e8edf9;
  --text-muted: #8b93ab;
  --text-faint: #565f7c;
  --accent: #0b6bf5;
  --accent-2: #0a2c6b;
  --accent-soft: rgba(11, 107, 245, 0.15);
  --accent-glow: rgba(11, 107, 245, 0.32);
  --success: #2fb571;
  --warning: #e0a53d;
  --danger: #e2586b;
  --font-display: "Sora", -apple-system, "Segoe UI", Inter, Arial, sans-serif;
  --font-body: "Inter", -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 640px at 20% -12%, rgba(61, 108, 240, 0.16), transparent 60%),
    radial-gradient(900px 560px at 100% 10%, rgba(20, 39, 102, 0.35), transparent 55%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---- botões compartilhados (mesmo padrão dos outros apps) ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: linear-gradient(135deg, #5686f5, var(--accent));
  color: #fff;
  border: none;
  padding: 0.6rem 1.15rem;
  border-radius: 9px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 6px 16px rgba(61, 108, 240, 0.25);
}

.btn:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(61, 108, 240, 0.35); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  box-shadow: none;
  border-radius: 9px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn-danger { color: var(--danger); border-color: rgba(226, 88, 107, 0.4); }
.btn-danger:hover { background: rgba(226, 88, 107, 0.12); color: var(--danger); }

.card {
  background: linear-gradient(160deg, var(--surface) 0%, #0c1120 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.85rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

/* ---- botão "voltar ao DS2HUB" (mesmo padrão do Contratos/Cobrança) ---- */
.value-toggle {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  box-shadow: 0 3px 10px rgba(11, 107, 245, 0.35);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.value-toggle:hover { filter: brightness(1.1); transform: translateY(-1px); }
.value-toggle svg { width: 16px; height: 16px; }

.value-toggle-pulse { animation: value-toggle-pulse 0.32s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes value-toggle-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(0.82); }
  100% { transform: scale(1); }
}

/* ---- tela "acesso pelo DS2HUB" (sem sessão válida) ---- */
.login-necessario-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-necessario-card {
  max-width: 380px;
  text-align: center;
}

.login-necessario-card h1 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 0.6rem;
}

.login-necessario-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.4rem;
}

/* ==================================================================
   Tarefas — layout estilo "Notas"
   ================================================================== */

.tf-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.tf-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.4rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tf-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tf-brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(11, 107, 245, 0.4);
}

.tf-brand-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tf-brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.tf-topbar-right {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.tf-greeting {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.tf-greeting strong { color: var(--text); }

.logout-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 500;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
}

.logout-link:hover { background: var(--surface-2); color: var(--text); }
.logout-link svg { width: 16px; height: 16px; }

.tf-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ---- coluna da lista ---- */
.tf-list-pane {
  width: 340px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.012);
}

.tf-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tf-list-tabs {
  display: flex;
  gap: 0.3rem;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0.2rem;
}

.tf-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.tf-tab.active { background: var(--accent); color: #fff; }

.tf-new-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(11, 107, 245, 0.35);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.tf-new-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }

.tf-list-items {
  flex: 1;
  overflow-y: auto;
}

.tf-list-empty {
  padding: 2rem 1.2rem;
  color: var(--text-faint);
  font-size: 0.85rem;
  text-align: center;
}

.tf-list-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  align-items: flex-start;
}

.tf-list-item:hover { background: var(--surface-2); }
.tf-list-item.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }

.tf-cat-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
}

.tf-cat-badge svg { width: 14px; height: 14px; }
.tf-cat-badge.cat-obrigacao { color: var(--accent); border-color: rgba(11, 107, 245, 0.4); background: var(--accent-soft); }
.tf-cat-badge.cat-ideia { color: var(--warning); border-color: rgba(224, 165, 61, 0.4); background: rgba(224, 165, 61, 0.12); }

.tf-item-main { flex: 1; min-width: 0; }

.tf-item-title {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tf-list-item.is-done .tf-item-title {
  text-decoration: line-through;
  color: var(--text-faint);
  font-weight: 500;
}

.tf-item-snippet {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.15rem;
}

.tf-list-item.is-done .tf-item-snippet { color: var(--text-faint); }

.tf-item-due {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-faint);
}

.tf-due-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-faint);
}

.tf-due-dot.due-overdue { background: var(--danger); box-shadow: 0 0 0 3px rgba(226, 88, 107, 0.18); }
.tf-due-dot.due-soon { background: var(--warning); box-shadow: 0 0 0 3px rgba(224, 165, 61, 0.18); }
.tf-due-dot.due-ok { background: var(--success); box-shadow: 0 0 0 3px rgba(47, 181, 113, 0.18); }

/* ---- coluna do editor ---- */
.tf-editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tf-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  gap: 0.8rem;
  padding: 2rem;
  text-align: center;
}

.tf-empty-state svg { width: 48px; height: 48px; opacity: 0.5; }
.tf-empty-state p { margin: 0; font-size: 0.9rem; max-width: 280px; }

.tf-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.6rem 2.2rem 2rem;
  min-height: 0;
}

.tf-editor[hidden],
.tf-empty-state[hidden] {
  display: none;
}

.tf-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.tf-category-toggle {
  display: flex;
  gap: 0.4rem;
}

.tf-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border-light);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.tf-cat-btn svg { width: 15px; height: 15px; }

.tf-cat-btn[data-cat="obrigacao"].active { color: var(--accent); border-color: rgba(11, 107, 245, 0.5); background: var(--accent-soft); }
.tf-cat-btn[data-cat="ideia"].active { color: var(--warning); border-color: rgba(224, 165, 61, 0.5); background: rgba(224, 165, 61, 0.14); }

.tf-done-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
}

.tf-done-toggle input { width: 16px; height: 16px; accent-color: var(--success); }

.tf-title-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  padding: 0;
  margin-bottom: 0.5rem;
}

.tf-title-input::placeholder { color: var(--text-faint); }

.tf-due-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}

.tf-due-row label {
  color: var(--text-faint);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.tf-due-row input[type="datetime-local"] {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text);
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  font-family: inherit;
}

.tf-body-input {
  flex: 1;
  resize: none;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 0;
}

.tf-body-input::placeholder { color: var(--text-faint); }

@media (max-width: 780px) {
  .tf-body { flex-direction: column; }
  .tf-list-pane { width: 100%; height: 42vh; border-right: none; border-bottom: 1px solid var(--border); }
  .tf-editor { padding: 1.3rem 1.3rem 1.6rem; }
}
