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

:root {
  color-scheme: light;
  --text: #1e1b2e;
  --muted: #6b7280;
  --border: rgba(30, 27, 46, 0.1);
  --primary: #6366f1;
  --primary-weak: #4f46e5;
  --primary-soft: rgba(99, 102, 241, 0.14);
  --danger: #dc2626;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-border: rgba(255, 255, 255, 0.9);
  --card: #ffffff;
  --modal-bg: #ffffff;
  --input-bg: #fafafa;
  --ghost-bg: rgba(255, 255, 255, 0.9);
  --soft-bg: rgba(30, 27, 46, 0.06);
  --hover-bg: rgba(30, 27, 46, 0.07);
  --entity-hover: #f6f6fb;
  --tabbar-bg: #f1f1f8;
  --scrollbar: rgba(30, 27, 46, 0.15);
  --header-bg: rgba(255, 255, 255, 0.78);
  --empty-card-bg: rgba(255, 255, 255, 0.75);
  --backdrop: rgba(30, 27, 46, 0.4);
  --toast-bg: #1e1b2e;
  --bg: linear-gradient(140deg, #eef1ff 0%, #f3efff 30%, #fdf2f7 65%, #e9fbf3 100%);
  --shadow: 0 1px 2px rgba(30, 27, 46, 0.06), 0 4px 14px rgba(30, 27, 46, 0.05);
  --shadow-hover: 0 2px 4px rgba(30, 27, 46, 0.08), 0 10px 24px rgba(30, 27, 46, 0.09);
  --radius-lg: 16px;
  --radius-md: 12px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --text: #e8e6f4;
  --muted: #a0a0ba;
  --border: rgba(255, 255, 255, 0.09);
  --primary: #818cf8;
  --primary-weak: #a5b4fc;
  --primary-soft: rgba(129, 140, 248, 0.2);
  --danger: #f87171;
  --surface: rgba(28, 26, 48, 0.68);
  --surface-border: rgba(255, 255, 255, 0.08);
  --card: #26233f;
  --modal-bg: #221f3a;
  --input-bg: #1b1830;
  --ghost-bg: #26233f;
  --soft-bg: rgba(255, 255, 255, 0.08);
  --hover-bg: rgba(255, 255, 255, 0.08);
  --entity-hover: rgba(255, 255, 255, 0.05);
  --tabbar-bg: #1b1830;
  --scrollbar: rgba(255, 255, 255, 0.18);
  --header-bg: rgba(20, 18, 36, 0.8);
  --empty-card-bg: rgba(40, 37, 66, 0.85);
  --backdrop: rgba(0, 0, 0, 0.55);
  --toast-bg: #0f0e1b;
  --bg: linear-gradient(140deg, #14122a 0%, #1a1733 30%, #231732 65%, #11251f 100%);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.45), 0 14px 30px rgba(0, 0, 0, 0.4);
}

html, body {
  height: 100%;
}

body {
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ---------- Header ---------- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--surface-border);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 20;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

#hamburger-btn {
  display: none;
}

/* "+ nova tarefa" existe só no mobile */
#add-card-btn {
  display: none;
}

.logo-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  color: var(--primary);
}

.app-logo h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  background: linear-gradient(90deg, var(--primary), var(--primary-weak));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-weak));
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.45);
}

.btn-ghost {
  background: var(--ghost-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.btn-ghost:hover {
  background: var(--card);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

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

.btn-icon:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.btn-icon-danger:hover {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

.btn-icon-header {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--ghost-bg);
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.btn-icon-header svg {
  width: 18px;
  height: 18px;
}

.btn-icon-header:hover {
  background: var(--card);
  color: var(--text);
  transform: translateY(-1px);
}

.logout-header {
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.35);
}

.logout-header:hover {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

/* ---------- Board ---------- */

.board-wrap {
  height: calc(100vh - 69px);
  overflow: auto;
}

.board {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 28px;
  min-height: 100%;
}

.column {
  width: 300px;
  flex-shrink: 0;
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 10px 10px 14px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  transition: box-shadow 0.2s ease;
}

.column.drag-over {
  box-shadow: var(--shadow-hover), inset 0 0 0 2px rgba(99, 102, 241, 0.35);
}

.column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 12px;
}

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

.column-title {
  font-weight: 700;
  font-size: 0.95rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--soft-bg);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 9px;
}

.column-actions {
  display: flex;
}

/* ---------- Cards ---------- */

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  padding: 2px 2px 6px;
  min-height: 48px;
}

.cards::-webkit-scrollbar {
  width: 8px;
}

.cards::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 999px;
}

