:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: rgba(20, 27, 48, 0.78);
  --panel-strong: #151d33;
  --line: rgba(148, 163, 184, 0.18);
  --text: #eef4ff;
  --muted: #91a0b8;
  --blue: #66e3ff;
  --violet: #a78bfa;
  --green: #55e6a5;
  --yellow: #ffd166;
  --red: #ff6b7a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 22px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(102, 227, 255, 0.18), transparent 32rem),
    radial-gradient(circle at 80% 10%, rgba(167, 139, 250, 0.2), transparent 36rem),
    linear-gradient(135deg, #070a12, var(--bg));
  color: var(--text);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1500px, calc(100% - 36px)); margin: 0 auto; padding: 32px 0; }
.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px);
  background: rgba(12, 18, 34, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.eyebrow { margin: 0 0 8px; color: var(--blue); text-transform: uppercase; font-size: 0.76rem; letter-spacing: 0.18em; font-weight: 800; }
h1 { margin: 0; font-size: clamp(2.2rem, 5vw, 4.8rem); line-height: 0.94; letter-spacing: -0.07em; }
.subtle { color: var(--muted); margin: 10px 0 0; max-width: 680px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.primary, .secondary, .ghost {
  border: 0;
  border-radius: 999px;
  padding: 12px 17px;
  font-weight: 800;
  color: var(--text);
}
.primary { background: linear-gradient(135deg, var(--blue), var(--violet)); color: #06101c; box-shadow: 0 12px 32px rgba(102, 227, 255, 0.24); }
.secondary { background: rgba(255,255,255,0.07); border: 1px solid var(--line); }
.ghost { background: transparent; border: 1px solid var(--line); }
.danger { color: var(--red); }
.view-switcher {
  margin: 18px 0 0;
}
.view-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 18, 34, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 32px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
}
.tab {
  position: relative;
  border: 0;
  border-radius: 999px;
  padding: 11px 20px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}
.tab:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 227, 255, 0.22);
}
.tab.active {
  color: #06101c;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 10px 28px rgba(102, 227, 255, 0.28);
}
.tab.active:hover {
  transform: translateY(-1px);
}
.hidden { display: none !important; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px);
  background: rgba(12, 18, 34, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.auth-card h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.05em;
}
.auth-submit {
  width: 100%;
  margin-top: 8px;
}
.auth-error {
  margin: 0;
  color: var(--red);
  font-size: 0.92rem;
  font-weight: 700;
}
.field-hint {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--muted);
}
.auth-switch {
  margin: 18px 0 0;
  color: var(--muted);
  text-align: center;
}
.link-button {
  border: 0;
  background: none;
  color: var(--blue);
  font-weight: 800;
  padding: 0 4px;
}
.link-button:hover {
  text-decoration: underline;
}
.user-badge {
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 800;
  background: rgba(102, 227, 255, 0.08);
}

.view-content {
  margin-top: 18px;
}
.view-panel {
  animation: view-fade-in 0.2s ease;
}
.view-panel[hidden] {
  display: none !important;
}
@keyframes view-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin: 0 0 18px; }
.stat { padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.stat span { display: block; font-size: 2rem; font-weight: 900; }
.stat small { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.board { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 16px; align-items: start; }
.column { min-height: 560px; background: rgba(16, 23, 42, .72); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,.22); }
.column header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.column h2 { margin: 0; font-size: 1rem; letter-spacing: -0.02em; }
.count { background: rgba(255,255,255,.08); padding: 4px 10px; border-radius: 999px; color: var(--muted); font-size: .82rem; }
.dropzone { min-height: 500px; padding: 14px; display: flex; flex-direction: column; gap: 12px; transition: background .2s ease; }
.dropzone.drag-over { background: rgba(102, 227, 255, 0.08); }
.card { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035)); box-shadow: 0 14px 34px rgba(0,0,0,.24); transition: transform .16s ease, border .16s ease, background .16s ease; }
.card:hover { transform: translateY(-2px); border-color: rgba(102, 227, 255, .42); }
.card.dragging { opacity: .48; transform: rotate(2deg) scale(.98); }
.card-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.card h3 { margin: 0; font-size: 1rem; letter-spacing: -.02em; }
.card p { color: var(--muted); margin: 8px 0 0; font-size: .92rem; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pill { border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 4px 8px; font-size: .75rem; font-weight: 800; }
.priority-high { color: var(--red); border-color: rgba(255,107,122,.38); }
.priority-medium { color: var(--yellow); border-color: rgba(255,209,102,.38); }
.priority-low { color: var(--green); border-color: rgba(85,230,165,.38); }
.empty { color: var(--muted); border: 1px dashed var(--line); border-radius: 18px; padding: 20px; text-align: center; }
.card-actions { display: flex; gap: 6px; }
.icon { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); }
dialog { width: min(560px, calc(100vw - 28px)); border: 1px solid var(--line); border-radius: 26px; background: #11182b; color: var(--text); box-shadow: var(--shadow); padding: 0; }
dialog::backdrop { background: rgba(2, 6, 23, .72); backdrop-filter: blur(6px); }
form { padding: 22px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.dialog-head h2 { margin: 0; }
label { display: grid; gap: 7px; margin: 13px 0; color: var(--muted); font-weight: 800; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.06); color: var(--text); padding: 12px; outline: none; }
select { background-color: #11182b; color: var(--text); }
select option { background-color: #11182b; color: var(--text); }
select option:checked, select option:hover { background-color: #263556; color: #ffffff; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(102,227,255,.12); }
textarea { resize: vertical; }
.grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; margin-top: 18px; }
.dialog-actions.right { display: flex; justify-content: flex-end; }
.check { display: flex; grid-template-columns: unset; align-items: center; gap: 10px; color: var(--text); }
.check input { width: auto; }
#toast { position: fixed; right: 22px; bottom: 22px; background: rgba(15,23,42,.94); border: 1px solid var(--line); color: var(--text); padding: 12px 16px; border-radius: 999px; opacity: 0; transform: translateY(12px); transition: .2s ease; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translateY(0); }

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.panel-head h2 { margin: 0 0 6px; }
.week-badge {
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--blue);
  font-size: .82rem;
  font-weight: 800;
  background: rgba(102, 227, 255, 0.08);
}
.todo-panel,
.recurring-panel {
  background: rgba(16, 23, 42, .72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
.todo-quick-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 16px;
}
.todo-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.todo-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
}
.todo-item.completed { opacity: .72; }
.todo-check {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}
.todo-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}
.todo-title { font-size: 1rem; }
.todo-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}
.todo-notes {
  margin: 10px 0 0 30px;
  color: var(--muted);
  font-size: .92rem;
}
.todo-done-section {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.todo-done-section summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.todo-done-section summary::-webkit-details-marker { display: none; }
.recurring-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.recurring-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035));
}
.recurring-card.disabled { opacity: .62; }
.recurring-card h3 { margin: 0; font-size: 1rem; }
.recurring-card p { color: var(--muted); margin: 8px 0 0; font-size: .92rem; }
.status-pill { color: var(--violet); border-color: rgba(167, 139, 250, .38); }

@media (max-width: 1100px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) {
  .shell { width: min(100% - 22px, 1500px); padding: 16px 0; }
  .hero { align-items: stretch; flex-direction: column; }
  .view-switcher { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .view-tabs { display: flex; width: max-content; max-width: 100%; }
  .tab { padding: 10px 14px; font-size: 0.86rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .board { grid-template-columns: 1fr; }
  .grid-two { grid-template-columns: 1fr; }
  .dialog-actions { grid-template-columns: 1fr; }
}
