@import url("https://fonts.googleapis.com/css2?family=Quicksand:wght@300..700&display=swap");

/* ─── App+Art — CSS ──────────────────────────────────────────────────────── */
:root {
  --bg: #2e2e30;
  --surface: #3f3f42;
  --surface2: #484849;
  --border: #59595c;
  --inset: #171717;
  --text: #797774;
  --text2: #908e8a;
  --text3: #5a5855;
  --c1: #5fa8a4;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --font-display: "Quicksand", sans-serif;
  --font-ui: system-ui, sans-serif;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  width: 300vw;
  height: 200vw;
  border-radius: 50%;
  position: fixed;
  left: -200%;
  top: -30%;
  filter: blur(100px);
  background: rgba(0,0,0,.2);
  pointer-events: none;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 42px;
  text-align: center;
  margin-bottom: 28px;
  color: var(--text);
}

.auth-logo span {
  color: var(--c1);
}

.auth-card {
  background: var(--surface);
  border-top: 1px solid #525254;
  border-left: 1px solid #525254;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 5px;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
  width: 100%;
  border: 2px solid var(--inset);
  background: var(--bg);
  padding: 9px 12px;
  font-family: var(--font-ui);
  font-size: 14px;
  height: 34px !important;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--c1);
}

.form-error {
  color: #c0402e;
  font-size: 12.5px;
  margin-bottom: 10px;
  min-height: 18px;
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 10px;
}

.modal-box-footer .btn-primary {
  background: var(--bg);
}

#app {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 0 4px rgba(0,0,0,.3);
}

.topbar-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.topbar-logo span {
  color: var(--c1);
}

.topbar-spacer {
  flex: 1;
}

.view-tabs {
  display: flex;
  gap: 2px;
}

.view-tab {
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: rgba(0,0,0,.5);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  transition: all .2s ease-in-out;
}

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

.view-tab.active {
  background: var(--surface);
  color: var(--c1);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--inset);
  border-radius: 0;
}

.btn-primary:hover {
  background: rgba(0,0,0,.1);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  padding: 6px 10px;
}

.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all var(--transition);
  font-size: 14px;
  transition: all .2s ease-in-out;
}

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

.icon-btn.danger:hover {
  background: var(--surface);
  color: #c0402e;
}

.avatar-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--c1);
  font-family: var(--font-ui);
  font-weight: 600;
  display: grid;
  place-items: center;
  transition: border-color var(--transition);
}

.avatar-btn:hover {
  border-color: var(--text);
}

.account-menu-wrap {
  position: relative;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 300;
  padding: 6px 0;
}

.account-email {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text2);
}

.dropdown-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  background: transparent;
  border: none;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}

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

.dropdown-item.danger {
  color: #c0402e;
}

.dropdown-item.danger:hover {
  background: #fce8e5;
}

#main {
  padding: 20px;
  overflow-y: auto;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  align-items: start;
}

.task-card {
  background: var(--bg);
  /* border-radius: 20px; */
  overflow: hidden;
  border: 2px solid #59595c;
  padding: 10px;
}

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

.task-card.dragging {
  opacity: 0.5;
  transform: scale(0.97);
}

.task-card.drag-over {
  border-left: 3px solid var(--c1);
  transform: translateX(2px);
}

.task-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 14px;
  cursor: grab;
  position: relative;
}

.task-card-header::before,
.task-card-header::after {
  content: "";
  height: 2px;
  width: 10px;
  background: var(--border);
  position: absolute;
  bottom: 0;
  left: -10px;
}

.task-card-header::after {
  left: auto;
  right: -10px;
}


.task-card-header:active {
  cursor: grabbing;
}

.task-color-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
}

.task-title-wrap {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: none;
  background: transparent;
  width: 100%;
  font-family: var(--font-ui);
  color: var(--text);
  outline: none;
  padding: 0;
  cursor: text;
}

.task-title:focus {
  white-space: normal;
  overflow: visible;
}

.task-timing {
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
}

.task-timing.due-soon {
  color: #5B6BAE;
}

#grid-today .task-timing.due-soon {
  color: #5FA8A4;
  display: none;
}

#grid-today .task-title {
  color: #5FA8A4;
}

#grid-open .task-title {
  color: #DDB800;
}

/* .task-timing.overdue {
  color: #c0402e;
} */

.task-title-wrap:has(.task-timing.overdue) .task-title {
    color: #c0402e !important;
}

.task-card-header:has(.task-timing.overdue) .task-color-pip {
  background-color: #c0402e !important;
}

