:root{
  --bg: #000000;
  --panel: rgba(18, 18, 20, 0.92);
  --panel2: rgba(28, 28, 30, 0.96);
  --line: rgba(255,255,255,0.10);
  --text: #f5f5f7;
  --muted: #c0c0c8;
  --soft: #a9a9b3;
  --brand: #0a84ff;
  --good: #32d74b;
  --warn: #ffd60a;
  --shadow: 0 14px 40px rgba(0,0,0,0.28);
  --radius: 22px;
  --radius-sm: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  width: 100%;
  background:
    radial-gradient(circle at top, rgba(10,132,255,0.14), transparent 25%),
    linear-gradient(180deg, #000 0%, #0a0a0d 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
  overscroll-behavior: none;
  touch-action: manipulation;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
body {
  padding: env(safe-area-inset-top) 12px 0;
}
body.modal-open {
  overflow: hidden;
}
.app {
  max-width: 430px;
  margin: 0 auto;
  padding: 10px 0 calc(env(safe-area-inset-bottom) + 18px);
  height: calc(100dvh - env(safe-area-inset-top));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overflow-x: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
@supports (height: 100svh) {
  .app {
    height: calc(100svh - env(safe-area-inset-top));
  }
}
.app::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.app-splash {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: env(safe-area-inset-top) 20px calc(env(safe-area-inset-bottom) + 20px);
  background:
    radial-gradient(circle at top, rgba(10,132,255,0.2), transparent 28%),
    linear-gradient(180deg, #000 0%, #0a0a0d 100%);
  opacity: 1;
  visibility: visible;
  transition: opacity 260ms ease, visibility 260ms ease;
}
.app-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.app-splash-card {
  width: min(86vw, 280px);
  display: grid;
  justify-items: center;
  gap: 12px;
}
.app-splash-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}
.app-splash-name {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f5f5f7;
}
.app-splash-line {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.1);
}
.app-splash-line span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a84ff, #32d74b);
  animation: splash-move 1.05s ease-in-out infinite;
}
@keyframes splash-move {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
@media (prefers-reduced-motion: reduce) {
  .app-splash-line span {
    animation: none;
    transform: translateX(0);
    width: 100%;
  }
}
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.landing {
  display: grid;
  gap: 22px;
}
.metric-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.metric-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(18,18,20,0.96), rgba(12,12,14,0.93));
  box-shadow: var(--shadow);
}
.metric-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}
.metric-head-main {
  align-items: center;
}
.metric-head-copy {
  min-width: 0;
}
.metric-head-kicker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hidden {
  display: none !important;
}
.gold-zone-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,214,10,0.48);
  background: rgba(255,214,10,0.16);
  color: #ffe08a;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ui-kicker,
.section-label,
.modal-kicker {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b7cdfc;
}
.metric-card-main {
  display: grid;
  gap: 18px;
}
.metric-value {
  margin-top: 20px;
  font-size: clamp(4rem, 6vw, 6.8rem);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.08em;
  text-align: center;
}
.metric-tag {
  width: max-content;
  max-width: 100%;
  margin: 26px auto 12px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(10,132,255,0.34);
  background: rgba(10,132,255,0.10);
  color: #64a8ff;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: inset 0 0 0 1px rgba(10,132,255,0.06);
}
.metric-main-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
}
.metric-primary {
  text-align: center;
}
.metric-primary .metric-value {
  margin-top: 6px;
  text-align: center;
  font-size: clamp(3.9rem, 11vw, 5.2rem);
}
.metric-value-ratio {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}
.metric-value-ratio #daysGoal {
  font-size: 0.55em;
  font-weight: 700;
  color: #b7cdfc;
  letter-spacing: -0.02em;
}
.metric-value-ratio .metric-value-sep {
  font-size: 0.55em;
  font-weight: 700;
  color: #8ca2c7;
  letter-spacing: -0.01em;
}
.metric-value-caption {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  color: #b7cdfc;
}
.metric-loop-summary {
  margin-top: 8px;
  display: grid;
  gap: 3px;
  font-size: 0.78rem;
  color: #9db2d6;
}
.metric-loop-summary.goal-reached {
  color: #ffd873;
}
.metric-ring-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.progress-ring {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--brand) calc(var(--progress) * 1%), rgba(255,255,255,0.12) 0);
  padding: 4px;
  box-shadow: var(--shadow);
  position: relative;
}
.progress-ring::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: rgba(12,12,14,0.96);
}
.progress-ring span {
  position: relative;
  z-index: 1;
  font-size: 1.6rem;
  font-weight: 700;
  color: #4e96ff;
}
.progress-ring.goal-reached {
  background: conic-gradient(#ffd60a calc(var(--progress) * 1%), rgba(255,255,255,0.12) 0);
}
.progress-ring.goal-reached span {
  color: #ffd60a;
}
#daysElapsed.goal-reached {
  color: #ffd873;
  text-shadow: 0 0 18px rgba(255,214,10,0.25);
}
.loop-counter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  min-height: 24px;
  max-width: 220px;
  padding: 5px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,214,10,0.5);
  background: rgba(255,214,10,0.14);
  color: #ffe08a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}
