:root {
  color-scheme: light;
  --bg: #fbf6ee;
  --panel: #fffaf2;
  --text: #23312d;
  --muted: #68756f;
  --line: #ded8cd;
  --accent: #315f55;
  --accent-dark: #22443d;
  --green: #2f9d5b;
  --orange: #d88428;
  --red: #c74a42;
  --shadow: 0 22px 70px rgba(35, 49, 45, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(49, 95, 85, 0.12), transparent 34%),
    var(--bg);
  color: var(--text);
}

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

input[name="birthCity"],
input[name$="BirthCity"],
#personal-birth-city,
input[data-relative-field="birthCity"] {
  text-transform: uppercase;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.auth-layout {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 32px;
  align-items: center;
}

.brand-panel {
  padding: 48px;
}

.brand-logo {
  display: block;
  width: min(420px, 86vw);
  height: auto;
  margin: 0 0 24px;
  border-radius: 8px;
}

.brand-intro {
  max-width: 620px;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 800;
}

.brand-highlights {
  display: grid;
  gap: 8px;
  max-width: 620px;
  margin: 18px 0 0;
  padding: 0;
  color: var(--muted);
  line-height: 1.55;
  list-style: none;
}

.brand-highlights li {
  position: relative;
  padding-left: 18px;
}

.brand-highlights li::before {
  position: absolute;
  left: 0;
  color: var(--accent);
  content: "•";
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.brand-panel h1,
.topbar h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(2.1rem, 4vw, 4.5rem);
  line-height: 1.02;
}

.brand-panel p:not(.eyebrow),
.memory-form-section > div p,
.section-heading p {
  color: var(--muted);
  line-height: 1.7;
}

.auth-card,
.memory-form-section,
.memory-card {
  border: 1px solid rgba(222, 216, 205, 0.88);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 24px;
}

.home-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4eee4;
}

.tab {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.is-active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(35, 49, 45, 0.08);
}

.auth-form,
.memory-form {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.birth-date-grid {
  display: grid;
  grid-template-columns: minmax(72px, 0.72fr) minmax(120px, 1.2fr) minmax(92px, 0.9fr);
  gap: 8px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.field-helper {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
}

.field-helper.is-limit-warning {
  color: var(--red);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}

input[name="lastName"],
input[name$="LastName"],
input[data-relative-field="lastName"] {
  text-transform: uppercase;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(49, 95, 85, 0.13);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 52px;
}

input[readonly] {
  background: #f6f1e8;
  color: var(--muted);
  cursor: not-allowed;
}

.readonly-detail {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.readonly-detail-placeholder {
  visibility: hidden;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-size: 0;
  transform: translateY(-50%);
}

.password-toggle svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

.password-toggle::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 2;
  min-width: max-content;
  border-radius: 6px;
  background: var(--text);
  color: white;
  padding: 6px 9px;
  font-size: 0.78rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: rgba(49, 95, 85, 0.08);
}

.password-toggle:hover::after,
.password-toggle:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-weight: 800;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.danger-button {
  background: #fff7f5;
  border-color: rgba(199, 74, 66, 0.35);
  color: var(--red);
}

.danger-button:hover {
  background: #ffe8e3;
}

.notification-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.notification-button .notification-badge {
  width: 22px;
  height: 22px;
  font-size: 0.78rem;
  line-height: 1;
}

.full-width-button {
  width: 100%;
  margin-top: 14px;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.remember-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.93rem;
}

.remember-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font-weight: 800;
  text-align: right;
}

.link-button:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.full-width-link {
  display: block;
  width: 100%;
  margin-top: 10px;
  text-align: center;
}

.auth-legal-link {
  margin-top: 16px;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 28px auto 0;
  padding: 16px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.app-footer .link-button,
.app-footer a {
  color: var(--muted);
  font-size: inherit;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.app-footer .link-button:hover,
.app-footer a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.inline-link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
}

.inline-link-button:hover {
  color: var(--accent-dark);
}

.form-message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--accent);
  font-weight: 700;
}

