:root {
  --bg: #14151b;
  --card: #1c1e26;
  --text: #f5f4f2;
  --text-muted-50: rgba(245, 244, 242, 0.5);
  --text-muted-45: rgba(245, 244, 242, 0.45);
  --text-muted-40: rgba(245, 244, 242, 0.4);
  --text-muted-35: rgba(245, 244, 242, 0.35);
  --text-muted-30: rgba(245, 244, 242, 0.3);
  --border: rgba(255, 255, 255, 0.05);
  --border-strong: rgba(255, 255, 255, 0.08);
  --track: rgba(255, 255, 255, 0.08);
  --blue: #3f7fe0;
  --amber: #e0a83f;
  --teal: #33b6a0;
  --orange: #e0704a;
  --tab-bg: #1a1b22;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
}

a {
  color: inherit;
}

input {
  font-family: inherit;
}

input::placeholder {
  color: rgba(245, 244, 242, 0.35);
}

input:focus {
  outline: none;
  border-color: var(--blue) !important;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.screen {
  padding: 20px 20px 110px;
  min-height: 100vh;
}

.screen-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 2px;
}

.screen-subtitle {
  font-size: 12px;
  color: var(--text-muted-50);
  margin-bottom: 16px;
}

/* Cards & stats */

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid var(--border);
}

.stat-row {
  display: flex;
  gap: 8px;
}

.stat-tile {
  flex: 1;
  background: var(--card);
  border-radius: 14px;
  padding: 10px 12px;
}

.stat-value {
  font-size: 16px;
  font-weight: 800;
}

.stat-label {
  font-size: 9px;
  color: var(--text-muted-45);
  font-weight: 700;
  margin-top: 2px;
  letter-spacing: 0.3px;
}

/* Buttons */

.btn {
  text-align: center;
  padding: 13px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}

.btn-disabled {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted-35);
  cursor: default;
}

.btn-danger-text {
  text-align: center;
  color: var(--orange);
  font-weight: 700;
  font-size: 14px;
  padding: 10px;
  cursor: pointer;
}

/* Inputs */

.text-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
}

.field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted-50);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

/* Toggle switch */

.toggle-switch {
  width: 44px;
  height: 26px;
  border-radius: 14px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  border: none;
  padding: 0;
}

.toggle-knob {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  transition: left 0.15s;
}

/* Tab bar */

.tab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: 78px;
  background: var(--tab-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  padding-bottom: 20px;
  z-index: 25;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.tab-label {
  font-size: 10px;
  font-weight: 700;
}

/* FAB */

.fab {
  position: fixed;
  right: max(20px, calc(50% - 240px + 20px));
  bottom: 92px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(63, 127, 224, 0.4);
  cursor: pointer;
  z-index: 30;
  border: none;
}

/* Toast */

@keyframes toastPop {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.9); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid rgba(63, 127, 224, 0.4);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toastPop 0.25s ease;
  white-space: nowrap;
}

/* Rating dots */

.rating-dots {
  display: flex;
  gap: 4px;
}

.rating-dot {
  flex: 1;
  height: 16px;
  border-radius: 3px;
  cursor: pointer;
  border: none;
  padding: 0;
}

/* Badges / streak grid (Progress screen) */

.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.badge-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid;
}

.badge-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.streak-row {
  display: flex;
  gap: 4px;
}

.streak-cell {
  flex: 1;
  height: 8px;
  border-radius: 3px;
}

/* Icon shape swatches / picker */

.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

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

.shape-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}

.option-row {
  display: grid;
  gap: 8px;
}

.option-row-2 { grid-template-columns: repeat(2, 1fr); }
.option-row-7 { grid-template-columns: repeat(7, 1fr); }

.chip {
  text-align: center;
  padding: 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.routine-row {
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.icon-slot {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#blazor-error-ui {
  background: #b32121;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
  color: #fff;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}