.task-header-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}

.task-card:hover .task-header-actions {
  opacity: 1;
}

.color-picker-wrap {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}

.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--transition), border-color var(--transition);
}

.color-swatch:hover {
  transform: scale(1.2);
}

.color-swatch.active {
  border-color: var(--text);
}

.timing-row {
  display: flex;
  align-items: center;
  gap: 10px;
  row-gap: 10px;
  padding: 14px 10px;
  flex-wrap: wrap;
}

.timing-select,
.timing-date,
.repeat-select {
  border: 1px solid var(--inset);
  background: var(--bg);
  padding: 4px 8px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text2);
  height: 28px;
  box-sizing: border-box;
  border-radius: 0;
  outline: none;
  transition: border-color var(--transition);
  line-height: 20px;
  vertical-align: middle;
}

@media (hover: none) {
  .timing-select,
  .timing-date,
  .repeat-select {
    height: auto;
    min-height: 36px;
    padding: 6px 8px;
    line-height: normal;
  }
}

.timing-select:focus,
.timing-date:focus,
.repeat-select:focus {
  border-color: var(--c1);
}

.subtask-section {
  padding: 0;
}

.subtask-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.subtask-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  cursor: grab;
  transition: background var(--transition);
}

.subtask-row:hover {
  background: var(--surface2);
}

.subtask-row.dragging {
  opacity: 0.4;
}

.subtask-row.drag-over {
  background: var(--surface2);
  outline: 1px solid var(--c1);
}

.subtask-check {
  width: 16px;
  height: 16px;
  border-radius: 0;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: all var(--transition);
}

.subtask-check:hover {
  border-color: var(--c1);
}

.subtask-check.checked {
  background: var(--bg);
  border-color: var(--border);
  color: var(--border);
}

.subtask-check.checked::after {
  content: "";
  width: 5px;
  height: 3px;
  border-left: 1.5px solid var(--border);
  border-bottom: 1.5px solid var(--border);
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}

.subtask-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  border: none;
  background: transparent;
  font-family: var(--font-ui);
  color: var(--text);
  outline: none;
  padding: 0;
  cursor: text;
  resize: none;
}

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

.subtask-row .icon-btn {
  width: 22px;
  height: 22px;
  opacity: 0;
  font-size: 12px;
}

.subtask-row:hover .icon-btn {
  opacity: 1;
}

.subtask-date-wrap {
  display: flex;
  align-items: center;
}

.subtask-date-chip {
  font-size: 10.5px;
  color: var(--text3);
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition);
}

.subtask-date-chip:hover {
  color: var(--text);
}

.subtask-date {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text2);
  outline: none;
  width: 120px;
  transition: border-color var(--transition);
}

.subtask-date:focus {
  border-color: var(--c1);
}

.completed-bucket {
  padding-top: 8px;
}

.completed-bucket-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text3);
  font-size: 11.5px;
  font-weight: 500;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: color var(--transition);
}

.completed-bucket-toggle:hover {
  color: var(--text2);
}

.bucket-arrow {
  font-size: 9px;
  transition: transform var(--transition);
}

.bucket-arrow.open {
  transform: rotate(90deg);
}

.completed-list {
  display: none;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
}

.completed-list.open {
  display: flex;
}

.add-subtask-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  margin-top: 4px;
}

.add-subtask-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text);
  outline: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}

.add-subtask-input:focus {
  border-bottom-color: var(--c1);
}

.add-subtask-input::placeholder {
  color: var(--text3);
}

.artifacts-section {
  padding: 8px 2px 12px;
}

.artifacts-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text3);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  width: 100%;
  text-align: left;
  transition: color var(--transition);
}

.artifacts-toggle:hover {
  color: var(--text2);
}

.artifacts-body {
  display: none;
  margin-top: 8px;
}

.artifacts-body.open {
  display: block;
}

.artifact-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-bottom: 4px;
}

.artifact-type-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid var(--surface2);
  color: var(--text2);
  flex-shrink: 0;
  margin-top: 1px;
}

.artifact-content-wrap {
  flex: 1;
  min-width: 0;
}

.artifact-label {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 1px;
}

.artifact-content {
  font-size: 12.5px;
  padding-top: 2px;
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
}

.artifact-content a {
  color: var(--c1);
  text-decoration: none;
}

.artifact-content a:hover {
  text-decoration: underline;
}

.artifact-item .icon-btn {
  opacity: 0;
}

