/* =================================================
   VOLT TOOLS — HABIT TRACKER
   Self-contained: variables defined here so the
   tool works with or without the site stylesheet
================================================= */

/* ── CSS VARIABLES ───────────────────────────── */
:root {
  --bg:        #0b1020;
  --card:      rgba(255,255,255,0.055);
  --border:    rgba(255,255,255,0.09);
  --text:      #f1f5f9;
  --muted:     #94a3b8;
  --primary:   #6366f1;
  --secondary: #8b5cf6;
  --success:   #22c55e;
}

/* ── BASE ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ── LAYOUT ──────────────────────────────────── */
.ht-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

/* ── SIDEBAR ──────────────────────────────────── */
.ht-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.022);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none;
  transition: left 0.3s ease;
  z-index: 300;
}
.ht-sidebar::-webkit-scrollbar { display: none; }

.ht-sidebar-logo {
  padding: 22px 18px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ht-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}
.ht-sidebar-logo span {
  font-size: 1rem; font-weight: 700; color: var(--text);
  white-space: nowrap; letter-spacing: -0.02em;
}

.ht-nav { padding: 14px 10px; flex: 1; }

.ht-nav-label {
  font-size: 0.65rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1.2px;
  padding: 12px 8px 5px;
}

.ht-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--muted); font-size: 0.875rem;
  cursor: pointer; transition: all 0.18s ease;
  text-decoration: none; margin-bottom: 2px;
  position: relative; white-space: nowrap;
}
.ht-nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
}
.ht-nav-item.active {
  background: rgba(99,102,241,0.14);
  color: #c7d2fe;
}
.ht-nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 56%;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.ht-nav-icon {
  font-size: 0.88rem; width: 18px;
  text-align: center; flex-shrink: 0;
}
.ht-nav-badge {
  margin-left: auto;
  background: rgba(99,102,241,0.7);
  color: white;
  font-size: 0.65rem; padding: 2px 7px;
  border-radius: 99px; font-weight: 700;
}

/* XP Bar */
.ht-xp-wrap {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ht-xp-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; font-size: 0.72rem;
}
.ht-level-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(139,92,246,0.18);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 6px; padding: 3px 8px;
  font-size: 0.7rem; font-weight: 700; color: #c4b5fd;
}
.ht-xp-val { color: #c7d2fe; font-weight: 600; }
.ht-xp-bar {
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px; overflow: hidden;
}
.ht-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 99px; transition: width 1.2s ease;
}

/* Premium badge (replaces upgrade CTA) */
.ht-sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ht-premium-badge {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, rgba(99,102,241,0.14), rgba(139,92,246,0.1));
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 12px; padding: 12px 14px;
}
.ht-premium-badge .ht-badge-icon {
  font-size: 1.4rem; flex-shrink: 0;
}
.ht-premium-badge h4 {
  font-size: 0.8rem; font-weight: 700; color: #c7d2fe; margin-bottom: 1px;
}
.ht-premium-badge p {
  font-size: 0.68rem; color: var(--muted); line-height: 1.3;
}

/* ── MAIN CONTENT ─────────────────────────────── */
.ht-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}

/* Inner Sticky Header */
.ht-header {
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  background: rgba(11,16,32,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 200;
  height: 62px;
  flex-shrink: 0;
}
.ht-header-title {
  font-size: 0.95rem; font-weight: 700;
  white-space: nowrap; letter-spacing: -0.01em;
}

.ht-search {
  flex: 1; max-width: 280px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 9px; padding: 7px 12px;
  transition: border-color 0.2s;
}
.ht-search:focus-within {
  border-color: rgba(99,102,241,0.4);
}
.ht-search input {
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: 0.82rem;
  width: 100%; min-width: 0;
}
.ht-search input::placeholder { color: var(--muted); }
.ht-search-icon { color: var(--muted); font-size: 0.78rem; flex-shrink: 0; }

.ht-header-actions {
  display: flex; align-items: center;
  gap: 8px; margin-left: auto;
}

.ht-icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted);
  transition: all 0.18s;
  position: relative; flex-shrink: 0;
}
.ht-icon-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.18);
}
.ht-notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 6px; height: 6px;
  background: var(--primary);
  border-radius: 50%;
  border: 1.5px solid var(--bg);
}

