/* ==========================================================================
   ESTÚDIO — estilo "canvas + painéis flutuantes" (macOS/iOS), não SaaS-grid.
   Hierarquia por espaço/profundidade, não por linhas de borda pesadas.
   ========================================================================== */

:root {
  --canvas-light: #ECEAE3;
  --canvas-dark: #0D0F13;

  --panel-light: rgba(255, 255, 255, 0.72);
  --panel-dark: rgba(26, 29, 36, 0.72);

  --sub-light: rgba(0, 0, 0, 0.035);
  --sub-dark: rgba(255, 255, 255, 0.045);

  --hairline-light: rgba(0, 0, 0, 0.07);
  --hairline-dark: rgba(255, 255, 255, 0.08);

  --ink: #1B1D22;
  --paper-text: #ECEAE3;

  --muted-light: rgba(27, 29, 34, 0.55);
  --muted-dark: rgba(236, 234, 227, 0.55);

  --accent: #34A874;
  --accent-soft-light: rgba(52, 168, 116, 0.14);
  --accent-soft-dark: rgba(52, 168, 116, 0.22);

  --hi: #E8604A;
  --mid: #E8A23C;
  --low: #4F92D8;

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  background: var(--canvas-light);
  color: var(--ink);
}
html.dark body {
  background: var(--canvas-dark);
  color: var(--paper-text);
}

textarea, input, select, button { font-family: inherit; }

/* ---------------------------------------------------------------------- */
/* SHELL                                                                   */
/* ---------------------------------------------------------------------- */
#shell {
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  display: flex;
  gap: 14px;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  min-height: 0;
}

.glass-panel {
  background: var(--panel-light);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--hairline-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 18px 40px -18px rgba(0,0,0,0.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
html.dark .glass-panel {
  background: var(--panel-dark);
  border-color: var(--hairline-dark);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 18px 40px -18px rgba(0,0,0,0.6);
}

/* ---------------------------------------------------------------------- */
/* SIDEBAR                                                                 */
/* ---------------------------------------------------------------------- */
.sidebar { width: 250px; flex-shrink: 0; min-height: 0; transition: width .18s ease, opacity .18s ease; }
.sidebar.collapsed { width: 0; opacity: 0; border: none; margin-right: -14px; }

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 14px 10px;
}
.sidebar-title { font-size: 13px; font-weight: 700; opacity: 0.45; flex: 1; }

.project-tree { flex: 1; overflow-y: auto; min-height: 0; padding: 4px 10px 10px; }

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--hairline-light);
}
html.dark .sidebar-foot { border-top-color: var(--hairline-dark); }
.sidebar-stat { font-size: 11.5px; opacity: 0.45; line-height: 1.4; }