.artifact-item:hover .icon-btn {
  opacity: 1;
}

.add-artifact-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}

.add-artifact-select {
  border: 2px solid var(--inset);
  background: var(--bg);
  padding: 5px 8px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text2);
  outline: none;
  height: 24px;
}

.add-artifact-input {
  flex: 1;
  border: 2px solid var(--inset);
  background: var(--bg);
  padding: 5px 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  height: 24px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.add-artifact-input:focus {
  border-color: var(--c1);
}

.add-artifact-input::placeholder {
  color: var(--text3);
}

.task-card.task-completed .task-title {
  text-decoration: line-through;
  color: var(--text3);
}

.task-card.task-completed .task-card-header {
  background: var(--bg);
}

.main-completed-section {
  margin-top: 24px;
}

.main-completed-header {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 0;
  color: var(--text3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: none;
  background: none;
  width: 100%;
  transition: color var(--transition);
}

.main-completed-header:hover {
  color: var(--text2);
}

.main-completed-grid {
  display: none;
}

.main-completed-grid.open {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 64px 20px;
  color: var(--text3);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
}

.empty-state small {
  display: block;
  margin-top: 8px;
  font-size: 13px;
}

.loading {
  display: grid;
  place-items: center;
  min-height: 200px;
  color: var(--text3);
  font-size: 13px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.calendar-nav h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
}

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

.cal-day-label {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text);
  padding: 6px 0;
}

.cal-day {
  min-height: 90px;
  background: var(--surface);
  border: 2px solid var(--border);
  padding: 6px;
  transition: background var(--transition);
}

.cal-day.today {
  border-color: var(--c1);
  background: var(--bg);
}

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

.cal-day.cal-drop-active {
  background: #eef4f8;
  outline: 2px dashed var(--c1);
}

.cal-day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 4px;
}

.cal-day.today .cal-day-num {
  color: var(--c1);
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
}

.cal-task-chip {
  padding: 2px 6px;
  font-size: 10.5px;
  font-weight: 500;
  color: rgba(255,255,255,.7);
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition);
}

.cal-task-chip:hover {
  opacity: 0.85;
}

.cal-task-chip.dragging {
  opacity: 0.4;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 14px;
}

.week-col {
  background: var(--bg);
  border: 2px solid var(--border);
  padding: 10px;
  min-height: 200px;
}

.week-col.today {
  border-color: var(--c1);
}

.week-col.cal-drop-active {
  background: #eef4f8;
  outline: 2px dashed var(--c1);
}

.week-col-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  margin-bottom: 4px;
}

.week-col-date {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text);
  margin-bottom: 8px;
}

.week-col.today .week-col-date {
  color: var(--c1);
}

@media (min-width: 600px) {
  .task-card {
    transition: all .2s ease-in-out;
  }
  .week-grid {
    grid-template-columns: repeat(1, 1fr);
    gap: 10px;
  }

  .week-col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    position: relative;
    padding-left: 50px;
    min-height: 95px;
    height: auto;
  }

  .week-col .week-col-label,
  .week-col .week-col-date {
    position: absolute;
    left: 10px;
    top: 10px;
  }

  .week-col .week-col-date {
    top: 20px;
    font-size: 24px;
  }

  .cal-task-chip {
    font-size: 14px;
    padding: 8px;
    white-space: normal;
    text-overflow: unset;
    line-height: 1.2;
    height: auto;
    min-height: 95px;
  }
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.year-month {
  background: var(--bg);
  border: 2px solid var(--border);
  padding: 12px;
}

.year-month-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 8px;
  cursor: pointer;
  transition: color var(--transition);
}

.year-month-label:hover {
  color: var(--c1);
}

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.mini-day-label {
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--text3);
  padding: 2px 0;
}

.mini-day {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: 9.5px;
  color: var(--text3);
  border-radius: 3px;
  position: relative;
  transition: background var(--transition);
}

.mini-day.today {
  color: var(--c1);
  font-weight: 700;
  border-radius: 5px;
}

.mini-day.has-tasks {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.mini-day.has-tasks:hover {
  background: var(--surface2);
}

.mini-day.today.has-tasks {
  color: var(--c1);
}

.mini-dots {
  display: flex;
  justify-content: center;
  gap: 1px;
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
}

.mini-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  display: block;
}

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 200;
  justify-content: space-around;
  height: 60px;
  align-items: center;
  padding: 10px 10px 20px;
  box-shadow: 0 0 4px rgba(0,0,0,.3);
}

