/* === Minimal monochrome aesthetic === */
:root {
  /* Surfaces — pure neutrals */
  --bg: oklch(0.985 0 0);
  --bg-deep: oklch(0.95 0 0);
  --panel: oklch(1 0 0);
  --panel-edge: oklch(0.9 0 0);
  --panel-edge-soft: oklch(0.94 0 0);
  --task: oklch(1 0 0);
  --task-hover: oklch(0.975 0 0);

  /* Ink — neutral greys */
  --ink: oklch(0.18 0 0);
  --ink-2: oklch(0.4 0 0);
  --ink-3: oklch(0.6 0 0);
  --ink-4: oklch(0.78 0 0);

  /* Accent — neutral black, used sparingly */
  --accent: oklch(0.18 0 0);
  --accent-soft: oklch(0.92 0 0);
  --accent-blue: oklch(0.6 0.16 245);

  /* Urgency colors (gradient: green → yellow → orange → red) */
  --u-safe-bg: oklch(0.92 0.04 150);
  --u-safe-fg: oklch(0.38 0.06 150);
  --u-safe-bd: oklch(0.82 0.05 150);

  --u-soon-bg: oklch(0.94 0.07 95);
  --u-soon-fg: oklch(0.42 0.08 80);
  --u-soon-bd: oklch(0.85 0.08 92);

  --u-urgent-bg: oklch(0.91 0.09 55);
  --u-urgent-fg: oklch(0.45 0.13 45);
  --u-urgent-bd: oklch(0.8 0.11 55);

  --u-over-bg: oklch(0.88 0.1 28);
  --u-over-fg: oklch(0.42 0.16 25);
  --u-over-bd: oklch(0.78 0.13 28);

  --u-none-bg: oklch(0.94 0.005 75);
  --u-none-fg: oklch(0.55 0.012 65);
  --u-none-bd: oklch(0.88 0.012 75);

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;

  --shadow-soft: 0 1px 0 oklch(1 0 0 / 0.6) inset, 0 1px 2px oklch(0.2 0.02 60 / 0.04);
  --shadow-panel: 0 1px 0 oklch(1 0 0 / 0.7) inset, 0 1px 1px oklch(0.2 0.02 60 / 0.03), 0 6px 24px -12px oklch(0.2 0.02 60 / 0.15);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Helvetica Neue", system-ui, sans-serif;
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  min-height: 100vh;
}

/* === App shell === */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

.app-header {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 28px 36px 18px 36px;
  gap: 24px;
}

.app-title {
  font-family: "Instrument Serif", "Cormorant Garamond", Georgia, serif;
  font-weight: 400;
  font-size: 36px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.app-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  transform: translateY(-4px);
}

.app-meta {
  font-size: 12.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  text-align: right;
}
.app-meta .today {
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-2);
  display: block;
  letter-spacing: 0;
  margin-top: 2px;
}

/* === Board === */
.board {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(300px, 1fr));
  gap: 18px;
  padding: 14px 24px 18px 24px;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: stretch;
  min-height: 0;
}

@media (max-width: 1200px) {
  .board { grid-template-columns: repeat(4, minmax(280px, 320px)); }
}

/* === Panel === */
.panel {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--panel-edge-soft);
  border-radius: var(--radius-lg);
  box-shadow: none;
  min-height: 0;
  position: relative;
  transition: background 160ms ease, border-color 160ms ease;
}

.panel.drop-target {
  background: oklch(0.96 0 0);
  border-color: var(--ink);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 12px 18px;
  border-bottom: 0;
}

.panel-title {
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  margin: 0;
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  gap: 0;
}

.panel-title .swatch { display: none; }

.panel-count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-4);
  letter-spacing: 0;
  text-transform: none;
}

.panel-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px 8px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-4) transparent;
}
.panel-list::-webkit-scrollbar { width: 8px; }
.panel-list::-webkit-scrollbar-thumb {
  background: oklch(0.85 0.012 70);
  border-radius: 4px;
}

.panel-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--ink-4);
  font-size: 12.5px;
  font-style: italic;
}

/* === Add input at bottom === */
.add-row {
  flex: 0 0 auto;
  padding: 10px 12px 12px 12px;
  border-top: 1px solid var(--panel-edge-soft);
  display: flex;
  gap: 6px;
  align-items: center;
}