.form-message.is-error {
  border: 1px solid rgba(199, 74, 66, 0.24);
  border-radius: 8px;
  background: rgba(255, 247, 245, 0.94);
  color: var(--red);
  padding: 10px 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(29, 42, 38, 0.42);
}

.password-modal-card,
.daily-modal-card,
.partner-modal-card,
.owner-intro-modal-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 24px;
  box-shadow: 0 24px 70px rgba(35, 49, 45, 0.26);
}

.daily-modal-card,
.partner-modal-card,
.owner-intro-modal-card {
  display: grid;
  gap: 16px;
  width: min(720px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
}

.password-modal-card h2,
.daily-modal-card h2,
.partner-modal-card h2,
.owner-intro-modal-card h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.owner-intro-text {
  display: grid;
  gap: 12px;
  max-height: min(48vh, 420px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
}

.owner-intro-text p {
  margin: 0;
  line-height: 1.55;
}

.consent-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 600;
}

.consent-line input {
  margin-top: 3px;
}

.password-modal-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.dashboard {
  display: grid;
  gap: 24px;
}

.topbar,
.section-heading,
.memory-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.legal-page {
  border: 1px solid rgba(222, 216, 205, 0.88);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  padding: 32px;
  box-shadow: var(--shadow);
  color: #35443f;
  line-height: 1.72;
}

.legal-page h2,
.legal-page h3,
.legal-page h4 {
  color: var(--text);
}

.legal-page h2 {
  margin-bottom: 8px;
  font-size: 1.6rem;
}

.legal-page h3 {
  margin: 28px 0 10px;
  font-size: 1.18rem;
}

.legal-page h4 {
  margin: 18px 0 8px;
  font-size: 1rem;
}

.legal-page p {
  margin-bottom: 12px;
}

.memory-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.memory-form-section {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 28px;
  padding: 28px;
}

.economy-section {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(222, 216, 205, 0.88);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  padding: 24px;
  box-shadow: var(--shadow);
}

.notification-badge {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: white;
  font-weight: 900;
}

.plan-grid,
.credit-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.subscription-note {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.55;
}

.subscription-management {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.subscription-management .form-message {
  margin: 0;
}

.plan-card,
.credit-panel article {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.plan-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(49, 95, 85, 0.1);
}

.plan-card.is-unavailable {
  opacity: 0.58;
  background: #f3f1ec;
}

.plan-card.is-unavailable button {
  cursor: not-allowed;
}

.plan-status {
  width: fit-content;
  border-radius: 999px;
  background: #e7e1d6;
  color: #756b5b;
  padding: 5px 9px;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.plan-card span,
.credit-panel span {
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 900;
}

.plan-card p,
.credit-panel small,
.credit-history {
  color: var(--muted);
  line-height: 1.55;
}

.credit-history {
  display: grid;
  gap: 6px;
}

.credit-history p {
  margin: 0;
}

.daily-question-text {
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #f3faf7;
  padding: 12px 14px;
  color: var(--text);
  font-weight: 800;
}

.pending-question-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.pending-question-actions .ghost-button {
  justify-content: flex-start;
  width: 100%;
  background: rgba(255, 255, 255, 0.68);
}

.editorial-config-block {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 16px;
}

.editorial-config-block h3 {
  margin: 0;
  color: var(--text);
}

.editorial-history {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.editorial-history p {
  margin: 0;
}

.admin-panel {
  display: grid;
  gap: 16px;
}

.admin-user-stats {
  margin-top: 14px;
  max-width: 300px;
}

.admin-user-stats table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.admin-user-stats th,
.admin-user-stats td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.92rem;
}

.admin-user-stats tr:last-child th,
.admin-user-stats tr:last-child td {
  border-bottom: 0;
}

.admin-user-stats th {
  color: var(--muted);
  font-weight: 800;
}

.admin-user-stats td {
  text-align: right;
  color: var(--text);
  font-weight: 900;
}

.question-admin-list {
  display: grid;
  gap: 12px;
}

.admin-simple-list {
  display: grid;
  gap: 8px;
}

.admin-simple-list p {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 12px 14px;
  color: var(--text);
}

.question-admin-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 14px;
}

.question-admin-message {
  min-height: 1.2em;
  margin: 0;
  color: var(--green);
  font-size: 0.9rem;
  font-weight: 800;
}

.partner-label {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: #fff8ec;
  color: #7a4b13;
  padding: 7px 10px;
  font-weight: 900;
}

.visitor-section,
.access-section {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 28px;
  padding: 28px;
  border: 1px solid rgba(222, 216, 205, 0.88);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.memory-form-section h2,
.visitor-section h2,
.access-section h2,
.memories-section h2 {
  margin-bottom: 10px;
  font-size: 1.55rem;
}

.visitor-section > div p,
.access-section > div p {
  color: var(--muted);
  line-height: 1.7;
}

.family-form,
.family-group,
.relative-list {
  display: grid;
  gap: 14px;
}

.family-group {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.danger-zone {
  border: 1px solid rgba(199, 74, 66, 0.26);
  border-radius: 8px;
  background: rgba(255, 247, 245, 0.68);
  padding: 16px;
}

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

.email-invite-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.email-invite-row .invite-button {
  min-height: 42px;
  padding-inline: 12px;
}

.invite-status {
  grid-column: 1 / -1;
  color: var(--green);
  font-size: 0.9rem;
  font-weight: 800;
}

.password-change-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 16px;
}

.orange-data-note {
  border-left: 4px solid var(--orange);
  border-radius: 8px;
  background: #fff8ec;
  color: #7a4b13;
  padding: 12px 14px;
  line-height: 1.55;
}

.repeat-add-note {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.password-change-panel h4 {
  margin: 0;
}

.profile-photo-preview,
.visitor-profile-photo-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.profile-photo-preview {
  width: min(220px, 100%);
  aspect-ratio: 1;
}

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

.profile-photo-consent {
  margin-top: 2px;
}

.visitor-profile-photo-frame {
  width: min(180px, 100%);
  aspect-ratio: 1;
  margin-top: 18px;
}

.alphabet-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.alphabet-filter button {
  min-width: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  padding: 7px 9px;
  font-weight: 900;
  cursor: pointer;
}

.alphabet-filter button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.visitor-memory-status {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.visitor-memory-status article {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px;
}

.visitor-memory-status strong {
  color: var(--text);
  font-size: 0.92rem;
}

.visitor-memory-status span {
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 900;
}

.family-group:last-of-type {
  border-bottom: 0;
}

.family-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.family-group-heading h3,
.relative-card h4 {
  margin: 0;
}

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

.birth-info-grid {
  align-items: start;
}

.birth-info-grid label {
  display: grid;
  grid-template-rows: auto auto 20px;
}

.relative-card {
  position: relative;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 16px;
}

.gender-fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
}

.gender-fieldset legend {
  padding: 0 4px;
  color: var(--text);
  font-weight: 800;
}

.gender-fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.gender-fieldset input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.small-button {
  min-height: 38px;
  padding: 0 12px;
}

.remove-relative-button {
  justify-self: end;
  border: 1px solid rgba(199, 74, 66, 0.25);
  border-radius: 8px;
  background: #fff7f5;
  color: var(--red);
  padding: 7px 10px;
  font-weight: 800;
}

.response-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4eee4;
}

.response-mode-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.response-mode-button.is-active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(35, 49, 45, 0.08);
}

.response-mode-button:disabled,
.response-mode-button.is-disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.response-mode-button:disabled.is-active,
.response-mode-button.is-disabled.is-active {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.question-admin-card.is-archived {
  opacity: 0.62;
}

.admin-death-report-panel,
.admin-report-list {
  display: grid;
  gap: 12px;
}

.admin-alert-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  background: #fff1ef;
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 4px 10px;
}

.admin-report-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
}

.admin-report-card.is-validated {
  border-color: rgba(49, 95, 85, 0.28);
  background: #f3faf7;
}

.admin-report-card.is-rejected {
  opacity: 0.72;
}

.response-panel {
  display: grid;
  gap: 16px;
}

.question-progress {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.questionnaire-complete-message {
  border: 1px solid rgba(184, 145, 79, 0.35);
  border-radius: 8px;
  padding: 18px;
  background: rgba(250, 245, 234, 0.85);
  color: var(--text);
  font-weight: 700;
  line-height: 1.5;
}

.subscription-upgrade-prompt {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 600;
}

.subscription-upgrade-prompt button {
  width: fit-content;
}

.memory-form.is-questionnaire-complete > .privacy-fieldset,
.memory-form.is-questionnaire-complete > .form-actions {
  display: none;
}

.response-panel.is-complete > label,
.response-panel.is-complete > fieldset,
.response-panel.is-complete > button {
  display: none;
}

.progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eee7dc;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 220ms ease;
}

.consent-fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.consent-fieldset legend {
  margin-bottom: 2px;
  font-weight: 800;
}

.consent-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.consent-option input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.important-consent {
  border-color: rgba(199, 74, 66, 0.28);
  background: #fff7f5;
  color: var(--text);
}

.privacy-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.privacy-fieldset legend {
  margin-bottom: 10px;
  font-weight: 800;
}

.qcm-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.qcm-fieldset legend {
  margin-bottom: 10px;
  font-weight: 800;
}

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

.qcm-choice {
  position: relative;
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.qcm-choice input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.qcm-choice:has(input:checked) {
  border-color: var(--accent);
  background: #f3faf7;
  box-shadow: 0 0 0 4px rgba(49, 95, 85, 0.08);
}

.privacy-options {
  display: grid;
  gap: 10px;
}

.privacy-option {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr;
  column-gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.privacy-option input {
  position: absolute;
  opacity: 0;
}

.privacy-option:has(input:checked) {
  border-color: currentColor;
  box-shadow: 0 0 0 4px rgba(49, 95, 85, 0.08);
}

.privacy-option.public {
  color: var(--green);
}

.privacy-option.guidance {
  color: var(--orange);
}

.privacy-option.locked {
  color: var(--red);
}

.privacy-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: currentColor;
}

.privacy-option strong,
.privacy-option small {
  grid-column: 2;
}

.privacy-option small {
  color: var(--muted);
  line-height: 1.4;
}

.memories-list {
  display: grid;
  gap: 14px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}

.pagination button {
  min-width: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  padding: 8px 11px;
  font-weight: 900;
}

.pagination button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.pagination button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.memory-card {
  padding: 20px;
  box-shadow: none;
}

.memory-card h3 {
  margin-bottom: 6px;
  font-size: 1.15rem;
}

.memory-card time {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-line;
}

.memory-content {
  margin: 16px 0 0;
  color: #35443f;
  line-height: 1.65;
  white-space: pre-wrap;
}

.memory-qcm-stats {
  margin: 14px 0 0;
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  background: rgba(247, 240, 222, 0.72);
  color: #5d4d2b;
  padding: 10px 12px;
  font-size: 0.92rem;
  font-weight: 800;
}

.memory-content.locked-memory-content {
  border: 1px dashed rgba(199, 74, 66, 0.32);
  border-radius: 8px;
  padding: 14px;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(199, 74, 66, 0.08) 0,
      rgba(199, 74, 66, 0.08) 10px,
      rgba(255, 250, 242, 0.9) 10px,
      rgba(255, 250, 242, 0.9) 20px
    );
  color: #8d3d38;
  font-weight: 800;
  user-select: none;
}

.privacy-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 10px;
  color: white;
  font-size: 0.78rem;
  font-weight: 900;
}