.ht-avatar {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.72rem; color: white;
  cursor: pointer; flex-shrink: 0; user-select: none;
  letter-spacing: 0.5px;
}

.ht-add-btn {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white; border: none; padding: 8px 16px;
  border-radius: 9px; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; transition: all 0.18s;
  white-space: nowrap; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}
.ht-add-btn:hover {
  opacity: 0.88; transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99,102,241,0.45);
}

/* Sidebar toggle (hidden desktop) */
.ht-sidebar-toggle {
  display: none; background: transparent; border: none;
  color: var(--text); font-size: 1.15rem; cursor: pointer;
  padding: 4px; flex-shrink: 0;
}


/* ── CONTENT AREA ─────────────────────────────── */
.ht-content { padding: 24px; flex: 1; }

/* ── WELCOME CARD ─────────────────────────────── */
.ht-welcome {
  background: linear-gradient(135deg,
    rgba(99,102,241,0.14) 0%,
    rgba(139,92,246,0.08) 60%,
    rgba(11,16,32,0) 100%);
  border: 1px solid rgba(99,102,241,0.22);
  border-radius: 20px; padding: 28px 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; margin-bottom: 22px;
  position: relative; overflow: hidden;
}
.ht-welcome::before {
  content: '';
  position: absolute; right: -60px; top: -60px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(99,102,241,0.15), transparent 70%);
  pointer-events: none;
}
.ht-welcome-left h2 {
  font-size: 1.5rem; font-weight: 800;
  margin-bottom: 4px; letter-spacing: -0.02em;
}
.ht-welcome-left .ht-date {
  color: var(--muted); font-size: 0.82rem; margin-bottom: 10px;
}
.ht-welcome-left .ht-quote {
  color: #a5b4fc; font-size: 0.83rem;
  font-style: italic; max-width: 380px; line-height: 1.5;
}
.ht-welcome-scores {
  display: flex; gap: 18px; flex-shrink: 0;
  position: relative; z-index: 1;
}
.ht-score-ring {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
}
.ht-score-ring > span {
  font-size: 0.65rem; color: var(--muted);
  text-align: center; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ── STATS GRID ───────────────────────────────── */
.ht-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px; margin-bottom: 22px;
}
.ht-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 18px 16px;
  transition: all 0.22s ease;
  cursor: default;
}
.ht-stat:hover {
  border-color: rgba(99,102,241,0.35);
  transform: translateY(-2px);
  background: rgba(255,255,255,0.08);
}
.ht-stat-icon { font-size: 1.2rem; margin-bottom: 10px; }
.ht-stat-value {
  font-size: 1.55rem; font-weight: 800;
  line-height: 1; margin-bottom: 5px;
  letter-spacing: -0.03em;
}
.ht-stat-label {
  font-size: 0.7rem; color: var(--muted);
  font-weight: 500;
}
.ht-stat-change { font-size: 0.7rem; margin-top: 6px; }
.ht-stat-change.up   { color: var(--success); }
.ht-stat-change.down { color: #ef4444; }

/* ── CARD ─────────────────────────────────────── */
.ht-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px; overflow: hidden;
}
.ht-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.ht-card-header h3 {
  font-size: 0.92rem; font-weight: 700;
  letter-spacing: -0.01em;
}
.ht-card-body { padding: 12px 14px; }

/* ── MAIN GRID ────────────────────────────────── */
.ht-main-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px; margin-bottom: 20px;
}

