/* ==========================================================================
   myslop.shop — app.css  (v1.0)
   Plain CSS, no build step. Mobile-first; breakpoints: 640 / 900 / 1200px.

   FONTS (self-host later, OFL):  Geist 400/500/600/700 · Geist Mono 400/500
   THEME:  light by default; dark via prefers-color-scheme, overridable with
           <html data-theme="light|dark">.

   --------------------------------------------------------------------------
   CLASS INDEX
   --------------------------------------------------------------------------
   Layout ........ .container  .container--narrow  .page  .page-head
                   .filters-toggle  .filters-panel (.is-open on mobile)
                   .layout-detail--read (article width capped for reading)
                   .page-head__title  .page-head__lead  .page-head__meta
                   .section  .section-head  .section-head__title
                   .section-head__eyebrow  .section-head__link
                   .layout-sidebar (__main, __aside)  .layout-detail
                   .stack (--sm/--lg)  .cluster  .divider
   Header ........ .site-header  .site-header__inner  .brand  .brand__mark
                   .brand__word  .header-search  .header-search__input
                   .site-nav  .site-nav__link (.is-active)  .site-header__actions
                   .site-menu (mobile nav, inside .dropdown)
   Footer ........ .site-footer  .site-footer__grid  .site-footer__col
                   .site-footer__bottom
   Hero .......... .hero  .hero__eyebrow  .hero__title  .hero__lead
                   .hero-search (__input, __btn)  .hero__quick  .hero__stats
   Buttons ....... .btn  .btn--primary  .btn--secondary  .btn--ghost
                   .btn--danger  .btn--sm  .btn--lg  .btn--block  .btn--icon
                   .btn__count  .like-btn[aria-pressed]  .theme-toggle
   Forms ......... .field  .field__label  .field__hint  .field__error
                   .field--invalid  .field__counter  .input  .textarea  .select
                   .input-group (__addon)  .check  .form-actions  .form-grid
   Tags .......... .tag  .tag--lg  .tag--active  .tag__count  .tag-list
                   .tag-cloud
   Tag input ..... .tag-input  .tag-input__chip  .tag-input__remove
                   .tag-input__field  .tag-input__suggestions
                   .tag-input__option[aria-selected]
   Tabs .......... .tabs  .tabs__tab[aria-selected]  .segmented
                   .segmented__item[aria-pressed|aria-current]
   Cards ......... .app-card  .app-card--sponsored  .app-card__cover
                   .app-card__body  .app-card__head  .app-card__title
                   .app-card__link (stretched)  .app-card__tagline
                   .app-card__foot  .app-card__author  .app-card__stats
                   .app-row (+ --sponsored)  list variant for search results
                   .panel  .panel__head  .panel__body
   Badges ........ .badge  .badge--success|warning|danger|info|accent|outline
                   .badge-sponsored  .badge-demo  .dot
   Grid .......... .grid  .grid--cards  .grid--strip  .grid--2  .grid--3
   Nav bits ...... .pagination  .pagination__item  .pagination__gap
                   .breadcrumb  .dropdown  .dropdown__menu  .dropdown__item
                   .dropdown__sep  .dropdown__label
   Feedback ...... .alert (--success|warning|danger|info)  .alert__title
                   .flash  .empty  .empty__icon  .empty__title  .empty__text
                   .skeleton (--text|--title|--cover|--avatar)
                   .toast-region  .toast (--success|--danger)  .progress
   Overlay ....... .modal (on <dialog>)  .modal--static  .modal__header
                   .modal__body  .modal__footer
   Data .......... .table-wrap  .table  .table--compact  .table__num
                   .table__actions  .stat  .stat__label  .stat__value
                   .stat__delta
   Pricing ....... .pricing  .plan  .plan--featured  .plan__name  .plan__price
                   .plan__features  .plan__cta  .plan__ribbon
   Detail ........ .app-hero  .app-icon  .app-hero__title  .app-hero__tagline
                   .app-hero__actions  .meta  .meta__item  .meta-list
   Markdown ...... .prose  (h1–h6 p a img video iframe .embed table pre code
                   blockquote hr ul ol .task-list-item kbd details)
   Editor ........ .md-editor  .md-editor__head  .md-editor__tabs
                   .md-editor__toolbar  .md-editor__tool  .md-editor__sep
                   .md-editor__body (--split)  .md-editor__input
                   .md-editor__preview  .md-editor__foot  .md-editor__drop
                   .md-editor.is-dragover
   Upload ........ .dropzone (.is-dragover)  .dropzone__icon  .dropzone__title
                   .dropzone__hint  .upload-item  .cover-preview
   Admin ......... .admin  .admin__sidebar  .admin__main  .side-nav
                   .side-nav__link (.is-active)  .side-nav__count
   Auth .......... .auth  .auth__card  .auth__aside  .oauth-btn  .or-sep
   Profile ....... .profile-head  .avatar (--sm|--lg|--xl)
   Utilities ..... .visually-hidden  .mono  .muted  .subtle  .nowrap
                   .hide-mobile  .hide-desktop  .icon  .kbd
   States ........ .is-active  .is-dragover  .is-loading  [aria-*] driven
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Neutral base (warm graphite / off-white) */
  --bg:            #F6F5F1;
  --surface:       #FFFFFF;
  --surface-2:     #EFEEE9;
  --surface-3:     #E7E5DF;
  --border:        #E1DFD8;
  --border-strong: #C9C6BD;
  --text:          #161614;
  --text-2:        #55534D;
  --text-3:        #6E6B64;   /* min. 4.5:1 on --bg and --surface-2 */

  /* Accent: signal orange */
  --accent:             #FF5A1F;
  --accent-hover:       #F04A0E;
  --on-accent:          #141210;
  --accent-text:        #B83A0B;  /* links / accent text on light surfaces */
  --accent-soft:        #FFE9DF;
  --accent-soft-border: #FFC9B2;

  /* Semantic */
  --success: #1F7A3A;  --success-soft: #E5F2E8;  --success-border: #B9DCC2;
  --warning: #8A5A00;  --warning-soft: #FBF0D9;  --warning-border: #EBD39C;
  --danger:  #C42B1C;  --danger-soft:  #FCE8E5;  --danger-border:  #F1BCB5;
  --info:    #1F5FA8;  --info-soft:    #E6EEF8;  --info-border:    #BCD0EA;

  /* Sponsored */
  --sponsored-bg:     #FBF7EF;
  --sponsored-border: #E5D8BF;
  --sponsored-text:   #6A5428;

  --focus: #B83A0B;
  --overlay: rgba(22, 22, 20, .48);
  --code-bg: #F1F0EB;
  --selection: #FFD3BF;

  /* Type */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --fs-2xs: .6875rem;  /* 11 */
  --fs-xs:  .75rem;    /* 12 */
  --fs-sm:  .8125rem;  /* 13 */
  --fs-base:.9375rem;  /* 15 */
  --fs-md:  1.0625rem; /* 17 */
  --fs-lg:  1.25rem;   /* 20 */
  --fs-xl:  1.5rem;    /* 24 */
  --fs-2xl: 2rem;      /* 32 */
  --fs-3xl: clamp(2.125rem, 1.4rem + 3.2vw, 3.5rem); /* 34–56 hero */
  --lh-tight: 1.15;
  --lh-snug: 1.35;
  --lh-base: 1.55;
  --tracking-tight: -.02em;
  --tracking-mono: .02em;

  /* Spacing (4px base) */
  --sp-0: 2px;  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;
  --sp-16: 64px; --sp-20: 80px;

  /* Radii */
  --r-xs: 3px; --r-sm: 5px; --r-md: 8px; --r-lg: 12px; --r-pill: 999px;

  /* Elevation (kept subtle, no glows) */
  --shadow-1: 0 1px 0 rgba(22, 22, 20, .04);
  --shadow-2: 0 1px 2px rgba(22, 22, 20, .06), 0 2px 8px -2px rgba(22, 22, 20, .08);
  --shadow-pop: 0 12px 32px -8px rgba(22, 22, 20, .22), 0 2px 6px rgba(22, 22, 20, .08);

  /* Layout */
  --container: 1280px;
  --container-narrow: 760px;
  --gutter: 16px;
  --header-h: 60px;
  --control-h: 36px;
  --control-h-sm: 30px;
  --control-h-lg: 44px;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: 140ms;
}