.mobile-nav-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  min-width: 56px;
}

.mobile-nav-btn .nav-icon {
  font-size: 18px;
  line-height: 1;
}

.mobile-nav-btn.active {
  color: var(--c1);
}

#btn-new-task-mobile {
  display: none;
}

#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: white;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  opacity: 0;
  transition: all 300ms;
  pointer-events: none;
  z-index: 999;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 900px) {
  .year-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  #main {
    padding-bottom: 80px;
  }

  .task-grid,
  .main-completed-grid.open {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .topbar-logo {
    font-size: 18px;
  }

  .view-tabs {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .cal-grid {
    gap: 8px;
  }

  .cal-day {
    min-height: 54px;
    padding: 7px;
  }

  .week-grid {
    grid-template-columns: 1fr;
  }

  .year-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .calendar-nav h2 {
    font-size: 13px;
  }

  .week-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    position: relative;
    padding-left: 50px;
    min-height: 65px;
  }

  .week-col .week-col-label,
  .week-col .week-col-date {
    position: absolute;
    left: 10px;
    top: 10px;
  }

  .week-col .week-col-date {
    top: 20px;
    font-size: 24px;
  }

  .cal-task-chip {
    font-size: 14px;
    padding: 8px;
    white-space: normal;
    text-overflow: unset;
    line-height: 1.2;
  }

  .mini-dots {
    bottom: 2px;
  }

  .mini-dot {
    width: 3px;
    height: 3px;
  }
}

/* ─── Task detail panel ──────────────────────────────────────────────────── */
.task-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.task-panel.open {
  transform: translateX(0);
}

.task-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 399;
}

.task-panel-body {
  overflow-y: auto;
  flex: 1;
  padding: 0;
}

/* Task card inside panel — no height constraint, card header acts as panel header */
.task-panel-body .task-card {
  height: auto !important;
  display: block !important;
  cursor: default;
}

.task-panel-body .task-card-header {
  border-radius: 0;
  position: sticky;
  top: 0;
  z-index: 2;
}

@media (min-width: 601px) {
  .task-card {
    height: 500px;
    display: flex;
    flex-direction: column;
  }

  .task-card-header,
  .color-picker-wrap,
  .timing-row {
    flex-shrink: 0;
  }

  .subtask-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  .subtask-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    min-height: 0;
  }

  .subtask-list::-webkit-scrollbar {
    display: none;
  }

  .completed-bucket {
    flex-shrink: 0;
  }

  .add-subtask-row {
    flex-shrink: 0;
  }

  .artifacts-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    max-height: 180px;
    overflow: hidden;
  }

  .artifacts-toggle {
    flex-shrink: 0;
  }

  .artifacts-body.open {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    display: flex;
    flex-direction: column;
  }

  .artifacts-body.open::-webkit-scrollbar {
    display: none;
  }

  .add-artifact-row {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    background: var(--surface);
    padding-top: 4px;
  }
}

/* ─── Repeating task completion style on calendar ────────────────────────── */
.cal-chip-done {
  opacity: 0.45;
  text-decoration: line-through;
}