.metric-card-main .progress-line {
  margin-top: 8px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}
.progress-summary {
  margin-top: 8px;
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.35;
}
.progress-summary-status {
  text-align: center;
}
.progress-summary .value-const {
  color: #4e96ff;
  font-weight: 700;
}
.progress-summary.goal-reached .value-const {
  color: #ffd60a;
  text-shadow: 0 0 10px rgba(255,214,10,0.24);
}
.progress-summary.goal-reached #progressSummaryConstLabel {
  color: #ffe08a;
}
.progress-summary .value-stumble {
  color: #ff6a63;
  font-weight: 700;
}
.banner, .card, .calendar-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), rgba(12,12,14,0.88));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
  min-width: 0;
}
.mode-alert {
  margin-bottom: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,59,48,0.30);
  background: linear-gradient(180deg, rgba(255,59,48,0.15), rgba(255,255,255,0.04));
  color: #ffd9d5;
  display: none;
}
.mode-alert strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}
.mode-alert p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}
.top {
  padding: 18px;
  overflow: hidden;
}
.section-label { margin-bottom: 8px; }
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.stat {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 14px;
  min-height: 92px;
}
.stat-label {
  display: block;
  font-size: 11px;
  color: var(--soft);
  margin-bottom: 6px;
}
.stat-value {
  display: block;
  font-size: 36px;
  line-height: 1;
  letter-spacing: -0.06em;
  font-weight: 700;
}
.progress-wrap { margin-top: 12px; }
.progress-line {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--good));
  transition: width 0.25s ease;
}
.mini-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.mini-pill {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: var(--text);
  text-align: center;
}
.card {
  padding: 16px;
  margin-top: 12px;
  min-width: 0;
  overflow: hidden;
}
.streak-toolbar {
  margin-top: 4px;
  margin-bottom: 12px;
  overflow: visible;
  position: relative;
  z-index: 120;
}
.streak-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.streak-toolbar-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}
.streak-toolbar-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.streak-toolbar-title {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 270px;
}
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  color: #dbe8ff;
  font-size: 14px;
}
.notify-bell-btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  position: relative;
}
.notify-bell-icon {
  font-size: 1rem;
}
.notify-bell-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  background: #ff453a;
  color: #fff;
  border: 1px solid rgba(0,0,0,0.3);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}
