:root {
  --nt-header-logo-size: 48px;
  --nt-header-padding-y: 0.75rem;
  --nt-header-height: calc(var(--nt-header-logo-size) + (var(--nt-header-padding-y) * 2));
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bs-body-bg);
}

header.navbar {
  padding-block: var(--nt-header-padding-y);
}

header.navbar .container-fluid {
  align-items: center;
}

.navbar-brand {
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-brand-logo {
  height: var(--nt-header-logo-size);
  width: auto;
  display: block;
}

.navbar-brand-title {
  line-height: 1;
  display: inline-block;
}

main.container-fluid {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 1rem;
  overflow: hidden;
  min-height: 0;
}

#app.row {
  flex: 1 1 auto;
  overflow: hidden;
  min-height: 0;
}

#app.row > * {
  display: flex;
  min-height: 0;
}

#app.row > * > .card {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Column cards with sticky headers and scrollable bodies */
.sticky-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--nt-header-height) - 2rem);
  overflow: hidden;
}

.sticky-card-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bs-card-cap-bg, #f8f9fa);
  border-bottom: 1px solid rgba(0,0,0,.125);
}

.sticky-card-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Modal: ensure it always scrolls and footer is reachable */
.modal-dialog {
  max-height: calc(100dvh - 2rem);
}
.modal-content {
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
}

/* Task modal responsive layout */
.task-modal-columns {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr);
}

.task-modal-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  font-size: 0.95rem;
}

.task-modal-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-modal-toggle {
  padding-top: 0.25rem;
}

.task-modal-toggle .form-check {
  margin: 0;
}

@media (min-width: 768px) {
  .task-modal .task-modal-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 992px) {
  .task-modal .task-modal-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.task-modal .modal-dialog {
  width: min(1100px, 96vw);
  max-width: none;
}

.task-modal .modal-content {
  max-height: min(92dvh, 760px);
}

.task-modal .modal-body {
  padding-bottom: 6rem;
  scroll-padding-bottom: 6rem;
}

.task-modal .modal-footer {
  position: sticky;
  bottom: 0;
  background: var(--bs-modal-bg, #fff);
  box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);
  z-index: 5;
}

/* Utilities */
.small-muted { color:#6c757d; font-size: 12px; }
.list-group-item-action.active { background:#0d6efd; border-color:#0d6efd; }

/* Project list styling */
#project-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#project-list > * {
  width: 100%;
}

#projects-last-updated {
  background: rgba(248, 249, 250, 0.85);
  border-top: 1px solid rgba(0,0,0,0.08);
  text-align: center;
}

.proj-row {
  border: none;
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--proj-color, var(--bs-light));
  color: var(--proj-text, inherit);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.proj-row:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.1);
}

.proj-row.proj-row-selected {
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08), 0 0 0 3px rgba(255,255,255,0.55), 0 0 0 5px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.proj-row .btn {
  background: rgba(255,255,255,0.15);
  border-color: currentColor;
  color: inherit;
}

.proj-row .btn:hover {
  background: rgba(255,255,255,0.25);
}


.proj-row .proj-row-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.proj-row .proj-info {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
}

.proj-row .proj-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.proj-counts {
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.proj-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--proj-count-bg, rgba(15,23,42,0.08));
  color: inherit;
}

.proj-row-selected .proj-count-pill {
  background: rgba(255,255,255,0.25);
}

.proj-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.proj-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,0.1);
  background: var(--proj-swatch-color, var(--bs-light));
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  position: relative;
  padding: 0;
}

.proj-color-swatch::after {
  content: '\2713';
  font-size: 1.05rem;
  color: #212529;
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.proj-color-swatch:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.proj-color-swatch.is-active {
  border-color: rgba(13,110,253,0.65);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.9), 0 0 0 4px rgba(13,110,253,0.25);
}

.proj-color-swatch.is-active::after {
  opacity: 1;
  transform: scale(1);
}

.proj-color-swatch:focus-visible {
  outline: 3px solid rgba(13,110,253,0.45);
  outline-offset: 2px;
}

.proj-color-swatch-none {
  background: repeating-linear-gradient(135deg, rgba(0,0,0,0.08) 0, rgba(0,0,0,0.08) 6px, rgba(255,255,255,0.75) 6px, rgba(255,255,255,0.75) 12px);
  color: rgba(33,37,41,0.55);
  font-size: 1.1rem;
  font-weight: 600;
}

.proj-color-swatch-none::after {
  content: '\00D7';
  opacity: 1;
  transform: none;
}

.proj-row .proj-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.proj-row .proj-chip {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: rgba(255,255,255,0.2);
  color: inherit;
}

.proj-row small {
  color: inherit;
  opacity: 0.85;
}

#project-list .list-group-item-action {
  border-radius: 0.75rem;
}

/* Task list layout */
#task-list,
#task-completed-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#task-list .list-group-item,
#task-completed-list .list-group-item {
  border: none;
  background: transparent;
  padding: 0;
}

