/* PULSE — clean baseline todo (product DNA, not KODER LIVE chrome) */

:root {
  --bg: #e8f1f0;
  --bg-2: #d7e8e5;
  --surface: #f7fbfa;
  --surface-2: #ffffff;
  --ink: #16332f;
  --muted: #5a736e;
  --line: #b9d0cb;
  --accent: #0f7a6c;
  --ok: #2f9e44;
  --danger: #c23b22;
  --tag-teal: #0f7a6c;
  --tag-green: #2f9e44;
  --tag-amber: #b45309;
  --tag-rose: #be123c;
  --tag-sky: #0369a1;
  --tag-slate: #475569;
  --font-display: "Fraunces", Georgia, serif;
  --font-ui: "Manrope", "Segoe UI", sans-serif;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(22, 51, 47, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 0% 0%, #c9ebe4 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 10%, #dce8f5 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

.top {
  margin-bottom: 26px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 0.95;
  color: var(--ink);
}

.tag {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  max-width: 420px;
}

.top-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.progress {
  text-align: right;
}

.progress__numbers {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.progress__bar {
  margin-top: 6px;
  width: 120px;
  height: 5px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  width: 0%;
  background: var(--ok);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress__label {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.ver {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(15, 122, 108, 0.1);
  border: 1px solid rgba(15, 122, 108, 0.25);
  padding: 6px 10px;
  border-radius: 999px;
}

.composer {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.composer input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  outline: none;
}

.composer input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 122, 108, 0.15);
}

.composer button[type="submit"] {
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 0 22px;
  border-radius: var(--radius);
  cursor: pointer;
}

.composer button[type="submit"]:hover {
  filter: brightness(1.06);
}

/* Search */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.search input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  padding: 12px 16px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 122, 108, 0.15);
}

.search input::placeholder {
  color: var(--muted);
}

.search__clear {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.search__clear:hover {
  color: var(--accent);
  background: rgba(15, 122, 108, 0.08);
}

.search__clear[hidden] {
  display: none;
}

.list--empty-msg {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.45);
}

.list--empty-msg[hidden] {
  display: none;
}

.list.is-searching:empty::after {
  display: none;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.suggest {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -4px 0 16px;
  padding: 12px 16px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.5);
}

.suggest[hidden] {
  display: none;
}

.suggest__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.suggest__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sug {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.sug:hover {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.meta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.ghost.is-on,
.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(15, 122, 108, 0.08);
}

.ghost--copy.is-copied {
  border-color: var(--ok);
  color: var(--ok);
  background: rgba(47, 158, 68, 0.1);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(22, 51, 47, 0.04);
}

.item.is-done .item__text {
  text-decoration: line-through;
  color: var(--muted);
}

.item__check {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.item.is-done .item__check {
  border-color: var(--ok);
  background: var(--ok);
  color: #fff;
}

.item__text {
  font-size: 15px;
  line-height: 1.35;
  word-break: break-word;
}

.item__del {
  border: 0;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.75;
}

.item__del:hover { opacity: 1; }

.list:empty::after {
  content: "Lista pusta — dodaj pierwsze zadanie.";
  display: block;
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.45);
}

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

.upgrades__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

#upgrade-log {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}

/* Tag picker in composer */
.tag-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tag-bar__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
  white-space: nowrap;
}

.tag-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  padding: 0;
  background: none;
}

.tag-dot:hover {
  transform: scale(1.18);
}

.tag-dot.is-active {
  border-color: var(--ink);
  transform: scale(1.18);
}

.tag-dot[data-color="teal"]   { background: var(--tag-teal); }
.tag-dot[data-color="green"]  { background: var(--tag-green); }
.tag-dot[data-color="amber"]  { background: var(--tag-amber); }
.tag-dot[data-color="rose"]   { background: var(--tag-rose); }
.tag-dot[data-color="sky"]    { background: var(--tag-sky); }
.tag-dot[data-color="slate"]  { background: var(--tag-slate); }

