:root {
  color-scheme: dark;
  --bg: #090b10;
  --surface: #111620;
  --surface-2: #171e2a;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f8fafc;
  --muted: #98a2b3;
  --teal: #5eead4;
  --amber: #f59e0b;
  --green: #22c55e;
  --red: #fb7185;
  --blue: #60a5fa;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -20%, rgba(94, 234, 212, 0.17), transparent 32rem),
    linear-gradient(180deg, #0b0e14 0%, #090b10 56%);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-screen,
.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 0;
}

.auth-card,
.phone-frame {
  width: min(100%, 31rem);
  min-height: 100vh;
  background: rgba(9, 11, 16, 0.88);
}

.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: max(1.25rem, env(safe-area-inset-top)) 1.25rem max(1.25rem, env(safe-area-inset-bottom));
}

.phone-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 3rem 1fr 3rem;
  gap: 0.75rem;
  align-items: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem 0.8rem;
  background: rgba(9, 11, 16, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.topbar h1,
.auth-card h1,
h2,
h3,
p {
  margin: 0;
}

.topbar h1 {
  font-size: 1.35rem;
}

.auth-card h1 {
  margin-top: 0.7rem;
  font-size: 2.25rem;
  line-height: 1;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted,
.fine-print {
  color: var(--muted);
  line-height: 1.55;
}

.fine-print {
  font-size: 0.78rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1.25rem;
  color: var(--teal);
  background: linear-gradient(145deg, rgba(94, 234, 212, 0.18), rgba(245, 158, 11, 0.12));
  border: 1px solid var(--line);
}

.brand-mark svg {
  width: 3rem;
  height: 3rem;
}

.view {
  flex: 1;
  overflow: auto;
  padding: 1rem 1rem 6.5rem;
}

.enter {
  animation: enter 260ms ease both;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.35rem;
  margin: 1.5rem 0 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.segmented button,
.bottom-nav button,
.ghost-button,
.primary-button,
.finish-button,
.icon-button,
.calendar-day,
.picture-card,
.photo-thumb {
  cursor: pointer;
  border: 0;
  color: var(--text);
}

.segmented button {
  min-height: 2.65rem;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segmented button.active {
  color: var(--bg);
  background: var(--teal);
}

.form-stack {
  display: grid;
  gap: 0.85rem;
}

input,
textarea,
select {
  width: 100%;
  min-height: 3.1rem;
  padding: 0.85rem 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  outline: none;
}

textarea {
  min-height: 5rem;
  resize: vertical;
}

textarea.long {
  min-height: 9rem;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(94, 234, 212, 0.75);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.1);
}

.hidden {
  display: none;
}

.primary-button,
.ghost-button,
.finish-button {
  min-height: 3.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  font-weight: 900;
}

.primary-button,
.finish-button {
  background: linear-gradient(135deg, var(--teal), #7dd3fc);
  color: #041014;
  box-shadow: 0 14px 40px rgba(94, 234, 212, 0.16);
}

.primary-button.wide,
.ghost-button.wide,
.finish-button {
  width: 100%;
}

.ghost-button {
  background: var(--surface);
  border: 1px solid var(--line);
}

.danger {
  color: var(--red);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 2.85rem;
  height: 2.85rem;
  border-radius: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
}

.icon-button:disabled,
.calendar-day:disabled,
.finish-button:disabled {
  opacity: 0.42;
}

.hero-panel,
.panel,
.task-card,
.chart-card {
  background: linear-gradient(180deg, rgba(23, 30, 42, 0.96), rgba(17, 22, 32, 0.96));
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr 6.2rem;
  gap: 1rem;
  align-items: center;
  padding: 1.1rem;
  margin-bottom: 1rem;
}

.hero-panel h2 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.75rem;
}

.ring {
  width: 5.75rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 56%, transparent 58%),
    conic-gradient(var(--teal) calc(var(--value) * 1%), rgba(255, 255, 255, 0.08) 0);
}

.ring span {
  font-weight: 950;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.metric-grid article {
  min-height: 5.6rem;
  padding: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.metric-grid strong {
  display: block;
  font-size: 1.55rem;
}

.metric-grid span,
.task-head span,
small {
  color: var(--muted);
  font-size: 0.8rem;
}

.panel {
  padding: 1rem;
  margin-top: 1rem;
}

.panel h2 {
  margin-bottom: 0.9rem;
  font-size: 1.05rem;
}

.task-list {
  display: grid;
  gap: 0.9rem;
}

.task-card {
  padding: 1rem;
}

.task-card.done {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.12), 0 10px 40px rgba(0, 0, 0, 0.18);
}

.task-card.done .check-row span {
  color: var(--green);
}

.task-card.done .task-head h3 {
  color: var(--green);
}

.task-head,
.day-switcher,
.button-row,
.split-inputs,
.check-row,
.switch-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.task-head,
.day-switcher,
.switch-row {
  justify-content: space-between;
}

.day-switcher {
  margin-bottom: 1rem;
  padding: 0.4rem 0;
}

.check-row {
  min-height: 2.2rem;
  font-weight: 850;
  flex: 1;
}

.check-row input,
.switch-row input,
.setting-actions input {
  width: auto;
  min-height: auto;
  accent-color: var(--teal);
}

.task-card textarea,
.task-card input,
.task-card .upload-zone {
  margin-top: 0.8rem;
}

.note-icon-button {
  flex: 0 0 2.35rem;
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
}

.note-icon-button:focus,
.note-icon-button:hover {
  color: var(--teal);
  border-color: rgba(94, 234, 212, 0.45);
}

.split-inputs > * {
  flex: 1;
}

.finish-button {
  position: static;
  margin: 1.1rem 0 0;
  box-shadow: 0 16px 44px rgba(94, 234, 212, 0.2);
}

.upload-zone {
  min-height: 7rem;
  display: grid;
  place-items: center;
  gap: 0.35rem;
  color: var(--muted);
  background: rgba(94, 234, 212, 0.06);
  border: 1px dashed rgba(94, 234, 212, 0.38);
  border-radius: 0.75rem;
}

.upload-zone input {
  display: none;
}

.upload-progress {
  height: 0.42rem;
  overflow: hidden;
  margin-top: 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.upload-progress span {
  display: block;
  width: 42%;
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
  animation: uploadPulse 900ms ease-in-out infinite alternate;
}

@keyframes uploadPulse {
  from {
    transform: translateX(-20%);
  }
  to {
    transform: translateX(150%);
  }
}

.photo-strip,
.picture-grid {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding-top: 0.8rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  padding-top: 0.8rem;
}

.photo-tile {
  position: relative;
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.photo-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 0.68rem;
}

.photo-tile.primary .photo-preview {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.1);
}

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

.primary-badge {
  position: absolute;
  left: 0.28rem;
  bottom: 0.28rem;
  padding: 0.18rem 0.34rem;
  color: #041014;
  background: var(--teal);
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 950;
}

.photo-tile figcaption {
  display: grid;
  grid-template-columns: 1fr 2rem;
  gap: 0.28rem;
}

.photo-tile figcaption button {
  min-height: 2rem;
  padding: 0 0.35rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  font-size: 0.66rem;
  font-weight: 850;
}

.photo-tile figcaption button:disabled {
  color: #041014;
  background: var(--teal);
}

.photo-thumb,
.photo-strip img {
  flex: 0 0 5.5rem;
  width: 5.5rem;
  height: 5.5rem;
  padding: 0;
  border-radius: 0.7rem;
  overflow: hidden;
  background: var(--surface);
  border: 2px solid transparent;
}

.photo-thumb.primary {
  border-color: var(--teal);
}

.photo-thumb img,
.picture-card img,
.photo-modal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.38rem;
}

.calendar-day {
  min-height: 3.95rem;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 0.42rem 0.18rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.62rem;
}

.calendar-day span {
  font-size: 1.28rem;
  line-height: 1;
  font-weight: 950;
}

.calendar-day small {
  margin-top: 0.2rem;
  font-size: 0.58rem;
  font-weight: 800;
  opacity: 0.58;
  white-space: nowrap;
}

.calendar-day.complete {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.48);
}

.calendar-day.current {
  outline: 2px solid var(--amber);
}

.calendar-day.future {
  color: #667085;
}

.chart-card {
  padding: 0.9rem;
  margin-top: 0.75rem;
}

.goal-tracker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.goal-tracker > div:not(.goal-bar) {
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
}

.goal-tracker span,
.goal-note {
  color: var(--muted);
  font-size: 0.78rem;
}

.goal-tracker strong {
  display: block;
  margin-top: 0.16rem;
}

.goal-bar {
  grid-column: 1 / -1;
  height: 0.45rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.goal-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--green));
  border-radius: inherit;
}