.project-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 1px;
  transition: background .12s ease;
}
.project-row:hover { background: var(--sub-light); }
html.dark .project-row:hover { background: var(--sub-dark); }
.project-row.active { background: var(--accent-soft-light); color: var(--accent); }
html.dark .project-row.active { background: var(--accent-soft-dark); color: #6FDDAA; }

.project-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.project-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-count { font-size: 11px; opacity: 0.4; font-weight: 700; }
.project-chevron {
  width: 14px; height: 14px; flex-shrink: 0; opacity: 0.4;
  transition: transform .15s ease;
}
.project-chevron.expanded { transform: rotate(90deg); }
.project-children { padding-left: 15px; }

/* ---------------------------------------------------------------------- */
/* MAIN PANEL / TOOLBAR                                                    */
/* ---------------------------------------------------------------------- */
.main { flex: 1; min-width: 0; min-height: 0; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px 14px;
  flex-shrink: 0;
}
.toolbar-crumb { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toolbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Segmented control (iOS-style) */
.segmented {
  position: relative;
  display: flex;
  background: var(--sub-light);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
html.dark .segmented { background: var(--sub-dark); }
.segmented-highlight {
  position: absolute;
  top: 3px; left: 3px;
  height: calc(100% - 6px);
  border-radius: 999px;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  transition: transform .25s cubic-bezier(.4,0,.2,1), width .25s cubic-bezier(.4,0,.2,1);
  z-index: 0;
}
html.dark .segmented-highlight { background: rgba(255,255,255,0.14); box-shadow: none; }
.segmented-btn {
  position: relative;
  z-index: 1;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 999px;
  opacity: 0.5;
  white-space: nowrap;
  transition: opacity .15s ease;
}
.segmented-btn.active { opacity: 1; }
.seg-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 15px; height: 15px; padding: 0 4px;
  margin-left: 5px;
  border-radius: 999px;
  background: var(--hi);
  color: white;
  font-size: 10px; font-weight: 700;
  vertical-align: middle;
}
.seg-badge:empty { display: none; }

/* Icon buttons */
.icon-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  opacity: 0.55;
  transition: background .12s ease, opacity .12s ease;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { opacity: 1; background: var(--sub-light); }
html.dark .icon-btn:hover { background: var(--sub-dark); }
.icon-btn-sm { width: 28px; height: 28px; }
.icon-btn-sm svg { width: 14px; height: 14px; }

.fab {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 14px -4px rgba(52,168,116,0.55);
  transition: transform .12s ease, box-shadow .12s ease;
}
.fab svg { width: 17px; height: 17px; }
.fab:hover { transform: scale(1.06); }
.fab:active { transform: scale(0.96); }

/* Search bar */
.search-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 22px 12px;
  padding: 9px 14px;
  background: var(--sub-light);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
html.dark .search-bar-wrap { background: var(--sub-dark); }
.search-bar-wrap.hidden { display: none; }
.search-bar-icon { width: 15px; height: 15px; opacity: 0.4; flex-shrink: 0; }
#global-search { flex: 1; background: transparent; border: none; outline: none; font-size: 13.5px; }
#global-search::placeholder { color: inherit; opacity: 0.4; }

/* ---------------------------------------------------------------------- */
/* VIEW CONTENT                                                            */
/* ---------------------------------------------------------------------- */
.view-content { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 0 22px 22px; }
.view-content.hidden { display: none; }

.hint-text { font-size: 12.5px; opacity: 0.4; padding: 6px 2px 10px; display: block; }

/* Capture bar (lembretes) — mais simples que a de ideias, uma linha só */
.reminder-capture-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--sub-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 14px;
}
html.dark .reminder-capture-bar { background: var(--sub-dark); }
.reminder-capture-bar svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.reminder-capture-bar input {
  flex: 1; background: transparent; border: none; outline: none;
  font-size: 14.5px; font-weight: 500;
}
.reminder-capture-bar input::placeholder { color: inherit; opacity: 0.45; }

.reminder-list { display: flex; flex-direction: column; }
.reminder-row {
  padding: 10px 4px;
  border-bottom: 1px solid var(--hairline-light);
}
html.dark .reminder-row { border-bottom-color: var(--hairline-dark); }
.reminder-row:last-child { border-bottom: none; }

.reminder-row-main { display: flex; align-items: center; gap: 12px; }

.reminder-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--hairline-light);
  flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s ease;
}
html.dark .reminder-check { border-color: var(--hairline-dark); }
.reminder-check.checked { background: var(--accent); border-color: var(--accent); }
.reminder-check svg { width: 12px; height: 12px; color: white; }

.reminder-text {
  flex: 1; font-size: 14.5px; line-height: 1.4;
  outline: none; min-width: 0;
}
.reminder-row.is-done .reminder-text { opacity: 0.4; text-decoration: line-through; }

.reminder-count-badge { font-size: 11px; font-weight: 700; opacity: 0.4; flex-shrink: 0; }

.reminder-add-btn, .reminder-delete {
  opacity: 0; flex-shrink: 0;
  transition: opacity .12s ease;
}
.reminder-delete { color: var(--hi); }
.reminder-row:hover .reminder-add-btn, .reminder-row:hover .reminder-delete { opacity: 0.55; }
.reminder-add-btn:hover, .reminder-delete:hover { opacity: 1 !important; }
@media (max-width: 860px) { .reminder-add-btn, .reminder-delete { opacity: 0.45; } }

