:root{
  --bg: #f8f7f4;
  --card: #ffffff;
  --text: #111111;
  --muted: rgba(0,0,0,.55);
  --line: rgba(0,0,0,.10);
  --shadow: 0 18px 50px rgba(0,0,0,.08);
  --radius: 18px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-serif, Georgia, "Times New Roman", serif;
}

.page{
  min-height: 100%;
  display:flex;
  justify-content:center;
  padding: 72px 18px;
}

.card{
  width: min(720px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1{
  margin:0;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-size: 30px;
}

.sub{
  margin:6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.stats{ text-align:right; }

.pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 54px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.03);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-size: 13px;
}

.meta{
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.add{
  display:flex;
  gap: 10px;
  margin: 18px 0 16px;
}

.input{
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
  background: white;
  transition: border-color .15s ease;
}

.input:focus{
  border-color: rgba(0,0,0,.25);
}

.btn{
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  background: #111;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: opacity .15s ease, transform .05s ease;
}

.btn:hover{ opacity: .9; }
.btn:active{ transform: translateY(1px); }

.list{
  list-style:none;
  padding:0;
  margin:0;
  border-top: 1px solid var(--line);
}

.row{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}

.check{
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family: ui-sans-serif, system-ui;
  font-weight: 700;
  transition: background .15s ease;
}

.row.done .check{
  background: rgba(0,0,0,.06);
}

.text{
  flex:1;
  text-align:left;
  border:none;
  background: transparent;
  padding: 0;
  cursor: text;
  font-size: 18px;
  line-height: 1.2;
  font-family: inherit;
}

.row.done .text{
  text-decoration: line-through;
  opacity: .55;
}

.trash{
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
  cursor:pointer;
  font-size: 18px;
  line-height: 0;
  transition: background .15s ease;
}

.trash:hover{ background: rgba(0,0,0,.04); }

.empty{
  padding: 18px 4px;
  color: var(--muted);
  font-size: 15px;
}

.footer{
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  padding-top: 14px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-size: 13px;
}

.link{
  border:none;
  background: transparent;
  cursor:pointer;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dot{ opacity: .6; }

.select, .date{
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px;
  background: white;
  font-size: 14px;
  outline: none;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  transition: border-color .15s ease;
}

.select:focus, .date:focus{
  border-color: rgba(0,0,0,.25);
}

/* On small screens, let the form wrap nicely */
.add{
  flex-wrap: wrap;
}
.select, .date, .btn{
  flex: 0 0 auto;
}
.badge{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.03);
  color: var(--muted);
  font-size: 12px;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  white-space: nowrap;
}

.rank{
  font-weight: 600;
  color: rgba(0,0,0,.70);
}


.confirm-wrap{
  display:flex;
  gap:6px;
}

.confirm-btn{
  border:1px solid rgba(0,0,0,.15);
  background:#111;
  color:white;
  border-radius:8px;
  padding:6px 10px;
  font-size:12px;
  cursor:pointer;
}

.confirm-btn:hover{
  opacity:.9;
}

.cancel-btn{
  border:1px solid var(--line);
  background:white;
  border-radius:8px;
  padding:6px 10px;
  font-size:12px;
  cursor:pointer;
}

.cancel-btn:hover{
  background:rgba(0,0,0,.05);
}
.nav{
  display:flex;
  gap:12px;
  justify-content:flex-end;
  margin-bottom: 6px;
}

.navlink{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-size: 13px;
  color: rgba(0,0,0,.65);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.02);
}

.navlink:hover{ background: rgba(0,0,0,.05); }

.cal-controls{
  display:flex;
  gap:10px;
  margin: 10px 0 14px;
}

.btn-lite{
  border: 1px solid var(--line);
  background: rgba(0,0,0,.02);
  border-radius: 12px;
  padding: 10px 12px;
  cursor:pointer;
}

.btn-lite:hover{ background: rgba(0,0,0,.05); }

.cal-weekdays{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-size: 12px;
}

.cal-grid{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day{
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  min-height: 64px;
  background: white;
  cursor: pointer;
  display:flex;
  flex-direction: column;
  justify-content: space-between;
}

.day:hover{ background: rgba(0,0,0,.02); }

.day.muted{
  opacity: .35;
}

.daynum{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-size: 12px;
  color: rgba(0,0,0,.70);
}

.dotrow{
  display:flex;
  gap:6px;
  align-items:center;
  margin-top: 6px;
}

.dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.15);
}

.dot.filled{
  background: rgba(0,0,0,.55);
}

/* TODAY highlight */
.day.today{
  border: 2px solid #96281b;
}

/* Overdue highlight */
.day.overdue{
  border: 2px solid #c33;
}

/* Task count text */
.count{
  font-family: ui-sans-serif, system-ui;
  font-size: 12px;
  color: rgba(0,0,0,.60);
}

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

.mid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.badge-overdue {
  border-color: #c33;
  color: #c33;
}

.overdue-row .text {
  color: #c33;
}

.done-wrapper {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.done-toggle {
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-size: 13px;
  color: var(--muted);
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.done-section {
  display: none;
  margin-top: 10px;
}

.done-section.open {
  display: block;
}

/* Selected day highlight */
.day.selected {
  border: 2px solid #555;
  background: rgba(0,0,0,.04);
}

/* Day panel */
.day-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  background: white;
  display: none;
}
.day-panel:not(:empty) {
  display: block;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.panel-title {
  font-size: 15px;
  font-weight: 500;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}
.panel-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  padding: 2px 6px;
}
.panel-close:hover { color: #111; }
.panel-empty {
  color: var(--muted);
  font-size: 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  margin: 0;
}
.panel-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.panel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}
.panel-row:last-child { border-bottom: none; }
.panel-row.done .panel-text {
  text-decoration: line-through;
  opacity: .5;
}
.panel-check {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.panel-check.checked { background: rgba(0,0,0,.06); }
.panel-text { flex: 1; font-size: 14px; }
.panel-right {
  display: flex;
  gap: 6px;
}


.task-dates {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.task-date-item {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-size: 11px;
  color: var(--muted);
}

.date-overdue {
  color: #c33;
}

.navlink.active-nav {
  background: rgba(0,0,0,.10);
  color: #111;
  font-weight: 600;
}

.missed-wrapper {
  margin-top: 18px;
  border-top: 2px solid #c33;
  padding-top: 12px;
}

.missed-toggle {
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-size: 13px;
  color: #c33;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

.missed-section {
  display: none;
  margin-top: 10px;
}

.missed-section.open {
  display: block;
}

.missed-row {
  border-left: 3px solid #c33;
  padding-left: 10px;
}
