* { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow: hidden; }

:root {
  --bg-primary: #faf9f5;
  --bg-secondary: #F5F4EF;
  --bg-card: #ffffff;
  --text-primary: #141413;
  --text-secondary: #5c5c5a;
  --text-muted: #8c8c8a;
  --accent: #D97757;
  --accent-hover: #c4684a;
  --border: #e5e4df;
  --border-light: #eeeee9;
  --shadow: rgba(20, 20, 19, 0.04);
  --shadow-hover: rgba(20, 20, 19, 0.08);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  padding: 0;
  line-height: 1.5;
  overflow: hidden;
  display: flex;
  flex-direction: row;
}

/* ── App content wrapper (header + app-body, right of nav sidebar) */
.app-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  height: 100vh;
  padding: 10px 24px 20px 16px;
  overflow: hidden;
}

/* ── App body: quadros sidebar (hidden) + main ────────────── */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  gap: 0;
}

.app-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

/* ── Quadros sidebar ───────────────────────────────────────── */
.quadros-sidebar {
  width: 210px;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-radius: 12px;
  margin-right: 16px;
  padding: 12px 0;
  overflow: hidden;
  flex-shrink: 0;
}

.qs-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 8px 8px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qs-header-label {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.18s, max-width 0.25s;
  max-width: 120px;
  opacity: 1;
}

.qs-collapse-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s, transform 0.25s;
  flex-shrink: 0;
}
.qs-collapse-btn:hover { color: var(--text-primary); background: var(--bg-hover, rgba(255,255,255,0.06)); }

.qs-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 6px;
}

.qs-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
  user-select: none;
}
.qs-item:hover { background: var(--bg-hover, rgba(255,255,255,0.06)); }
.qs-item.active {
  background: var(--accent-bg, rgba(217,119,87,0.15));
}

.qs-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent);
}

.qs-name-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.qs-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qs-item.active .qs-name { color: var(--text-primary); font-weight: 600; }

/* Sufixo curto de ID quando há nomes duplicados */
.qs-id-suffix {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  opacity: 0.7;
  text-transform: uppercase;
}

/* Container dos botões de ação (rename + invite) */
.qs-item-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s;
  flex-shrink: 0;
}
.qs-item:hover .qs-item-actions { opacity: 1; }

.qs-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.12s, background 0.12s;
}
.qs-action-btn:hover { color: var(--text-primary); background: var(--bg-hover, rgba(255,255,255,0.1)); }

/* Input de rename inline */
.qs-rename-input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--accent);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  width: 100%;
  min-width: 0;
}
.qs-item.qs-renaming { cursor: default; }

.qs-footer {
  padding: 8px 6px 0 6px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.qs-btn {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  background: var(--accent);
  color: #fff;
}
.qs-btn:hover { opacity: 0.9; }
.qs-btn.qs-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.qs-btn.qs-btn-ghost:hover { background: var(--bg-hover, rgba(255,255,255,0.06)); color: var(--text-primary); }

/* Botões apenas mobile — ocultos no desktop */
.qs-mobile-create, .qs-mobile-compact { display: none !important; }

/* Bottom area (nav pill + compact button) — oculto no desktop */
#mobileBottomArea { display: none; }

/* ── Sidebar colapsada ──────────────────────────────────────── */
.quadros-sidebar.qs-collapsed {
  width: 44px;
  min-width: 44px;
}
.quadros-sidebar.qs-collapsed .qs-header-label { opacity: 0; max-width: 0; }
.quadros-sidebar.qs-collapsed .qs-collapse-btn { transform: scaleX(-1); }
.quadros-sidebar.qs-collapsed .qs-name-wrap,
.quadros-sidebar.qs-collapsed .qs-item-actions,
.quadros-sidebar.qs-collapsed .qs-footer { display: none; }
.quadros-sidebar.qs-collapsed .qs-item {
  justify-content: center;
  padding: 8px 0;
}
.quadros-sidebar.qs-collapsed .qs-dot { width: 10px; height: 10px; }
.quadros-sidebar {
  transition: width 0.25s cubic-bezier(.4,0,.2,1), min-width 0.25s cubic-bezier(.4,0,.2,1);
}

/* ── Split view ─────────────────────────────────────────────── */
.app-main.split-mode {
  flex-direction: row;
  gap: 0;
}
.app-main.split-mode .tab-panel { display: none; }
.app-main.split-mode #tasksPanel {
  display: flex;
  flex-direction: column;
  flex: 1.15;
  min-width: 0;
  border-right: 1px solid var(--border);
}
.app-main.split-mode #calendarPanel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* Calendar compact (split mode) */
.app-main.split-mode .cal-panel {
  gap: 0;
}
.app-main.split-mode .cal-main {
  flex: 1;
  min-width: 0;
}
.app-main.split-mode .cal-sidebar {
  width: 200px;
  min-width: 180px;
  max-width: 220px;
  border-left: 1px solid var(--border);
  padding: 12px;
}
.app-main.split-mode .cal-day {
  min-height: 64px;
  padding: 4px;
}
.app-main.split-mode .cal-day-num {
  font-size: 11px;
}
.app-main.split-mode .cal-event-dot {
  font-size: 10px;
  padding: 1px 4px;
}
.app-main.split-mode .cal-header {
  padding: 8px 12px;
}
.app-main.split-mode .cal-month-label {
  font-size: 14px;
}
.app-main.split-mode .cal-sidebar-title {
  font-size: 13px;
  margin-bottom: 8px;
  padding-bottom: 6px;
}
.app-main.split-mode .cal-event-item {
  padding: 6px 8px;
  margin-bottom: 6px;
}
.app-main.split-mode .cal-event-item-title { font-size: 12px; }
.app-main.split-mode #calNewTaskBtn { font-size: 12px; padding: 7px; }

/* Split view button active state */
#splitViewBtn.active {
  background: var(--accent);
  color: #fff;
}


/* Invite code modal */
.qs-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qs-modal {
  background: var(--bg-card, var(--bg-secondary));
  border-radius: 14px;
  padding: 28px 32px;
  min-width: 340px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
}
.qs-modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.qs-modal p  { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.qs-modal-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: 'Inter', monospace;
  color: var(--text-primary);
  outline: none;
  margin-bottom: 16px;
  letter-spacing: 0.05em;
  box-sizing: border-box;
}
.qs-modal-input:focus { border-color: var(--accent); }
.qs-modal-btns { display: flex; gap: 8px; justify-content: flex-end; }
.qs-modal-btns button { padding: 8px 18px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid var(--border); font-family: inherit; background: transparent; color: var(--text-primary); }
.qs-modal-btns button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Nav sidebar ───────────────────────────────────────────── */
.nav-sidebar {
  width: 204px;
  min-width: 204px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  padding: 14px 6px 10px 6px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: none;
  transition: width 0.25s cubic-bezier(.4,0,.2,1), min-width 0.25s cubic-bezier(.4,0,.2,1);
}
.ns-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 10px 10px;
}
.ns-logo-icon {
  height: 24px;
  width: auto;
  flex-shrink: 0;
}
.ns-logo-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.ns-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 10px 8px 10px;
}
.ns-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 12px 6px 12px;
  user-select: none;
}
.ns-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
  text-align: left;
  width: 100%;
  font-family: inherit;
}
.ns-item:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text-primary);
}
.ns-item.active {
  background: rgba(248,108,86,0.15);
  color: var(--accent);
  font-weight: 600;
}
.ns-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.5;
}
.ns-item:hover .ns-icon {
  opacity: 0.7;
}
.ns-item.active .ns-icon {
  opacity: 1;
  filter: invert(39%) sepia(60%) saturate(600%) hue-rotate(336deg) brightness(90%) contrast(90%);
}
.ns-spacer {
  flex: 1;
}
.ns-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  border-radius: 8px;
  transition: background 0.15s;
}
.ns-user:hover {
  background: rgba(0,0,0,0.04);
}
.ns-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: white;
  overflow: hidden;
}
.ns-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.ns-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ns-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ns-user-role {
  font-size: 10px;
  font-weight: 300;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Header ────────────────────────────────────────────────── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 6px 0 10px 0;
  border-bottom: 1px solid var(--accent);
  flex-shrink: 0;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; color: var(--text-secondary); }

.header-left {
  display: flex;
  align-items: center;
  gap: 0;
}

/* ── Header board tabs ─────────────────────────────────────── */
.header-board-tabs {
  display: flex;
  align-items: center;
  gap: 0;
}
.header-board-active {
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  padding: 6px 28px;
  border-radius: 6px 6px 0 0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  top: 5px;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: filter 0.15s;
}
.header-board-active:hover { filter: brightness(1.08); }
.hab-chevron { opacity: 0.7; transition: transform 0.15s; }

/* ── Active board dropdown menu ──────────────────────────── */
.hab-menu {
  position: fixed;
  z-index: 1300;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20,20,19,0.13);
  min-width: 170px;
  padding: 4px;
  animation: ppFadeIn 0.1s ease;
}
.hab-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 12px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  text-align: left;
}
.hab-menu-item:hover { background: var(--bg-secondary); }
.hab-menu-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }
.hab-menu-sep { height: 1px; background: var(--border); margin: 4px 8px; }
.hab-menu-danger { color: #ef4444; }
.hab-menu-danger:hover { background: #fef2f2; }
.header-board-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 16px;
  background: var(--bg-secondary);
  border: none;
  border-radius: 5px;
  color: rgba(30,30,30,0.4);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  margin-left: 12px;
}
.header-board-tab:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.header-board-tab .hbt-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}
.header-board-tab-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
  margin-left: 12px;
}
.header-board-add {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  margin-left: 8px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.12s, background 0.12s;
}
.header-board-add:hover {
  color: var(--accent);
  background: rgba(0,0,0,0.04);
}
.notif-bell-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.12s;
}
.notif-bell-btn:hover {
  background: rgba(0,0,0,0.04);
}

/* ── View toggle (header tabs) ─────────────────────────────── */
.view-toggle {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 3px;
  margin-left: 16px;
}
.view-toggle button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.view-toggle button:hover {
  background: rgba(255,255,255,0.6);
  color: var(--text-primary);
}
.view-toggle button.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(20,20,19,0.08);
  font-weight: 600;
}
.view-toggle .tab-icon {
  width: 16px;
  height: 16px;
  opacity: 0.45;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.view-toggle button:hover .tab-icon { opacity: 0.7; }
.view-toggle button.active .tab-icon {
  opacity: 0.85;
  filter: none;
}
#splitViewBtn {
  padding: 6px 10px;
}
#splitViewBtn .tab-icon {
  width: 18px;
  height: 18px;
}

/* ── Pill flutuante — desktop ───────────────────────────────── */
.floating-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 4px 20px rgba(20,20,19,0.12), 0 2px 8px rgba(20,20,19,0.06);
  padding: 4px;
  z-index: 200;
  transition: box-shadow 0.2s;
}
.floating-pill:hover {
  box-shadow: 0 6px 28px rgba(20,20,19,0.18), 0 2px 10px rgba(20,20,19,0.08);
}

.fp-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.fp-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.fp-btn.active {
  background: var(--accent);
  color: #fff;
}

.fp-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 2px;
}

/* Compact toggle icon states */
#compactToggleBtn .ico-expand { display: none; }
#compactToggleBtn.active .ico-compress { display: none; }
#compactToggleBtn.active .ico-expand { display: inline-flex; }

.buttons { display: flex; gap: 12px; }

button {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s ease;
}

button:hover {
  background: var(--bg-primary);
  border-color: var(--accent);
  color: var(--accent);
}

button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== TASKS STYLES ===== */

