/* ===================================================================
   HABIT TRACKER DASHBOARD - Scoped Styles
   All styles scoped under .tool-habit-tracker wrapper
   Auto-inherits theme colors from styles.css
   =================================================================== */

/* Root Wrapper */
.tool-habit-tracker {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    font-family: inherit;
    box-sizing: border-box;
    position: relative;
    min-height: 600px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
}

.tool-habit-tracker *,
.tool-habit-tracker *::before,
.tool-habit-tracker *::after {
    box-sizing: border-box;
}

/* ===================================================================
   NAVIGATION
   =================================================================== */

/* Desktop Top Navigation */
.ht-nav {
    display: flex;
    gap: 8px;
    padding: 20px 20px 0;
    border-bottom: 2px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.4);
    border-radius: 16px 16px 0 0;
}

.ht-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s ease;
    position: relative;
}

.ht-nav-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent, #22c55e);
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.ht-nav-btn:hover {
    background: rgba(34, 197, 94, 0.05);
    color: var(--text-primary);
}

.ht-nav-btn.active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--accent, #22c55e);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.ht-nav-btn.active::after {
    transform: scaleX(1);
}

.ht-nav-icon {
    font-size: 18px;
}

/* Mobile Bottom Navigation */
.ht-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid rgba(148, 163, 184, 0.3);
    padding: 8px 0;
    z-index: 100;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}

.ht-bottom-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ht-bottom-btn.active {
    color: var(--accent, #22c55e);
}

/* ===================================================================
   MAIN CONTENT
   =================================================================== */

.ht-main {
    padding: 20px;
    min-height: 400px;
}

/* Screens */
.ht-screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.ht-screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ht-screen-header {
    margin-bottom: 24px;
}

.ht-screen-title {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
}

.ht-screen-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 16px;
}

