:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #edf4ef;
  --ink: #18211d;
  --muted: #66736c;
  --line: #dce2dd;
  --green: #2f8b57;
  --green-soft: #dff1e6;
  --blue: #316f9f;
  --amber: #b46b22;
  --red: #a9473f;
  --shadow: 0 18px 45px rgba(23, 35, 30, 0.1);
  --radius: 8px;
  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);
  color: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(47, 139, 87, 0.06), transparent 34%),
    radial-gradient(circle at 100% 0, rgba(180, 107, 34, 0.12), transparent 28%),
    var(--bg);
}

body.lightbox-open,
body.modal-open {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

.auth-gate {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.6fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 40px clamp(18px, 5vw, 56px);
}

.auth-gate[hidden] {
  display: none;
}

.auth-hero {
  display: grid;
  gap: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
}

.auth-hero h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font-size: clamp(44px, 7vw, 78px);
  line-height: 0.95;
}

.auth-lead {
  max-width: 680px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.45;
}

.auth-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-points span {
  border: 1px solid #c7d7ce;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 9px 12px;
  color: var(--ink);
  font-weight: 800;
}

.auth-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  padding: 18px;
  box-shadow: var(--shadow);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell[hidden] {
  display: none;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 50%;
  background: #16231e;
  color: #f5f3ee;
  font-weight: 800;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin: 4px 0;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
}

.nav-item.active {
  border-color: #c7d7ce;
  background: #e8f2ec;
  color: var(--ink);
}

.nav-item.add-accent {
  color: var(--green);
}

.icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(24, 33, 29, 0.07);
  flex: 0 0 auto;
}

.main {
  width: min(1120px, 100%);
  padding: 34px clamp(18px, 4vw, 48px) 96px;
  margin: 0 auto;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 12px 30px rgba(23, 35, 30, 0.06);
}

.step-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  flex: 0 0 auto;
}

.guide-card.done .step-number {
  background: var(--green);
}

.onboarding-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 33, 29, 0.42);
}

.onboarding-modal[hidden] {
  display: none;
}

.onboarding-dialog {
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid #c7d7ce;
  border-radius: var(--radius);
  background: #fff;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(23, 35, 30, 0.22);
}

.onboarding-dialog h2 {
  margin-bottom: 8px;
  font-size: 30px;
}

.onboarding-dialog p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.45;
}

.onboarding-guide {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.onboarding-guide[hidden] {
  display: none;
}

.guide-card-list {
  display: grid;
  gap: 10px;
}

.guide-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
  padding: 13px;
}

.guide-card.done {
  border-color: #9fc9ad;
  background: var(--green-soft);
}

.guide-card strong {
  display: block;
  margin-bottom: 4px;
}

.guide-card p {
  margin-bottom: 10px;
  font-size: 14px;
}

.template-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  border: 1px solid #c7d7ce;
  border-radius: var(--radius);
  background: #eef8f2;
  color: var(--ink);
  padding: 13px;
  text-align: left;
}

.template-card strong {
  display: block;
  font-size: 16px;
}

.template-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.template-card b {
  border-radius: 999px;
  background: #fff;
  color: var(--green);
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.onboarding-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.account-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.account-identity strong,
.account-identity span {
  display: block;
}

.account-identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-identity span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.avatar-preview {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  overflow: hidden;
  border: 2px solid #c7d7ce;
  border-radius: 50%;
  background: #16231e;
  color: #f5f3ee;
  font-size: 24px;
  font-weight: 900;
  flex: 0 0 auto;
}

.avatar-preview.small {
  width: 42px;
  height: 42px;
  font-size: 14px;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.96;
}

h2 {
  margin-bottom: 16px;
  font-size: 22px;
}

.date-picker,
.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.date-picker input,
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 12px 13px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
}