.card {
  background: var(--card);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  padding: 12px 12px 12px 14px;
  cursor: grab;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  transition: box-shadow 0.15s ease, opacity 0.15s ease;
}

.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--card-accent, transparent);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  transition: width 0.18s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card:hover::before {
  width: 10px;
}

.card:active {
  cursor: grabbing;
}

.card.dragging {
  opacity: 0.35;
  transform: rotate(3deg) scale(0.98);
}

.card-placeholder {
  height: 6px;
  border-radius: 999px;
  background: repeating-linear-gradient(
    90deg,
    var(--primary) 0 6px,
    transparent 6px 12px
  );
  opacity: 0.6;
}

.card-content {
  flex: 1;
  word-break: break-word;
  min-width: 0;
}

/* só no web: no hover o título corta com reticências antes dos botões;
   nada do card se move, os botões ficam sobrepostos na altura do título */
.card:hover .card-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 56px;
}

.card-title {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.35;
}

.card-note {
  color: var(--muted);
  font-size: 0.83rem;
  margin-top: 3px;
  white-space: pre-wrap;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.card-tasks {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-task {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-task-name {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-task-time {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--soft-bg);
  border-radius: 999px;
  padding: 1px 8px;
  flex-shrink: 0;
}

.card-task-name.done {
  text-decoration: line-through;
  color: var(--muted);
}

.card-task-time.done {
  color: #10b981;
}

.card-dates {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.card-dates svg {
  width: 13px;
  height: 13px;
  color: var(--primary);
}

.card-dates.overdue {
  color: var(--danger);
}

.card-dates.overdue svg {
  color: var(--danger);
}

.card-assignee {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: default;
  flex-shrink: 0;
}

.card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: none;
  gap: 2px;
}

.card:hover .card-actions {
  display: flex;
}

/* ---------- Empty state ---------- */

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
}

.empty-card {
  text-align: center;
  padding: 24px 40px;
  background: var(--empty-card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.empty-card > svg {
  width: 36px;
  height: 36px;
  color: var(--primary);
  margin: 0 auto 10px;
  opacity: 0.85;
  display: block;
}

.empty-card p {
  color: var(--muted);
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.empty-add-btn svg {
  margin: 0;
  width: 16px;
  height: 16px;
}

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in 0.15s ease;
}

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

.modal-box {
  background: var(--modal-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 520px;
  max-width: 92vw;
  box-shadow: var(--shadow-hover);
  animation: pop-in 0.18s ease;
}

.modal-box.card-modal {
  width: 900px;
}

.modal-box.card-modal.with-tasks {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  align-items: start;
}

.modal-box.card-modal.with-tasks .card-form {
  grid-column: 1;
  grid-row: 1;
}

.modal-box.card-modal.with-tasks .modal-tasks {
  grid-column: 1;
  grid-row: 2;
  margin-top: 0;
}

.modal-box.card-modal.with-tasks .card-tasks-panel {
  grid-column: 2;
  grid-row: 1 / 3;
  position: relative;
  align-self: stretch;
}

.modal-box.card-modal.with-tasks .card-tasks-panel::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -9px;
  width: 1px;
  background: var(--border);
}

.modal-box.card-modal.with-tasks .modal-actions {
  grid-column: 1 / -1;
  grid-row: 3;
  margin-top: 0;
}

.card-tasks-panel {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.card-tasks-panel .subtask-list {
  max-height: 360px;
}

@keyframes pop-in {
  from { transform: translateY(8px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-box h2 {
  font-size: 1.05rem;
  margin-bottom: 14px;
  font-weight: 700;
}

.modal-box input[type="text"],
.modal-box textarea,
.modal-box select,
.modal-box input[type="date"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.modal-box input[type="text"]:focus,
.modal-box textarea:focus,
.modal-box select:focus,
.modal-box input[type="date"]:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.modal-box textarea {
  min-height: 84px;
  resize: vertical;
  margin-top: 10px;
}

.modal-row {
  margin-top: 12px;
}

.modal-row label,
.modal-dates label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.modal-dates {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.modal-date-field {
  flex: 1;
}

.modal-dates label {
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.modal-dates input[type="date"] {
  padding: 7px 10px;
  font-size: 0.85rem;
}

.modal-dates input[type="date"].edited {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.modal-dates input[type="date"].saving {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions-spacer {
  flex: 1;
}

/* ---------- Tarefas do card ---------- */

.modal-tasks {
  margin-top: 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.modal-tasks-heading {
  margin-bottom: 10px;
}

.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.tasks-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.tasks-summary {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.subtask-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.subtask-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
}

.subtask-item input[type="checkbox"],
.card-task input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 5px;
  background: var(--input-bg);
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
}

.subtask-item input[type="checkbox"]:hover,
.card-task input[type="checkbox"]:hover {
  border-color: var(--primary);
}

.subtask-item input[type="checkbox"]:checked,
.card-task input[type="checkbox"]:checked {
  background-color: var(--primary);
  border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.subtask-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.subtask-item:hover {
  border-color: var(--primary);
  background: var(--ghost-bg);
}

.subtask-name-text {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtask-name-text.done {
  text-decoration: line-through;
  color: var(--muted);
}

.subtask-time {
  width: 56px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 12px 6px;
}

.subtask-unit {
  width: 105px !important;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 8px 6px;
}

.subtask-item .btn-icon {
  width: 26px;
  height: 26px;
}

.subtask-modal-fields {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.subtask-modal-fields .subtask-time {
  flex: 1;
  width: auto;
}

.subtask-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.subtask-form input[type="text"],
.subtask-form input[type="number"],
.subtask-form select {
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--card);
  padding: 8px 10px;
}

.subtask-form input[type="text"] {
  flex: 1 1 180px;
  min-width: 0;
}

.subtask-form input[type="number"] {
  width: 64px;
  padding: 12px 6px;
}

.subtask-form select {
  width: 88px;
}

.subtask-form .btn {
  padding: 8px 11px;
}

.tasks-hint {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ---------- Settings modal ---------- */

.settings-box {
  width: 460px;
  max-height: 86vh;
  overflow-y: auto;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-header h2 {
  margin-bottom: 0;
}

.tabbar {
  display: flex;
  gap: 6px;
  background: var(--tabbar-bg);
  padding: 4px;
  border-radius: 10px;
  margin-top: 16px;
}

.tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tab.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(30, 27, 46, 0.1);
}

.tab-panel {
  margin-top: 6px;
}

.entity-form {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
}

.entity-form input[type="color"] {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.entity-form input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 3px;
}

.entity-form input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}

.entity-form input[type="text"] {
  flex: 1;
}

.entity-list {
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 12px;
}

.entity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.entity-item:hover {
  background: var(--entity-hover);
}

.entity-item .swatch {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.entity-item .swatch::-webkit-color-swatch-wrapper {
  padding: 0;
}

.entity-item .swatch::-webkit-color-swatch {
  border: none;
  border-radius: 9px;
}

.entity-item .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.entity-item input[type="text"] {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--text);
  padding: 6px 8px;
  border-radius: 8px;
}

.entity-item input[type="text"]:hover {
  background: var(--card);
}

.entity-item input[type="text"]:focus {
  outline: none;
  background: var(--card);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ---------- Visualização ---------- */

.view-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  margin-top: 14px;
}

.view-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.view-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s ease;
}

.view-option:hover {
  background: var(--entity-hover);
}

.view-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: var(--soft-bg);
  border: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}

.view-option input:checked ~ .toggle-track {
  background: var(--primary);
  border-color: var(--primary);
}

.view-option input:checked ~ .toggle-track::after {
  transform: translateX(17px);
}

.settings-hint {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- Conta ---------- */

.account-username {
  color: var(--primary);
}

.account-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin: 14px 0 6px;
}

.account-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.account-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.account-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.account-actions .btn {
  flex: 1;
  justify-content: center;
}

#logout-btn-settings {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.3);
}

#logout-btn-settings:hover {
  background: rgba(220, 38, 38, 0.18);
  color: var(--danger);
}

/* ---------- Gráfico de andamento ---------- */

.chart-box {
  width: 480px;
}

.chart-hint {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--tabbar-bg);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.chart-wrap {
  margin-top: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px 4px;
}

#chart {
  display: block;
  width: 100%;
  height: auto;
  font-family: inherit;
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.legend-item i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.chart-verdict {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
}

.chart-verdict strong {
  font-size: 1rem;
}

.chart-verdict.ahead {
  background: rgba(16, 185, 129, 0.12);
  color: #0f9d70;
}

.chart-verdict.frombehind {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}

.chart-verdict.behind {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}

.chart-verdict.ontime {
  background: var(--primary-soft);
  color: var(--primary);
}

.chart-status {
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.chart-box .modal-actions {
  margin-top: 16px;
  justify-content: flex-end;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(30, 27, 46, 0.35);
  z-index: 200;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { transform: translateX(-50%) translateY(10px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ---------- Sidebar (mobile) ---------- */

.sidebar {
  display: none;
}

/* ---------- Mobile (< 768px) ---------- */

@media (max-width: 768px) {
  /* header: hamburger à esquerda, coração centralizado, nada à direita */
  .app-header {
    position: relative;
    justify-content: space-between;
    padding: 10px 14px;
  }

  .app-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  /* só o coração, sem o texto */
  .app-logo h1 {
    display: none;
  }

  .logo-icon {
    width: 25px;
    height: 25px;
  }

  .btn-icon-header {
    width: 36px;
    height: 36px;
  }

  #hamburger-btn {
    display: inline-flex;
  }

  /* configurações e logout ficam na sidebar (mobile) */
  #settings-btn,
  #logout-btn {
    display: none;
  }

  .board {
    padding: 14px 12px;
    gap: 12px;
  }

  .column {
    width: 84vw;
    max-width: 340px;
  }

  /* sem lápis/lixeira no mobile: o card abre no toque e exclusão é só no web */
  .card-actions,
  .card:hover .card-actions {
    display: none;
  }

  .card:hover .card-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    padding-right: 0;
  }

  /* "+ nova tarefa" volta no mobile (web não tem): só o ícone + */
  #add-card-btn {
    display: inline-flex;
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 10px;
  }

  .add-card-label {
    display: none;
  }

  /* sidebar */
  .sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 300px);
    flex-direction: column;
    background: var(--modal-bg);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-hover);
    z-index: 130;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: var(--backdrop);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 120;
    animation: fade-in 0.2s ease;
  }

  .sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-brand {
    flex: 1;
    font-weight: 700;
    font-size: 1rem;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 12px;
    flex: 1;
  }

  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
  }

  .sidebar-item:hover,
  .sidebar-item:active {
    background: var(--entity-hover);
  }

  .sidebar-item svg {
    width: 19px;
    height: 19px;
    color: var(--muted);
    flex-shrink: 0;
  }

  .sidebar-item > span:not(.toggle-track) {
    flex: 1;
  }

  .sidebar-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
  }

  #sidebar-theme-toggle:checked ~ .toggle-track {
    background: var(--primary);
    border-color: var(--primary);
  }

  #sidebar-theme-toggle:checked ~ .toggle-track::after {
    transform: translateX(17px);
  }

  .sidebar-logout {
    color: var(--danger);
  }

  .sidebar-logout svg {
    color: var(--danger);
  }

  .sidebar-logout:hover,
  .sidebar-logout:active {
    background: rgba(220, 38, 38, 0.1);
  }

  .sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid var(--border);
  }

  .sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-weak));
    color: #fff;
  }

  .sidebar-user-avatar svg {
    width: 18px;
    height: 18px;
  }

  .sidebar-theme-toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
  }

  .sidebar-theme-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
  }

  .sidebar-theme-toggle .toggle-track {
    margin: 0;
  }

  .sidebar-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .sidebar-user-name {
    font-weight: 700;
    font-size: 0.9rem;
  }

  .sidebar-user-username {
    font-size: 0.75rem;
    color: var(--muted);
  }

  /* modais viram "bottom sheet" */
  .modal {
    align-items: flex-end;
  }

  .modal-box {
    width: 100vw;
    max-width: 100vw;
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    animation: pop-up 0.2s ease;
  }

  @keyframes pop-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  .modal-box.card-modal.with-tasks {
    display: block;
  }

  .modal-box.card-modal.with-tasks .card-tasks-panel {
    margin-top: 16px;
  }

  .modal-box.card-modal.with-tasks .card-tasks-panel::before {
    display: none;
  }

  .modal-box.card-modal.with-tasks .modal-tasks {
    margin-top: 16px;
  }

  .settings-box,
  .chart-box {
    max-height: calc(100dvh - 16px);
  }

  /* espaçamento entre o box "criar nova tarefa" e a barra dos botões (mobile) */
  .modal-box.card-modal.with-tasks .modal-actions {
    margin-top: 28px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
  }

  .tab {
    padding: 7px 4px;
    font-size: 0.8rem;
  }

  .modal-actions {
    flex-wrap: wrap;
  }

  .modal-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .subtask-form select {
    width: 72px;
  }

  /* o "+" fica na mesma linha: sem quebra, título da tarefa encolhe */
  .subtask-form {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .subtask-form input[type="text"] {
    flex: 1 1 96px;
  }

  .toast {
    bottom: 18px;
    max-width: 90vw;
    width: max-content;
    text-align: center;
  }
}