/* ── FILTER TABS ──────────────────────────────── */
.ht-filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.ht-tab {
  padding: 4px 10px; border-radius: 7px; font-size: 0.73rem;
  cursor: pointer; transition: all 0.18s;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted); font-family: inherit; font-weight: 500;
}
.ht-tab.active {
  background: rgba(99,102,241,0.14);
  border-color: rgba(99,102,241,0.3);
  color: #c7d2fe;
}
.ht-tab:hover:not(.active) {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

/* ── HABIT ITEMS ──────────────────────────────── */
.ht-habit-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px; border-radius: 10px;
  transition: background 0.18s; cursor: pointer;
}
.ht-habit-item:hover { background: rgba(255,255,255,0.05); }
.ht-habit-item + .ht-habit-item {
  border-top: 1px solid rgba(255,255,255,0.04);
}

.ht-habit-check {
  width: 26px; height: 26px; border-radius: 7px;
  border: 2px solid rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer; transition: all 0.18s;
  font-size: 0.8rem; background: transparent; color: transparent;
  font-weight: 700;
}
.ht-habit-check:hover:not(.done):not(.skipped):not(.missed) {
  border-color: var(--success);
  background: rgba(34,197,94,0.1);
}
.ht-habit-check.done    {
  background: var(--success);
  border-color: var(--success);
  color: white;
  box-shadow: 0 2px 8px rgba(34,197,94,0.35);
}
.ht-habit-check.skipped {
  background: rgba(234,179,8,0.15);
  border-color: rgba(234,179,8,0.5);
  color: #eab308;
}
.ht-habit-check.missed  {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.5);
  color: #ef4444;
}

.ht-habit-color {
  width: 3px; border-radius: 99px;
  align-self: stretch; flex-shrink: 0;
  min-height: 28px;
}
.ht-habit-info { flex: 1; min-width: 0; }
.ht-habit-info h4 {
  font-size: 0.875rem; font-weight: 600;
  margin-bottom: 2px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.ht-habit-info p {
  font-size: 0.7rem; color: var(--muted);
}
.ht-habit-right {
  display: flex; align-items: center;
  gap: 8px; flex-shrink: 0;
}
.ht-streak-badge {
  display: flex; align-items: center; gap: 3px;
  font-size: 0.72rem; color: #fb923c; font-weight: 700;
  background: rgba(251,146,60,0.12);
  border: 1px solid rgba(251,146,60,0.2);
  border-radius: 6px; padding: 2px 7px;
}
.ht-habit-actions {
  display: flex; gap: 3px;
  opacity: 0; transition: opacity 0.18s;
}
.ht-habit-item:hover .ht-habit-actions { opacity: 1; }
.ht-habit-act-btn {
  width: 24px; height: 24px; border-radius: 6px; border: none;
  background: rgba(255,255,255,0.07); color: var(--muted);
  cursor: pointer; font-size: 0.72rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
}
.ht-habit-act-btn:hover {
  background: rgba(99,102,241,0.2); color: #c7d2fe;
}

/* ── RIGHT COLUMN ─────────────────────────────── */
.ht-progress-section {
  display: flex; flex-direction: column; gap: 16px;
}
.ht-today-progress {
  display: flex; flex-direction: column;
  align-items: center; padding: 22px 16px; gap: 16px;
}
.ht-big-ring {
  position: relative; width: 140px; height: 140px; flex-shrink: 0;
}
.ht-big-ring svg { display: block; }
.ht-mini-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; width: 100%;
}
.ht-mini-stat {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 10px; text-align: center;
}
.ht-mini-stat strong {
  display: block; font-size: 1.15rem;
  font-weight: 800; letter-spacing: -0.02em;
}
.ht-mini-stat span { font-size: 0.68rem; color: var(--muted); }
.ht-chart-wrap {
  padding: 14px 16px; height: 200px; position: relative;
}

/* ── BOTTOM GRID ──────────────────────────────── */
.ht-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px; margin-bottom: 20px;
}