.ht-today-date {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===================================================================
   CARDS & COMPONENTS
   =================================================================== */

.ht-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.ht-card-title {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Progress Ring */
.ht-progress-card {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 40px;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.ht-progress-ring-container {
    position: relative;
}

.ht-progress-ring {
    transform: rotate(-90deg);
}

.ht-progress-ring-bg {
    fill: none;
    stroke: rgba(148, 163, 184, 0.2);
    stroke-width: 8;
}

.ht-progress-ring-fill {
    fill: none;
    stroke: var(--accent, #22c55e);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 327;
    stroke-dashoffset: 327;
    transition: stroke-dashoffset 0.6s ease;
}

.ht-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.ht-progress-value {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--accent, #22c55e);
}

.ht-progress-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.ht-progress-stats {
    display: flex;
    gap: 40px;
}

.ht-stat {
    display: flex;
    flex-direction: column;
}

.ht-stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.ht-stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Reminders Card */
.ht-reminders-card {
    background: rgba(248, 113, 113, 0.1);
    border: 2px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.ht-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: #ef4444;
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.ht-reminders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.ht-reminder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
}

.ht-reminder-actions {
    display: flex;
    gap: 8px;
}

/* Today Habits List */
.ht-today-habits-list,
.ht-streaks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ht-habit-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.ht-habit-item:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(34, 197, 94, 0.3);
}

.ht-habit-item.completed {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.3);
}

.ht-habit-checkbox {
    width: 28px;
    height: 28px;
    border: 2px solid var(--accent, #22c55e);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: white;
    transition: all 0.2s ease;
}

.ht-habit-checkbox:hover {
    background: rgba(34, 197, 94, 0.1);
    transform: scale(1.05);
}

.ht-habit-checkbox.checked {
    background: var(--accent, #22c55e);
    color: white;
}

.ht-habit-checkbox.checked::after {
    content: '✓';
    font-size: 16px;
    font-weight: 700;
}

.ht-habit-info {
    flex: 1;
}

.ht-habit-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.ht-habit-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.ht-streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(251, 146, 60, 0.15);
    color: #ea580c;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
}

/* Week Calendar */
.ht-week-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.ht-week-day {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    background: rgba(148, 163, 184, 0.1);
    border: 2px solid transparent;
}

.ht-week-day-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.ht-week-day-count {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.ht-week-day.today {
    border-color: var(--accent, #22c55e);
    background: rgba(34, 197, 94, 0.1);
}

.ht-week-day.completed {
    background: rgba(34, 197, 94, 0.2);
}

/* ===================================================================
   HABITS SCREEN
   =================================================================== */

.ht-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ht-search {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.9);
    outline: none;
    transition: border-color 0.2s ease;
}

.ht-search:focus {
    border-color: var(--accent, #22c55e);
}

.ht-select {
    padding: 10px 16px;
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    outline: none;
}

.ht-tag-filters,
.ht-category-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ht-tag-btn,
.ht-category-btn {
    padding: 8px 16px;
    border: 2px solid rgba(148, 163, 184, 0.3);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ht-tag-btn:hover,
.ht-category-btn:hover {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--accent, #22c55e);
}

.ht-tag-btn.active,
.ht-category-btn.active {
    background: var(--accent, #22c55e);
    border-color: var(--accent, #22c55e);
    color: white;
}

/* Habits Grid */
.ht-habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.ht-habit-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 2px solid rgba(148, 163, 184, 0.15);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.ht-habit-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent, #22c55e), rgba(34, 197, 94, 0.5));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.ht-habit-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--accent, #22c55e);
}

.ht-habit-card:hover::before {
    transform: scaleX(1);
}

.ht-habit-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
}

.ht-habit-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.ht-tag-pill {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 6px;
}

.ht-habit-card-actions {
    display: flex;
    gap: 8px;
}

.ht-icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
}

.ht-icon-btn:hover {
    background: rgba(148, 163, 184, 0.2);
    transform: scale(1.05);
}

.ht-habit-card-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.ht-habit-card-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ht-habit-card-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.ht-habit-card-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Mini Grid (7-day completion) */
.ht-mini-grid {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.ht-mini-grid-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.3);
}

.ht-mini-grid-dot.completed {
    background: var(--accent, #22c55e);
}

.ht-habit-card-check {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(34, 197, 94, 0.05);
    border-radius: 8px;
    border: 2px dashed rgba(34, 197, 94, 0.3);
}

.ht-habit-card-check-label {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

/* Archived Section */
.ht-archived-section {
    margin-top: 40px;
}

.ht-archived-toggle {
    padding: 16px;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
}

.ht-archived-toggle:hover {
    background: rgba(148, 163, 184, 0.15);
}

/* ===================================================================
   ANALYTICS SCREEN
   =================================================================== */

.ht-range-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.6);
    padding: 4px;
    border-radius: 8px;
    width: fit-content;
}

.ht-range-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.ht-range-btn:hover {
    background: rgba(34, 197, 94, 0.1);
}

.ht-range-btn.active {
    background: var(--accent, #22c55e);
    color: white;
}

.ht-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.ht-metric-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 2px solid rgba(148, 163, 184, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.ht-metric-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--accent, #22c55e);
    line-height: 1;
    margin-bottom: 8px;
}

.ht-metric-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.ht-chart-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 2px solid rgba(148, 163, 184, 0.15);
}

.ht-chart {
    width: 100%;
    height: 300px;
    max-width: 100%;
}

.ht-bar-chart,
.ht-heatmap {
    margin-top: 16px;
}

.ht-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.ht-bar-label {
    min-width: 120px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.ht-bar {
    flex: 1;
    height: 32px;
    background: rgba(34, 197, 94, 0.2);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.ht-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent, #22c55e), rgba(34, 197, 94, 0.7));
    border-radius: 4px;
    transition: width 0.6s ease;
}

.ht-bar-value {
    min-width: 50px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}

.ht-insights-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ht-insights-list li {
    padding: 12px 16px;
    background: rgba(34, 197, 94, 0.05);
    border-left: 4px solid var(--accent, #22c55e);
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-primary);
}

/* ===================================================================
   TEMPLATES SCREEN
   =================================================================== */

.ht-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.ht-template-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 2px solid rgba(148, 163, 184, 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
}

.ht-template-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--accent, #22c55e);
}

.ht-template-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.ht-template-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.ht-template-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.ht-template-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.ht-template-count {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ===================================================================
   BUTTONS
   =================================================================== */

.ht-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ht-btn-primary {
    background: radial-gradient(circle at 0 0, #bbf7d0 0, var(--accent, #22c55e) 36%, #22d3ee 100%);
    color: #022c22;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.ht-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
}

.ht-btn-secondary {
    background: rgba(255, 255, 255, 0.97);
    color: rgba(15, 23, 42, 0.9);
    border: 2px solid rgba(148, 163, 184, 0.5);
    font-weight: 600;
}

.ht-btn-secondary:hover {
    background: rgba(248, 250, 252, 1);
    border-color: rgba(100, 116, 139, 0.7);
    color: rgba(15, 23, 42, 1);
    transform: translateY(-1px);
}

.ht-btn-danger {
    background: rgba(255, 255, 255, 0.97);
    color: #dc2626;
    border: 2px solid #dc2626;
}

.ht-btn-danger:hover {
    background: #fee2e2;
    border-color: #b91c1c;
}

/* FAB */
.ht-fab {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 0 0, #bbf7d0 0, var(--accent, #22c55e) 36%, #22d3ee 100%);
    color: #022c22;
    border: none;
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4);
    transition: all 0.2s ease;
    z-index: 90;
}

.ht-fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 12px 32px rgba(34, 197, 94, 0.5);
}

/* ===================================================================
   MODALS
   =================================================================== */

.ht-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ht-modal.active {
    display: flex;
}

.ht-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.ht-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

.ht-modal-large {
    max-width: 800px;
}

.ht-modal-small {
    max-width: 400px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ht-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 2px solid rgba(148, 163, 184, 0.15);
}

.ht-modal-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.ht-modal-actions {
    display: flex;
    gap: 12px;
}

.ht-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ht-modal-close:hover {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-primary);
}

.ht-modal-body {
    padding: 24px;
}

.ht-modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    border-top: 2px solid rgba(148, 163, 184, 0.15);
    background: rgba(248, 250, 252, 0.5);
}

.ht-modal-footer .ht-btn {
    min-width: 120px;
    justify-content: center;
}

/* ===================================================================
   FORMS
   =================================================================== */

.ht-form-group {
    margin-bottom: 20px;
}

.ht-form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.ht-required {
    color: #dc2626;
}

.ht-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.ht-input:focus {
    border-color: var(--accent, #22c55e);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.ht-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ht-radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.ht-radio-label:hover {
    background: rgba(34, 197, 94, 0.05);
}

.ht-radio-label input[type="radio"] {
    cursor: pointer;
}

.ht-weekdays-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ht-weekdays-selector label {
    padding: 8px 16px;
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.ht-weekdays-selector input:checked+label,
.ht-weekdays-selector label:has(input:checked) {
    background: var(--accent, #22c55e);
    border-color: var(--accent, #22c55e);
    color: white;
}

.ht-checkbox-label,
.ht-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

/* Time Picker */
.ht-time-picker {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.ht-time-picker .ht-select {
    flex-shrink: 0;
}

.ht-time-picker span {
    font-weight: 700;
    color: var(--text-primary);
}

/* Toggle Switch */
.ht-toggle {
    position: relative;
    width: 50px;
    height: 28px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 14px;
    outline: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ht-toggle:checked {
    background: var(--accent, #22c55e);
}

.ht-toggle::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    background: white;
    transition: transform 0.2s ease;
}

.ht-toggle:checked::before {
    transform: translateX(22px);
}

/* ===================================================================
   SETTINGS & MISC
   =================================================================== */

.ht-setting-row {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.ht-setting-row:last-child {
    border-bottom: none;
}

.ht-setting-help {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.ht-setting-group {
    padding: 16px;
    background: rgba(148, 163, 184, 0.05);
    border-radius: 8px;
    margin-top: 12px;
}

.ht-setting-group h4 {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.ht-danger-zone {
    background: rgba(248, 113, 113, 0.05);
    padding: 16px;
    border-radius: 8px;
    border: 2px dashed rgba(239, 68, 68, 0.3);
}

/* Stats Cards (Habit Detail) */
.ht-detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.ht-stat-card {
    padding: 20px;
    background: rgba(34, 197, 94, 0.05);
    border-radius: 12px;
    text-align: center;
    border: 2px solid rgba(34, 197, 94, 0.15);
}

.ht-detail-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 2px solid rgba(148, 163, 184, 0.1);
}

.ht-detail-section:last-child {
    border-bottom: none;
}

.ht-detail-section h4 {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.ht-heatmap-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.ht-heatmap-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.1);
    position: relative;
    cursor: pointer;
}

.ht-heatmap-cell.completed {
    background: var(--accent, #22c55e);
}

.ht-heatmap-cell.partial {
    background: rgba(34, 197, 94, 0.5);
}

.ht-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ht-history-list li {
    padding: 12px;
    background: rgba(148, 163, 184, 0.05);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-primary);
}

.ht-template-habits-list {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
}

.ht-template-habits-list li {
    padding: 12px 16px;
    background: rgba(148, 163, 184, 0.05);
    border-left: 3px solid var(--accent, #22c55e);
    border-radius: 4px;
    margin-bottom: 8px;
}

/* Empty States */
.ht-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.ht-empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* ===================================================================
   CALENDAR SCREEN
   =================================================================== */

.ht-calendar-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ht-calendar-habit-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
}

.ht-calendar-habit-filter label {
    font-weight: 600;
    color: var(--text-primary);
}

.ht-calendar-month {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 2px solid rgba(148, 163, 184, 0.15);
}

.ht-calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(148, 163, 184, 0.2);
}

.ht-calendar-day-name {
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    padding: 8px;
}

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

.ht-calendar-day {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: rgba(148, 163, 184, 0.05);
    border: 2px solid transparent;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ht-calendar-day:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.ht-calendar-day.other-month {
    opacity: 0.3;
    pointer-events: none;
}

.ht-calendar-day.today {
    border-color: var(--accent, #22c55e);
    font-weight: 700;
}

.ht-calendar-day.has-completions-1 {
    background: rgba(34, 197, 94, 0.2);
}

.ht-calendar-day.has-completions-2 {
    background: rgba(34, 197, 94, 0.4);
}

.ht-calendar-day.has-completions-3 {
    background: rgba(34, 197, 94, 0.6);
}

.ht-calendar-day.has-completions-4 {
    background: rgba(34, 197, 94, 0.8);
}

.ht-calendar-day.has-completions-5 {
    background: #22c55e;
    color: white;
}

.ht-calendar-day-number {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.ht-calendar-day.has-completions-5 .ht-calendar-day-number {
    color: white;
}

.ht-calendar-day-count {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.ht-calendar-day.has-completions-5 .ht-calendar-day-count {
    color: rgba(255, 255, 255, 0.9);
}

.ht-calendar-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 16px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    margin-bottom: 20px;
}

.ht-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.ht-legend-box {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid rgba(148, 163, 184, 0.2);
}

.ht-month-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===================================================================
   RESPONSIVE DESIGN
   =================================================================== */

@media (max-width: 1024px) {

    .ht-habits-grid,
    .ht-templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .ht-progress-card {
        flex-direction: column;
        gap: 24px;
    }

    .ht-progress-stats {
        justify-content: center;
    }
}

@media (max-width: 768px) {

    /* Hide desktop nav, show bottom nav */
    .ht-nav {
        display: none;
    }

    .ht-bottom-nav {
        display: flex;
    }

    .tool-habit-tracker {
        padding: 0;
        border-radius: 0;
    }

    .ht-main {
        padding: 16px;
        padding-bottom: 80px;
        /* Space for bottom nav */
    }

    .ht-fab {
        bottom: 96px;
        /* Above bottom nav */
        right: 16px;
    }

    .ht-habits-grid,
    .ht-templates-grid {
        grid-template-columns: 1fr;
    }

    .ht-toolbar {
        flex-direction: column;
    }

    .ht-search {
        width: 100%;
    }

    .ht-progress-card {
        padding: 20px;
    }

    .ht-progress-stats {
        gap: 20px;
    }

    .ht-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ht-detail-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .ht-modal-content {
        max-width: calc(100% - 32px);
        margin: 0 16px;
    }

    .ht-range-selector {
        width: 100%;
        justify-content: space-between;
    }
}