.add-row input[type="text"] {
  flex: 1 1 auto;
  background: transparent;
  border: 1px dashed transparent;
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 120ms, background 120ms;
}
.add-row input[type="text"]::placeholder {
  color: var(--ink-4);
}
.add-row input[type="text"]:hover { border-color: var(--panel-edge); }
.add-row input[type="text"]:focus {
  border-color: var(--ink);
  background: var(--panel);
  border-style: solid;
}

.add-row .add-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--panel-edge);
  background: var(--task);
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 140ms ease;
}
.add-row .add-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* === Task === */
.task {
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  padding: 6px 28px 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: grab;
  transition: background 120ms, box-shadow 120ms, transform 120ms;
  position: relative;
}

.task-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
  z-index: 2;
}
.task:hover .task-delete { opacity: 0.85; }
.task-delete:hover {
  opacity: 1;
  background: var(--bg-deep);
  color: var(--ink);
}
.task:hover {
  background: var(--task-hover);
}
.task:active { cursor: grabbing; }
.task.dragging {
  opacity: 0.4;
  transform: scale(0.98);
}
.task.done {
  background: transparent;
}

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

/* Custom checkbox — square rounded */
.check {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  border-radius: 4px;
  border: 1.2px solid var(--ink-4);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 140ms ease;
  padding: 0;
}
.check:hover { border-color: var(--ink-2); background: var(--bg); }
.check.checked {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}
.check.checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.task-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.task-text {
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  word-wrap: break-word;
  outline: none;
  border-radius: 3px;
  padding: 0 2px;
  margin: 0 -2px;
  cursor: text;
  transition: color 220ms ease, text-decoration-color 220ms ease;
  letter-spacing: -0.005em;
}
.task.done .task-text {
  color: var(--ink-4);
  text-decoration: line-through;
  text-decoration-color: var(--ink-4);
  text-decoration-thickness: 1px;
}
.task-text:focus {
  background: var(--bg);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.task-text[contenteditable="true"]:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-4);
}

/* Task meta row: date pill + sub count + actions */
.task-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.due-wrap {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.due-clear {
  width: 18px;
  height: 18px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 120ms ease;
}
.task:hover .due-clear { opacity: 0.7; }
.due-clear:hover { opacity: 1 !important; }

.due-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding: 2px 4px;
  border-radius: 5px;
  border: 0;
  background: transparent;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 120ms ease, opacity 120ms ease;
  position: relative;
}
.due-pill:hover { background: var(--bg-deep); }
.due-pill .num {
  font-weight: 500;
  letter-spacing: 0.02em;
}
.due-pill .lbl {
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  opacity: 0.85;
}
.due-pill .dotmark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}

/* Urgency: colored dot + colored numeral, label stays neutral grey */
.due-pill.u-safe   .dotmark { background: var(--u-safe-bd); }
.due-pill.u-safe   .num,
.due-pill.u-safe   .lbl     { color: var(--u-safe-fg); }
.due-pill.u-soon   .dotmark { background: var(--u-soon-bd); }
.due-pill.u-soon   .num,
.due-pill.u-soon   .lbl     { color: var(--u-soon-fg); }
.due-pill.u-urgent .dotmark { background: var(--u-urgent-bd); }
.due-pill.u-urgent .num,
.due-pill.u-urgent .lbl     { color: var(--u-urgent-fg); }
.due-pill.u-over   .dotmark { background: var(--u-over-bd); }
.due-pill.u-over   .num     { color: var(--u-over-fg); font-weight: 600; }
.due-pill.u-over   .lbl     { color: var(--u-over-fg); }
.due-pill.u-none   .dotmark {
  background: transparent;
  border: 1px dashed var(--ink-4);
  width: 6px;
  height: 6px;
  box-sizing: border-box;
}
.due-pill.u-none   .num     { color: var(--ink-4); font-style: italic; }
.due-pill.u-none   .lbl     { color: var(--ink-4); font-style: italic; }



.task.done .due-pill { opacity: 0.4; }

/* Hidden native date input — covers the whole pill so any click opens the calendar */
.due-input {
  position: absolute;
  inset: 0;
  display: block;
}
.due-input input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
}

