.ht-wrap {
    max-width: 780px;
    margin: 0 auto;
    padding: 1rem;
}

.ht-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    text-align: center;
}

.ht-sub {
    margin: 0 0 1.25rem;
    color: #4b5563;
    line-height: 1.55;
    text-align: center;
}

.ht-add {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.ht-input {
    flex: 1;
    min-width: 180px;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font: inherit;
    box-sizing: border-box;
}

.ht-input:focus {
    outline: 2px solid #059669;
    outline-offset: 1px;
    border-color: #059669;
}

.ht-colors { display: flex; gap: 0.35rem; }

.ht-swatch {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
}

.ht-swatch.ht-on {
    border-color: #111;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111;
}

.ht-btn {
    padding: 0.6rem 1.25rem;
    border: 1px solid #888;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.ht-btn-primary {
    background: #059669;
    border-color: #059669;
    color: #fff;
}

.ht-btn-primary:hover { background: #047857; }

.ht-error {
    margin: 0.8rem 0 0;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    background: #fdecea;
    color: #b3261e;
    border: 1px solid #f5c6c2;
    font-size: 0.9rem;
}

.ht-error[hidden] { display: none; }

/* ------- habit cards ------- */

.ht-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
    margin-top: 1.1rem;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.ht-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.ht-dot {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.ht-hname {
    font-weight: 700;
    font-size: 1.05rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ht-del {
    border: none;
    background: none;
    color: #a8a29e;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.2rem;
}

.ht-del:hover { color: #dc2626; }

.ht-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.9rem;
}

.ht-stat {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    padding: 0.55rem 0.3rem;
    text-align: center;
}

.ht-stat-n { font-weight: 800; font-size: 1.15rem; }
.ht-stat-l { font-size: 0.72rem; color: #6b7280; margin-top: 0.1rem; }
.ht-stat.ht-hot .ht-stat-n { color: #ea580c; }

/* ------- streak grid ------- */

.ht-grid-scroll { overflow-x: auto; padding-bottom: 0.2rem; }

.ht-grid { display: flex; gap: 3px; min-width: max-content; }

.ht-col {
    display: grid;
    grid-template-rows: repeat(7, 13px);
    gap: 3px;
}

.ht-cell {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    background: #e5e7eb;
    border: none;
    padding: 0;
    cursor: pointer;
}

.ht-cell:hover { outline: 1px solid #9ca3af; outline-offset: 1px; }
.ht-cell.ht-done { background: #16a34a; }
.ht-cell.ht-future { visibility: hidden; cursor: default; }

.ht-mlabs { display: flex; gap: 3px; margin-top: 5px; min-width: max-content; }

.ht-mlab {
    width: 13px;
    font-size: 10px;
    color: #6b7280;
    white-space: nowrap;
    overflow: visible;
}

.ht-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 0.7rem;
    font-size: 0.78rem;
    color: #6b7280;
}

.ht-legend-sq {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    background: #e5e7eb;
}

/* ------- empty state ------- */

.ht-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #57534e;
    line-height: 1.6;
}

.ht-empty-ico { font-size: 2.5rem; margin-bottom: 0.5rem; }

.ht-note {
    text-align: center;
    color: #6b7280;
    font-size: 0.85rem;
    margin-top: 1.4rem;
}

@media (max-width: 560px) {
    .ht-stats { grid-template-columns: repeat(2, 1fr); }
    .ht-add { flex-direction: column; align-items: stretch; }
    .ht-colors { justify-content: center; }
}