.edit-memory-button,
.delete-memory-button {
  position: relative;
  width: 38px;
  height: 38px;
  overflow: visible;
  border-radius: 8px;
  color: transparent;
  font-size: 0;
}

.reveal-memory-button {
  position: relative;
  min-height: 38px;
  border: 1px solid rgba(199, 74, 66, 0.25);
  border-radius: 8px;
  background: #fff7f5;
  color: var(--red);
  padding: 0 12px;
  font-size: 0.85rem;
  font-weight: 900;
}

.reveal-memory-button:hover {
  border-color: var(--red);
  background: #ffecea;
}

.edit-memory-button {
  border: 1px solid rgba(49, 95, 85, 0.25);
  background: #f3faf7;
}

.delete-memory-button {
  border: 1px solid rgba(199, 74, 66, 0.25);
  background: #fff7f5;
}

.edit-memory-button::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: 9px auto 0;
  background:
    linear-gradient(135deg, transparent 0 35%, var(--accent) 35% 65%, transparent 65%) 2px 1px / 14px 14px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 4px 14px / 11px 2px no-repeat,
    linear-gradient(135deg, transparent 0 48%, var(--accent) 48% 60%, transparent 60%) 1px 14px / 6px 4px no-repeat;
}

.delete-memory-button::before {
  content: "";
  display: block;
  width: 17px;
  height: 19px;
  margin: 8px auto 0;
  background:
    linear-gradient(var(--red), var(--red)) 3px 5px / 11px 2px no-repeat,
    linear-gradient(var(--red), var(--red)) 6px 1px / 5px 2px no-repeat,
    linear-gradient(var(--red), var(--red)) 2px 8px / 2px 10px no-repeat,
    linear-gradient(var(--red), var(--red)) 7px 8px / 2px 10px no-repeat,
    linear-gradient(var(--red), var(--red)) 12px 8px / 2px 10px no-repeat,
    linear-gradient(var(--red), var(--red)) 0 6px / 17px 2px no-repeat;
}

