/* S15 in-app tools: hub sliders, template gallery, signature + business card workbenches.
   Prefix: at-. Reuses qq-* / ap-* / tl-modal / ap-toast from the shared stylesheets. */
[hidden] { display: none !important; }
.at-page { min-width: 0; }
.at-tools > *, .at-row__head > *, .at-tplgrid > *, .at-work__form > *, .at-side > * { min-width: 0; }
.at-tools :is(a, button, input, [role="button"], [tabindex]):focus-visible,
.at-page :is(a, button, input, textarea, [role="button"], [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- hub: search ---------- */
.at-search { display: flex; align-items: center; gap: 10px; max-width: 560px; min-height: 52px;
  padding: 0 8px 0 16px; border-radius: var(--pill); border: 1px solid var(--line-2); background: var(--surface); }
.at-search .qq-ic { width: 18px; height: 18px; color: var(--text-2); flex: none; }
.at-search input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: var(--text); outline: none; }
.at-search input::placeholder { color: var(--text-2); }
.at-search__clear { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: none; color: var(--text-2); cursor: pointer; }
.at-search__clear:hover { background: var(--surface-2); color: var(--text); }
.at-search__clear .qq-ic { width: 15px; height: 15px; }
.at-count { margin: 14px 2px 0; font-size: .88rem; font-weight: 600; color: var(--text-2); }

/* ---------- hub: category tabs + card grid ---------- */
.at-hubbar { display: grid; gap: 14px; }
.at-group { margin-top: 26px; }
.at-group__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.at-group__ic { display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: 10px; background: var(--ink); color: var(--on-ink); }
.at-group__ic .qq-ic { width: 17px; height: 17px; }
.at-group__head h2 { margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
.at-group__head small { margin-left: auto; font-size: .82rem; font-weight: 600; color: var(--text-2); }
.at-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.at-card { position: relative; display: grid; grid-template-rows: auto 1fr auto; gap: 14px; min-height: 176px;
  padding: 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--sh-1); text-decoration: none; color: inherit;
  transition: border-color .2s, box-shadow .2s, transform .2s; }
.at-card:hover { border-color: var(--line-2); box-shadow: var(--sh-2); transform: translateY(-2px); }
.at-card__ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); }
.at-card__ic .qq-ic { width: 23px; height: 23px; }
.at-card__tx { display: grid; gap: 4px; align-content: start; min-width: 0; }
.at-card b { font-size: .96rem; }
.at-card small { color: var(--text-2); font-size: .84rem; line-height: 1.45; }
.at-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.at-card__go { width: 16px; height: 16px; color: var(--text-2); transition: transform .2s, color .2s; }
.at-card:hover .at-card__go { color: var(--text); transform: translateX(3px); }
.at-free { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--pill);
  background: var(--accent-soft); color: var(--accent); font-style: normal;
  font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.at-free .qq-ic { width: 12px; height: 12px; }
.at-empty { display: grid; justify-items: center; gap: 6px; margin-top: 18px; padding: 48px 20px;
  border-radius: var(--r-xl); border: 1.5px dashed var(--line-2); text-align: center; color: var(--text-2); }
.at-empty > span .qq-ic { width: 40px; height: 40px; color: var(--accent); }
.at-empty b { color: var(--text); font-size: 1.05rem; }
.at-empty p { margin: 0 0 8px; }

/* ---------- underline tab bar (rule 11: left-aligned, compact, active underlined) ---------- */
.at-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.at-tabs::-webkit-scrollbar { display: none; }
.at-tabs button { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 12px;
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none;
  font: 600 .88rem var(--font); color: var(--text-2); white-space: nowrap; cursor: pointer; }
.at-tabs button .qq-ic { width: 16px; height: 16px; }
.at-tabs button em { font-style: normal; font-size: .72rem; font-weight: 700; padding: 1px 8px;
  border-radius: var(--pill); background: var(--surface-2); color: var(--text-2); }
.at-tabs button:hover { color: var(--text); }
.at-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.at-tabs button[aria-selected="true"] em { background: var(--accent-soft); color: var(--accent); }