.metric strong {
  display: block;
  margin-bottom: 2px;
  font-size: 26px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.habit-list,
.shadow-list {
  display: grid;
  gap: 12px;
}

.habit-card,
.panel,
.victory-card,
.shadow-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.habit-card {
  overflow: hidden;
}

.habit-main {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 74px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
}

.habit-check,
.habit-label,
.collapse-toggle,
.habit-order,
.habit-delete {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

.habit-check {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.habit-label {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  text-align: left;
}

.habit-card.done {
  border-color: #9fc9ad;
  background: var(--green-soft);
}

.habit-card.partial {
  border-color: #bdd7c6;
  background: #eef8f2;
}

.habit-card.empty {
  background: rgba(255, 255, 255, 0.72);
}

.check {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid #b9c5bf;
  border-radius: 50%;
  color: transparent;
  font-weight: 900;
  flex: 0 0 auto;
}

.done .check,
.child-row.done .mini-check {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.partial .check {
  border-color: var(--green);
  color: var(--green);
}

.habit-title {
  flex: 1;
  min-width: 0;
}

.habit-title strong {
  display: block;
  font-size: 17px;
}

.habit-title span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.habit-streak {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.habit-order-controls {
  display: grid;
  grid-template-columns: repeat(2, 30px);
  gap: 5px;
  flex: 0 0 auto;
}

.habit-order {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.habit-order:disabled {
  opacity: 0.28;
}

.habit-order:not(:disabled):active {
  background: var(--green-soft);
  color: var(--green);
}

.collapse-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  transition: transform 0.16s ease, background 0.16s ease;
  flex: 0 0 auto;
}

.collapse-toggle.collapsed {
  transform: rotate(-90deg);
}

.collapse-toggle:active {
  background: var(--green-soft);
}

.habit-delete {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #ead0cc;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--red);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  flex: 0 0 auto;
}

.habit-delete:active {
  background: #f8e8e5;
}

.children {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px 70px;
}

.child-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
  color: var(--ink);
  text-align: left;
}

.mini-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid #bac4bf;
  border-radius: 50%;
  color: transparent;
  font-size: 12px;
  font-weight: 900;
  flex: 0 0 auto;
}

.skipped-habits {
  display: grid;
  gap: 10px;
  border: 1px dashed #bfd1c7;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  padding: 14px;
}

.skipped-habits strong {
  color: var(--muted);
  font-size: 14px;
}

.skipped-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filters,
.form-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tag-filter-section {
  margin-top: 18px;
  padding-bottom: 12px;
}

.tag-filter-section .eyebrow {
  margin-bottom: 8px;
}

.tag-filters {
  margin-bottom: 0;
}

.victory-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.filter-toggle {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  font-weight: 900;
}

.filter-toggle.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.filter-popover {
  display: grid;
  gap: 12px;
  margin: -4px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  padding: 12px;
  box-shadow: var(--shadow);
}

.filter-popover[hidden] {
  display: none;
}

.filter-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compact-action {
  min-height: 30px;
  padding: 5px 9px;
}

.filter-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 9px 10px;
  color: var(--ink);
  font-weight: 800;
}

.filter-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.view-switch {
  display: inline-flex;
  gap: 4px;
  width: fit-content;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.view-option {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 18px;
  font-weight: 900;
}

.view-option.active {
  background: var(--ink);
  color: #fff;
}

.filter-chip,
.form-tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 8px 13px;
  font-weight: 800;
}

.filter-chip.active,
.form-tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.victory-grid {
  display: grid;
  gap: 14px;
}

.victory-grid.tile-view {
  grid-template-columns: repeat(auto-fill, minmax(240px, 280px));
  align-items: start;
  justify-content: start;
}

.victory-grid.list-view {
  grid-template-columns: minmax(0, 1fr);
}

.victory-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.victory-tile {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  color: var(--ink);
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.victory-tile .victory-media {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  overflow: hidden;
}

.victory-tile .victory-body {
  display: grid;
  gap: 5px;
  min-height: 88px;
}

.victory-tile .victory-body strong {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.victory-media {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  min-height: 0;
  background: #dfe8e3;
  color: var(--muted);
  font-weight: 800;
}

.victory-image-button {
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}

.victory-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.victory-image-button:hover img {
  transform: scale(1.03);
}

.victory-body {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  padding: 14px;
  background: rgba(255, 255, 255, 0.96);
}

.victory-date,
.meta-line {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.victory-body p {
  margin: 8px 0 12px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.victory-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 17, 14, 0.62);
}

.victory-detail-modal[hidden] {
  display: none;
}

.victory-detail-dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.victory-detail-media {
  display: grid;
  place-items: center;
  min-height: 220px;
  background: #dfe8e3;
}

.detail-media-button {
  width: 100%;
  max-height: 52vh;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}

.detail-media-button img {
  display: block;
  width: 100%;
  max-height: 52vh;
  object-fit: contain;
}

.detail-media-placeholder {
  padding: 48px 18px;
  color: var(--muted);
  font-size: 24px;
  font-weight: 900;
}

.victory-detail-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.victory-detail-body h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.22;
  white-space: pre-wrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border-radius: 999px;
  background: #edf2f6;
  color: #31556b;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.primary-action {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  padding: 10px 15px;
  font-weight: 900;
}

.primary-action.wide {
  width: 100%;
  margin-top: 4px;
}

.panel {
  padding: 16px;
}

.form-panel {
  display: none;
  max-width: 720px;
  gap: 14px;
}

.form-panel.active {
  display: grid;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-field input {
  width: 20px;
  height: 20px;
}

.subtask-builder {
  display: grid;
  gap: 10px;
}

.subtask-builder[hidden] {
  display: none;
}

.inline-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}

.square-action {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  color: var(--green);
  font-size: 24px;
  line-height: 1;
}

.subtask-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.subtask-empty {
  width: 100%;
  border: 1px dashed #b8c3bd;
  border-radius: var(--radius);
  color: var(--muted);
  padding: 12px;
  text-align: center;
}

.subtask-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid #c7d7ce;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--ink);
  padding: 7px 8px 7px 12px;
  font-weight: 800;
}

.subtask-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-subtask {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(47, 139, 87, 0.16);
  color: var(--green);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  flex: 0 0 auto;
}

.image-preview {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed #b8c3bd;
  border-radius: var(--radius);
  background: #f7faf8;
  color: var(--muted);
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
}

.tag-picker,
.award-picker {
  display: grid;
  gap: 8px;
  margin: -2px 0 14px;
}

.tag-picker > span,
.award-picker > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.quick-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-chip {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 7px 11px;
  font-weight: 800;
}

.award-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  border: 1px solid rgba(195, 135, 37, 0.42);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff8df, #ffffff);
  color: var(--ink);
  padding: 8px 12px 8px 8px;
  font-weight: 900;
  text-align: left;
}

.award-chip img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.award-chip span {
  display: grid;
  gap: 1px;
}

.award-chip small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.award-empty-note {
  border: 1px dashed #d8cdb9;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 17, 14, 0.88);
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox img {
  max-width: min(1100px, 96vw);
  max-height: 88vh;
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.progress-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
}

.calendar-panel {
  margin-bottom: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin-bottom: 4px;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.legend-dot.full {
  border-color: #2f8b57;
  background: var(--green);
}

.legend-dot.partial {
  border-color: #b9d4c3;
  background: #cfe9d8;
}

.legend-dot.empty {
  background: #edf0ee;
}

.calendar-wrap {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.month-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
  padding: 12px;
}

.month-card h3 {
  margin-bottom: 10px;
  font-size: 16px;
  text-transform: capitalize;
}

.weekdays,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.day-cell {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #edf0ee;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

button.day-cell {
  padding: 0;
}

.day-cell.blank {
  border-color: transparent;
  background: transparent;
}

.day-cell.full {
  border-color: #2f8b57;
  background: var(--green);
  color: #fff;
}

.day-cell.partial {
  border-color: #add0ba;
  background: #d7efdf;
  color: var(--green);
}

.day-cell.empty {
  background: #edf0ee;
}

.day-cell.muted {
  border-color: transparent;
  background: transparent;
  color: #c0c7c3;
}

.day-cell.today::after {
  position: absolute;
  inset: -4px;
  border: 2px solid var(--amber);
  border-radius: 8px;
  content: "";
  pointer-events: none;
}

.streak-list,
.achievement-list {
  display: grid;
  gap: 10px;
}

.streak-item,
.achievement-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfcfb;
}

.streak-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e1e8e3;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.shadow-card {
  padding: 16px;
}

.shadow-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.shadow-card h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.shadow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.shadow-note {
  border-radius: var(--radius);
  background: #f8f6f1;
  padding: 10px;
}

.shadow-note strong {
  display: block;
  margin-bottom: 4px;
  color: var(--amber);
  font-size: 13px;
}

.profile-layout {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 14px;
  align-items: start;
}

.profile-layout.auth-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.profile-card {
  display: grid;
  gap: 14px;
}

.profile-top {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.connection-status {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #f8f6f1;
}

.connection-status strong,
.connection-status span {
  display: block;
}

.connection-status span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.connection-status.connected {
  border-color: #9fc9ad;
  background: var(--green-soft);
}

.auth-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.profile-hint {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-award-showcase {
  display: grid;
  gap: 10px;
}

.profile-rank-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 18% 20%, rgba(241, 176, 58, .2), transparent 120px),
    #111a1b;
  color: #fff;
}

.profile-rank-card.empty {
  display: block;
  color: var(--ink);
  background: #f8f6f1;
}

.profile-rank-card img {
  width: 64px;
  height: 74px;
  object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(0,0,0,.28));
}

.profile-rank-card strong,
.profile-rank-card span {
  display: block;
}

.profile-rank-card span {
  margin-top: 4px;
  color: rgba(255,255,255,.68);
  font-size: 13px;
  font-weight: 800;
}

.profile-rank-card.empty span {
  color: var(--muted);
}

.profile-award-mini-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-award-mini {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.profile-award-mini img {
  width: 40px;
  height: 44px;
  object-fit: contain;
}

.awards-hero {
  grid-template-columns: minmax(0, 1fr) 280px;
}

.awards-hero p {
  max-width: 720px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.awards-hero-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 18px;
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(circle at 50% 12%, rgba(241, 176, 58, .28), transparent 150px),
    linear-gradient(180deg, #252e31 0%, #0b1012 100%);
  box-shadow: var(--shadow);
}

.awards-hero-card img {
  width: 172px;
  height: 198px;
  object-fit: contain;
  filter: drop-shadow(0 18px 20px rgba(0,0,0,.35));
}

.awards-hero-card strong,
.awards-hero-card span {
  display: block;
  text-align: center;
}

.awards-hero-card strong {
  font-size: 20px;
}

.awards-hero-card span {
  color: rgba(255,255,255,.68);
  font-size: 13px;
  font-weight: 800;
}

.awards-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.award-stat-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.award-stat-card strong,
.award-stat-card span {
  display: block;
}

.award-stat-card strong {
  font-size: 30px;
  line-height: 1;
}

.award-stat-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.awards-panel,
.awards-section {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.awards-panel p,
.awards-section p {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.5;
}

.awards-track {
  display: grid;
  grid-template-columns: repeat(10, minmax(86px, 1fr));
  overflow-x: auto;
  padding: 8px 0 2px;
}

.award-level {
  position: relative;
  min-width: 92px;
  text-align: center;
}

.award-level::before {
  content: "";
  position: absolute;
  top: 36px;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(220, 151, 46, .28);
}

.award-level:first-child::before {
  left: 50%;
}

.award-level:last-child::before {
  right: 50%;
}

.award-level img,
.award-level > span {
  position: relative;
  z-index: 1;
}

.award-level img {
  width: 70px;
  height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 10px 10px rgba(0,0,0,.14));
}

.award-level > span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 6px auto 14px;
  border-radius: 50%;
  background: #f5dfaa;
  color: #9b611e;
  font-weight: 950;
}

.award-level.locked {
  opacity: .45;
  filter: grayscale(.55);
}

.award-level strong,
.award-level small {
  display: block;
}

.award-level strong {
  margin-top: 4px;
  font-size: 13px;
}

.award-level small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.award-collection-card {
  min-height: 360px;
  padding: 18px;
  border-radius: 24px;
  color: #fff;
  text-align: center;
  background:
    radial-gradient(circle at 50% 12%, rgba(255,255,255,.14), transparent 130px),
    linear-gradient(180deg, #171222 0%, #0b0912 100%);
  box-shadow: 0 20px 48px rgba(11, 9, 18, .2);
}

.award-collection-card.locked {
  opacity: .54;
  filter: grayscale(.5);
}

.award-collection-card img {
  width: min(190px, 100%);
  height: 220px;
  object-fit: contain;
  filter: drop-shadow(0 16px 18px rgba(0,0,0,.35));
}

.award-collection-card strong,
.award-collection-card span,
.award-collection-card small {
  display: block;
}

.award-collection-card strong {
  font-size: 20px;
}

.award-collection-card span {
  margin-top: 4px;
  color: rgba(255,255,255,.68);
  font-weight: 800;
}

.award-collection-card p {
  margin: 10px auto 0;
  color: rgba(255,255,255,.58);
  font-size: 13px;
  line-height: 1.4;
}

.award-collection-card small {
  margin-top: 10px;
  color: #f5d37e;
  font-weight: 900;
}

.award-symbol-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.award-symbol-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.award-symbol-card strong,
.award-symbol-card span {
  display: block;
}

.award-symbol-card span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.form-actions .wide {
  flex: 1 1 220px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ghost-action,
.danger-action {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 8px 11px;
  font-weight: 800;
}

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

.status-pill {
  align-self: flex-start;
  border-radius: 999px;
  background: #edf2f6;
  color: var(--blue);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.empty-state {
  padding: 28px;
  border: 1px dashed #b8c3bd;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  text-align: center;
}

.bottom-nav {
  display: none;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  transform: translateY(120px);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 20;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 920px) {
  .auth-gate {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 22px;
  }

  .auth-hero {
    gap: 18px;
  }

  .auth-hero h1 {
    font-size: 46px;
  }

  .auth-lead {
    font-size: 17px;
  }

  .app-shell {
    display: block;
  }

  .side-nav {
    display: none;
  }

  .main {
    padding: 22px 14px 96px;
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.91);
    backdrop-filter: blur(18px);
  }

  .bottom-nav .nav-item {
    justify-content: center;
    gap: 4px;
    width: auto;
    min-width: 0;
    min-height: 58px;
    margin: 0;
    padding: 7px 4px;
    overflow: hidden;
    font-size: 10px;
    text-align: center;
  }

  .bottom-nav .nav-item span:last-child {
    display: block;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
  }

  .bottom-nav .icon {
    width: 24px;
    height: 24px;
  }

  .screen-header {
    align-items: stretch;
  }

  .victory-toolbar {
    justify-content: space-between;
  }

  .victory-toolbar .primary-action {
    width: auto;
    flex: 1;
    min-width: 0;
  }

  .summary-strip,
  .victory-grid,
  .progress-layout,
  .calendar-wrap,
  .shadow-grid,
  .profile-layout,
  .awards-hero,
  .awards-stats,
  .awards-grid,
  .award-symbol-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .victory-grid.tile-view {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .victory-grid.list-view {
    grid-template-columns: 1fr;
  }

  .victory-tile .victory-body {
    min-height: 76px;
    padding: 10px;
  }

  .victory-tile .victory-media {
    height: auto;
  }

  .victory-tile .victory-date {
    font-size: 11px;
  }

  .children {
    padding-left: 14px;
  }

  h1 {
    font-size: 40px;
  }
}

@media (max-width: 520px) {
  .auth-gate {
    padding: 24px 14px;
  }

  .auth-hero h1 {
    font-size: 40px;
  }

  .auth-points {
    display: grid;
  }

  .screen-header {
    display: grid;
  }

  .date-picker,
  .primary-action {
    width: 100%;
  }

  .view-switch {
    flex: 0 0 auto;
    width: auto;
  }

  .view-option {
    flex: 0 0 auto;
  }

  .filter-toggle {
    flex: 0 0 auto;
  }

  .victory-toolbar .primary-action {
    width: auto;
  }

  .victory-tile .victory-media {
    height: auto;
  }

  .victory-tile .victory-body strong {
    font-size: 15px;
  }

  .victory-detail-modal {
    align-items: end;
    padding: 10px;
  }

  .victory-detail-dialog {
    width: 100%;
    max-height: 88vh;
  }

  .victory-detail-body h2 {
    font-size: 21px;
  }

  .panel-head {
    display: grid;
  }

  .calendar-wrap {
    gap: 10px;
  }

  .habit-main {
    align-items: flex-start;
    gap: 10px;
  }

  .habit-streak {
    display: none;
  }

  .collapse-toggle {
    width: 32px;
    height: 32px;
  }

  .habit-delete {
    width: 32px;
    height: 32px;
  }

  .account-bar {
    align-items: stretch;
  }

  .account-bar .ghost-action {
    width: auto;
  }

  .profile-top {
    grid-template-columns: 1fr;
  }

  .awards-hero-card img {
    width: 144px;
    height: 166px;
  }

  .award-collection-card {
    min-height: 320px;
  }

  .award-collection-card img {
    height: 190px;
  }

  .onboarding-dialog {
    padding: 18px;
  }

  .onboarding-dialog-actions .primary-action,
  .onboarding-dialog-actions .ghost-action {
    width: 100%;
  }
}
