
:root {
  --navy: #163a52;
  --blue: #2f75b5;
  --pale-blue: #eaf3f9;
  --line: #d6dee3;
  --text: #243746;
  --muted: #637381;
  --green: #d9ead3;
  --green-text: #274e13;
  --yellow: #fff2cc;
  --yellow-text: #7f6000;
  --gray: #eceff1;
  --red: #b3261e;
  --white: #fff;
  --shadow: 0 8px 24px rgba(22, 58, 82, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #f7f9fa;
}

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

.app-header {
  background: var(--navy);
  color: var(--white);
  padding: 22px clamp(18px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.app-header h1 { margin: 0; font-size: clamp(1.4rem, 3vw, 2rem); }
.app-header p { margin: 5px 0 0; opacity: .82; }

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

button, .button {
  border: 0;
  border-radius: 9px;
  padding: 9px 13px;
  cursor: pointer;
  background: var(--blue);
  color: var(--white);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover, .button:hover { filter: brightness(.96); }

.secondary {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.24);
}

.danger { background: #8c2f27; }
.danger-text { background: transparent; color: var(--red); padding-inline: 0; }

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  background: var(--white);
  padding: 10px clamp(14px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab {
  white-space: nowrap;
  color: var(--navy);
  background: transparent;
  font-weight: 650;
}

.tab.active {
  background: var(--pale-blue);
  color: var(--blue);
}

main {
  width: min(1180px, calc(100% - 28px));
  margin: 28px auto 60px;
}

.hidden { display: none !important; }

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.page-heading h2 { margin: 0; font-size: 1.7rem; }
.page-heading p { margin: 4px 0 0; color: var(--muted); }

.dashboard-list {
  display: grid;
  gap: 10px;
}

.dashboard-row, .empty-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.dashboard-row {
  display: grid;
  grid-template-columns: 150px minmax(220px, 1fr) minmax(300px, 2fr);
  align-items: center;
  gap: 18px;
  padding: 15px 18px;
}

.dashboard-area {
  color: var(--blue);
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

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

.dashboard-next {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.dashboard-next-label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.empty-card {
  padding: 18px;
}

.project-list {
  display: grid;
  gap: 12px;
}

.project-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 3px 14px rgba(22,58,82,.06);
}

.project-summary {
  width: 100%;
  padding: 16px 18px;
  background: var(--white);
  color: var(--text);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  text-align: left;
}

.summary-main, .summary-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.summary-main { min-width: 0; }
.summary-main > div { min-width: 0; }

.project-name {
  margin: 0;
  font-size: 1.03rem;
}

.next-action {
  margin: 4px 0 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 700px;
}

.priority-pill, .status-badge {
  border-radius: 999px;
  padding: 5px 9px;
  font-weight: 800;
  font-size: .78rem;
}

.priority-A { background: var(--green); color: var(--green-text); }
.priority-B { background: var(--yellow); color: var(--yellow-text); }
.priority-C { background: var(--gray); color: #4d565c; }

.status-badge { background: var(--pale-blue); color: var(--navy); }
.progress { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.chevron { font-size: 1.25rem; transition: transform .2s ease; }
.project-card.open .chevron { transform: rotate(180deg); }

.project-body {
  border-top: 1px solid var(--line);
  padding: 18px;
}

.project-controls {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.project-controls label, .notes-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 650;
}

select, input[type="text"], textarea {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 11px;
  background: var(--white);
  color: var(--text);
}

textarea {
  width: 100%;
  resize: vertical;
}

.task-list {
  margin-top: 18px;
  display: grid;
  gap: 7px;
}

.task-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
}

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

.task-row.waiting {
  background: #fffaf0;
}

.task-text {
  width: 100%;
  border: 0 !important;
  padding: 5px 2px !important;
  background: transparent !important;
}

.task-waiting {
  background: transparent;
  color: var(--yellow-text);
  padding: 5px;
}

.task-delete {
  background: transparent;
  color: var(--red);
  padding: 5px;
}

.add-task-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  margin-top: 12px;
}

.area-toolbar {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.sort-control {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.sort-control select {
  min-width: 165px;
  padding-block: 8px;
}

.filter-btn {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--line);
}

.filter-btn.active {
  background: var(--pale-blue);
  color: var(--blue);
  border-color: #b9d5e8;
}

.add-project-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

@media (max-width: 760px) {
  .app-header { align-items: flex-start; flex-direction: column; }
  .dashboard-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .project-summary { align-items: flex-start; }
  .summary-meta { align-items: flex-end; flex-direction: column; }
  .next-action { white-space: normal; }
  .task-row { grid-template-columns: auto 1fr auto; }
  .task-waiting { grid-column: 2; justify-self: start; }
  .add-project-panel, .add-task-row { grid-template-columns: 1fr; }
}


.project-name-input {
  width: min(520px, 100%);
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 6px;
  margin: -4px -6px 0;
  border-radius: 7px;
  font-size: 1.03rem;
  font-weight: 700;
  color: var(--text);
}

.project-name-input:hover,
.project-name-input:focus {
  border-color: var(--line);
  background: var(--white);
  outline: none;
}

.drag-handle {
  color: var(--muted);
  font-size: 1.05rem;
  letter-spacing: -3px;
  cursor: grab;
  user-select: none;
}

.project-card.dragging {
  opacity: .45;
}

.project-card.drag-over {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.project-summary {
  cursor: pointer;
}


.filter-group {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 5px;
}

.filter-group legend {
  padding: 0;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.priority-filter-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.priority-filter-btn[data-priority="A"]:not(.active) {
  background: var(--green);
  color: var(--green-text);
}

.priority-filter-btn[data-priority="B"]:not(.active) {
  background: var(--yellow);
  color: var(--yellow-text);
}

.priority-filter-btn[data-priority="C"]:not(.active) {
  background: var(--gray);
  color: #4d565c;
}




/* Dashboard compact expandable rows */
.dashboard-project-card .project-summary {
  display: grid;
  grid-template-columns: 150px minmax(250px, 1fr) minmax(360px, 2fr) 34px 24px;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 16px 18px;
  text-align: left;
}

.dashboard-summary-area {
  color: var(--blue);
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.dashboard-summary-project {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dashboard-project-name {
  min-width: 0;
  width: 100%;
  font-size: 1rem;
}

.dashboard-summary-next {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.dashboard-next-label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.dashboard-next-text {
  color: var(--text);
  line-height: 1.3;
}

.dashboard-chevron {
  justify-self: end;
  transition: transform .18s ease;
}

.dashboard-project-card.open .dashboard-chevron {
  transform: rotate(180deg);
}

@media (max-width: 860px) {
  .dashboard-project-card .project-summary {
    grid-template-columns: 110px minmax(180px, 1fr) minmax(240px, 1.5fr) 32px 20px;
    gap: 12px;
  }
}

@media (max-width: 680px) {
  .dashboard-project-card .project-summary {
    grid-template-columns: 1fr 20px;
  }

  .dashboard-summary-area,
  .dashboard-summary-project,
  .dashboard-summary-next {
    grid-column: 1;
  }

  .dashboard-chevron {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
  }
}


.drag-handle[draggable="true"] {
  cursor: grab;
}

.drag-handle[draggable="true"]:active {
  cursor: grabbing;
}


.drag-handle {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: grab;
  user-select: none;
}

.drag-handle:hover,
.drag-handle:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
  outline: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.dashboard-drag-handle {
  justify-self: end;
}

@media (max-width: 680px) {
  .dashboard-drag-handle {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    margin-right: 30px;
  }

  .dashboard-chevron {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
  }
}


.summary-meta .drag-handle {
  flex: 0 0 30px;
  display: inline-grid;
  place-items: center;
  margin-right: 2px;
}

.drag-handle {
  position: relative;
  z-index: 3;
  touch-action: none;
}


/* Full project-card image shown while dragging */
.project-drag-preview {
  position: fixed;
  top: -10000px;
  left: -10000px;
  z-index: 99999;
  pointer-events: none;
  opacity: .92;
  transform: rotate(.5deg);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .2);
  background: var(--white);
}

.project-drag-preview .drag-handle {
  color: var(--blue);
  border-color: var(--blue);
}

.project-card.dragging {
  opacity: .28;
  transform: scale(.995);
}


/* Keep the drag preview inside a practical browser-sized footprint. */
.project-drag-preview {
  max-width: calc(100vw - 48px);
  overflow: hidden;
}


/* Search controls */
.search-control {
  display: grid;
  gap: 5px;
  min-width: 230px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.search-control input {
  min-height: 38px;
}

/* Dashboard grouping */
#dashboardGroups {
  display: grid;
  gap: 28px;
}

.dashboard-area-group {
  display: grid;
  gap: 10px;
}

.dashboard-area-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px;
}

.dashboard-area-heading h3 {
  margin: 0;
  color: var(--navy);
  font-size: 1.1rem;
}

.dashboard-area-heading span {
  color: var(--muted);
  font-size: .85rem;
}

.dashboard-area-list {
  display: grid;
  gap: 10px;
}

.dashboard-project-card .project-summary {
  grid-template-columns: minmax(250px, 1fr) minmax(360px, 2fr) 34px 24px;
}

/* Daily Habits */
.habit-list {
  display: grid;
  gap: 12px;
}

.habit-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.habit-main {
  display: grid;
  grid-template-columns: auto minmax(200px, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.habit-today-check {
  position: relative;
  width: 38px;
  height: 38px;
}

.habit-today-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.habit-checkmark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--line);
  border-radius: 50%;
  color: transparent;
  cursor: pointer;
  font-weight: 900;
}

.habit-today-check input:checked + .habit-checkmark {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
}

.habit-info {
  display: grid;
  gap: 3px;
}

.habit-name-input {
  width: min(520px, 100%);
  border-color: transparent;
  background: transparent;
  font-size: 1rem;
  font-weight: 700;
}

.habit-name-input:focus {
  border-color: var(--line);
  background: var(--white);
}

.habit-streak {
  color: var(--muted);
  font-size: .82rem;
}

.habit-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.habit-day {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--background);
  color: var(--muted);
}

.habit-day span {
  font-size: .7rem;
  text-transform: uppercase;
}

.habit-day strong {
  font-size: .9rem;
}

.habit-day.done {
  border-color: var(--blue);
  background: #e7f2fb;
  color: var(--navy);
}

.habit-day.today {
  box-shadow: inset 0 0 0 2px var(--navy);
}

@media (max-width: 760px) {
  .area-toolbar {
    align-items: stretch;
  }

  .search-control {
    min-width: 100%;
  }

  .dashboard-project-card .project-summary {
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.3fr) 32px 20px;
  }

  .habit-week {
    grid-template-columns: repeat(7, minmax(36px, 1fr));
    gap: 5px;
  }
}

@media (max-width: 560px) {
  .habit-main {
    grid-template-columns: auto 1fr;
  }

  .habit-delete {
    grid-column: 2;
    justify-self: start;
  }

  .habit-week {
    overflow-x: auto;
  }
}


/* Backup dialogs */
.backup-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
}

.backup-dialog::backdrop {
  background: rgba(10, 31, 48, .58);
  backdrop-filter: blur(2px);
}

.dialog-card {
  max-height: calc(100vh - 40px);
  padding: 24px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.dialog-heading h2 {
  margin: 0 0 5px;
  color: var(--navy);
}

.dialog-heading p {
  margin: 0;
  color: var(--muted);
}

.icon-button {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.45rem;
  line-height: 1;
}

.dialog-field {
  display: grid;
  gap: 7px;
  color: var(--navy);
  font-weight: 700;
}

.dialog-field textarea {
  resize: vertical;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.auto-backup-setting {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--background);
}

.auto-backup-setting input {
  margin-top: 3px;
  width: 19px;
  height: 19px;
}

.auto-backup-setting span {
  display: grid;
  gap: 3px;
}

.auto-backup-setting small {
  color: var(--muted);
}

.backup-manager-actions {
  display: flex;
  justify-content: flex-end;
  margin: 16px 0;
}

.backup-snapshot-list {
  display: grid;
  gap: 10px;
}

.backup-snapshot {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.backup-snapshot-info {
  display: grid;
  gap: 3px;
}

.backup-snapshot-info span {
  color: var(--muted);
  font-size: .82rem;
}

.backup-snapshot-info p {
  margin: 5px 0 0;
  color: var(--navy);
  font-size: .9rem;
}

.backup-snapshot-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.backup-empty-card {
  box-shadow: none;
}

@media (max-width: 680px) {
  .backup-snapshot {
    grid-template-columns: 1fr;
  }

  .backup-snapshot-actions {
    justify-content: flex-start;
  }

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


/* ============================================================
   VERSION 2.0 DESKTOP APPLICATION SHELL
   ============================================================ */
:root {
  --sidebar: #102f45;
  --sidebar-2: #173f59;
  --surface: #ffffff;
  --surface-soft: #f6f8fa;
  --text: #183247;
  --muted-2: #63798a;
  --accent: #2478b5;
  --accent-soft: #e8f2fa;
  --success: #4d8e5d;
  --drop-line: #2b82c2;
}

html[data-theme="dark"] {
  --background: #0d1821;
  --white: #172630;
  --surface: #172630;
  --surface-soft: #12212b;
  --line: #304552;
  --navy: #eff7fb;
  --text: #e6f0f5;
  --muted: #9db0bc;
  --muted-2: #9db0bc;
  --blue: #67b5ec;
  --accent: #67b5ec;
  --accent-soft: #17394f;
  --shadow: 0 7px 22px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-columns: 254px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 15px 16px;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--sidebar), #0b2638);
  color: #fff;
}

.brand-block {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 11px;
  align-items: center;
  padding: 0 7px 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,.13);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .06em;
}

.brand-block h1 {
  margin: 0;
  color: #fff;
  font-size: .98rem;
  line-height: 1.15;
}

.brand-block p {
  margin: 4px 0 0;
  color: rgba(255,255,255,.65);
  font-size: .7rem;
}

.sidebar-nav {
  display: grid;
  gap: 3px;
}

.nav-item,
.sidebar-action {
  display: grid;
  grid-template-columns: 27px 1fr;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(255,255,255,.76);
  text-align: left;
  font-weight: 650;
  cursor: pointer;
}

.nav-item:hover,
.sidebar-action:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(255,255,255,.14);
  color: #fff;
  box-shadow: inset 3px 0 0 #78c4f4;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 6px;
  background: rgba(255,255,255,.08);
  font-size: .72rem;
}

.sidebar-footer {
  display: grid;
  gap: 2px;
  margin-top: auto;
  padding-top: 20px;
}

.sidebar-action {
  grid-template-columns: 27px 1fr;
  font-size: .8rem;
}

.file-action { cursor: pointer; }
.danger-sidebar { color: #ffc4bc; }
.app-version {
  padding: 12px 11px 0;
  color: rgba(255,255,255,.42);
  font-size: .68rem;
}

.workspace {
  min-width: 0;
}

.command-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(260px, 720px) auto;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 15px clamp(22px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
}

.command-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.command-search-wrap > input {
  width: 100%;
  min-height: 43px;
  padding: 9px 48px 9px 42px;
  border-radius: 11px;
  background: var(--surface-soft);
}

.command-search-icon {
  position: absolute;
  left: 15px;
  z-index: 1;
  color: var(--muted);
  font-size: 1.2rem;
}

.command-search-wrap kbd {
  position: absolute;
  right: 12px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface);
  font-family: inherit;
  font-size: .75rem;
}

.command-results {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  z-index: 50;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(0,0,0,.18);
}

.command-results button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.command-results button:hover { background: var(--accent-soft); }
.command-results button span:first-child { display: grid; gap: 2px; }
.command-results small { color: var(--muted); }
.command-empty { padding: 15px; color: var(--muted); }

main {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 32px clamp(22px, 4vw, 52px) 70px;
}

.app-header, .tabs { display: none !important; }

.page-heading {
  align-items: flex-end;
  margin-bottom: 22px;
}

.page-heading h2 {
  margin: 3px 0 4px;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  letter-spacing: -.035em;
}

.eyebrow {
  color: var(--accent);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.view-count {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 750;
}

.project-card,
.habit-card,
.today-action,
.review-checklist,
.review-summary-grid article {
  background: var(--surface);
}

.progress-wrap {
  display: grid;
  grid-template-columns: 72px 35px;
  align-items: center;
  gap: 7px;
}

.progress-bar {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
  transition: width .25s ease;
}

.progress { font-size: .72rem; }

.task-row {
  grid-template-columns: 27px auto minmax(180px, 1fr) auto auto !important;
}

.task-drag-handle {
  display: grid;
  place-items: center;
  width: 25px;
  height: 30px;
  color: var(--muted);
  cursor: grab;
  user-select: none;
}

.task-drag-handle:active { cursor: grabbing; }
.task-row.dragging { opacity: .28; }
.task-row.drag-over { box-shadow: inset 0 -3px 0 var(--drop-line); }

.today-list {
  display: grid;
  gap: 10px;
}

.today-action {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.today-check input { position: absolute; opacity: 0; }
.today-check span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--line);
  border-radius: 50%;
  color: transparent;
  cursor: pointer;
}
.today-check input:checked + span,
.today-check:hover span { border-color: var(--accent); color: var(--accent); }

.today-action-copy { display: grid; gap: 4px; }
.project-link {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}
.project-link:hover { color: var(--accent); }

.area-chip {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.review-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.review-summary-grid article {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.review-summary-grid strong { font-size: 1.65rem; color: var(--accent); }
.review-summary-grid span { color: var(--muted); font-size: .8rem; }

.review-checklist {
  display: grid;
  gap: 10px;
  margin-bottom: 26px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.review-checklist h3 { margin: 0 0 5px; }
.review-checklist label {
  display: flex;
  gap: 10px;
  align-items: center;
}

.review-section {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 3px;
}
.section-title h3 { margin: 0; }
.section-title span { color: var(--muted); }

.empty-card.compact { padding: 12px 16px; }
.empty-card.compact p { margin: 0; }

.backup-file-setting {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 15px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.backup-file-setting > div:first-child {
  display: grid;
  gap: 4px;
}
.backup-file-setting small,
#backupFolderStatus { color: var(--muted); }
#backupFolderStatus { font-size: .78rem; }
.backup-folder-actions { display: flex; gap: 7px; }
.backup-manager-actions { gap: 8px; }

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 82px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .brand-block { grid-template-columns: 1fr; justify-items: center; }
  .brand-block div { display: none; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; }
  .nav-item > span:last-child,
  .sidebar-action > span:last-child,
  .file-action,
  .sidebar-footer > button:not(#darkModeBtn) { font-size: 0; }
  .sidebar-action { grid-template-columns: 1fr; justify-items: center; }
  .app-version { display: none; }
  .review-summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 650px) {
  .app-shell { display: block; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 10px;
  }
  .brand-block, .sidebar-footer { display: none; }
  .sidebar-nav {
    display: flex;
    overflow-x: auto;
  }
  .nav-item {
    min-width: max-content;
    grid-template-columns: auto auto;
  }
  .nav-item > span:last-child { display: inline; font-size: .76rem; }
  .command-header {
    grid-template-columns: 1fr;
    padding: 10px 14px;
  }
  #quickAddBtn { display: none; }
  main { padding: 23px 14px 55px; }
  .review-summary-grid { grid-template-columns: 1fr 1fr; }
  .today-action { grid-template-columns: auto 1fr; }
  .area-chip { grid-column: 2; width: fit-content; }
  .progress-wrap { grid-template-columns: 48px 30px; }
  .backup-file-setting { grid-template-columns: 1fr; }
}


/* VERSION 2.1: Rich project notes */
.notes-label {
  display: grid;
  gap: 7px;
  color: var(--navy);
  font-size: .82rem;
  font-weight: 750;
}

.rich-notes-editor {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.rich-notes-editor:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.notes-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 42px;
  padding: 6px 7px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.notes-tool {
  min-width: 32px;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: .76rem;
  font-weight: 700;
}

.notes-tool:hover,
.notes-tool:focus-visible {
  border-color: var(--line);
  background: var(--surface);
}

.notes-tool-bold { font-weight: 900; }
.notes-tool-italic { font-family: Georgia, serif; font-style: italic; }
.notes-tool-underline { text-decoration: underline; }

.notes-toolbar-divider {
  width: 1px;
  height: 22px;
  margin: 0 2px;
  background: var(--line);
}

.notes-format-select {
  min-height: 30px;
  width: auto;
  padding: 4px 28px 4px 8px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: .76rem;
  font-weight: 650;
}

.project-notes {
  min-height: 112px;
  max-height: 420px;
  padding: 13px 14px;
  overflow-y: auto;
  color: var(--text);
  font-size: .92rem;
  font-weight: 400;
  line-height: 1.55;
  outline: none;
  overflow-wrap: anywhere;
}

.project-notes:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.project-notes h1,
.project-notes h2,
.project-notes h3 {
  color: var(--navy);
  line-height: 1.25;
}

.project-notes h1 { margin: .6em 0 .35em; font-size: 1.5rem; }
.project-notes h2 { margin: .55em 0 .3em; font-size: 1.25rem; }
.project-notes h3 { margin: .5em 0 .25em; font-size: 1.05rem; }
.project-notes p { margin: .35em 0; }
.project-notes ul,
.project-notes ol { margin: .45em 0; padding-left: 1.55rem; }

.project-notes a {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 620px) {
  .notes-toolbar-divider { display: none; }
  .notes-format-select { max-width: 125px; }
}


/* VERSION 2.2: Reorderable dashboard area groups */
.dashboard-area-group {
  position: relative;
  transition:
    opacity .15s ease,
    transform .15s ease,
    box-shadow .15s ease;
}

.dashboard-area-heading {
  min-height: 42px;
}

.dashboard-area-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-area-title h3 {
  margin: 0;
}

.dashboard-area-drag-handle {
  display: inline-grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  cursor: grab;
  user-select: none;
}

.dashboard-area-drag-handle:hover,
.dashboard-area-drag-handle:focus-visible {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--accent);
}

.dashboard-area-drag-handle:active {
  cursor: grabbing;
}

.dashboard-group-dragging {
  opacity: .35;
}

.dashboard-group-drag-over {
  border-radius: 14px;
  box-shadow: inset 0 -4px 0 var(--drop-line);
}

@media (max-width: 650px) {
  .dashboard-area-drag-handle {
    width: 34px;
    height: 34px;
  }
}


/* VERSION 2.3: Today Area and Context filters */
.today-filters {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.today-filters label {
  display: grid;
  gap: 5px;
  min-width: 180px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 750;
}

.today-filters select {
  min-height: 40px;
  padding: 8px 34px 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: .88rem;
}

.today-filters .secondary-button {
  min-height: 40px;
}

.today-action-tags {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.context-chip {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}

.context-unassigned {
  color: var(--muted);
  font-weight: 600;
}

.task-context {
  width: 118px;
  min-width: 108px;
  min-height: 34px;
  padding: 5px 26px 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: .74rem;
}

@media (max-width: 760px) {
  .today-filters {
    align-items: stretch;
  }

  .today-filters label {
    flex: 1 1 170px;
    min-width: 0;
  }

  .today-action-tags {
    width: 100%;
    justify-content: flex-start;
    padding-left: 42px;
  }

  .task-context {
    width: 100%;
  }
}


/* VERSION 2.3.1: Refined task rows */
.task-row {
  display: grid;
  grid-template-columns:
    24px
    22px
    minmax(180px, 1fr)
    118px
    88px
    38px;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 12px;
}

.task-drag-handle {
  justify-self: center;
  align-self: center;
  width: 22px;
  margin: 0;
  cursor: grab;
}

.task-row > input[type="checkbox"] {
  justify-self: center;
  margin: 0;
}

.task-text {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.task-context {
  width: 118px;
  min-width: 118px;
  min-height: 34px;
  margin: 0;
  padding: 5px 25px 5px 8px;
  white-space: nowrap;
}

.task-waiting {
  justify-self: stretch;
  min-height: 34px;
  margin: 0;
  padding: 5px 9px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: .74rem;
  font-weight: 750;
}

.task-delete {
  display: inline-grid;
  place-items: center;
  justify-self: end;
  width: 34px;
  height: 34px;
  min-width: 34px;
  margin: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, #b42318 35%, var(--line));
  border-radius: 8px;
  background: transparent;
  color: #b42318;
  font-size: .95rem;
  line-height: 1;
}

.task-delete:hover,
.task-delete:focus-visible {
  border-color: #b42318;
  background: color-mix(in srgb, #b42318 9%, transparent);
  color: #8f1c13;
}

.task-row.done .task-text {
  opacity: .7;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 820px) {
  .task-row {
    grid-template-columns:
      24px
      22px
      minmax(0, 1fr)
      38px;
    grid-template-areas:
      "drag check text delete"
      ". . context waiting";
    gap: 8px 10px;
    padding: 11px 12px;
  }

  .task-drag-handle {
    grid-area: drag;
  }

  .task-row > input[type="checkbox"] {
    grid-area: check;
  }

  .task-text {
    grid-area: text;
  }

  .task-context {
    grid-area: context;
    width: min(180px, 100%);
    min-width: 0;
    justify-self: start;
  }

  .task-waiting {
    grid-area: waiting;
    justify-self: end;
    min-width: 88px;
  }

  .task-delete {
    grid-area: delete;
  }
}

@media (max-width: 520px) {
  .task-row {
    grid-template-columns:
      24px
      22px
      minmax(0, 1fr)
      38px;
    grid-template-areas:
      "drag check text delete"
      ". . context context"
      ". . waiting waiting";
  }

  .task-context,
  .task-waiting {
    width: 100%;
    justify-self: stretch;
  }
}


/* VERSION 2.3.2: Structural task-row layout fix
   Controls now live inside one dedicated grid container. This avoids older
   .task-row column rules from forcing the final control onto another line. */
.task-row {
  display: block !important;
  min-height: 0;
  padding: 0 !important;
  overflow: hidden;
}

.task-row-content {
  display: grid;
  grid-template-columns:
    24px
    22px
    minmax(160px, 1fr)
    112px
    84px
    36px;
  align-items: center;
  gap: 9px;
  min-height: 56px;
  padding: 9px 11px;
}

.task-row-content > .task-drag-handle {
  grid-column: 1;
  justify-self: center;
}

.task-row-content > input[type="checkbox"] {
  grid-column: 2;
  justify-self: center;
  width: 16px;
  height: 16px;
  margin: 0;
}

.task-row-content > .task-text {
  grid-column: 3;
  min-width: 0;
}

.task-row-content > .task-context {
  grid-column: 4;
  width: 112px;
  min-width: 112px;
}

.task-row-content > .task-waiting {
  grid-column: 5;
  min-width: 84px;
}

.task-row-content > .task-delete {
  grid-column: 6;
  justify-self: end;
}

.task-row:hover {
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
}

.task-row.dragging .task-row-content {
  opacity: .35;
}

@media (max-width: 900px) {
  .task-row-content {
    grid-template-columns:
      24px
      22px
      minmax(0, 1fr)
      36px;
    grid-template-areas:
      "drag check text delete"
      ". . controls controls";
    gap: 8px 9px;
    padding: 10px 11px;
  }

  .task-row-content > .task-drag-handle {
    grid-area: drag;
  }

  .task-row-content > input[type="checkbox"] {
    grid-area: check;
  }

  .task-row-content > .task-text {
    grid-area: text;
  }

  .task-row-content > .task-delete {
    grid-area: delete;
  }

  .task-row-content > .task-context {
    grid-area: controls;
    justify-self: start;
    width: 112px;
    min-width: 112px;
  }

  .task-row-content > .task-waiting {
    grid-area: controls;
    justify-self: start;
    margin-left: 121px;
    min-width: 84px;
    width: 84px;
  }
}

@media (max-width: 560px) {
  .task-row-content {
    grid-template-columns:
      22px
      22px
      minmax(0, 1fr)
      36px;
    grid-template-areas:
      "drag check text delete"
      ". . context context"
      ". . waiting waiting";
  }

  .task-row-content > .task-context {
    grid-area: context;
    width: 100%;
    min-width: 0;
    justify-self: stretch;
  }

  .task-row-content > .task-waiting {
    grid-area: waiting;
    width: 100%;
    min-width: 0;
    margin-left: 0;
    justify-self: stretch;
  }
}


/* VERSION 2.3.3: New-project priority selector */
.add-project-panel {
  grid-template-columns: minmax(220px, 1fr) 110px auto;
  align-items: end;
}

.new-project-name-field,
.new-project-priority-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.new-project-name-field input,
.new-project-priority-field select {
  width: 100%;
  min-height: 42px;
}

.new-project-priority-field select {
  min-width: 100px;
}

.add-project-panel #addProjectBtn {
  min-height: 42px;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .add-project-panel {
    grid-template-columns: minmax(0, 1fr) 100px;
  }

  .add-project-panel #addProjectBtn {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 460px) {
  .add-project-panel {
    grid-template-columns: 1fr;
  }

  .add-project-panel #addProjectBtn {
    grid-column: auto;
  }
}


/* VERSION 2.3.3a: Fixed-width project title field */
.project-name-input{
  width:360px;
  min-width:360px;
  max-width:360px;
  box-sizing:border-box;
}

@media (max-width:900px){
  .project-name-input{
    width:300px;
    min-width:300px;
    max-width:300px;
  }
}

@media (max-width:700px){
  .project-name-input{
    width:100%;
    min-width:0;
    max-width:100%;
  }
}


/* VERSION 2.3.3b: Prevent dashboard title/next-action overlap */
.dashboard-project-card .project-name-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.dashboard-project-card .summary-main > div {
  min-width: 0;
}

.dashboard-project-card .project-name-input {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