.tag-dot--none {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px dashed var(--line);
  cursor: pointer;
  transition: border-color 0.15s;
  padding: 0;
  background: transparent;
  position: relative;
}

.tag-dot--none:hover {
  border-color: var(--muted);
}

.tag-dot--none.is-active {
  border-color: var(--ink);
}

.tag-dot--none::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2px;
  background: var(--line);
  transform: translate(-50%, -50%) rotate(45deg);
}

/* Toast undo */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(22, 51, 47, 0.25);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast__msg {
  color: rgba(255, 255, 255, 0.7);
}

.toast__undo {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.toast__undo:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Apple Health panel */
.health {
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.health__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

.health__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.health__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(190, 18, 60, 0.1);
  color: var(--tag-rose);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.health__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.health__toggle {
  font-size: 13px;
  padding: 6px 14px;
}

.health__toggle.is-on {
  background: rgba(47, 158, 68, 0.08);
  border-color: var(--ok);
  color: var(--ok);
}

.health__panel {
  padding: 0 16px 16px;
}

.health__panel[hidden] {
  display: none;
}

.health__status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.health__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
  transition: background 0.3s;
}

.health__status.is-connected .health__dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(47, 158, 68, 0.2);
}

.health__status-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.health__status.is-connected .health__status-text {
  color: var(--ok);
}

.health__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.health__import-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.health__import-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.health__goal-btn {
  font-size: 12px;
}

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

.health__metrics[hidden] {
  display: none;
}

.health__metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.health__metric-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.health__metric-label {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.health__last-sync {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.health__last-sync[hidden] {
  display: none;
}

/* Chip on task card */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip[data-color="teal"]   { background: rgba(15,122,108,0.12); color: var(--tag-teal); }
.chip[data-color="green"]  { background: rgba(47,158,68,0.12);  color: var(--tag-green); }
.chip[data-color="amber"]  { background: rgba(180,83,9,0.12);   color: var(--tag-amber); }
.chip[data-color="rose"]   { background: rgba(190,18,60,0.12);  color: var(--tag-rose); }
.chip[data-color="sky"]    { background: rgba(3,105,161,0.12);  color: var(--tag-sky); }
.chip[data-color="slate"]  { background: rgba(71,85,105,0.12);  color: var(--tag-slate); }

.item {
  grid-template-columns: auto 1fr auto auto;
}

.item__chip-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

/* Inline tag changer on existing cards */
.item__tag-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px dashed var(--line);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s;
  flex-shrink: 0;
}

.item__tag-btn:hover {
  border-color: var(--accent);
}

.item__tag-btn.is-set {
  border-style: solid;
}

.item__tag-btn[data-color="teal"]   { background: var(--tag-teal); border-color: var(--tag-teal); }
.item__tag-btn[data-color="green"]  { background: var(--tag-green); border-color: var(--tag-green); }
.item__tag-btn[data-color="amber"]  { background: var(--tag-amber); border-color: var(--tag-amber); }
.item__tag-btn[data-color="rose"]   { background: var(--tag-rose); border-color: var(--tag-rose); }
.item__tag-btn[data-color="sky"]    { background: var(--tag-sky); border-color: var(--tag-sky); }
.item__tag-btn[data-color="slate"]  { background: var(--tag-slate); border-color: var(--tag-slate); }

.item__tag-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 10;
}

.item__tag-menu .tag-dot,
.item__tag-menu .tag-dot--none {
  width: 20px;
  height: 20px;
}

@media (max-width: 560px) {
  .brand { font-size: 42px; }
  .brand-row { flex-direction: column; align-items: flex-start; }
  .top-side { align-items: flex-start; }
  .composer { flex-direction: column; }
  .composer button[type="submit"] { padding: 14px; }
  .suggest { flex-direction: column; align-items: flex-start; gap: 8px; }
  .health__metrics { grid-template-columns: repeat(2, 1fr); }
}