/* ---------- template gallery ---------- */
.at-tplfilters { margin: 4px 0 18px; }
.at-tplgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.at-tplcard { display: grid; gap: 0; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface); overflow: hidden; box-shadow: var(--sh-1); }
.at-thumb { position: relative; display: block; width: 100%; padding: 18px 18px 0; border: 0;
  background: var(--bg-2); cursor: pointer; }
.at-thumb__hover { position: absolute; left: 0; right: 0; bottom: 14px; display: grid; justify-items: center;
  gap: 8px; opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; pointer-events: none; }
.at-thumb__hover a { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px;
  border-radius: var(--pill); background: var(--ink); color: var(--on-ink);
  font-weight: 700; font-size: .86rem; text-decoration: none; }
.at-thumb__hover em { font-style: normal; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: var(--pill); background: var(--surface); border: 1px solid var(--line);
  color: var(--text-2); font-size: .78rem; font-weight: 600; }
.at-thumb__hover .qq-ic { width: 15px; height: 15px; }
.at-thumb:hover .at-thumb__hover a, .at-thumb:focus-visible .at-thumb__hover a { pointer-events: auto; }
.at-thumb:hover .at-thumb__hover, .at-thumb:focus-visible .at-thumb__hover { opacity: 1; transform: none; }
.at-tplmeta { display: grid; gap: 8px; padding: 14px 16px 16px; }
.at-tplmeta b { font-size: 1.02rem; }
.at-tplmeta small { display: block; margin-top: 2px; color: var(--text-2); font-size: .85rem; line-height: 1.45; }
.at-tplcats { display: flex; flex-wrap: wrap; gap: 6px; }
.at-tplcats em { font-style: normal; font-size: .72rem; font-weight: 700; padding: 3px 9px;
  border-radius: var(--pill); background: var(--surface-2); color: var(--text-2); }
.at-tplcta { display: flex; gap: 8px; }
.at-tplcta .qq-btn { flex: 1; }
/* mini CV thumbnails (pure HTML/CSS, --tc = template colour) */
.at-mini { aspect-ratio: 1 / 1.3; border-radius: 10px 10px 0 0; background: #fff;
  border: 1px solid var(--line); border-bottom: 0; overflow: hidden; color: #0a0a0a; }
.at-mini--big { aspect-ratio: 1 / 1.414; border-radius: 14px; border-bottom: 1px solid var(--line); box-shadow: var(--sh-2); }
.at-mini i { display: block; border-radius: 3px; background: #d6d3d1; margin-top: 5px; }
.at-mini em { display: block; height: 8px; }
.at-mini b { display: block; height: 12px; border-radius: 4px; background: var(--tc); }
.at-mini__pad { padding: 12px; }
.at-mini__name { width: 52%; }
.at-mini__row { display: grid; grid-template-columns: 34% 1fr; height: 100%; }
.at-mini__side { background: var(--tc); padding: 12px 10px; }
.at-mini__side s { display: block; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.85); margin-bottom: 8px; }
.at-mini__side i { background: rgba(255,255,255,.55); }
.at-mini__main { padding: 12px 10px; }
.at-mini__main b { width: 70%; }
.at-mini__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.at-mini__top { padding: 12px 12px 8px; border-bottom: 3px solid var(--tc); }
.at-mini__top b { width: 44%; }
.at-mini__band { background: var(--tc); padding: 12px; }
.at-mini__band b { background: #fff; width: 48%; }
.at-mini__band i { background: rgba(255,255,255,.6); }
.at-mini__cards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.at-mini__cards u { display: block; height: 34px; border-radius: 6px; text-decoration: none;
  background: color-mix(in srgb, var(--tc) 14%, #fff); border: 1px solid color-mix(in srgb, var(--tc) 30%, #fff); }
.at-tplmodal { width: min(880px, 100%); grid-template-columns: 1fr 1fr; gap: 24px; text-align: left; align-items: start; }
.at-tplmodal__meta { display: grid; gap: 12px; align-content: start; padding-top: 8px; }
.at-tplmodal__meta h2 { font-size: 1.8rem; }
.at-tplmodal__meta p { margin: 0; }
.at-dots { display: flex; gap: 10px; }
.at-dots button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--c); cursor: pointer;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line-2); }
.at-dots button.is-on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
/* My CVs strip under the gallery */
.at-mycvs { margin-top: 22px; }
.at-mycvs__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.at-mycvs__head h2 { margin: 0 auto 0 0; font-size: 1.05rem; font-weight: 800; }
.at-mycv { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); }
.at-mycv__page { display: grid; gap: 3px; align-content: center; justify-items: center; width: 34px; height: 44px;
  flex: none; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface); }
