/* ── Activity Stats / Streak / Heatmap ── */
.stats-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}

.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    transition: background var(--transition);
    font-family: var(--sans);
    color: var(--text);
}

.stats-header:hover {
    background: var(--surface2);
}

.stats-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-streak-icon {
    font-size: 1rem;
    line-height: 1;
}

.stats-streak-text {
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
}

.stats-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-week-count {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--text-muted);
}

.stats-header .chevron {
    display: inline-block;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.22s ease;
}

.stats-section.open .stats-header .chevron {
    transform: rotate(180deg);
}

.stats-body {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.22s ease, padding 0.22s ease;
    padding: 0 16px;
}

.stats-section.open .stats-body {
    max-height: 200px;
    opacity: 1;
    padding: 0 16px 14px;
}

.heatmap-container {
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.heatmap-container::-webkit-scrollbar { height: 3px; }
.heatmap-container::-webkit-scrollbar-track { background: transparent; }
.heatmap-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.heatmap-grid {
    display: grid;
    grid-template-rows: repeat(7, 1fr);
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 3px;
    min-width: max-content;
}

.heatmap-cell {
    width: 11px;
    height: 11px;
    border-radius: 2.5px;
    background: var(--accent);
    opacity: 0.06;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.heatmap-cell:hover {
    transform: scale(1.5);
    z-index: 1;
}

.heatmap-cell.today {
    outline: 1.5px solid var(--accent);
    outline-offset: 1px;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 8px;
}

.heatmap-legend-label {
    font-family: var(--mono);
    font-size: 0.55rem;
    color: var(--text-muted);
    margin: 0 2px;
}

.heatmap-cell-legend {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: var(--accent);
    display: inline-block;
}

/* ── Mobile ── */
@media (max-width: 520px) {
    body { padding: 12px; }
    .input-row { flex-direction: column; }
    .btn-group { flex-direction: row; }
    .add-btn { flex: 1; justify-content: center; padding: 13px; }
    .entry-item { grid-template-columns: auto 1fr auto; gap: 10px; padding: 12px 12px; }
    .custom-fields { flex-direction: column; }
    .filter-row { flex-direction: column; }
    .filter-date-wrap input[type="date"] { width: 100%; }
    .section-actions { flex-wrap: wrap; gap: 6px; }
    .palette-section { flex-wrap: wrap; gap: 8px; }
}

/* ── Settings gear button ── */
.palette-gear-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition);
    flex-shrink: 0;
    margin-left: auto;
}
.palette-gear-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
    transform: rotate(30deg);
}

/* ── Settings modal fields ── */
.settings-field {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}
.settings-field:last-child { margin-bottom: 0; }
.settings-field label {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.settings-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color var(--transition);
    -webkit-appearance: none;
    appearance: none;
}
.settings-select:focus {
    border-color: var(--accent);
    outline: none;
}

/* ── Daily View ── */
.daily-outer { position: relative; }
.daily-day { margin-bottom: 28px; }
.daily-day:last-child { margin-bottom: 0; }
.daily-day-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.daily-entries {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.daily-entry-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 12px;
    transition: border-color var(--transition), background var(--transition);
    cursor: pointer;
}
.daily-entry-card.today {
    background: var(--today-bg);
    border-color: var(--today-border);
}
.daily-entry-card.custom-entry {
    border-left: 3px solid var(--custom);
    padding-left: 14px;
}
.daily-entry-card .entry-text {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
    line-height: 1.5;
}
.daily-entry-card:hover {
    border-color: rgba(0, 229, 160, 0.35);
}
.daily-entry-card .entry-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
    margin-top: 5px;
    flex-shrink: 0;
}
.daily-entry-card.custom-entry .entry-dot {
    background: var(--custom);
    box-shadow: 0 0 0 3px var(--custom-dim);
}

/* ── Entry Preview in Sheet ── */
.preview-content {
    padding: 4px 0 8px;
    display: grid;
    gap: 12px;
}
.preview-text {
    font-family: var(--sans);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}
.preview-text.no-text {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}
.preview-meta {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}
.preview-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.preview-colors {
    display: flex;
    gap: 8px;
    align-items: center;
}
.preview-color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.12);
}
