:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #737373;
  --border: #e5e5e5;
  --border-dark: #000000;
  --hover-bg: #f5f5f5;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  display: flex;
  justify-content: center;
  padding: 40px 20px 80px;
  line-height: 1.5;
}

.container {
  width: 100%;
  max-width: 760px;
}

/* Header Section */
header {
  margin-bottom: 24px;
}

.header-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.title-group {
  flex: 1;
  min-width: 0; /* Allows text wrapping without expanding the container */
}

.title-group h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  word-wrap: break-word; /* Breaks long titles onto new lines gracefully */
}

.title-group p.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

/* Custom Track Select Dropdown */
.custom-dropdown {
  position: relative;
  width: 240px;
  flex-shrink: 0;
}

.dropdown-trigger {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-dark);
  color: var(--fg);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  border-radius: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.dropdown-trigger:focus {
  box-shadow: 0 0 0 1px var(--fg);
}

.dropdown-arrow {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.custom-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

/* Dropdown Menu Overlay */
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 280px;
  background: var(--bg);
  border: 1px solid var(--border-dark);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.custom-dropdown.open .dropdown-menu {
  display: block;
}

/* Search input inside dropdown */
.dropdown-search-wrapper {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.dropdown-search-wrapper input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-dark);
  font-size: 0.8rem;
  outline: none;
  background: var(--bg);
}

.dropdown-search-wrapper input:focus {
  box-shadow: 0 0 0 1px var(--fg);
}

/* Option List */
.dropdown-options {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}

.dropdown-option {
  padding: 10px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.dropdown-option:last-child {
  border-bottom: none;
}

.dropdown-option:hover,
.dropdown-option.selected {
  background-color: var(--hover-bg);
  font-weight: 700;
}

.dropdown-no-match {
  padding: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* Buttons */
.btn {
  background: var(--bg);
  border: 1px solid var(--border-dark);
  color: var(--fg);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  background: var(--hover-bg);
}

.btn.active {
  background: var(--fg);
  color: var(--bg);
}

.reset-btn {
  margin-left: auto;
  border-color: #ccc;
  color: var(--muted);
}

.reset-btn:hover {
  border-color: var(--fg);
  color: var(--fg);
}

/* Sticky Progress Header */
.sticky-header {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  z-index: 10;
  margin-bottom: 32px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background-color: #f0f0f0;
  border-radius: 0;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border-dark);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background-color: var(--fg);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Controls: Search & Filters */
.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border-dark);
  border-radius: 0;
  outline: none;
  font-size: 0.875rem;
  background: var(--bg);
}

input[type="text"]:focus {
  box-shadow: 0 0 0 1px var(--fg);
}

.filters {
  display: flex;
  gap: 4px;
}

/* Category Section */
.category-group {
  margin-bottom: 36px;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--fg);
  margin-bottom: 12px;
}

.category-title {
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.category-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

/* Task Items */
.task-list {
  list-style: none;
}

.task-item {
  display: flex;
  align-items: center;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: background 0.1s ease;
}

.task-item:hover {
  background-color: var(--hover-bg);
}

.checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--fg);
  margin-right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.checkbox::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  margin-bottom: 2px;
  transition: transform 0.15s ease;
}

.task-item.completed .checkbox {
  background-color: var(--fg);
}

.task-item.completed .checkbox::after {
  transform: rotate(45deg) scale(1);
}

.task-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fg);
}

.task-item.completed .task-label {
  text-decoration: line-through;
  color: var(--muted);
}

.no-results {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 0.9rem;
  display: none;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--fg);
  color: var(--bg);
  padding: 12px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 100;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}