.board {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 24px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.board-dots { display: none; }

.column {
  background: var(--bg-secondary);
  border-radius: 12px;
  min-width: 340px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.column-header {
  padding: 16px 18px;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
}

.column-header:active {
  cursor: grabbing;
}

.column.dragging-column {
  opacity: 0.5;
}

.column-drop-indicator {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 0 -2px;
  min-height: 100px;
}

.column-header .count {
  background: var(--bg-card);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.btn-delete-section {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s ease;
  margin-left: 4px;
}

.column-header:hover .btn-delete-section,
.list-section-header:hover .btn-delete-section {
  opacity: 1;
}

.btn-delete-section:hover {
  background: #fee2e2;
  color: #991b1b;
}

.cards {
  overflow-y: auto;
  padding: 0 12px 12px;
  flex: 1;
  min-height: 0;
}
.cards::-webkit-scrollbar { width: 5px; }
.cards::-webkit-scrollbar-track { background: transparent; }
.cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.cards.drag-over {
  background: rgba(217, 119, 87, 0.05);
  border-radius: 8px;
}

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: grab;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px var(--shadow);
  position: relative;
}

.task-card:hover {
  box-shadow: 0 4px 12px var(--shadow-hover);
  border-color: var(--border);
}

.task-card .add-on-hover {
  display: none;
}

.task-card:hover .add-on-hover {
  display: block;
}

.task-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.card-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-primary);
}

.card-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
  overflow-wrap: break-word;
  word-break: break-word;
}

.card-subtasks {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-secondary);
}

.subtask {
  padding: 3px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.checkbox {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--bg-card);
}

.checkbox:hover {
  border-color: var(--accent);
}

.checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox.checked::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* ── COMPACT MODE ─────────────────────────────────────────────────── */
.board.compact-mode .column {
  min-width: 240px;
  max-width: 240px;
}

.board.compact-mode .column-header {
  padding: 10px 14px;
  font-size: 11px;
}

.board.compact-mode .cards {
  padding: 0 8px 8px;
}

.board.compact-mode .task-card {
  padding: 5px 10px;
  margin-bottom: 2px;
  border-radius: 7px;
}

.board.compact-mode .card-title {
  font-size: 12px;
  line-height: 1.4;
}

.card-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px 2px 4px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: default;
  line-height: 1;
}

.board.compact-mode .task-card .card-meta,
.board.compact-mode .task-card .card-att-bar,
.board.compact-mode .task-card .card-note,
.board.compact-mode .task-card .card-subtasks {
  display: none !important;
}

/* Compact mode: corrige margens do label-strip para o padding reduzido */
.board.compact-mode .card-label-strip {
  margin: 0;
}

/* Compact mode: area badges viram pequenos quadradinhos coloridos sem texto */
.board.compact-mode .card-areas {
  gap: 3px;
  margin-top: 3px;
}

.board.compact-mode .area-badge {
  font-size: 0 !important;
  padding: 0 !important;
  width: 8px;
  min-width: 8px;
  height: 8px;
  border-radius: 2px;
  background: currentColor !important;
  border: none !important;
}

/* ── EMPTY STATE ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 40px;
  color: var(--text-muted);
}

.empty-state button {
  font-size: 16px;
  padding: 14px 28px;
  background: var(--accent);
  border: none;
  color: white;
}

.empty-state button:hover {
  background: var(--accent-hover);
}

.status-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 4px 20px rgba(20, 20, 19, 0.15);
  z-index: 200;
}

.status-bar.visible { opacity: 1; }

.add-card {
  padding: 6px 12px 10px;
}

.add-card button {
  width: 100%;
  background: transparent;
  border: 1.5px dashed var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
}

.add-card button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(217,119,87,0.04);
}

.new-task-input {
  width: 100%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: none;
}

.new-task-input:focus {
  outline: none;
}

.new-task-input::placeholder {
  color: var(--text-muted);
}

/* Scrollbar styling */
.cards::-webkit-scrollbar,
.list-view::-webkit-scrollbar {
  width: 6px;
}

.cards::-webkit-scrollbar-track,
.list-view::-webkit-scrollbar-track {
  background: transparent;
}

.cards::-webkit-scrollbar-thumb,
.list-view::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.cards::-webkit-scrollbar-thumb:hover,
.list-view::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* List View Styles */
.list-view {
  max-width: 800px;
  margin: 0 auto;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.list-section {
  margin-bottom: 28px;
}

.list-section.drag-over {
  background: rgba(217, 119, 87, 0.05);
  border-radius: 8px;
  margin: 0 -12px 32px;
  padding: 0 12px;
}

.list-section-header {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 4px 0;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-section-header .section-title {
  cursor: pointer;
}

.list-section-header .section-title:hover {
  color: var(--text-primary);
}

.list-section-header .count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  cursor: grab;
  position: relative;
  border-radius: 10px;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px var(--shadow);
}

.list-item:active {
  cursor: grabbing;
}

.list-item:hover {
  box-shadow: 0 4px 12px var(--shadow-hover);
  border-color: var(--border);
}

.list-item.dragging {
  opacity: 0.5;
  background: var(--bg-secondary);
}

.list-item .checkbox {
  margin-top: 2px;
  flex-shrink: 0;
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.4;
}

.list-item-title.checked {
  color: var(--text-muted);
  text-decoration: line-through;
}

.list-item-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  cursor: pointer;
}

.list-item-note:hover {
  color: var(--text-secondary);
}

.list-item-note.add-note {
  font-style: italic;
  display: none;
}

.list-item:hover .list-item-note.add-note {
  display: block;
}

.list-item-subtasks {
  margin-top: 8px;
  padding-left: 2px;
}

.list-item-subtask {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.list-item-subtask .checkbox {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  margin-top: 1px;
}

.list-item-subtask span {
  cursor: pointer;
}

.list-item-subtask span:hover {
  color: var(--text-primary);
}

.list-item-add-subtask {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  cursor: pointer;
  padding: 3px 0;
  padding-left: 24px;
  display: none;
}

.list-item:hover .list-item-add-subtask {
  display: block;
}

.list-item-add-subtask:hover {
  color: var(--accent);
}

.list-item-section {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.list-item-actions {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
}

.list-item:hover .list-item-actions {
  display: flex;
  gap: 4px;
}

.list-item-actions button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 14px;
  line-height: 1;
  border-radius: 4px;
}

.list-item-actions button:hover {
  background: var(--bg-card);
  color: var(--accent);
}

.list-drop-indicator {
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 2px -12px;
}

.list-add-section {
  margin-top: 16px;
  padding: 16px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.list-add-section:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.quick-add {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.quick-add-input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 15px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}

.quick-add-input::placeholder {
  color: var(--text-muted);
}

.quick-add-section {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
}

.quick-add-section:hover {
  border-color: var(--accent);
}

.section-picker {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px var(--shadow-hover);
  padding: 4px;
  z-index: 100;
}

.section-picker button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  background: transparent;
  border: none;
  border-radius: 6px;
}

.section-picker button:hover {
  background: var(--bg-secondary);
}

/* ===== MEMORY STYLES ===== */

.memory-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: 8px;
  flex-shrink: 0;
}

.memory-tab {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  text-transform: capitalize;
}

.memory-tab:hover { color: var(--text-primary); }

.memory-tab.active {
  color: var(--text-primary);
  background: var(--bg-card);
  box-shadow: 0 1px 3px var(--shadow);
}

.memory-tab .count {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 6px;
  color: var(--text-muted);
}

.memory-tab.active .count {
  background: var(--border-light);
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.memory-flat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.memory-flat-table th {
  text-align: left;
  padding: 10px 16px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.memory-flat-table td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  line-height: 1.4;
}

.memory-flat-table td:first-child {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  width: 120px;
}

.memory-flat-table tr:last-child td {
  border-bottom: none;
}

.memory-flat-table tr:hover td {
  background: var(--bg-secondary);
}

.memory-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px var(--shadow);
}

.memory-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px var(--shadow-hover);
}

.memory-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.memory-card-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.memory-card-preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
}

.memory-card-fields {
  margin-top: 10px;
  font-size: 12px;
}

.memory-card-field {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.memory-card-field-label {
  color: var(--text-muted);
  min-width: 80px;
}

.memory-card-field-value {
  color: var(--text-secondary);
}

.file-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px var(--shadow);
}

.file-card-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.file-card-header:hover {
  background: var(--bg-secondary);
}

.file-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.file-card-content {
  padding: 16px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-y: auto;
  display: none;
  color: var(--text-secondary);
}

.file-card-content.expanded {
  display: block;
}

.stats {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 16px 24px;
  min-width: 100px;
  box-shadow: 0 1px 3px var(--shadow);
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: capitalize;
  margin-top: 4px;
}

.search-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.add-btn {
  background: transparent;
  border: 2px dashed var(--border);
  color: var(--text-muted);
  padding: 40px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
}

.add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.markdown-content {
  line-height: 1.6;
  color: var(--text-secondary);
}

.markdown-content h1 { font-size: 1.4em; margin: 16px 0 8px; color: var(--text-primary); }
.markdown-content h2 { font-size: 1.2em; margin: 14px 0 6px; color: var(--text-primary); }
.markdown-content h3 { font-size: 1.1em; margin: 12px 0 4px; color: var(--text-secondary); }
.markdown-content p { margin: 8px 0; }
.markdown-content ul, .markdown-content ol { margin: 8px 0 8px 20px; }
.markdown-content li { margin: 4px 0; }
.markdown-content code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-primary);
}
.markdown-content pre {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid var(--border-light);
}
.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 13px;
}
.markdown-content th, .markdown-content td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}
.markdown-content th {
  background: var(--bg-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 20, 19, 0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(20, 20, 19, 0.2);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.form-group textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  line-height: 1.5;
  min-height: 300px;
  resize: vertical;
}

.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Tab panel containers */
.tab-panel {
  display: none;
  flex: 1;
  min-height: 0;
  min-width: 0;
  flex-direction: column;
}

.tab-panel.active {
  display: flex;
}

.app-main > .tab-panel { flex: 1; }

/* Memory panel scrollable area */
.memory-content-area {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.memory-content-area::-webkit-scrollbar {
  width: 6px;
}

.memory-content-area::-webkit-scrollbar-track {
  background: transparent;
}

.memory-content-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.memory-content-area::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.file-card-content::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 6px;
}

.file-card-content::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.file-card-content::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.file-card-content::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* File path display */
.file-path {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== CALENDAR STYLES ===== */
.cal-panel {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 0;
  overflow: hidden;
}

.cal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.cal-month-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  min-width: 200px;
  text-align: center;
}

.cal-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.cal-nav button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: inherit;
  transition: all 0.12s;
}

.cal-nav button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.cal-nav button.today-btn {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 500;
}

.cal-nav button.today-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  flex: 1;
  min-height: 0;
}

.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 4px 0 6px;
}

.cal-day {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 8px;
  min-height: 70px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.cal-day:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--shadow-hover);
}

.cal-day.selected {
  border-color: var(--accent);
  background: rgba(217, 119, 87, 0.04);
}