.task-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 1rem;
  background: var(--task-card-bg, var(--bs-body-bg));
  color: var(--task-card-text, inherit);
  box-shadow: 0 1px 2px rgba(15,23,42,0.08), 0 10px 20px rgba(15,23,42,0.03);
  border: 1px solid rgba(15,23,42,0.08);
  --task-project-color: rgba(15,23,42,0.1);
  width: 100%;
  overflow: hidden;
}

.task-card a {
  color: inherit;
}

.task-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  border-radius: 1rem 0 0 1rem;
  background: var(--task-project-color, rgba(15,23,42,0.12));
}

.task-card-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.task-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: nowrap;
  min-width: 0;
}

.task-leading {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.task-leading .form-check-input {
  width: 1.25rem;
  height: 1.25rem;
}

.task-project-chip {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: rgba(255,255,255,0.65);
  color: var(--task-project-chip-text, #212529);
  box-shadow: inset 0 0 0 2px var(--task-project-color, rgba(108,117,125,0.45));
}

.task-title {
  font-weight: 600;
  font-size: 1rem;
  word-break: break-word;
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  cursor: pointer;
}

.task-title.task-title-done {
  text-decoration: line-through;
  color: var(--bs-secondary-color);
}

.task-flag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.task-flag-important {
  background: rgba(255, 159, 67, 0.2);
  color: #c0392b;
}

.task-flag-pill i {
  font-size: 0.85rem;
}


.task-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

.task-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.task-meta-icons {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.95rem;
  color: inherit;
  flex-wrap: wrap;
  justify-content: flex-start;
  flex: 0 0 auto;
}

.task-meta-icons:empty {
  display: none;
}

.task-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.task-meta-icons a {
  color: inherit;
}

.task-meta-item .bi {
  font-size: 1.1rem;
}

.task-meta-item span {
  font-size: 0.85rem;
  font-weight: 600;
}

.task-subtasks { 
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.task-subtasks-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-subtasks li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--bs-secondary-color);
}

.task-subtasks li span {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.task-subtasks-more {
  font-size: 0.75rem;
  opacity: 0.7;
}

.task-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  margin-left: auto;
}

.task-card-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
  padding: 0.35rem 0.6rem;
}

.task-card-actions .btn i {
  font-size: 1.05rem;
}

.task-card-done {
  opacity: 0.7;
}

.task-card-overdue {
  border-color: rgba(192,57,43,0.35);
  box-shadow: 0 1px 2px rgba(192,57,43,0.12), 0 10px 20px rgba(192,57,43,0.05);
}

.task-card-overdue .task-title {
  color: #c0392b;
}

.task-date-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-date-heading {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--bs-secondary-color);
}

.task-date-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (max-width: 767.98px) {
  .task-card::before {
    inset: auto 0 0 0;
    height: 4px;
    width: auto;
    border-radius: 0 0 1rem 1rem;
  }

  .task-header {
    justify-content: flex-start;
  }

  .task-footer {
    justify-content: flex-start;
  }
}

/* Tako list layout */
#note-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#note-list .list-group-item {
  border: none;
  background: transparent;
  padding: 0;
}

.tako-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 1rem;
  background: var(--tako-card-bg, var(--bs-body-bg));
  color: var(--tako-card-text, inherit);
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 1px 2px rgba(15,23,42,0.08), 0 8px 16px rgba(15,23,42,0.04);
  --tako-project-color: rgba(15,23,42,0.12);
  min-height: 0;
  overflow: hidden;
}

.tako-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 1rem 0 0 1rem;
  background: var(--tako-project-color, rgba(15,23,42,0.12));
}

.tako-card-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.tako-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
}

.tako-leading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.tako-heading {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  flex: 1 1 auto;
}

.tako-leading .form-check-input {
  width: 1.1rem;
  height: 1.1rem;
}

.tako-project-info {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.tako-project-chip {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: rgba(255,255,255,0.6);
  color: var(--tako-project-chip-text, inherit);
  box-shadow: inset 0 0 0 2px var(--tako-project-color, rgba(15,23,42,0.25));
}

.tako-project-name {
  font-size: 0.9rem;
}

.tako-project-info .tako-updated,
.tako-updated-only {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
}

.tako-updated-separator {
  color: var(--bs-secondary-color);
  font-size: 0.8rem;
}

.tako-list-placeholder {
  padding: 0.25rem 0;
}

.tako-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tako-title {
  font-weight: 600;
  font-size: 1rem;
  word-break: break-word;
}

.tako-title-done {
  text-decoration: line-through;
  color: var(--bs-secondary-color);
}

.tako-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tako-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.tako-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.tako-card-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.6rem;
}

.tako-card-actions .btn i {
  font-size: 1.05rem;
}

.tako-card-done {
  opacity: 0.85;
}

.tako-archived-section {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.tako-archived-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  color: inherit;
}

.tako-archived-toggle .small {
  font-weight: 400;
}

.tako-archived-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.tako-archived-collapse {
  margin-top: 0.5rem;
}

.tako-modal-meta {
  min-height: 1rem;
}

@media (max-width: 575.98px) {
  .tako-card {
    padding: 0.85rem;
  }

  .tako-card::before {
    inset: auto 0 0 0;
    width: auto;
    height: 4px;
    border-radius: 0 0 1rem 1rem;
  }
}