.ht-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}
.ht-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.ht-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
  margin: 0;
}
.ht-date {
  font-size: .8rem;
  color: var(--muted);
}

/* Habit list */
.ht-habit-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.ht-empty {
  color: var(--muted);
  text-align: center;
  padding: 2.5rem 0;
  font-size: .95rem;
}

.ht-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1rem;
  background: var(--card-2);
  border-radius: 12px;
  cursor: default;
  user-select: none;
  transition: background .12s;
  position: relative;
}
.ht-row:hover { background: var(--card-3, #1e2340); }

.ht-check {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 7px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  flex-shrink: 0;
}
.ht-row.done .ht-check {
  background: var(--ic, #6c8bff);
  border-color: var(--ic, #6c8bff);
}
.ht-check svg {
  display: none;
  width: 13px;
  height: 13px;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.ht-row.done .ht-check svg { display: block; }

.ht-emoji {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
}
.ht-name {
  flex: 1;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ht-row.done .ht-name {
  text-decoration: line-through;
  color: var(--muted);
}

.ht-streak {
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .2rem;
}
.ht-streak.hot { color: #ff9e7a; }

.ht-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 6px;
  border-radius: 6px;
  font-size: .85rem;
  line-height: 1;
  opacity: 0;
  transition: opacity .12s, color .12s;
  flex-shrink: 0;
}
.ht-row:hover .ht-del { opacity: 1; }
.ht-del:hover { color: #ff6b8a; }

/* Add form */
.ht-add-col {
  padding: 1.25rem 1.25rem 1.5rem;
  background: var(--card-2);
  border-radius: 16px;
}
.ht-add-col .ht-section-title { margin-bottom: 1rem; }
.ht-colors {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
}
.ht-color-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  padding: 0;
  background: var(--c);
}
.ht-color-dot:hover { transform: scale(1.15); }
.ht-color-dot.sel { border-color: rgba(255,255,255,.8); transform: scale(1.1); }

/* Week grid */
.ht-week-outer {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.ht-week-grid {
  display: grid;
  gap: .375rem;
  min-width: 360px;
}
.ht-week-row {
  display: grid;
  grid-template-columns: 150px repeat(7, 1fr);
  align-items: center;
  gap: .375rem;
}
.ht-week-header-row .ht-week-label { /* empty first cell */ }
.ht-week-day-hdr {
  font-size: .65rem;
  color: var(--muted-2, var(--muted));
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ht-week-label {
  font-size: .83rem;
  font-weight: 600;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: .5rem;
}
.ht-dot-wrap {
  display: flex;
  justify-content: center;
}
.ht-dot-clickable {
  cursor: pointer;
  border-radius: 7px;
  padding: 2px;
}
.ht-dot-clickable:hover .ht-dot { background: var(--border, #2a3157); }
.ht-dot-clickable:hover .ht-dot.done { filter: brightness(1.15); }
.ht-dot-clickable:focus-visible { outline: 2px solid var(--accent, #6c8bff); outline-offset: 2px; }
.ht-dot {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--card-2);
  transition: background .12s;
  position: relative;
}
.ht-dot.done { background: var(--ic, #6c8bff); }
.ht-dot.today::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 7px;
  outline: 2px solid var(--ic, #6c8bff);
}

/* Calendar */
.ht-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.ht-cal-nav {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .9rem;
  font-weight: 600;
}
.ht-cal-nav .btn { padding: .25rem .6rem; min-height: 32px; }
.ht-export-btn { margin-top: 1.25rem; font-size: .85rem; padding: 8px 16px; }

.ht-cal-section { margin-bottom: 1.75rem; }
.ht-cal-habit-name {
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.ht-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.ht-cal-dow {
  font-size: .6rem;
  color: var(--muted-2, var(--muted));
  text-align: center;
  text-transform: uppercase;
  padding: 2px 0 4px;
}
.ht-cal-day {
  aspect-ratio: 1;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  color: var(--muted);
  background: var(--card-2);
}
.ht-cal-day.blank { background: transparent; }
.ht-cal-day.today { outline: 2px solid #5cd6c0; outline-offset: 1px; color: var(--fg); }
.ht-cal-day.done { color: #fff; }
.ht-cal-day.future { opacity: .3; }

.ht-main-card { padding: 1.5rem; }

@media (max-width: 720px) {
  .ht-layout { grid-template-columns: 1fr; }
  .ht-add-col { margin-top: .25rem; }
}
@media (max-width: 480px) {
  .ht-week-row { grid-template-columns: 90px repeat(7, 1fr); }
}