.reminder-subtasks { margin-left: 34px; display: flex; flex-direction: column; }
.reminder-subtasks:not(:empty) { margin-top: 6px; margin-bottom: 2px; gap: 5px; }

.reminder-subtask-row { display: flex; align-items: center; gap: 9px; }
.reminder-subtask-check {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--hairline-light);
  flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
html.dark .reminder-subtask-check { border-color: var(--hairline-dark); }
.reminder-subtask-check.checked { background: var(--accent); border-color: var(--accent); }
.reminder-subtask-check svg { width: 9px; height: 9px; color: white; }
.reminder-subtask-text { flex: 1; font-size: 13px; outline: none; opacity: 0.85; min-width: 0; }
.reminder-subtask-row.is-done .reminder-subtask-text { opacity: 0.4; text-decoration: line-through; }
.reminder-subtask-remove { font-size: 11px; opacity: 0; color: var(--hi); cursor: pointer; flex-shrink: 0; }
.reminder-subtask-row:hover .reminder-subtask-remove { opacity: 0.5; }
.reminder-subtask-remove:hover { opacity: 1; }
@media (max-width: 860px) { .reminder-subtask-remove { opacity: 0.4; } }

/* Capture bar (ideias) */
.capture-bar {
  background: var(--sub-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
}
html.dark .capture-bar { background: var(--sub-dark); }
.capture-bar textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  min-height: 22px;
  max-height: 120px;
}
.capture-bar textarea::placeholder { color: inherit; opacity: 0.4; }
.capture-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.capture-row input[type="text"] {
  flex: 1;
  font-size: 12.5px;
  background: transparent;
  border: 1px dashed var(--hairline-light);
  border-radius: 999px;
  padding: 6px 12px;
  outline: none;
}
html.dark .capture-row input[type="text"] { border-color: var(--hairline-dark); }

.pill-select {
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
}
html.dark .pill-select { background: rgba(255,255,255,0.08); color: inherit; }
.pill-select-ghost { background: var(--sub-light); font-weight: 500; opacity: 0.8; }
html.dark .pill-select-ghost { background: var(--sub-dark); }

.btn-primary {
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  transition: opacity .12s ease;
}
.btn-primary:hover { opacity: 0.9; }
.btn-ghost {
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  opacity: 0.6;
}
.btn-ghost:hover { opacity: 1; background: var(--sub-light); }
html.dark .btn-ghost:hover { background: var(--sub-dark); }
.btn-danger-ghost { font-size: 12.5px; font-weight: 600; color: var(--hi); opacity: 0.85; }
.btn-danger-ghost:hover { opacity: 1; }
.btn-danger-ghost.hidden { display: none; }

/* Chip filter row */
.chip-row { display: flex; align-items: center; gap: 6px; padding-bottom: 14px; flex-wrap: nowrap; overflow-x: auto; }
.chip {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--sub-light);
  opacity: 0.6;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .12s ease;
}
html.dark .chip { background: var(--sub-dark); }
.chip:hover { opacity: 0.85; }
.chip.active { background: var(--accent); color: white; opacity: 1; }

/* ---------------------------------------------------------------------- */
/* MASONRY (ideias / referências)                                         */
/* ---------------------------------------------------------------------- */
.masonry { column-count: 1; column-gap: 14px; }
@media (min-width: 900px)  { .masonry { column-count: 2; } }
@media (min-width: 1300px) { .masonry { column-count: 3; } }
@media (min-width: 1700px) { .masonry { column-count: 4; } }

.card {
  break-inside: avoid;
  margin-bottom: 14px;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--hairline-light);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease;
}
html.dark .card { background: rgba(255,255,255,0.045); border-color: var(--hairline-dark); }
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -14px rgba(0,0,0,0.18); }

.idea-text { font-size: 13.5px; line-height: 1.55; margin-bottom: 10px; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.tag-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--sub-light);
  opacity: 0.75;
}
html.dark .tag-chip { background: var(--sub-dark); }

