:root {
  --bg: #fff8ef;
  --bg-2: #ffe9f2;
  --surface: #ffffff;
  --ink: #1a1f36;
  --muted: #6a7390;
  --line: #ffd6e5;
  --accent: #ff3b5c;
  --accent-soft: #ffe0e7;
  --accent-dark: #e11d48;
  --danger: #ff3b5c;
  --danger-soft: #ffe0e7;
  --today: #4f7cff;
  --shadow: 0 12px 32px rgba(255, 59, 92, 0.10);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Segoe UI", "Candara", "Gill Sans", Trebuchet MS, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1000px 480px at 0% 0%, rgba(79, 124, 255, 0.10) 0%, transparent 48%),
    radial-gradient(900px 420px at 100% 0%, rgba(255, 77, 184, 0.08) 0%, transparent 42%),
    radial-gradient(800px 360px at 50% 100%, rgba(20, 184, 166, 0.07) 0%, transparent 40%),
    linear-gradient(180deg, #f7f9fc 0%, #f4f7fb 42%, #eef3f9 100%);
  min-height: 100vh;
}
button, input, textarea { font: inherit; }
body, .app, .topbar, .workspace, .main, .unsorted-board, .grid, .day, .task, .backlog-task, .side-task, .cats, .modal {
  -webkit-user-select: none;
  user-select: none;
}
input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

#toasts {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 24px));
}
.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  animation: slideIn .28s ease;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}
.toast.error { border-left-color: var(--danger); }
.toast.hide { opacity: 0; transform: translateX(12px); transition: .25s ease; }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: 22px;
  padding: 36px 32px 30px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.7);
}
.login-card h1 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.login-card p {
  color: var(--muted);
  font-size: .95rem;
  margin-bottom: 24px;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: #f7fafc;
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #fff;
}
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
  transition: transform .12s, background .15s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  margin-top: 8px;
  box-shadow: 0 8px 18px rgba(42, 157, 143, .28);
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 8px 12px;
  font-size: .88rem;
}
.btn-ghost:hover { background: #f3f7fb; color: var(--ink); }
.login-error {
  display: none;
  margin-top: 12px;
  background: var(--danger-soft);
  color: #9b3b28;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .9rem;
}

.app { display: none; min-height: 100vh; flex-direction: column; }
.app.show { display: flex; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 180, 200, .45);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand strong { font-size: 1.15rem; letter-spacing: -0.02em; }
.brand span { color: var(--muted); font-size: .85rem; }
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.clock-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(180deg, #fff 0%, #fff3f7 100%);
  border: 2px solid #ffb4c8;
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: 0 6px 16px rgba(255, 59, 92, .10);
}
.clock-box .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ff3b5c;
  box-shadow: 0 0 0 4px rgba(255, 59, 92, .2);
  animation: pulse 1.6s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}
