:root {
  --bg: #0b0f14;
  --card: #121925;
  --text: #e8eef7;
  --muted: #9bb0c8;
  --border: rgba(255,255,255,0.08);

  --green: #1f8f5f;
  --yellow: #d6b11f;
  --orange: #e27b2f;
  --red: #e24b4b;
  --overdue: #ff2d2d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 800px at 30% -10%, #17263a 0%, var(--bg) 55%);
  color: var(--text);
}

header {
  padding: 18px 18px 10px;
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
}

header h1 { margin: 0; font-size: 20px; letter-spacing: 0.3px; }
header .meta { color: var(--muted); font-size: 13px; display:flex; gap:14px; flex-wrap:wrap; }

.wrap {
  padding: 12px 18px 22px;
  max-width: 1100px;
  margin: 0 auto;
}

.row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
}
@media (max-width: 900px) {
  .row { grid-template-columns: 1fr; }
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.divider { border:0; border-top:1px solid var(--border); margin:12px 0; }

.nextDueTop {
  display:flex;
  justify-content: space-between;
  gap: 12px;
  align-items:flex-start;
  flex-wrap: wrap;
}
.nextDueTitle { font-size: 18px; margin: 0 0 6px; }
.nextDueSub { color: var(--muted); font-size: 13px; margin: 0; }
.countdown {
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.pill {
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.dot { width: 9px; height: 9px; border-radius: 999px; display:inline-block; }

.actions { display:flex; gap:8px; flex-wrap:wrap; margin-top: 10px; }
button, a.btn {
  appearance:none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 13px;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap: 8px;
  user-select:none;
}
button:hover, a.btn:hover { background: rgba(255,255,255,0.10); }
button:disabled { opacity: 0.55; cursor:not-allowed; }

.listHeader {
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap:wrap;
  margin-bottom: 8px;
}
.listHeader h2 { margin: 0; font-size: 15px; color: var(--muted); font-weight: 600; }
.controls { display:flex; gap:8px; flex-wrap:wrap; }

.task {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  margin: 10px 0;
  background: rgba(0,0,0,0.08);
  display:grid;
  gap: 8px;
}

.taskTop {
  display:flex;
  gap: 10px;
  align-items:flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.taskTitle {
  margin:0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  max-width: 760px;
  word-break: break-word;
}
.taskMeta { margin:0; font-size: 12px; color: var(--muted); }

.taskRight { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }

.tag {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.tier-green  { border-left: 6px solid var(--green); }
.tier-yellow { border-left: 6px solid var(--yellow); }
.tier-orange { border-left: 6px solid var(--orange); }
.tier-red    { border-left: 6px solid var(--red); }
.tier-overdue{ border-left: 6px solid var(--overdue); }

@keyframes flashBorder {
  0%   { box-shadow: 0 0 0 rgba(255,45,45,0.0); }
  50%  { box-shadow: 0 0 20px rgba(255,45,45,0.35); }
  100% { box-shadow: 0 0 0 rgba(255,45,45,0.0); }
}
.tier-flash_red {
  border-left: 6px solid var(--overdue);
  animation: flashBorder 1.2s infinite;
}

.completed {
  opacity: 0.55;
  filter: saturate(0.7);
}

.task.active {
  outline: 2px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06);
}

.small { font-size: 12px; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18,25,37,0.95);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  display:none;
  max-width: 92vw;
  font-size: 13px;
}