@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 1200px) { :root { --gutter: 32px; } }

/* Dark theme tokens — shared by media query and explicit override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0F0F0E; --surface: #171716; --surface-2: #1E1E1C; --surface-3: #262624;
    --border: #2A2A27; --border-strong: #3B3A36;
    --text: #EDEBE6; --text-2: #A9A69F; --text-3: #8E8B84;
    --accent: #FF6A2B; --accent-hover: #FF7E45; --on-accent: #140C07;
    --accent-text: #FF8A55; --accent-soft: #2A1810; --accent-soft-border: #5A2D17;
    --success: #4FBF73; --success-soft: #12261A; --success-border: #24492F;
    --warning: #E0A93A; --warning-soft: #2A2110; --warning-border: #4D3B17;
    --danger:  #F2685A; --danger-soft:  #2C1513; --danger-border:  #55251F;
    --info:    #6FA6E8; --info-soft:    #121E2C; --info-border:    #233A57;
    --sponsored-bg: #1A1813; --sponsored-border: #3A3224; --sponsored-text: #CDB98F;
    --focus: #FF8A55; --overlay: rgba(0, 0, 0, .64); --code-bg: #1B1B19; --selection: #5A2D17;
    --shadow-1: 0 1px 0 rgba(0, 0, 0, .3);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -4px rgba(0, 0, 0, .5);
    --shadow-pop: 0 16px 40px -8px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F0F0E; --surface: #171716; --surface-2: #1E1E1C; --surface-3: #262624;
  --border: #2A2A27; --border-strong: #3B3A36;
  --text: #EDEBE6; --text-2: #A9A69F; --text-3: #8E8B84;
  --accent: #FF6A2B; --accent-hover: #FF7E45; --on-accent: #140C07;
  --accent-text: #FF8A55; --accent-soft: #2A1810; --accent-soft-border: #5A2D17;
  --success: #4FBF73; --success-soft: #12261A; --success-border: #24492F;
  --warning: #E0A93A; --warning-soft: #2A2110; --warning-border: #4D3B17;
  --danger:  #F2685A; --danger-soft:  #2C1513; --danger-border:  #55251F;
  --info:    #6FA6E8; --info-soft:    #121E2C; --info-border:    #233A57;
  --sponsored-bg: #1A1813; --sponsored-border: #3A3224; --sponsored-text: #CDB98F;
  --focus: #FF8A55; --overlay: rgba(0, 0, 0, .64); --code-bg: #1B1B19; --selection: #5A2D17;
  --shadow-1: 0 1px 0 rgba(0, 0, 0, .3);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -4px rgba(0, 0, 0, .5);
  --shadow-pop: 0 16px 40px -8px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);
}


/* --------------------------------------------------------------------------
   2. RESET / BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
main { flex: 1 0 auto; }
img, picture, video, canvas, svg, iframe { display: block; max-width: 100%; }
img, video { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, h4, h5, h6, li, dd, td, th { overflow-wrap: break-word; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: var(--lh-tight); letter-spacing: var(--tracking-tight); text-wrap: balance; }
p { text-wrap: pretty; }
ul[class], ol[class] { list-style: none; padding: 0; }
table { border-collapse: collapse; border-spacing: 0; }
hr { border: 0; border-top: 1px solid var(--border); }
::selection { background: var(--selection); color: var(--text); }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Icons: inline SVG, 24×24 viewBox, stroke = currentColor */
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 14px; height: 14px; }
.icon--lg { width: 20px; height: 20px; }
.icon--fill { fill: currentColor; stroke: none; }


/* --------------------------------------------------------------------------
   3. UTILITIES
   -------------------------------------------------------------------------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: var(--tracking-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.link { color: var(--accent-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.link:hover { text-decoration-thickness: 2px; }
.skip-link { position: absolute; left: var(--sp-2); top: -100px; z-index: 100; padding: var(--sp-2) var(--sp-3); background: var(--text); color: var(--bg); border-radius: var(--r-sm); }
.skip-link:focus { top: var(--sp-2); }
@media (max-width: 899.98px) { .hide-mobile { display: none !important; } }
@media (min-width: 900px) { .hide-desktop { display: none !important; } }

.kbd, kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.6em; height: 1.6em; padding: 0 .4em;
  font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 500; line-height: 1;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: var(--r-xs);
}

.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack--xs { gap: var(--sp-1); }
.stack--sm { gap: var(--sp-2); }
.stack--lg { gap: var(--sp-8); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.cluster--between { justify-content: space-between; }
.divider { height: 1px; background: var(--border); border: 0; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }


/* --------------------------------------------------------------------------
   4. LAYOUT
   -------------------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: calc(var(--container-narrow) + 2 * var(--gutter)); }

.page { padding-block: var(--sp-6) var(--sp-16); }
@media (min-width: 900px) { .page { padding-block: var(--sp-8) var(--sp-20); } }

.page-head { display: flex; flex-direction: column; gap: var(--sp-2); padding-bottom: var(--sp-6); margin-bottom: var(--sp-6); border-bottom: 1px solid var(--border); }
.page-head__eyebrow { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); letter-spacing: var(--tracking-mono); }
.page-head__title { font-size: var(--fs-xl); }
.page-head__lead { color: var(--text-2); max-width: 64ch; }
.page-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); }
.page-head__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); }
@media (min-width: 900px) { .page-head__title { font-size: var(--fs-2xl); } }

.section { padding-block: var(--sp-8); }
.section + .section { border-top: 1px solid var(--border); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.section-head__titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.section-head__eyebrow { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.section-head__title { font-size: var(--fs-lg); }
.section-head__link { display: inline-flex; align-items: center; gap: var(--sp-1); flex: none; font-size: var(--fs-sm); color: var(--text-2); }
.section-head__link:hover { color: var(--text); }

/* listing with filter sidebar (tag, search) */
.layout-sidebar { display: grid; gap: var(--sp-6); }
.layout-sidebar__aside { display: flex; flex-direction: column; gap: var(--sp-6); min-width: 0; }
.layout-sidebar__main { min-width: 0; }
/* Mobile: filters collapse behind .filters-toggle; add .is-open to .filters-panel (tiny JS) to show */
.filters-toggle { align-self: flex-start; }
.filters-panel { display: flex; flex-direction: column; gap: var(--sp-6); }
@media (max-width: 899.98px) {
  .filters-panel:not(.is-open) { display: none; }
  .filters-panel.is-open { padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
}
@media (min-width: 900px) { .filters-toggle { display: none; } }
@media (min-width: 900px) {
  .layout-sidebar { grid-template-columns: 232px minmax(0, 1fr); gap: var(--sp-8); }
  .layout-sidebar__aside { position: sticky; top: calc(var(--header-h) + var(--sp-6)); align-self: start; }
}

/* app detail: content + right rail */
.layout-detail { display: grid; gap: var(--sp-8); }
.layout-detail > * { min-width: 0; }
@media (min-width: 1024px) {
  .layout-detail { grid-template-columns: minmax(0, 1fr) 300px; gap: var(--sp-10); }
  .layout-detail--read { grid-template-columns: minmax(0, 800px) 300px; justify-content: space-between; }
  .layout-detail__aside { position: sticky; top: calc(var(--header-h) + var(--sp-6)); align-self: start; }
}

.grid { display: grid; gap: var(--sp-4); }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 264px), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
@media (min-width: 640px) { .grid { gap: var(--sp-5); } }