.type-badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.type-insight { background: var(--accent-soft-light); color: var(--accent); }
.type-referencia { background: rgba(79,146,216,0.14); color: var(--low); }
.type-roteiro { background: rgba(232,162,60,0.16); color: var(--mid); }
html.dark .type-insight { background: var(--accent-soft-dark); color: #6FDDAA; }
html.dark .type-referencia { background: rgba(79,146,216,0.22); color: #8FC1F2; }
html.dark .type-roteiro { background: rgba(232,162,60,0.24); color: #F0C877; }

.status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-novo { background: var(--mid); }
.dot-desenvolvimento { background: var(--low); }
.dot-revisado { background: var(--accent); }
.dot-arquivado { background: #9A9A9A; }

/* Reference cards (moodboard) */
.ref-card { padding: 0; overflow: hidden; }
.ref-image { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--sub-light); }
.ref-image-placeholder {
  width: 100%; height: 90px; display: flex; align-items: center; justify-content: center;
  background: var(--sub-light); color: currentColor; opacity: 0.3;
}
html.dark .ref-image-placeholder, html.dark .ref-image { background: var(--sub-dark); }
.ref-image-placeholder svg { width: 26px; height: 26px; }
.ref-body { padding: 13px 15px 15px; }
.ref-title { font-size: 13.5px; font-weight: 700; margin-bottom: 4px; }
.ref-note { font-size: 12.5px; opacity: 0.65; line-height: 1.5; margin-bottom: 8px; }
.ref-link-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; opacity: 0.6;
  padding: 3px 9px; border-radius: 999px; background: var(--sub-light);
  margin-bottom: 8px;
}
html.dark .ref-link-chip { background: var(--sub-dark); }
.ref-link-chip svg { width: 11px; height: 11px; }

.ref-links-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ref-link-row { display: flex; align-items: center; gap: 8px; }
.ref-link-row input { flex: 1; }
.btn-add-link { align-self: flex-start; padding-left: 0; }

.portfolio-gallery { display: flex; flex-wrap: wrap; gap: 10px; }
.portfolio-thumb {
  position: relative; width: 84px; height: 84px;
  border-radius: 14px; overflow: hidden;
  background: var(--sub-light);
}
html.dark .portfolio-thumb { background: var(--sub-dark); }
.portfolio-thumb img { width: 100%; height: 100%; object-fit: cover; }
.portfolio-thumb-remove {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; cursor: pointer;
}
.portfolio-thumb-cover-badge {
  position: absolute; bottom: 4px; left: 4px;
  font-size: 9px; font-weight: 700;
  background: var(--accent); color: white;
  padding: 1px 6px; border-radius: 6px;
}
.portfolio-add-tile {
  width: 84px; height: 84px; border-radius: 14px;
  border: 1.5px dashed var(--hairline-light);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0.6; transition: all .12s ease;
  flex-shrink: 0;
}
.portfolio-add-tile svg { width: 20px; height: 20px; }
.portfolio-add-tile:hover { opacity: 1; background: var(--accent-soft-light); border-color: var(--accent); }
html.dark .portfolio-add-tile { border-color: var(--hairline-dark); }
html.dark .portfolio-add-tile:hover { background: var(--accent-soft-dark); }

.portfolio-image-badge {
  position: absolute; top: 8px; right: 8px;
  font-size: 10px; font-weight: 700;
  background: rgba(0,0,0,0.55); color: white;
  padding: 2px 7px; border-radius: 999px;
}
.portfolio-client { font-size: 11px; font-weight: 700; color: var(--accent); margin-bottom: 3px; }

/* ---------------------------------------------------------------------- */
/* KANBAN                                                                  */
/* ---------------------------------------------------------------------- */
.kanban { flex: 1; display: flex; overflow-x: auto; padding-bottom: 4px; min-height: 0; }
.kanban-col { flex: 0 0 300px; min-width: 220px; max-width: 640px; display: flex; min-height: 0; }
.kanban-col-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--sub-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 0;
}
html.dark .kanban-col-inner { background: var(--sub-dark); }

.kanban-resizer {
  width: 14px;
  flex-shrink: 0;
  cursor: col-resize;
  position: relative;
}
.kanban-resizer::after {
  content: '';
  position: absolute;
  left: 50%; top: 16%; bottom: 16%;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 3px;
  background: var(--hairline-light);
  transition: background .12s ease;
}
html.dark .kanban-resizer::after { background: var(--hairline-dark); }
.kanban-resizer:hover::after, .kanban-resizer.active::after { background: var(--accent); }

.kanban-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px 10px;
  font-size: 12.5px; font-weight: 700;
  flex-shrink: 0;
}
.kanban-count { font-size: 11px; font-weight: 700; opacity: 0.35; }
.kanban-drop { flex: 1; overflow-y: auto; min-height: 0; padding: 2px 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.kanban-drop.drag-over { background: var(--accent-soft-light); border-radius: var(--radius-sm); }

.task-card {
  background: rgba(255,255,255,0.9);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  cursor: grab;
  transition: transform .12s ease, box-shadow .12s ease;
}
html.dark .task-card { background: rgba(255,255,255,0.06); }
.task-card:hover { box-shadow: 0 10px 22px -12px rgba(0,0,0,0.18); transform: translateY(-1px); }
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: 0.35; }

