:root {
  --bg: #0b0b12;
  --card: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f2f2f7;
  --muted: #8e8ea0;
  --accent: #8b5cf6;
  --accent2: #06b6d4;
  --warn: #f59e0b;
  --danger: #f43f5e;
}

* { box-sizing: border-box; margin: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(600px circle at 10% -10%, rgba(139, 92, 246, 0.25), transparent 60%),
    radial-gradient(500px circle at 100% 10%, rgba(6, 182, 212, 0.18), transparent 60%);
  background-attachment: fixed;
}

main { max-width: 640px; margin: 0 auto; padding: 40px 20px 60px; }

header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.04em; }
h1 span { color: var(--accent); }

button { font: inherit; cursor: pointer; border: none; color: inherit; background: none; }
.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  padding: 10px 18px; border-radius: 12px; font-weight: 600;
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.35);
  transition: transform 0.15s;
}
.primary:hover { transform: translateY(-1px); }
.ghost { padding: 10px 18px; border-radius: 12px; color: var(--muted); }
.ghost:hover { color: var(--text); }
.link { color: var(--muted); font-size: 0.85rem; cursor: pointer; }
.link:hover { color: var(--text); }

/* Stats */
.stats { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 24px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  padding: 16px 18px; backdrop-filter: blur(12px);
}
.stat small { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.stat strong { display: block; font-size: 1.5rem; margin-top: 6px; letter-spacing: -0.02em; }
.stat:first-child strong {
  background: linear-gradient(135deg, #c4b5fd, #67e8f9);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Filter chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 6px 14px; border-radius: 999px; font-size: 0.85rem;
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
}
.chip.active { color: var(--text); border-color: var(--accent); background: rgba(139, 92, 246, 0.15); }
.chip span { opacity: 0.6; margin-left: 6px; }

/* List */
#list { list-style: none; padding: 0; display: grid; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  padding: 14px 16px; cursor: pointer; transition: background 0.15s, transform 0.15s;
  animation: in 0.25s ease both;
}
.item:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

.logo {
  position: relative; width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; overflow: hidden;
  display: grid; place-items: center; font-weight: 700; font-size: 1.1rem;
  background: hsl(var(--h) 60% 45%);
}
.logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 6px; }

.info { flex: 1; min-width: 0; }
.info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info small, .due small { color: var(--muted); font-size: 0.8rem; }
.due { text-align: right; }
.due b { display: block; }
.due small.soon { color: var(--warn); }

.del {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  color: var(--muted); opacity: 0.5; transition: all 0.15s;
}
.item:hover .del { opacity: 1; }
.del:hover { color: var(--danger); background: rgba(244, 63, 94, 0.12); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
footer { text-align: center; margin-top: 36px; color: var(--muted); }

/* Dialog */
dialog {
  margin: auto; border: 1px solid var(--border); border-radius: 22px; padding: 24px;
  background: #15151f; color: var(--text); width: min(440px, calc(100% - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
dialog h2 { font-size: 1.2rem; margin-bottom: 18px; }
form { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
form label { display: grid; gap: 6px; font-size: 0.8rem; color: var(--muted); }
label em { font-style: normal; opacity: 0.6; }
input, select {
  font: inherit; color: var(--text); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; width: 100%;
  color-scheme: dark;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