.cal-day.today .cal-day-num {
  background: var(--accent);
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.cal-day.other-month {
  background: var(--bg-secondary);
  opacity: 0.5;
}

.cal-day.other-month .cal-day-num {
  color: var(--text-muted);
}

.cal-day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.cal-event-dot {
  font-size: 11px;
  line-height: 1.3;
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.cal-more {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

/* Sidebar */
.cal-sidebar {
  width: 260px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  padding-left: 16px;
  margin-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.cal-sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.cal-event-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 12px;
  position: relative;
}

.cal-event-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  padding-right: 20px;
}

.cal-event-item-cat {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.cal-add-event {
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
  width: 100%;
}

.cal-add-event:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cal-add-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cal-add-form input,
.cal-add-form select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  width: 100%;
}

.cal-add-form input:focus,
.cal-add-form select:focus {
  border-color: var(--accent);
}

.cal-add-form-btns {
  display: flex;
  gap: 6px;
}

.cal-add-form-btns button {
  flex: 1;
  padding: 7px;
  font-size: 13px;
  border-radius: 6px;
}

.cal-task-item { cursor: pointer; opacity: 0.9; }

/* Task date badge */
.card-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: rgba(217, 119, 87, 0.1);
  border-radius: 4px;
  padding: 2px 8px;
  margin-left: 30px;
  margin-top: 4px;
  cursor: pointer;
  border: 1px solid rgba(217, 119, 87, 0.2);
  transition: background 0.15s;
  user-select: none;
}
.card-date:hover { background: rgba(217, 119, 87, 0.2); }
.card-date.no-date {
  color: var(--text-muted);
  background: transparent;
  border-color: transparent;
  font-style: italic;
  font-weight: 400;
}
.card-date.no-date:hover {
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-color: var(--border);
}
.card-date input[type="date"] {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  outline: none;
  width: 108px;
}

/* Time on cards */
.card-time {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  opacity: 0.85;
}

/* Time badge in task detail meta row */
.td-time-set {
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-color: var(--border);
}
.td-time-set:hover {
  background: var(--bg-card);
}
.td-time-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 3px;
  margin-left: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.td-time-set:hover .td-time-clear { opacity: 1; }

.card-date input[type="time"] {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  outline: none;
  width: 80px;
}

/* Time select — 15-min intervals */
.td-time-select {
  border: none;
  background: var(--bg-card);
  font-family: inherit;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 2px 4px;
  outline: none;
  border-radius: 4px;
  max-width: 130px;
}

/* Calendar event time prefix */
.cal-event-time {
  font-size: 9px;
  font-weight: 600;
  opacity: 0.8;
  letter-spacing: 0.02em;
}

/* ===== LABEL STRIP — barra colorida no topo do card ===== */
.card-label-strip {
  margin: 0;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.4;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== LABELS DE ANDAMENTO ===== */
.card-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  margin-left: 30px;
  margin-top: 6px;
  cursor: pointer;
  transition: opacity 0.15s, filter 0.15s;
  user-select: none;
}
.card-label:hover { filter: brightness(0.92); }
.card-label.no-label {
  color: var(--text-muted);
  background: transparent;
  border: 1px dashed var(--border);
  font-weight: 400;
  font-style: italic;
}
.card-label.no-label:hover {
  border-color: var(--text-muted);
  color: var(--text-secondary);
}
.label-picker {
  position: fixed; z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 8px 32px rgba(20,20,19,0.16), 0 1px 3px rgba(20,20,19,0.06);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
  animation: picker-in 0.12s ease-out;
}
@keyframes picker-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.label-picker-title {
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.label-picker-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  cursor: pointer; font-size: 12px; font-weight: 600;
  transition: filter 0.1s, transform 0.1s;
}
.label-picker-item:hover { filter: brightness(0.93); transform: translateX(2px); }
.label-picker-item.active::after { content: ' ✓'; margin-left: auto; }
.label-picker-item .label-edit-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
  display: flex;
  align-items: center;
}
.label-picker-item:hover .label-edit-btn { opacity: 0.6; }
.label-picker-item .label-edit-btn:hover { opacity: 1; }
.label-picker-remove {
  padding: 7px 10px; border-radius: 7px;
  cursor: pointer; font-size: 12px;
  color: var(--text-muted); font-style: italic;
  transition: background 0.1s;
}
.label-picker-remove:hover { background: var(--bg-secondary); }
.label-picker-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}
.label-picker-manage {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: 7px;
  cursor: pointer; font-size: 12px; font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s;
}
.label-picker-manage:hover { background: var(--bg-secondary); color: var(--accent); }
.label-picker-manage img { width: 14px; height: 14px; opacity: 0.5; }

/* ===== ÁREAS ===== */
.card-areas {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.area-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.12s;
}
.area-badge:hover { filter: brightness(0.92); }

.area-badge-empty {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
}

/* ===== AREA PICKER ===== */
.area-picker {
  position: fixed;
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 8px 32px rgba(20,20,19,0.16), 0 1px 3px rgba(20,20,19,0.06);
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: picker-in 0.12s ease-out;
}
.area-picker-title {
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.area-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.12s, transform 0.1s;
}
.area-picker-item:hover { background: var(--bg-secondary); transform: translateX(2px); }
.area-picker-item.active { background: var(--bg-secondary); }
.area-picker-item.active::after { content: '✓'; margin-left: auto; font-size: 12px; color: var(--accent); }
.area-picker-item .area-edit-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
  display: flex;
  align-items: center;
}
.area-picker-item:hover .area-edit-btn { opacity: 0.6; }
.area-picker-item .area-edit-btn:hover { opacity: 1; }

.area-picker-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.area-picker-clear {
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  border-top: 1px solid var(--border);
  margin-top: 2px;
  border-radius: 0 0 6px 6px;
  transition: color 0.12s;
}
.area-picker-clear:hover { color: #ef4444; }


.area-picker-divider {
  height: 1px;
  background: var(--border);
  margin: 0 2px 4px;
}

/* ===== EDIT LABEL/AREA INLINE FORM ===== */
.picker-edit-form {
  position: fixed;
  z-index: 10000;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(20,20,19,0.2), 0 2px 6px rgba(20,20,19,0.08);
  min-width: 260px;
  animation: picker-in 0.12s ease-out;
}
.picker-edit-form h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.picker-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.picker-edit-row label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 40px;
}
.picker-edit-row input[type="text"] {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-primary);
  outline: none;
}
.picker-edit-row input[type="text"]:focus { border-color: var(--accent); }
.picker-edit-row input[type="color"] {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: transparent;
}
.picker-edit-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.picker-edit-row input[type="color"]::-webkit-color-swatch { border: none; border-radius: 5px; }
.picker-edit-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 14px;
}
.picker-edit-actions button {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  transition: background 0.12s;
}
.picker-edit-actions button:hover { background: var(--bg-secondary); }
.picker-edit-actions button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.picker-edit-actions button.primary:hover { background: var(--accent-hover); }
.picker-edit-actions button.danger {
  color: #dc2626;
  border-color: transparent;
}
.picker-edit-actions button.danger:hover { background: #fef2f2; }
.area-picker-manage {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: 7px;
  cursor: pointer; font-size: 12px; font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s;
}
.area-picker-manage:hover { background: var(--bg-secondary); color: var(--accent); }
.area-picker-manage img { width: 14px; height: 14px; opacity: 0.5; }

/* ===== PEOPLE / AVATARES ===== */
.card-people {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  margin-left: 0;
  margin-top: 6px;
}
.card-people .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 1.5px var(--border);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  margin-left: -10px;
  position: relative;
}
.card-people .avatar:first-child { margin-left: 0; }
.card-people .avatar:hover { transform: scale(1.12); box-shadow: 0 0 0 2px var(--accent); z-index: 10; }
.card-people .avatar-initial {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--text-secondary);
  cursor: pointer; transition: transform 0.1s;
  margin-left: -10px;
  position: relative;
}
.card-people .avatar-initial:first-child { margin-left: 0; }
.card-people .avatar-initial:hover { transform: scale(1.12); z-index: 10; }
.add-person-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
  transition: border-color 0.15s, color 0.15s;
}
.add-person-btn:hover { border-color: var(--accent); color: var(--accent); background: transparent; }
.people-picker {
  position: fixed; z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 8px 28px rgba(20,20,19,0.14);
  display: flex; flex-wrap: wrap; gap: 8px;
  max-width: 260px;
}
.people-picker-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; padding: 5px 4px; border-radius: 8px;
  transition: background 0.1s; width: 52px;
}
.people-picker-item:hover { background: var(--bg-secondary); }
.people-picker-item.selected { background: rgba(217,119,87,0.1); }
.people-picker-item.selected img,
.people-picker-item.selected .picker-initial { box-shadow: 0 0 0 2.5px var(--accent); }
.picker-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.picker-initial {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-secondary); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--text-secondary);
}
.people-picker-name {
  font-size: 10px; color: var(--text-secondary); text-align: center;
  max-width: 50px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.cal-sidebar::-webkit-scrollbar { width: 4px; }
.cal-sidebar::-webkit-scrollbar-track { background: transparent; }
.cal-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ===== TASK DETAIL PANEL ===== */
.task-detail-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(20, 20, 19, 0.45);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.task-detail-overlay.visible { display: flex; }
.task-detail-panel {
  background: var(--bg-card);
  width: 760px;
  max-width: 95vw;
  max-height: 88vh;
  display: flex;
  flex-direction: row;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(20,20,19,0.28), 0 2px 8px rgba(20,20,19,0.12);
  overflow: hidden;
  animation: modalPopIn 0.18s ease;
}
.task-detail-panel-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* ── Sidebar de ações (desktop) ──────────────────────────────── */
.task-detail-sidebar {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 16px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-light);
  justify-content: flex-start;
}
.task-detail-sidebar .td-sidebar-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.task-detail-sidebar .td-sidebar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
  font-family: inherit;
  transition: all 0.15s;
}
.task-detail-sidebar .td-sidebar-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}
.task-detail-sidebar .td-sidebar-btn.td-btn-done {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.task-detail-sidebar .td-sidebar-btn.td-btn-done:hover {
  filter: brightness(1.1);
  background: var(--accent);
  color: #fff;
}
.task-detail-sidebar .td-sidebar-btn.td-btn-delete:hover {
  background: #FEE2E2;
  border-color: #FECACA;
  color: #991B1B;
}
@keyframes modalPopIn {
  from { transform: scale(0.96) translateY(8px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);   opacity: 1; }
}
.task-detail-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 10px;
}
.task-detail-section-badge {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-detail-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
.task-detail-close-btn:hover { color: var(--text-primary); background: transparent; }
.task-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 32px;
}
.task-detail-body::-webkit-scrollbar { width: 6px; }
.task-detail-body::-webkit-scrollbar-track { background: transparent; }
.task-detail-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.task-detail-title-el {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  margin-left: -8px;
  transition: border-color 0.15s;
  word-break: break-word;
}
.task-detail-title-el:hover { border-color: var(--border); }
.task-detail-title-el.checked { text-decoration: line-through; color: var(--text-muted); }
.task-detail-note-el {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  margin-left: -8px;
  transition: border-color 0.15s;
  min-height: 32px;
  word-break: break-word;
}
.task-detail-note-el:hover { border-color: var(--border); }
.task-detail-note-el.empty { color: var(--text-muted); font-style: italic; }
.task-detail-divider { height: 1px; background: var(--border-light); margin: 16px 0; }
.task-detail-row-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.task-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
}
.task-detail-subtasks-list { margin-bottom: 8px; }
.task-detail-subtask-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
}
.task-detail-subtask-row:last-child { border-bottom: none; }
.task-detail-subtask-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.4;
}
.task-detail-subtask-text:hover { color: var(--text-primary); }
.task-detail-subtask-text.checked { text-decoration: line-through; color: var(--text-muted); }
.task-detail-add-subtask {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 16px;
}
.task-detail-add-subtask:hover { color: var(--accent); }
.task-detail-people-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
}
.task-detail-people-row .avatar { width: 36px; height: 36px; }
.task-detail-people-row .avatar-initial { width: 36px; height: 36px; font-size: 13px; }
.task-detail-people-row .add-person-btn { width: 36px; height: 36px; font-size: 18px; }
.task-detail-action-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
  text-align: center;
  font-family: inherit;
  transition: all 0.15s;
}
.task-detail-action-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
.task-detail-delete-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
  text-align: center;
  font-family: inherit;
  transition: all 0.15s;
}
.task-detail-delete-btn:hover { background: #FEE2E2; border-color: #FECACA; color: #991B1B; }

/* ── Comments section ─────────────────────────────────────────────── */
.task-comments-section {
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
  margin-top: 8px;
}
.task-comments-section .task-detail-row-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.task-comments-section .task-detail-row-label .comment-count {
  font-weight: 400;
  font-size: 10px;
  color: var(--text-muted);
}
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}
.comment-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  position: relative;
}
.comment-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.comment-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.comment-body {
  flex: 1;
  min-width: 0;
}
.comment-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.comment-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.comment-time {
  font-size: 11px;
  color: var(--text-muted);
}
.comment-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  word-break: break-word;
}
.comment-text.removed {
  color: var(--text-muted);
  font-style: italic;
}
.comment-delete-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.comment-item:hover .comment-delete-btn { opacity: 1; }
.comment-delete-btn:hover { color: #991B1B; }

.comment-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.comment-input-row textarea {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  outline: none;
  min-height: 36px;
  max-height: 120px;
  transition: border-color 0.15s;
}
.comment-input-row textarea:focus {
  border-color: var(--accent);
}
.comment-input-row textarea::placeholder {
  color: var(--text-muted);
}
.comment-send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.comment-send-btn:hover { background: var(--accent-hover); }
.comment-send-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.comments-offline-msg {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}
.comment-loading {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0;
}

/* ── Image split preview ──────────────────────────────────────────── */
.task-detail-overlay.td-split-active .task-detail-panel {
  width: min(90vw, 1100px);
  max-width: 90vw;
  max-height: 85vh;
  flex-direction: row;
}
.td-split-image-pane {
  flex: 1.2;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: 16px 0 0 16px;
}
.td-split-image-pane img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
}
.td-split-detail-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.td-img-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 2;
}
.td-img-nav:hover { background: rgba(255,255,255,0.25); }
.td-img-nav.prev { left: 12px; }
.td-img-nav.next { right: 12px; }
.td-split-back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  transition: color 0.15s;
}
.td-split-back-btn:hover { color: var(--text-primary); }