.notify-bell-badge.hidden {
  display: none;
}
.streak-toolbar-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.meta-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 0.82rem;
  padding: 10px 8px;
}
.streak-picker {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}
.streak-picker-trigger {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  position: relative;
}
.streak-picker-icon,
.streak-picker-icon::before,
.streak-picker-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #dbe8ff;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.streak-picker-icon {
  position: relative;
}
.streak-picker-icon::before,
.streak-picker-icon::after {
  content: "";
  position: absolute;
  left: 0;
}
.streak-picker-icon::before {
  top: -6px;
}
.streak-picker-icon::after {
  top: 6px;
}
.streak-picker-trigger:focus {
  border-color: rgba(10,132,255,0.7);
  box-shadow: 0 0 0 3px rgba(10,132,255,0.12);
}
.streak-picker-open .streak-picker-icon {
  background: transparent;
}
.streak-picker-open .streak-picker-icon::before {
  transform: translateY(6px) rotate(45deg);
}
.streak-picker-open .streak-picker-icon::after {
  transform: translateY(-6px) rotate(-45deg);
}
.streak-picker-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.streak-picker-drawer {
  position: absolute;
  left: 8px;
  top: var(--streak-drawer-top, calc(env(safe-area-inset-top) + 8px));
  width: min(86vw, 360px);
  height: var(--streak-drawer-height, calc(100dvh - env(safe-area-inset-top) - 18px));
  background: linear-gradient(180deg, rgba(18,18,20,0.99), rgba(12,12,14,0.99));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(0,0,0,0.45);
  overflow: hidden;
  transform: translateX(calc(-100% - 20px));
  transition: transform 0.28s ease;
  display: grid;
  grid-template-rows: auto 1fr;
  pointer-events: none;
}
.streak-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.streak-picker-head-title {
  font-size: 1rem;
  color: #dbe8ff;
  letter-spacing: 0.02em;
  font-weight: 700;
}
.streak-picker-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
}
.streak-picker-open {
  pointer-events: auto;
}
.streak-picker-open .streak-picker-backdrop {
  opacity: 1;
  pointer-events: auto;
}
.streak-picker-open .streak-picker-drawer {
  transform: translateX(0);
  pointer-events: auto;
}
.streak-picker-menu {
  padding: 10px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  align-content: start;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
body.streak-drawer-open {
  overflow: hidden;
}
.streak-picker-item {
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
}
.streak-picker-item.active {
  border-color: rgba(10,132,255,0.34);
  background: rgba(10,132,255,0.16);
  color: #64a8ff;
}
.streak-picker-item.streak-picker-item-add {
  border-style: dashed;
}
.streak-picker-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.streak-picker-menu::-webkit-scrollbar {
  display: none;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-width: 0;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field.full {
  grid-column: 1 / -1;
}
.field label {
  font-size: 12px;
  color: var(--muted);
}
.field input, .field textarea, .field select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 12px 12px;
  outline: none;
  font: inherit;
  font-size: 14px;
}
.field select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23a1a1aa' d='M7.4 9.4 12 14l4.6-4.6 1.4 1.4-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}
.field input[type="date"] {
  position: relative;
  text-align: left;
  direction: ltr;
  min-height: 44px;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23a1a1aa' d='M7 2h2v2h6V2h2v2h3a2 2 0 0 1 2 2v12a4 4 0 0 1-4 4H6a4 4 0 0 1-4-4V6a2 2 0 0 1 2-2h3V2zm13 8H4v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}