.goal-note {
  margin-top: 0.45rem;
}

.chart {
  width: 100%;
  height: 9rem;
}

.grid-line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.line {
  fill: none;
  stroke-width: 4;
}

.line.teal {
  stroke: var(--teal);
}

.line.amber {
  stroke: var(--amber);
}

.empty-chart,
.empty-state {
  display: grid;
  place-items: center;
  min-height: 7rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.picture-card {
  flex: 0 0 8.5rem;
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.picture-card img {
  height: 9rem;
}

.picture-card span,
.picture-card small {
  display: block;
  padding: 0.65rem 0.75rem 0;
  font-weight: 850;
}

.picture-card small {
  padding-top: 0.2rem;
  padding-bottom: 0.75rem;
}

.history-list,
.summary-list,
.invite-list,
.task-settings {
  display: grid;
  gap: 0.7rem;
}

.history-list div,
.summary-list > div,
.invite-list div,
.summary-row,
.setting-row {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
}

.invite-topline {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.invite-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.invite-actions .ghost-button {
  min-height: 2.55rem;
}

.summary-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.summary-row small {
  grid-column: 1 / -1;
}

.setting-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.library-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.4rem;
  padding: 0.85rem;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
}

.library-row.active {
  border-color: rgba(94, 234, 212, 0.55);
  background: rgba(94, 234, 212, 0.08);
}

.task-config {
  display: grid;
  gap: 0.55rem;
}

.task-config input,
.task-config select {
  min-height: 2.55rem;
  padding: 0.62rem 0.7rem;
}

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.option-grid select {
  grid-column: 1 / -1;
}

.option-grid.single {
  grid-template-columns: 1fr;
}

.option-grid label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.55rem;
  padding: 0 0.65rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.option-grid input[type="checkbox"] {
  width: 1rem;
  min-width: 1rem;
  height: 1rem;
  min-height: 1rem;
  padding: 0;
  margin: 0;
  accent-color: var(--teal);
}

.setting-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.setting-actions .icon-button {
  width: 2.35rem;
  height: 2.35rem;
}

.add-task,
.invite-box {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 8;
  width: min(100%, 31rem);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.2rem;
  transform: translateX(-50%);
  padding: 0.55rem 0.65rem max(0.55rem, env(safe-area-inset-bottom));
  background: rgba(9, 11, 16, 0.9);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  min-height: 3.8rem;
  display: grid;
  place-items: center;
  gap: 0.15rem;
  padding: 0.4rem;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.bottom-nav button.active {
  color: var(--teal);
  background: rgba(94, 234, 212, 0.1);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(10px);
}

.modal-sheet,
.photo-modal {
  width: min(100%, 31rem);
  max-height: 88vh;
  margin: 0 auto;
  overflow: auto;
  padding: 1.1rem;
  background: #0d1118;
  border: 1px solid var(--line);
  border-radius: 1.1rem 1.1rem 0 0;
  box-shadow: var(--shadow);
  animation: sheet 220ms ease both;
}

@keyframes sheet {
  from {
    transform: translateY(2rem);
    opacity: 0;
  }
}

.modal-sheet h2 {
  margin: 0.3rem 3rem 0.8rem 0;
}

.close {
  float: right;
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 1rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(251, 113, 133, 0.12);
  color: var(--red);
  font-weight: 850;
}

.status-pill.complete {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
}

.danger-sheet {
  border-color: rgba(251, 113, 133, 0.35);
}

.photo-modal {
  display: grid;
  gap: 0.8rem;
  align-items: center;
}

.photo-modal img {
  max-height: 68vh;
  border-radius: 0.85rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 6rem;
  z-index: 50;
  width: min(calc(100% - 2rem), 27rem);
  transform: translateX(-50%);
  padding: 0.9rem 1rem;
  color: var(--text);
  background: #18202d;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  animation: enter 180ms ease both;
}

@media (min-width: 42rem) {
  .auth-screen,
  .app-shell {
    padding: 2rem;
  }

  .auth-card,
  .phone-frame {
    min-height: min(54rem, calc(100vh - 4rem));
    border: 1px solid var(--line);
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
  }

  .phone-frame {
    max-height: calc(100vh - 4rem);
  }

  .bottom-nav {
    bottom: 2rem;
    border: 1px solid var(--line);
    border-radius: 0 0 1.5rem 1.5rem;
  }

  .modal-backdrop {
    align-items: center;
  }

  .modal-sheet,
  .photo-modal {
    border-radius: 1.1rem;
  }
}

@media (max-width: 23rem) {
  .calendar-grid {
    gap: 0.26rem;
  }

  .calendar-day {
    min-height: 3.35rem;
  }

  .calendar-day span {
    font-size: 1.05rem;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }
}
