:root {
  color-scheme: light;
  --paper: #f8f6f1;
  --surface: #fffefa;
  --ink: #24213a;
  --muted: #635e72;
  --border: #e3ded8;
  --accent: #43338f;
  --accent-dark: #32246f;
  --accent-soft: #eee9fc;
  --green: #215844;
  --green-soft: #e8f4eb;
  --danger: #a03440;
  --danger-soft: #fff0ef;
  --space: clamp(1.125rem, 4vw, 3.5rem);
  --radius: 1.125rem;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 var(--font); }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
form, p, h1, h2, h3 { margin: 0; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -.035em; overflow-wrap: anywhere; }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 720; }
h2 { font-size: clamp(1.25rem, 2.5vw, 1.65rem); font-weight: 720; }
h3 { font-size: 1.13rem; font-weight: 710; }
:focus-visible { outline: 3px solid #8c70e5; outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 10; top: .5rem; left: .5rem; padding: .7rem 1rem; background: var(--surface); color: var(--accent); border-radius: .5rem; transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.app-shell { min-height: 100svh; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; width: min(100%, 84rem); min-height: 4.5rem; margin-inline: auto; padding: .6rem var(--space); }
.brand { width: fit-content; display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); font-size: 1.29rem; font-weight: 780; letter-spacing: -.05em; line-height: 1; text-decoration: none; white-space: nowrap; }
.brand-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--surface); font-size: .83rem; font-weight: 850; letter-spacing: -.045em; }
.brand-end { color: var(--accent); }
.top-nav { display: flex; gap: .3rem; align-items: center; }
.top-nav a, .logout { display: inline-flex; padding: .6rem .8rem; color: var(--muted); border: 0; border-radius: .5rem; background: transparent; font-size: .88rem; font-weight: 620; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.top-nav a:hover, .logout:hover { color: var(--accent-dark); background: var(--accent-soft); }
.top-nav .nav-current { color: var(--accent-dark); background: var(--accent-soft); }
.session { display: flex; justify-self: end; align-items: center; gap: .75rem; }
.account-label { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.main-content { width: min(100%, 84rem); flex: 1; margin-inline: auto; padding: clamp(1.35rem, 3.75vw, 3.3rem) var(--space) clamp(2.3rem, 5vw, 5rem); }
.footer { display: flex; justify-content: space-between; gap: .6rem 1.5rem; flex-wrap: wrap; width: min(100%, 84rem); margin-inline: auto; padding: 1.15rem var(--space); border-top: 1px solid var(--border); color: var(--muted); font-size: .8rem; }
.footer span:first-child { color: var(--accent); font-weight: 750; }

.feed-hero { position: relative; isolation: isolate; overflow: hidden; min-height: 16rem; display: flex; justify-content: space-between; align-items: end; gap: 1.35rem 2rem; padding: clamp(1.4rem, 4.5vw, 3.5rem); border-radius: calc(var(--radius) + .25rem); color: #fff; background: #35256f; }
.feed-hero::before, .feed-hero::after { position: absolute; z-index: -1; content: ""; display: block; transform: rotate(-26deg); pointer-events: none; }
.feed-hero::before { inset: -61% -9% -90% auto; width: 35%; min-width: 10rem; border-radius: 6rem; background: #5a47a6; }
.feed-hero::after { inset: -52% -15% -85% auto; width: 31%; min-width: 9rem; border: 1px solid #9281c9; border-radius: 7rem; }
.feed-hero-copy { max-width: 38rem; }
.eyebrow { margin-bottom: .65rem; color: var(--accent); font-size: .73rem; line-height: 1.45; font-weight: 740; letter-spacing: .105em; text-transform: uppercase; overflow-wrap: anywhere; }
.feed-hero .eyebrow, .login-art .eyebrow { color: #ded4ff; }
.page-lead { max-width: 41rem; margin-top: .75rem; color: var(--muted); font-size: clamp(.94rem, 1.5vw, 1.07rem); overflow-wrap: anywhere; }
.feed-hero .page-lead { color: #e8e1fb; }
.preserve-lines { white-space: pre-line; }
.page-header { margin: .4rem 0 clamp(1.6rem, 3.4vw, 2.8rem); }
.split-header { display: flex; justify-content: space-between; align-items: end; gap: 1.25rem 2rem; }
.back-link { display: inline-flex; align-items: center; gap: .45rem; margin-bottom: 1.1rem; color: var(--accent); font-size: .85rem; font-weight: 660; text-decoration: none; }
.back-link:hover, .text-link:hover { text-decoration: underline; }
.eyebrow-row { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; margin-bottom: .7rem; }
.eyebrow-row .eyebrow { margin: 0; }
.section-block { margin-top: clamp(1.5rem, 4vw, 2.85rem); }
.section-heading { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.section-heading p { color: var(--muted); font-size: .9rem; margin-top: .35rem; }
.count-label { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; padding: .2rem .55rem; min-width: 1.7rem; border-radius: 2rem; color: var(--accent); background: var(--accent-soft); font-size: .73rem; line-height: 1.35; font-weight: 700; letter-spacing: 0; white-space: nowrap; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.6rem; padding: .62rem 1rem; border: 1px solid transparent; border-radius: .6rem; font-size: .88rem; line-height: 1.24; font-weight: 690; text-decoration: none; text-align: center; transition: background-color .18s, border-color .18s; }
.button-primary { background: var(--accent); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--accent-dark); }
.button-light { background: #fffefa; color: var(--accent-dark); }
.button-light:hover { background: #eee9fc; }
.button-secondary { background: var(--surface); border-color: var(--border); color: var(--accent-dark); }
.button-secondary:hover { border-color: #b4a4e0; background: #f5f1ff; }
.button-small { min-height: 2.1rem; padding: .42rem .72rem; font-size: .79rem; }
.action-row, .form-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.form-actions { margin-top: 1.35rem; }

.collection-grid, .product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 1rem; }
.collection-tile, .product-card, .panel { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.collection-tile { display: block; text-decoration: none; transition: border-color .2s, box-shadow .2s; }
.collection-tile:hover { border-color: #b1a0da; box-shadow: 0 .45rem 1.5rem #291a5514; }
.collection-visual { position: relative; isolation: isolate; aspect-ratio: 1.8; display: grid; align-items: center; justify-items: end; overflow: hidden; background: #e7e1f5; }
.collection-visual img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.collection-visual-placeholder::before { position: absolute; z-index: -1; inset: -36% -15% -35% 49%; border: 1px solid #b6a6e4; border-radius: 45%; content: ""; transform: rotate(-28deg); background: #d9cff4; }
.store-cover-name { place-self: center; padding: .8rem; color: #453176; font-size: clamp(1.1rem, 2.4vw, 2rem); font-weight: 750; line-height: 1.1; text-align: center; overflow-wrap: anywhere; }
.collection-cover-header { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 18rem); gap: 1rem 2rem; align-items: center; }
.collection-cover-header .collection-visual { width: 100%; max-width: 18rem; border-radius: .85rem; }
.visual-tag { position: absolute; bottom: .8rem; left: .8rem; max-width: calc(100% - 1.6rem); padding: .33rem .63rem; color: var(--accent-dark); background: var(--surface); border-radius: .4rem; font-size: .75rem; font-weight: 720; overflow-wrap: anywhere; }
.collection-body, .product-body { padding: 1rem; }
.collection-caption { display: flex; justify-content: space-between; align-items: start; gap: .65rem; }
.collection-body p, .collection-body time { color: var(--muted); font-size: .83rem; margin-top: .52rem; overflow-wrap: anywhere; }
.collection-body time { display: block; font-size: .73rem; }
.round-arrow { display: grid; flex: none; width: 1.75rem; height: 1.75rem; place-items: center; color: var(--accent); background: var(--accent-soft); border-radius: 50%; font-size: .84rem; line-height: 1; }
.empty-state { grid-column: 1 / -1; padding: clamp(1.65rem, 5vw, 3.4rem); border: 1px dashed #cdc5d6; border-radius: var(--radius); background: #fffefa80; color: var(--muted); }
.empty-state h3 { margin-bottom: .45rem; color: var(--ink); }

.export-toolbar, .author-products-heading { justify-content: space-between; flex-wrap: wrap; }
.product-image { position: relative; isolation: isolate; aspect-ratio: 1; display: grid; place-items: center; background: #f0ece8; overflow: hidden; }
.product-image img { width: 100%; height: 100%; object-fit: contain; }
.telegram-card { max-width: 29rem; }
.telegram-batch-list { display: grid; gap: .75rem; padding: 0; list-style: none; }
.telegram-batch-item { padding: 1rem; }
.telegram-batch-title { justify-content: space-between; }
.telegram-batch-title h2 { font-size: 1rem; margin: 0; }
.image-placeholder { padding: .8rem 1.2rem; color: var(--muted); font-size: .88rem; text-align: center; }
.check-chip { position: absolute; z-index: 1; top: .7rem; right: .7rem; display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: .5rem; font-size: .75rem; font-weight: 700; cursor: pointer; }
.check-chip input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); }
.product-heading { display: flex; gap: .55rem .7rem; align-items: start; justify-content: space-between; flex-wrap: wrap; }
.price { color: var(--accent-dark); font-weight: 770; white-space: nowrap; }
.rate-notice { margin: .6rem 0; color: var(--muted); font-size: .83rem; }
.text-link { color: var(--accent); font-size: .82rem; font-weight: 680; text-decoration: none; }
.post-preview { margin-top: .8rem; border-top: 1px solid var(--border); padding-top: .75rem; }
.post-preview summary { color: var(--accent); font-size: .83rem; font-weight: 700; cursor: pointer; }
.post-preview textarea { width: 100%; resize: vertical; margin-top: .5rem; padding: .55rem .62rem; border: 1px solid var(--border); border-radius: .5rem; background: var(--paper); color: var(--ink); font-size: .84rem; }
.post-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .65rem; }
.copy-status { color: var(--muted); font-size: .77rem; }

.panel { padding: clamp(1.05rem, 3.6vw, 2rem); }
.panel-lead { margin: .55rem 0 1.25rem; color: var(--muted); font-size: .91rem; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.author-form { max-width: 46rem; }
.stack-form { display: grid; align-content: start; gap: 1rem; }
.stack-form > p { display: grid; gap: .34rem; }
.stack-form label { display: block; color: var(--ink); font-size: .87rem; font-weight: 680; }
.stack-form input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .stack-form textarea, .stack-form select { width: 100%; min-height: 2.75rem; padding: .58rem .7rem; border: 1px solid #cfc7d8; border-radius: .55rem; color: var(--ink); background: var(--surface); }
.stack-form textarea { min-height: 5rem; resize: vertical; }
.stack-form input[type=file] { max-width: 100%; font-size: .82rem; }
.stack-form .helptext { color: var(--muted); font-size: .77rem; }
.stack-form ul.errorlist { margin: 0; padding: .54rem .72rem .54rem 1.7rem; border-radius: .5rem; color: var(--danger); background: var(--danger-soft); font-size: .83rem; }
.stack-form .form-actions { margin-top: .12rem; }
.stack-form > .button { justify-self: start; }
.messages { display: grid; gap: .6rem; margin-bottom: 1.1rem; }
.message { padding: .7rem .95rem; border: 1px solid #d5c9f4; border-radius: .55rem; color: var(--accent-dark); background: var(--accent-soft); font-size: .89rem; }
.message.success { border-color: #cce2d2; color: var(--green); background: var(--green-soft); }
.message.error { border-color: #ecc1c3; color: var(--danger); background: var(--danger-soft); }

.author-list { display: grid; gap: .6rem; }
.author-list-row { display: flex; align-items: center; gap: .75rem 1rem; padding: .9rem 1rem; border: 1px solid var(--border); border-radius: .8rem; background: var(--surface); text-decoration: none; }
a.author-list-row:hover { border-color: #b1a0da; }
.store-icon, .author-thumbnail { width: 2.8rem; height: 2.8rem; display: grid; flex: none; place-items: center; overflow: hidden; border-radius: .5rem; color: var(--accent); background: var(--accent-soft); font-weight: 750; }
.author-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.author-list-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.author-list-name > span, .author-list-name p { display: block; margin-top: .18rem; color: var(--muted); font-size: .82rem; }
.author-list-name > .author-post-count { color: var(--ink); font-weight: 700; }
.status { display: inline-flex; align-items: center; justify-content: center; border-radius: .35rem; padding: .23rem .52rem; background: #eeeae6; color: #534b57; font-size: .73rem; font-weight: 660; white-space: nowrap; }
.status-live { background: var(--green-soft); color: var(--green); }
.price-original { background: var(--accent-soft); color: var(--accent-dark); }
.telegram-queue-form { max-width: 42rem; }
.telegram-queue-form input[type=datetime-local] { max-width: 18rem; }
.publication-grid { display: grid; gap: .8rem; }
.publication-heading { justify-content: space-between; }
.publication-counts { display: flex; flex-wrap: wrap; gap: .35rem .95rem; color: var(--muted); font-size: .87rem; }
.publication-counts strong { color: var(--ink); }
.publication-state[data-state=complete] { background: var(--green-soft); color: var(--green); }
.publication-state[data-state=queued], .publication-state[data-state=running] { background: var(--accent-soft); color: var(--accent-dark); }
.publication-state[data-state=paused], .publication-state[data-state=uncertain] { background: var(--danger-soft); color: var(--danger); }
.publication-error, .publication-actions { margin-top: .75rem; }
.publication-items { display: grid; gap: .45rem; margin: .6rem 0 0; padding-left: 1.2rem; font-size: .87rem; }
.publication-items li { padding-left: .2rem; overflow-wrap: anywhere; }
.publication-items li > :last-child { margin-left: .55rem; }

.login-content { min-height: 100svh; display: grid; align-content: center; width: min(100%, 77rem); margin-inline: auto; padding: var(--space); }
.login-layout { min-height: min(40rem, 82svh); display: grid; grid-template-columns: .95fr 1.05fr; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 1.4rem; }
.login-panel { display: flex; flex-direction: column; padding: clamp(1.2rem, 3.5vw, 2.8rem); }
.login-form-wrap { width: min(100%, 22rem); margin: auto; padding: 2.5rem 0; }
.login-form-wrap h1 { font-size: clamp(2rem, 3.9vw, 3rem); }
.login-form-wrap .stack-form { margin-top: 1.3rem; }
.login-art { position: relative; isolation: isolate; overflow: hidden; display: grid; align-items: end; padding: clamp(1.2rem, 4.5vw, 3.75rem); color: #fff; background: #35256f; }
.login-art h2 { max-width: 10ch; font-size: clamp(2.4rem, 4.6vw, 4.35rem); }
.login-art-text > p:last-child { margin-top: 1rem; color: #e8e1fb; }
.login-motif { position: absolute; z-index: -1; inset: -40% -37% 2% -3%; display: flex; align-items: stretch; justify-content: center; gap: .8rem; transform: rotate(-36deg); opacity: .86; }
.login-motif span { display: block; width: 18%; min-width: 3.5rem; border-radius: 5rem; background: #534099; }
.login-motif span:nth-child(2) { transform: translateY(-14%); border: 1px solid #8d7bc9; background: #6855b1; }
.login-motif span:nth-child(3) { transform: translateY(-23%); background: #7b66bd; }

@media (max-width: 57rem) {
  .collection-grid, .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-label { display: none; }
}
@media (max-width: 39rem) {
  .collection-cover-header { grid-template-columns: 1fr; }
  .topbar-inner { grid-template-columns: 1fr auto; gap: .6rem; padding-top: .75rem; padding-bottom: .55rem; }
  .top-nav { grid-column: 1 / -1; grid-row: 2; }
  .session { grid-column: 2; grid-row: 1; }
  .top-nav a { padding-inline: .7rem; }
  .feed-hero, .split-header { align-items: start; flex-direction: column; }
  .feed-hero { min-height: auto; }
  .feed-hero::before { opacity: .64; }
  .settings-grid, .login-layout { grid-template-columns: 1fr; }
  .login-content { align-content: start; }
  .login-layout { min-height: 0; }
  .login-form-wrap { padding: 1.75rem 0 1.1rem; margin-inline: 0; }
  .login-art { min-height: 12rem; }
  .login-art h2 { font-size: 2rem; }
  .author-product-row { flex-wrap: wrap; }
  .author-product-row .author-list-name { flex-basis: calc(100% - 4rem); }
}
@media (max-width: 29rem) {
  .collection-grid, .product-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