.at-mycv__page u { display: block; width: 18px; height: 3px; border-radius: 2px; background: var(--surface-3); text-decoration: none; }
.at-mycv div { flex: 1; min-width: 0; }
.at-mycv b { display: block; font-size: .92rem; }
.at-mycv small { color: var(--text-2); font-size: .8rem; }

/* ---------- workbench layout (signature + business card) ---------- */
.at-work { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.at-work__form { display: grid; gap: 12px; min-width: 0; }
.at-side { position: sticky; top: 96px; display: grid; gap: 10px; min-width: 0; }
.at-pane { padding: 20px; }
.at-pane__head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.at-pane__ic { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent); }
.at-pane__ic .qq-ic { width: 17px; height: 17px; }
.at-pane__head b { font-size: 1.02rem; }
.at-pane__head small { margin-left: auto; color: var(--text-2); font-size: .82rem; font-weight: 600; }
.at-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.at-field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.at-field--wide { grid-column: 1 / -1; }
.at-field > span { font-size: .84rem; font-weight: 700; }
.at-input { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px;
  border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); }
.at-input:focus-within { border-color: var(--accent); }
.at-input .qq-ic { width: 18px; height: 18px; color: var(--text-2); flex: none; }
.at-input input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: var(--text); outline: none; }
.at-input input::placeholder { color: var(--text-2); }
.at-field textarea { min-height: 48px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-2);
  background: var(--surface); font: inherit; color: var(--text); resize: vertical; }
.at-drop { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px;
  border-radius: 14px; border: 1.5px dashed var(--line-2); background: var(--surface);
  font: inherit; color: inherit; cursor: pointer; }
.at-drop:hover { border-color: var(--accent); }
.at-drop .qq-ic { width: 20px; height: 20px; color: var(--text-2); flex: none; }
.at-drop small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-2); font-size: .84rem; }
.at-drop u { font-weight: 700; font-size: .84rem; text-decoration: none; color: var(--accent); }
/* switch */
.at-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px;
  border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); font: inherit;
  color: var(--text); cursor: pointer; justify-self: start; }
.at-switch > span { position: relative; width: 40px; height: 24px; border-radius: 12px;
  background: var(--surface-3); flex: none; transition: background .2s; }
.at-switch > span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: left .2s; }
.at-switch.is-on > span { background: var(--accent); }
.at-switch.is-on > span::after { left: 19px; }
.at-switch em { font-style: normal; font-weight: 600; font-size: .88rem; }
/* layout picker */
.at-layouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.at-layout { display: grid; gap: 2px; justify-items: start; text-align: left; padding: 12px;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface);
  font: inherit; color: inherit; cursor: pointer; }
.at-layout .qq-ic { width: 20px; height: 20px; color: var(--text-2); }
.at-layout b { font-size: .88rem; }
.at-layout small { color: var(--text-2); font-size: .76rem; line-height: 1.35; }
.at-layout:hover { border-color: var(--line-2); }
.at-layout.is-on { border-color: var(--ink); box-shadow: var(--sh-1); }
.at-layout.is-on .qq-ic { color: var(--accent); }
/* colour swatches + custom picker */
.at-sw { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.at-sw button[data-c] { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--c);
  cursor: pointer; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line-2); }
