:root {
  --paper: #fffdf9;
  --canvas: #fbf8f2;
  --card: rgba(255, 255, 255, 0.92);
  --line: #e9e3d9;
  --line-strong: #d9d1c4;
  --ink: #252421;
  --muted: #77716a;
  --soft: #f3eee6;
  --green: #159b78;
  --green-2: #72c7a6;
  --mint: #dff3ea;
  --peach: #ffe5da;
  --coral: #ef765d;
  --lavender: #ece8fb;
  --violet: #7366b1;
  --yellow: #fff1c5;
  --honey: #f3c95f;
  --danger: #d94c5e;
  --shadow: 0 12px 28px rgba(57, 48, 36, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(223, 243, 234, 0.55), transparent 22%),
    radial-gradient(circle at 86% 72%, rgba(255, 229, 218, 0.45), transparent 24%),
    var(--canvas);
}

body.is-locked {
  overflow: hidden;
}

body.is-locked .app-shell {
  display: none;
}

body:not(.is-locked) .auth-screen {
  display: none;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.board-scroller:focus-visible {
  outline: 3px solid rgba(21, 155, 120, 0.22);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 12px;
  height: 100vh;
  min-width: 980px;
  padding: 12px;
}

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

.auth-card {
  display: grid;
  width: min(100%, 390px);
  gap: 14px;
  padding: 24px;
}

.auth-brand {
  margin-bottom: 6px;
}

.auth-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

.auth-submit {
  width: 100%;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 14px;
}

.brand,
.nav-item,
.user-switch,
.section-title,
.category-row,
.calendar-head,
.profile-row,
.topbar,
.toolbar,
.dialog-head,
.dialog-actions,
.task-meta,
.task-card label,
.day-top,
.empty-state {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  margin-bottom: 28px;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #dff3ea, #fff0ce);
  font-size: 22px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  gap: 12px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
}

.nav-item span,
.user-initial {
  width: 20px;
  color: #6f716b;
  text-align: center;
}

.nav-item.active {
  background: linear-gradient(90deg, var(--mint), rgba(223, 243, 234, 0.42));
}

.user-list {
  display: grid;
  gap: 8px;
}

.user-switch {
  width: 100%;
  gap: 12px;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.user-switch.active {
  background: linear-gradient(90deg, var(--mint), rgba(223, 243, 234, 0.42));
}

.user-switch small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.user-switch strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}

.user-initial {
  display: grid;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.user-switch.active .user-initial {
  background: white;
}

.sidebar-section {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.section-title {
  justify-content: space-between;
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  font-size: 14px;
  font-weight: 760;
}

.category-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.category-row {
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.category-name {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  margin-right: 10px;
  border-radius: 50%;
}

.dot.work {
  background: #afa7dd;
}

.dot.home {
  background: #ff9f87;
}

.dot.life {
  background: #75c7b3;
}

.dot.health {
  background: #ef765d;
}

.dot.study {
  background: #b55ead;
}

.dot.idea {
  background: #f4d26f;
}

.profile-row p,
.eyebrow,
.stat-card span,
.stat-card small,
.search-summary,
.task-note,
.task-date,
.board-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.search-section {
  display: grid;
  gap: 12px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.search-field span {
  color: var(--green);
  font-size: 17px;
  font-weight: 800;
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.search-field input::placeholder {
  color: #a39a8e;
}

.sidebar-calendar {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #faf3e8, #fffaf3);
}

.calendar-head {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.calendar-nav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.calendar-head span,
.calendar-nav-btn {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.calendar-nav-btn {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 17px;
  line-height: 1;
}

.calendar-nav-btn:hover {
  border-color: var(--line-strong);
  background: white;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  text-align: center;
}

.calendar-day {
  position: relative;
  display: grid;
  height: 28px;
  min-width: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.calendar-day.outside {
  color: #bbb2a5;
}

.calendar-day.weekend {
  color: #e75245;
}

.calendar-day.in-week {
  background: rgba(223, 243, 234, 0.78);
}

.calendar-day.today {
  color: white;
  background: var(--green);
  font-weight: 800;
}

.calendar-day.has-tasks::after {
  position: absolute;
  right: 5px;
  bottom: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--honey);
  content: "";
}

.calendar-day.today.has-tasks::after {
  background: white;
}

.profile-row {
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.profile-row > div {
  min-width: 0;
}

.logout-btn {
  display: grid;
  width: 32px;
  height: 32px;
  margin-left: auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--muted);
  font-size: 17px;
}

.logout-btn:hover {
  color: var(--danger);
  border-color: rgba(217, 76, 94, 0.32);
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-weight: 800;
  background: linear-gradient(145deg, #e4ad8b, #7a5d4c);
}

.main-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
}

.week-title {
  min-width: 250px;
}

.eyebrow {
  margin-bottom: 4px;
}

.toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.icon-btn,
.ghost-btn,
.primary-btn,
.danger-btn {
  height: 36px;
  border-radius: var(--radius);
}

.icon-btn {
  min-width: 36px;
  border: 1px solid var(--line-strong);
  background: white;
}

.ghost-btn {
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  background: white;
}

.primary-btn {
  padding: 0 18px;
  border: 0;
  color: white;
  font-weight: 760;
  background: linear-gradient(135deg, #25b489, var(--green));
  box-shadow: 0 10px 20px rgba(21, 155, 120, 0.22);
}

.danger-btn {
  padding: 0 16px;
  border: 1px solid rgba(217, 76, 94, 0.28);
  color: var(--danger);
  background: #fff5f5;
}

.stats-row {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 74px;
  padding: 12px 18px;
  overflow: hidden;
}

.stat-card {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  padding: 0;
}

.stat-card strong {
  font-size: 22px;
  line-height: 1;
}

.stat-card small {
  white-space: nowrap;
}

.progress-stat {
  align-items: center;
  margin-left: auto;
  min-width: 280px;
}

.week-progress-bar {
  width: 124px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.week-progress-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--green-2));
  transition: width 180ms ease;
}

.board-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.board-hint {
  display: flex;
  justify-content: flex-end;
  padding: 10px 14px 0;
}

.board-scroller {
  min-height: 0;
  overflow: auto;
  padding: 12px 14px 14px;
  cursor: grab;
  overscroll-behavior: contain;
  scrollbar-color: #d6cec2 transparent;
}

.board-scroller.is-panning {
  cursor: grabbing;
  user-select: none;
}

.week-board {
  display: grid;
  grid-template-columns: repeat(7, 292px);
  align-items: start;
  gap: 10px;
  min-width: max-content;
  min-height: 100%;
  padding-bottom: 6px;
}

.day-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 620px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.day-column.is-today {
  border-color: rgba(21, 155, 120, 0.42);
  background: linear-gradient(180deg, rgba(223, 243, 234, 0.62), rgba(255, 255, 255, 0.72));
}

.day-column.has-search-match {
  border-color: rgba(21, 155, 120, 0.46);
  box-shadow: inset 0 0 0 1px rgba(21, 155, 120, 0.14);
}

.day-top {
  justify-content: space-between;
  gap: 10px;
}

.day-top strong {
  display: block;
  font-size: 19px;
}

.day-top .weekend {
  color: #e75245;
}

.day-date {
  color: var(--muted);
  font-size: 12px;
}

.day-count {
  min-width: 42px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.progress {
  height: 4px;
  overflow: hidden;
  border-radius: 20px;
  background: #e8e2d9;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-card {
  display: grid;
  gap: 10px;
  min-height: 92px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 8px 18px rgba(57, 48, 36, 0.06);
}

.task-card.done {
  background: rgba(255, 255, 255, 0.68);
}

.task-card.search-match {
  border-color: rgba(21, 155, 120, 0.52);
  box-shadow:
    0 0 0 2px rgba(223, 243, 234, 0.92),
    0 12px 22px rgba(21, 155, 120, 0.12);
}

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

.task-card label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.35;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--green);
}

.task-title {
  overflow-wrap: anywhere;
}

.task-note {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-meta {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
}

.tag.work {
  color: var(--violet);
  background: var(--lavender);
}

.tag.life {
  color: #17836a;
  background: var(--mint);
}

.tag.home {
  color: #e06a50;
  background: var(--peach);
}

.tag.health {
  color: #de634c;
  background: #ffe1d7;
}

.tag.study {
  color: #b55ead;
  background: #f4e4f5;
}

.tag.idea {
  color: #bd8410;
  background: var(--yellow);
}

.priority {
  border: 1px solid transparent;
}

.priority.low {
  color: #6d746f;
  background: #eef3ee;
}

.priority.medium {
  color: #a36d10;
  background: #fff1c5;
}

.priority.high {
  color: #bc4454;
  background: #ffe1e6;
}

.task-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.task-actions button,
.add-day-task {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: white;
  color: var(--muted);
}

.task-actions button {
  min-width: 32px;
  height: 30px;
}

.add-day-task {
  height: 36px;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.5);
}

.empty-state {
  justify-content: center;
  min-height: 108px;
  border: 1px dashed #d7d0c5;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.task-dialog {
  width: min(520px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(57, 48, 36, 0.22);
}

.task-dialog::backdrop {
  background: rgba(37, 36, 33, 0.28);
  backdrop-filter: blur(2px);
}

.task-dialog form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dialog-head,
.dialog-actions {
  justify-content: space-between;
  gap: 12px;
}

.dialog-actions > div {
  display: flex;
  gap: 8px;
}

.field,
.field-grid {
  display: grid;
  gap: 7px;
}

.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
}

.field input,
.field select {
  height: 38px;
  padding: 0 10px;
}

.field textarea {
  resize: vertical;
  min-height: 82px;
  padding: 10px;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
    min-width: 760px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .week-board {
    grid-template-columns: repeat(7, 272px);
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    min-width: 0;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    min-height: auto;
  }

  .main-area {
    min-height: 720px;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

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