/* ── Split responsive ─────────────────────────────────────────────── */
@media (max-width: 700px) {
  .task-detail-overlay.td-split-active .task-detail-panel {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
  }
  .td-split-image-pane {
    flex: none;
    height: 40vh;
    border-radius: 12px 12px 0 0;
  }
  .td-split-detail-pane {
    flex: 1;
  }
  .task-detail-overlay.td-split-active .task-detail-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-left: none;
    border-top: 1px solid var(--border-light);
    padding: 12px 16px;
  }
}

/* Open detail button on card */
.open-detail-btn {
  display: none;
  position: absolute;
  top: 8px;
  right: 32px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 5px;
  font-size: 12px;
  line-height: 1;
  border-radius: 4px;
}
.task-card:hover .open-detail-btn { display: block; }
.open-detail-btn:hover { background: var(--bg-secondary); color: var(--accent); }
/* Cal task item clickable */
.cal-task-item { cursor: pointer; }
.cal-task-item:hover { background: rgba(99,102,241,0.07); border-radius: 6px; }

/* ======================================================================= */
/* ===== RESPONSIVE / MOBILE STYLES ===================================== */
/* ======================================================================= */

/* ── Touch devices: always show hover-only elements ─────────────────── */
@media (hover: none) {
  .task-card .add-on-hover,
  .task-card .delete-btn,
  .task-card .open-detail-btn,
  .list-item .list-item-note.add-note,
  .list-item .list-item-add-subtask,
  .list-item .list-item-actions {
    display: block !important;
  }
  .list-item .list-item-actions {
    display: flex !important;
  }
}

/* ── Tablet breakpoint (≤ 900px) ────────────────────────────────────── */
@media (max-width: 900px) {

  /* Collapse nav sidebar to icons only */
  .nav-sidebar {
    width: 48px;
    min-width: 48px;
    padding: 10px 4px;
  }
  .ns-logo-text, .ns-section-label, .ns-item span, .ns-user-info { display: none; }
  .ns-logo { padding: 4px 8px 8px 8px; justify-content: center; }
  .ns-item { justify-content: center; padding: 8px; }
  .ns-user { justify-content: center; padding: 8px; }
  .ns-user-avatar { width: 24px; height: 24px; font-size: 10px; }

  .app-content {
    padding: 8px 14px 12px 12px;
  }

  /* Header: wrap into two rows */
  header {
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 8px;
    margin-bottom: 8px;
  }

  .header-left {
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100%;
  }

  h1 { font-size: 1.25rem; }

  .buttons {
    gap: 8px;
  }

  button {
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Board: slimmer columns */
  .board { gap: 14px; }

  .column {
    min-width: 280px;
    max-width: 280px;
  }

  /* Calendar: sidebar stacks below on tablets */
  .cal-panel {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    gap: 0;
  }

  .cal-main {
    flex: none;
    min-height: auto;
    width: 100%;
  }

  .cal-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    margin-left: 0;
    padding-top: 14px;
    margin-top: 14px;
    flex-shrink: 0;
    overflow-y: visible;
  }

  .cal-header {
    justify-content: flex-start;
  }

  .cal-header > div:last-child:not(.cal-nav):not(.cal-month-label) {
    display: none;
  }

  /* Memory grid: smaller cards */
  .memory-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
  }

  /* Task detail modal: full width on tablet */
  .task-detail-panel { width: 520px; }
}

/* ── Mobile breakpoint (≤ 640px) ────────────────────────────────────── */
@media (max-width: 640px) {

  body {
    padding: 0;
    height: 100dvh; /* dynamic viewport height for mobile browsers */
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Hide nav sidebar on mobile (bottom nav is used) */
  .nav-sidebar { display: none !important; }

  .app-content {
    padding: 0;
  }

  /* ── HEADER: linha única compacta ───────────────────────────────── */
  header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    padding: 10px 14px 8px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--accent);
    flex-shrink: 0;
  }

  .header-left {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  .header-board-active {
    font-size: 12px;
    padding: 4px 16px;
  }

  h1 {
    font-size: 1rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Pill flutuante: oculto no mobile (usa pill próprio) */
  .floating-pill { display: none !important; }

  /* Buttons (notificações + perfil): compacto à direita */
  .buttons {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
  }

  .buttons #connectBtn,
  .buttons #importBtn {
    display: none !important;
  }

  .buttons button {
    padding: 6px 8px;
    font-size: 12px;
  }
  #memoryTabBtn,
  #splitViewBtn { display: none !important; }

  /* ── BARRA INFERIOR FLUTUANTE MOBILE ─────────────────────────────── */
  #mobileBottomArea {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 300;
  }

  #mobileBottomNav {
    display: flex;
    gap: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 32px;
    padding: 5px 6px;
    box-shadow: 0 4px 24px rgba(20,20,19,0.18), 0 1px 4px rgba(20,20,19,0.08);
    white-space: nowrap;
  }

  .mbn-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 26px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, color 0.15s;
  }

  .mbn-btn.active {
    background: var(--accent);
    color: #fff;
  }

  .mbn-btn svg { flex-shrink: 0; }

  /* Ícones mobile: mesmo visual dos ícones da nav sidebar desktop */
  .mbn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.15s, filter 0.15s;
  }
  .mbn-btn.active .mbn-icon {
    opacity: 1;
    filter: brightness(0) invert(1);
  }

  /* Slot da galeria: inline no pill. Colapsado = 1 botão; aberto = Fotos + Vídeos lado a lado */
  .mbn-gallery-slot {
    display: flex;
    align-items: center;
    gap: 2px;
  }
  .mbn-gallery-sub {
    display: none;
  }
  .mbn-gallery-slot.open .mbn-gallery-main {
    display: none;
  }
  .mbn-gallery-slot.open .mbn-gallery-sub {
    display: flex;
    animation: mbnGallerySubIn 0.18s ease-out;
  }
  @keyframes mbnGallerySubIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
  }

  /* Botão compacto — pill separado */
  .mbn-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 32px;
    box-shadow: 0 4px 24px rgba(20,20,19,0.18), 0 1px 4px rgba(20,20,19,0.08);
    color: var(--text-muted);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    opacity: 0.7;
    transition: opacity 0.15s, color 0.15s;
  }
  .mbn-compact .ico-expand   { display: none; }
  .mbn-compact.compact-active { opacity: 1; color: var(--accent); }
  .mbn-compact.compact-active .ico-compress { display: none; }
  .mbn-compact.compact-active .ico-expand   { display: inline-flex; }

  /* ── APP BODY: empilha sidebar horizontal + main vertical ─────── */
  .app-body {
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* ── PADDING PARA A BARRA FLUTUANTE ─────────────────────────────── */
  .app-body {
    padding-bottom: 80px;
  }

  /* ── QUADROS SIDEBAR HORIZONTAL ─────────────────────────────────── */
  .quadros-sidebar {
    width: 100%;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    margin-right: 0;
    margin-bottom: 0;
    padding: 6px 8px;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    flex-shrink: 0;
    gap: 6px;
  }

  .quadros-sidebar::-webkit-scrollbar { display: none; }

  /* Esconde cabeçalho "Quadros" e footer no mobile horizontal */
  .quadros-sidebar .qs-header,
  .quadros-sidebar .qs-footer {
    display: none !important;
  }

  /* Lista de quadros em linha — scrollável internamente */
  .quadros-sidebar .qs-list {
    display: flex;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
  }

  .quadros-sidebar .qs-list::-webkit-scrollbar { display: none; }

  .quadros-sidebar .qs-item {
    flex-direction: row;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: unset;
    background: var(--bg-primary);
    border: 1px solid var(--border);
  }

  .quadros-sidebar .qs-item.active,
  .quadros-sidebar .qs-item.qs-active {
    background: var(--accent);
    border-color: var(--accent);
  }

  .quadros-sidebar .qs-item.active .qs-name,
  .quadros-sidebar .qs-item.qs-active .qs-name {
    color: #fff;
  }

  .quadros-sidebar .qs-item-actions { display: none !important; }

  .quadros-sidebar .qs-dot {
    width: 7px;
    height: 7px;
    margin-right: 5px;
    flex-shrink: 0;
  }

  .quadros-sidebar .qs-name {
    font-size: 12px;
    max-width: none;
    overflow: visible;
  }

  /* Botão "+ novo quadro" mobile */
  .qs-mobile-create {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px dashed var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    flex-shrink: 0;
    padding: 0;
  }

  .qs-mobile-create:hover { border-color: var(--accent); color: var(--accent); }

  /* Botão compacto mobile (sidebar) — substituído pelo pill; oculto no mobile */
  .qs-mobile-compact {
    display: none !important;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: pointer;
    touch-action: manipulation;
    flex-shrink: 0;
    padding: 0;
  }

  .qs-mobile-compact.active { background: var(--accent); border-color: var(--accent); color: #fff; }

  /* Estado colapsado não se aplica no mobile */
  .qs-collapsed .qs-mobile-create,
  .qs-collapsed .qs-mobile-compact { display: flex !important; }

  .quadros-sidebar.qs-collapsed {
    width: 100%;
  }
  .quadros-sidebar.qs-collapsed .qs-name-wrap { display: flex !important; }

  /* ── APP MAIN: ocupa o restante ──────────────────────────────────── */
  .app-main {
    flex: 1;
    min-height: 0;
    padding: 0;
  }

  /* ── BOARD VIEW ──────────────────────────────────────────────────── */
  .board {
    gap: 12px;
    padding: 12px 14px 16px;
    /* enable smooth horizontal scroll */
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .column {
    min-width: 85vw;
    max-width: 85vw;
    scroll-snap-align: start;
  }

  .column-header {
    padding: 12px 14px;
    font-size: 12px;
  }

  .cards { padding: 0 8px 8px; }

  .task-card {
    padding: 12px 14px;
    margin-bottom: 8px;
  }

  .card-title { font-size: 13px; }

  /* Compact mode on mobile */
  .board.compact-mode .column { min-width: 72vw; max-width: 72vw; }

  /* ── Board carousel dots ── */
  .board-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 6px 0 10px;
    flex-shrink: 0;
  }
  .board-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    transition: width 0.2s ease, border-radius 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
  }
  .board-dot.active {
    width: 18px;
    border-radius: 3px;
    background: var(--accent);
  }

  .add-card { padding: 4px 8px 8px; }
  .add-card button { padding: 6px 8px; font-size: 12px; }

  /* Always show action buttons on mobile (no hover) */
  .task-card .delete-btn,
  .task-card .open-detail-btn {
    display: block;
  }

  .task-card .add-on-hover {
    display: block;
  }

  /* ── LIST VIEW ──────────────────────────────────────────────────── */
  .list-view {
    max-width: 100%;
    padding: 0;
  }

  .list-item {
    padding: 10px 12px;
    gap: 10px;
  }

  .list-item-title { font-size: 14px; }

  .list-item .list-item-actions {
    display: flex;
  }

  .list-item .list-item-note.add-note,
  .list-item .list-item-add-subtask {
    display: block;
  }

  .quick-add {
    padding: 10px 0;
    gap: 8px;
  }

  .quick-add-input { font-size: 14px; }

  /* ── EMPTY STATE ─────────────────────────────────────────────────── */
  .empty-state {
    padding: 40px 20px;
  }

  .empty-state p:first-child { font-size: 16px !important; }
  .empty-state p:nth-child(2) { font-size: 13px !important; }
  .empty-state button { font-size: 14px; padding: 12px 20px; }

  /* ── CALENDAR ────────────────────────────────────────────────────── */
  .cal-panel {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 0;
  }

  .cal-main {
    flex: none;
    min-height: auto;
    width: 100%;
  }

  .cal-header {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    justify-content: flex-start;
  }

  .cal-month-label {
    font-size: 1rem;
    min-width: unset;
    width: 100%;
    text-align: left;
    margin-bottom: 2px;
  }

  /* hide the spacer div */
  .cal-header > div:last-child:not(.cal-nav):not(.cal-month-label) {
    display: none;
  }

  .cal-nav button {
    padding: 6px 10px;
    font-size: 12px;
  }

  .cal-grid { gap: 2px; }

  .cal-dow {
    font-size: 10px;
    padding: 2px 0 4px;
  }

  .cal-day {
    min-height: 48px;
    padding: 3px 4px;
    border-radius: 6px;
  }

  .cal-day-num { font-size: 11px; }

  .cal-day.today .cal-day-num {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  .cal-event-dot {
    font-size: 9px;
    padding: 0 3px;
    border-radius: 3px;
  }

  .cal-more { font-size: 9px; }

  /* Sidebar stacks below the calendar */
  .cal-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    margin-left: 0;
    padding-top: 14px;
    margin-top: 14px;
    flex-shrink: 0;
    overflow-y: visible;
  }

  .cal-sidebar-title { font-size: 12px; }

  .cal-add-form input,
  .cal-add-form select {
    padding: 10px 12px;
    font-size: 14px;
  }

  /* ── MEMORY ──────────────────────────────────────────────────────── */
  .memory-tabs {
    margin-bottom: 8px;
    gap: 2px;
  }

  .memory-tab {
    padding: 6px 10px;
    font-size: 12px;
  }

  .memory-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .memory-card { padding: 14px; }

  .stats { gap: 10px; }
  .stat { padding: 12px 16px; min-width: 80px; }
  .stat-value { font-size: 22px; }

  .file-card-header { padding: 12px; }
  .file-card-content { padding: 12px; font-size: 12px; }

  .search-box { padding: 8px 12px; }

  .add-btn { padding: 24px; font-size: 13px; }

  .memory-flat-table th,
  .memory-flat-table td {
    padding: 8px 10px;
    font-size: 12px;
  }

  .memory-flat-table td:first-child {
    width: auto;
    white-space: normal;
    min-width: 80px;
  }

  /* ── MODAL ───────────────────────────────────────────────────────── */
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }

  .modal-header { padding: 14px 16px; }
  .modal-header h3 { font-size: 16px; }
  .modal-body { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }

  .form-group textarea {
    min-height: 200px;
    font-size: 12px;
  }

  /* ── TASK DETAIL PANEL ───────────────────────────────────────────── */
  .task-detail-overlay { padding: 12px; }
  .task-detail-panel {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 12px;
    flex-direction: column;
  }
  .task-detail-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-left: none;
    border-top: 1px solid var(--border-light);
    padding: 12px 16px;
  }
  .task-detail-sidebar .td-sidebar-title { display: none; }

  .task-detail-header { padding: 12px 16px; }
  .task-detail-body { padding: 16px 16px 24px; }
  .task-detail-title-el { font-size: 18px; }

  /* ── STATUS BAR ──────────────────────────────────────────────────── */
  .status-bar {
    bottom: 16px;
    padding: 10px 20px;
    font-size: 12px;
    border-radius: 8px;
  }

  /* ── PICKERS (labels, people) ────────────────────────────────────── */
  .label-picker {
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: calc(100vw - 20px);
  }

  .people-picker {
    left: 10px !important;
    right: 10px !important;
    max-width: calc(100vw - 20px);
  }

  /* Card metadata: reduce left margin */
  .card-date,
  .card-label,
  .card-people {
    margin-left: 30px;
  }

  .card-date input[type="date"] {
    width: 90px;
    font-size: 12px;
  }

  /* Section picker */
  .section-picker {
    left: 10px !important;
    right: 10px !important;
  }
}