/* ── ACHIEVEMENTS ─────────────────────────────── */
.ht-achievement {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 11px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  margin-bottom: 7px; transition: all 0.18s;
}
.ht-achievement:last-child { margin-bottom: 0; }
.ht-achievement:hover {
  border-color: rgba(99,102,241,0.3);
  background: rgba(99,102,241,0.06);
}
.ht-achievement.locked { opacity: 0.38; }
.ht-ach-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.ht-ach-icon.gold   { background: rgba(234,179,8,0.18); }
.ht-ach-icon.silver { background: rgba(156,163,175,0.16); }
.ht-ach-icon.purple { background: rgba(139,92,246,0.18); }
.ht-ach-icon.blue   { background: rgba(59,130,246,0.18); }
.ht-ach-icon.green  { background: rgba(34,197,94,0.18); }
.ht-ach-info h4 {
  font-size: 0.82rem; font-weight: 700; margin-bottom: 2px;
}
.ht-ach-info p { font-size: 0.7rem; color: var(--muted); }

/* ── INSIGHTS ─────────────────────────────────── */
.ht-insight {
  padding: 11px 14px; border-radius: 10px;
  background: rgba(99,102,241,0.07);
  border-left: 3px solid rgba(99,102,241,0.6);
  margin-bottom: 8px; font-size: 0.82rem;
  color: var(--muted); line-height: 1.55;
}
.ht-insight:last-child { margin-bottom: 0; }
.ht-insight strong { color: var(--text); }

/* ── HEATMAP ──────────────────────────────────── */
.ht-heatmap {
  display: grid; grid-template-columns: repeat(52, 1fr);
  gap: 3px; padding: 14px 20px;
}
.ht-hm-day {
  aspect-ratio: 1; border-radius: 2px;
  background: rgba(255,255,255,0.06);
  transition: opacity 0.15s; cursor: pointer;
}
.ht-hm-day:hover { opacity: 0.7; }
.ht-hm-day.l1 { background: rgba(99,102,241,0.22); }
.ht-hm-day.l2 { background: rgba(99,102,241,0.44); }
.ht-hm-day.l3 { background: rgba(99,102,241,0.66); }
.ht-hm-day.l4 { background: rgba(99,102,241,0.88); }
.ht-heatmap-legend {
  display: flex; gap: 5px; align-items: center;
  padding: 2px 20px 16px; font-size: 0.7rem; color: var(--muted);
}
.ht-hm-swatch { width: 11px; height: 11px; border-radius: 2px; flex-shrink: 0; }

/* ── MODAL ────────────────────────────────────── */
.ht-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none;
  transition: opacity 0.22s;
}
.ht-modal-overlay.open { opacity: 1; pointer-events: all; }
.ht-modal {
  background: #0d1526;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px; width: 100%; max-width: 540px;
  max-height: 92vh; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.22s;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
}
.ht-modal-overlay.open .ht-modal {
  transform: translateY(0) scale(1);
}
.ht-modal-header {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0;
  background: #0d1526; z-index: 10;
}
.ht-modal-header h3 {
  font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em;
}
.ht-modal-close {
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
}
.ht-modal-close:hover {
  color: var(--text); background: rgba(255,255,255,0.08);
}
.ht-modal-body { padding: 22px 26px; }
.ht-form-group { margin-bottom: 16px; }
.ht-form-group label {
  display: block; font-size: 0.7rem; font-weight: 700;
  color: var(--muted); margin-bottom: 7px;
  text-transform: uppercase; letter-spacing: 0.7px;
}
.ht-input, .ht-select, .ht-textarea {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 13px;
  color: var(--text); font-size: 0.875rem;
  font-family: inherit; outline: none;
  transition: border-color 0.18s, background 0.18s;
}
.ht-input:focus, .ht-select:focus, .ht-textarea:focus {
  border-color: rgba(99,102,241,0.6);
  background: rgba(99,102,241,0.05);
}
.ht-input::placeholder { color: var(--muted); }
.ht-select option { background: #0d1526; color: var(--text); }
.ht-textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
.ht-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.ht-color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ht-color-dot {
  width: 28px; height: 28px; border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer; transition: transform 0.18s;
}
.ht-color-dot.selected {
  border-color: white; transform: scale(1.2);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}

.ht-freq-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ht-freq-btn {
  padding: 5px 12px; border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  font-size: 0.78rem; cursor: pointer;
  font-family: inherit; font-weight: 500;
  transition: all 0.18s;
}
.ht-freq-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }
.ht-freq-btn.sel {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.45);
  color: #c7d2fe;
}