.field input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}
.field input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field input[type="number"] {
  -moz-appearance: textfield;
}
.field textarea {
  min-height: 72px;
  resize: none;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: rgba(10,132,255,0.7);
  box-shadow: 0 0 0 3px rgba(10,132,255,0.12);
}
.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.about-trigger {
  grid-column: 1 / -1;
}
button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
}
button.secondary {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
}
button.danger {
  background: rgba(255, 69, 58, 0.16);
  border: 1px solid rgba(255, 69, 58, 0.28);
  color: #ff8a84;
}
button.danger:hover {
  background: rgba(255, 69, 58, 0.22);
}
.streak-picker-trigger,
.streak-picker-item {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.streak-picker-item.active {
  border-color: rgba(10,132,255,0.34);
  background: rgba(10,132,255,0.16);
  color: #64a8ff;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: saturate(0.6);
}
.chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.chip {
  padding: 9px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}
.calendar-panel {
  margin-top: 12px;
  padding: 22px;
  min-width: 0;
  overflow: hidden;
}
.calendar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.calendar-month {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.05em;
}
.calendar-nav {
  display: flex;
  gap: 8px;
}
.calendar-nav button {
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--text);
  border-radius: 999px;
}
.dow, .days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
.dow {
  margin-bottom: 10px;
}
.dow div {
  text-align: center;
  color: var(--soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 0;
}
.day {
  min-height: 58px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 6px;
  cursor: pointer;
}
.day.empty {
  background: transparent;
  border-style: dashed;
  opacity: 0.15;
}
.day .num {
  font-size: 12px;
  color: #e8e8ea;
  font-weight: 600;
  z-index: 1;
}
.day .cross {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--good);
  font-size: 20px;
  font-weight: 700;
  user-select: none;
}
.day.completed .cross {
  color: var(--good);
}
.day.failed {
  border-color: rgba(255, 69, 58, 0.72);
  background: rgba(255, 69, 58, 0.12);
}
.day.failed .num {
  color: #ffb0ab;
}
.day.failed .cross {
  color: #ff6a63;
}
.day.blocked {
  background: rgba(255,255,255,0.02);
  border-style: dashed;
  opacity: 0.28;
}
.day.blocked .num {
  color: rgba(232, 232, 234, 0.55);
}
.day.blocked .cross {
  display: none;
}
.day.today {
  border-color: rgba(10,132,255,0.90);
  background: rgba(10,132,255,0.12);
}
.day.start {
  border-color: rgba(50,215,75,0.65);
  background: rgba(50,215,75,0.14);
}
.day.goal {
  border-color: rgba(10,132,255,0.65);
  background: rgba(10,132,255,0.08);
}
.day.surpassed {
  border-color: rgba(255,214,10,0.72);
  border-style: dashed;
  background: rgba(255,214,10,0.15);
}
.day.surpassed .num {
  color: #ffe8a6;
}
.day.surpassed .cross {
  color: #ffd60a;
  text-shadow: 0 0 10px rgba(255,214,10,0.32);
  font-size: 22px;
}
.day.failed.surpassed {
  border-color: rgba(255, 69, 58, 0.72);
  border-style: dashed;
  background: rgba(255, 69, 58, 0.12);
}
.day.failed.surpassed .cross {
  color: #ff6a63;
}
.day.future {
  opacity: 0.72;
}
.config-panel {
  margin-top: 12px;
}
.config-panel summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), rgba(12,12,14,0.88));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.config-panel summary::-webkit-details-marker { display: none; }
.config-panel summary::after {
  content: "›";
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--soft);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.2s ease, background 0.2s ease;
}
.config-panel[open] summary::after {
  transform: rotate(90deg);
  background: rgba(255,255,255,0.08);
}
.config-body {
  margin-top: 10px;
  min-width: 0;
  overflow: hidden;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%) translateY(120%);
  background: rgba(28, 28, 30, 0.96);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: transform 0.22s ease;
  z-index: 50;
  max-width: min(92vw, 430px);
  text-align: center;
  font-size: 13px;
}
.toast.show { transform: translateX(-50%) translateY(0); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  z-index: 13000;
  backdrop-filter: blur(6px);
}
.modal-backdrop.show {
  display: flex;
}
.modal-card {
  width: min(100%, 420px);
  max-width: 420px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(28,28,30,0.98), rgba(18,18,20,0.98));
  box-shadow: 0 24px 70px rgba(0,0,0,0.45);
  padding: 18px;
  overflow: hidden;
  min-width: 0;
}
.modal-kicker { margin-bottom: 8px; }
.modal-title {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.03em;
}
.modal-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.home-install-steps {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #d1d1d6;
  font-size: 0.86rem;
  line-height: 1.45;
}
.home-install-steps li + li {
  margin-top: 5px;
}
#homeInstallModal .modal-actions {
  grid-template-columns: 1fr;
}
.about-modal-card {
  text-align: left;
}
.about-version {
  margin-top: 6px;
  color: #b7cdfc;
  font-size: 0.92rem;
  font-weight: 600;
}
.about-link {
  color: #64a8ff;
  text-decoration: none;
}
.about-link:hover {
  text-decoration: underline;
}
.about-policy {
  margin-top: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}