/* ── Very small screens (≤ 380px) ─────────────────────────────────── */
@media (max-width: 380px) {

  body { padding: 8px 8px; }

  h1 { font-size: 1rem; }

  .column {
    min-width: 90vw;
    max-width: 90vw;
  }

  .cal-day { min-height: 40px; }
  .cal-day-num { font-size: 10px; }
  .cal-event-dot { display: none; }
  .cal-more { display: none; }

  .task-detail-title-el { font-size: 16px; }
  .task-detail-note-el { font-size: 13px; }

  .memory-tab { padding: 5px 8px; font-size: 11px; }
}

/* ── Safe area insets (notch/home indicator) ──────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .status-bar {
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px));
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Modal de login Supabase
───────────────────────────────────────────────────────────────────────────── */
/* ──────────────────────────────────────────────────────────────────────────
   Botão de perfil (header)
─────────────────────────────────────────────────────────────────────────── */
.profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.profile-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217,119,87,0.12);
}
.profile-btn-avatar {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1;
  text-transform: uppercase;
}
.profile-btn-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ──────────────────────────────────────────────────────────────────────────
   Popup de perfil
─────────────────────────────────────────────────────────────────────────── */
.profile-popup {
  position: fixed;
  z-index: 1200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(20,20,19,0.12);
  width: 260px;
  padding: 16px;
  animation: ppFadeIn 0.12s ease;
}
@keyframes ppFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.pp-avatar-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  transition: border-color 0.15s;
}
.pp-avatar-wrap:hover { border-color: var(--accent); }
.pp-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}
.pp-avatar-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.pp-avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.15s;
  border-radius: 50%;
}
.pp-avatar-wrap:hover .pp-avatar-overlay { opacity: 1; }
.pp-info { flex: 1; min-width: 0; }
.pp-name-wrap { margin-bottom: 3px; }
.pp-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: -4px;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.1s;
}
.pp-name:hover { background: var(--bg-secondary); }
.pp-name-input {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 2px solid var(--accent);
  border-radius: 4px;
  padding: 1px 6px;
  outline: none;
  width: 100%;
  font-family: inherit;
  box-sizing: border-box;
}
.pp-email {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pp-divider {
  height: 1px;
  background: var(--border-light);
  margin: 12px 0;
}
.pp-signout-btn {
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.pp-signout-btn:hover {
  background: #FEF2F2;
  color: #DC2626;
  border-color: #FECACA;
}
.pp-gcal-btn {
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
  margin-bottom: 6px;
}
.pp-gcal-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ── Profile Area Picker ── */
.pp-area-row {
  padding: 6px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pp-area-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.pp-area-btn {
  background: var(--bg-secondary);
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.pp-area-btn:hover { background: var(--border); }

.pp-area-picker {
  position: fixed;
  z-index: 10002;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  min-width: 180px;
  padding: 6px 0;
  animation: fade-in 0.12s ease;
}
.pp-area-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s;
}
.pp-area-picker-item:hover { background: var(--bg-secondary); }
.pp-area-picker-item.active { font-weight: 600; background: var(--bg-secondary); }
.pp-area-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Area Filter Bar (above board) ── */
.area-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px 4px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.area-filter-bar::-webkit-scrollbar { display: none; }
.area-filter-bar:empty { display: none; }

.area-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
}
.area-filter-chip:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.area-filter-chip.active {
  background: var(--text-primary);
  color: var(--bg-card);
  border-color: var(--text-primary);
  font-weight: 600;
}
.area-filter-chip.area-filter-mine {
  border-style: dashed;
}
.area-filter-chip.area-filter-mine.active {
  border-style: solid;
}
.area-filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}


.supa-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: supa-fade-in 0.18s ease;
}

@keyframes supa-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.supa-box {
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border, #e5e5e3);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  animation: supa-slide-up 0.22s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes supa-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.supa-logo {
  margin-bottom: 16px;
}

.supa-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #1a1a1a);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.supa-mode-toggle {
  display: flex;
  background: var(--bg-secondary, #f0f0eb);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  margin-bottom: 16px;
  width: 100%;
}