/* horizontal strip that scrolls inside itself on small screens (no page scroll) */
.grid--strip {
  grid-auto-flow: column; grid-auto-columns: min(82%, 300px);
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  padding-bottom: var(--sp-2); margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter);
  scrollbar-width: thin;
}
.grid--strip > * { scroll-snap-align: start; }
@media (min-width: 900px) {
  .grid--strip { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; margin-inline: 0; padding-inline: 0; }
}


/* --------------------------------------------------------------------------
   5. HEADER
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  backdrop-filter: saturate(1.2) blur(8px);
}
.site-header__inner {
  display: grid; align-items: center;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand . actions" "search search search";
  gap: var(--sp-2) var(--sp-3);
  padding-block: var(--sp-2) var(--sp-3);
}
@media (min-width: 900px) {
  .site-header__inner {
    grid-template-columns: auto minmax(220px, 440px) 1fr auto;
    grid-template-areas: "brand search nav actions";
    gap: var(--sp-5); min-height: var(--header-h); padding-block: 0;
  }
}

.brand { grid-area: brand; display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text); min-height: 40px; border-radius: var(--r-sm); }
.brand__logo { height: 26px; width: auto; }
.brand__mark { width: 26px; height: 26px; }

.header-search { grid-area: search; position: relative; display: flex; align-items: center; }
.header-search > .icon { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.header-search__input {
  width: 100%; height: var(--control-h); padding: 0 40px 0 34px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: var(--fs-sm); color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.header-search__input::placeholder { color: var(--text-3); }
.header-search__input:hover { border-color: var(--border-strong); }
.header-search__input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.header-search .kbd { position: absolute; right: 9px; pointer-events: none; }
.header-search__input::-webkit-search-cancel-button { display: none; }

.site-nav { grid-area: nav; display: none; align-items: center; gap: var(--sp-1); }
@media (min-width: 900px) { .site-nav { display: flex; } }
.site-nav__link {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 var(--sp-3);
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); border-radius: var(--r-sm);
  transition: color var(--dur), background-color var(--dur);
}
.site-nav__link:hover { color: var(--text); background: var(--surface-2); }
.site-nav__link.is-active, .site-nav__link[aria-current="page"] { color: var(--text); background: var(--surface-2); }

.site-header__actions { grid-area: actions; display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); }

/* mobile menu list inside dropdown */
.site-menu { display: flex; flex-direction: column; }


/* --------------------------------------------------------------------------
   6. FOOTER
   -------------------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg); padding-block: var(--sp-10) var(--sp-6); font-size: var(--fs-sm); color: var(--text-2); margin-top: auto; }
.site-footer__grid { display: grid; gap: var(--sp-8); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.site-footer__brand { grid-column: 1 / -1; display: flex; flex-direction: column; gap: var(--sp-3); max-width: 34ch; }
@media (min-width: 900px) { .site-footer__grid { grid-template-columns: 2fr repeat(3, 1fr); } .site-footer__brand { grid-column: auto; } }
.site-footer__col { display: flex; flex-direction: column; gap: var(--sp-2); }
.site-footer__heading { font-family: var(--font-mono); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: var(--sp-1); font-weight: 500; }
.site-footer__col a:hover { color: var(--text); }
.site-footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-10); padding-top: var(--sp-5); border-top: 1px solid var(--border); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); }


/* --------------------------------------------------------------------------
   7. BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: var(--control-h); padding: 0 14px;
  font-size: var(--fs-sm); font-weight: 500; line-height: 1; white-space: nowrap;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-bd); border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur);
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:hover { --btn-bg: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn .icon { margin-inline: -2px; }

.btn--primary { --btn-bg: var(--accent); --btn-fg: var(--on-accent); --btn-bd: transparent; font-weight: 600; }
.btn--primary:hover { --btn-bg: var(--accent-hover); }
.btn--secondary { --btn-bg: var(--surface); }
.btn--dark { --btn-bg: var(--text); --btn-fg: var(--bg); --btn-bd: transparent; }
.btn--dark:hover { --btn-bg: color-mix(in srgb, var(--text) 86%, var(--bg)); }
.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2); box-shadow: none; }
.btn--ghost:hover { --btn-bg: var(--surface-2); --btn-fg: var(--text); }
.btn--danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: transparent; }
.btn--danger:hover { --btn-bg: color-mix(in srgb, var(--danger) 88%, #000); }
.btn--danger-outline { --btn-fg: var(--danger); --btn-bd: var(--danger-border); }
.btn--danger-outline:hover { --btn-bg: var(--danger-soft); }

.btn--sm { height: var(--control-h-sm); padding: 0 10px; font-size: var(--fs-xs); border-radius: var(--r-sm); gap: 6px; }
.btn--lg { height: var(--control-h-lg); padding: 0 20px; font-size: var(--fs-base); }
.btn--block { width: 100%; }
.btn--icon { width: var(--control-h); padding: 0; }
.btn--icon.btn--sm { width: var(--control-h-sm); }

.btn__count { font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); padding-left: var(--sp-2); margin-left: 2px; border-left: 1px solid var(--border); align-self: stretch; display: inline-flex; align-items: center; }
.btn--primary .btn__count { color: inherit; border-color: color-mix(in srgb, var(--on-accent) 25%, transparent); }

.btn.is-loading { color: transparent; position: relative; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--btn-fg); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Like / heart */
.like-btn .icon { transition: transform var(--dur) var(--ease); }
.like-btn[aria-pressed="true"] { --btn-bg: var(--accent-soft); --btn-bd: var(--accent-soft-border); --btn-fg: var(--accent-text); }
.like-btn[aria-pressed="true"] .icon { fill: currentColor; }
.like-btn[aria-pressed="true"] .btn__count { color: var(--accent-text); border-color: var(--accent-soft-border); }

.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}


