:root {
  --ink: #202a35;
  --muted: #687585;
  --line: #e3e8ee;
  --paper: #fff;
  --canvas: #f5f6f8;
  --blue: #315c78;
  --red: #c83e42;
  --yellow: #e3ad24;
  --green: #31845b;
  --shadow: 0 8px 24px rgba(32,42,53,.07);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 23px max(20px,calc((100vw - 1180px)/2));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}
.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: #e9f0f4;
  color: var(--blue);
  display: grid;
  place-items: center;
  font-size: 21px;
}
.brand h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.03em;
}
.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.header-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 9px;
  padding: 10px 13px;
  font-size: 13px;
  font-weight: 650;
  transition: .15s;
}
.btn:hover {
  border-color: #b9c5cf;
  background: #f9fbfc;
}
.btn.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn.primary:hover {
  background: #254b64;
}
.btn.small {
  padding: 7px 10px;
  font-size: 12px;
}
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 54px;
}
.notice {
  border: 1px solid #dce6eb;
  background: #eef4f6;
  color: #435967;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 12px;
  margin: 0 0 19px;
}
.notice strong {
  color: #274b60;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 17px;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  flex-wrap: wrap;
}
.search {
  min-width: 210px;
  max-width: 360px;
  flex: 1;
  position: relative;
}
.search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 10px 12px 10px 35px;
  outline: none;
}
.search:before {
  content: '⌕';
  position: absolute;
  top: 6px;
  left: 12px;
  color: #7b8997;
  font-size: 20px;
}
.toolbar select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
}
.folder-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 1px 12px;
  margin: 0 0 8px;
}
.folder-tab {
  flex: 0 0 auto;
  border: 1px solid #e7d38f;
  background: #fff9df;
  color: #5f5024;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 650;
}
.folder-tab:hover {
  border-color: #d7b94f;
  background: #fff4c6;
}
.folder-tab[aria-pressed="true"] {
  background: #ffe89a;
  border-color: #d1a91f;
  color: #474233;
  box-shadow: inset 0 0 0 1px rgba(209,169,31,.14);
}
.folder-tab span {
  margin-left: 5px;
  color: #83703a;
  font-weight: 500;
}
.folder-icon {
  width: 17px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 5px;
  color: #e5b323;
  filter: drop-shadow(0 1px 0 rgba(106,79,0,.2));
}
.folder-tag {
  background: #fff5cc!important;
  color: #604d14!important;
  border: 1px solid #ecd47c;
}
.folder-manager-row {
  background: #fffdf5;
}
.folder-manager-row .folder-icon {
  width: 19px;
  height: 16px;
}
.folder-tab.all-folders {
  background: #f3f5f7;
  border-color: var(--line);
  color: #52616e;
}
.folder-manage {
  margin-left: auto;
}
.folder-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.folder-row .folder-tag {
  background: #eef3f5;
  color: #425c6a;
  border-radius: 20px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 650;
}
.summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 21px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 15px;
  min-width: 116px;
}
.stat b {
  display: block;
  font-size: 19px;
  line-height: 1.1;
}
.stat span {
  color: var(--muted);
  font-size: 11px;
}
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(260px,1fr));
  gap: 13px;
}
.task-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 5px solid #a8b3bd;
  border-radius: 11px;
  padding: 15px 15px 12px;
  box-shadow: 0 2px 7px rgba(32,42,53,.025);
  min-width: 0;
  transition: box-shadow .16s,transform .16s;
}
.task-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.task-card.priority-high {
  border-left-color: var(--red);
}
.task-card.priority-medium {
  border-left-color: var(--yellow);
}
.task-card.priority-low {
  border-left-color: var(--green);
}
.task-card.soon {
  animation: urgentPulse 1.1s ease-in-out infinite;
}
.task-card.overdue {
  border-color: #e9b7b8;
  border-left-color: var(--red);
  animation: urgentPulse .85s ease-in-out infinite;
}
.task-card.completed {
  opacity: .72;
  animation: none;
}
.task-card.completed .task-title {
  text-decoration: line-through;
  color: #78838d;
}
@keyframes urgentPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(200,62,66,.05);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(200,62,66,.16);
  }
}
.task-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.task-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.priority-badge {
  font-size: 10px;
  font-weight: 750;
  border-radius: 30px;
  padding: 5px 8px;
  white-space: nowrap;
}
.priority-badge.high {
  background: #fde8e8;
  color: #a82e33;
}
.priority-badge.medium {
  background: #fff4d7;
  color: #805d00;
}
.priority-badge.low {
  background: #e5f4eb;
  color: #246b48;
}
.task-desc {
  font-size: 12px;
  color: #65717e;
  line-height: 1.5;
  margin: 9px 0 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 13px;
}
.date-cell {
  background: #f6f8fa;
  border-radius: 7px;
  padding: 8px;
}
.date-cell span {
  display: block;
  color: #778492;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 9px;
  font-weight: 700;
  margin-bottom: 4px;
}
.date-cell b {
  font-size: 12px;
  font-weight: 650;
}
.deadline {
  margin-top: 10px;
  font-size: 11px;
  color: #64717c;
}
.deadline.alert {
  font-weight: 750;
  color: #af3438;
}
.deadline.ok {
  color: #32805a;
}
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 13px;
  padding-top: 10px;
  border-top: 1px solid #edf0f2;
}
.status {
  font-size: 11px;
  color: #687585;
}
.actions {
  display: flex;
  gap: 3px;
}
.icon-btn {
  width: 30px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #75818c;
  border-radius: 6px;
  font-size: 16px;
}
.icon-btn:hover {
  background: #eef2f4;
  color: #263440;
}
.empty-state {
  grid-column: 1/-1;
  border: 1px dashed #cad3da;
  border-radius: 12px;
  background: #fff;
  text-align: center;
  padding: 48px 20px;
  color: #76828e;
}
.empty-state b {
  display: block;
  color: #394956;
  margin-bottom: 5px;
  font-size: 15px;
}
.footer-note {
  margin-top: 18px;
  color: #75818d;
  font-size: 11px;
}
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18,29,38,.48);
  z-index: 10;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.open {
  display: flex;
}
.modal#reminderModal {
  z-index: 40;
}
.modal-content {
  background: white;
  border-radius: 13px;
  padding: 23px;
  width: min(100%,510px);
  max-height: 94vh;
  overflow: auto;
  box-shadow: 0 20px 65px rgba(0,0,0,.2);
}
.modal-content h2 {
  font-size: 18px;
  margin: 0 0 17px;
}
.field {
  margin-bottom: 13px;
}
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #465462;
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #d8dfe5;
  border-radius: 8px;
  background: #fff;
  padding: 10px 11px;
  color: var(--ink);
  outline: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #6f91a6;
  box-shadow: 0 0 0 3px rgba(49,92,120,.1);
}
.field textarea {
  resize: vertical;
  min-height: 78px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.helper {
  color: #71808b;
  font-size: 10px;
  margin-top: 4px;
}
.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 19px;
}
.file-input {
  display: none;
}
.toast {
  position: fixed;
  right: 20px;
  bottom: 18px;
  z-index: 20;
  background: #243846;
  color: #fff;
  padding: 11px 15px;
  border-radius: 9px;
  font-size: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: .2s;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
@media (max-width:650px) {
  header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 18px;
  }
  .header-actions {
    width: 100%;
  }
  .header-actions .btn {
    flex: 1;
  }
  .page {
    padding: 18px 14px 40px;
  }
  .tasks-grid {
    grid-template-columns: 1fr;
  }
  .search {
    max-width: none;
  }
  .toolbar-left {
    width: 100%;
  }
  .toolbar select {
    flex: 1;
  }
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
@media (prefers-reduced-motion:reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    scroll-behavior: auto!important;
    transition: none!important;
  }
}
.reminder-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(18,29,38,.62);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.reminder-backdrop.open {
  display: flex;
}
.reminder-dialog {
  width: min(100%,520px);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 22px 70px rgba(0,0,0,.28);
  border-top: 5px solid var(--red);
}
.reminder-dialog h2 {
  margin: 0 0 8px;
  font-size: 19px;
}
.reminder-dialog p {
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.reminder-meta {
  margin: 14px 0;
  color: #8e292d;
  font-weight: 750;
}
.reminder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}
.reminder-actions .btn {
  min-height: 42px;
}
.reschedule-hint {
  font-size: 12px;
  color: var(--muted);
  margin: -8px 0 15px;
}
.task-id {
  margin-top: 8px;
  color: #75818d;
  font: 11px ui-monospace,SFMono-Regular,monospace;
  overflow-wrap: anywhere;
}
.notification-note {
  font-size: 11px;
  color: #687585;
  margin-top: 8px;
}
@media (max-width:520px) {
  .reminder-actions .btn {
    flex: 1 1 100%;
  }
}