.at-sw button[data-c].is-on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.at-sw__add { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px dashed var(--line-2); background: none; color: var(--text-2); cursor: pointer; }
.at-sw__add:hover { border-color: var(--accent); color: var(--accent); }
.at-sw__add .qq-ic { width: 16px; height: 16px; }
.at-cp { position: absolute; left: 0; top: calc(100% + 8px); z-index: 40; display: grid; gap: 10px;
  width: min(300px, calc(100vw - 48px)); padding: 14px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--sh-3); }
.at-cp__sv { position: relative; height: 150px; border-radius: 10px; cursor: crosshair; touch-action: none;
  background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent),
    hsl(var(--h, 150) 100% 50%); }
.at-cp__sv i { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3); pointer-events: none; }
.at-cp__hue { width: 100%; accent-color: var(--accent); }
.at-cp__row { display: flex; align-items: center; gap: 8px; }
.at-cp__now { width: 34px; height: 34px; flex: none; border-radius: 10px; border: 1px solid var(--line-2); }
.at-cp__hex { flex: 1; min-height: 40px; }
.at-cp__warn { display: flex; align-items: center; gap: 6px; margin: 0; font-size: .8rem;
  font-weight: 600; color: #b45309; }
.at-cp__warn .qq-ic { width: 15px; height: 15px; }
/* side column bits */
.at-paper { background: #fff; border-radius: var(--r-lg); border: 1px solid var(--line);
  padding: 20px 16px; color: #1c1917; overflow-x: auto; }
.at-meta { margin: 0; text-align: center; font-size: .82rem; font-weight: 600; color: var(--text-2); }
.at-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0;
  font-size: .8rem; color: var(--text-2); text-align: center; }
.at-note .qq-ic { width: 15px; height: 15px; color: var(--accent); }
.at-mailpan { padding: 14px 4px 4px; color: var(--text-2); font-size: .92rem; line-height: 1.6; }
.at-mailpan ol { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.at-mailpan strong { color: var(--text); }

/* ---------- signature preview ---------- */
.at-es { font: 400 13px/1.55 Inter, Arial, sans-serif; }
.at-es b { color: #0a0a0a; font-size: 15px; }
.at-es a { color: var(--esc, #166534); text-decoration: none; }
.at-es__side { display: flex; gap: 12px; align-items: center; }
.at-es__photo { display: inline-block; width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  flex: none; background: #e7e5e4; vertical-align: middle; }
.at-es__stack .at-es__photo { width: 56px; height: 56px; margin-bottom: 8px; }
.at-es__banner { border-left: 4px solid var(--esc, #166534); padding-left: 12px; }
.at-es__centred { text-align: center; }
.at-es__centred .at-es__photo { margin: 0 auto 8px; }
.at-es__card { border: 1px solid #e7e5e4; border-radius: 12px; padding: 12px; display: flex; gap: 12px; align-items: center; }
.at-es__qr { display: inline-block; width: 64px; height: 64px; flex: none; vertical-align: middle; }
.at-es__qr svg { display: block; width: 100%; height: auto; }

/* ---------- business card flip preview ---------- */
.at-bcstage { perspective: 1200px; }
.at-bc { position: relative; aspect-ratio: 85 / 55; transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.at-bcstage.is-back .at-bc { transform: rotateY(180deg); }
.at-bc__face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--sh-2); overflow: hidden;
  background: #fff; color: #1c1917; padding: 14px 16px; font-size: 11px; line-height: 1.5; }
.at-bc__back { transform: rotateY(180deg); }
.at-bc__front b { display: block; font-size: 15px; color: #0a0a0a; letter-spacing: -.01em; }
.at-bc__front small, .at-bc__back small { color: #57534e; }
.at-bc__qr { display: inline-block; width: 72px; height: 72px; vertical-align: middle; }
.at-bc__qr svg { display: block; width: 100%; height: auto; }
.at-bc__split { display: flex; gap: 10px; align-items: center; height: 100%; }
.at-bc__split > div:first-child { flex: 1; min-width: 0; }
.at-bc__centred { text-align: center; display: grid; gap: 2px; align-content: center; height: 100%; }
.at-bc__band { border-top: 10px solid var(--bcc, #166534); }
.at-bc__dark { background: #1c1917; color: #e7e5e4; border-color: #1c1917; }
.at-bc__dark b { color: #fff; }
.at-bc__dark small { color: #a8a29e; }
.at-bc__photo { display: flex; gap: 12px; align-items: center; height: 100%; }
.at-bc__init { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  background: var(--bcc, #166534); color: #fff; font-weight: 800; font-size: 22px; flex: none; }
.at-bc__backc { display: flex; gap: 12px; align-items: center; justify-content: center; height: 100%; text-align: left; }
.at-bc__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.at-bc__row em { font-style: normal; font-size: .82rem; font-weight: 600; color: var(--text-2); }
.at-qrwait { display: grid; place-items: center; min-height: 64px; border-radius: 8px;
  background: var(--surface-2); color: var(--text-2); font-weight: 700; }


/* ---------- one-screen tool pattern (every tool page): crumbs, actions, QR stage, bits ---------- */
.at-crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 14px;
  font-size: .86rem; font-weight: 500; color: var(--text-2); }
.at-crumbs a { color: var(--text-2); text-decoration: none; }
.at-crumbs a:hover { color: var(--text); }
.at-crumbs .qq-ic { width: 12px; height: 12px; }
.at-crumbs span { color: var(--text); font-weight: 700; }
.at-crumbs em { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-style: normal;
  font-weight: 600; color: var(--text-2); }
.at-crumbs em .qq-ic { width: 15px; height: 15px; color: var(--accent); }
.at-actions { display: grid; gap: 8px; }
.at-actions .qq-btn { width: 100%; justify-content: center; }
.at-side { padding: 16px; border-radius: var(--r-xl); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sh-1); }
.at-qrstage { display: grid; justify-items: center; gap: 10px; padding: 18px 14px; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: #fff; color: #0a0a0a; }
.at-qrstage__code { width: min(100%, 240px); aspect-ratio: 1; }
.at-qrstage__code svg { display: block; width: 100%; height: 100%; }
.at-qrstage b { font-size: .8rem; letter-spacing: .16em; height: 20px; line-height: 20px; text-align: center; }
.at-qrstage b[hidden] { display: block !important; visibility: hidden; }
.at-range { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.at-range input { flex: 1; min-width: 0; accent-color: var(--accent); }
.at-range em { min-width: 1.6em; font-style: normal; font-weight: 700; font-size: .9rem; text-align: right; }
.at-drop--big { min-height: 96px; flex-direction: column; justify-content: center; text-align: center; gap: 4px; padding: 18px; }
.at-drop--big .qq-ic { width: 28px; height: 28px; color: var(--accent); }
.at-drop--big small { flex: none; max-width: 100%; }
.at-drop.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.at-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.at-hint { margin: 0; color: var(--text-2); font-size: .82rem; line-height: 1.45; }
.at-filerow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.at-rows { display: grid; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.at-rows > div { display: grid; grid-template-columns: 1.2fr 2fr 1fr 1fr; gap: 10px; align-items: center; padding: 10px 14px;
  border-top: 1px solid var(--line); font-size: .86rem; cursor: pointer; background: var(--surface); }
.at-rows > div:first-child { border-top: 0; }
.at-rows > div.is-head { background: var(--surface-2); font-weight: 700; font-size: .78rem; color: var(--text-2); cursor: default; text-transform: uppercase; letter-spacing: .04em; }
.at-rows > div:not(.is-head):hover { background: var(--surface-2); }
.at-rows > div.is-on { background: var(--accent-soft); }
.at-rows span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-errs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.at-errs:empty { display: none; }
.at-errs li { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: #b45309; }
.at-errs .qq-ic { width: 15px; height: 15px; flex: none; }
.at-err { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: .84rem; font-weight: 600; color: var(--danger, #b91c1c); }
.at-err .qq-ic { width: 16px; height: 16px; }
.at-pre { color: var(--text-2); font-size: .9rem; white-space: nowrap; }
.at-savebox { width: min(520px, 100%); text-align: left; }
.at-savebox h2 { margin: 0 0 6px; }
.at-savebox > div > p { margin: 0 0 14px; color: var(--text-2); }
.at-savegrid { display: grid; gap: 14px; }
.at-savegrid .ap2-dd, .at-savegrid .ap2-chips { min-width: 0; }
.at-savebox .tl-modal__cta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.at-savedone__ic { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 10px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); }
.at-savedone__ic .qq-ic { width: 28px; height: 28px; }
.at-crumbs + .at-tabs, .at-crumbs + .at-tplfilters { margin-top: 0; }
.at-side .at-paper { height: 290px; overflow: auto; }

/* ---------- saved-items table section ---------- */
.at-saved { margin-top: 22px; }
.at-saved__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.at-saved__head h2 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.at-saved__head p { margin: 0 0 0 auto; font-size: .82rem; font-weight: 600; color: var(--text-2); }
.at-load { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px;
  border-radius: var(--pill); border: 1px solid var(--line-2); background: var(--surface);
  font: 700 .8rem var(--font); color: var(--text); cursor: pointer; white-space: nowrap; }
.at-load:hover { border-color: var(--accent); color: var(--accent); }
.at-load .qq-ic { width: 14px; height: 14px; }
/* kit-table column toggles (app-table.js adds hide-<key> on the table) */
[data-table-id="signatures"].hide-qr .ap-col-qr,
[data-table-id="signatures"].hide-updated .ap-col-updated,
[data-table-id="bizcards"].hide-size .ap-col-size,
[data-table-id="bizcards"].hide-updated .ap-col-updated { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .at-work { grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
  .at-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .at-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .at-tplgrid { grid-template-columns: repeat(2, 1fr); }
  .at-tplmodal { grid-template-columns: 1fr; }
  .at-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  [data-table-id="signatures"] .ap-col-qr, [data-table-id="bizcards"] .ap-col-size { display: none; }
  .at-saved .ap-name { min-width: 0; overflow: hidden; }
  .at-saved .ap-name b, .at-saved .ap-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .at-grid { grid-template-columns: 1fr; }
  .at-tplgrid, .at-layouts { grid-template-columns: 1fr; }
  .at-cards { grid-template-columns: 1fr; }
  .at-grid--4 { grid-template-columns: 1fr; }
  .at-rows > div { grid-template-columns: 1fr 1fr; }
  .at-rows > div span:nth-child(n+3) { display: none; }
  .at-crumbs em { margin-left: 0; width: 100%; }
  .at-saved__head { flex-wrap: wrap; }
  .at-saved__head p { margin-left: 0; }
  .at-pane { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .at-bc { transition: none; }
}
.at-panels { margin-top: 14px; }
.at-savebox .tl-modal__cta .qq-btn { flex: 1 1 170px; width: auto; justify-content: center; }
.at-savebox { max-height: calc(100vh - 32px); overflow-y: auto; }
.at-input input:focus-visible, .at-input input:focus { outline: none; }
.at-savegrid { grid-template-columns: minmax(0, 1fr); }
.at-savegrid .at-input { min-width: 0; }
.at-savegrid .at-pre { font-size: .82rem; }

/* template gallery: equal cards, no wrapping buttons */
.at-tplcard { grid-template-rows: auto 1fr; }
.at-thumb { aspect-ratio: 1 / 1.12; overflow: hidden; padding: 14px 14px 0; }
.at-thumb .at-mini { aspect-ratio: auto; height: 100%; }
.at-tplmeta { align-content: space-between; }
.at-tplcta .qq-btn { white-space: nowrap; justify-content: center; padding-left: 12px; padding-right: 12px; }
@media (max-width: 1100px) { .at-tplgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .at-tplgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .ap:has(.at-page) .ap-top__act > .qq-btn { display: none; }
  .at-tplgrid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) { .at-work { grid-template-columns: 1fr; } .at-side { position: static; } }

/* narrow form column (aside beside it): one field per row so nothing overflows */
@media (max-width: 1100px) and (min-width: 761px) {
  .at-work__form .at-grid { grid-template-columns: minmax(0, 1fr); }
  .at-layouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