/* --------------------------------------------------------------------------
   8. FORMS
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: var(--fs-sm); font-weight: 500; color: var(--text); display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.field__optional { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-3); font-weight: 400; }
.field__hint { font-size: var(--fs-xs); color: var(--text-3); }
.field__error { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--danger); font-weight: 500; }
.field__counter { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-3); font-weight: 400; }
.field__row { display: flex; justify-content: space-between; gap: var(--sp-3); }

.input, .textarea, .select {
  width: 100%; min-width: 0;
  height: var(--control-h); padding: 0 var(--sp-3);
  font-size: var(--fs-sm); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, .02);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  appearance: none; -webkit-appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.input:hover, .textarea:hover, .select:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-3)); }
.input:focus, .textarea:focus, .select:focus,
.tag-input:focus-within {
  outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}
.input:disabled, .textarea:disabled, .select:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.input--lg { height: var(--control-h-lg); font-size: var(--fs-base); }
.input--mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
.textarea { height: auto; min-height: 120px; padding: 10px var(--sp-3); line-height: var(--lh-base); resize: vertical; }
.select {
  padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6B64' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.field--invalid .input, .field--invalid .textarea, .field--invalid .select, .field--invalid .tag-input,
.input[aria-invalid="true"] { border-color: var(--danger); }
.field--invalid .input:focus, .input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }

.input-group { display: flex; align-items: stretch; min-width: 0; }
.input-group > .input { border-radius: 0; flex: 1 1 auto; }
.input-group > :first-child { border-top-left-radius: var(--r-md); border-bottom-left-radius: var(--r-md); }
.input-group > :last-child { border-top-right-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
.input-group > * + * { margin-left: -1px; }
.input-group > .btn { border-radius: 0; height: auto; box-shadow: none; }
.input-group > .input:focus { position: relative; z-index: 1; }
.input-group__addon {
  display: inline-flex; align-items: center; padding: 0 10px; flex: none;
  font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3);
  background: var(--surface-2); border: 1px solid var(--border-strong); white-space: nowrap;
}
/* --stack: on narrow screens the trailing button drops to its own full-width row */
@media (max-width: 479.98px) {
  .input-group--stack { flex-wrap: wrap; row-gap: var(--sp-2); }
  .input-group--stack > .input { flex: 1 1 0; border-top-right-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
  .input-group--stack > .btn { flex: 1 0 100%; margin-left: 0; height: var(--control-h); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
}

.check { display: inline-flex; align-items: flex-start; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text); cursor: pointer; line-height: 1.4; }
.check input { width: 16px; height: 16px; margin: 1px 0 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.check__count { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); }

.form-grid { display: grid; gap: var(--sp-5); }
@media (min-width: 640px) { .form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid__full { grid-column: 1 / -1; } }
.form-section { display: grid; gap: var(--sp-5); padding-block: var(--sp-6); border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section__head { display: flex; flex-direction: column; gap: 2px; }
.form-section__title { font-size: var(--fs-md); }
.form-section__desc { font-size: var(--fs-sm); color: var(--text-2); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--sp-2); padding-top: var(--sp-5); border-top: 1px solid var(--border); }
.form-actions__note { margin-right: auto; font-size: var(--fs-xs); color: var(--text-3); font-family: var(--font-mono); }


/* --------------------------------------------------------------------------
   9. TAGS & TAG INPUT
   -------------------------------------------------------------------------- */
.tag {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 0; max-width: 100%;
  height: 22px; padding: 0 7px;
  font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 500; letter-spacing: .01em;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-xs);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color var(--dur), border-color var(--dur), background-color var(--dur);
}
.tag::before { content: "#"; color: var(--text-3); margin-right: 1px; }
a.tag:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }
.tag--lg { height: 28px; padding: 0 10px; font-size: var(--fs-xs); }
.tag--active, .tag[aria-current="page"] { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-soft-border); }
.tag--active::before { color: inherit; }
.tag__count { color: var(--text-3); font-weight: 400; margin-left: 6px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.tag-input {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: var(--control-h); padding: 5px 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  cursor: text;
}
.tag-input__chip {
  display: inline-flex; align-items: center; gap: 0; height: 24px; padding: 0 2px 0 8px;
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-xs);
}
.tag-input__chip::before { content: "#"; color: var(--text-3); margin-right: 1px; }
.tag-input__chip .tag-input__remove { margin-left: 4px; }
.tag-input__remove { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 2px; color: var(--text-3); }
.tag-input__remove:hover { color: var(--danger); background: var(--danger-soft); }
.tag-input__field { flex: 1 1 120px; min-width: 80px; height: 24px; border: 0; background: transparent; outline: none; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text); padding: 0 4px; }
.tag-input__field::placeholder { color: var(--text-3); }
.tag-input__suggestions {
  position: absolute; z-index: 20; left: -1px; right: -1px; top: calc(100% + 4px);
  padding: 4px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  max-height: 260px; overflow-y: auto;
}
.tag-input__option { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 7px 8px; border-radius: var(--r-sm); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text); cursor: pointer; }
.tag-input__option mark { background: none; color: var(--accent-text); font-weight: 600; }
.tag-input__option:hover, .tag-input__option[aria-selected="true"] { background: var(--surface-2); }
.tag-input__option-count { color: var(--text-3); }
.tag-input__option--create { color: var(--text-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--r-sm) var(--r-sm); margin-top: 4px; }


/* --------------------------------------------------------------------------
   10. TABS / SEGMENTED
   -------------------------------------------------------------------------- */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs__tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 38px; padding: 0 var(--sp-3);
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-2);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.tabs__tab:hover { color: var(--text); }
.tabs__tab[aria-selected="true"], .tabs__tab.is-active { color: var(--text); }
.tabs__tab[aria-selected="true"]::after, .tabs__tab.is-active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; }
.tabs__count { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-3); padding: 1px 5px; background: var(--surface-2); border-radius: var(--r-xs); }

.segmented { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented__item { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; flex: none; font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); border-radius: var(--r-sm); white-space: nowrap; }
.segmented__item:hover { color: var(--text); }
.segmented__item[aria-pressed="true"], .segmented__item[aria-current="true"], .segmented__item[aria-current="page"], .segmented__item.is-active {
  color: var(--text); background: var(--surface); box-shadow: 0 0 0 1px var(--border), var(--shadow-1);
}


/* --------------------------------------------------------------------------
   11. BADGES
   -------------------------------------------------------------------------- */
.badge {
  --b-fg: var(--text-2); --b-bg: var(--surface-2); --b-bd: var(--border);
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 6px; flex: none;
  font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 500; letter-spacing: .02em; line-height: 1; white-space: nowrap;
  color: var(--b-fg); background: var(--b-bg); border: 1px solid var(--b-bd); border-radius: var(--r-xs);
}
.badge--success { --b-fg: var(--success); --b-bg: var(--success-soft); --b-bd: var(--success-border); }
.badge--warning { --b-fg: var(--warning); --b-bg: var(--warning-soft); --b-bd: var(--warning-border); }
.badge--danger  { --b-fg: var(--danger);  --b-bg: var(--danger-soft);  --b-bd: var(--danger-border); }
.badge--info    { --b-fg: var(--info);    --b-bg: var(--info-soft);    --b-bd: var(--info-border); }
.badge--accent  { --b-fg: var(--accent-text); --b-bg: var(--accent-soft); --b-bd: var(--accent-soft-border); }
.badge--outline { --b-bg: transparent; --b-bd: var(--border-strong); }
.badge--solid   { --b-fg: var(--on-accent); --b-bg: var(--accent); --b-bd: transparent; }

/* SPONSORED LABEL — must always be visible text, never icon-only, never hidden. */
.badge-sponsored {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; flex: none;
  font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 500; letter-spacing: .04em; line-height: 1;
  text-transform: uppercase; white-space: nowrap;
  color: var(--sponsored-text); background: var(--surface);
  border: 1px solid var(--sponsored-border); border-radius: var(--r-xs);
}
.badge-sponsored::before { content: ""; width: 5px; height: 5px; border-radius: 1px; background: currentColor; opacity: .8; }

.badge-demo { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 500; color: var(--success); letter-spacing: .02em; }
.badge-demo .icon { width: 10px; height: 10px; }


/* --------------------------------------------------------------------------
   12. AVATAR
   -------------------------------------------------------------------------- */