.ht-modal-footer {
  padding: 16px 26px 22px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}
.ht-btn {
  padding: 10px 22px; border-radius: 9px;
  font-size: 0.85rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: all 0.18s; border: none;
}
.ht-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 14px rgba(99,102,241,0.4);
}
.ht-btn-primary:hover {
  opacity: 0.88; transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99,102,241,0.5);
}
.ht-btn-ghost {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border); color: var(--muted);
}
.ht-btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.08); }

/* ── NOTIFICATIONS PANEL ─────────────────────── */
.ht-notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 300px; background: #0d1526;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  z-index: 500; overflow: hidden; display: none;
}
.ht-notif-panel.open { display: block; }
.ht-notif-hd {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.875rem; font-weight: 700;
}
.ht-notif-hd a { font-size: 0.72rem; color: var(--primary); }
.ht-notif-item {
  display: flex; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.18s; position: relative;
}
.ht-notif-item:last-child { border-bottom: none; }
.ht-notif-item:hover { background: rgba(255,255,255,0.03); }
.ht-notif-item.unread { padding-left: 22px; }
.ht-notif-item.unread::before {
  content: ''; position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%); width: 5px; height: 5px;
  background: var(--primary); border-radius: 50%;
}
.ht-notif-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: rgba(99,102,241,0.14);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem; flex-shrink: 0;
}
.ht-notif-body p   { font-size: 0.78rem; line-height: 1.4; margin-bottom: 2px; }
.ht-notif-body span { font-size: 0.68rem; color: var(--muted); }

/* ── EMPTY STATE ──────────────────────────────── */
.ht-empty { text-align: center; padding: 56px 20px; }
.ht-empty-icon { font-size: 2.8rem; margin-bottom: 14px; opacity: 0.4; }
.ht-empty h4 {
  font-size: 1rem; font-weight: 700;
  margin-bottom: 6px; color: var(--text);
}
.ht-empty p { font-size: 0.83rem; color: var(--muted); line-height: 1.5; }

/* ── SIDEBAR OVERLAY (mobile) ─────────────────── */
.ht-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(2px);
  z-index: 299;
}

