:root {
  --bg-0: #0a0a0f;
  --bg-1: #11121a;
  --bg-2: #181a26;
  --bg-3: #20232f;
  --line: #262939;
  --line-2: #2f3447;
  --text: #e9ecf5;
  --text-2: #9aa1b9;
  --text-3: #6b7191;
  --accent: #ffcf47;       /* IGG amber/gold */
  --accent-2: #ff8a2a;
  --accent-soft: #2a230f;
  --green: #34d399;
  --red: #f87171;
  --blue: #60a5fa;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; background: var(--bg-0); color: var(--text); font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
body {
  background:
    radial-gradient(1200px 600px at 100% -200px, rgba(255, 207, 71, 0.07), transparent 60%),
    radial-gradient(900px 500px at -100px 100%, rgba(255, 138, 42, 0.05), transparent 60%),
    var(--bg-0);
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; }
input, select, button { color: var(--text); }

/* Passcode gate */
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(8, 9, 14, 0.85); backdrop-filter: blur(8px); z-index: 50; }
.gate__card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; width: min(380px, 92vw); display: grid; gap: 14px; box-shadow: var(--shadow); }
.gate__title { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.gate__sub { margin: -4px 0 8px; color: var(--text-2); font-size: 14px; }
.gate__card input { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 15px; outline: none; transition: border-color 0.15s; }
.gate__card input:focus { border-color: var(--accent); }
.gate__card button { background: var(--accent); color: #1a1408; border: none; border-radius: 10px; padding: 12px 14px; font-weight: 600; font-size: 15px; transition: filter 0.15s; }
.gate__card button:hover { filter: brightness(1.08); }
.gate__err { color: var(--red); margin: 0; font-size: 13px; }

/* Layout */
main { max-width: 1080px; margin: 0 auto; padding: 28px 24px 80px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand__dot { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 16px rgba(255, 207, 71, 0.5); }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.topbar__meta { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }
.dot-sep { margin: 0 6px; opacity: 0.6; }

.topbar__right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.progress { display: flex; align-items: center; gap: 10px; }
.progress__count { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; color: var(--text-2); }
.progress__count #done-count { color: var(--accent); font-weight: 600; }
.progress__sep { margin: 0 2px; opacity: 0.5; }
.progress__bar { width: 120px; height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress__fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0%; transition: width 0.4s ease; }

select#who { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; outline: none; }
select#who:focus { border-color: var(--accent); }

.sync { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--text-2); }
.sync__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.sync[data-state="live"] .sync__dot { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s ease-in-out infinite; }
.sync[data-state="local"] .sync__dot { background: var(--blue); }
.sync[data-state="error"] .sync__dot { background: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Filters */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 18px 0; }
.chip { background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 13px; color: var(--text-2); transition: all 0.15s; }
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip--active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.filters__sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
#search { flex: 1; min-width: 160px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 13px; outline: none; }
#search:focus { border-color: var(--accent); }

/* Sections */
.sections { display: grid; gap: 24px; margin-top: 8px; }
.section { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.section__head { display: flex; align-items: baseline; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.section__title { margin: 0; font-size: 16px; letter-spacing: -0.005em; }
.section__hint { color: var(--text-3); font-size: 12px; }
.section__count { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-2); background: var(--bg-2); border: 1px solid var(--line); padding: 3px 8px; border-radius: 999px; }

.task-list { list-style: none; margin: 0; padding: 4px 0; }
.task { display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 14px 20px; border-top: 1px solid transparent; border-bottom: 1px solid var(--line); align-items: start; transition: background 0.12s; }
.task:last-child { border-bottom: none; }
.task:hover { background: var(--bg-2); }

.task__check { position: relative; display: grid; place-items: center; padding-top: 2px; cursor: pointer; }
.task__check input { position: absolute; opacity: 0; width: 22px; height: 22px; cursor: pointer; }
.task__box { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line-2); background: var(--bg-2); display: grid; place-items: center; transition: all 0.15s; }
.task__box::after { content: ''; width: 11px; height: 6px; border-left: 2px solid #1a1408; border-bottom: 2px solid #1a1408; transform: rotate(-45deg) translateY(-1px); opacity: 0; transition: opacity 0.15s; }
.task__check input:checked + .task__box { background: var(--accent); border-color: var(--accent); }
.task__check input:checked + .task__box::after { opacity: 1; }

.task__body { display: grid; gap: 4px; min-width: 0; }
.task__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task__id { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-3); background: var(--bg-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 4px; }
.task__pic { font-size: 11px; color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(255, 207, 71, 0.25); padding: 1px 8px; border-radius: 999px; }
.task__title { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text); }
.task--done .task__title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }
.task__meta { margin: 4px 0 0; font-size: 11px; color: var(--text-3); font-family: 'JetBrains Mono', monospace; }

/* Section hidden when empty after filtering */
.section--empty { display: none; }

/* Footer */
.footer { display: flex; justify-content: space-between; align-items: center; padding-top: 28px; color: var(--text-3); font-size: 12px; flex-wrap: wrap; gap: 12px; }
.link { background: none; border: none; color: var(--accent); padding: 0; font-size: 12px; }
.link:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 640px) {
  main { padding: 18px 14px 60px; }
  .topbar { gap: 10px; }
  .topbar__right { gap: 8px; }
  .progress__bar { width: 80px; }
  .task { padding: 12px 14px; }
  .section__head { padding: 14px 16px 10px; }
}