.avatar {
  --avatar-bg: var(--surface-3);
  display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  font-size: 11px; font-weight: 600; color: #fff; text-transform: uppercase; letter-spacing: 0;
  background: var(--avatar-bg); overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--xs { width: 18px; height: 18px; font-size: 8px; }
.avatar--sm { width: 22px; height: 22px; font-size: 9px; }
.avatar--md { width: 30px; height: 30px; font-size: 10px; }
.avatar--lg { width: 40px; height: 40px; font-size: 14px; }
.avatar--xl { width: 88px; height: 88px; font-size: 30px; }
button.avatar, summary .avatar { cursor: pointer; }


/* --------------------------------------------------------------------------
   13. APP CARD (grid)  &  APP ROW (list)
   -------------------------------------------------------------------------- */
.app-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.app-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.app-card:has(.app-card__link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.app-card__cover { position: relative; aspect-ratio: 2 / 1; background: var(--surface-2); border-bottom: 1px solid var(--border); overflow: hidden; }
.app-card__cover > img, .app-card__cover > svg { width: 100%; height: 100%; object-fit: cover; }
.app-card__cover-badges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; gap: 6px; pointer-events: none; }
.app-card__body { display: flex; flex-direction: column; gap: 6px; padding: var(--sp-3) var(--sp-3) var(--sp-3); flex: 1; }
.app-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.app-card__title { font-size: var(--fs-base); font-weight: 600; letter-spacing: -.01em; line-height: var(--lh-snug); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card__link { color: inherit; }
.app-card__link::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.app-card__link:focus-visible { outline: none; }
.app-card__likes { display: inline-flex; align-items: center; gap: 4px; flex: none; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); padding-top: 2px; }
.app-card__likes .icon { width: 13px; height: 13px; }
.app-card__tagline {
  font-size: var(--fs-sm); line-height: 1.45; color: var(--text-2);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  min-height: calc(2 * 1.45em);
}
.app-card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: auto; padding-top: var(--sp-2); min-width: 0; }
.app-card__author { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-2); }
.app-card__author span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.app-card__author:hover { color: var(--text); }
.app-card__stats { display: inline-flex; align-items: center; gap: var(--sp-3); flex: none; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); }
.app-card__stats > span { display: inline-flex; align-items: center; gap: 4px; }
.app-card .tag-list { flex-wrap: nowrap; overflow: hidden; mask-image: linear-gradient(90deg, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); }

/* Sponsored card: tinted surface + warm border + visible label. Never hide the label. */
.app-card--sponsored { background: var(--sponsored-bg); border-color: var(--sponsored-border); }
.app-card--sponsored:hover { border-color: color-mix(in srgb, var(--sponsored-border) 70%, var(--sponsored-text)); }
.app-card--sponsored .app-card__cover { border-bottom-color: var(--sponsored-border); }
.app-card__sponsor-line { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-3); }

/* Compact list row (search results, profile lists) */
.app-row {
  position: relative; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--sp-3);
  padding: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease);
}
.app-row:hover { border-color: var(--border-strong); }
.app-row__thumb { aspect-ratio: 2 / 1; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); align-self: start; }
.app-row__thumb > svg, .app-row__thumb > img { width: 100%; height: 100%; object-fit: cover; }
.app-row__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.app-row__head { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; flex-wrap: wrap; }
.app-row__title { font-size: var(--fs-base); font-weight: 600; letter-spacing: -.01em; }
.app-row__title mark, .app-row__tagline mark { background: var(--accent-soft); color: inherit; border-radius: 2px; padding: 0 1px; }
.app-row__tagline { font-size: var(--fs-sm); color: var(--text-2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.app-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.app-row__meta > span { display: inline-flex; align-items: center; gap: 4px; }
.app-row--sponsored { background: var(--sponsored-bg); border-color: var(--sponsored-border); }
@media (min-width: 640px) { .app-row { grid-template-columns: 168px minmax(0, 1fr); gap: var(--sp-4); } }
.app-list { display: flex; flex-direction: column; gap: var(--sp-3); }

/* Generic panel */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); min-width: 0; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.panel__title { font-size: var(--fs-sm); font-weight: 600; }
.panel__body { padding: var(--sp-4); }
.panel--flush .panel__body { padding: 0; }
.panel--sponsored { background: var(--sponsored-bg); border-color: var(--sponsored-border); }

/* Filter group (sidebar) */
.filter { display: flex; flex-direction: column; gap: var(--sp-2); }
.filter__title { font-family: var(--font-mono); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 500; }
.filter__list { display: flex; flex-direction: column; gap: 6px; }
.filter__list .check { width: 100%; }


/* --------------------------------------------------------------------------
   14. HERO (home)
   -------------------------------------------------------------------------- */
.hero { position: relative; padding-block: var(--sp-10) var(--sp-8); border-bottom: 1px solid var(--border); overflow: hidden; }
.hero::before {  /* precise grid backdrop, fades out — no glow */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px; background-position: -1px -1px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.55), transparent 85%); -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.55), transparent 85%);
}
.hero { isolation: isolate; }
.hero__inner { display: flex; flex-direction: column; gap: var(--sp-5); max-width: 820px; }
.hero__eyebrow { display: inline-flex; align-items: center; gap: var(--sp-2); align-self: flex-start; height: 26px; padding: 0 10px 0 8px; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill); }
.hero__eyebrow .dot { color: var(--accent); }
.hero__title { font-size: var(--fs-3xl); font-weight: 700; letter-spacing: -.035em; line-height: 1.02; }
.hero__title em { font-style: normal; color: var(--text-3); }
.hero__lead { font-size: var(--fs-md); color: var(--text-2); max-width: 58ch; line-height: 1.5; }
.hero-search { display: flex; align-items: center; gap: 6px; padding: 5px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-2); max-width: 680px; }
.hero-search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent), var(--shadow-2); }
.hero-search > .icon { margin-left: 10px; color: var(--text-3); }
.hero-search__input { flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; font-size: var(--fs-base); color: var(--text); outline: none; padding: 0 4px; }
.hero-search__input::placeholder { color: var(--text-3); }
.hero-search__btn { flex: none; height: 42px; border-radius: var(--r-md); }
.hero__quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); }
.hero__quick-label { font-family: var(--font-mono); margin-right: 4px; }
.hero__stats { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); padding-top: var(--sp-2); }
.hero__stats b { color: var(--text); font-weight: 500; }
@media (min-width: 900px) { .hero { padding-block: var(--sp-16) var(--sp-12); } }


/* --------------------------------------------------------------------------
   15. APP DETAIL
   -------------------------------------------------------------------------- */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); margin-bottom: var(--sp-5); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb__sep { color: var(--border-strong); }
.breadcrumb [aria-current] { color: var(--text-2); }

.app-hero { display: grid; gap: var(--sp-5); padding-bottom: var(--sp-6); margin-bottom: var(--sp-6); border-bottom: 1px solid var(--border); }
.app-hero__top { display: flex; gap: var(--sp-4); align-items: flex-start; min-width: 0; }
.app-icon { width: 56px; height: 56px; flex: none; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.app-icon > svg, .app-icon > img { width: 100%; height: 100%; object-fit: cover; }
.app-hero__titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.app-hero__title { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.03em; }
.app-hero__tagline { font-size: var(--fs-md); color: var(--text-2); line-height: 1.45; }
.app-hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.app-hero__actions .like-btn { margin-left: auto; }
@media (min-width: 640px) { .app-icon { width: 72px; height: 72px; } .app-hero__title { font-size: var(--fs-2xl); } }
@media (max-width: 479.98px) { .app-hero__actions > .btn { flex: 1 1 auto; } .app-hero__actions .like-btn { margin-left: 0; } }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--sp-3); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); }
.meta__item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.meta__item a { color: var(--text-2); }
.meta__item a:hover { color: var(--text); text-decoration: underline; }
.meta__item .icon { width: 13px; height: 13px; }

.app-cover { aspect-ratio: 16 / 9; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); margin-bottom: var(--sp-8); }
.app-cover > svg, .app-cover > img { width: 100%; height: 100%; object-fit: cover; }