.task-title { font-size: 13px; font-weight: 600; line-height: 1.35; margin-bottom: 8px; }
.task-meta-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.prio-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.prio-alta { background: var(--hi); }
.prio-media { background: var(--mid); }
.prio-baixa { background: var(--low); }
.task-due { font-size: 11px; font-weight: 600; opacity: 0.55; }
.task-due.overdue { color: var(--hi); opacity: 1; }
.task-card.overdue { background: rgba(232,96,74,0.07); }
html.dark .task-card.overdue { background: rgba(232,96,74,0.1); }

/* ---------------------------------------------------------------------- */
/* MODAIS                                                                  */
/* ---------------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,11,14,0.5);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 24px;
}
.modal-overlay.hidden { display: none; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) { @keyframes modalIn { from{opacity:1;transform:none;} to{opacity:1;transform:none;} } }

.modal-box {
  background: #FDFCFA;
  border-radius: 28px;
  padding: 34px 40px 32px;
  width: 100%; max-width: 520px; max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,0.4);
  animation: modalIn .22s cubic-bezier(.2,.8,.2,1) both;
}
html.dark .modal-box { background: #1A1D24; color: var(--paper-text); }
.modal-box-sm { max-width: 380px; }
.modal-box-md { max-width: 460px; }
.modal-box-lg { max-width: 900px; }

.modal-split { display: grid; grid-template-columns: 1fr 320px; gap: 40px; align-items: start; }
.modal-split-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.modal-split-side {
  display: flex; flex-direction: column; gap: 22px;
  padding-left: 32px;
  border-left: 1px solid var(--hairline-light);
}
html.dark .modal-split-side { border-left-color: var(--hairline-dark); }

.modal-input-title {
  font-size: 17px; font-weight: 700;
  border: none; background: transparent;
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--hairline-light);
  border-radius: 0;
}
html.dark .modal-input-title { border-bottom-color: var(--hairline-dark); }
.modal-input-title:focus { box-shadow: none; border-bottom-color: var(--accent); }

.modal-textarea-hero { min-height: 190px; line-height: 1.6; }
.modal-textarea-md { min-height: 100px; line-height: 1.55; }

@media (max-width: 860px) {
  .modal-split { grid-template-columns: 1fr; }
  .modal-split-side { padding-left: 0; border-left: none; border-top: 1px solid var(--hairline-light); padding-top: 18px; }
  html.dark .modal-split-side { border-top-color: var(--hairline-dark); }
}


.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; gap: 12px; }
.modal-head-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.modal-head h3 { font-size: 17px; font-weight: 800; margin: 0; letter-spacing: -0.01em; }

.modal-icon {
  width: 36px; height: 36px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.modal-icon svg { width: 17px; height: 17px; }
.modal-icon-task { background: var(--accent-soft-light); color: var(--accent); }
html.dark .modal-icon-task { background: var(--accent-soft-dark); color: #6FDDAA; }
.modal-icon-idea { background: rgba(232,162,60,0.16); color: var(--mid); }
html.dark .modal-icon-idea { background: rgba(232,162,60,0.24); color: #F0C877; }
.modal-icon-ref { background: rgba(79,146,216,0.14); color: var(--low); }
html.dark .modal-icon-ref { background: rgba(79,146,216,0.22); color: #8FC1F2; }
.modal-icon-project { background: rgba(140,111,214,0.16); color: #8C6FD6; }
html.dark .modal-icon-project { background: rgba(140,111,214,0.24); color: #B7A6EA; }

.modal-form { display: flex; flex-direction: column; gap: 16px; }
.modal-divider { height: 1px; background: var(--hairline-light); margin: 2px 0; border: none; }
html.dark .modal-divider { background: var(--hairline-dark); }

.modal-label { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; opacity: 0.5; margin-bottom: 7px; }
.modal-label-icon { width: 12px; height: 12px; flex-shrink: 0; opacity: 0.8; }
.modal-input {
  width: 100%;
  font-size: 14px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--hairline-light);
  background: #F6F5F1;
  color: inherit;
  resize: none;
}
html.dark .modal-input { border-color: var(--hairline-dark); background: #14161B; }
.modal-input:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft-light); border-color: var(--accent); }
html.dark .modal-input:focus { box-shadow: 0 0 0 3px var(--accent-soft-dark); }

.modal-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.modal-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.modal-actions { display: flex; align-items: center; padding-top: 10px; flex-wrap: wrap; gap: 8px; }
.flex-1 { flex: 1; }

.chip-toggle-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle {
  font-size: 12.5px; font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  background: #F6F5F1;
  border: 1px solid var(--hairline-light);
  opacity: 0.75;
  transition: all .12s ease;
}
html.dark .chip-toggle { background: #14161B; border-color: var(--hairline-dark); }
.chip-toggle:hover { opacity: 1; }
.chip-toggle.active { background: var(--accent); border-color: var(--accent); color: white; opacity: 1; }
.chip-toggle[data-value="alta"]::before, .chip-toggle[data-value="media"]::before, .chip-toggle[data-value="baixa"]::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; vertical-align: middle;
}
.chip-toggle[data-value="alta"]::before { background: var(--hi); }
.chip-toggle[data-value="media"]::before { background: var(--mid); }
.chip-toggle[data-value="baixa"]::before { background: var(--low); }

.ref-preview {
  width: 100%; height: 220px;
  border-radius: 16px;
  background: var(--sub-light);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
  color: currentColor; opacity: 0.9;
}
html.dark .ref-preview { background: var(--sub-dark); }
.ref-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ref-preview svg { width: 30px; height: 30px; opacity: 0.3; }

.color-picker { display: flex; gap: 8px; }
.color-swatch {
  width: 24px; height: 24px; border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
}
.color-swatch.selected { border-color: var(--ink); }
html.dark .color-swatch.selected { border-color: var(--paper-text); }

.settings-section { margin-bottom: 20px; }
.settings-section:last-child { margin-bottom: 4px; }
.settings-label { font-size: 12px; font-weight: 700; opacity: 0.45; margin-bottom: 10px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--hairline-light);
}
html.dark .settings-row { border-top-color: var(--hairline-dark); }
.settings-row-title { font-size: 13px; font-weight: 600; }
.settings-row-desc { font-size: 11.5px; opacity: 0.5; line-height: 1.4; margin-top: 2px; max-width: 260px; }

/* ---------------------------------------------------------------------- */
/* MULTI-VIEW DE TAREFAS (Lista / Calendário / Linha do tempo)             */
/* ---------------------------------------------------------------------- */
.task-view-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.task-view-panel.hidden { display: none; }
.task-view-panel > div { min-height: 0; }

