.app-main {
  max-width: var(--max-width);
  min-height: calc(100vh - 82px);
  margin: 0 auto;
  padding: 56px var(--page-pad) 100px;
}

.app-nav a.is-active {
  text-decoration: underline;
  text-decoration-color: var(--acid);
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

.account-name {
  max-width: 210px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.83rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-account {
  margin: 80px 0 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.mobile-signout {
  cursor: pointer;
  padding: 0;
}

.auth-layout {
  display: grid;
  max-width: 1250px;
  min-height: calc(100vh - 82px);
  align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
  gap: clamp(50px, 9vw, 140px);
  margin: 0 auto;
  padding: 60px var(--page-pad) 100px;
}

.auth-intro h1 {
  max-width: 760px;
  margin-bottom: 26px;
  font-size: clamp(3.2rem, 7vw, 6.7rem);
}

.auth-intro > p:not(.eyebrow) {
  max-width: 620px;
  color: var(--ink-soft);
  font-size: 1.1rem;
}

.selected-plan {
  display: grid;
  max-width: 420px;
  gap: 3px;
  border-top: 1px solid var(--ink);
  margin-top: 42px;
  padding-top: 18px;
}

.selected-plan span,
.selected-plan small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.selected-plan strong {
  font-size: 1.4rem;
}

.auth-card {
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-md);
  background: var(--paper-bright);
  box-shadow: var(--shadow);
  padding: clamp(25px, 4vw, 42px);
}

.auth-card form,
.brief-form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

label > span {
  color: var(--muted);
  font-weight: 400;
}

input,
select,
textarea {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-sm);
  background: var(--paper-bright);
  padding: 11px 13px;
}

input::placeholder {
  color: #a09c92;
}

.form-error {
  min-height: 24px;
  margin-bottom: 0;
  color: var(--danger);
  font-size: 0.84rem;
}

.recovery-button {
  margin-top: 18px;
  padding: 0;
}

.auth-switch {
  border-top: 1px solid var(--line);
  margin: 24px 0 0;
  padding-top: 20px;
  font-size: 0.9rem;
}

.auth-switch a {
  font-weight: 700;
}

.trust-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.dashboard-heading,
.project-detail-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 44px;
}

.dashboard-heading h1,
.project-detail-heading h1,
.studio-heading h1 {
  max-width: 900px;
  margin-bottom: 0;
  font-size: clamp(3rem, 7vw, 6.5rem);
}

.account-strip {
  display: grid;
  align-items: center;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) auto;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line-dark);
  padding: 20px 0;
}

.account-strip > div {
  display: grid;
  gap: 4px;
  border-right: 1px solid var(--line);
  padding: 0 24px;
}

.account-strip > div:first-child {
  padding-left: 0;
}

.account-strip > div:last-child {
  border-right: 0;
}

.account-strip span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.account-actions {
  align-content: center;
  justify-items: start;
}

.receipt-room {
  border-top: 1px solid var(--ink);
  margin-top: 70px;
  padding-top: 22px;
}

.receipt-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.receipt-heading .eyebrow {
  margin-bottom: 7px;
}

.receipt-heading h2 {
  margin-bottom: 0;
  font-size: 2rem;
}

.receipt-heading > span,
.receipt-row span,
.receipt-unavailable {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.receipt-list {
  border-bottom: 1px solid var(--line-dark);
}

.receipt-row {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(170px, 1.35fr) repeat(3, minmax(100px, 0.7fr)) auto;
  gap: 22px;
  border-top: 1px solid var(--line);
  padding: 20px 0;
}

.receipt-row:first-child {
  border-top-color: var(--line-dark);
}

.receipt-row > div {
  display: grid;
  gap: 4px;
}

.receipt-identity strong {
  font-size: 1.05rem;
}

.receipt-link {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.receipt-link span {
  color: inherit;
  font-family: inherit;
  font-size: inherit;
}

.receipt-unavailable {
  text-align: right;
}

.receipt-empty {
  display: grid;
  min-height: 120px;
  place-content: center;
  justify-items: center;
  border: 1px dashed var(--line-dark);
  border-radius: var(--radius-sm);
  padding: 26px;
  text-align: center;
}

.receipt-empty span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.receipt-skeleton {
  min-height: 84px;
  border-radius: var(--radius-sm);
  background: linear-gradient(100deg, #e6e1d7 20%, #f2ede4 40%, #e6e1d7 60%);
  background-size: 200% 100%;
  animation: skeleton 1.4s infinite;
}

.setup-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-radius: var(--radius-sm);
  background: var(--acid);
  margin-top: 24px;
  padding: 17px 20px;
}

.setup-banner div {
  display: grid;
}

.setup-banner span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.projects-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 70px 0 24px;
}

.projects-heading h2 {
  margin-bottom: 0;
  font-size: 2rem;
}

.projects-heading span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

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

.project-card {
  position: relative;
  min-height: 270px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-md);
  background: var(--paper-bright);
  transition: box-shadow var(--ease), transform var(--ease);
}