.supa-mode-btn {
  flex: 1;
  padding: 7px 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted, #999);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.supa-mode-btn.active {
  background: var(--bg-card, #fff);
  color: var(--text-primary, #141413);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.supa-mode-btn:not(.active):hover {
  color: var(--text-secondary, #555);
}

.supa-subtitle {
  font-size: 13px;
  color: var(--text-muted, #999);
  margin-bottom: 24px;
}

.supa-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 13px;
  border-radius: 8px;
  border: 1px solid var(--border, #e5e5e3);
  background: var(--bg-secondary, #f5f5f3);
  font-size: 14px;
  color: var(--text-primary, #1a1a1a);
  outline: none;
  margin-bottom: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.supa-input:focus {
  border-color: var(--accent, #D97757);
  box-shadow: 0 0 0 3px rgba(217,119,87,0.12);
  background: var(--bg-primary, #fff);
}

.supa-error {
  width: 100%;
  font-size: 12px;
  color: #ef4444;
  min-height: 18px;
  margin-bottom: 6px;
  text-align: center;
}

.supa-btn-primary {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: var(--accent, #D97757);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.15s, transform 0.1s;
}

.supa-btn-primary:hover:not(:disabled) { opacity: 0.88; }
.supa-btn-primary:active:not(:disabled) { transform: scale(0.98); }
.supa-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.supa-btn-ghost {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted, #999);
  font-size: 13px;
  cursor: pointer;
  margin-top: 6px;
  transition: color 0.15s;
}

.supa-btn-ghost:hover { color: var(--text-secondary, #666); }

.supa-btn-google {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border, #e5e5e3);
  background: #fff;
  color: #3c4043;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.supa-btn-google:hover:not(:disabled) {
  background: #f8f9fa;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.supa-btn-google:active:not(:disabled) { transform: scale(0.98); }
.supa-btn-google:disabled { opacity: 0.55; cursor: not-allowed; }


/* ===== WHITEBOARD ===== */

#wbContainer {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;
}

/* ── Toolbar (left side) ─────────────────────────────────────────────────── */
#wbToolbar {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 4px 16px rgba(20,20,19,0.10);
}

.wb-tool {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-muted);
  padding: 0;
  transition: background 0.12s, color 0.12s;
}
.wb-tool:hover { background: var(--bg-secondary); color: var(--text-primary); border-color: transparent; }
.wb-tool.wb-active { background: var(--accent); color: #fff; border-color: transparent; }
.wb-tool.wb-active:hover { background: var(--accent-hover); }
.wb-tool-sep { height: 1px; background: var(--border); margin: 3px 2px; }

/* ── Format bar (top center, shown when text node selected) ──────────────── */
#wbFormatBar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: none;
  align-items: center;
  gap: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px;
  box-shadow: 0 4px 16px rgba(20,20,19,0.10);
  white-space: nowrap;
}

#wbPreset {
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  border-radius: 7px;
  padding: 5px 8px;
  outline: none;
  cursor: pointer;
}

.wb-fmt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0;
  transition: background 0.12s, color 0.12s;
  font-family: inherit;
}
.wb-fmt-btn:hover { background: var(--bg-secondary); color: var(--text-primary); border-color: transparent; }
.wb-fmt-btn.wb-active { background: var(--bg-secondary); color: var(--accent); border-color: transparent; }
.wb-fmt-sep { width: 1px; height: 22px; background: var(--border); margin: 0 3px; flex-shrink: 0; }

/* ── Zoom controls (bottom right) ────────────────────────────────────────── */
#wbZoomControls {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  gap: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(20,20,19,0.08);
}
.wb-zoom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  padding: 0;
  transition: background 0.12s, color 0.12s;
  font-family: inherit;
}
.wb-zoom-btn:hover { background: var(--bg-secondary); color: var(--text-primary); border-color: transparent; }

/* ── Viewport (the clipping container) ──────────────────────────────────── */
#wbViewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle, #c8c7c2 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  cursor: default;
}

/* ── World (the infinite canvas) ─────────────────────────────────────────── */
#wbWorld {
  position: absolute;
  transform-origin: 0 0;
  width: 1px;
  height: 1px;
  overflow: visible;
}

/* ── Nodes ──────────────────────────────────────────────────────────────── */
.wb-node {
  position: absolute;
  cursor: default;
  user-select: none;
}

/* Text node */
.wb-node--text {
  min-height: 1em;
  padding: 4px 6px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
  cursor: text;
  outline: none;
  /* Allow text selection — overrides .wb-node's user-select: none */
  user-select: text;
  -webkit-user-select: text;
  /* invisible border so it doesn't jump when selected */
  box-shadow: 0 0 0 1px transparent;
  transition: box-shadow 0.1s;
}
.wb-node--text:hover {
  box-shadow: 0 0 0 1px var(--border);
}
.wb-node--text[contenteditable="true"],
.wb-node--text:focus {
  outline: none;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

/* Shape nodes */
.wb-node--rect {
  background: rgba(255,255,255,0.9);
  border: 2px solid #8c8c8a;
  border-radius: 6px;
  cursor: move;
}
.wb-node--ellipse {
  background: rgba(255,255,255,0.9);
  border: 2px solid #8c8c8a;
  border-radius: 50%;
  cursor: move;
}

/* Group nodes */
.wb-node--group {
  background: rgba(217, 119, 87, 0.04);
  border: 2px dashed rgba(217, 119, 87, 0.45);
  border-radius: 10px;
  cursor: move;
  overflow: visible;
}
.wb-node--group.wb-selected {
  border-color: var(--accent);
  background: rgba(217, 119, 87, 0.08);
}
.wb-group-label {
  position: absolute;
  top: -10px;
  left: 12px;
  background: var(--bg-primary);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.03em;
  line-height: 20px;
  border-radius: 4px;
  cursor: text;
  outline: none;
  white-space: nowrap;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.wb-group-label[contenteditable="true"] {
  box-shadow: 0 0 0 2px var(--accent);
  background: var(--bg-secondary);
}
[data-theme="dark"] .wb-node--group {
  background: rgba(217, 119, 87, 0.06);
  border-color: rgba(217, 119, 87, 0.35);
}
[data-theme="dark"] .wb-node--group.wb-selected {
  background: rgba(217, 119, 87, 0.1);
}

/* Preview while drawing */
.wb-node--preview {
  opacity: 0.45;
  pointer-events: none;
}

/* Selected state */
.wb-selected {
  box-shadow: 0 0 0 2px var(--accent) !important;
}
.wb-node--text.wb-selected {
  box-shadow: 0 0 0 2px var(--accent);
}

/* ── Attachment full content ──────────────────────────────────────────────── */
.wb-attach-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0 2px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

/* For shape nodes: strip sits below the shape border */
.wb-node--rect .wb-attach-strip,
.wb-node--ellipse .wb-attach-strip {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  margin-top: 0;
}

/* ── Doc attachment (full content) ────────────────────────────── */
.wb-attach-doc {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary, #fff);
  overflow: hidden;
}
.wb-attach-doc-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}
.wb-attach-doc-title {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wb-attach-doc-open {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.wb-attach-doc-open:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.wb-attach-doc-body {
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  min-height: 40px;
  max-height: 300px;
  overflow-y: auto;
  outline: none;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}
.wb-attach-doc-body:focus {
  box-shadow: inset 0 0 0 1px var(--accent);
}
.wb-attach-doc-body p { margin: 0 0 0.5em; }
.wb-attach-doc-body h1, .wb-attach-doc-body h2, .wb-attach-doc-body h3 {
  margin: 0.6em 0 0.3em;
}
.wb-attach-doc-body ul, .wb-attach-doc-body ol {
  margin: 0.3em 0;
  padding-left: 1.5em;
}

/* ── Image attachment (full) ──────────────────────────────────── */
.wb-attach-img {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
}
.wb-attach-img img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 5px;
}
.wb-attach-img:hover { border-color: var(--accent); }

.wb-attach-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.wb-attach-doc-header .wb-attach-del {
  position: static;
  opacity: 1;
  width: 16px;
  height: 16px;
  line-height: 16px;
  font-size: 11px;
  flex-shrink: 0;
}
.wb-attach-img:hover .wb-attach-del { opacity: 1; }
.wb-attach-del:hover { background: var(--danger, #e53e3e); }

/* Disabled state for attach button */
#wbAttachBtn:disabled { opacity: 0.35; cursor: not-allowed; }
#wbAttachBtn:disabled:hover { background: transparent; color: inherit; }

/* Shape nodes need overflow visible so strip shows below */
.wb-node--rect,
.wb-node--ellipse {
  overflow: visible;
}

/* ── SVG arrow layer ──────────────────────────────────────────────────────── */
#wbSvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
#wbSvg line {
  pointer-events: stroke;
}

/* ══════════════════════════════════════════════════════════════
   DOCS TAB
══════════════════════════════════════════════════════════════ */
#docsPanel {
  display: none;
  flex-direction: column;
}
#docsPanel.active {
  display: flex;
}

.docs-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.docs-sidebar {
  width: 240px;
  min-width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-radius: 12px;
  margin-right: 16px;
  padding: 12px 0 8px;
  overflow: hidden;
}

.docs-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.docs-sidebar-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.docs-new-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 3px 5px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  transition: color 0.12s, background 0.12s;
}
.docs-new-btn:hover {
  color: var(--accent);
  background: rgba(217,119,87,0.1);
}

.docs-sidebar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.docs-new-btn.active {
  color: var(--accent);
  background: rgba(217,119,87,0.15);
}

.docs-list-restore {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.docs-list-item:hover .docs-list-restore { opacity: 1; }
.docs-list-restore:hover { color: #2f9e44; }

.docs-search-wrap {
  padding: 0 8px 8px;
}

.docs-search {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.docs-search:focus { border-color: var(--accent); }
.docs-search::placeholder { color: var(--text-muted); }

.docs-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 6px;
}

.docs-list-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 20px 12px;
}

.docs-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.docs-list-item:hover { background: rgba(255,255,255,0.55); }
.docs-list-item.active { background: rgba(217,119,87,0.13); }

.docs-list-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 1px;
}
.docs-list-item.active .docs-list-icon { color: var(--accent); }

.docs-list-info {
  flex: 1;
  min-width: 0;
}

.docs-list-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docs-list-item.active .docs-list-title { color: var(--text-primary); font-weight: 600; }

.docs-list-date {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

.docs-list-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s;
  flex-shrink: 0;
}
.docs-list-item:hover .docs-list-delete { opacity: 1; }
.docs-list-delete:hover { color: #e05252; }

/* ── Editor wrap ─────────────────────────────────────────────── */
.docs-editor-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

/* Empty state */
.docs-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.docs-empty-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.docs-empty-btn:hover { background: var(--accent-hover); }

/* Editor container */
.docs-editor-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ── Minimal top bar ─────────────────────────────────────────── */
.docs-top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  flex-shrink: 0;
}

.docs-save-status {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.docs-top-delete-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.docs-top-delete-btn:hover { background: rgba(224,82,82,0.1); color: #e05252; }

.docs-back-btn {
  display: none;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  margin-right: auto;
  transition: background 0.12s;
}
.docs-back-btn:hover { background: rgba(217,119,87,0.1); }

/* ── Format toolbar (always visible, static) ─────────────────── */
.docs-floating-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 10px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  overflow: visible;
  white-space: nowrap;
  position: relative;
  z-index: 20;
}

.docs-fb-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
  transition: border-color 0.12s;
  flex-shrink: 0;
}
.docs-fb-select:focus { border-color: var(--accent); }

.docs-fb-sep {
  width: 1px;
  height: 16px;
  background: var(--border-light);
  margin: 0 3px;
  flex-shrink: 0;
}

.docs-fb-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
}
.docs-fb-btn:hover { background: rgba(0,0,0,0.07); color: var(--text-primary); }
.docs-fb-btn.active { background: rgba(217,119,87,0.15); color: var(--accent); }

/* ── Title ───────────────────────────────────────────────────── */
.docs-title-wrap {
  padding: 28px 48px 10px;
}

.docs-title-input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-size: 30px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-primary);
  line-height: 1.25;
  caret-color: var(--accent);
}
.docs-title-input::placeholder { color: var(--border); }

/* ── Content editable ────────────────────────────────────────── */
.docs-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 48px 40px;
  outline: none;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
  caret-color: var(--accent);
}

.docs-content:empty::before {
  content: 'Comece a escrever…';
  color: var(--text-muted);
  pointer-events: none;
}

/* Heading styles inside editor */
.docs-content h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 20px 0 6px;
  line-height: 1.25;
  color: var(--text-primary);
}
.docs-content h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 18px 0 5px;
  line-height: 1.3;
  color: var(--text-primary);
}
.docs-content h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 14px 0 4px;
  line-height: 1.35;
  color: var(--text-primary);
}
.docs-content p {
  margin: 2px 0;
  min-height: 1em;
}
.docs-content ul, .docs-content ol {
  margin: 4px 0 4px 22px;
}
.docs-content li { margin: 2px 0; }

.docs-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 8px 0;
  padding: 6px 16px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 0 6px 6px 0;
  font-style: italic;
}

.docs-content pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 8px;
  padding: 14px 18px;
  margin: 10px 0;
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
}

.docs-content a {
  color: var(--accent);
  text-decoration: underline;
}

/* Selection highlight */
.docs-content ::selection {
  background: rgba(217,119,87,0.2);
}

/* ── Checklist ───────────────────────────────────────────────── */
.docs-content ul.docs-checklist {
  list-style: none;
  margin: 4px 0;
  padding: 0;
}

.docs-content ul.docs-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 3px 0;
  padding: 1px 0;
  min-height: 1.6em;
}