.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 4px;
  transition: background .12s ease;
}
.task-row:hover { background: var(--sub-light); }
html.dark .task-row:hover { background: var(--sub-dark); }
.task-row-check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--hairline-light);
  flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
html.dark .task-row-check { border-color: var(--hairline-dark); }
.task-row-check.checked { background: var(--accent); border-color: var(--accent); }
.task-row-check.checked svg { width: 11px; height: 11px; color: white; }
.task-row-title { flex: 1; font-size: 13.5px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row.is-done .task-row-title { opacity: 0.4; text-decoration: line-through; }
.task-row-group-label { font-size: 11.5px; font-weight: 700; opacity: 0.4; padding: 14px 14px 6px; }
.task-row-group-label:first-child { padding-top: 4px; }

.calendar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 4px 12px;
  flex-shrink: 0;
}
.calendar-head-title { font-size: 13.5px; font-weight: 700; }
.calendar-nav { display: flex; gap: 4px; }
.calendar-grid {
  flex: 1; overflow-y: auto; min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  align-content: start;
}
.calendar-dow { font-size: 10.5px; font-weight: 700; opacity: 0.4; text-align: center; padding-bottom: 4px; }
.calendar-cell {
  min-height: 88px;
  border-radius: var(--radius-sm);
  background: var(--sub-light);
  padding: 6px 6px 4px;
  display: flex; flex-direction: column; gap: 3px;
}
html.dark .calendar-cell { background: var(--sub-dark); }
.calendar-cell.other-month { opacity: 0.35; }
.calendar-cell.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.calendar-daynum { font-size: 11px; font-weight: 700; opacity: 0.6; margin-bottom: 2px; }
.calendar-chip {
  font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 6px;
  background: rgba(255,255,255,0.9);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
  border-left: 2px solid var(--low);
}
html.dark .calendar-chip { background: rgba(255,255,255,0.08); }
.calendar-more { font-size: 10px; opacity: 0.45; padding: 1px 6px; }