.project-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.project-card-main {
  display: flex;
  height: 100%;
  justify-content: flex-end;
  flex-direction: column;
  padding: 26px;
  text-decoration: none;
}

.project-card h3 {
  margin: 58px 0 6px;
  font-size: 2rem;
}

.project-card p,
.project-card small {
  margin-bottom: 0;
  color: var(--muted);
}

.project-status {
  position: absolute;
  left: 22px;
  top: 20px;
  border-radius: 999px;
  background: var(--acid);
  padding: 5px 9px;
  font-family: var(--font-mono);
  font-size: 0.63rem;
  text-transform: uppercase;
}

.icon-text-button {
  position: absolute;
  right: 18px;
  top: 18px;
  min-width: 50px;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  text-decoration: underline;
}

.empty-state {
  display: grid;
  min-height: 320px;
  place-content: center;
  justify-items: center;
  border: 1px dashed var(--line-dark);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
}

.empty-state span {
  font-size: 1.6rem;
  font-weight: 700;
}

.empty-state p {
  max-width: 500px;
  color: var(--muted);
}

.skeleton-card,
.detail-skeleton {
  min-height: 270px;
  border-radius: var(--radius-md);
  background: linear-gradient(100deg, #e6e1d7 20%, #f2ede4 40%, #e6e1d7 60%);
  background-size: 200% 100%;
  animation: skeleton 1.4s infinite;
}

.detail-skeleton {
  min-height: 70vh;
}

@keyframes skeleton {
  to { background-position-x: -200%; }
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.7fr) minmax(560px, 1.3fr);
  gap: clamp(50px, 8vw, 120px);
}

.studio-heading {
  position: sticky;
  top: 40px;
  align-self: start;
}

.studio-heading h1 {
  font-size: clamp(3rem, 5vw, 5.5rem);
}

.studio-heading > p:last-child {
  max-width: 470px;
  color: var(--muted);
}

.brief-form {
  gap: 0;
}

.brief-form fieldset {
  display: grid;
  gap: 22px;
  border: 0;
  border-top: 1px solid var(--ink);
  margin: 0;
  padding: 30px 0 54px;
}

.brief-form legend {
  padding: 0;
  font-size: 1.45rem;
  font-weight: 700;
}

.brief-form legend span {
  margin-right: 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

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

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.choice input {
  position: absolute;
  opacity: 0;
}

.choice span {
  display: grid;
  min-height: 52px;
  place-items: center;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.choice input:checked + span {
  border-color: var(--ink);
  background: var(--acid);
}

.choice input:focus-visible + span {
  outline: 3px solid var(--acid);
  outline-offset: 2px;
}

.brief-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--ink);
  padding-top: 25px;
}

.brief-submit p {
  max-width: 390px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 45px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.project-detail-heading > div > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.concepts-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  border-top: 1px solid var(--ink);
  margin: 70px 0 26px;
  padding-top: 22px;
}

.concepts-heading span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.concepts-heading h2 {
  max-width: 700px;
  margin: 7px 0 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
}

.concepts-heading > p {
  max-width: 320px;
  color: var(--muted);
}

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

.concept-card {
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-md);
  background: var(--paper-bright);
}

.concept-card.is-selected {
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 5px var(--acid);
}

.concept-image-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #e9e4da;
}

.concept-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-placeholder {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
}

.selected-label {
  position: absolute;
  left: 15px;
  top: 15px;
  border-radius: 999px;
  background: var(--acid);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
}

.concept-copy {
  padding: 25px;
}

.concept-copy h3 {
  margin-bottom: 12px;
  font-size: 1.8rem;
}

.concept-copy p {
  min-height: 72px;
  color: var(--muted);
}

.palette-row {
  display: flex;
  gap: 7px;
  margin: 20px 0;
}

.palette-row span {
  width: 28px;
  height: 28px;
  border: 1px solid rgb(17 17 15 / 20%);
  border-radius: 50%;
  background: var(--swatch);
}

.brand-kit {
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: var(--paper);
  margin-top: 90px;
  padding: clamp(28px, 5vw, 70px);
}

.brand-kit .eyebrow {
  color: var(--acid);
}

.brand-kit-heading h2 {
  font-size: clamp(2.4rem, 5vw, 4.7rem);
}

.brand-kit-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(30px, 5vw, 70px);
  margin-top: 40px;
}

.kit-logo {
  display: grid;
  align-items: start;
  gap: 18px;
}

