:root {
  --bg: #F2F4F6;
  --surface: #FFFFFF;
  --text: #20262E;
  --accent: #3B5B7D;
  --border: #E2E6EB;
  --muted: #6B7280;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.4;
  font-size: 15px;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

header {
  margin-bottom: 20px;
}

h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.stats {
  background: var(--surface);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 24px;
  box-shadow: 0 1px 2px rgba(32, 38, 46, 0.06);
}

.counters {
  display: flex;
  gap: 20px;
  margin-bottom: 14px;
}

.counter {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.counter .num {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.counter .label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  flex: 1;
  height: 7px;
  background: #E8EBEF;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.25s ease;
}

#progress-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 54px;
  text-align: right;
}

h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-section {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: 0 1px 2px rgba(32, 38, 46, 0.06);
}

.add-form {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto;
  gap: 10px;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--accent);
}

button {
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}

button:hover {
  filter: brightness(0.95);
}

.groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.location-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(32, 38, 46, 0.04);
}

.location-header {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  background: #F7F8FA;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid #F3F5F7;
}

.item:last-child {
  border-bottom: none;
}

.item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.item .note-text {
  flex: 1;
  font-size: 14.5px;
  line-height: 1.3;
}

.item.is-done .note-text {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.item .ts {
  font-size: 11.5px;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}

.empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.empty-msg {
  color: var(--muted);
  font-size: 14px;
  padding: 16px 12px;
  font-style: italic;
}

#completed-details {
  margin-top: 20px;
}

#completed-details summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  user-select: none;
  padding: 5px 0;
}

#completed-details summary:hover {
  text-decoration: underline;
}

.completed-section .groups {
  margin-top: 6px;
  padding-left: 4px;
}

.count-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding-left: 3px;
}

.error {
  display: none;
  margin-top: 10px;
  padding: 9px 12px;
  background: #FEE2E2;
  color: #991B1B;
  border-radius: 6px;
  font-size: 13px;
}

@media (max-width: 640px) {
  .add-form {
    grid-template-columns: 1fr;
    gap: 9px;
  }
  button {
    width: 100%;
  }
  .counters {
    gap: 30px;
  }
}