.about-policy strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.about-policy ul {
  margin: 0;
  padding-left: 16px;
}
.about-policy li + li {
  margin-top: 4px;
}
.about-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.about-link-chip {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  text-decoration: none;
  border-radius: 11px;
  padding: 8px 10px;
  color: #dbeafe;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.1;
}
.about-link-chip:hover {
  background: rgba(255,255,255,0.08);
}
.legal-modal-card {
  max-height: min(84vh, 700px);
  display: flex;
  flex-direction: column;
}
.legal-modal-body {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  overflow-y: auto;
}
.legal-modal-body p {
  margin: 0;
  color: #d1d1d6;
  font-size: 0.9rem;
  line-height: 1.5;
}
.legal-modal-body p + p {
  margin-top: 10px;
}
.legal-modal-body a {
  color: #7ab6ff;
}
.legal-modal-body h3 {
  margin: 12px 0 6px;
  color: #dbeafe;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}
.legal-modal-body ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.legal-modal-body li {
  color: #d1d1d6;
  line-height: 1.5;
}
.legal-modal-body li + li {
  margin-top: 4px;
}
.feedback-modal-card {
  max-height: min(84vh, 700px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.feedback-modal-backdrop {
  z-index: 16000;
  align-items: flex-end;
  padding: max(14px, env(safe-area-inset-top))
    12px
    max(14px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.72);
}
.feedback-modal-backdrop .feedback-modal-card {
  width: min(100%, 430px);
  max-height: min(70dvh, 620px);
  border-radius: 24px;
}
.notification-panel-backdrop {
  z-index: 15500;
  align-items: flex-end;
  padding: max(14px, env(safe-area-inset-top))
    12px
    max(14px, env(safe-area-inset-bottom));
}
.notification-panel-card {
  width: min(100%, 430px);
  max-height: min(62dvh, 560px);
  display: flex;
  flex-direction: column;
}
.notification-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.notification-row {
  width: 100%;
  text-align: left;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.notification-row:hover {
  border-color: rgba(131, 177, 255, 0.45);
  background: rgba(255,255,255,0.07);
}
.notification-row:focus-visible {
  outline: 2px solid rgba(58, 154, 255, 0.75);
  outline-offset: 2px;
}
.notification-row:active {
  transform: scale(0.99);
}
.notification-row-main {
  min-width: 0;
}
.notification-row-title {
  display: block;
  font-size: 0.94rem;
  font-weight: 650;
}
.notification-row-desc {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}
.notification-row-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.notification-row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(58, 154, 255, 0.45);
  background: rgba(58, 154, 255, 0.16);
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.notification-row-chevron {
  color: rgba(255, 255, 255, 0.68);
  font-size: 1.04rem;
  font-weight: 700;
  line-height: 1;
}
.notification-empty {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}
.goal-celebration-backdrop {
  z-index: 17000;
}
.goal-celebration-card {
  width: min(100%, 420px);
  max-height: min(58dvh, 480px);
  text-align: center;
}
.goal-celebration-icon {
  width: 72px;
  height: 72px;
  margin: 2px auto 10px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: radial-gradient(circle at 32% 28%, rgba(255,214,10,0.34), rgba(255,214,10,0.08));
  border: 1px solid rgba(255,214,10,0.45);
  box-shadow: 0 0 0 0 rgba(255,214,10,0.25);
  animation: goal-pulse 1.8s ease-in-out infinite;
}
@keyframes goal-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,214,10,0.25); }
  70% { transform: scale(1.06); box-shadow: 0 0 0 12px rgba(255,214,10,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,214,10,0); }
}
.feedback-form {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}
.rating-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}
.rating-fieldset legend {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.rating-stars {
  display: flex;
  gap: 8px;
}
.rating-star {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: #7f8494;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
}
.rating-star.is-active {
  border-color: rgba(255,214,10,0.5);
  background: rgba(255,214,10,0.16);
  color: #ffd60a;
}
.feedback-label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}
.feedback-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.feedback-input {
  width: 100%;
  margin-top: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.92rem;
}
.feedback-input:focus {
  border-color: rgba(10,132,255,0.7);
  box-shadow: 0 0 0 3px rgba(10,132,255,0.12);
  outline: none;
}
.feedback-textarea {
  min-height: 88px;
  resize: none;
}
.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}
#dayFailModal .modal-actions {
  grid-template-columns: 1fr;
}
#dayFailModal {
  padding-bottom: calc(16px + var(--day-fail-kb-offset, 0px));
}
#dayFailModal .modal-card {
  max-height: min(80vh, 640px);
  overflow-y: auto;
}
.day-fail-date-label {
  margin: 8px 0 10px;
  color: #b7cdfc;
  font-size: 0.92rem;
}
.day-fail-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}
.day-fail-input {
  width: 100%;
  min-height: 84px;
  resize: none;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.92rem;
}
.field-edit-input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field-edit-form {
  margin-top: 10px;
  width: 100%;
  min-width: 0;
}
.field-edit-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}
.field-edit-form .field-edit-input + .field-edit-input {
  margin-top: 0;
}
.field-edit-input[type="number"] {
  -moz-appearance: textfield;
}
.field-edit-input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  text-align: left;
  direction: ltr;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23a1a1aa' d='M7 2h2v2h6V2h2v2h3a2 2 0 0 1 2 2v12a4 4 0 0 1-4 4H6a4 4 0 0 1-4-4V6a2 2 0 0 1 2-2h3V2zm13 8H4v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}
