:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #0e1116;
  --muted: #5b6370;
  --soft: #eef0f5;
  --line: #e3e6ee;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(247, 248, 251, 0.85);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.brand {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.brand .dot { color: var(--accent); }

.nav nav { display: flex; align-items: center; gap: 22px; }
.nav nav a, .nav nav button {
  color: var(--muted);
  font-size: 14px;
  transition: color .15s;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.nav nav a:hover, .nav nav button:hover { color: var(--ink); }
.nav nav .nav-cta {
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
}
.nav nav .nav-cta:hover { background: var(--accent); color: #fff; }
.inline-form { display: inline; margin: 0; }
.link-btn { color: var(--muted); }

main { max-width: 980px; margin: 0 auto; padding: 0 24px; }

.hero { padding: 96px 0 56px; text-align: center; }
.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 16px;
  font-weight: 600;
}
.hero h1 {
  font-size: clamp(40px, 7vw, 68px);
  margin: 0 0 16px;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.lede {
  color: var(--muted);
  font-size: 18px;
  max-width: 600px;
  margin: 0 auto 32px;
}
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .08s, background .2s, border-color .2s, color .2s;
  text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: #0f172a; color: #fff; }
.btn.primary:hover { background: #1e293b; }
.btn.ghost {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.full { width: 100%; padding: 12px 22px; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  padding: 40px 0;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card .links { margin: 0; padding-left: 18px; }
.card .links li { color: var(--muted); font-size: 14px; margin: 4px 0; }
.card .links a { color: var(--accent); }
.card .links a:hover { text-decoration: underline; }

.demo {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  margin: 32px 0 64px;
  text-align: center;
  box-shadow: var(--shadow);
}
.demo h2 { margin-top: 0; }
.demo p { color: var(--muted); }
.demo code {
  background: var(--soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}
#ping-out {
  margin: 20px auto 0;
  max-width: 560px;
  text-align: left;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  color: #1e293b;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  min-height: 56px;
}

/* Auth */
.auth {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 0;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.auth-card h1 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: -0.02em;
}
.auth-sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.auth-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 14px 0 6px;
}
.auth-card input[type="text"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 15px;
  background: var(--panel);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.auth-card .btn { margin-top: 22px; }
.auth-foot {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 8px;
}
.alert.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f5c6c2;
}

/* Dashboard */
.dash { padding: 64px 0; }
.dash h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 5vw, 48px);
  letter-spacing: -0.025em;
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 32px 0;
}
.signout { margin-top: 16px; }

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform .12s, box-shadow .2s, border-color .2s;
}
.card-link:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.06), 0 16px 32px rgba(79, 70, 229, 0.10);
}
.metric {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 8px 0 4px;
  color: var(--ink);
}
.metric.negative { color: var(--danger); }
.muted { color: var(--muted); font-size: 13px; margin: 0; }

/* Page header (money / tasks) */
.page { padding: 40px 0 64px; }
.page-head { margin-bottom: 24px; }
.page-head h1 {
  margin: 8px 0 0;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.025em;
}
.back {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.back:hover { color: var(--accent); }

/* Stats row */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.stat-value.positive { color: #047857; }
.stat-value.negative { color: var(--danger); }

/* Inline row form (add transaction / add task) */
.row-form {
  display: flex;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.row-form input[type="text"],
.row-form input[type="number"],
.row-form select {
  flex: 1 1 140px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: var(--panel);
  color: var(--ink);
}
.row-form input:focus, .row-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.row-form .btn { flex: 0 0 auto; }

/* Transaction list */
.tx-list { list-style: none; padding: 0; margin: 0; }
.tx {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.tx-main { flex: 1; min-width: 0; }
.tx-desc { font-weight: 500; }
.tx-date { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tx-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tx.in .tx-amount { color: #047857; }
.tx.out .tx-amount { color: var(--danger); }
.empty {
  background: transparent;
  border: 1px dashed var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 22px;
  border-radius: 10px;
  list-style: none;
}

/* Buttons */
.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { color: var(--danger); border-color: var(--danger); }
.mini-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}
.mini-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Task board */
.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 760px) {
  .board { grid-template-columns: 1fr; }
}
.col {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  min-height: 200px;
}
.col h3 {
  margin: 0 0 12px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.col h3 .count {
  background: var(--panel);
  color: var(--ink);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  letter-spacing: 0;
}
.task {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-title { font-size: 14px; margin-bottom: 8px; word-break: break-word; }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-col {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 16px 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
}

/* Projects list */
.project-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.project-form h3 { margin: 0 0 14px; font-size: 17px; }
.project-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 760px) {
  .project-form-grid { grid-template-columns: 1fr; }
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field input[type="text"],
.field input[type="file"] {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  background: var(--panel);
  color: var(--ink);
}
.field input[type="text"]:focus,
.field input[type="file"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input[type="file"] {
  padding: 8px 12px;
  cursor: pointer;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}
.project-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .2s, border-color .2s;
  text-decoration: none;
  color: inherit;
}
.project-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.06), 0 16px 32px rgba(79, 70, 229, 0.14);
}
.project-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.project-tile-fallback {
  font-size: clamp(48px, 9vw, 88px);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-soft), #ffffff);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
}
.project-actions .icon-btn,
.project-actions .inline-form .icon-btn {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  text-decoration: none;
}
.icon-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.current-image {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}
.current-image img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--soft);
}
.clear-toggle {
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.hint {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* Settings page */
.settings-list { display: flex; flex-direction: column; gap: 12px; }
.settings-page {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.settings-page summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.settings-page summary::-webkit-details-marker { display: none; }
.settings-page summary::after {
  content: "+";
  font-size: 22px;
  color: var(--muted);
  margin-left: 12px;
  transition: transform .15s;
}
.settings-page[open] summary::after { content: "−"; }
.settings-name { font-weight: 700; font-size: 15px; }
.settings-swatches { display: inline-flex; gap: 4px; margin-left: auto; margin-right: 8px; }
.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: inline-block;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 0 20px 20px;
}
.color-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.color-item input[type="color"] {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
}
.color-item .color-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
}
.color-item code {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  font-family: ui-monospace, monospace;
}

footer {
  border-top: 1px solid var(--line);
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
