:root {
  color-scheme: dark;
  --bg: #07152c;
  --surface: #0d2243;
  --surface-strong: #122f5c;
  --surface-soft: #173763;
  --text: #f7f9ff;
  --text-muted: #bfcae0;
  --primary: #78b7ff;
  --primary-strong: #2f83e4;
  --accent: #ffd280;
  --border: #31527d;
  --success: #55d59a;
  --warning: #ffd166;
  --danger: #ff8e8e;
  --focus: #ffdf8a;
  --shadow: 0 18px 45px rgb(0 0 0 / 28%);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 80% 0%, rgb(54 105 174 / 28%), transparent 34rem),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
}

@supports (padding: env(safe-area-inset-top)) {
  body {
    padding-right: env(safe-area-inset-right);
    padding-left: env(safe-area-inset-left);
  }
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #07152c;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  padding: clamp(18px, 4vw, 38px) max(20px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgb(255 255 255 / 12%);
  background: rgb(7 21 44 / 84%);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 26px);
}

.brand-logo {
  width: clamp(72px, 10vw, 104px);
  height: auto;
  flex: 0 0 auto;
  border-radius: 50%;
  filter: drop-shadow(0 10px 22px rgb(0 0 0 / 35%));
}

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.6rem);
  line-height: 1.12;
}

.brand-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.pwa-install-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgb(255 210 128 / 32%);
  border-radius: var(--radius-md);
  background: rgb(10 34 67 / 72%);
}

.pwa-install-box > div {
  display: grid;
  gap: 2px;
}

.pwa-install-box strong {
  color: var(--accent);
  font-size: 0.9rem;
}

#pwaStatus {
  color: var(--text-muted);
  font-size: 0.84rem;
}

#pwaStatus[data-state="ready"],
#pwaStatus[data-state="installable"] {
  color: #b9f2d5;
}

#pwaStatus[data-state="warning"] {
  color: var(--warning);
}

#pwaStatus[data-state="offline"] {
  color: #c7e2ff;
}

.access-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 13px 14px;
  border: 1px solid rgb(120 183 255 / 34%);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgb(15 55 97 / 76%), rgb(8 27 55 / 86%));
}

.access-summary > div:first-child {
  display: grid;
  gap: 2px;
}

.access-label {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

#accessPlanName {
  color: #fff;
  font-size: 1rem;
}

#accessStatus {
  color: var(--text-muted);
  font-size: 0.84rem;
}

#accessAccountStatus {
  color: #b9d8f3;
  font-size: 0.8rem;
}

.access-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
}

.button-quiet:hover {
  background: rgb(255 255 255 / 8%);
  color: #fff;
}

.access-dialog {
  width: min(960px, calc(100% - 28px));
  margin: 22px auto 0;
  padding: 0;
  overflow: visible;
  border: 1px solid rgb(221 184 95 / 58%);
  border-radius: 22px;
  background: #081a31;
  color: var(--text);
  box-shadow: 0 26px 80px rgb(0 0 0 / 58%);
}

.access-dialog[hidden] {
  display: none !important;
}

.access-dialog::backdrop {
  background: rgb(1 8 20 / 78%);
  backdrop-filter: blur(5px);
}

.access-dialog-panel {
  position: relative;
  padding: clamp(22px, 4vw, 40px);
  background:
    linear-gradient(180deg, rgb(10 33 65 / 76%), rgb(5 20 42 / 94%)),
    url("assets/cielo_stellato_luna_orizzonte.png") center / cover no-repeat;
}

.access-dialog-panel h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
}

.access-dialog-intro {
  max-width: 720px;
  color: var(--text-muted);
}

.access-steps {
  display: grid;
  gap: 8px;
  max-width: 760px;
  margin: 14px 0;
  padding-left: 24px;
  color: #eaf5ff;
}

.access-login-notice {
  margin: 12px 0 18px;
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  background: rgb(221 184 95 / 10%);
  color: #f7e8bd;
}

.access-dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 50%;
  background: rgb(4 18 39 / 78%);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
}

.access-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.collapsible-panel {
  margin-top: 22px;
}