/* ── TOAST ────────────────────────────────────── */
.ht-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: #22c55e; color: white;
  padding: 12px 20px; border-radius: 12px;
  font-size: 0.875rem; font-weight: 700;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  animation: htSlideUp 0.28s ease;
  font-family: 'Inter', sans-serif;
}
.ht-toast.warn { background: #f59e0b; }
@keyframes htSlideUp {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ── SECTION PLACEHOLDER ──────────────────────── */
.ht-ph {
  min-height: 360px;
  display: flex; align-items: center; justify-content: center;
}

/* =================================================
   RESPONSIVE
================================================= */
@media (max-width: 1280px) {
  .ht-stats-grid    { grid-template-columns: repeat(3, 1fr); }
  .ht-bottom-grid   { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1100px) {
  .ht-main-grid     { grid-template-columns: 1fr 280px; }
}

@media (max-width: 960px) {
  .ht-main-grid     { grid-template-columns: 1fr; }
  .ht-welcome-scores { display: none; }
}

@media (max-width: 860px) {
  .ht-sidebar {
    position: fixed;
    left: -260px;
    top: 0; height: 100vh;
    z-index: 300;
    background: #0b1020;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 8px 0 32px rgba(0,0,0,0.5);
  }
  .ht-sidebar.open  { left: 0; }
  .ht-overlay.open  { display: block; }
  .ht-sidebar-toggle { display: flex; align-items: center; }
  .ht-content       { padding: 16px; }
  .ht-bottom-grid   { grid-template-columns: 1fr; }
  .ht-wrapper       { min-height: 100vh; }
}

@media (max-width: 640px) {
  .ht-stats-grid    { grid-template-columns: repeat(2, 1fr); }
  .ht-form-row      { grid-template-columns: 1fr; }
  .ht-welcome       { flex-direction: column; }
  .ht-welcome-left h2 { font-size: 1.2rem; }
  .ht-modal-overlay { align-items: flex-end; padding: 0; }
  .ht-modal         { border-radius: 20px 20px 0 0; max-width: 100%; }
  .ht-search        { display: none; }
  .ht-heatmap       { grid-template-columns: repeat(26, 1fr); }
  .ht-header        { gap: 8px; padding: 0 14px; }
}

@media (max-width: 420px) {
  .ht-stats-grid  { grid-template-columns: 1fr 1fr; }
  .ht-content     { padding: 10px; }
  .ht-add-btn span { display: none; }
  .ht-add-btn     { padding: 8px 10px; }
}

/* ── STAT CARD TOOLTIPS ──────────────────────────── */
.ht-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--muted);
  cursor: help;
  margin-left: 3px;
  opacity: 0.7;
  vertical-align: middle;
  position: relative;
}
/*.ht-tip::after {*/
/*  content: attr(data-tip);*/
/*  position: absolute;*/
/*  bottom: calc(100% + 8px);*/
/*  left: 50%;*/
/*  transform: translateX(-50%);*/
/*  background: #1e2d45;*/
/*  color: #e2e8f0;*/
/*  font-size: 0.72rem;*/
/*  font-weight: 400;*/
/*  line-height: 1.45;*/
/*  padding: 8px 12px;*/
/*  border-radius: 9px;*/
/*  border: 1px solid rgba(255,255,255,0.1);*/
/*  white-space: nowrap;*/
/*  max-width: 200px;*/
/*  white-space: normal;*/
/*  width: max-content;*/
/*  max-width: 180px;*/
/*  box-shadow: 0 8px 24px rgba(0,0,0,0.45);*/
/*  opacity: 0;*/
/*  pointer-events: none;*/
/*  z-index: 1000;*/
/*  transition: opacity 0.18s;*/
/*  text-transform: none;*/
/*}*/
.ht-tip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e2d45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  z-index: 1000;
}
.ht-tip:hover::after,
.ht-tip:hover::before { opacity: 1; }