.docs-content ul.docs-checklist input[type=checkbox] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  min-width: 16px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  cursor: pointer;
  margin-top: 3px;
  transition: background 0.12s, border-color 0.12s;
  flex-shrink: 0;
  position: relative;
  outline: none;
}
.docs-content ul.docs-checklist input[type=checkbox]:hover {
  border-color: var(--accent);
}
.docs-content ul.docs-checklist input[type=checkbox]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.docs-content ul.docs-checklist input[type=checkbox]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.docs-content ul.docs-checklist label {
  flex: 1;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  cursor: text;
  outline: none;
  min-height: 1em;
  word-break: break-word;
}
/* Checked label gets strikethrough */
.docs-content ul.docs-checklist input[type=checkbox]:checked + label {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* ── Columns ─────────────────────────────────────────────────── */
.docs-content .docs-cols {
  display: grid;
  gap: 16px;
  margin: 8px 0;
  align-items: start;
}
.docs-content .docs-cols-2 { grid-template-columns: 1fr 1fr; }
.docs-content .docs-cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.docs-content .docs-col {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px 14px;
  min-height: 60px;
  outline: none;
  border: 1.5px solid transparent;
  transition: border-color 0.15s;
}
.docs-content .docs-col:focus-within {
  border-color: rgba(217,119,87,0.3);
}
.docs-content .docs-col p {
  margin: 2px 0;
  min-height: 1em;
}

/* ── Tables ─────────────────────────────────────────────────── */
.docs-content .docs-table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  table-layout: auto;
}
.docs-content .docs-table th,
.docs-content .docs-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  min-width: 60px;
  max-width: 320px;
  outline: none;
  line-height: 1.5;
  word-break: break-word;
}
.docs-content .docs-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
}
.docs-content .docs-table td:focus,
.docs-content .docs-table th:focus {
  box-shadow: inset 0 0 0 2px var(--accent);
  outline: none;
}
.docs-content .docs-table tr:hover td {
  background: rgba(217,119,87,0.03);
}

/* Table picker popover */
.docs-table-picker {
  z-index: 100;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.docs-table-picker-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 6px;
  font-weight: 500;
}
.docs-table-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 20px);
  gap: 3px;
}
.docs-table-picker-cell {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.docs-table-picker-cell:hover,
.docs-table-picker-cell.active {
  background: rgba(217,119,87,0.2);
  border-color: var(--accent);
}

/* Table context menu */
.docs-table-ctx {
  position: fixed;
  z-index: 10600;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  min-width: 180px;
}
.docs-table-ctx-item {
  display: block;
  width: 100%;
  padding: 7px 12px;
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  border: none;
  background: none;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 5px;
}
.docs-table-ctx-item:hover {
  background: var(--bg-secondary);
}
.docs-table-ctx-item.danger {
  color: var(--danger, #e53e3e);
}
.docs-table-ctx-item.danger:hover {
  background: rgba(229,62,62,0.08);
}
.docs-table-ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 3px 8px;
}

/* ── Presence bar ───────────────────────────────────────────── */
.docs-presence-bar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 4px 16px 2px;
  flex-shrink: 0;
}
.docs-presence-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 7px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--presence-color) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--presence-color) 25%, transparent);
  animation: docs-presence-in 0.3s ease;
}
.docs-presence-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--presence-color);
  animation: docs-presence-pulse 2s infinite;
}
.docs-presence-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--presence-color);
  white-space: nowrap;
}

@keyframes docs-presence-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes docs-presence-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ── Comments panel ──────────────────────────────────────────── */
.docs-editor-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}
.docs-editor-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.docs-comments-panel {
  width: 320px;
  flex-shrink: 0;
  border-left: 1px solid var(--border-light);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: width 0.2s ease, opacity 0.2s ease;
}
.docs-comments-panel.collapsed {
  width: 0;
  border-left: none;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
.docs-comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.docs-comments-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.docs-comments-filter {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.docs-comments-filter input {
  margin: 0;
  cursor: pointer;
}
.docs-comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.docs-comments-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 20px 12px;
  line-height: 1.5;
}

.docs-comment-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.docs-comment-item:hover {
  border-color: var(--border);
}
.docs-comment-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.docs-comment-item.resolved {
  opacity: 0.55;
}
.docs-comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.docs-comment-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.docs-comment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.docs-comment-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.docs-comment-date {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.docs-comment-body {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.docs-comment-body .docs-mention {
  color: var(--accent);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 0 3px;
  border-radius: 3px;
}
.docs-comment-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.docs-comment-action {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 11px;
  font-family: inherit;
  padding: 3px 8px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.docs-comment-action:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}
.docs-comment-action.danger:hover {
  background: rgba(224,82,82,0.1);
  color: #e05252;
  border-color: rgba(224,82,82,0.3);
}

/* Composer */
.docs-comment-composer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  position: relative;
}
.docs-comment-textarea {
  width: 100%;
  min-height: 60px;
  max-height: 160px;
  resize: vertical;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
  outline: none;
  transition: border-color 0.12s;
}
.docs-comment-textarea:focus {
  border-color: var(--accent);
}
.docs-comment-composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.docs-comment-send {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 5px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.docs-comment-send:hover { background: var(--accent-hover); }
.docs-comment-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.docs-comment-cancel {
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}
.docs-comment-cancel:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Mention popover */
.docs-mention-popover {
  position: absolute;
  background: #2a2927;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 4px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  z-index: 10000;
  min-width: 180px;
}
.docs-mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: #e8e6e3;
}
.docs-mention-item.active,
.docs-mention-item:hover {
  background: rgba(255,255,255,0.08);
}
.docs-mention-item img,
.docs-mention-item .docs-mention-avatar-fallback {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Comment mark (selected text in the editor) */
.docs-content .docs-comment-mark {
  background: #fff3bf;
  color: inherit;
  border-bottom: 2px solid #f5b700;
  cursor: pointer;
  padding: 1px 0;
  border-radius: 2px;
  transition: background 0.15s;
}
.docs-content .docs-comment-mark:hover,
.docs-content .docs-comment-mark.active {
  background: #ffe066;
}
.docs-content .docs-comment-mark.resolved {
  background: transparent;
  border-bottom: 1px dashed var(--border);
}

/* Badge on the toggle button */
.docs-comments-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  margin-left: 4px;
  background: var(--accent);
  color: white;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 860px) {
  .docs-comments-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 85%;
    max-width: 340px;
    z-index: 50;
    box-shadow: -8px 0 24px rgba(0,0,0,0.25);
  }
  .docs-editor-body { position: relative; }
}

/* ── Color pickers ───────────────────────────────────────────── */
.docs-fb-colorpick {
  position: relative;
  display: flex;
  align-items: center;
}

.docs-fb-clr-btn {
  flex-direction: column;
  gap: 2px;
  padding: 4px 7px;
  height: auto;
}

.docs-fb-clr-a {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: currentColor;
}

.docs-fb-clr-bar {
  display: block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  transition: background 0.15s;
}

/* Popover bubble */
.docs-fb-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #2a2927;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 7px 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
  z-index: 10000;
  white-space: nowrap;
}

/* Arrow (points up toward the toolbar) */
.docs-fb-popover::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: #2a2927;
}

/* Color swatches */
.docs-fb-clr-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  outline: none;
}
.docs-fb-clr-swatch:hover {
  transform: scale(1.25);
  border-color: rgba(255,255,255,0.7);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* "Clear" button (X) */
.docs-fb-clr-clear {
  background: #3e3d3a;
  color: #a0a09b;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.docs-fb-clr-clear:hover {
  background: #525049;
  color: #fff;
}

/* ── Docs mobile layout ──────────────────────────────────────── */
@media (max-width: 640px) {
  .docs-layout {
    flex-direction: column;
    overflow: hidden;
  }

  /* Sidebar: full width, shown by default */
  .docs-sidebar {
    width: 100%;
    min-width: 0;
    border-radius: 12px;
    flex-shrink: 0;
    min-height: 0;
    margin-right: 0;
  }

  /* Editor: hidden until a doc is opened */
  .docs-editor-wrap {
    display: none;
    border-radius: 12px;
  }

  /* When a doc is open: hide list, show editor */
  .docs-layout.show-editor .docs-sidebar {
    display: none;
  }
  .docs-layout.show-editor .docs-editor-wrap {
    display: flex;
    flex: 1;
    min-height: 0;
  }

  /* Show back button on mobile */
  .docs-back-btn {
    display: flex;
  }

  /* Reduce padding for mobile editor */
  .docs-title-wrap {
    padding: 16px 16px 8px;
  }
  .docs-content {
    padding: 8px 16px 32px;
  }
  .docs-title-input {
    font-size: 22px;
  }

  /* Toolbar: quebra em múltiplas linhas no mobile */
  .docs-floating-bar {
    flex-wrap: wrap;
    row-gap: 4px;
    padding: 6px 8px;
    white-space: normal;
  }
  /* Botão de toggle dos comentários volta ao fluxo normal
     (sem empurrar sozinho pro fim da linha) */
  #docsToggleCommentsBtn {
    margin-left: auto !important;
  }
}

/* ═══════════════════════════════════════════════════════
   LINKS PANEL
   ═══════════════════════════════════════════════════════ */

.links-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px 32px;
  overflow-y: auto;
}

.links-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.links-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.links-add-btn,
.links-empty-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.links-add-btn:hover,
.links-empty-btn:hover { opacity: 0.85; }

.links-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Grid ── */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  flex: 1;
}

.links-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  position: relative;
}
.links-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.links-card-cover {
  width: 100%;
  height: 140px;
  overflow: hidden;
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.links-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.links-card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.links-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.links-card-favicon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

.links-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.links-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.links-card-domain {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: auto;
}

/* ── Card actions ── */
.links-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.links-card:hover .links-card-actions { opacity: 1; }

.links-card-action {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  transition: background 0.12s, color 0.12s;
}
.links-card-action:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.links-card-action-danger:hover {
  background: #fee;
  color: #d33;
}

/* ── Modal ── */
.links-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}

.links-modal {
  background: var(--bg-primary);
  border-radius: 14px;
  width: 460px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.links-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
}
.links-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.links-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.links-modal-close:hover { color: var(--text-primary); }

.links-modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.links-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 8px;
}
.links-field-label:first-child { margin-top: 0; }

.links-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}
.links-input:focus {
  border-color: var(--accent);
}

/* Cover picker area */
.links-cover-area {
  margin-top: 4px;
}
.links-cover-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.links-cover-placeholder:hover {
  border-color: var(--accent);
  background: var(--bg-secondary);
}
.links-cover-preview {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--border);
}

.links-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 18px;
}

.links-btn-primary {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.links-btn-primary:hover { opacity: 0.85; }

.links-btn-secondary {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
}
.links-btn-secondary:hover { background: var(--border); }

/* ── Links mobile ── */
@media (max-width: 640px) {
  .links-layout {
    padding: 16px;
  }
  .links-grid {
    grid-template-columns: 1fr;
  }
  .links-card-actions {
    opacity: 1;
  }
}

/* ══════════════════════════════════════════════════════════════════
   BOAS PRATICAS — extras (reutiliza estilos do docs-*)
   ══════════════════════════════════════════════════════════════════ */

.bp-area-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
}

.bp-area-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.bp-area-select {
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
}

.bp-area-select:focus {
  border-color: var(--accent);
}

.bp-area-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ══════════════════════════════════════════════════════════════════
   GALLERY
   ══════════════════════════════════════════════════════════════════ */

/* ── No-API-Key / Onboarding states ── */
.gallery-no-google,
.gallery-onboarding {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  padding: 40px 20px;
}

.gallery-onboarding-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.gallery-folder-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.gallery-folder-input:focus {
  border-color: var(--accent);
}