/* ─── Modal box (delete repeat) ─────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 490;
}

.modal-box {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  z-index: 500;
}

.modal-box-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}

#new-task-modal .modal-box-header {
  display: none;
}

.modal-box-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
}

.modal-box-body {
  padding: 16px 18px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 3px;
}

.modal-box-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 18px;
  position: relative;
}

.modal-box-footer::before,
.modal-box-footer::after {
  content: "";
  height: 2px;
  width: 10px;
  background: var(--border);
  position: absolute;
  top: 0;
  left: 0;
}

#new-task-error:empty {
  display: none;
}

.modal-box-footer::after {
  left: auto;
  right: 0;
}

@media (max-width: 600px) {
  .task-panel {
    width: 100%;
  }
}

/* ─── Quick date buttons (Today / Tomorrow) ──────────────────────────────── */
.btn-quick-date {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-quick-date:hover {
  background: var(--c1);
  color: white;
  border-color: var(--c1);
}

/* ─── Mobile enhancements ────────────────────────────────────────────────── */
@media (hover: none) {

  /* Always show action buttons on touch devices */
  .task-header-actions {
    opacity: 1;
  }

  .task-header-actions .icon-btn {
    pointer-events: auto;
    touch-action: manipulation;
    position: relative;
    z-index: 1;
  }

  .subtask-row .icon-btn {
    opacity: 1;
  }

  .artifact-item .icon-btn {
    opacity: 1;
  }

  /* Larger touch targets for checkboxes and icon buttons */
  .subtask-check {
    width: 24px;
    height: 24px;
    border-radius: 0;
  }

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

  /* Prevent double-tap delay */
  .subtask-check,
  .icon-btn,
  .btn,
  .btn-quick-date,
  .color-swatch,
  .task-color-pip {
    touch-action: manipulation;
    position: relative;
  }
  .task-color-pip::after {
    content: '';
    position: absolute;
    inset: -10px;
  }
}

/* mobile-only elements: hidden on desktop hover devices, visible on touch */
.mobile-only {
  display: none;
}

@media (hover: none) {
  .mobile-only {
    display: grid;
  }
}

/* ─── Subtask drag handle ────────────────────────────────────────────────── */
.subtask-drag-handle {
  color: var(--text3);
  font-size: 16px;
  cursor: grab;
  padding: 0 3px 0 0;
  flex-shrink: 0;
  user-select: none;
  line-height: 1;
  margin-top: 2px;
}

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

/* ─── Completed-actions row ─────────────────────────────────────────────── */
.completed-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ─── List view sections ─────────────────────────────────────────────────── */
.list-section {
  margin-bottom: 15px;
}

.list-section-header {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 0 2px 14px;
}

.list-section[data-section="today"] .list-section-header    { color: #5fa8a4; }
.list-section[data-section="today"] .subtask-title          { color: #5fa8a4; }
.list-section[data-section="outstanding"] .list-section-header { color: #c0402e; }
.list-section[data-section="outstanding"] .subtask-title    { color: #c0402e; }
.list-section[data-section="open"] .list-section-header     { color: #e4b800; }
.list-section[data-section="open"] .subtask-title           { color: #e4b800; }
.list-section[data-section="upcoming"] .list-section-header { color: #5B6BAE; }

.list-section-empty {
  font-size: 12px;
  color: var(--text3);
  padding: 8px 2px;
  font-style: italic;
}

/* ─── Today section date subtitle ───────────────────────────────────────── */
.list-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.list-section-date {
  font-family: var(--font-display);
  text-transform: none;
  letter-spacing: 0;
  color: #5fa8a4;
}

/* ─── New task modal quick date active state ─────────────────────────────── */
.btn-quick-date.active {
  background: var(--c1);
  color: white;
  border-color: var(--c1);
}

/* ─── New task popover ───────────────────────────────────────────────────── */
.new-task-popover {
  position: fixed;
  z-index: 500;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  /* width set dynamically by JS */
}

.new-task-popover::before {
  content: "";
  width:  calc(100% - 40px);
  height: calc(100% - 40px);
  position: absolute;
  border: 2px solid var(--border);
  pointer-events: none;
}

.new-task-popover-caret {
  position: absolute;
  top: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--bg);
  transform: translateX(-50%);
  /* left set dynamically by JS */
}

/* ─── Pinned task ────────────────────────────────────────────────────────── */
.task-card.task-pinned .task-card-header {
  background: #1a1a1a;
}

.task-card.task-pinned .task-card-header::before,
.task-card.task-pinned .task-card-header::after {
  display: none;
}

.task-card.task-pinned .task-title {
  color: white;
  background: transparent;
}

.task-card.task-pinned .task-title::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.task-card.task-pinned .task-color-pip {
  background: white !important;
  cursor: pointer;
}

.task-card.task-pinned .task-color-pip:hover {
  opacity: 0.7;
}

.icon-btn-pinned {
  color: rgba(255, 255, 255, 0.85) !important;
}

.icon-btn-pinned:hover {
  color: white !important;
  background: rgba(255, 255, 255, 0.15) !important;
}

.icon-btn-pinned.danger:hover {
  background: rgba(220, 80, 80, 0.5) !important;
}

.cal-chip-pinned {
  font-weight: 600;
}

/* ─── Prevent iOS auto-zoom on input focus ───────────────────────────────── */
@media (hover: none) {

  input,
  textarea,
  .form-group input {
    font-size: 16px !important;
    border-radius: 0 !important;
    height: 20px !important;
  }
  select,
  .form-group select {
    font-size: 16px !important;
    border-radius: 0 !important;
    height: 34px !important;
  }
  
  .form-group input {
    font-size: 16px !important;
    border-radius: 0 !important;
    height: 44px !important;
  }
  .form-group select {
    font-size: 16px !important;
    border-radius: 0 !important;
    height: 44px !important;
  }
  
}