/* ── CALENDAR ENHANCEMENTS ───────────────────────── */
.cal-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.cal-summary-stat {
  text-align: center;
}
.cal-summary-stat strong {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.cal-summary-stat span {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cal-view-tabs {
  display: flex;
  gap: 4px;
}

.cal-day-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
  font-size: 0.82rem;
  font-weight: 600;
  user-select: none;
}
.cal-day-cell:hover { filter: brightness(1.25); }
.cal-day-cell .cal-pct {
  font-size: 0.58rem;
  opacity: 0.8;
  margin-top: 1px;
}
.cal-day-cell .cal-streak {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.5rem;
  line-height: 1;
}

/* Week view */
.cal-week-row {
  display: grid;
  grid-template-columns: 160px repeat(7, 1fr);
  gap: 6px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cal-week-row:last-child { border-bottom: none; }
.cal-week-habit-name {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}
.cal-week-check {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.cal-week-check.done    { background: rgba(34,197,94,0.25);  color: #22c55e; }
.cal-week-check.missed  { background: rgba(239,68,68,0.18);  color: #ef4444; }
.cal-week-check.skipped { background: rgba(234,179,8,0.18);  color: #eab308; }
.cal-week-check.none    { background: rgba(255,255,255,0.04); color: transparent; }
.cal-week-check.today-col { box-shadow: inset 0 0 0 1px rgba(99,102,241,0.5); }

/* Day detail slide-up panel */
.cal-detail-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 3000;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.cal-detail-overlay.open { opacity: 1; pointer-events: all; }
.cal-detail-panel {
  background: #0d1526;
  border: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  width: 100%; max-width: 600px;
  max-height: 85vh; overflow-y: auto;
  transform: translateY(24px); transition: transform 0.28s;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}
.cal-detail-overlay.open .cal-detail-panel { transform: translateY(0); }
.cal-detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #0d1526; z-index: 10;
}
.cal-detail-header h3 { font-size: 1rem; font-weight: 700; }
.cal-detail-close {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); cursor: pointer; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
}
.cal-detail-close:hover { color: var(--text); background: rgba(255,255,255,0.07); }
.cal-detail-body { padding: 16px 22px; }

/* Notes */
.cal-note-area {
  width: 100%; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 13px; color: var(--text); font-size: 0.875rem;
  font-family: 'Inter', sans-serif; resize: vertical; min-height: 80px;
  outline: none; transition: border-color 0.18s; line-height: 1.5;
}
.cal-note-area:focus { border-color: rgba(99,102,241,0.55); }
.cal-note-save {
  margin-top: 8px;
  padding: 7px 18px; border-radius: 8px; border: none;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white; font-size: 0.8rem; font-weight: 700;
  cursor: pointer; transition: opacity 0.18s; font-family: inherit;
}
.cal-note-save:hover { opacity: 0.88; }

@media (max-width: 640px) {
  .cal-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .cal-week-row { grid-template-columns: 100px repeat(7, 1fr); }
  .cal-week-habit-name { font-size: 0.7rem; }
}
.ht-tip {
  cursor: help;
  color: var(--muted);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
}

#htTipBubble {
  position: fixed;
  z-index: 9999;
  max-width: 260px;
  width: max-content;
  background: #1e1e2e;
  color: #e2e8f0;
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
#htTipBubble.show { opacity: 1; }
.ht-tip i {
  font-size: 0.75rem;
  color: var(--muted);
}
.ht-tip:hover i {
  color: var(--primary, #6366f1);
}

.cal-day-cell .cal-habit-icons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
  font-size: 0.6rem;
  line-height: 1;
  max-width: 100%;
  opacity: 0.9;
}

.ht-offline-banner{
  display:none;
  align-items:center;
  justify-content:center;
  gap:10px;
  background:#f59e0b;
  color:#1e1b0e;
  font-size:0.8rem;
  font-weight:700;
  padding:8px 14px;
  text-align:center;
  position:sticky;
  top:0;
  z-index:500;
}
.ht-offline-banner.show{ display:flex; }
.ht-offline-banner .pending{
  background:rgba(0,0,0,0.15);
  border-radius:999px;
  padding:2px 9px;
  font-size:0.72rem;
}
/* ── Calendar month grid (moved off inline styles) ─────── */


/* ── Report stat grids (moved off inline styles) ───────── */
.rep-grid-4 { grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }
.rep-grid-3 { grid-template-columns: repeat(3, 1fr); margin-bottom: 18px; }

@media (max-width: 640px) {
  .rep-grid-4, .rep-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .cal-summary-stat strong { font-size: 1.1rem; }
}

@media (max-width: 480px) {
  .cal-month-grid { gap: 3px; }
  .cal-day-cell { font-size: 0.62rem; border-radius: 7px; }
  .cal-day-cell .cal-pct { font-size: 0.48rem; }
  .cal-day-cell .cal-habit-icons { font-size: 0.5rem; gap: 1px; }
  .cal-day-cell .cal-streak { font-size: 0.42rem; }
  .cal-dow-label { font-size: 0.55rem; padding-bottom: 3px; }

  #sec-calendar .ht-card-header {
    flex-direction: column; align-items: stretch;
  }
  #sec-calendar .ht-card-header > div {
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .rep-grid-4, .rep-grid-3 { grid-template-columns: 1fr; }
  .cal-summary-stat strong { font-size: 1rem; }
}