.clock-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: .02em;
  min-width: 5.2ch;
}
.clock-meta { color: var(--muted); font-size: .82rem; line-height: 1.25; }
.clock-split {
  width: 1px;
  height: 34px;
  background: #ffd2df;
  flex: 0 0 1px;
}
.clock-steps {
  text-align: right;
  min-width: 5.5ch;
}
.clock-steps strong {
  display: block;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: .02em;
}
.clock-steps span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.25;
}
.site-search {
  min-width: 160px;
  max-width: 240px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: #fff;
}
.search-panel {
  position: sticky;
  top: 72px;
  z-index: 40;
  margin: 0 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow: auto;
}
.search-hit {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  border-bottom: 1px solid var(--line);
}
.search-hit:last-child { border-bottom: 0; }
.search-hit:hover { background: #fff5f8; }
.search-hit .when { color: var(--muted); font-size: .8rem; white-space: nowrap; }

.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.main {
  flex: 1;
  padding: 18px 18px 28px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}
.btn-today {
  border: 2px solid #ffb4c8;
  background: linear-gradient(180deg, #fff 0%, #ffe8f0 100%);
  color: var(--accent);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 59, 92, .12);
  transition: background .15s, color .15s, transform .12s;
  white-space: nowrap;
}
.btn-today:hover {
  background: linear-gradient(180deg, #ff5a78 0%, #ff3b5c 100%);
  color: #fff;
  border-color: #ff3b5c;
}
.btn-today:active { transform: scale(.97); }
.btn-month-archive {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-month-archive:hover { background: #f3f7fb; color: var(--ink); }
.nav-arrow {
  width: 48px;
  height: 48px;
  border: 2px solid #ffb4c8;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, #ffe8f0 100%);
  color: var(--accent);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(255, 59, 92, .12);
  transition: background .15s, color .15s, transform .12s, box-shadow .15s, border-color .15s;
  flex-shrink: 0;
  user-select: none;
}
.nav-arrow:hover {
  background: linear-gradient(180deg, #ff5a78 0%, #ff3b5c 100%);
  color: #fff;
  border-color: #ff3b5c;
  box-shadow: 0 10px 22px rgba(255, 59, 92, .28);
}
.nav-arrow:active { transform: scale(.94); }
.cal-title-wrap {
  min-width: 0;
  text-align: center;
}
.cal-head h2 {
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  letter-spacing: -0.02em;
  transition: opacity .2s, transform .35s ease;
}
.cal-head p { color: var(--muted); font-size: .88rem; }
.assistant-bar {
  margin: 0 0 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.assistant-bar form {
  display: flex;
  gap: 8px;
}
.assistant-bar input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
}
.assistant-hint {
  margin-top: 8px;
  font-size: .8rem;
  color: var(--muted);
}
.overdue-strip {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.overdue-item {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  background: #fff3f5;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: .9rem;
}
.overdue-item .when { color: var(--accent-dark); font-size: .78rem; }
.overdue-actions { display: flex; gap: 6px; flex-shrink: 0; }
.overdue-actions button {
  border: 0;
  background: #fff;
  color: var(--today);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
}
.unsorted-board {
  margin: 6px 0 14px;
  background: rgba(255,255,255,.72);
  border: 2px dashed #ffb4c8;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 8px 22px rgba(255, 59, 92, .08);
}
.unsorted-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.unsorted-head h3 {
  font-size: 1rem;
  letter-spacing: -0.02em;
}
.unsorted-head p {
  color: var(--muted);
  font-size: .8rem;
  margin-top: 2px;
}
.unsorted-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.unsorted-cols {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  min-height: 168px;
  align-items: stretch;
}
.unsorted-cols::-webkit-scrollbar { height: 6px; }
.unsorted-cols::-webkit-scrollbar-thumb { background: #ffc4d6; border-radius: 999px; }
.cat-col {
  flex: 0 0 280px;
  min-width: 260px;
  background: rgba(255,255,255,.55);
  border: 1px solid #ffd9e5;
  border-radius: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cat-col.drop-target {
  background: rgba(255, 59, 92, .08);
  box-shadow: inset 0 0 0 2px rgba(255, 59, 92, .22);
}
.cat-col-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
}
.cat-col-head h4 {
  margin: 0;
  font-size: .86rem;
  letter-spacing: -0.02em;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.cat-col-head h4 span {
  color: var(--muted);
  font-weight: 600;
  font-size: .78rem;
}
.cat-col-head .icon-btn {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}
.cat-col-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 92px;
  flex: 1;
}
.unsorted-empty {
  width: 100%;
  min-height: 58px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: .84rem;
  border: 1px dashed #ffd2df;
  border-radius: 14px;
  background: rgba(255,255,255,.6);
  cursor: pointer;
}
.steps-board {
  margin: 0 0 14px;
  background: rgba(255,255,255,.72);
  border: 2px solid #c9d8ff;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 8px 22px rgba(79, 124, 255, .08);
}
.steps-today-pill {
  background: #eef3ff;
  color: #2a4fd4;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .84rem;
  font-weight: 700;
}
.steps-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.steps-cell {
  min-height: 54px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e4ebff;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.steps-cell.empty { background: transparent; border-color: transparent; }
.steps-cell .n {
  font-size: .78rem;
  font-weight: 700;
}
.steps-cell .c {
  font-variant-numeric: tabular-nums;
  font-size: .72rem;
  color: var(--muted);
  font-weight: 700;
}
.steps-cell.has {
  background: #eef3ff;
  border-color: #c9d8ff;
}
.steps-cell.good {
  background: #4f7cff;
  border-color: #4f7cff;
  color: #fff;
}
.steps-cell.good .c { color: rgba(255,255,255,.88); }
.steps-cell.today {
  box-shadow: inset 0 0 0 2px #ff3b5c;
}
.backlog-task {
  min-width: 0;
  max-width: none;
  width: 100%;
  background: #fff;
  border: 2px solid #ffd9e5;
  border-left: 5px solid #ffb4c8;
  border-radius: 10px;
  padding: 2px 6px;
  display: flex;
  gap: 3px;
  align-items: center;
  box-shadow: 0 6px 16px rgba(255, 59, 92, .08);
  position: relative;
}
.backlog-task.colored {
  border-left-color: var(--task-color);
  background: color-mix(in srgb, var(--task-color) 34%, #fff);
  border-color: color-mix(in srgb, var(--task-color) 58%, #fff);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--task-color) 22%, transparent);
}
.backlog-task .txt,
.backlog-task .meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
}
.backlog-task .txt {
  font-size: .74rem;
}
.backlog-task .meta {
  display: none;
}
.cal-stage {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.cal-stage .grid {
  width: 100%;
  height: 100%;
  transition: transform .38s cubic-bezier(.22,.7,.25,1), opacity .28s ease;
  will-change: transform, opacity;
}
.cal-stage.slide-left .grid {
  animation: pageLeft .38s cubic-bezier(.22,.7,.25,1);
}
.cal-stage.slide-right .grid {
  animation: pageRight .38s cubic-bezier(.22,.7,.25,1);
}
@keyframes pageLeft {
  from { transform: translateX(28%) scale(.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes pageRight {
  from { transform: translateX(-28%) scale(.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.weekdays span {
  text-align: center;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 0;
}

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(160px, 1fr);
  gap: 8px;
  min-height: 0;
}
.cal-stage .grid { flex: none; }

.day {
  background: #ffffff;
  border: 2px solid #ffe0ea;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 160px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(255, 100, 140, .08);
  transition: border-color .15s, box-shadow .15s, background .2s, transform .12s;
  position: relative;
  cursor: pointer;
}
.day.empty { background: transparent; border-color: transparent; box-shadow: none; cursor: default; }
.day.today {
  border-color: var(--today);
  box-shadow: 0 0 0 3px rgba(79,124,255,.22), 0 10px 24px rgba(79,124,255,.18);
}
.day.selected {
  box-shadow: 0 0 0 3px rgba(255,59,92,.25), 0 12px 28px rgba(255,59,92,.16);
}
.day.has-color {
  border-width: 2px;
  background: color-mix(in srgb, var(--day-color) 42%, #ffffff);
  border-color: color-mix(in srgb, var(--day-color) 80%, #333);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--day-color) 28%, transparent);
}
.day.has-color.today,
.day.has-color.selected {
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--day-color) 35%, transparent),
    0 10px 26px color-mix(in srgb, var(--day-color) 30%, transparent);
}
.day:not(.empty):hover { transform: translateY(-1px); }
.day-tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .28;
  border-radius: inherit;
  background: var(--day-color, transparent);
}
.day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 6px 5px 2px;
  flex-shrink: 0;
  gap: 4px;
  position: relative;
  z-index: 1;
}
.day-left {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
}
.day-num {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 7px;
  font-weight: 700;
  font-size: .78rem;
  background: rgba(255,255,255,.7);
  flex-shrink: 0;
}
.day.today .day-num { background: var(--today); color: #fff; }
.day-title {
  font-size: .62rem;
  font-weight: 650;
  line-height: 1.2;
  color: var(--ink);
  word-break: break-word;
  max-height: 2.4em;
  overflow: hidden;
  cursor: pointer;
  min-width: 0;
  flex: 1;
}
.day-title:hover { color: var(--accent-dark); }
.day-title.empty-title {
  color: var(--muted);
  font-weight: 500;
  font-style: italic;
  opacity: .65;
}
.day-tools { display: flex; gap: 2px; align-items: center; flex-shrink: 0; }
.btn-add, .btn-day-edit, .btn-day-archive {
  width: 22px; height: 22px;
  border: none; border-radius: 7px;
  cursor: pointer;
  font-weight: 700;
  display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.btn-day-archive {
  background: rgba(255,255,255,.78);
  color: #7a5a00;
  font-size: .72rem;
}
.btn-day-archive:hover { background: #fff7ae; color: #7a3e00; }
.btn-add { background: #fff3a0; color: #a16207; font-size: .9rem; }
.btn-add:hover { background: #ffd400; color: #713f12; }
.btn-day-edit { background: rgba(255,255,255,.75); color: var(--muted); font-size: .72rem; }
.btn-day-edit:hover { background: #fff; color: var(--ink); }
.btn-day-edit .swatch {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,.12);
  background: conic-gradient(#ff3b5c, #ffd400, #2ecc71, #00c2ff, #a855f7, #ff3b5c);
}
.btn-day-edit.has-color .swatch { background: var(--sw); border-color: rgba(0,0,0,.2); }

.tasks {
  flex: 1;
  overflow-y: auto;
  padding: 0 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
  scrollbar-color: #c5d4e0 transparent;
  position: relative;
  z-index: 1;
}
.tasks::-webkit-scrollbar { width: 4px; }
.tasks::-webkit-scrollbar-thumb { background: #c5d4e0; border-radius: 99px; }

.task {
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 7px;
  padding: 3px 22px 3px 6px;
  display: flex;
  gap: 3px;
  align-items: center;
  animation: fadeUp .2s ease;
  border-left: 3px solid #c5d4e0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  min-height: 0;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease, background .15s ease, border-color .15s ease, filter .15s ease;
  position: relative;
}
.task:active { cursor: grabbing; }
.task:hover {
  background: #fff7ae;
  border-color: #ffd400;
  box-shadow: 0 0 0 2px rgba(255, 212, 0, .35), 0 4px 12px rgba(255, 138, 0, .18);
  transform: translateY(-1px);
  z-index: 2;
  filter: brightness(1.03);
}
.task.colored:hover {
  background: color-mix(in srgb, var(--task-color) 38%, #fff7ae);
  border-color: var(--task-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--task-color) 35%, transparent), 0 4px 12px color-mix(in srgb, var(--task-color) 28%, transparent);
}
.task.dragging {
  opacity: .35;
  transform: scale(.96);
}
.task.drop-before::before,
.backlog-task.drop-before::before {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  top: -3px;
  height: 3px;
  border-radius: 99px;
  background: #ff3b5c;
  box-shadow: 0 0 0 2px rgba(255,59,92,.2);
  z-index: 5;
}
.task.drop-after::after,
.backlog-task.drop-after::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: -3px;
  height: 3px;
  border-radius: 99px;
  background: #ff3b5c;
  box-shadow: 0 0 0 2px rgba(255,59,92,.2);
  z-index: 5;
}
.task.drop-in {
  animation: dropIn .38s cubic-bezier(.22,.7,.25,1);
}
@keyframes dropIn {
  0% { transform: translateY(-10px) scale(.92); opacity: 0; }
  60% { transform: translateY(2px) scale(1.03); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
.task.colored {
  background: color-mix(in srgb, var(--task-color) 42%, #fff);
  border-color: color-mix(in srgb, var(--task-color) 65%, #fff);
  border-left-color: var(--task-color);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--task-color) 28%, transparent);
}
.day.drop-target {
  outline: 3px solid #ff3b5c;
  outline-offset: -2px;
  transform: scale(1.02);
  z-index: 5;
  box-shadow: 0 0 0 4px rgba(255, 59, 92, .2), 0 14px 30px rgba(255, 59, 92, .22) !important;
}
.day.drop-target .tasks {
  background: rgba(255, 59, 92, .08);
  border-radius: 10px;
}
.drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  width: 160px;
  max-width: 40vw;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 2px solid #ff3b5c;
  border-left: 5px solid var(--task-color, #ff3b5c);
  box-shadow: 0 16px 40px rgba(255, 59, 92, .28);
  font-size: .85rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink);
  transform: translate(-20%, -50%) rotate(-3deg) scale(1.05);
  opacity: .95;
  transition: transform .12s ease;
  word-break: break-word;
}
.drag-ghost.dropping {
  transition: transform .28s cubic-bezier(.22,.7,.25,1), opacity .28s ease;
  opacity: 0;
  transform: translate(-20%, -50%) scale(.6);
}
body.is-dragging {
  cursor: grabbing !important;
}
body.is-dragging .day {
  transition: transform .15s ease, box-shadow .15s ease, outline .15s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.task-text {
  flex: 1;
  font-size: .65rem;
  line-height: 1.25;
  word-break: break-word;
  cursor: grab;
  color: var(--ink);
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.task:hover .task-text {
  color: #7a3e00;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.task-actions {
  display: flex;
  gap: 0;
  flex-shrink: 0;
  align-items: center;
  opacity: 0;
  width: auto;
  overflow: hidden;
  transition: opacity .15s ease, width .15s ease;
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.85);
  border-radius: 6px;
}
.task:hover .task-actions,
.task:focus-within .task-actions {
  opacity: 1;
  overflow: visible;
}
.side-task .task-actions {
  opacity: 1;
  width: auto;
  overflow: visible;
  gap: 2px;
  position: static;
  transform: none;
  background: transparent;
}
.icon-btn {
  width: 18px; height: 18px;
  border: none; border-radius: 5px;
  background: transparent; cursor: pointer;
  color: var(--muted); display: grid; place-items: center; font-size: .68rem;
}
.icon-btn:hover { background: #fff; color: var(--ink); }
.icon-btn.del:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn .mini {
  width: 8px; height: 8px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
  background: conic-gradient(#ff3b5c, #ffd400, #2ecc71, #00c2ff, #a855f7, #ff3b5c);
}
.icon-btn.has-color .mini { background: var(--sw); }

/* Category chips (in day modal) */
.cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #f7fafc;
  border-radius: 999px;
  padding: 5px 10px 5px 7px;
  font-size: .78rem;
  color: var(--ink);
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.cat:hover { background: #eef5f9; }
.cat.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px rgba(42,157,143,.12);
  font-weight: 650;
}
.cat .dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.1);
  flex-shrink: 0;
}
.cat .dot.all {
  background: linear-gradient(135deg, #ff3b5c, #ffd400 35%, #2ecc71 65%, #4f7cff);
}
.cat .count {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--muted);
  min-width: 1.2ch;
}
.cat.active .count { color: var(--accent-dark); }

.side-empty {
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
  padding: 28px 10px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(247,250,252,.7);
}
.side-task {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 10px 10px 12px;
  border-left: 4px solid #c5d4e0;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  box-shadow: 0 2px 8px rgba(28,42,58,.04);
}
.side-task.colored {
  border-left-color: var(--task-color);
  background: color-mix(in srgb, var(--task-color) 34%, #fff);
  border-color: color-mix(in srgb, var(--task-color) 58%, #fff);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--task-color) 20%, transparent);
}
.side-task .txt {
  flex: 1;
  font-size: .9rem;
  line-height: 1.4;
  word-break: break-word;
  cursor: pointer;
}
.side-task .txt:hover { color: var(--accent-dark); }
.side-task .meta {
  font-size: .72rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Modals */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(28, 42, 58, .35);
  backdrop-filter: blur(3px);
  display: none;
  place-items: center;
  z-index: 200;
  padding: 20px;
}
.modal-bg.show { display: grid; }
#dayModalBg { z-index: 200; }
#modalBg { z-index: 300; }
.modal {
  width: min(440px, 100%);
  background: var(--surface);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(28,42,58,.2);
  border: 1px solid var(--line);
  max-height: min(90vh, 820px);
  overflow: auto;
}
.modal.wide { width: min(560px, 100%); }
.modal h3 { font-size: 1.1rem; margin-bottom: 6px; }
.modal .sub { color: var(--muted); font-size: .88rem; margin-bottom: 14px; }
.modal textarea, .modal input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  outline: none;
  background: #f7fafc;
}
.modal textarea { min-height: 100px; resize: vertical; }
.modal textarea:focus, .modal input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #fff;
}
.color-label, .input-label {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin: 14px 0 8px;
}
.input-label:first-of-type { margin-top: 0; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; }
.pal-btn {
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  background: #eef3f8;
  transition: transform .12s, border-color .15s, box-shadow .15s;
}
.pal-btn:hover { transform: scale(1.08); }
.pal-btn.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(28,42,58,.12);
}
.pal-btn.none::after {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 2px;
  background: linear-gradient(135deg, transparent 44%, #c45c4a 46%, #c45c4a 54%, transparent 56%);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.btn-save { background: var(--accent); color: #fff; padding: 10px 16px; }
.btn-save:hover { background: var(--accent-dark); }

.day-modal-cats { margin-bottom: 12px; }
.day-modal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 2px;
}
.archive-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.archive-tab {
  border: 1px solid var(--line);
  background: #f7fafc;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .82rem;
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
}
.archive-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
  box-shadow: 0 0 0 2px rgba(255, 59, 92, .12);
}
.archive-tab .n {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  margin-left: 4px;
}
.task-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}
.side-task .task-check { width: 18px; height: 18px; margin-top: 2px; }
.task.done, .side-task.done {
  opacity: .72;
}
.task.done .task-text,
.side-task.done .txt {
  text-decoration: line-through;
  color: var(--muted);
}
.side-task.done {
  background: #f3f5f8;
}
.task.archived, .side-task.archived {
  opacity: .78;
}
.side-task.archived {
  background: #f6f1e8;
}
.icon-btn.archive {
  color: #8e6b3d;
}
.btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 16px;
}
.btn-accent:hover { background: var(--accent-dark); }

.brand-mark { margin-bottom: 12px; }
.brand-mark img { border-radius: 12px; display: block; }
.login-card .btn-ghost { width: 100%; margin-top: 8px; }
.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin: 12px 0;
}
.time-row input, .time-row select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f7fafc;
}
.task-time {
  font-size: .78em;
  font-weight: 700;
  color: var(--accent);
  margin-right: 4px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141c;
    --surface: #1c2030;
    --ink: #f2f4fb;
    --muted: #9aa3bf;
    --line: #343b54;
  }
  body {
    background: radial-gradient(900px 420px at 0% 0%, rgba(255,59,92,.16), transparent 50%),
                #101218;
    color: var(--ink);
  }
  .login-card, .topbar, .day, .modal, .unsorted-board, .clock-box, .steps-board {
    background: rgba(28, 32, 48, .88);
    color: var(--ink);
  }
  .clock-split { background: #343b54; }
  .steps-cell { background: rgba(22, 25, 36, .7); border-color: #343b54; }
  .steps-cell.has { background: rgba(79, 124, 255, .22); border-color: #4f7cff; }
  .steps-today-pill { background: rgba(79, 124, 255, .18); color: #c9d8ff; }
  .cat-col {
    background: rgba(22, 25, 36, .7);
    border-color: #343b54;
  }
  .unsorted-empty {
    background: rgba(22, 25, 36, .55);
    border-color: #343b54;
  }
  .field input, .time-row input, .time-row select, textarea {
    background: #161924;
    color: var(--ink);
    border-color: #343b54;
  }
}

@media (max-width: 1100px) {
  .grid { grid-auto-rows: minmax(150px, auto); }
  .main { padding: 12px; }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; padding: 12px; }
  .clock-box { order: 3; width: 100%; justify-content: center; }
  .cal-head { flex-wrap: wrap; }
  .nav-arrow { width: 42px; height: 42px; }
}