.edit-memory-button:hover {
  border-color: var(--accent);
  background: #e8f4ef;
}

.delete-memory-button:hover {
  border-color: var(--red);
  background: #ffecea;
}

.edit-memory-button::after,
.reveal-memory-button::after,
.delete-memory-button::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 2;
  min-width: max-content;
  border-radius: 6px;
  background: var(--text);
  color: white;
  padding: 6px 9px;
  font-size: 0.78rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.edit-memory-button:hover::after,
.edit-memory-button:focus-visible::after,
.reveal-memory-button:hover::after,
.reveal-memory-button:focus-visible::after,
.delete-memory-button:hover::after,
.delete-memory-button:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.privacy-badge.public {
  background: var(--green);
}

.privacy-badge.guidance {
  background: var(--orange);
}

.privacy-badge.locked {
  background: var(--red);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.65);
  text-align: center;
}

.visitor-answer-list {
  display: grid;
  gap: 14px;
}

.visitor-answer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.88);
  color: #35443f;
  line-height: 1.65;
  padding: 22px;
}

.visitor-answer-card h3 {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.visitor-answer-card p {
  margin: 0;
  white-space: pre-wrap;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding: 10px 0 24px;
  }

  .auth-layout,
  .memory-form-section,
  .visitor-section,
  .access-section {
    grid-template-columns: 1fr;
  }

  .plan-grid,
  .credit-panel {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    padding: 24px 4px 0;
  }

  .topbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions .ghost-button {
    flex: 1 1 180px;
  }

  .memory-card-header {
    flex-direction: column;
  }

  .memory-actions {
    justify-content: space-between;
    width: 100%;
  }

  .qcm-choices,
  .response-mode-tabs,
  .form-grid,
  .family-grid {
    grid-template-columns: 1fr;
  }

  .family-group-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .birth-date-grid {
    grid-template-columns: 1fr;
  }
}
