/* Habits APP - Refined Apple Components (+1 Size Up) */

/* Category Group */
.category-group {
  margin-bottom: 22px;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
  padding: 0 4px;
}

.category-title {
  font-size: 15px; /* Scaled 1 size up */
  font-weight: 750;
  letter-spacing: 0.2px;
  color: var(--text-primary);
}

.category-count {
  font-size: 13px; /* Scaled 1 size up */
  color: var(--text-secondary);
  background: rgba(125, 125, 125, 0.14);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

/* Habit Card */
.habit-card {
  background: var(--surface-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.habit-card:active {
  transform: scale(0.985);
}

.habit-card.completed {
  border-color: rgba(0, 169, 230, 0.42);
  background: rgba(0, 169, 230, 0.12);
}

.habit-info {
  display: flex;
  align-items: center;
  gap: 13px;
  flex: 1;
  min-width: 0;
}

.habit-icon-tag {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(125, 125, 125, 0.14);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.habit-icon-tag svg {
  width: 22px;
  height: 22px;
  stroke: var(--accent-primary);
}

.habit-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.habit-name-wrapper {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 0;
  row-gap: 2px;
  min-width: 0;
}

.habit-name {
  font-size: 17.5px; /* Scaled 1 size up */
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.habit-target-inline {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.habit-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px; /* Scaled 1 size up */
  color: var(--text-secondary);
  line-height: 1.35;
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: rgba(255, 69, 69, 0.16);
  border: 1px solid rgba(255, 69, 69, 0.38);
  color: #ff4545;
  border-radius: var(--radius-pill);
  font-size: 12.5px; /* Scaled 1 size up */
  font-weight: 700;
}

.streak-pill svg {
  width: 13px;
  height: 13px;
  stroke: #ff4545;
}

/* Action Inputs */
.habit-action-area {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* 1. Toggle Button */
.toggle-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(125, 125, 125, 0.38);
  background: rgba(125, 125, 125, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-btn:active {
  transform: scale(0.88);
}

.toggle-btn.checked {
  background: var(--brand-blue, #00a9e6);
  border-color: var(--brand-blue, #00a9e6);
  box-shadow: 0 0 14px rgba(0, 169, 230, 0.55);
}

.toggle-btn svg {
  width: 20px;
  height: 20px;
  stroke: #ffffff;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toggle-btn.checked svg {
  opacity: 1;
  transform: scale(1);
}

/* 2. Rating Widget (Stars) */
.rating-widget {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(125, 125, 125, 0.14);
  padding: 5px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.rating-star {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rating-star:active {
  transform: scale(0.85);
}

.rating-star svg {
  width: 20px;
  height: 20px;
  stroke: rgba(125, 125, 125, 0.5);
  fill: transparent;
  transition: all 0.12s ease;
}

.rating-star.active svg {
  stroke: var(--brand-yellow-dark, #e6b800);
  fill: var(--brand-yellow, #fff13e);
  filter: drop-shadow(0 0 4px rgba(255, 241, 62, 0.55));
}

/* 3. Counter Widget (- / Value / +) */
.counter-widget {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(125, 125, 125, 0.14);
  padding: 4px 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.counter-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(125, 125, 125, 0.18);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px; /* Scaled 1 size up */
  font-weight: 750;
  transition: all var(--transition-fast);
}

.counter-btn:active {
  transform: scale(0.88);
  background: rgba(125, 125, 125, 0.3);
}

.counter-display {
  min-width: 48px;
  text-align: center;
  font-size: 16px; /* Scaled 1 size up */
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.counter-unit {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 2px;
}

/* Heatmap View */
.heatmap-header-card {
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.heatmap-container {
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 20px;
}

.heatmap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.heatmap-title {
  font-size: 18px; /* Scaled 1 size up */
  font-weight: 750;
  color: var(--text-primary);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.heatmap-stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-box {
  background: rgba(125, 125, 125, 0.12);
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  padding: 10px 8px;
  text-align: center;
}

/* Individual Habit Heatmap Cards */
.habit-heatmap-card {
  background: var(--surface-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.habit-heatmap-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.habit-heatmap-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.habit-heatmap-rate {
  font-size: 17px;
  font-weight: 800;
  color: var(--brand-yellow, #fff13e);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.habit-heatmap-done {
  font-size: 12px;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 21px; /* Scaled 1 size up */
  font-weight: 800;
  color: var(--text-primary);
}

.stat-label {
  font-size: 12px; /* Scaled 1 size up */
  color: var(--text-secondary);
  margin-top: 2px;
}

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

.heatmap-day-label {
  text-align: center;
  font-size: 12px; /* Scaled 1 size up */
  font-weight: 650;
  color: var(--text-muted);
  padding-bottom: 5px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  background: rgba(125, 125, 125, 0.08);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px; /* Scaled 1 size up */
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.12s ease;
}

.heatmap-cell:active {
  transform: scale(0.9);
}

.heatmap-cell.level-1 {
  background: rgba(255, 241, 62, 0.45);
  border-color: rgba(230, 184, 0, 0.6);
  color: #1e293b;
  font-weight: 700;
}

.heatmap-cell.level-2 {
  background: rgba(0, 169, 230, 0.68);
  border-color: rgba(0, 169, 230, 0.85);
  color: #ffffff;
}

.heatmap-cell.level-3 {
  background: var(--brand-blue, #00a9e6);
  border-color: #008ec4;
  color: #ffffff;
}

.heatmap-cell.today {
  box-shadow: 0 0 0 2.5px var(--brand-yellow, #fff13e);
}

/* iOS Bottom Sheet Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: var(--mobile-max-width);
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface-modal);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-top: 1px solid var(--border-light);
  border-radius: var(--radius-sheet);
  padding: 16px 20px max(24px, env(safe-area-inset-bottom, 20px)) 20px;
  box-shadow: var(--shadow-sheet);
  transform: translateY(100%);
  transition: transform var(--transition-sheet);
}

.modal-overlay.open .modal-card {
  transform: translateY(0);
}

/* iOS Drag Handle Bar */
.sheet-handle {
  width: 38px;
  height: 4px;
  background: rgba(125, 125, 125, 0.35);
  border-radius: 2px;
  margin: 0 auto 14px auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 18px; /* Scaled 1 size up */
  font-weight: 750;
  color: var(--text-primary);
}

.modal-close-btn {
  background: rgba(125, 125, 125, 0.15);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close-btn:active {
  transform: scale(0.9);
}

.modal-close-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 14px; /* Scaled 1 size up */
  font-weight: 650;
  color: var(--text-secondary);
}

.form-input, .form-select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(125, 125, 125, 0.12);
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15.5px; /* Scaled 1 size up */
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
}

.form-select option {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* Toast */
.toast-container {
  position: fixed;
  top: max(20px, env(safe-area-inset-top, 20px));
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 380px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  font-size: 15px; /* Scaled 1 size up */
  font-weight: 650;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastFadeDown 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent-success);
}

@keyframes toastFadeDown {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Settings Page Card & Sections */
.settings-section {
  background: var(--surface-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.settings-section-title {
  font-size: 16px;
  font-weight: 750;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-section-title svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent-primary);
}

.lang-segmented-control {
  display: flex;
  background: rgba(125, 125, 125, 0.14);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 6px;
}

.lang-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 650;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-btn.active {
  background: var(--brand-yellow, #fff13e);
  color: #1e293b;
  font-weight: 750;
  box-shadow: 0 2px 8px rgba(255, 241, 62, 0.4);
}

.bg-mode-segmented-control {
  display: flex;
  background: rgba(125, 125, 125, 0.14);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 6px;
  margin-bottom: 12px;
}

.bg-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 650;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bg-mode-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}

.bg-mode-btn.active {
  background: var(--brand-yellow, #fff13e);
  color: #1e293b;
  font-weight: 750;
  box-shadow: 0 2px 8px rgba(255, 241, 62, 0.4);
}

.bg-active-badge-note {
  font-size: 12.5px;
  color: var(--text-primary);
  font-weight: 650;
  margin-bottom: 14px;
  padding: 7px 12px;
  background: rgba(0, 169, 230, 0.12);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 169, 230, 0.28);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Trends View */
.trends-header-card {
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.trends-header-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trends-title {
  font-size: 18px;
  font-weight: 750;
  color: var(--text-primary);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.trends-subtitle {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.trend-range-selector {
  display: flex;
  background: rgba(125, 125, 125, 0.14);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 4px;
}

.trend-range-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 650;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.trend-range-btn.active {
  background: var(--brand-yellow, #fff13e);
  color: #1e293b;
  font-weight: 750;
  box-shadow: 0 2px 8px rgba(255, 241, 62, 0.4);
}

/* Individual Habit Trend Card */
.habit-trend-card {
  background: var(--surface-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.habit-trend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.habit-trend-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.habit-trend-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid;
  background: rgba(125, 125, 125, 0.1);
  flex-shrink: 0;
}

.habit-trend-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: rgba(125, 125, 125, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 12px;
}

.trend-stat-item {
  text-align: center;
}

.trend-stat-val {
  font-size: 14px;
  font-weight: 750;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.trend-stat-lbl {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.habit-chart-wrapper {
  width: 100%;
  overflow: hidden;
}

.habit-svg-chart {
  display: block;
  overflow: visible;
}

/* Enhanced Text Legibility for Ultra-translucent Background */
.habit-name, .category-title, .settings-section-title, .stat-value, .modal-title, .trends-title, .heatmap-title {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

[data-theme="light"] .habit-name,
[data-theme="light"] .category-title,
[data-theme="light"] .settings-section-title,
[data-theme="light"] .stat-value,
[data-theme="light"] .modal-title,
[data-theme="light"] .trends-title,
[data-theme="light"] .heatmap-title {
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
}

/* Habit Card Left Stamp Link */
.habit-card-stamp-link {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.habit-card-stamp-link:active {
  transform: scale(0.9);
}

.habit-card-stamp-img {
  width: 38px;
  height: 38px;
  aspect-ratio: 1;
  border-radius: 9px;
  object-fit: cover;
  border: 1.5px solid var(--border-subtle);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  display: block;
}

@keyframes highlightPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 241, 62, 0.7); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(255, 241, 62, 0); }
  100% { transform: scale(1); box-shadow: none; }
}

.highlight-pulse {
  animation: highlightPulse 1.2s ease;
  border-color: var(--brand-yellow, #fff13e) !important;
}

/* Square Stamp Toggle Button */
.toggle-btn.square-stamp-btn {
  position: relative;
  width: 44px;
  height: 44px;
  aspect-ratio: 1;
  border-radius: 11px;
  border: 2px solid rgba(125, 125, 125, 0.38);
  background-color: rgba(125, 125, 125, 0.08);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: all var(--transition-fast);
}

.toggle-btn.square-stamp-btn:active {
  transform: scale(0.92);
}

.toggle-btn.square-stamp-btn.checked {
  border-color: var(--brand-yellow, #fff13e);
  box-shadow: 0 0 14px rgba(255, 241, 62, 0.45);
  transform: scale(1.04);
}

.toggle-btn.square-stamp-btn.pressing {
  transform: scale(0.86);
  filter: brightness(0.82);
  box-shadow: 0 0 0 3px rgba(255, 69, 69, 0.65), 0 0 16px rgba(255, 69, 69, 0.4);
  transition: transform 0.55s ease, box-shadow 0.55s ease, filter 0.55s ease;
}

/* Badge for multiple Yes count */
.stamp-count-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--brand-yellow, #fff13e);
  color: #0b0f17;
  font-size: 11px;
  font-weight: 800;
  min-width: 19px;
  height: 19px;
  line-height: 19px;
  padding: 0 4px;
  border-radius: 9999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  border: 1.5px solid #0b0f17;
  text-align: center;
  pointer-events: none;
  animation: badgePop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badgePop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Heatmap cell with square stamp */
.heatmap-cell.has-stamp {
  padding: 0;
  overflow: hidden;
  border-color: rgba(255, 241, 62, 0.55);
  background: transparent;
}

.heatmap-cell-stamp {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.heatmap-cell-badge {
  position: absolute;
  bottom: 1px;
  right: 1px;
  background: rgba(11, 15, 23, 0.88);
  color: var(--brand-yellow, #fff13e);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 3px;
  pointer-events: none;
  border: 0.5px solid rgba(255, 241, 62, 0.3);
}

/* Stamp Customization UI in Settings */
.stamp-preview-container {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: rgba(125, 125, 125, 0.1);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.stamp-preview-live {
  width: 52px;
  height: 52px;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2px solid var(--brand-yellow, #fff13e);
  overflow: hidden;
  box-shadow: 0 3px 12px rgba(255, 241, 62, 0.35);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stamp-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stamp-preview-mini {
  width: 34px;
  height: 34px;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1.5px solid var(--brand-yellow, #fff13e);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stamp-preview-mini-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stamp-preset-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.stamp-preset-card {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(125, 125, 125, 0.12);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 6px;
  transition: all var(--transition-fast);
}

.stamp-preset-card.active {
  border-color: var(--brand-yellow, #fff13e);
  box-shadow: 0 0 12px rgba(255, 241, 62, 0.5);
  background: rgba(255, 241, 62, 0.12);
}

.stamp-preset-img {
  width: 32px;
  height: 32px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
}

.stamp-preset-label {
  font-size: 10.5px;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: center;
}

/* Habit Manage Stamp Button */
.btn-habit-stamp-edit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: var(--radius-sm);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.btn-habit-stamp-edit:active {
  transform: scale(0.92);
}

.habit-manage-stamp-thumb {
  width: 38px;
  height: 38px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1.5px solid var(--brand-yellow, #fff13e);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  display: block;
}

.habit-manage-stamp-tip {
  font-size: 10px;
  color: #000000 !important;
  background: var(--brand-yellow, #fff13e);
  font-weight: 800;
  letter-spacing: -0.2px;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* Stamp Gallery Management (Settings) */
.stamp-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.stamp-gallery-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(125, 125, 125, 0.12);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 6px;
  transition: all var(--transition-fast);
}

.stamp-gallery-card:hover {
  border-color: var(--brand-blue);
  background: rgba(0, 169, 230, 0.08);
}

.stamp-gallery-thumb {
  width: 44px;
  height: 44px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.stamp-gallery-name {
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 600;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stamp-gallery-badge {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.stamp-gallery-badge.builtin {
  background: rgba(0, 169, 230, 0.2);
  color: #00a9e6;
}

.stamp-gallery-badge.custom {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.btn-stamp-delete {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-danger, #ef4444);
  color: #ffffff;
  border: 1.5px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: transform var(--transition-fast);
}

.btn-stamp-delete:active {
  transform: scale(0.85);
}

.btn-stamp-delete svg {
  width: 11px;
  height: 11px;
}

/* Habit Reordering & Drag Styles */
.habit-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(125, 125, 125, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}

.habit-manage-row.is-dragging {
  opacity: 0.65;
  border-color: var(--brand-yellow);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transform: scale(1.02);
  z-index: 10;
}

.habit-manage-row.drag-over {
  border-top: 2.5px solid var(--brand-yellow);
}

.habit-manage-row.is-inactive {
  opacity: 0.6;
  border-style: dashed;
}

.habit-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  cursor: grab;
  touch-action: none;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.habit-drag-handle:active {
  cursor: grabbing;
  color: var(--brand-yellow);
}

.habit-drag-handle svg {
  width: 18px;
  height: 18px;
}

/* Habit Status Badges */
.habit-status-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.habit-status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.35);
}

.habit-status-badge.inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
}

/* Edit Habit Button */
.btn-habit-edit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-habit-edit:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
  background: rgba(0, 169, 230, 0.1);
}

/* Custom Rating Star / Flaticon Icons */
.rating-custom-icon {
  width: 26px;
  height: 26px;
  aspect-ratio: 1;
  object-fit: contain;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.rating-custom-icon.inactive {
  filter: grayscale(100%) opacity(0.35);
  transform: scale(0.92);
}

.rating-custom-icon.active {
  filter: drop-shadow(0 2px 8px rgba(255, 241, 62, 0.65));
  transform: scale(1.15);
}

.star-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.star-input-badge {
  font-size: 11.5px;
  font-weight: 750;
  color: #000000 !important;
  background: var(--brand-yellow, #fff13e);
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.2px;
}

.star-input-preview {
  width: 30px;
  height: 30px;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(125, 125, 125, 0.1);
  flex-shrink: 0;
}

.star-input-fa-preview {
  width: 32px;
  height: 32px;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(125, 125, 125, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--brand-yellow);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.rating-custom-fa {
  font-size: 20px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.rating-custom-fa.inactive {
  color: rgba(255, 255, 255, 0.25);
  transform: scale(0.92);
}

[data-theme="light"] .rating-custom-fa.inactive {
  color: rgba(0, 0, 0, 0.22);
}

.rating-custom-fa.active {
  color: var(--brand-yellow);
  filter: drop-shadow(0 0 6px rgba(255, 241, 62, 0.7));
  transform: scale(1.15);
}