.timeline-group { margin-bottom: 16px; }
.timeline-group-head { font-size: 12px; font-weight: 700; margin-bottom: 8px; opacity: 0.7; }
.timeline-group-head.is-overdue { color: var(--hi); }
.timeline-row { display: flex; flex-wrap: wrap; gap: 8px; }
.timeline-chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--hairline-light);
  cursor: pointer;
}
html.dark .timeline-chip { background: rgba(255,255,255,0.05); border-color: var(--hairline-dark); }

/* Stale project indicator */
.stale-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--mid); flex-shrink: 0; margin-left: 2px; }

/* ---------------------------------------------------------------------- */
/* MAPA MENTAL                                                             */
/* ---------------------------------------------------------------------- */
.mind-toolbar { display: flex; align-items: center; gap: 12px; padding: 4px 22px 12px 0; flex-shrink: 0; }
.mind-canvas-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
  border-radius: var(--radius-md);
  background-image: radial-gradient(circle, var(--hairline-light) 1px, transparent 1px);
  background-size: 22px 22px;
  margin-right: 22px;
  margin-bottom: 4px;
}
html.dark .mind-canvas-wrap { background-image: radial-gradient(circle, var(--hairline-dark) 1px, transparent 1px); }
.mind-canvas { position: relative; width: 2400px; height: 1600px; }
.mind-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mind-link-line { stroke: var(--accent); stroke-width: 1.5; opacity: 0.55; }