.field-edit-input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  min-width: 0;
  width: 100%;
}
.field-edit-input[type="date"]::-webkit-datetime-edit {
  padding: 0;
  min-width: 0;
  width: 100%;
}
.field-edit-input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.field-edit-input[type="number"]::-webkit-outer-spin-button,
.field-edit-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field-edit-input:focus {
  border-color: rgba(10,132,255,0.7);
  box-shadow: 0 0 0 3px rgba(10,132,255,0.12);
  outline: none;
}

@media (max-width: 480px) {
  body {
    padding-left: 6px;
    padding-right: 6px;
    padding-bottom: calc(env(safe-area-inset-bottom) + 18px);
  }
  .app {
    max-width: 100%;
    padding-top: 6px;
  }
  .metric-card {
    padding: 18px;
  }
  .metric-value {
    font-size: clamp(3.4rem, 18vw, 5rem);
  }
  .metric-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .metric-primary .metric-value {
    text-align: center;
    font-size: clamp(3.1rem, 15vw, 4.4rem);
  }
  .metric-value-caption {
    font-size: 0.78rem;
  }
  .metric-tag {
    margin-top: 18px;
    padding: 10px 16px;
    font-size: 0.95rem;
  }
  .progress-ring {
    width: 108px;
    height: 108px;
  }
  .progress-ring span {
    font-size: 1.35rem;
  }
  .metric-card-main .progress-line {
    height: 18px;
    margin-top: 6px;
  }
  .progress-summary {
    font-size: 0.9rem;
    margin-top: 4px;
  }
  .card,
  .calendar-panel {
    padding: 12px;
  }
  .streak-toolbar {
    margin-top: 0;
  }
  .config-body,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field input,
  .field textarea,
  .field select {
    max-width: 100%;
    padding: 10px 11px;
    font-size: 16px;
  }
  .field.full,
  .field {
    grid-column: auto;
  }
  .actions {
    grid-template-columns: 1fr;
  }
  .mini-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .mini-pill,
  .actions button {
    min-width: 0;
    padding-left: 10px;
    padding-right: 10px;
  }
  .calendar-head {
    margin-bottom: 8px;
  }
  .calendar-panel {
    margin-top: 12px;
  }
  .calendar-nav button {
    width: 36px;
    height: 36px;
    padding: 0;
  }
  .dow, .days {
    gap: 6px;
  }
  .day {
    min-height: 40px;
    padding: 5px;
    border-radius: 12px;
  }
  .day .num {
    font-size: 10px;
  }
  .day .cross {
    font-size: 16px;
  }
  .config-panel summary,
  .config-body {
    margin-top: 8px;
  }
  .modal-backdrop {
    padding: 10px;
  }
  #dayFailModal {
    padding-bottom: calc(10px + var(--day-fail-kb-offset, 0px));
  }
  .modal-card {
    width: 100%;
    padding: 16px;
  }
  .modal-actions {
    grid-template-columns: 1fr;
  }
  .feedback-row {
    grid-template-columns: 1fr;
  }
}
