/* Neutral grays, with the TWM WORLD store's Pikachu yellow as the one accent (open tab, tile edges). */
:root {
  --brand-navy: #1f2023;   /* header and banner charcoal */
  --brand-blue: #3b3d42;   /* header and banner graphite */
  --brand-yellow: #ffcd00;
  --brand-red: #e0262a;
  --bg: #f4f4f5;
  --panel: #ffffff;
  --text: #18181b;
  --muted: #6b6b73;
  --line: #e4e4e7;
  --accent: #27272a;       /* primary buttons */
  --accent-text: #ffffff;
  --link: #18181b;
  --good: #067647;
  --warn: #b54708;
  --bad: #c8201f;
  --chip: #efeff1;
  --shadow: 0 1px 2px rgba(24, 24, 27, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --panel: #1b1b1e;
    --text: #ececee;
    --muted: #a1a1aa;
    --line: #2e2e33;
    --accent: #e4e4e7;
    --accent-text: #18181b;
    --link: #ececee;
    --good: #47cd89;
    --warn: #fdb022;
    --bad: #ff7a70;
    --chip: #26262a;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
/* Links are the text's gray, told apart by a light underline that darkens on hover. */
a { color: var(--link); text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

button, input, select, textarea { font: inherit; color: inherit; }
button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; padding: 0; color: var(--link); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
button.link:hover { text-decoration-color: currentColor; }
button.small, .small button { padding: 5px 10px; font-size: 14px; }
input, select, textarea { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 7px 10px; }
input[type=number] { width: 84px; }
input.price { width: 92px; text-align: right; }
input.qty { width: 52px; text-align: right; }
textarea { width: 100%; min-height: 90px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
label { display: block; }

/* The header is charcoal, edged in the logo's yellow; the open tab is yellow. */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; padding: 10px 28px; background: linear-gradient(100deg, var(--brand-navy), var(--brand-blue)); border-bottom: 3px solid var(--brand-yellow); color: #fff; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18.5px; letter-spacing: .01em; }
.brand img { width: 40px; height: 40px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--brand-yellow); }
.brand-name { display: grid; line-height: 1.15; }
.brand-sub { font-size: 12.5px; font-weight: 500; color: rgba(255, 255, 255, .75); }
.tabs { display: flex; gap: 6px; flex: 1; overflow-x: auto; }
.tabs button { white-space: nowrap; }
.tabs button { border: 0; background: none; border-radius: 999px; padding: 8px 16px; color: rgba(255, 255, 255, .85); font-weight: 600; }
.tabs button:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.tabs button[aria-selected=true] { background: var(--brand-yellow); color: var(--brand-navy); }
.who { margin-left: auto; color: rgba(255, 255, 255, .8); }
.who .muted, .who .link { color: inherit; }

main { padding: 24px 28px 72px; max-width: 1560px; margin: 0 auto; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .grow { flex: 1; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.panel.pad { padding: 22px 24px; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--chip); font-size: 14px; white-space: nowrap; }
.chip.good { color: var(--good); } .chip.warn { color: var(--warn); } .chip.bad { color: var(--bad); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button[aria-pressed=true] { background: var(--chip); font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: left; }
th { font-size: 14px; color: var(--muted); font-weight: 600; background: var(--panel); }
/* The listings table sits in the page itself (no scroll box of its own); its header row sticks
   under the site header as the page scrolls. On narrower screens the table scrolls sideways
   instead, and the header row just scrolls with it. */
#listing-table { overflow: visible; }
/* Tighter cells than other tables, so all thirteen columns fit the page. */
#listing-table th, #listing-table td { padding: 12px 9px; }
#listing-table td.num > div { white-space: normal; max-width: 150px; margin-left: auto; }
#listing-table select { max-width: 165px; }
.row-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
#listing-table thead th { position: sticky; top: var(--top-h, 64px); z-index: 2; box-shadow: inset 0 -1px 0 var(--line); }
@media (max-width: 1360px) {
  #listing-table { overflow-x: auto; }
  #listing-table thead th { position: static; }
}
th.check, td.check { width: 28px; padding-right: 0; }
tr.selected td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
th .sort { color: inherit; font-weight: inherit; font-size: inherit; white-space: nowrap; }
th[aria-sort=ascending] .sort, th[aria-sort=descending] .sort { color: var(--text); }
tr:last-child td { border-bottom: 0; }
td.thumb img { width: 64px; height: 88px; object-fit: contain; border-radius: 4px; background: var(--chip); display: block; }
td.title { min-width: 230px; max-width: 420px; }
.title-text { display: block; text-decoration: none; }
.title-text:hover { text-decoration: underline; text-decoration-color: currentColor; }
.table-wrap { overflow-x: auto; }

.switch { position: relative; flex: none; display: inline-block; width: 34px; height: 20px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 20px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::before { transform: translateX(14px); }
.switch input:disabled + span { opacity: .4; cursor: default; }

.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.card { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 18px; padding: 18px; min-width: 0; }
.card img { width: 170px; height: 238px; object-fit: contain; border-radius: 6px; background: var(--chip); }
.card .fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; align-content: start; min-width: 0; }
.card .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card .title-input { width: 100%; min-height: 0; resize: vertical; font-family: inherit; font-size: 15px; }
.card select { max-width: 100%; }
.card .actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.card.listed { opacity: .75; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 120px; gap: 10px 16px; align-items: center; }
.form-grid .hint { grid-column: 1 / -1; margin-top: -4px; }
h2 { font-size: 17px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 20px 0 8px; color: var(--muted); }

dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); padding: 0; width: min(760px, 94vw); }
dialog::backdrop { background: rgba(0, 0, 0, .4); }
#dialog-body { padding: 26px; display: grid; gap: 14px; }
#dialog-body .buttons { display: flex; gap: 8px; justify-content: flex-end; }
.comp-list { max-height: 50vh; overflow: auto; }
.comp-list td { padding: 8px 10px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; max-width: 90vw; z-index: 20; box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.toast.bad { background: var(--bad); color: #fff; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

body.login { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, var(--brand-navy), var(--brand-blue)); }
.login-box { background: var(--panel); border: 3px solid var(--brand-yellow); border-radius: 16px; padding: 0 28px 28px; width: min(520px, 92vw); text-align: center; display: grid; gap: 12px; justify-items: center; overflow: hidden; }
.login-banner { width: calc(100% + 56px); max-width: none; margin: 0 -28px; display: block; }
.login-logo { width: 88px; height: 88px; border-radius: 50%; margin-top: -52px; background: #fff; box-shadow: 0 0 0 4px var(--brand-yellow); }
.login-box h1 { margin: 0; font-size: 25.5px; color: var(--brand-navy); }
.login-box button.primary { justify-self: stretch; }
@media (prefers-color-scheme: dark) { .login-box h1 { color: var(--text); } }

/* Collection (the P&L) */
.pl { display: grid; gap: 20px; }
.pl-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; padding: 24px 28px; border-radius: 14px; color: #fff;
  background: linear-gradient(100deg, rgba(31, 32, 35, .93), rgba(59, 61, 66, .85)), url(/assets/store-banner.jpg) center / cover; }
.pl-head h1 { margin: 0 0 4px; font-size: 25.5px; }
.pl-head p { margin: 0; max-width: 70ch; }
.pl-head b { color: var(--brand-yellow); }
.pl-head .muted, .pl-head .link { color: rgba(255, 255, 255, .8); }
.pl-head .warn { color: var(--brand-yellow); }
.pl-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.pl-tile { display: grid; gap: 4px; padding: 18px 20px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--brand-yellow); border-radius: 12px; box-shadow: var(--shadow); }
.pl-big { font-size: 27.5px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.pl-big.good { color: var(--good); } .pl-big.bad { color: var(--bad); }
.pl-section { font-size: 19.5px; margin: 12px 0 0; color: var(--text); }
.pl-table td .muted, .pl-table td .small { font-size: 14px; }
.pl-table tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
/* A collection row opens a full-width row of its cards beneath it. */
.pl-toggle { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: inherit; cursor: pointer; text-align: left; }
.pl-caret { display: inline-block; width: 12px; text-align: center; font-size: 1.25em; line-height: 1; transition: transform .15s; color: var(--muted); }
.pl-toggle[aria-expanded="true"] .pl-caret { transform: rotate(90deg); }
/* Full width, with its columns' padding matching the table above, so the card names line up
   under the collection names and nothing is inset on either side. */
tr.pl-expand > td { background: var(--bg); padding: 0 0 6px; }
.pl-cards { width: 100%; font-size: 14px; }
.pl-cards th, .pl-cards td { padding: 9px 14px; background: transparent; }
.pl-cards thead th { padding-top: 10px; }
/* Grade, cert and date stay on one line; the card name takes the wrapping. */
.pl-cards td:not(:first-child), .pl-cards th { white-space: nowrap; }
.pl-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; color: var(--muted); }
.pl-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.pl-cogs { fill: var(--muted); background: var(--muted); }
.pl-profit { fill: var(--brand-yellow); background: var(--brand-yellow); }
.pl-uncosted { fill: var(--muted); background: var(--muted); opacity: .45; }
svg .pl-grid { stroke: var(--line); }
svg .pl-axis { fill: var(--muted); font-size: 12.5px; }

@media (max-width: 700px) {
  .top { padding: 8px 14px; gap: 8px; }
  main { padding: 16px 16px 60px; }
  th, td { padding: 10px 10px; }
  .card { grid-template-columns: 110px minmax(0, 1fr); }
  .card img { width: 110px; height: 154px; }
  .brand-name { display: none; }
  .tabs { order: 3; flex-basis: 100%; }
}
.net { font-size: 14px; line-height: 1.5; }

/* New listing cards: sections with small caps labels. */
.card .fields { gap: 16px; }
.dc-photo { display: grid; gap: 8px; align-content: start; justify-items: start; }
.dc-nophoto { width: 160px; aspect-ratio: 3 / 4; display: grid; place-items: center; border: 1px dashed currentColor; border-radius: 8px; opacity: .6; }
.dc-photo .small { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dc-head { display: grid; gap: 3px; }
.dc-name { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 17px; }
.dc-section { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.dc-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dc-labelrow { display: flex; justify-content: space-between; align-items: baseline; }
.dc-field { display: grid; gap: 4px; }
.dc-field select { width: 100%; max-width: none; }
.dc-inputs { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.dc-inputs input.price { width: 110px; }
.dc-inputs input.qty { width: 70px; }
.dc-suggest { display: grid; gap: 2px; padding: 10px 12px; background: var(--bg); border-radius: 8px; }
.dc-suggest strong { font-size: 18px; }
.dc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; align-items: start; }
.dc-stat { display: grid; gap: 1px; }
.dc-stat .dc-label { font-size: 11px; }
.dc-value { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dc-net { width: 100%; max-width: 320px; font-size: 15px; }
.dc-net td { padding: 3px 0; border-bottom: 0; }
.dc-net tr.dc-keep td { border-top: 1px solid var(--line); padding-top: 7px; }
input[type=file] { max-width: 100%; }

/* Full-width new listing cards: on wide screens the sections sit side by side --
   title and price | market | each sale -- under the card's header. */
.dc-status:empty { display: none; }
@media (min-width: 1100px) {
  .card .fields {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "head head head" "title market sale" "price graded sale" "status status status";
    column-gap: 28px; align-items: start;
  }
  .dc-head { grid-area: head; }
  .dc-title { grid-area: title; }
  .dc-price { grid-area: price; }
  .dc-market { grid-area: market; }
  .dc-graded { grid-area: graded; }
  .dc-sale { grid-area: sale; }
  .dc-status { grid-area: status; }
  .dc-market, .dc-sale { align-self: stretch; align-content: start; }
  .dc-stats { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}

/* Stories tab */
.stories .panel { margin-bottom: 16px; }
.story-conn { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.story-conn h2, .story-conn p { width: 100%; margin: 0 0 6px; }
.story-account { display: flex; align-items: center; gap: 12px; }
.story-account img { border-radius: 50%; }
.story-conn-actions { display: flex; gap: 16px; }
.story-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.story-tools input[type=search] { flex: 1 1 220px; max-width: 360px; }
.story-tools .spacer { flex: 1; }
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.story-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); display: flex; flex-direction: column; }
.story-card.on { border-color: var(--brand-yellow); box-shadow: 0 0 0 2px var(--brand-yellow); }
.story-pick { position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: pointer; background: var(--chip); aspect-ratio: 3 / 4; color: inherit; font: inherit; }
.story-pick:disabled { cursor: default; }
.story-pick img { width: 100%; height: 100%; object-fit: contain; display: block; }
.story-noimg { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 14px; }
.story-meta { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.story-card-actions { display: flex; gap: 6px; margin-top: 2px; }
.story-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.story-preview { display: block; max-height: 70vh; max-width: 100%; margin: 0 auto 12px; border-radius: 10px; }
.story-thumb { width: 45px; height: 80px; object-fit: cover; border-radius: 4px; display: block; }
.story-thumb.post { width: 64px; height: 80px; }
.story-history-caption { max-width: 48ch; white-space: pre-line; }
/* Create post, in the preview */
.story-post-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.story-post-check input { width: 18px; height: 18px; margin: 0; }
.story-post { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: start; }
.story-post[hidden] { display: none; }
.story-post-img { width: 160px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 8px; background: var(--chip); display: block; }
.story-post-text { display: grid; gap: 4px; }
.story-post-caption { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; min-height: 120px; }
.story-post-text .link { justify-self: start; }
@media (max-width: 480px) {
  .story-post { grid-template-columns: 110px 1fr; }
  .story-post-img { width: 110px; }
}
.story-color { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.story-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.story-swatch { width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: var(--swatch, conic-gradient(red, yellow, lime, cyan, blue, magenta, red)); cursor: pointer; position: relative; overflow: hidden; }
.story-swatch.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
.story-swatch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.story-swatch-auto { --swatch: linear-gradient(135deg, #ff7a00, #ff2d87 45%, #2f7bff); color: #fff; font-weight: 700; font-size: 13px; line-height: 1; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.story-toggle { display: block; margin: 0 0 6px; cursor: pointer; }
.story-toggle input { margin-right: 6px; }
.story-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; margin-bottom: 10px; }
.story-template { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 6px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); cursor: pointer; font: inherit; font-size: 14px; color: inherit; }
.story-template.on { border-color: var(--brand-yellow); box-shadow: 0 0 0 2px var(--brand-yellow); }
.story-template-img { display: block; width: 100%; aspect-ratio: 9 / 16; border-radius: 8px; overflow: hidden; background: var(--chip); }
.story-template-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.story-badge { position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 999px; background: var(--brand-yellow); color: #111; font-size: 12px; font-weight: 700; }
.story-defaults > summary { cursor: pointer; list-style-position: inside; }
.story-defaults[open] > summary { margin-bottom: 14px; }
/* Stories to post */
.story-queue-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 10px; }
.story-queue-head h2 { margin: 0; }
.story-queue-head .spacer { flex: 1; }
.story-queue-items { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.story-queue-item { position: relative; flex: 0 0 96px; display: flex; flex-direction: column; gap: 4px; }
.story-queue-open { padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--chip); cursor: pointer; aspect-ratio: 9 / 16; width: 96px; }
.story-queue-open img { display: block; width: 100%; height: 100%; object-fit: cover; }
.story-queue-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.story-queue-meta .story-title { -webkit-line-clamp: 2; font-size: 12px; line-height: 1.3; }
.story-queue-remove { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
/* The preview */
dialog.story-modal { width: min(560px, 96vw); max-height: 96vh; overflow-y: auto; }
.story-modal-body { padding: 16px; display: grid; gap: 12px; }
.story-modal-head { display: flex; align-items: flex-start; gap: 12px; }
.story-modal-title { flex: 1; min-width: 0; }
.story-modal-title strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.story-modal-close { width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; flex: none; }
.story-modal-stage { display: flex; justify-content: center; transition: opacity .15s; }
.story-modal-stage.loading { opacity: .75; }
.story-modal-img { display: block; height: clamp(220px, calc(96vh - 400px), 640px); aspect-ratio: 9 / 16; max-width: 100%; object-fit: contain; border-radius: 10px; background: var(--chip); }
.story-carousel { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding: 4px 2px 6px; }
.story-slide { flex: 0 0 76px; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: inherit; font: inherit; cursor: pointer; }
.story-slide.on { border-color: var(--brand-yellow); box-shadow: 0 0 0 2px var(--brand-yellow); }
.story-slide .story-template-img { border-radius: 6px; }
.story-slide .small { font-size: 11px; line-height: 1.2; text-align: center; }
.story-modal-colors .story-swatches { justify-content: center; }
.story-modal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; position: sticky; bottom: 0; margin: 0 -16px -16px; padding: 12px 16px 16px; background: var(--panel); border-top: 1px solid var(--line); }
.story-modal-actions .spacer { flex: 1; }
@media (max-width: 520px) {
  .story-modal-actions > .small { display: none; }
  .story-modal-actions .spacer { display: none; }
  .story-modal-actions button { flex: 1; white-space: nowrap; }
  .story-modal-img { height: clamp(220px, calc(92vh - 420px), 560px); }
  .story-modal-colors .story-swatch { width: 26px; height: 26px; }
  .story-modal-colors .story-swatches { gap: 6px; }
}

/* Stories tabs: Inventory, Templates, Replies, History */
.story-tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.story-tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 16px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.story-tabs button:hover { color: var(--text); }
.story-tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--brand-yellow); }
.story-pane[hidden] { display: none; }
.story-cat { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-keywords { display: grid; gap: 14px; }
.story-keywords p { margin: 0; }
.story-keywords > button { justify-self: start; }
.story-kw { display: grid; gap: 8px; }
.story-kw-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.story-kw input[type=text] { max-width: 280px; }
.story-emojis { display: flex; flex-wrap: wrap; gap: 6px; }
.story-emoji { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 24px; line-height: 1; cursor: pointer; }
.story-emoji.on { border-color: var(--brand-yellow); box-shadow: 0 0 0 2px var(--brand-yellow); }
.story-lines { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; line-height: 1.5; resize: vertical; }
.story-lines-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 10px; }

/* Posting progress: a bar at the bottom of the screen while Stories go up */
.story-progress { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50; width: min(440px, calc(100vw - 32px)); box-sizing: border-box; padding: 12px 14px 10px; border-radius: 12px; background: var(--brand-navy); color: #fff; box-shadow: 0 8px 28px rgba(0,0,0,.35); }
.story-progress[hidden] { display: none; }
.story-progress-row { display: flex; align-items: center; gap: 12px; }
.story-progress-text { flex: 1; min-width: 0; }
.story-progress-title { opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-progress-icon { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--good); font-weight: 700; font-size: 13px; }
.story-progress.bad .story-progress-icon { background: var(--bad); }
.story-progress-close { flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.story-progress-bar { height: 4px; margin-top: 10px; border-radius: 2px; background: rgba(255,255,255,.18); overflow: hidden; }
.story-progress-bar span { display: block; height: 100%; background: var(--brand-yellow); transition: width .4s ease; }
.story-progress.bad .story-progress-bar span { background: var(--bad); }
.story-spinner { flex: none; display: inline-block; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.3); border-top-color: var(--brand-yellow); border-radius: 50%; animation: story-spin .8s linear infinite; }
.story-badge .story-spinner { width: 10px; height: 10px; border-width: 2px; border-color: rgba(0,0,0,.2); border-top-color: #111; margin-right: 5px; vertical-align: -1px; }
@keyframes story-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .story-spinner { animation-duration: 2.4s; } }
.story-queue-open { position: relative; }
.story-queue-state { position: absolute; inset: auto 0 0 0; padding: 4px 0; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 5px; }
.story-queue-state .story-spinner { width: 10px; height: 10px; border-width: 2px; }
.story-queue-item.waiting img { opacity: .6; }