/* definition list in side rail */
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: 10px var(--sp-4); font-size: var(--fs-sm); }
.meta-list dt { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); padding-top: 1px; }
.meta-list dd { color: var(--text); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-list dd a { color: var(--accent-text); }
.meta-list dd a:hover { text-decoration: underline; }

.link-list { display: flex; flex-direction: column; }
.link-list__item { display: flex; align-items: center; gap: var(--sp-3); padding: 10px var(--sp-4); font-size: var(--fs-sm); border-top: 1px solid var(--border); min-width: 0; }
.link-list__item:first-child { border-top: 0; }
.link-list__item:hover { background: var(--surface-2); }
.link-list__item .icon { color: var(--text-3); }
.link-list__label { font-weight: 500; }
.link-list__url { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.author-card { display: flex; align-items: center; gap: var(--sp-3); }
.author-card__name { font-weight: 600; font-size: var(--fs-sm); }
.author-card__meta { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); }


/* --------------------------------------------------------------------------
   16. MARKDOWN PROSE  (.prose wraps rendered, sanitized Markdown)
   -------------------------------------------------------------------------- */
.prose { font-size: var(--fs-base); line-height: 1.7; color: var(--text); max-width: 72ch; overflow-wrap: break-word; }
.prose--full { max-width: none; }
.prose > * + * { margin-top: 1em; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { margin-top: 1.9em; margin-bottom: -.25em; color: var(--text); scroll-margin-top: calc(var(--header-h) + 16px); }
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: 1.75rem; }
.prose h2 { font-size: 1.375rem; padding-bottom: .35em; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 1.125rem; }
.prose h4 { font-size: 1rem; }
.prose h5, .prose h6 { font-size: .875rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.prose a { color: var(--accent-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose strong { font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .3em; }
.prose li > ul, .prose li > ol { margin-top: .3em; }
.prose ul li::marker { color: var(--text-3); }
.prose ol li::marker { color: var(--text-3); font-family: var(--font-mono); font-size: .9em; }
.prose img, .prose video, .prose picture { border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); max-width: 100%; height: auto; }
.prose img { display: inline-block; vertical-align: middle; }
.prose p > img:only-child, .prose > img, .prose video { display: block; width: auto; }
.prose video { width: 100%; }
.prose figure { margin-inline: 0; }
.prose figcaption { margin-top: .5em; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); text-align: center; }
/* Responsive 16:9 embeds: wrap iframes in .embed (server-side), or rely on iframe aspect-ratio */
.prose iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: #000; }
.prose .embed, .embed { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); background: #000; }
.embed > iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; }
.prose hr { margin-block: 2em; border-top: 1px solid var(--border); }
.prose blockquote { padding: .2em 0 .2em 1em; border-left: 3px solid var(--accent); color: var(--text-2); }
.prose blockquote > * + * { margin-top: .6em; }
.prose code { font-family: var(--font-mono); font-size: .86em; padding: .12em .38em; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--r-xs); }
.prose pre {
  position: relative; padding: var(--sp-4); overflow-x: auto; tab-size: 2;
  font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.6;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--r-md);
}
.prose pre code { padding: 0; background: none; border: 0; font-size: inherit; }
.prose pre[data-lang]::before { content: attr(data-lang); position: absolute; top: 6px; right: 10px; font-size: var(--fs-2xs); color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
/* minimal token colors (e.g. highlight.js/shiki classes mapped) */
.prose .tok-k { color: var(--accent-text); }
.prose .tok-s { color: var(--success); }
.prose .tok-c { color: var(--text-3); font-style: italic; }
.prose .tok-n { color: var(--info); }
.prose table { display: block; width: max-content; max-width: 100%; overflow-x: auto; font-size: var(--fs-sm); border: 1px solid var(--border); border-radius: var(--r-md); border-collapse: separate; border-spacing: 0; }
.prose th, .prose td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th + th, .prose td + td { border-left: 1px solid var(--border); }
.prose thead th { font-weight: 600; background: var(--surface-2); font-size: var(--fs-xs); }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td[align="right"], .prose th[align="right"] { text-align: right; font-variant-numeric: tabular-nums; }
.prose td[align="center"], .prose th[align="center"] { text-align: center; }
.prose kbd { font-size: .78em; vertical-align: .08em; }
.prose details { border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 var(--sp-4); }
.prose details[open] { padding-bottom: var(--sp-3); }
.prose summary { cursor: pointer; padding-block: var(--sp-3); font-weight: 500; }
.prose summary::marker { color: var(--text-3); }
.prose mark { background: var(--accent-soft); color: inherit; padding: 0 .15em; border-radius: 2px; }
/* GitHub-style task lists: <ul class="contains-task-list"><li class="task-list-item"><input type="checkbox" disabled> */
.prose .contains-task-list, .prose ul:has(> li > input[type="checkbox"]) { list-style: none; padding-left: 0; }
.prose .task-list-item, .prose li:has(> input[type="checkbox"]) { display: flex; align-items: baseline; gap: .6em; }
.prose .task-list-item input, .prose li > input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 16px; height: 16px; margin: 0; flex: none; transform: translateY(3px);
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: 4px; opacity: 1;
}
.prose .task-list-item input:checked, .prose li > input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23141210' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.prose .task-list-item .contains-task-list { padding-left: 1.6em; }
.prose .footnotes { font-size: var(--fs-sm); color: var(--text-2); }


/* --------------------------------------------------------------------------
   17. MARKDOWN EDITOR
   -------------------------------------------------------------------------- */
.md-editor { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); min-width: 0; }
.md-editor:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.md-editor__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 var(--sp-2); padding: 0 6px 0 4px; background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: var(--r-md) var(--r-md) 0 0; }
.md-editor__tabs { display: flex; gap: 2px; align-self: stretch; }
.md-editor__tabs .tabs__tab { height: 40px; }
.md-editor__tabs .tabs__tab[aria-selected="true"] { background: var(--surface); box-shadow: 1px 0 0 var(--border), -1px 0 0 var(--border); }
.md-editor__tabs .tabs__tab[aria-selected="true"]::after { top: 0; bottom: auto; left: 0; right: 0; }
.md-editor__toolbar { display: flex; align-items: center; gap: 1px; flex-wrap: wrap; padding-block: 4px; }
.md-editor__tool { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm); color: var(--text-2); }
.md-editor__tool:hover { background: var(--surface-3); color: var(--text); }
.md-editor__tool[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.md-editor__sep { width: 1px; height: 18px; background: var(--border-strong); margin-inline: 4px; }
.md-editor__body { display: grid; min-height: 320px; }
.md-editor__body--split { grid-template-columns: 1fr; }
@media (min-width: 900px) { .md-editor__body--split { grid-template-columns: 1fr 1fr; } .md-editor__body--split > * + * { border-left: 1px solid var(--border); } }
.md-editor__input {
  width: 100%; min-height: 320px; padding: var(--sp-4); resize: vertical;
  font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.7; color: var(--text);
  background: transparent; border: 0; outline: none; tab-size: 2;
}
.md-editor__preview { padding: var(--sp-4) var(--sp-5); overflow: auto; max-height: 640px; }
.md-editor__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); padding: 8px var(--sp-3); border-top: 1px dashed var(--border-strong); font-size: var(--fs-xs); color: var(--text-3); border-radius: 0 0 var(--r-md) var(--r-md); }
.md-editor__foot .icon { width: 14px; height: 14px; }
.md-editor__foot-hint { display: inline-flex; align-items: center; gap: 6px; }
.md-editor__drop {  /* overlay shown while dragging files over the editor */
  position: absolute; inset: 6px; z-index: 5; display: none; place-items: center; text-align: center;
  background: color-mix(in srgb, var(--accent-soft) 88%, transparent); border: 2px dashed var(--accent); border-radius: var(--r-sm);
  color: var(--accent-text); font-weight: 600; font-size: var(--fs-sm);
}
.md-editor.is-dragover .md-editor__drop { display: grid; }