.kit-logo > span,
.kit-details > div > span {
  color: #aaa79f;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.kit-logo img {
  width: 100%;
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.kit-logo .button {
  width: max-content;
  border-color: var(--paper);
  color: var(--paper);
}

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

.kit-actions .kit-export-button {
  border-color: var(--acid);
  background: var(--acid);
  color: var(--ink);
}

.kit-actions .kit-export-button:hover:not(:disabled) {
  border-color: var(--paper);
  background: var(--paper);
  color: var(--ink);
}

.kit-export-note {
  max-width: 560px;
  margin: -4px 0 0;
  color: #aaa79f;
  font-size: 0.78rem;
  line-height: 1.55;
}

.kit-details {
  display: grid;
  align-content: start;
  gap: 42px;
}

.kit-palette,
.font-list {
  display: grid;
  gap: 10px;
  margin: 15px 0 0;
  padding: 0;
  list-style: none;
}

.kit-palette li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kit-palette i {
  width: 34px;
  height: 34px;
  border: 1px solid #555;
  border-radius: 50%;
  background: var(--swatch);
}

.kit-palette code {
  color: var(--paper);
}

.font-list {
  font-size: 1.45rem;
  font-weight: 700;
}

.kit-note {
  border-top: 1px solid #444;
  margin: 0;
  padding-top: 18px;
  color: #aaa79f;
  font-size: 0.78rem;
}

.toast {
  position: fixed;
  z-index: 120;
  right: 22px;
  bottom: 22px;
  display: flex;
  max-width: min(420px, calc(100vw - 44px));
  align-items: center;
  gap: 16px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.toast-error {
  background: var(--danger);
}

.toast button {
  min-width: 34px;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.3rem;
}

.app-loader {
  position: fixed;
  z-index: 150;
  inset: 0;
  display: grid;
  visibility: hidden;
  place-items: center;
  background: rgb(17 17 15 / 76%);
  opacity: 0;
  padding: 20px;
  transition: opacity var(--ease), visibility var(--ease);
}

.app-loader.is-visible {
  visibility: visible;
  opacity: 1;
}

.loader-card {
  display: grid;
  min-width: min(360px, 100%);
  justify-items: center;
  border-radius: var(--radius-md);
  background: var(--paper);
  padding: 38px;
  text-align: center;
}

.loader-card small {
  color: var(--muted);
}

.loader-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--line);
  border-top-color: var(--acid-strong);
  border-radius: 50%;
  margin-bottom: 17px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 980px) {
  .app-main {
    min-height: calc(100vh - 72px);
    padding-top: 40px;
  }

  .auth-layout,
  .studio-layout {
    grid-template-columns: 1fr;
  }

  .auth-layout {
    min-height: auto;
  }

  .studio-heading {
    position: static;
  }

  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .account-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px 0;
  }

  .account-strip > div:nth-child(2) {
    border-right: 0;
  }

  .brand-kit-grid {
    grid-template-columns: 1fr;
  }

  .receipt-row {
    grid-template-columns: minmax(160px, 1.2fr) repeat(2, minmax(100px, 0.7fr)) auto;
  }

  .receipt-row > div:nth-child(4) {
    display: none;
  }
}

@media (max-width: 680px) {
  .app-main {
    padding-top: 28px;
    padding-bottom: 70px;
  }

  .auth-layout {
    gap: 36px;
    padding-top: 35px;
  }

  .auth-intro h1,
  .dashboard-heading h1,
  .project-detail-heading h1,
  .studio-heading h1 {
    font-size: clamp(2.8rem, 14vw, 4.6rem);
  }

  .dashboard-heading,
  .project-detail-heading,
  .concepts-heading,
  .brief-submit,
  .setup-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-heading .button {
    width: 100%;
  }

  .account-strip {
    grid-template-columns: 1fr 1fr;
  }

  .account-strip > div {
    padding: 0 13px;
  }

  .account-strip > div:nth-child(3) {
    padding-left: 0;
  }

  .receipt-heading {
    align-items: flex-start;
  }

  .receipt-row {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .receipt-row > div:nth-child(4) {
    display: grid;
  }

  .receipt-identity,
  .receipt-link,
  .receipt-unavailable {
    grid-column: 1 / -1;
  }

  .receipt-link,
  .receipt-unavailable {
    text-align: left;
  }

  .project-grid,
  .concept-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

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

  .project-card {
    min-height: 230px;
  }

  .back-link {
    margin-bottom: 28px;
  }

  .concept-copy p {
    min-height: 0;
  }

  .brand-kit {
    border-radius: var(--radius-md);
    margin-top: 60px;
  }

  .kit-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .kit-logo .kit-actions .button {
    width: 100%;
  }

  .toast {
    right: 14px;
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }
}
