.app-body { background: var(--paper); }
.preview-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; min-height: 4rem; padding: .5rem clamp(.8rem, 3vw, 2rem); border-bottom: 1px solid #4a3b52; background: var(--dark); color: var(--dark-text); }
.app-wordmark { flex: 0 0 auto; font-size: 1.48rem; font-weight: 700; letter-spacing: -.07em; line-height: 1; text-decoration: none; }
.app-wordmark span { color: var(--dark-accent); }
.prototype-label { color: #d7c8dc; font-size: .84rem; }
.preview-bar nav { display: flex; flex-wrap: wrap; gap: .15rem .28rem; margin-inline: auto; }
.preview-bar nav a, .preview-website { display: inline-flex; align-items: center; gap: .25rem; min-height: 2.75rem; padding: .28rem .55rem; border-radius: .35rem; color: #e9dfee; font-size: .9rem; font-weight: 600; text-decoration: none; }
.preview-bar nav a:hover, .preview-website:hover { color: white; text-decoration: underline; text-underline-offset: .19em; }
.preview-bar nav a[aria-current='page'] { background: #45374e; color: white; }
.preview-bar :focus-visible, .dashboard-feature :focus-visible { outline-color: var(--dark-accent); }
.preview-layout { display: grid; grid-template-columns: 14.25rem minmax(0, 1fr); min-height: calc(100vh - 4rem); }
.preview-layout.auth-layout { display: block; }
.app-sidebar { display: flex; flex-direction: column; gap: 1rem; padding: 1.2rem .85rem; border-right: 1px solid #dacdde; background: #ede5ee; }
.sidebar-business, .sidebar-user { display: flex; align-items: center; gap: .62rem; padding: .3rem; min-width: 0; }
.sidebar-business strong, .sidebar-user strong { display: block; font-size: .88rem; overflow-wrap: anywhere; }
.sidebar-business small, .sidebar-user small { display: block; color: #5d5061; font-size: .8rem; }
.business-monogram, .user-avatar { flex: 0 0 auto; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .36rem; background: #d8c3e7; color: #452b53; font-weight: 700; }
.user-avatar { border-radius: 50%; background: #e1e6c5; color: #465335; font-size: .78rem; }
.app-sidebar nav { display: grid; gap: .19rem; }
.app-sidebar nav a { display: flex; align-items: center; gap: .52rem; min-height: 2.75rem; padding: .32rem .5rem; border: 1px solid transparent; border-radius: .35rem; color: #47384d; text-decoration: none; font-size: .93rem; font-weight: 600; }
.app-sidebar nav a:hover { background: #e4d7e8; }
.app-sidebar nav a[aria-current='page'] { border-color: #c5aed1; background: #dfcfe7; color: #372342; font-weight: 700; }
.app-sidebar nav a > span { display: grid; place-items: center; width: 1.25rem; font-size: 1.06rem; line-height: 1; }
.app-sidebar .sidebar-divider { margin-top: .48rem; }
.sidebar-user { margin-top: auto; padding-top: .95rem; border-top: 1px solid #dbcbdf; }
.app-main { min-width: 0; }
.app-screen { width: min(100%, 72rem); margin-inline: auto; padding: clamp(1.35rem, 4vw, 3.45rem); }
.screen-heading { display: flex; justify-content: space-between; align-items: end; gap: .7rem 1.1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.screen-heading h1, .auth-form-wrap h1 { font-size: clamp(2.85rem, 5.6vw, 5.5rem); line-height: .94; }
.screen-heading p, .auth-form-wrap > p { color: var(--muted); margin-top: .48rem; }
.app-button { display: inline-flex; align-items: center; justify-content: center; width: fit-content; min-height: 2.75rem; padding: .43rem .84rem; border: 1px solid transparent; border-radius: .36rem; background: #38283f; color: #fff; text-decoration: none; text-align: center; font-size: .91rem; font-weight: 700; cursor: pointer; transition: background .2s ease; }
.app-button:hover { background: #53366a; }
.app-button.app-secondary { border-color: #c6b4ce; background: var(--white); color: #482f56; }
.app-button.app-secondary:hover { background: #eee4f2; }
.app-button.app-destructive { background: #803f4f; }
.app-button.app-destructive:hover { background: #67313f; }
.app-link { min-height: 2.65rem; padding: 0; border: 0; background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: .19em; font-size: .9rem; font-weight: 700; cursor: pointer; }
.dashboard-feature { display: grid; grid-template-columns: 1fr minmax(11rem, .76fr); align-items: center; gap: 1rem clamp(1.25rem, 5vw, 4rem); padding: clamp(1rem, 4vw, 2.4rem); border: 1px solid #4f395d; border-radius: .65rem; background: radial-gradient(ellipse at right, #493751, #292032 76%); color: var(--dark-text); }
.feature-copy h2 { font-size: clamp(2.05rem, 4.5vw, 4.05rem); text-wrap: initial; }
.feature-copy p { margin: .7rem 0; color: #e1d4e2; }
.feature-copy a { display: inline-flex; align-items: center; gap: .32rem; min-height: 2.75rem; color: #efdbfa; font-size: .93rem; font-weight: 700; text-underline-offset: .22em; }
.feature-brief { padding: .82rem; border: 1px solid #786083; border-radius: .4rem; background: #392b43; }
.feature-brief > div { display: flex; align-items: center; gap: .52rem; padding: .15rem .34rem .55rem; }
.feature-brief > div > span { color: #e4c7f4; }
.feature-brief ul { display: grid; gap: .29rem; list-style: none; margin: 0; padding: 0; }
.feature-brief li { padding: .32rem .5rem; border: 1px solid #736079; border-radius: .24rem; color: #efe6ef; font-size: .86rem; }
.feature-brief li span { margin-right: .2rem; color: #dae5ae; }
.dashboard-library { margin-top: 1.4rem; }
.dashboard-library h2, .app-surface h2 { font: 700 1.18rem/1.22 var(--body); letter-spacing: -.015em; text-wrap: initial; }
.library-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: .68rem; }
.library-tile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .64rem; min-width: 0; padding: .76rem; border: 1px solid var(--line); border-radius: .42rem; background: var(--white); text-decoration: none; transition: border-color .2s ease, background .2s ease; }
.library-tile:hover { border-color: #ad8cbf; background: #faf3ff; }
.library-tile h3 { font-size: 1rem; letter-spacing: 0; }
.library-tile p { margin-top: .15rem; color: var(--muted); font-size: .89rem; }
.tile-icon { display: grid; place-items: center; width: 2.05rem; height: 2.05rem; border-radius: .35rem; background: #e9ddf0; color: #54396b; font-weight: 700; }
.tile-peach { background: #f2e1d9; color: #69483e; }
.tile-green { background: #e9edcf; color: #43522d; }
.tile-arrow { color: var(--accent); }

.app-surface { padding: clamp(.9rem, 2.65vw, 1.5rem); border: 1px solid var(--line); border-radius: .45rem; background: var(--white); }
.app-surface + .app-surface { margin-top: .82rem; }
.surface-bar, .settings-preference { display: flex; align-items: center; justify-content: space-between; gap: .65rem; flex-wrap: wrap; }
.surface-note { max-width: 43rem; margin: .48rem 0 .68rem; color: var(--muted); }
.app-definition { display: grid; margin: .7rem 0 0; }
.app-definition > div { display: grid; grid-template-columns: minmax(8rem, .33fr) 1fr; gap: .25rem .75rem; padding: .67rem 0; border-top: 1px solid var(--line); }
.app-definition dt { font-weight: 700; }
.app-definition dd { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.app-records { margin: .65rem 0 0; padding: 0; list-style: none; }
.app-records li { display: flex; align-items: center; justify-content: space-between; gap: .38rem .7rem; flex-wrap: wrap; padding: .68rem 0; border-top: 1px solid var(--line); }
.app-records li > div { max-width: min(100%, 43rem); overflow-wrap: anywhere; }
.app-records p { margin-top: .17rem; color: var(--muted); }
.record-actions { display: flex; flex-wrap: wrap; gap: .35rem .72rem; }
.tone-example { max-width: 42rem; margin-top: .85rem; padding: .76rem .86rem; border-left: 2px solid #a884bb; background: #f0e7f2; }
.tone-example p { margin-top: .25rem; }
.app-status { display: inline-block; padding: .18rem .44rem; border-radius: .25rem; background: #ebe1ef; color: #523664; font-size: .82rem; font-weight: 700; }
.app-status.status-positive { background: #e8edcf; color: #405231; }
.app-check { display: flex; align-items: center; gap: .45rem; }
.app-check input { width: 1rem; min-height: auto; height: 1rem; accent-color: var(--accent); }
.billing-cost { margin-top: .75rem; font: 450 3rem/.96 var(--display); }

.auth-screen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: min(100% - 2rem, 60rem); margin: clamp(1.4rem, 6vw, 5.6rem) auto; border: 1px solid var(--line); border-radius: .62rem; background: var(--white); overflow: hidden; }
.auth-intro { display: grid; align-content: center; gap: .72rem; padding: clamp(1.05rem, 4vw, 2.85rem); background: #e9dff0; }
.auth-intro h2 { font-size: clamp(2.25rem, 4.25vw, 4rem); text-wrap: initial; }
.auth-intro p { color: #514059; }
.auth-letter { display: grid; gap: .34rem; justify-self: start; margin: 1rem .25rem .3rem; padding: .7rem .85rem; border: 1px solid #cfbdd5; border-radius: .3rem; background: #fcf8f4; transform: rotate(-3deg); }
.auth-letter strong { font: 500 1.47rem/1.12 var(--display); }
.auth-letter > span { color: var(--muted); font-size: .83rem; }
.auth-form-wrap { padding: clamp(1.05rem, 4vw, 2.85rem); }
.auth-form-wrap h1 { font-size: clamp(2.5rem, 4vw, 3.75rem); }
.auth-form { margin-top: .95rem; }
.auth-switch { margin-top: 1rem !important; }
.auth-switch a { color: var(--accent); font-weight: 700; text-underline-offset: .16em; }
.app-form, #app-dialog-content { display: grid; gap: .35rem; }
.app-form textarea { min-height: 6rem; resize: vertical; padding: .53rem .65rem; border: 1px solid #a0979f; border-radius: .35rem; background: #fff; color: inherit; font: inherit; }
.app-form label:not(:first-child) { margin-top: .32rem; }
.app-form > button[type='submit'] { margin-top: .48rem; }
.field-help { color: var(--muted); font-size: .83rem; }
.reset-link { justify-self: start; }

.swatch-row { display: flex; flex-wrap: wrap; gap: .65rem 1rem; margin-block: .7rem 1rem; }
.swatch-row > span { font-size: .85rem; }
.swatch { display: block; width: 3.7rem; height: 2rem; margin-bottom: .2rem; border: 1px solid #b8aebd; border-radius: .26rem; }
.swatch-ink { background: var(--ink); }
.swatch-paper { background: var(--paper); }
.swatch-lilac { background: #e9dff0; }
.swatch-green { background: #e9edcf; }
.pattern-type { font: 450 2.25rem/1 var(--display); }
.pattern-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .38rem; margin-top: .65rem; }
.pattern-input { display: grid; max-width: 19rem; margin-top: .85rem; gap: .29rem; }
.pattern-input p { color: var(--muted); font-size: .82rem; }
.app-feedback { position: fixed; z-index: 3; right: 1rem; bottom: 1rem; max-width: min(28rem, calc(100% - 2rem)); padding: .63rem .83rem; border: 1px solid #c3cfa5; border-radius: .4rem; background: #e9edcf; color: #314226; font-weight: 600; box-shadow: 0 .3rem 1.2rem #30233720; }
.app-feedback:empty { width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.app-dialog h2 { padding-right: 1.6rem; font-size: clamp(2.35rem, 4.8vw, 3.35rem); text-wrap: initial; }
.app-dialog-inner { position: relative; padding: clamp(1rem, 4vw, 1.65rem); }
.app-dialog-inner > p { margin: .57rem 0 .68rem; color: var(--muted); }
.app-dialog-close { position: absolute; top: .44rem; right: .44rem; width: 2.75rem; height: 2.75rem; border: 0; border-radius: .35rem; background: #eee7f5; color: var(--ink); font: 1.28rem/1 var(--body); cursor: pointer; }
.app-dialog-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: .4rem; margin-top: .68rem; }
.dialog-checkout, .sample-payment-fields { display: grid; gap: .48rem; padding: .7rem; border: 1px solid #daccdf; border-radius: .36rem; background: #f3ebf4; }
.dialog-checkout > div { display: flex; flex-wrap: wrap; gap: .3rem 1rem; justify-content: space-between; }
.sample-payment-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sample-payment-fields > div:first-child, .sample-payment-fields > div:nth-child(2) { grid-column: 1 / -1; }
.sample-payment-fields input { width: 100%; margin-top: .22rem; background: var(--white); color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .app-screen:not([hidden]), .auth-screen:not([hidden]) { animation: app-arrival .28s ease-out both; }
  .app-dialog[open] { animation: app-arrival .24s ease-out both; }
}
@keyframes app-arrival { from { opacity: .55; translate: 0 .42rem; } to { opacity: 1; translate: none; } }

@media (max-width: 54rem) {
  .preview-layout { grid-template-columns: 12rem minmax(0, 1fr); }
  .preview-bar nav { margin-inline: auto 0; }
  .preview-website { display: none; }
  .dashboard-feature { grid-template-columns: 1fr; }
}

@media (max-width: 43rem) {
  .preview-bar { gap: .2rem .7rem; }
  .preview-bar nav { flex-basis: 100%; margin: 0; }
  .preview-bar nav a { font-size: .83rem; padding-inline: .39rem; }
  .preview-layout { display: block; }
  .app-sidebar { gap: .32rem; padding: .48rem .58rem; border-right: 0; border-bottom: 1px solid #dacdde; }
  .app-sidebar nav { display: flex; gap: .22rem; overflow-x: auto; padding: .15rem .12rem .4rem; }
  .app-sidebar nav a { flex: 0 0 auto; }
  .app-sidebar nav a:focus-visible { outline-offset: 1px; }
  .app-sidebar .sidebar-divider { margin-top: 0; }
  .sidebar-user { display: none; }
  .auth-screen { grid-template-columns: 1fr; }
  .auth-intro { order: 2; }
  .auth-letter { display: none; }
}

@media (max-width: 30rem) {
  .library-grid, .app-definition > div { grid-template-columns: 1fr; }
}