.upload-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px var(--sp-3); font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-2); }
.upload-item__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .progress { grid-column: 2 / -1; }

.progress { height: 4px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.progress__bar { height: 100%; width: var(--value, 0%); background: var(--accent); border-radius: inherit; transition: width .3s var(--ease); }


/* --------------------------------------------------------------------------
   18. DROPZONE / COVER UPLOAD
   -------------------------------------------------------------------------- */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: var(--sp-8) var(--sp-4); text-align: center;
  background: var(--surface); border: 1.5px dashed var(--border-strong); border-radius: var(--r-md);
  color: var(--text-2); cursor: pointer;
  transition: border-color var(--dur), background-color var(--dur);
}
.dropzone:hover { border-color: var(--text-3); }
.dropzone.is-dragover, .dropzone:focus-within { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); margin-bottom: 4px; }
.dropzone__title { font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.dropzone__title u { color: var(--accent-text); text-underline-offset: 2px; }
.dropzone__hint { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-3); }

.cover-preview { position: relative; aspect-ratio: 2 / 1; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.cover-preview > svg, .cover-preview > img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview__actions { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.cover-upload { display: grid; gap: var(--sp-3); }
@media (min-width: 640px) { .cover-upload { grid-template-columns: 1fr 1fr; } }


/* --------------------------------------------------------------------------
   19. DROPDOWN (use <details class="dropdown"><summary>…</summary><div class="dropdown__menu">)
   -------------------------------------------------------------------------- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; border-radius: var(--r-md); }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown__menu {
  position: absolute; z-index: 50; top: calc(100% + 6px); right: 0; min-width: 220px; max-width: calc(100vw - 2 * var(--gutter));
  padding: 4px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  font-size: var(--fs-sm);
}
.dropdown__menu--left { right: auto; left: 0; }
.dropdown__item { display: flex; align-items: center; gap: var(--sp-2); width: 100%; padding: 7px 8px; border-radius: var(--r-sm); color: var(--text); text-align: left; }
.dropdown__item .icon { color: var(--text-3); }
.dropdown__item:hover, .dropdown__item:focus-visible { background: var(--surface-2); outline: none; }
.dropdown__item--danger, .dropdown__item--danger .icon { color: var(--danger); }
.dropdown__item kbd { margin-left: auto; }
.dropdown__sep { height: 1px; margin: 4px -4px; background: var(--border); }
.dropdown__label { padding: 8px 8px 6px; display: flex; flex-direction: column; gap: 1px; }
.dropdown__label strong { font-weight: 600; }
.dropdown__label span { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); }


/* --------------------------------------------------------------------------
   20. PAGINATION
   -------------------------------------------------------------------------- */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; margin-top: var(--sp-8); font-family: var(--font-mono); font-size: var(--fs-xs); }
.pagination__item { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--r-sm); color: var(--text-2); }
.pagination__item:hover { background: var(--surface-2); color: var(--text); }
.pagination__item[aria-current="page"] { color: var(--text); background: var(--surface); border-color: var(--border-strong); font-weight: 500; }
.pagination__item[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.pagination__item--nav { border-color: var(--border); background: var(--surface); }
.pagination__gap { color: var(--text-3); padding: 0 4px; }
@media (max-width: 479.98px) { .pagination__item--far { display: none; } }


/* --------------------------------------------------------------------------
   21. ALERTS / FLASH / EMPTY / SKELETON / TOASTS
   -------------------------------------------------------------------------- */
.alert {
  --a-fg: var(--text); --a-bg: var(--surface); --a-bd: var(--border-strong); --a-ic: var(--text-2);
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px var(--sp-3); align-items: start;
  padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm);
  color: var(--a-fg); background: var(--a-bg); border: 1px solid var(--a-bd); border-radius: var(--r-md);
}
.alert > .icon { color: var(--a-ic); margin-top: 2px; }
.alert__content { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alert__title { font-weight: 600; }
.alert__text { color: var(--text-2); }
.alert__close { display: grid; place-items: center; width: 24px; height: 24px; margin: -2px -6px 0 0; border-radius: var(--r-sm); color: var(--text-3); }
.alert__close:hover { background: color-mix(in srgb, var(--a-ic) 12%, transparent); color: var(--text); }
.alert--success { --a-bg: var(--success-soft); --a-bd: var(--success-border); --a-ic: var(--success); }
.alert--warning { --a-bg: var(--warning-soft); --a-bd: var(--warning-border); --a-ic: var(--warning); }
.alert--danger  { --a-bg: var(--danger-soft);  --a-bd: var(--danger-border);  --a-ic: var(--danger); }
.alert--info    { --a-bg: var(--info-soft);    --a-bd: var(--info-border);    --a-ic: var(--info); }
.flash { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-6); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-2); padding: var(--sp-12) var(--sp-4); border: 1px dashed var(--border-strong); border-radius: var(--r-md); }
.empty__icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: var(--sp-2); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text-3); }
.empty__title { font-size: var(--fs-md); font-weight: 600; }
.empty__text { font-size: var(--fs-sm); color: var(--text-2); max-width: 44ch; }
.empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-3); }

.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-xs); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent); animation: shimmer 1.4s infinite; }
.skeleton--text { height: 12px; width: 100%; }
.skeleton--title { height: 16px; width: 60%; }
.skeleton--cover { aspect-ratio: 2 / 1; border-radius: 0; }
.skeleton--avatar { width: 20px; height: 20px; border-radius: 50%; }
.skeleton-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.skeleton-card__body { display: flex; flex-direction: column; gap: 8px; padding: var(--sp-3); }
@keyframes shimmer { to { transform: translateX(100%); } }

.toast-region { position: fixed; z-index: 90; bottom: var(--sp-4); left: var(--gutter); right: var(--gutter); display: flex; flex-direction: column; align-items: stretch; gap: var(--sp-2); pointer-events: none; }
@media (min-width: 640px) { .toast-region { left: auto; right: var(--sp-6); bottom: var(--sp-6); width: 360px; } }
.toast-region--static { position: static; width: auto; max-width: 380px; }
.toast {
  pointer-events: auto; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-3);
  padding: 10px 10px 10px var(--sp-3); font-size: var(--fs-sm);
  color: var(--bg); background: var(--text); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  animation: toast-in .2s var(--ease);
}
.toast > .icon { color: var(--accent); }
.toast--success > .icon { color: #4FBF73; }
.toast--danger > .icon { color: #F2685A; }
.toast__action { font-weight: 600; font-size: var(--fs-xs); padding: 4px 8px; border-radius: var(--r-sm); color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.toast__action:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }


/* --------------------------------------------------------------------------
   22. MODAL  (<dialog class="modal">; use .modal--static for inline previews)
   -------------------------------------------------------------------------- */
.modal {
  width: min(480px, calc(100vw - 2 * var(--gutter))); max-height: calc(100dvh - 48px); padding: 0; margin: auto;
  color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
}
.modal::backdrop { background: var(--overlay); }
.modal[open] { display: flex; flex-direction: column; animation: modal-in .18s var(--ease); }
.modal--static { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 480px; }
.modal__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-5) var(--sp-5) 0; }
.modal__title { font-size: var(--fs-md); }
.modal__body { padding: var(--sp-3) var(--sp-5) var(--sp-5); font-size: var(--fs-sm); color: var(--text-2); overflow: auto; }
.modal__footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5); background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--r-lg) var(--r-lg); }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(.99); } }