.collapsible-panel > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 420px);
  min-height: 50px;
  padding: 11px 18px;
  border: 2px solid var(--gold);
  border-radius: 14px;
  background: #16375f;
  color: #fff;
  box-shadow: 0 8px 22px rgb(0 0 0 / 24%);
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  list-style: none;
}

.collapsible-panel > summary::-webkit-details-marker {
  display: none;
}

.collapsible-panel > summary::after {
  content: "▾";
  margin-left: 12px;
  color: var(--gold);
  font-size: 1.15rem;
}

.collapsible-panel[open] > summary::after {
  content: "▴";
}

.collapsible-label-open,
.collapsible-panel[open] .collapsible-label-closed {
  display: none;
}

.collapsible-panel[open] .collapsible-label-open {
  display: inline;
}

.information-disclosure > summary {
  margin-bottom: 18px;
}

.access-plan-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 250px;
  padding: 20px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: var(--radius-md);
  background: rgb(5 23 48 / 84%);
}

.access-plan-card h3 {
  margin: 12px 0 8px;
  color: #fff;
}

.access-plan-card p {
  flex: 1;
  color: var(--text-muted);
}

.access-plan-featured {
  border-color: rgb(221 184 95 / 76%);
  box-shadow: 0 0 0 1px rgb(221 184 95 / 20%), 0 18px 35px rgb(0 0 0 / 22%);
}

.access-plan-badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgb(46 126 211 / 25%);
  color: #cfe8ff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.access-production-note {
  margin-top: 18px;
  padding: 16px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgb(7 24 48 / 88%);
}

.access-production-note h3,
.access-production-note p {
  margin: 0 0 6px;
}

.access-production-note p:last-child {
  margin-bottom: 0;
  color: var(--text-muted);
}

.account-config-notice,
.auth-card,
.preview-controls {
  border: 1px solid rgb(221 184 95 / 42%);
  border-radius: 16px;
  background: rgb(6 27 53 / 68%);
}

.account-config-notice {
  margin: 1rem 0;
  padding: 1rem 1.15rem;
}

.account-config-notice h3,
.account-config-notice p {
  margin: 0;
}

