:root {
  --bg: #17212b;
  --card: #1f2c38;
  --text: #e9edf2;
  --muted: #a1afbd;
  --accent: #2aabee;   /* Telegram blue */
  --accent-2: #229ed9;
  --border: #223446;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  scrollbar-width: none;
  overflow: -moz-scrollbars-none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.page-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(34, 52, 70, 0.6), rgba(23, 33, 43, 0.95));
  z-index: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 16px 24px;
  background: rgba(27, 40, 52, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  justify-content: flex-start;
  gap: 14px;
}
.nav a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 12px;
  transition: background 120ms ease, transform 120ms ease;
}
.nav a:hover {
  background: rgba(42, 171, 238, 0.12);
  transform: translateY(-1px);
}

.user {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.tag {
  background: rgba(42, 171, 238, 0.12);
  color: #d6efff;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
}

main.card {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 32px auto;
  background: var(--card);
  padding: 32px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

h1 { margin: 0 0 10px; }
.muted { color: var(--muted); margin: 0 0 18px; }
.empty-gap { margin-top: 12px; }

form.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

input[type="text"], input[type="number"] {
  flex: 1 1 260px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #243447;
  font-size: 15px;
  background: #0f1a24;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.compact-input {
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding: 10px 12px;
  flex: 1 1 200px;
}

button {
  background: linear-gradient(135deg, #2f4d6d, #26425f);
  color: #e9edf2;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
  box-shadow: 0 8px 18px rgba(38, 66, 95, 0.35);
}
button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.items {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  display: grid;
  gap: 10px;
}
.items li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 12px 14px;
  background: #1a2532;
  border: 1px solid rgba(56, 189, 248, 0.16);
  border-radius: 12px;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 6px;
}
.dot-goal { background: var(--accent); }
.dot-value { background: var(--accent-2); }
.item-body { display: flex; flex-direction: column; gap: 4px; }
.item-text {
  font-weight: 600;
  word-break: break-word;
}
.item-meta {
  color: var(--muted);
  font-size: 13px;
  word-break: break-word;
}
.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(47, 77, 109, 0.4);
  box-shadow: none;
}
button.ghost:hover {
  transform: none;
  background: rgba(47, 77, 109, 0.14);
}

.icon-btn {
  padding: 8px 10px;
  width: 42px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 16px;
  border-radius: 10px;
  box-shadow: none;
}
.icon-btn.danger {
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.3);
  box-shadow: none;
}
.edit-form {
  display: none;
  position: absolute;
  inset: 10px 10px auto 10px;
  padding: 12px;
  background: rgba(23, 33, 43, 0.98);
  border: 1px solid rgba(42, 171, 238, 0.25);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  z-index: 5;
}
.item-body { position: relative; }
.edit-form.open { display: block; }
.edit-form .inline-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.edit-form .inline-form input {
  min-width: 100%;
  width: 100%;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(56, 189, 248, 0.12);
  border-radius: 12px;
  color: var(--text);
}

/* Login */
.login-body {
  display: grid;
  place-items: center;
}
.login-card {
  position: relative;
  z-index: 1;
  width: min(440px, 90vw);
  background: var(--card);
  padding: 30px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.alert {
  background: #3f1d2e;
  color: #fda4af;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

@media (max-width: 720px) {
  .site-header {
    grid-template-columns: 1fr;
    gap: 8px;
    text-align: center;
  }
  .nav { justify-content: center; }
  main.card { margin: 20px; padding: 24px; }
  form.stack { flex-direction: column; }
  button { width: 100%; text-align: center; }
}