/* Tema escuro: mantém os componentes e a hierarquia visual legíveis. */
:root[data-theme="dark"] {
  --ink: #e5edf3;
  --muted: #a6b4c0;
  --line: #394957;
  --paper: #202c36;
  --canvas: #141d25;
  --blue: #8dbbd4;
  --red: #ff7a7e;
  --yellow: #f2c85d;
  --green: #70d09a;
  --shadow: 0 8px 24px rgba(0,0,0,.28);
  color-scheme: dark;
}
:root[data-theme="dark"] body,
:root[data-theme="dark"] .modal-content,
:root[data-theme="dark"] .reminder-dialog {
  background: var(--canvas);
  color: var(--ink);
}
:root[data-theme="dark"] header,
:root[data-theme="dark"] .btn,
:root[data-theme="dark"] .stat,
:root[data-theme="dark"] .task-card,
:root[data-theme="dark"] .empty-state {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}
:root[data-theme="dark"] .btn.primary {
  background: #315c78;
  color: #fff;
  border-color: #315c78;
}
:root[data-theme="dark"] .btn:hover,
:root[data-theme="dark"] .icon-btn:hover {
  background: #2a3945;
  color: var(--ink);
}
:root[data-theme="dark"] .search input,
:root[data-theme="dark"] .toolbar select,
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select,
:root[data-theme="dark"] .field textarea {
  background: #18232c;
  color: var(--ink);
  border-color: var(--line);
}
:root[data-theme="dark"] .date-cell,
:root[data-theme="dark"] .folder-manager-row {
  background: #18232c;
  color: var(--ink);
}
:root[data-theme="dark"] .task-desc,
:root[data-theme="dark"] .deadline,
:root[data-theme="dark"] .status,
:root[data-theme="dark"] .helper,
:root[data-theme="dark"] .notification-note,
:root[data-theme="dark"] .reschedule-hint {
  color: var(--muted);
}
:root[data-theme="dark"] .folder-tab {
  background: #3b341f;
  color: #f3d77e;
  border-color: #665927;
}
:root[data-theme="dark"] .folder-tab[aria-pressed="true"] {
  background: #51451e;
  color: #ffe58d;
  border-color: #b2932b;
}
:root[data-theme="dark"] .folder-tab.all-folders {
  background: #293640;
  color: #d3e0e9;
  border-color: var(--line);
}
:root[data-theme="dark"] .folder-tag {
  background: #40371c!important;
  color: #f3d77e!important;
  border-color: #665927;
}
:root[data-theme="dark"] .notice {
  background: #1c303a;
  color: #c0d1dc;
  border-color: #34505e;
}
:root[data-theme="dark"] .notice strong {
  color: #d3e8f4;
}
:root[data-theme="dark"] .priority-badge.high {
  background: #51282b;
  color: #ffb5b7;
}
:root[data-theme="dark"] .priority-badge.medium {
  background: #4a3b1d;
  color: #ffdf8a;
}
:root[data-theme="dark"] .priority-badge.low {
  background: #1f4332;
  color: #a5e6bf;
}
:root[data-theme="dark"] .task-card.overdue {
  border-color: #704044;
  border-left-color: var(--red);
}
:root[data-theme="dark"] .card-bottom {
  border-color: var(--line);
}
:root[data-theme="dark"] .reminder-dialog {
  border-top-color: var(--red);
}
@media (prefers-reduced-motion:reduce) {
  .task-card.soon,
  .task-card.overdue {
    animation: none!important;
  }
}