/* --------------------------------------------------------------------------
   23. TABLES (admin)
   -------------------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.table { width: 100%; font-size: var(--fs-sm); }
.table th, .table td { padding: 10px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.table th { position: sticky; top: 0; font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); background: var(--surface-2); }
.table th a { display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--text); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table tr.is-selected { background: var(--accent-soft); }
.table__num { text-align: right !important; font-family: var(--font-mono); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.table__mono { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-2); }
.table__check { width: 36px; padding-right: 0 !important; }
.table__check input { width: 15px; height: 15px; accent-color: var(--accent); }
.table__actions { text-align: right !important; width: 1%; }
.table__app { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.table__app-thumb { width: 44px; aspect-ratio: 2 / 1; border-radius: var(--r-xs); overflow: hidden; border: 1px solid var(--border); flex: none; }
.table__app-thumb > svg { width: 100%; height: 100%; }
.table__app-name { font-weight: 500; }
.table__app-sub { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-3); }
.table--compact th, .table--compact td { padding: 6px var(--sp-3); }
.table-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.table-toolbar__filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

.stat { display: flex; flex-direction: column; gap: 4px; padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); min-width: 0; }
.stat__label { font-family: var(--font-mono); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.stat__value { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat__delta { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); }
.stat__delta--up { color: var(--success); }
.stat__delta--down { color: var(--danger); }
.stat-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 28px; margin-top: 4px; }
.spark > i { flex: 1; background: var(--border-strong); border-radius: 1px; height: var(--h, 20%); }
.spark > i:last-child { background: var(--accent); }


/* --------------------------------------------------------------------------
   24. PRICING
   -------------------------------------------------------------------------- */
.pricing { display: grid; gap: var(--sp-4); align-items: stretch; }
@media (min-width: 900px) { .pricing { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); } }
.plan { position: relative; display: flex; flex-direction: column; gap: var(--sp-5); padding: var(--sp-6); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); min-width: 0; }
.plan--featured { border-color: var(--text); box-shadow: 0 0 0 1px var(--text), var(--shadow-2); }
.plan__ribbon { position: absolute; top: -11px; left: var(--sp-6); height: 22px; padding: 0 8px; display: inline-flex; align-items: center; font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--on-accent); background: var(--accent); border-radius: var(--r-xs); }
.plan__head { display: flex; flex-direction: column; gap: 6px; }
.plan__index { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; }
.plan__name { font-size: var(--fs-lg); }
.plan__desc { font-size: var(--fs-sm); color: var(--text-2); min-height: 3em; }
.plan__price { display: flex; align-items: baseline; gap: 6px; padding-block: var(--sp-4); border-block: 1px solid var(--border); }
.plan__amount { font-size: 2.5rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.plan__currency { font-size: var(--fs-md); font-weight: 600; }
.plan__period { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); margin-left: auto; }
.plan__features { display: flex; flex-direction: column; gap: 10px; font-size: var(--fs-sm); }
.plan__features li { display: flex; gap: var(--sp-2); align-items: flex-start; }
.plan__features .icon { color: var(--success); margin-top: 3px; }
.plan__features li.is-off { color: var(--text-3); }
.plan__features li.is-off .icon { color: var(--text-3); }
.plan__where { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); }
.plan__cta { margin-top: auto; }
/* mini wireframe showing where the placement appears */
.plan__diagram { aspect-ratio: 16 / 6; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); padding: 8px; display: grid; gap: 4px; grid-template-columns: repeat(4, 1fr); grid-template-rows: 6px repeat(2, 1fr); }
.plan__diagram > i { background: var(--border); border-radius: 2px; }
.plan__diagram > i.is-bar { grid-column: 1 / -1; background: var(--border-strong); }
.plan__diagram > i.is-hit { background: var(--accent); }
.plan__diagram--list { grid-template-columns: 1fr; grid-template-rows: 6px repeat(4, 1fr); }


/* --------------------------------------------------------------------------
   25. ADMIN SHELL
   -------------------------------------------------------------------------- */
.admin { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); }
.admin__main { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-6); }
@media (min-width: 900px) { .admin { grid-template-columns: 216px minmax(0, 1fr); gap: var(--sp-8); } .admin__sidebar { position: sticky; top: calc(var(--header-h) + var(--sp-6)); align-self: start; } }
.side-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
@media (min-width: 900px) { .side-nav { flex-direction: column; overflow: visible; margin: 0; padding: 0; } }
.side-nav__heading { display: none; font-family: var(--font-mono); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: var(--sp-4) 10px 6px; }
@media (min-width: 900px) { .side-nav__heading { display: block; } .side-nav__heading:first-child { padding-top: 0; } }
.side-nav__link { display: flex; align-items: center; gap: 10px; flex: none; height: 34px; padding: 0 10px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); border-radius: var(--r-sm); white-space: nowrap; }
.side-nav__link .icon { color: var(--text-3); }
.side-nav__link:hover { background: var(--surface-2); color: var(--text); }
.side-nav__link.is-active, .side-nav__link[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.side-nav__link.is-active .icon { color: var(--accent-text); }
.side-nav__count { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-3); }
.side-nav__count--alert { color: var(--danger); font-weight: 600; }


/* --------------------------------------------------------------------------
   26. AUTH
   -------------------------------------------------------------------------- */
.auth { display: grid; min-height: calc(100dvh - var(--header-h)); }
@media (min-width: 900px) { .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.auth__main { display: flex; align-items: center; justify-content: center; padding: var(--sp-10) var(--gutter); }
.auth__card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: var(--sp-5); }
.auth__title { font-size: var(--fs-xl); letter-spacing: -.025em; }
.auth__lead { color: var(--text-2); font-size: var(--fs-sm); margin-top: 4px; }
.auth__aside { display: none; position: relative; overflow: hidden; border-left: 1px solid var(--border); background: var(--surface-2); }
@media (min-width: 900px) { .auth__aside { display: flex; flex-direction: column; justify-content: space-between; padding: var(--sp-10); } }
.auth__quote { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.025em; line-height: 1.25; max-width: 22ch; }
.auth__foot { font-size: var(--fs-xs); color: var(--text-3); text-align: center; }
.oauth-btn { gap: 10px; }
.or-sep { display: flex; align-items: center; gap: var(--sp-3); font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }


/* --------------------------------------------------------------------------
   27. PROFILE
   -------------------------------------------------------------------------- */
.profile-head { display: grid; gap: var(--sp-4); grid-template-columns: auto minmax(0, 1fr); align-items: center; padding-bottom: var(--sp-6); margin-bottom: var(--sp-6); border-bottom: 1px solid var(--border); }
.profile-head__name { font-size: var(--fs-xl); letter-spacing: -.025em; }
.profile-head__handle { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-3); }
.profile-head__bio { color: var(--text-2); font-size: var(--fs-sm); max-width: 60ch; margin-top: 6px; }
.profile-head__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
@media (min-width: 640px) { .profile-head { grid-template-columns: auto minmax(0, 1fr) auto; } .profile-head__actions { grid-column: auto; align-self: start; } }
@media (max-width: 639.98px) { .profile-head .avatar--xl { width: 64px; height: 64px; font-size: 22px; } }


/* --------------------------------------------------------------------------
   28. PRINT
   -------------------------------------------------------------------------- */
@media print {
  .site-header, .site-footer, .app-hero__actions, .toast-region { display: none !important; }
  body { background: #fff; color: #000; }
  .prose a::after { content: " (" attr(href) ")"; font-size: .85em; color: #555; }
}