.gallery-btn-primary {
  padding: 9px 22px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.gallery-btn-primary:hover { opacity: 0.85; }

.gallery-btn-secondary {
  padding: 9px 22px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.gallery-btn-secondary:hover {
  background: var(--bg-tertiary, var(--bg-secondary));
  border-color: var(--accent);
}

/* ── Source tabs (Fotos / Vídeos) ── */
.gallery-source-tabs {
  display: flex;
  gap: 0;
  padding: 8px 16px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.gallery-source-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.gallery-source-tab:hover {
  color: var(--text-primary);
}
.gallery-source-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.gallery-source-tab svg {
  flex-shrink: 0;
}

/* ── Video play overlay on cards ── */
.gallery-card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}
.gallery-card-play svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.5));
  opacity: 0.85;
  transition: opacity 0.15s, transform 0.15s;
}
.gallery-card:hover .gallery-card-play svg {
  opacity: 1;
  transform: scale(1.1);
}

/* ── Video in lightbox ── */
.gallery-lightbox.is-video .gallery-lightbox-img-wrap {
  aspect-ratio: 16 / 9;
  max-height: 65vh;
}
.gallery-lightbox-video {
  width: 100%;
  height: 100%;
  border-radius: 6px;
}

/* ── Main layout ── */
.gallery-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

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

.gallery-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.gallery-toolbar-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.gallery-toolbar-btn.syncing {
  opacity: .6;
  pointer-events: none;
}
.gallery-toolbar-btn.syncing svg {
  animation: gallery-spin 1s linear infinite;
}
@keyframes gallery-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.gallery-counter {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.gallery-search-input {
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  width: 200px;
  outline: none;
  transition: border-color 0.15s;
}
.gallery-search-input:focus {
  border-color: var(--accent);
}

/* ── Tag bar: horizontal acima do grid ── */
.gallery-tagbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.gallery-tagbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  text-transform: capitalize;
  transition: all 0.15s;
  flex-shrink: 0;
}
.gallery-tagbar-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.gallery-tagbar-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.gallery-tagbar-pill.active .gallery-tagbar-edit,
.gallery-tagbar-pill.active .gallery-tagbar-del {
  color: rgba(255,255,255,0.7);
}
.gallery-tagbar-pill.active .gallery-tagbar-edit:hover,
.gallery-tagbar-pill.active .gallery-tagbar-del:hover {
  color: #fff;
}

.gallery-tagbar-edit,
.gallery-tagbar-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  line-height: 1;
}
.gallery-tagbar-pill:hover .gallery-tagbar-edit,
.gallery-tagbar-pill:hover .gallery-tagbar-del {
  opacity: 1;
}
.gallery-tagbar-edit:hover { color: var(--accent); }
.gallery-tagbar-del:hover { color: #ef4444; }

/* ── Content: sidebar + grid ── */
.gallery-content {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Sidebar: folder tree ── */
.gallery-filter-sidebar {
  width: 220px;
  min-width: 220px;
  border-right: 1px solid var(--border);
  padding: 14px 0;
  overflow-y: auto;
  flex-shrink: 0;
}

.gallery-filter-group {
  margin-bottom: 18px;
  padding: 0 12px;
}

.gallery-filter-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Folder tree items */
.gallery-folder-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 0;
  transition: background 0.1s, color 0.1s;
  user-select: none;
}
.gallery-folder-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.gallery-folder-item.active {
  background: var(--accent);
  color: #fff;
}
.gallery-folder-item.active .gallery-folder-count {
  color: rgba(255,255,255,0.7);
}

.gallery-folder-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  font-size: 8px;
  flex-shrink: 0;
  transition: transform 0.15s;
  color: var(--text-muted);
}
.gallery-folder-arrow.expanded {
  transform: rotate(90deg);
}
.gallery-folder-arrow.leaf {
  visibility: hidden;
}
.gallery-folder-item.active .gallery-folder-arrow {
  color: rgba(255,255,255,0.7);
}

.gallery-folder-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-folder-count {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: auto;
}

/* Status-of-use radio filters */
.gallery-filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 3px 0;
  cursor: pointer;
}
.gallery-filter-item input[type="radio"] {
  accent-color: var(--accent);
  margin: 0;
}

/* ── Grid area ── */
.gallery-grid-area {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 14px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.gallery-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  aspect-ratio: 1;
}
.gallery-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--shadow-hover);
}

.gallery-card-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
}
.gallery-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.gallery-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  opacity: 0;
  transition: opacity 0.18s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gallery-card:hover .gallery-card-overlay {
  opacity: 1;
}

.gallery-card-name {
  font-size: 11px;
  color: #fff;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Card: checkbox "usada" ── */
.gallery-card-used-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 2;
}
.gallery-card-used-check input { display: none; }
.gallery-card-used-check svg {
  width: 14px;
  height: 14px;
  color: transparent;
  transition: color 0.15s;
}
.gallery-card-used-check.checked {
  background: #10b981;
  border-color: #10b981;
}
.gallery-card-used-check.checked svg { color: #fff; }
.gallery-card-used-check:hover {
  border-color: #10b981;
  background: rgba(16,185,129,0.3);
}
.gallery-card-used-check:hover svg { color: rgba(255,255,255,0.8); }

/* ── Loading / Empty / Error ── */
.gallery-loading,
.gallery-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  gap: 12px;
}

.gallery-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gallery-spin 0.7s linear infinite;
}
@keyframes gallery-spin {
  to { transform: rotate(360deg); }
}

.gallery-error {
  padding: 20px;
  color: #ef4444;
  font-size: 13px;
  text-align: center;
}

/* ── Lightbox (centralizado) ── */
.gallery-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.gallery-lightbox-overlay.open { opacity: 1; }

.gallery-lightbox {
  position: relative;
  background: var(--bg-card);
  border-radius: 16px;
  max-width: 800px;
  width: 92vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}
.gallery-lightbox-overlay.open .gallery-lightbox { transform: scale(1); }

.gallery-lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.gallery-lightbox-close:hover { background: rgba(0,0,0,0.7); }

.gallery-lightbox-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  min-height: 200px;
  max-height: 60vh;
  overflow: hidden;
}
.gallery-lightbox-img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
}

.gallery-lightbox-info {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.gallery-lightbox-meta { min-width: 0; flex: 1; }
.gallery-lightbox-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-lightbox-path {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.gallery-lightbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.gallery-lightbox-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.gallery-lightbox-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.gallery-lightbox-btn.is-used {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}
.gallery-lightbox-btn.is-used:hover {
  background: #059669;
  border-color: #059669;
  color: #fff;
}
.gallery-lightbox-btn:disabled { opacity: 0.5; cursor: wait; }

/* ── Drawer input (reused in tag modal) ── */
.gallery-drawer-input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.gallery-drawer-input:focus { border-color: var(--accent); }

/* ── Gallery mobile ── */
@media (max-width: 768px) {
  .gallery-filter-sidebar {
    display: none;
  }
  .gallery-search-input {
    width: 140px;
  }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }
  .gallery-toolbar {
    flex-wrap: wrap;
    padding: 8px 12px;
  }
  .gallery-lightbox {
    width: 98vw;
    max-height: 94vh;
    border-radius: 10px;
  }
  .gallery-lightbox-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .gallery-lightbox-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  /* Galeria: garantir que o painel ocupe o espaço e permita scroll */
  #galleryPanel.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .gallery-main {
    /* Scroll container no mobile — overflow-x oculto para evitar barra horizontal */
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Toolbar: sticky no topo enquanto o grid rola */
  .gallery-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-primary);
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
  }

  .gallery-content {
    flex-direction: column;
    overflow: visible;
    /* Sobrescreve flex:1 e min-height:0 da regra base — sem esses, o conteúdo
       não pode ultrapassar o espaço alocado e o overflow-y no gallery-main
       nunca acumula overflow suficiente para rolar. */
    flex: none;
    min-height: auto;
  }

  .gallery-grid-area {
    overflow: visible;
    padding: 10px;
    flex: none;
    min-height: auto;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 6px;
  }

  .gallery-toolbar-left {
    gap: 6px;
  }

  .gallery-toolbar-btn span {
    display: none;
  }
  .gallery-toolbar-btn {
    padding: 6px 8px;
  }

  .gallery-search-input {
    width: 100%;
    flex: 1;
    min-width: 0;
  }

  .gallery-toolbar-right {
    flex: 1;
    min-width: 0;
  }

  /* Mostrar nome da foto sempre (sem hover em touch) */
  .gallery-card-overlay {
    opacity: 1;
    background: linear-gradient(transparent 40%, rgba(0,0,0,0.55));
  }

  /* Checkbox maior para touch */
  .gallery-card-used-check {
    width: 28px;
    height: 28px;
  }
  .gallery-card-used-check svg {
    width: 16px;
    height: 16px;
  }

  /* Onboarding: padding menor */
  .gallery-no-google,
  .gallery-onboarding {
    padding: 24px 14px;
  }
  .gallery-onboarding-card {
    padding: 20px 16px;
  }

  /* Lightbox mobile */
  .gallery-lightbox {
    width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }
  .gallery-lightbox-img-wrap {
    max-height: 50vh;
  }
  .gallery-lightbox-img {
    max-height: 50vh;
  }
  .gallery-lightbox-close {
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    font-size: 22px;
  }
  .gallery-lightbox-info {
    padding: 12px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .gallery-lightbox-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .gallery-lightbox-btn {
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  /* Tagbar mobile */
  .gallery-tagbar {
    padding: 6px 10px;
  }

  /* Counter */
  .gallery-counter {
    font-size: 11px;
  }
}

/* (drawer-actions/download removidos — substituídos pelo lightbox) */

/* ── Gallery: Tag items in sidebar ── */
.gallery-tag-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s, color 0.1s;
  text-transform: capitalize;
}
.gallery-tag-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.gallery-tag-item.active {
  background: var(--accent);
  color: #fff;
}

/* ── Gallery: Tag button on folder items ── */
.gallery-folder-tag-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.gallery-folder-item:hover .gallery-folder-tag-btn {
  opacity: 0.7;
}
.gallery-folder-tag-btn:hover {
  opacity: 1 !important;
}

/* ── Gallery: Tag pills ── */
.gallery-tag-pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  background: rgba(217,119,87,0.15);
  color: var(--accent);
  text-transform: capitalize;
  line-height: 1.6;
}

.gallery-folder-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 0 12px 4px;
}

/* ── Gallery: Tag modal ── */
.gallery-tag-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.gallery-tag-modal {
  background: var(--bg-primary);
  border-radius: 14px;
  width: 360px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}

.gallery-tag-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.gallery-tag-modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.gallery-tag-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
}
.gallery-tag-modal-close:hover { color: var(--text-primary); }

.gallery-tag-modal-body {
  padding: 14px 18px 18px;
}

.gallery-tag-modal-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

.gallery-tag-modal-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(217,119,87,0.15);
  padding: 3px 6px 3px 10px;
  border-radius: 14px;
}

.gallery-tag-pill-modal {
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  text-transform: capitalize;
}

.gallery-tag-available-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  text-transform: capitalize;
}
.gallery-tag-available-btn:hover {
  background: rgba(217,119,87,0.1);
  color: var(--accent);
  border-color: var(--accent);
}

.gallery-tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.05);
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  transition: all 0.12s;
}
.gallery-tag-remove:hover { 
  color: #fff;
  background: #ef4444; 
}

.gallery-tag-modal-add {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* ═══════════════════════════════════════════════════════
   LOADING SCREEN
   ═══════════════════════════════════════════════════════ */
#loadingScreen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.38s ease;
}

#loadingScreen.ls-fade-out {
  opacity: 0;
  pointer-events: none;
}

.ls-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  user-select: none;
}

.ls-logo {
  width: 64px;
  height: 64px;
  background: var(--bg-secondary);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(217, 119, 87, 0.18);
}

.ls-brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

@keyframes ls-spin {
  to { transform: rotate(360deg); }
}

.ls-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: ls-spin 0.75s linear infinite;
  margin-top: 4px;
}
