:root {
  --bg-color: #ffffff;
  --text-color: #121212;
  --border-color: #141414;
  --muted: #6b6b6b;
  --card-bg: #f7f7f7;
  --accent: #121212;
}
[data-theme="dark"] {
  --bg-color: #1f1f1f;
  --text-color: #f2f2f2;
  --border-color: #f2f2f2;
  --muted: #a8a8a8;
  --card-bg: #2a2a2a;
  --accent: #f2f2f2;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

.navbar {
  width: 100%;
  padding: 20px 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0; left: 0;
  background: transparent;
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(4px);
  z-index: 10;
}
.nav-title { font-weight: 700; text-decoration: none; color: var(--text-color); }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-link { text-decoration: none; color: var(--text-color); font-size: 14px; }
.nav-link:hover { text-decoration: underline; }

.theme-toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.theme-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { width: 42px; height: 22px; border: 2px solid var(--border-color); border-radius: 50px; position: relative; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: var(--text-color); border-radius: 50%; transition: transform 0.25s ease; }
.theme-toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); }

#main-content {
  max-width: 760px;
  margin: 110px auto 40px;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.app-header { display: flex; flex-direction: column; gap: 8px; }
.main-title { font-size: 32px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.body-text { font-size: 16px; line-height: 1.5; opacity: 0.85; margin: 0; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

.tabs { display: flex; gap: 8px; border-bottom: 2px solid var(--border-color); padding-bottom: 0; }
.tab-btn {
  padding: 10px 16px;
  border: 2px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--text-color);
  cursor: pointer;
  font-weight: 600;
  border-radius: 8px 8px 0 0;
  opacity: 0.6;
}
.tab-btn.active { opacity: 1; border-color: var(--border-color); background: var(--card-bg); }

.panel { display: none; flex-direction: column; gap: 16px; padding-top: 16px; }
.panel.active { display: flex; }

.input-row { display: flex; gap: 10px; }
.input-row input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border-color);
  border-radius: 50px;
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 15px;
  outline: none;
}
.input-row input:focus { border-color: var(--text-color); }
.input-row .duration-input { flex:0 0 190px !important; min-width:190px !important; max-width:190px; }
.input-row .unit-select { flex:0 0 70px !important; min-width:70px !important; }
.duration-input::-webkit-outer-spin-button, .duration-input::-webkit-inner-spin-button { -webkit-appearance:none; margin:0; }
.unit-select { flex:0 0 78px; min-width:78px; padding:10px 10px; border:2px solid var(--border-color); border-radius:50px; background:var(--bg-color); color:var(--text-color); }

.button {
  padding: 8px 16px;
  border: 2px solid var(--border-color);
  border-radius: 50px;
  background: var(--text-color);
  color: var(--bg-color);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font-weight: 600;
}
.button:hover { opacity: 0.9; }
.button .button-text { color: inherit; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 12px;
  border: 2px solid var(--border-color);
  border-radius: 50px;
  background: transparent;
  color: var(--text-color);
  cursor: pointer;
  font-size: 13px;
}
.filter-btn.active { background: var(--text-color); color: var(--bg-color); }
.stats { margin-left: auto; font-size: 13px; color: var(--muted); }

.item-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg);
}
.item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--text-color); }
.item-text { flex: 1; font-size: 15px; word-break: break-word; }
.item-text.done { text-decoration: line-through; opacity: 0.6; }
.item-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
}
.habit-btn, .todo-btn { font-size: 11px; padding: 4px 8px; border: 1.5px solid transparent; border-radius: 50px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.habit-btn { border-color: transparent; }
.pill-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; justify-content: center; font-size: 11px; padding: 4px 8px; border: 1.5px solid var(--border-color); border-radius: 50px; color: var(--text-color); background: transparent; white-space: nowrap; line-height: 1; text-align: center; }
.pill.muted { opacity: 0.7; border-color: var(--muted); color: var(--muted); }
button.pill { cursor: pointer; }
button.pill:hover { background: var(--text-color); color: var(--bg-color); }
.pill.habit-done { background: transparent; color: var(--text-color); opacity: 1; border-color: var(--border-color); }
.icon-btn:hover { background: var(--bg-color); color: var(--text-color); }
.empty-text { font-size: 14px; color: var(--muted); text-align: center; padding: 12px; border: 1.5px dashed var(--border-color); border-radius: 10px; opacity: 0.7; }

#footer { width: 100%; display: flex; justify-content: center; padding: 30px; }
.footer-copyright { font-size: 12px; opacity: 0.6; }

@media (max-width: 600px) {
  .navbar { padding: 16px 20px; }
  #main-content { margin-top: 90px; padding: 0 16px; }
  .main-title { font-size: 26px; }
}