/* Janela de consulta da tarefa: responsiva, acessível e compatível com o tema. */
.task-card[role="group"] {
  cursor: pointer;
}
.task-card[role="group"]:focus-visible {
  outline: 3px solid #7fa6c1;
  outline-offset: 3px;
}
.task-card[role="button"]:focus-visible {
  outline: 3px solid #7fa6c1;
  outline-offset: 3px;
}
.task-details-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: clamp(10px,3vw,24px);
  background: rgba(18,29,38,.58);
}
.task-details-modal.open {
  display: flex;
}
.task-details-content {
  width: min(100%,600px);
  max-height: min(90dvh,760px);
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(18px,4vw,26px);
  box-shadow: 0 22px 70px rgba(0,0,0,.26);
}
.task-details-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.task-details-heading h2 {
  margin: 0;
  font-size: clamp(18px,4vw,22px);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.task-details-close {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 22px;
}
.task-details-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 19px;
}
.task-details-chip {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--canvas);
  font-size: 12px;
}
.task-details-label {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.task-details-list {
  margin: 0;
  padding-left: 23px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.task-details-list li {
  padding-left: 3px;
  margin: 0 0 8px;
  white-space: pre-wrap;
}
.task-details-empty {
  color: var(--muted);
  font-size: 13px;
}
.task-details-buttons {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}
.task-details-buttons .btn {
  min-height: 42px;
}
:root[data-theme="dark"] .task-details-content {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}
:root[data-theme="dark"] .task-details-chip,
:root[data-theme="dark"] .task-details-close {
  background: #18232c;
  color: var(--ink);
  border-color: var(--line);
}
@media (max-width:520px) {
  .task-details-modal {
    padding: 9px;
  }
  .task-details-content {
    width: 100%;
    max-height: calc(100dvh - 18px);
    border-radius: 12px;
  }
  .task-details-buttons {
    justify-content: stretch;
  }
  .task-details-buttons .btn {
    flex: 1 1 100%;
  }
}