.account-config-notice p {
  margin-top: 0.35rem;
  color: var(--text-muted);
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.auth-card {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}

.auth-card h3 {
  margin: 0;
}

.auth-card label {
  display: grid;
  gap: 0.35rem;
  color: #f7e8bd;
  font-weight: 700;
}

.auth-card input {
  min-width: 0;
  padding: 0.7rem 0.75rem;
  border: 1px solid rgb(185 216 243 / 55%);
  border-radius: 10px;
  background: rgb(255 255 255 / 96%);
  color: #102846;
  font: inherit;
}

.password-field {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border-radius: 10px;
  background: rgb(255 255 255 / 96%);
}

.password-field input {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  border-radius: 10px 0 0 10px;
}

.password-toggle {
  position: relative;
  z-index: 1;
  flex: 0 0 46px;
  min-width: 46px;
  border: 1px solid rgb(185 216 243 / 55%);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: #e8f3ff;
  color: #102846;
  cursor: pointer;
  font-size: 1rem;
}

.text-button {
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: #cfe8ff;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

.reset-password-card { margin: 1rem 0; }

.auth-message {
  margin: 0.8rem 0;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: rgb(96 191 145 / 18%);
  color: #e9fff2;
}

.auth-message[data-tone="error"] {
  background: rgb(210 88 88 / 20%);
  color: #ffe8e8;
}

.gift-access-panel {
  margin: 1rem 0;
  padding: 1rem 1.15rem;
  border: 1px solid rgb(221 184 95 / 52%);
  border-radius: 16px;
  background: rgb(6 27 53 / 76%);
}

.gift-access-panel h3,
.gift-access-panel p { margin-top: 0; }

.gift-form {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.gift-form label { display: grid; gap: 0.35rem; font-weight: 700; color: #f7e8bd; }
.gift-form input,
.gift-form select { min-width: 15rem; padding: 0.7rem; border-radius: 10px; font: inherit; }
.gift-code-result { margin: 1rem 0 0 !important; padding: 0.8rem; border-radius: 10px; background: rgb(96 191 145 / 18%); }
.gift-code-result strong { font-size: 1.15rem; letter-spacing: 0.08em; color: #fff2bd; }

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

.billing-actions,
.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.billing-actions .button {
  flex: 1 1 10rem;
}

.preview-controls {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
}

.preview-controls summary {
  cursor: pointer;
  color: #f7e8bd;
  font-weight: 800;
}

.preview-controls p {
  margin: 0.65rem 0;
  color: var(--text-muted);
}

@media (max-width: 760px) {
  .access-dialog {
    width: calc(100% - 16px);
    max-width: none;
    margin: 8px auto;
    border-radius: 16px;
  }

  .access-dialog-panel {
    padding: 22px 16px 30px;
  }

  .access-dialog-close {
    position: absolute;
    top: 8px;
    float: right;
    z-index: 2;
  }

  .auth-grid,
  .billing-plan-grid {
    grid-template-columns: 1fr;
  }
}

.upgrade-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid rgb(221 184 95 / 58%);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgb(31 76 126 / 86%), rgb(10 31 60 / 92%));
  box-shadow: var(--shadow);
}

.upgrade-notice h2,
.upgrade-notice p {
  margin-bottom: 5px;
}

.upgrade-notice p:last-child {
  margin-bottom: 0;
  color: var(--text-muted);
}

@media (display-mode: standalone) {
  .site-header {
    padding-top: max(18px, env(safe-area-inset-top));
  }

  .pwa-install-box {
    border-color: rgb(85 213 154 / 35%);
  }
}

.primary-nav {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.primary-nav button,
.calendar-view-toggle button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 16px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.primary-nav button:hover,
.calendar-view-toggle button:hover {
  background: rgb(255 255 255 / 8%);
  color: var(--text);
}

.primary-nav button[aria-current="page"],
.primary-nav button.is-active,
.calendar-view-toggle button[aria-pressed="true"] {
  border-color: rgb(120 183 255 / 48%);
  background: rgb(47 131 228 / 25%);
  color: #fff;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(24px, 5vw, 54px) 0;
}

.discovery-shortcuts {
  margin-bottom: 24px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgb(221 184 95 / 42%);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgb(8 31 61 / 94%), rgb(18 55 91 / 86%)),
    url("assets/cielo_stellato_luna_orizzonte.png") center / cover no-repeat;
}

.discovery-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.discovery-shortcut {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 16px 18px;
  border: 1px solid rgb(185 216 243 / 34%);
  border-radius: 15px;
  background: rgb(4 20 43 / 78%);
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.discovery-shortcut::after {
  content: "Apri la scheda →";
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
}

.discovery-shortcut strong {
  color: #fff;
  font-size: 1rem;
}

.discovery-shortcut span {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.discovery-shortcut:hover,
.discovery-shortcut:focus-visible {
  border-color: var(--gold);
  background: rgb(16 52 88 / 92%);
  transform: translateY(-1px);
}

[hidden],
.hidden {
  display: none !important;
}

.view-panel {
  padding: clamp(18px, 4vw, 34px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgb(18 47 92 / 82%), rgb(10 30 60 / 92%));
  box-shadow: var(--shadow);
}

.section-heading {
  max-width: 760px;
  margin-bottom: 28px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.section-heading p:last-child {
  margin: 8px 0 0;
  color: var(--text-muted);
}

.birth-form {
  display: grid;
  gap: 22px;
}

.reverse-estimate-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(112, 192, 232, 0.1);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.reverse-estimate-toggle input {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.reverse-estimate-box {
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(218, 183, 93, 0.42);
  border-radius: 18px;
  background: rgba(5, 24, 47, 0.48);
}

.reverse-estimate-box legend {
  padding: 0 8px;
  color: var(--gold, #e2c16d);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.reverse-estimate-preview {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(218, 183, 93, 0.12);
  color: var(--text);
  font-weight: 700;
}

.birth-live-preview {
  padding: 18px;
  border: 1px solid rgba(218, 183, 93, 0.62);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(25, 67, 111, 0.88), rgba(9, 31, 62, 0.94));
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
}

.birth-live-preview h3 {
  margin: 0 0 12px;
  color: var(--gold, #e2c16d);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
}

.birth-live-preview p {
  margin: 8px 0;
}

.birth-live-date {
  color: #fff;
  font-size: 1.08rem;
}

.birth-live-tendency {
  font-size: 1rem;
}

.birth-live-note {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-size: 0.84rem;
}

.result-note-warning {
  border-left: 4px solid var(--gold, #e2c16d);
  padding-left: 12px;
}

.cycle-choice-field {
  grid-column: 1 / -1;
}

.field .field-label {
  font-weight: 750;
}

.cycle-choice-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.field .cycle-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #081a35;
  color: var(--text);
  cursor: pointer;
}

.field .cycle-choice:has(input:checked) {
  border-color: var(--gold, #e2c16d);
  background: rgba(218, 183, 93, 0.14);
  box-shadow: 0 0 0 2px rgba(218, 183, 93, 0.18);
}

.field .cycle-choice input {
  width: 20px;
  min-height: 20px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--gold, #e2c16d);
}

.field .cycle-choice span,
.field .cycle-choice input:checked + span {
  color: var(--text);
  font-weight: 700;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-weight: 750;
}

.field label span,
.field small {
  color: var(--text-muted);
  font-weight: 400;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #081a35;
  color: var(--text);
}

.field-wide {
  grid-column: 1 / -1;
}

.inline-check,
.save-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.inline-check {
  width: fit-content;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500 !important;
}

.inline-check input,
.save-choice input {
  width: 20px;
  min-height: 20px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.button,
.icon-button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 750;
}

.button {
  width: fit-content;
  padding: 10px 16px;
}

.button-primary {
  border-color: #87c2ff;
  background: var(--primary-strong);
  color: #fff;
}

.button-primary:not(:disabled):hover {
  background: #1d6fc9;
}

.button-secondary,
.icon-button {
  border-color: var(--border);
  background: rgb(255 255 255 / 6%);
  color: var(--text);
}

.button-secondary:hover,
.icon-button:hover {
  background: rgb(255 255 255 / 12%);
}

.button-danger {
  border-color: rgb(255 142 142 / 60%);
  background: rgb(129 40 48 / 28%);
  color: #ffd8d8;
}

.button-danger:not(:disabled):hover {
  background: rgb(154 48 58 / 48%);
}

.button-full {
  width: 100%;
}

.result-panel {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgb(3 15 32 / 50%);
}

.result-panel:empty {
  display: none;
}

.result-panel p:first-child,
.result-panel p:last-child {
  margin-block: 0;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgb(4 19 40 / 48%);
}

.calendar-navigation,
.calendar-view-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-button {
  width: 44px;
  padding: 6px;
  font-size: 1.6rem;
  line-height: 1;
}

.calendar-title {
  margin: 0;
  text-align: center;
  text-transform: capitalize;
}

.calendar-year-picker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.calendar-year-picker input {
  width: 88px;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0c2448;
  color: var(--text);
  font: inherit;
  text-align: center;
}

.calendar-year-picker input:invalid {
  border-color: var(--danger);
}

.calendar-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 350px);
  align-items: start;
  gap: 20px;
}

.calendar-panel,
.day-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgb(5 20 43 / 66%);
}

.calendar-panel {
  padding: clamp(10px, 2.5vw, 20px);
}

.calendar-container {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  gap: clamp(4px, 1vw, 8px);
  min-width: 344px;
}

.calendar-weekday,
.weekday-header {
  padding: 7px 2px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 72px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0c2448;
  color: var(--text);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.calendar-day:hover {
  border-color: var(--primary);
  background: #153563;
  transform: translateY(-1px);
}

.calendar-day[aria-pressed="true"],
.calendar-day.is-selected {
  border-color: var(--focus);
  background: #244b79;
  box-shadow: 0 0 0 2px rgb(255 223 138 / 28%);
}

.calendar-day.is-today {
  outline: 2px solid var(--primary);
  outline-offset: -4px;
}

.calendar-day.is-outside-month {
  opacity: 0.48;
}

.calendar-day.fertile-high {
  border-left: 4px solid var(--success);
}

.calendar-day.fertile-mid {
  border-left: 4px solid var(--warning);
}

.calendar-day.fertile-low {
  border-left: 4px solid var(--danger);
}

.calendar-day.favor-male,
.calendar-day.favor-female,
.calendar-day.favor-neutral {
  box-shadow: inset 0 -4px 0 #ae8cff;
}

.day-number {
  font-size: 0.8rem;
  font-weight: 750;
}

.moon-icon,
.day-moon {
  margin-top: 2px;
  font-size: 1.25rem;
  filter: drop-shadow(0 0 6px rgb(200 220 255 / 38%));
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 16px;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

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

.legend-marker {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: currentColor;
}

.legend-high { color: var(--success); }
.legend-mid { color: var(--warning); }
.legend-low { color: var(--danger); }
.legend-symbolic { color: #ae8cff; }

.day-card {
  position: sticky;
  top: 18px;
  padding: 20px;
  box-shadow: 0 14px 30px rgb(0 0 0 / 18%);
}

.day-card h3 {
  margin: 0 32px 14px 0;
  font-size: 1.2rem;
  text-transform: capitalize;
}

.day-card-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.5rem;
}

.day-card-close:hover {
  background: rgb(255 255 255 / 9%);
  color: var(--text);
}

#dayContent {
  margin-bottom: 18px;
}

#dayContent p {
  margin: 8px 0;
}

.day-card-controls {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid rgb(255 223 138 / 38%);
  border-radius: var(--radius-sm);
  background: rgb(12 36 72 / 78%);
}

.day-card-controls label {
  color: #ffe7a3;
  font-size: 0.86rem;
  font-weight: 800;
}

.day-card-controls select,
.day-card-controls input {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0c2448;
  color: var(--text);
  font: inherit;
}

.day-cycle-fields {
  display: grid;
  gap: 8px;
  margin-top: 5px;
}

.day-card-section-title {
  margin: 20px 0 8px;
  color: #ffe7a3;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
}

.day-card-story {
  color: var(--text-muted);
  line-height: 1.55;
}

.day-card-route-story {
  margin: 14px 0 !important;
  padding: 12px 14px;
  border-left: 3px solid #ffe07d;
  background: rgb(255 224 125 / 8%);
  color: #e9f2ff;
  line-height: 1.5;
}

.day-card-prediction {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgb(61 116 184 / 35%), rgb(143 91 185 / 28%));
  color: #fff4c6;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.45;
}

.day-card-note,
.day-card-prompt {
  margin-top: 18px !important;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.energy-Bassa { color: #b5d6ff; }
.energy-Media { color: var(--warning); }
.energy-Alta { color: #ffabab; }

.fertile-high { border-left-color: var(--success); }
.fertile-mid { border-left-color: var(--warning); }
.fertile-low { border-left-color: var(--danger); }

.status-message {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.form-error {
  color: var(--danger);
}

.profiles-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  align-items: start;
  gap: 22px;
}

.profile-form,
.profile-archive {
  padding: clamp(16px, 3vw, 22px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgb(4 19 40 / 48%);
}

.profile-form {
  display: grid;
  gap: 18px;
}

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

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

.save-choice {
  padding: 14px;
  border: 1px solid rgb(120 183 255 / 36%);
  border-radius: var(--radius-sm);
  background: rgb(47 131 228 / 10%);
  cursor: pointer;
}

.save-choice span {
  display: grid;
  gap: 3px;
}

.save-choice small,
.privacy-note,
.empty-state {
  color: var(--text-muted);
}

.profile-archive-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.profile-archive-heading h3 {
  margin: 0;
}

.privacy-note {
  margin: 12px 0 18px;
  font-size: 0.88rem;
}

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

.profile-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0c2448;
}

.profile-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.profile-card h4 {
  margin: 0;
  font-size: 1.08rem;
}

.profile-card p {
  margin: 6px 0;
}

.role-badge,
.storage-badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 750;
}

.role-badge {
  padding: 4px 9px;
  background: rgb(120 183 255 / 18%);
  color: #cce5ff;
}

.storage-badge {
  margin: 8px 0 10px !important;
  padding: 3px 8px;
  background: rgb(255 209 102 / 14%);
  color: var(--warning);
}

.storage-badge.is-saved {
  background: rgb(85 213 154 / 14%);
  color: var(--success);
}

.location-status {
  min-height: 1.4em;
  margin: 2px 0 0;
  color: var(--warning);
  font-size: 0.84rem;
}

.location-status.is-verified {
  color: var(--success);
}

.place-badge {
  display: inline-flex;
  width: fit-content;
  margin: 4px 0 8px !important;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgb(255 209 102 / 14%);
  color: var(--warning);
  font-size: 0.75rem;
  font-weight: 750;
}

.place-badge.is-verified {
  background: rgb(85 213 154 / 14%);
  color: var(--success);
}

.astro-summary {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid rgb(174 140 255 / 36%);
  border-radius: var(--radius-sm);
  background: rgb(97 67 155 / 12%);
}

.birth-symbols-summary {
  margin-top: 12px;
  padding: 13px;
  border: 1px solid rgb(255 209 102 / 42%);
  border-radius: var(--radius-sm);
  background: rgb(83 62 24 / 18%);
}

.birth-symbols-summary h5 {
  margin: 0 0 8px;
  color: #ffe3a0;
  font-size: 0.9rem;
}

.birth-symbols-summary p {
  margin: 5px 0;
}

.birth-symbols-details {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.birth-symbols-details summary {
  min-height: 44px;
  padding: 8px 0;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.astro-summary h5 {
  margin: 0 0 8px;
  color: #dccdff;
  font-size: 0.9rem;
}

.astro-summary p {
  margin: 5px 0;
}

.astro-result {
  color: #eadfff;
}

.astro-unavailable,
.astro-warning {
  color: var(--warning);
}

.astro-warning {
  font-size: 0.8rem;
}

.astro-details {
  margin-top: 9px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.astro-details summary {
  min-height: 36px;
  padding: 7px 0;
  cursor: pointer;
  font-weight: 700;
}

.field input[readonly] {
  border-color: rgb(85 213 154 / 42%);
  background: rgb(10 49 50 / 48%);
}

.profile-card-actions {
  margin-top: 14px;
}

.compatibility-layout {
  display: grid;
  grid-template-columns: minmax(270px, 0.72fr) minmax(0, 1.28fr);
  align-items: start;
  gap: 22px;
}

.compatibility-form,
.compatibility-results-panel {
  padding: clamp(16px, 3vw, 22px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgb(4 19 40 / 48%);
}

.compatibility-form {
  display: grid;
  gap: 16px;
}

.compatibility-fieldset {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.compatibility-fieldset legend {
  padding: 0 7px;
  font-weight: 750;
}

.compatibility-selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.compatibility-members,
.compatibility-results {
  display: grid;
  gap: 10px;
}

.compatibility-member {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px;
  border: 1px solid rgb(120 183 255 / 24%);
  border-radius: var(--radius-sm);
  background: rgb(47 131 228 / 8%);
  cursor: pointer;
}

.compatibility-member:has(input:checked) {
  border-color: rgb(85 213 154 / 55%);
  background: rgb(85 213 154 / 10%);
}

.compatibility-member input {
  width: 20px;
  min-height: 20px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.compatibility-member span {
  display: grid;
  gap: 2px;
}

.compatibility-member small,
.compatibility-help {
  color: var(--text-muted);
}

.compatibility-help {
  margin: 0;
  font-size: 0.88rem;
}

.symbolic-inline-notice {
  margin: 0;
  padding: 12px;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: rgb(83 62 24 / 28%);
  color: #f3e6ca;
  font-size: 0.86rem;
}

.compatibility-results-panel > h2 {
  margin: 0 0 16px;
  font-size: 1.35rem;
}

.parchment-export-panel {
  display: grid;
  gap: 13px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgb(255 209 102 / 48%);
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, rgb(83 62 24 / 42%), rgb(12 36 72 / 92%));
}

.parchment-export-panel h3,
.parchment-export-panel p {
  margin: 0;
}

.parchment-export-panel h3 {
  color: #ffe3a0;
  font-size: 1.2rem;
}

.parchment-export-panel input[type="file"] {
  padding-block: 8px;
}

.parchment-export-panel input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgb(255 255 255 / 10%);
  color: var(--text);
  cursor: pointer;
}

.parchment-export-panel .status-message {
  min-height: 1.25em;
}

.parchment-group-summary {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 7%);
  color: #fff0c7;
  font-weight: 700;
}

.parchment-photo-fields {
  display: grid;
  gap: 10px;
}

.parchment-photo-field {
  padding: 12px;
  border: 1px solid rgb(255 209 102 / 25%);
  border-radius: var(--radius-sm);
  background: rgb(8 26 53 / 52%);
}

.birth-group-badge {
  width: fit-content;
  margin: 8px 0;
  padding: 6px 10px;
  border: 1px solid rgb(255 209 102 / 42%);
  border-radius: 999px;
  background: rgb(83 62 24 / 38%);
  color: #ffe3a0;
  font-size: 0.8rem;
  font-weight: 750;
}

.name-meaning-result {
  color: #fff0c7;
}

.compatibility-card {
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0c2448;
}

.birth-symbols-card {
  padding: 17px;
  border: 1px solid rgb(255 209 102 / 45%);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgb(83 62 24 / 38%), #0c2448);
}

.birth-symbols-card h3 {
  margin: 0 0 10px;
  color: #ffe3a0;
}

.birth-symbols-card p {
  margin: 7px 0;
}

.birth-symbols-lead {
  font-weight: 750;
}

.name-day-result {
  color: #fff0c7;
  font-weight: 750;
}

.name-day-alternative,
.name-day-missing {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.zodiac-inspiration {
  display: grid;
  gap: 4px;
  margin-top: 13px;
  padding: 12px;
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: rgb(255 209 102 / 8%);
}

.zodiac-inspiration h4,
.zodiac-inspiration h5 {
  margin: 4px 0;
  color: #ffe3a0;
}

.zodiac-inspiration p {
  margin: 2px 0;
}

.family-summary-card {
  padding: 18px;
  border: 1px solid rgb(85 213 154 / 48%);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgb(20 86 81 / 28%), #0c2448);
}

.family-summary-card h3,
.family-summary-card h4 {
  margin: 0;
}

.family-summary-card h4 {
  margin-top: 12px;
  color: #a9f0d0;
}

.family-summary-index {
  color: #a9f0d0;
  font-weight: 750;
}

.family-summary-reading,
.relationship-synthesis {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
}

.family-summary-reading {
  border-left: 3px solid var(--success);
  background: rgb(85 213 154 / 9%);
}

.relationship-synthesis {
  border-left: 3px solid var(--primary);
  background: rgb(47 131 228 / 9%);
}

.family-summary-reading h5,
.relationship-synthesis h5 {
  margin: 5px 0 0;
  color: #c9f7e4;
  font-size: 0.88rem;
}

.relationship-synthesis h5 {
  color: #c7e2ff;
}

.family-summary-reading p,
.relationship-synthesis p {
  margin: 2px 0 5px;
}

.compatibility-card h3,
.compatibility-card h4 {
  margin: 0;
}

.compatibility-card h4 {
  margin-top: 12px;
  color: #dccdff;
}

.compatibility-role,
.compatibility-summary,
.compatibility-index {
  margin: 7px 0;
}

.compatibility-role {
  color: var(--text-muted);
}

.compatibility-relative-astro {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 22px;
  margin: 12px 0;
  padding: 0;
}

.compatibility-relative-astro div {
  min-width: 0;
}

.compatibility-relative-astro dt {
  margin-bottom: 3px;
  color: #ffe3a0;
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.compatibility-relative-astro dd {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.compatibility-quality {
  display: inline-flex;
  width: fit-content;
  margin: 5px 0;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 750;
}

.quality-full {
  background: rgb(85 213 154 / 14%);
  color: var(--success);
}

.quality-partial {
  background: rgb(255 209 102 / 14%);
  color: var(--warning);
}

.quality-unavailable {
  background: rgb(255 142 142 / 14%);
  color: var(--danger);
}

.compatibility-index {
  font-weight: 750;
}

.compatibility-reading {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  border-left: 3px solid #ae8cff;
  border-radius: var(--radius-sm);
  background: rgb(97 67 155 / 12%);
}

.compatibility-reading h5 {
  margin: 6px 0 0;
  color: #dccdff;
  font-size: 0.86rem;
}

.compatibility-reading p {
  margin: 2px 0 5px;
}

.compatibility-details {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.compatibility-details summary {
  min-height: 44px;
  padding: 8px 0;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.compatibility-details ul {
  padding-left: 20px;
}

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

.info-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgb(4 19 40 / 48%);
}

.info-card h3 {
  margin-top: 0;
}

.info-card p {
  margin-bottom: 0;
  color: var(--text-muted);
}

.symbolic-notice {
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid #7f6b3c;
  border-left: 5px solid var(--accent);
  border-radius: var(--radius-md);
  background: rgb(83 62 24 / 28%);
}

.symbolic-notice h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.symbolic-notice p {
  margin: 0;
  color: #f3e6ca;
}

.site-footer {
  padding: 22px 16px 34px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 900px) {
  .calendar-toolbar {
    grid-template-columns: 1fr auto auto;
  }

  .calendar-title {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .calendar-navigation,
  .calendar-view-toggle {
    grid-row: 2;
  }

  .calendar-year-picker {
    grid-column: 2;
    grid-row: 2;
  }

  .calendar-view-toggle {
    grid-column: 3;
    justify-content: flex-end;
  }

  .calendar-workspace {
    grid-template-columns: 1fr;
  }

  .day-card {
    position: static;
  }

  .profiles-layout {
    grid-template-columns: 1fr;
  }

  .compatibility-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .site-header {
    padding-inline: 16px;
  }

  .cycle-choice-group {
    grid-template-columns: 1fr;
  }

  .pwa-install-box {
    align-items: stretch;
    flex-direction: column;
  }

  .pwa-install-box .button {
    width: 100%;
  }

  .access-summary,
  .upgrade-notice {
    align-items: stretch;
    flex-direction: column;
  }

  .access-actions,
  .access-actions .button,
  .upgrade-notice .button {
    width: 100%;
  }

  .access-plan-grid {
    grid-template-columns: 1fr;
  }

  .discovery-shortcut-grid {
    grid-template-columns: 1fr;
  }

  .access-plan-card {
    min-height: auto;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-logo {
    width: 68px;
  }

  .brand-subtitle {
    display: none;
  }

  .page-shell {
    width: min(100% - 20px, 1180px);
  }

  .form-grid,
  .profile-form-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }

  .profile-archive-heading {
    flex-direction: column;
  }

  .compatibility-selection-actions .button,
  #compatibilityRun,
  #parchmentPdfButton,
  #keepsakePdfButton {
    width: 100%;
  }

  .calendar-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .calendar-title {
    order: -1;
  }

  .calendar-navigation,
  .calendar-view-toggle {
    justify-content: center;
  }

  .calendar-year-picker {
    justify-content: center;
  }

  .calendar-view-toggle {
    overflow-x: auto;
  }

  .calendar-day {
    min-height: 62px;
  }
}

@media (max-width: 420px) {
  .brand {
    gap: 10px;
  }

  .brand-logo {
    width: 58px;
  }

  .eyebrow {
    display: none;
  }

  h1 {
    font-size: 1.35rem;
  }

  .primary-nav button,
  .calendar-view-toggle button {
    padding-inline: 13px;
  }

  .view-panel {
    padding: 14px;
  }

  .calendar-panel {
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .skip-link,
  .access-summary,
  .access-dialog,
  .upgrade-notice,
  .primary-nav,
  .calendar-toolbar,
  .button,
  .day-card-close,
  .site-footer {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
  }

  .site-header,
  .view-panel,
  .day-card,
  .symbolic-notice {
    border-color: #aaa;
    background: #fff;
    color: #111;
    box-shadow: none;
  }
}