.mind-node {
  position: absolute;
  width: 190px;
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--hairline-light);
  border-radius: 14px;
  padding: 0 12px 9px;
  box-shadow: 0 8px 20px -10px rgba(0,0,0,0.18);
  z-index: 1;
}
html.dark .mind-node { background: #21242C; border-color: var(--hairline-dark); }
.mind-node.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.mind-node-handle { height: 16px; cursor: grab; margin: 0 -12px 2px; }
.mind-node-handle::before { content: ''; display: block; width: 28px; height: 3px; border-radius: 3px; background: var(--hairline-light); margin: 6px auto 0; }
html.dark .mind-node-handle::before { background: var(--hairline-dark); }
.mind-node-text { font-size: 13px; line-height: 1.4; outline: none; min-height: 20px; margin-bottom: 8px; }
.mind-node.done .mind-node-text { opacity: 0.5; text-decoration: line-through; }
.mind-node-foot { display: flex; align-items: center; justify-content: space-between; font-size: 11px; opacity: 0.6; }
.mind-node-check { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.mind-node-del { opacity: 0.4; }
.mind-node-del:hover { opacity: 1; color: var(--hi); }

/* ---------------------------------------------------------------------- */
/* UTIL                                                                    */
/* ---------------------------------------------------------------------- */
.hidden { display: none !important; }
.scroll-clean::-webkit-scrollbar { width: 6px; height: 6px; }
.scroll-clean::-webkit-scrollbar-track { background: transparent; }
.scroll-clean::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.3); border-radius: 8px; }
.scroll-clean-x { scrollbar-width: thin; }
.scroll-clean-x::-webkit-scrollbar { height: 5px; }
.scroll-clean-x::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.25); border-radius: 8px; }

.empty-state { font-size: 12.5px; opacity: 0.35; text-align: center; padding: 30px 10px; }

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------------------- */
/* RESPONSIVO — MOBILE / TABLET                                            */
/* ---------------------------------------------------------------------- */
#sidebar-backdrop { display: none; }

@media (max-width: 860px) {
  #shell {
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    gap: 0;
  }

  /* iOS dá zoom automático ao focar campo com fonte < 16px, e não volta sozinho. */
  input, textarea, select, .reminder-text[contenteditable], .mind-node-text[contenteditable] { font-size: 16px !important; }


  /* Sidebar vira gaveta sobreposta em vez de encolher o conteúdo */
  .sidebar {
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(8px, env(safe-area-inset-left));
    width: min(78vw, 300px);
    z-index: 41;
    transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .22s ease;
    transform: translateX(0);
    opacity: 1;
  }
  .sidebar.collapsed {
    transform: translateX(-115%);
    opacity: 1;
    width: min(78vw, 300px);
    margin-right: 0;
    border: 1px solid var(--hairline-light);
  }
  html.dark .sidebar.collapsed { border-color: var(--hairline-dark); }

  #sidebar-backdrop.show {
    display: block;
    position: fixed; inset: 0;
    background: rgba(10,11,14,0.4);
    z-index: 40;
  }

  .main { border-radius: 22px; }

  .toolbar { flex-wrap: wrap; padding: 14px 16px 10px; row-gap: 10px; }
  .toolbar-crumb { order: 1; flex: 1 1 auto; font-size: 14px; }
  .segmented { order: 3; flex: 1 1 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented-btn { white-space: nowrap; }
  .toolbar-actions { order: 2; margin-left: 0; }

  .view-content { padding: 0 16px 16px; }
  .search-bar-wrap { margin: 0 16px 10px; }

  /* Kanban: uma coluna por vez, tela cheia, sem redimensionador */
  .kanban-resizer { display: none; }
  .kanban-col { flex: 0 0 90vw !important; min-width: 0; }
  .kanban { scroll-snap-type: x mandatory; }
  .kanban-col { scroll-snap-align: start; }

  .mind-toolbar { padding-right: 16px; }
  .mind-canvas-wrap { margin-right: 16px; }

  .modal-overlay { padding: 10px; }
  .modal-box { padding: 24px 20px 22px; border-radius: 22px; max-height: 94vh; }
  .modal-split { gap: 20px; }
  .modal-grid-3 { grid-template-columns: 1fr 1fr; }
  .modal-grid-3 > *:last-child { grid-column: span 2; }
}

@media (max-width: 480px) {
  .modal-grid-2 { grid-template-columns: 1fr; }
  .modal-grid-3 { grid-template-columns: 1fr; }
  .modal-grid-3 > *:last-child { grid-column: auto; }
  .calendar-cell { min-height: 60px; padding: 4px; }
  .calendar-chip { font-size: 9px; padding: 1px 4px; }
  .modal-input-title { font-size: 15px; }
}