.sub-toggle {
  font-size: 11px;
  color: var(--ink-3);
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 2px 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
}
.sub-toggle:hover { background: var(--bg-deep); color: var(--ink-2); }
.sub-toggle .chev {
  display: inline-block;
  transition: transform 180ms ease;
  font-size: 9px;
  line-height: 1;
}
.sub-toggle.open .chev { transform: rotate(90deg); }

.task-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 120ms ease;
}
.task:hover .task-actions { opacity: 1; }

.icon-btn {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  transition: all 120ms ease;
}
.icon-btn:hover { background: var(--bg-deep); color: var(--ink); }
.icon-btn.danger:hover { background: var(--bg-deep); color: var(--ink); }

/* Subitems */
.subitems {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 0 2px 24px;
  margin-top: 2px;
  border-top: 1px dashed var(--panel-edge-soft);
  padding-top: 6px;
}

.subitem {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 1px 0;
  position: relative;
}

.subitem .check {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  border-width: 1.1px;
  border-radius: 3px;
}
.subitem .check.checked::after {
  left: 3px;
  top: 0px;
  width: 3px;
  height: 6.5px;
  border-width: 0 1.3px 1.3px 0;
}

.sub-text {
  flex: 1 1 auto;
  font-size: 13.5px;
  color: var(--ink-2);
  outline: none;
  border-radius: 3px;
  padding: 0 2px;
  margin: 0 -2px;
  cursor: text;
  transition: color 200ms ease;
  word-wrap: break-word;
  min-width: 0;
  letter-spacing: -0.003em;
}
.subitem.done .sub-text {
  color: var(--ink-4);
  text-decoration: line-through;
  text-decoration-color: var(--ink-4);
}
.sub-text:focus {
  background: var(--bg);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.sub-text[contenteditable="true"]:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-4);
}

.subitem .icon-btn {
  width: 18px;
  height: 18px;
  font-size: 11px;
  opacity: 0;
}
.subitem:hover .icon-btn { opacity: 1; }

.add-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-3);
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 3px 4px;
  margin-top: 2px;
  border-radius: 4px;
  font-family: inherit;
}
.add-sub:hover { color: var(--accent); }
.add-sub .plus { font-size: 13px; line-height: 1; }

/* Drag state on task */
.task.over-top { box-shadow: 0 -2px 0 var(--accent); }
.task.over-bottom { box-shadow: 0 2px 0 var(--accent); }

/* Footer hint */
.app-footer {
  flex: 0 0 auto;
  padding: 0 36px 18px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 11.5px;
  color: var(--ink-4);
  letter-spacing: 0.02em;
}
.legend {
  display: flex;
  gap: 14px;
  align-items: center;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid;
}
.legend-swatch.u-safe { background: var(--u-safe-bg); border-color: var(--u-safe-bd); }
.legend-swatch.u-soon { background: var(--u-soon-bg); border-color: var(--u-soon-bd); }
.legend-swatch.u-urgent { background: var(--u-urgent-bg); border-color: var(--u-urgent-bd); }
.legend-swatch.u-over { background: var(--u-over-bg); border-color: var(--u-over-bd); }

kbd {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 10.5px;
  background: oklch(0.93 0.01 75);
  border: 1px solid var(--panel-edge);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--ink-2);
}

/* === Auth screen === */
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.auth-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 36px 44px;
  text-align: center;
  max-width: 360px;
}
.auth-title {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.auth-sub {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: -10px;
  margin-bottom: 8px;
}
.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 140ms ease;
}
.auth-btn:hover {
  border-color: var(--ink-3);
  background: var(--task-hover);
}
.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.auth-error {
  font-size: 12px;
  color: oklch(0.5 0.18 25);
  max-width: 260px;
}
.auth-loading {
  font-size: 13px;
  color: var(--ink-3);
}

/* Sign-out button (bottom-right corner, subtle) */
.signout-btn {
  position: fixed;
  bottom: 14px;
  right: 18px;
  font: inherit;
  font-size: 11.5px;
  color: var(--ink-4);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 120ms ease;
  z-index: 10;
}
.signout-btn:hover {
  color: var(--ink-2);
  background: var(--bg-deep);
}
