/**
 * Wave A — cabinet screens (library / support / balance / history)
 * Loaded after app.css + theme-magicbox.css. Tokens from Magicbox.
 */

/* ── Shared ─────────────────────────────────────────── */
.cab-page {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px calc(var(--dock) + 28px);
  text-align: left;
  box-sizing: border-box;
}
.cab-page--wide { max-width: 1360px; }
.cab-page--hist { max-width: 1440px; padding-left: 40px; padding-right: 40px; }
.cab-page--support { max-width: 1240px; }

.cab-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.cab-head-main { min-width: 0; }
.cab-h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}
.cab-lead {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}
.cab-head-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
}
.cab-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.cab-btn-secondary:hover {
  border-color: var(--ui-hover-border, rgba(168, 85, 247, 0.4));
  background: var(--ui-hover-soft, rgba(168, 85, 247, 0.06));
  box-shadow: var(--ui-hover-glow, 0 0 8px rgba(168, 85, 247, 0.1));
}
.cab-btn-secondary:focus-visible {
  outline: none;
  border-color: var(--ui-focus-border, var(--cab-accent-border, rgba(168, 85, 247, 0.55)));
  box-shadow: var(--ui-focus-glow, var(--cab-glow-focus));
}
.cab-btn-back {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
}

.cab-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.cab-toolbar-grow { flex: 1 1 auto; min-width: 0; }
.cab-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cab-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.cab-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.cab-chip.is-on {
  border-color: rgba(160, 32, 240, .65);
  background: var(--chip-on);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(160, 32, 240, .18);
}
.cab-chip:focus-visible {
  outline: none;
  border-color: var(--ui-focus-border, rgba(168, 85, 247, 0.55));
  box-shadow: var(--ui-focus-glow, var(--cab-glow-focus));
}
.cab-chip.is-on span {
  background: rgba(160, 32, 240, .28);
  color: var(--text);
}
.cab-chip:hover:not(.is-on) {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.06);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.1);
}

.cab-dd {
  position: relative;
  flex-shrink: 0;
}
.cab-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  min-width: 160px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #292929;
  background: #101010;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.cab-dd-btn::after {
  content: '';
  margin-left: auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
}
.cab-dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 100%;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid #292929;
  background: #121212;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.cab-dd-menu[hidden] { display: none !important; }
.cab-dd-opt {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.cab-dd-opt:hover {
  background: var(--ui-hover-quiet-bg, rgba(168, 85, 247, 0.1));
}
.cab-dd-opt:focus-visible {
  outline: none;
  background: rgba(168, 85, 247, 0.1);
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.35), var(--ui-focus-glow-quiet, var(--cab-glow-focus));
}
.cab-dd-opt.is-on {
  background: rgba(160, 32, 240, .18);
  color: #fff;
}
.cab-dd-opt.is-on::after {
  content: '✓';
  margin-left: auto;
  color: #c084fc;
  font-weight: 700;
}

.cab-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 12px;
}
.cab-search-ico {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
  font-size: 14px;
}
.cab-search input[type="search"] {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 40px;
  border-radius: 12px;
  border: 1px solid #292929;
  background: #0b0b0d;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.cab-search input[type="search"]:focus,
.cab-search input[type="search"]:focus-visible {
  outline: none;
  border-color: var(--ui-focus-border, #8b5cf6);
  box-shadow: var(--ui-focus-glow, 0 0 0 2px rgba(139, 92, 246, .12));
}
.cab-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.cab-search-clear {
  position: absolute;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cab-search-clear:hover {
  color: var(--text);
  background: var(--ui-hover-quiet-bg, rgba(168, 85, 247, 0.1));
}
.cab-search-clear:focus-visible {
  outline: none;
  color: var(--text);
  background: rgba(168, 85, 247, 0.1);
  box-shadow: var(--ui-focus-glow-quiet, var(--cab-glow-focus));
}

.cab-found {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
}

.cab-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--gradient-brand);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: filter .15s ease, box-shadow .15s ease;
}
.cab-cta:hover {
  filter: var(--ui-hover-cta-filter, brightness(1.06));
  box-shadow: var(--ui-hover-cta-glow, var(--glow-hover));
  transform: var(--ui-hover-cta-lift, translateY(-1px));
}
.cab-cta:focus-visible {
  outline: none;
  box-shadow: var(--ui-focus-glow-cta, var(--glow-hover));
}
.cab-cta:disabled,
.cab-cta.is-loading {
  opacity: .7;
  pointer-events: none;
}
.cab-cta--block { width: 100%; }

.cab-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, .1);
  border-radius: 14px;
  background: rgba(255, 255, 255, .02);
}
.cab-empty p { margin: 0 0 14px; }
.cab-flash {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(32, 232, 121, .28);
  background: rgba(32, 232, 121, .08);
  color: #b8f5d0;
  font-size: 14px;
}
.cab-flash.err {
  border-color: rgba(255, 77, 94, .35);
  background: rgba(255, 77, 94, .08);
  color: #ffb4bc;
}

/* Dock active — text follows theme (Light chip-on is pale; avoid forced white) */
.dock a.dock-link.is-on {
  border-color: rgba(160, 32, 240, .55) !important;
  background: rgba(160, 32, 240, .12) !important;
  color: var(--text) !important;
}

/* ── Library (W.LIB) ────────────────────────────────── */
.lib-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lib-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) minmax(148px, 200px);
  gap: 18px;
  align-items: stretch;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #242424;
  background: #111;
  position: relative;
  z-index: 1;
}
.lib-card.lib-card--menu-open {
  z-index: 60;
}
.lib-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 260 / 170;
  max-height: 170px;
  border-radius: 12px;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 20% 20%, rgba(0, 212, 255, .12), transparent 50%),
    radial-gradient(100% 80% at 80% 80%, rgba(160, 32, 240, .16), transparent 55%),
    #0a0a0c;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
}
.lib-preview-art {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  font-size: 13px;
  font-weight: 600;
  color: #c4c4cc;
}
.lib-preview-art .lib-preview-ico { font-size: 28px; line-height: 1; opacity: .9; }
.lib-preview-art--thumb .lib-preview-ico { display: none; }
.lib-preview-art--thumb .lib-preview-play {
  position: absolute;
  z-index: 2;
  margin-top: 0;
  pointer-events: none;
}
.lib-preview-wave {
  width: 120px;
  height: 28px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 212, 255, .55) 0 3px,
      transparent 3px 7px
    );
  opacity: .55;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.lib-preview-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(6px);
}
.lib-preview-badge--right {
  left: auto;
  right: 8px;
}
.lib-preview-badge--dur {
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.lib-preview-wrap { width: 100%; }
.lib-preview--live {
  display: block;
  padding: 0;
}
.lib-preview-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0a0a0c;
  z-index: 1;
}
.lib-preview--audio .lib-preview-media--audio {
  object-fit: contain;
  padding: 28px 10px 40px;
}
.lib-preview--live .lib-preview-badge { z-index: 2; pointer-events: none; }
.lib-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.lib-kind {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: none;
}
.lib-kind strong { color: var(--text); font-weight: 700; }
.lib-id { color: var(--muted); font-weight: 600; }
.lib-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-model {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #d4d4d8;
}
.lib-model-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  background: rgba(160, 32, 240, .2);
  color: #e9d5ff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}
.lib-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 12px;
  color: var(--muted);
}
.lib-meta b { color: #ffe566; font-weight: 700; }
.lib-prompt {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: #a1a1aa;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 132px;
}
.lib-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: #161616;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.lib-act:hover {
  border-color: var(--ui-hover-border, rgba(168, 85, 247, 0.4));
  background: var(--ui-hover-soft, rgba(168, 85, 247, 0.06));
  box-shadow: var(--ui-hover-glow, 0 0 8px rgba(168, 85, 247, 0.1));
}
.lib-act--primary {
  border: 0;
  background: var(--gradient-brand);
  color: #fff;
}
.lib-act--primary:hover {
  filter: var(--ui-hover-cta-filter, brightness(1.06));
  box-shadow: var(--ui-hover-cta-glow);
  transform: var(--ui-hover-cta-lift, translateY(-1px));
}
.lib-act--more { font-size: 16px; letter-spacing: .08em; }

.lib-more {
  position: relative;
}
.lib-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 70;
  min-width: 180px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: #161616;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.lib-more-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.lib-more-item:hover:not(.lib-more-item--disabled) {
  background: var(--ui-hover-quiet-bg, rgba(168, 85, 247, 0.1));
}
.lib-more-item--disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: .65;
  font-weight: 500;
}
.lib-actions .lib-more {
  display: block;
}
.lib-list + .lib-more {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}
.lib-card-skel {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) auto;
  gap: 18px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #242424;
  background: #111;
}
.lib-card-skel .lib-preview,
.lib-card-skel .lib-body,
.lib-card-skel .lib-actions {
  border-radius: 12px;
  background: #1a1a1e;
  min-height: 100px;
  position: relative;
  overflow: hidden;
}
.lib-card-skel .lib-preview::after,
.lib-card-skel .lib-body::after,
.lib-card-skel .lib-actions::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, .06) 45%, transparent 70%);
  animation: cab-shimmer 1.4s ease-in-out infinite;
}

.sup-field-err {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: #ff6b7a;
}
.cab-cta.is-loading,
.cab-cta.is-loading:hover {
  opacity: .72;
  pointer-events: none;
  cursor: wait;
}

/* ── Support (W.SUP) ────────────────────────────────── */
.sup-crumb {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.sup-crumb-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.sup-intro {
  text-align: center;
  margin: 0 auto 28px;
  max-width: 640px;
}
.sup-intro .cab-h1 { font-size: 28px; }
.sup-intro .cab-lead { margin-bottom: 10px; }
.sup-bot-link {
  color: #b45cff;
  font-weight: 600;
  text-decoration: none;
}
.sup-bot-link:hover { text-decoration: underline; }

.sup-card {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 24px;
  border-radius: 16px;
  border: 1px solid #29292f;
  background: #111113;
}
.sup-col-right {
  border-left: 1px solid rgba(255, 255, 255, .06);
  padding-left: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}
.sup-col-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.sup-step-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.sup-step-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.sup-types {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sup-type {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 20px;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #2a2a30;
  background: #0f0f12;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.sup-type:hover {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.06);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.1);
}
.sup-type.is-on {
  border-color: #a855f7;
  background: linear-gradient(90deg, rgba(168, 85, 247, .1), rgba(168, 85, 247, .03));
}
.sup-type-ico {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(160, 32, 240, .14);
  color: #c084fc;
  font-size: 18px;
}
.sup-type strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.sup-type span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.sup-type-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #3f3f46;
}
.sup-type.is-on .sup-type-check {
  border-color: #a855f7;
  background: #a855f7;
  box-shadow: inset 0 0 0 3px #111;
}
.sup-howto {
  margin-top: auto;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid #29292e;
  background: #151517;
}
.sup-howto strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text);
}
.sup-howto p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.sup-field label.sup-step-title { display: block; }
.sup-textarea-wrap { position: relative; }
.sup-textarea-wrap textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #29292f;
  background: #0b0b0d;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  outline: none;
  box-sizing: border-box;
}
.sup-textarea-wrap textarea:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, .12);
}
.sup-counter {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}
.sup-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 105px;
  padding: 16px;
  border-radius: 10px;
  border: 1.5px dashed #8b3cf6;
  background: rgba(139, 60, 246, .04);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.sup-drop:hover,
.sup-drop.is-drag {
  border-color: #c084fc;
  background: rgba(139, 60, 246, .1);
}
.sup-drop strong { color: var(--text); font-weight: 600; }
.sup-drop small { font-size: 12px; color: #7a7a85; }
.sup-drop input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.sup-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.sup-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #29292f;
  background: #0f0f12;
  font-size: 13px;
}
.sup-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-file-size { color: var(--muted); font-size: 12px; }
.sup-file-rm {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
.sup-tickets { margin-top: 28px; max-width: 980px; margin-inline: auto; }
.sup-tickets .cab-h1 { font-size: 20px; margin-bottom: 12px; }
.sup-ticket-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.sup-ticket {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #242424;
  background: #111;
}
.sup-ticket-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sup-ticket-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(160, 32, 240, .15);
  color: #d8b4fe;
  font-size: 11px;
  font-weight: 700;
}
.sup-ticket-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.sup-ticket-body { min-width: 0; }
.sup-ticket-cat {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.sup-ticket-subject {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.sup-ticket-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: #161616;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.sup-ticket-cta:hover {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.06);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.1);
}

/* Custom select (support topic) */
.cab-select-trigger {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid #29292f;
  background: #0b0b0d;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.cab-select-trigger:focus,
.cab-select-trigger:focus-visible {
  outline: none;
  border-color: var(--ui-focus-border, #8b5cf6);
  box-shadow: var(--ui-focus-glow, 0 0 0 2px rgba(139, 92, 246, .12));
}
.cab-select-menu {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 6px);
  z-index: 30;
  max-height: 240px;
  overflow: auto;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid #29292f;
  background: #121214;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .4);
}
.cab-select-menu[hidden] { display: none !important; }

/* ── Balance shell (W.BAL / W.HIST) ──────────────────── */
.bal-section-title {
  margin: 0 0 14px;
  font-size: 26px;
  font-weight: 700;
}
.bal-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  min-height: 110px;
  padding: 22px 24px;
  margin-bottom: 18px;
  border-radius: 16px;
  border: 1px solid #242424;
  background: linear-gradient(120deg, #141416 0%, #111113 55%, #101018 100%);
}
.bal-summary-label {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--muted);
}
.bal-summary-value {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}
.bal-summary-meta {
  margin: 8px 0 0;
  font-size: 12px;
  color: #888;
}
.bal-summary-stars {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.bal-summary-stars strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 2px;
}
.bal-summary-link {
  color: #b45cff;
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
}
.bal-summary-link:hover { text-decoration: underline; }
.bal-summary .cab-cta { min-width: 220px; }

.bal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}
.bal-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid #2a2a30;
  background: #101012;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}
.bal-tab.is-on {
  color: #fff;
  border-color: rgba(168, 85, 247, .7);
  background: rgba(88, 28, 135, .35);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, .18), 0 0 18px rgba(160, 32, 240, .12);
}

.buy-page-h1 {
  margin: 0 0 18px;
  font-size: 28px;
  font-weight: 700;
}
.buy-pack-section-title {
  margin: 28px 0 14px;
  font-size: 20px;
  font-weight: 700;
}
.buy-packs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.buy-pack {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 16px 16px;
  border-radius: 14px;
  border: 1px solid #2a2a30;
  background: #121214;
  min-height: 100%;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.buy-pack:hover {
  border-color: var(--ui-hover-card-border, rgba(168, 85, 247, 0.4));
  transform: translateY(-1px);
  box-shadow: var(--ui-hover-card-glow, 0 0 8px rgba(168, 85, 247, 0.1));
}
.buy-pack:has(.cab-cta:focus-visible) {
  border-color: var(--ui-focus-border, rgba(168, 85, 247, 0.55));
  box-shadow: var(--ui-focus-glow, 0 0 0 1px rgba(168, 85, 247, 0.16), 0 0 10px rgba(168, 85, 247, 0.1));
}
.buy-pack.is-hot {
  border-color: #a855f7;
  box-shadow: 0 0 0 1px rgba(168, 85, 247, .2), 0 0 24px rgba(160, 32, 240, .12);
}
.buy-pack-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #a855f7;
  background: rgba(168, 85, 247, .12);
  color: #f0d7ff;
  font-size: 11px;
  font-weight: 700;
}
.buy-pack-name {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.buy-pack-credits {
  margin: 4px 0 0;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.05;
  color: #fff;
}
.buy-pack-credits small {
  font-size: 18px;
  font-weight: 600;
  color: #ffe566;
}
.buy-pack-rate {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #f5f5f5;
}
.buy-pack-rate span {
  font-size: 13px;
  font-weight: 400;
  color: #a0a0aa;
}
.buy-pack .cab-cta {
  margin-top: auto;
  min-height: 44px;
  font-size: 13px;
}

.buy-compare {
  margin-top: 18px;
  padding: 22px 24px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: linear-gradient(90deg, #151517, #121214);
}
.buy-compare h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
}
.buy-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.buy-compare-table th,
.buy-compare-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.buy-compare-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.buy-rate-hi { color: #ff8a95; }
.buy-rate-mid { color: #fbbf24; }
.buy-rate-lo { color: #34d399; }

.buy-howto-pop {
  position: relative;
  display: inline-block;
}
.buy-howto-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: min(320px, 80vw);
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #2a2a30;
  background: #141416;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .5);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.buy-howto-panel[hidden] { display: none !important; }
.buy-howto-panel strong { display: block; color: var(--text); margin-bottom: 6px; }

/* History feed */
.hist-feed-title { margin: 0 0 4px; font-size: 24px; font-weight: 700; }
.hist-feed-lead { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.hist-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}
.hist-filters-row .cab-dd { width: 190px; }
.hist-filters-row .cab-dd:nth-child(2) { width: 180px; }
.hist-filters-row .cab-search {
  flex: 1 1 280px;
  max-width: 400px;
  margin: 0;
}
.hist-day {
  margin: 18px 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: none;
}
.hist-tx {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 12px 14px;
  padding-right: 42px;
  margin-bottom: 8px;
  border-radius: 14px;
  border: 1px solid #242424;
  background: #111;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.hist-tx:hover,
.hist-tx.is-open {
  border-color: rgba(160, 32, 240, .35);
  background: #141414;
}
.hist-tx-main { min-width: 0; }
.hist-tx-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1e;
  font-size: 18px;
}
.hist-tx-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.hist-tx-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.hist-tx-gen {
  color: #b45cff;
  font-weight: 600;
  text-decoration: none;
  font-size: 12px;
}
.hist-tx-gen:hover { text-decoration: underline; }
.hist-tx-side {
  text-align: right;
  white-space: nowrap;
}
.hist-tx-amt { font-size: 15px; font-weight: 800; }
.hist-tx-amt.is-minus { color: #ff4d5e; }
.hist-tx-amt.is-plus { color: #20e879; }
.hist-tx-amt.is-zero { color: #9a9aa0; }
.hist-tx-time {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.hist-tx-after {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.hist-tx-menu {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
}
.hist-tx-menu:hover {
  background: var(--ui-hover-quiet-bg, rgba(168, 85, 247, 0.1));
  color: var(--text);
}
.hist-tx-more {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}
.hist-tx-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 180px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: #161616;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.hist-tx-more-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.hist-tx-more-item:hover {
  background: var(--ui-hover-quiet-bg, rgba(168, 85, 247, 0.1));
}

.hist-details {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
.hist-details:not([hidden]) {
  pointer-events: auto;
}
.hist-details-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
}
.hist-details-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 20px;
  border-left: 1px solid rgba(255, 255, 255, .08);
  background: #111113;
  box-shadow: -12px 0 40px rgba(0, 0, 0, .35);
}
.hist-details-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.hist-details-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}
.hist-details-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.hist-details-dl {
  margin: 0 0 16px;
  display: grid;
  gap: 12px;
}
.hist-details-dl > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.hist-details-dl dt {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.hist-details-dl dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.hist-details-desc-row dd {
  font-weight: 500;
  color: var(--muted);
}
.hist-details-gen {
  display: inline-block;
  margin-bottom: 12px;
}
.hist-ledger-search {
  margin-bottom: 16px;
}

.hist-chips-scroll {
  display: none;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 1280px) {
  .buy-packs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cab-page--hist { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 1024px) {
  .lib-card {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .lib-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
  }
  .bal-summary {
    grid-template-columns: 1fr;
  }
  .bal-summary .cab-cta { width: 100%; min-width: 0; }
}
@media (max-width: 768px) {
  .cab-page,
  .cab-page--wide,
  .cab-page--hist,
  .cab-page--support {
    padding: 16px 14px calc(var(--dock) + 24px);
  }
  .cab-head { flex-direction: column; align-items: stretch; }
  .cab-h1 { font-size: 24px; }
  .cab-toolbar { flex-direction: column; align-items: stretch; }
  .cab-toolbar .cab-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .cab-toolbar .cab-chips::-webkit-scrollbar { display: none; }
  .cab-dd { width: 100%; }
  .cab-dd-btn { width: 100%; }
  .lib-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .lib-preview { max-height: none; aspect-ratio: 16 / 10; }
  .lib-prompt { display: none; }
  .lib-actions { flex-wrap: wrap; }

  .sup-intro { text-align: left; margin-bottom: 18px; }
  .sup-intro .cab-h1 { font-size: 26px; }
  .sup-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .sup-col-left,
  .sup-col-right {
    padding: 16px;
    border: 1px solid #29292f;
    border-radius: 14px;
    background: #111113;
  }
  .sup-col-right {
    border-left: 1px solid #29292f;
    padding-left: 16px;
  }
  .sup-type {
    min-height: 56px;
    grid-template-columns: 36px minmax(0, 1fr) 18px;
    padding: 12px;
  }

  .buy-packs {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .buy-pack {
    flex: 0 0 78%;
    scroll-snap-align: center;
  }
  .buy-compare { padding: 16px; }
  .buy-compare-table thead { display: none; }
  .buy-compare-table,
  .buy-compare-table tbody,
  .buy-compare-table tr,
  .buy-compare-table td {
    display: block;
    width: 100%;
  }
  .buy-compare-table tr {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
  }
  .buy-compare-table td {
    padding: 2px 0;
    border: 0;
  }
  .buy-compare-table td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 110px;
    color: var(--muted);
    font-size: 12px;
  }

  .bal-tabs { width: 100%; }
  .bal-tab { flex: 1 1 50%; }
  .bal-summary-stars { display: none; }

  .hist-filters-row .cab-dd,
  .hist-filters-row .cab-dd:nth-child(2),
  .hist-filters-row .cab-search {
    width: 100%;
    max-width: none;
    flex: 1 1 100%;
  }
  .hist-chips-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .hist-filters-row > .cab-dd:first-of-type { display: none; }
  .hist-tx {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    padding-right: 42px;
  }
  .hist-tx-after {
    grid-column: 2 / -2;
    text-align: left;
  }
  .hist-tx-gen { display: none; }
  .hist-details {
    align-items: flex-end;
    justify-content: center;
  }
  .hist-details-panel {
    width: 100%;
    max-height: 85vh;
    border-left: 0;
    border-radius: 16px 16px 0 0;
  }
}
@media (max-width: 420px) {
  .buy-pack { flex-basis: 88%; }
  .lib-act { flex: 1 1 calc(50% - 4px); }
  .lib-card-skel { grid-template-columns: 1fr; }
  .sup-ticket {
    grid-template-columns: 1fr;
  }
  .sup-ticket-cta {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/*
 * Light Theme remaps for cabinet surfaces that still use Dark hex defaults.
 * Prefer semantic tokens (--card / --elev / --input-bg / --border / --text).
 * Dark defaults above stay unchanged so Dark Theme does not shift.
 */
html[data-theme="light"] .lib-card,
html[data-theme="light"] .lib-card-skel,
html[data-theme="light"] .hist-tx,
html[data-theme="light"] .buy-pack,
html[data-theme="light"] .sup-card,
html[data-theme="light"] .sup-ticket,
html[data-theme="light"] .bal-summary,
html[data-theme="light"] .buy-compare,
html[data-theme="light"] .hist-details-panel,
html[data-theme="light"] .account-panel,
html[data-theme="light"] .lib-more-menu,
html[data-theme="light"] .cab-dd-menu,
html[data-theme="light"] .cab-select-menu,
html[data-theme="light"] .buy-howto-panel,
html[data-theme="light"] .lib-delete-dialog-panel,
html[data-theme="light"] .lib-media-viewer-panel,
html[data-theme="light"] .sup-howto,
html[data-theme="light"] .sup-file {
  background: var(--card);
  border-color: var(--border);
}
html[data-theme="light"] .bal-summary {
  background: linear-gradient(120deg, var(--card) 0%, var(--surface-2) 55%, var(--elev) 100%);
}
html[data-theme="light"] .hist-tx:hover,
html[data-theme="light"] .hist-tx.is-open {
  background: var(--hover);
  border-color: var(--border);
}
html[data-theme="light"] .lib-preview,
html[data-theme="light"] .lib-preview--audio-ph,
html[data-theme="light"] .cab-search input,
html[data-theme="light"] .cab-dd-btn,
html[data-theme="light"] .sup-textarea-wrap textarea,
html[data-theme="light"] .cab-select-trigger,
html[data-theme="light"] .sup-type,
html[data-theme="light"] .lib-act,
html[data-theme="light"] .sup-ticket-cta,
html[data-theme="light"] .bal-tab,
html[data-theme="light"] .hist-tx-ico,
html[data-theme="light"] .lib-card-skel .lib-preview,
html[data-theme="light"] .lib-card-skel .lib-body,
html[data-theme="light"] .lib-card-skel .lib-actions,
html[data-theme="light"] .lib-media-viewer-stage {
  background: var(--input-bg);
}
html[data-theme="light"] .lib-preview,
html[data-theme="light"] .lib-preview--audio-ph {
  background:
    radial-gradient(120% 80% at 20% 20%, rgba(0, 168, 212, .08), transparent 50%),
    radial-gradient(100% 80% at 80% 80%, rgba(138, 43, 226, .1), transparent 55%),
    var(--input-bg);
}
html[data-theme="light"] .lib-prompt {
  color: var(--muted);
}
html[data-theme="light"] .lib-preview-art {
  color: var(--muted);
}
html[data-theme="light"] .account-lang-link {
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="light"] .account-lang-link.is-on {
  border-color: rgba(138, 43, 226, .45);
  background: var(--chip-on);
  color: var(--text);
}
html[data-theme="light"] .cab-dd-btn,
html[data-theme="light"] .cab-search input[type="search"],
html[data-theme="light"] .cab-select-trigger,
html[data-theme="light"] .sup-textarea-wrap textarea,
html[data-theme="light"] .sup-type,
html[data-theme="light"] .lib-act,
html[data-theme="light"] .sup-ticket-cta,
html[data-theme="light"] .bal-tab,
html[data-theme="light"] .buy-pack,
html[data-theme="light"] .lib-card,
html[data-theme="light"] .hist-tx {
  border-color: var(--border);
}
html[data-theme="light"] .bal-tab.is-on {
  color: var(--text);
  border-color: rgba(138, 43, 226, .55);
  background: var(--chip-on);
  box-shadow: 0 0 0 1px rgba(138, 43, 226, .12);
}
html[data-theme="light"] .cab-page--hist .lib-act--primary {
  color: var(--text);
}
html[data-theme="light"] .cab-page--hist .cab-empty--library,
html[data-theme="light"] .cab-page--hist .cab-empty--filter {
  border-color: var(--border);
  background: var(--surface-2);
}
html[data-theme="light"] .cab-page--hist {
  --cab-border: var(--border);
  --cab-surface: var(--elev);
  --cab-card: var(--card);
  --cab-input: var(--input-bg);
  --cab-accent-soft: var(--chip-on);
  --cab-accent-border: var(--ui-focus-border, rgba(138, 43, 226, 0.45));
}
html[data-theme="light"] .cab-page--hist .cab-chip.is-on {
  color: var(--text);
  background: var(--chip-on);
  border-color: var(--cab-accent-border);
}
html[data-theme="light"] .cab-page--hist .cab-chip.is-on span {
  background: rgba(138, 43, 226, 0.16);
  color: var(--text);
}
html[data-theme="light"] .lib-preview-play {
  background: rgba(36, 24, 56, 0.58);
  border-color: rgba(138, 43, 226, 0.28);
  color: #fff;
}
html[data-theme="light"] .cab-page--hist .lib-media-viewer-panel {
  background: var(--card);
  border-color: var(--border);
}
html[data-theme="light"] .cab-page--hist .lib-media-viewer-stage {
  background: var(--input-bg);
}
html[data-theme="light"] .cab-page--hist .lib-media-viewer-head {
  border-bottom-color: var(--border);
}
html[data-theme="light"] .sup-type.is-on .sup-type-check {
  box-shadow: inset 0 0 0 3px var(--card);
}
html[data-theme="light"] .sup-drop small {
  color: var(--muted);
}
html[data-theme="light"] .bal-summary-meta {
  color: var(--muted);
}
html[data-theme="light"] .hist-tx-more-menu {
  background: var(--card);
  border-color: var(--border);
}

/* Buy / Support scoped cabinet tokens (mirror History light remap) */
html[data-theme="light"] .cab-page--buy,
html[data-theme="light"] .cab-page--support {
  --cab-border: var(--border);
  --cab-surface: var(--elev);
  --cab-card: var(--card);
  --cab-input: var(--input-bg);
  --cab-accent-soft: var(--chip-on);
  --cab-accent-border: var(--ui-focus-border, rgba(138, 43, 226, 0.45));
  color-scheme: light;
}

/* Mobile Support: columns carry the surface (card itself is transparent) */
html[data-theme="light"] .sup-col-left,
html[data-theme="light"] .sup-col-right {
  background: var(--card);
  border-color: var(--border);
}
html[data-theme="light"] .sup-col-right {
  border-left-color: var(--border);
}

html[data-theme="light"] .sup-drop {
  background: var(--surface-2);
  border-color: rgba(138, 43, 226, 0.4);
  color: var(--muted);
}
html[data-theme="light"] .sup-drop:hover,
html[data-theme="light"] .sup-drop.is-drag {
  background: var(--chip-on);
  border-color: rgba(138, 43, 226, 0.55);
}
html[data-theme="light"] .sup-drop strong {
  color: var(--text);
}
html[data-theme="light"] .sup-counter {
  color: var(--muted);
}
html[data-theme="light"] .sup-type-check {
  border-color: var(--border);
}
html[data-theme="light"] .sup-type.is-on {
  border-color: var(--cab-accent-border, rgba(138, 43, 226, 0.45));
  background: var(--cab-accent-soft, var(--chip-on));
}
html[data-theme="light"] .sup-howto {
  background: var(--surface-2);
  border-color: var(--border);
}

/* Balance pack text: dark defaults are near-white; remap for light cards */
html[data-theme="light"] .buy-pack-credits {
  color: var(--text);
}
html[data-theme="light"] .buy-pack-credits small {
  color: var(--gold);
}
html[data-theme="light"] .buy-pack-rate {
  color: var(--text);
}
html[data-theme="light"] .buy-pack-rate span {
  color: var(--muted);
}
html[data-theme="light"] .buy-pack-name {
  color: var(--text);
}
html[data-theme="light"] .buy-pack-badge {
  background: var(--chip-on);
  border-color: rgba(138, 43, 226, 0.45);
  color: var(--text);
}

html[data-theme="light"] .cab-page--buy .bal-summary,
html[data-theme="light"] .cab-page--hist .bal-summary {
  background: linear-gradient(120deg, var(--card) 0%, var(--surface-2) 55%, var(--elev) 100%);
  border-color: var(--border);
}

html[data-theme="light"] .buy-compare {
  background: var(--card);
  border-color: var(--border);
}
html[data-theme="light"] .buy-compare-table th,
html[data-theme="light"] .buy-compare-table td {
  border-bottom-color: var(--border);
}
html[data-theme="light"] .buy-compare-table tr {
  border-bottom-color: var(--border);
}
html[data-theme="light"] .buy-howto-panel {
  color: var(--muted);
}

/* Status / shimmer / support success / compare */
.lib-card--pending { opacity: .92; }
.lib-card--failed { border-color: rgba(255, 77, 94, .35); }
.lib-status {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.lib-status--run {
  background: rgba(0, 212, 255, .12);
  color: #7dd3fc;
}
.lib-status--fail {
  background: rgba(255, 77, 94, .14);
  color: #ff8a95;
}
.lib-status--ok {
  background: rgba(32, 232, 121, .12);
  color: #7dffb3;
}
.lib-kind .lib-id {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  opacity: .75;
}
.lib-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
}
.lib-more-item--danger,
.lib-act--danger {
  color: #ff8a95 !important;
}
.lib-more-item--danger:hover,
.lib-more-item--danger:focus-visible,
.lib-act--danger:hover,
.lib-act--danger:focus-visible {
  color: #ffb4bb !important;
  background: rgba(255, 77, 94, .12) !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 77, 94, .35);
}
.cab-empty--library,
.cab-empty--filter {
  padding: 28px 16px;
  min-height: 0;
}
.cab-empty-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}
.lib-preview--audio-ph {
  background:
    radial-gradient(120% 80% at 20% 20%, rgba(0, 212, 255, .10), transparent 50%),
    #0a0a0c;
}
.lib-delete-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lib-delete-dialog[hidden] { display: none !important; }
.lib-delete-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .62);
}
.lib-delete-dialog-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 22px 20px;
  border-radius: 16px;
  border: 1px solid #2a2a30;
  background: #141416;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .45);
}
.lib-delete-dialog-panel h2 {
  margin: 0 0 10px;
  font-size: 18px;
}
.lib-delete-dialog-panel p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.lib-delete-dialog-hint {
  margin-bottom: 18px !important;
  font-size: 13px !important;
}
.lib-delete-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.lib-delete-confirm {
  appearance: none;
  border: 1px solid rgba(255, 77, 94, .45);
  background: rgba(255, 77, 94, .16);
  color: #ffb4bb;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}
.lib-delete-confirm:hover,
.lib-delete-confirm:focus-visible {
  background: rgba(255, 77, 94, .24);
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 77, 94, .35);
}
.lib-preview--open {
  display: flex;
  width: 100%;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.lib-preview-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  border: 1px solid rgba(255, 255, 255, .22);
  font-size: 16px;
  line-height: 1;
}
.lib-media-viewer {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lib-media-viewer[hidden] { display: none !important; }
.lib-media-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .72);
}
.lib-media-viewer-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid #2a2a30;
  background: #101012;
  box-shadow: 0 22px 56px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.lib-media-viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
}
.lib-media-viewer-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.3;
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-media-viewer-meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted, #9a9aa3);
}
.lib-media-viewer-x {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
}
.lib-media-viewer-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px 12px;
  background: #0a0a0c;
}
.lib-media-viewer-stage img,
.lib-media-viewer-stage video {
  display: block;
  max-width: 100%;
  max-height: min(70vh, 720px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}
.lib-media-viewer-stage audio {
  width: min(100%, 520px);
}
.lib-media-viewer-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 10px 16px 14px;
  border-top: 1px solid #222228;
}
@media (max-width: 640px) {
  .lib-media-viewer-panel { max-height: 96vh; }
  .lib-media-viewer-stage img,
  .lib-media-viewer-stage video { max-height: min(58vh, 520px); }
}
.lib-text-viewer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lib-text-viewer[hidden] { display: none !important; }
.lib-text-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .62);
}
.lib-text-viewer-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: #121214;
  color: #f2f2f4;
  padding: 18px 18px 14px;
}
.lib-text-viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.lib-text-viewer-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
}
.lib-text-viewer-meta {
  margin: 4px 0 0;
  opacity: .72;
  font-size: .9rem;
}
.lib-text-viewer-body {
  display: grid;
  gap: 14px;
}
.lib-text-block h3 {
  margin: 0 0 8px;
  font-size: .92rem;
  opacity: .8;
  font-weight: 600;
}
.lib-text-pre {
  margin: 0 0 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  line-height: 1.45;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}
.lib-text-variant {
  margin-bottom: 12px;
}
.lib-text-variant-label {
  margin-bottom: 6px;
  font-size: .85rem;
  opacity: .75;
}
.lib-text-viewer-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.lib-card--text .lib-preview--text {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.lib-more-load {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}
.lib-preview.is-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.08) 45%, transparent 70%);
  animation: cab-shimmer 1.4s ease-in-out infinite;
}
@keyframes cab-shimmer {
  0% { transform: translateX(-40%); }
  100% { transform: translateX(40%); }
}
.sup-success {
  max-width: 640px;
  margin: 0 auto 24px;
  padding: 28px 24px;
  text-align: center;
  border-radius: 16px;
  border: 1px solid rgba(32, 232, 121, .28);
  background: rgba(32, 232, 121, .08);
}
.sup-success-ico {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(32, 232, 121, .2);
  color: #20e879;
  font-size: 22px;
  font-weight: 800;
}
.buy-compare-details { border: 0; }
.buy-compare-summary {
  list-style: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
}
.buy-compare-summary::-webkit-details-marker { display: none; }
.cab-empty-ico {
  font-size: 28px;
  margin-bottom: 10px;
  opacity: .85;
}
.sup-drop-mobile { display: none; }
@media (max-width: 768px) {
  .buy-compare-details:not([open]) .buy-compare-table { display: none; }
  .sup-drop-desktop { display: none; }
  .sup-drop-mobile { display: inline; }
}

.cab-page--account { max-width: 1100px; }
.account-panel {
  margin: 0 0 20px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
}
.account-panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--text);
}
.account-panel--auth-conflict {
  border-color: rgba(220, 100, 60, 0.45);
  background: color-mix(in srgb, var(--card) 88%, rgba(220, 100, 60, 0.18));
}
.account-auth-conflict-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.account-auth-conflict-head h2 {
  margin: 0;
  flex: 1;
}
.account-auth-conflict-dismiss {
  flex: 0 0 auto;
  min-width: 36px;
  padding: 4px 10px;
  font-size: 18px;
  line-height: 1.2;
}
.account-auth-conflict-body {
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}
.account-auth-conflict-body p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  font-weight: 500;
}
.account-auth-conflict-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.account-dl {
  margin: 0;
  display: grid;
  gap: 10px;
}
.account-dl div { display: grid; gap: 2px; }
.account-dl dt { font-size: 12px; color: var(--muted); }
.account-dl dd { margin: 0; font-size: 14px; font-weight: 600; }
.account-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.account-lang { display: flex; gap: 8px; }
.account-lang-link {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}
.account-lang-link.is-on {
  border-color: rgba(168,85,247,.55);
  background: var(--chip-on);
  color: var(--text);
}
.account-theme-btn,
.account-panel .cab-btn-secondary {
  margin-right: 8px;
  margin-bottom: 8px;
}
.lib-status--ok {
  background: rgba(52,211,153,.12);
  color: #6ee7b7;
}
.lib-more-item--disabled {
  opacity: .55;
  cursor: not-allowed;
}
@media (max-width: 768px) {
  .lib-act--desktop { display: none !important; }
  .lib-more-item--mobile { display: block; }
}
@media (min-width: 769px) {
  .lib-more-item--mobile { display: none !important; }
}

/* =============================================================================
   History / Generation Viewer visual polish (Create V2 interaction language)
   Scoped under .cab-page--hist — does not redesign Home / Support / Buy.
   ============================================================================= */
.cab-page--hist {
  --cab-card-radius: 14px;
  --cab-control-h: 36px;
  --cab-gap: 12px;
  --cab-accent: #a855f7;
  --cab-accent-soft: rgba(168, 85, 247, 0.12);
  --cab-accent-border: var(--ui-focus-border, rgba(168, 85, 247, 0.55));
  --cab-surface: #121214;
  --cab-card: #141416;
  --cab-input: #0f0f12;
  --cab-border: rgba(255, 255, 255, 0.1);
  max-width: 1440px;
}

.cab-page--hist .cab-toolbar {
  gap: 10px 14px;
  align-items: center;
}
.cab-page--hist .cab-toolbar-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.cab-page--hist .cab-chips--media .cab-chip {
  height: var(--cab-control-h);
}
.cab-page--hist .cab-chips--status {
  flex: 0 0 auto;
  gap: 6px;
}
.cab-page--hist .cab-chips--status .cab-chip {
  height: var(--cab-control-h);
  font-weight: 600;
}
.cab-page--hist .lib-fail-msg {
  margin: 6px 0 0;
  color: #f87171;
  font-size: 0.92rem;
  line-height: 1.3;
}
.cab-page--hist .lib-meta-duration {
  white-space: nowrap;
}
.cab-page--hist .cab-chip:hover:not(.is-on) {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.06);
  box-shadow: var(--cab-glow-hover);
}
.cab-page--hist .cab-chip.is-on {
  border-color: var(--cab-accent-border);
  background: var(--cab-accent-soft);
  color: var(--text);
  box-shadow: var(--cab-glow-focus);
}
.cab-page--hist .cab-chip.is-on span {
  background: rgba(160, 32, 240, .28);
  color: var(--text);
}
.cab-page--hist .cab-dd-btn {
  height: var(--cab-control-h);
  min-width: 140px;
  border-color: var(--cab-border);
  background: var(--cab-input);
  border-radius: 10px;
}
.cab-page--hist .cab-dd-btn:hover {
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: var(--cab-glow-hover);
}
.cab-page--hist .cab-dd-btn:focus-visible {
  outline: none;
  border-color: var(--cab-accent-border);
  box-shadow: var(--cab-glow-focus);
}
.cab-page--hist .cab-dd-menu {
  border-color: var(--cab-border);
  background: var(--cab-surface);
  border-radius: 12px;
}
.cab-page--hist .cab-dd-opt:hover {
  background: rgba(168, 85, 247, 0.08);
}
.cab-page--hist .cab-dd-opt:focus-visible {
  outline: none;
  background: rgba(168, 85, 247, 0.12);
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.35), var(--cab-glow-focus);
}
.cab-page--hist .cab-search input[type="search"] {
  border-color: var(--cab-border);
  background: var(--cab-input);
}
.cab-page--hist .cab-search input[type="search"]:focus {
  border-color: var(--cab-accent-border);
  box-shadow: var(--cab-glow-focus);
}
.cab-page--hist .cab-btn-reset-filters {
  height: var(--cab-control-h);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border-color: var(--cab-border);
  background: var(--cab-input);
  color: var(--muted, #9aa0a6);
}
.cab-page--hist .cab-btn-reset-filters:hover,
.cab-page--hist .cab-btn-reset-filters:focus-visible {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.06);
  color: var(--text, #fff);
  box-shadow: var(--cab-glow-hover);
  outline: none;
}
.cab-page--hist .cab-btn-reset-filters:focus-visible {
  border-color: var(--cab-accent-border);
  box-shadow: var(--cab-glow-focus);
}

.cab-page--hist .lib-list { gap: var(--cab-gap); }
.cab-page--hist .lib-card {
  grid-template-columns: 240px minmax(0, 1fr) minmax(140px, 188px);
  gap: 16px;
  padding: 14px;
  border-radius: var(--cab-card-radius);
  border: 1px solid var(--cab-border);
  background: var(--cab-card);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.cab-page--hist .lib-card:hover {
  border-color: rgba(168, 85, 247, 0.28);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.06);
  /* No transform: translateY creates a stacking context that can paint
     a hovered lower card above an open ••• menu on an upper card. */
}
.cab-page--hist .lib-card.lib-card--menu-open,
.cab-page--hist .lib-card.lib-card--menu-open:hover {
  z-index: 60;
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.1);
}
.cab-page--hist .lib-card--pending { opacity: 0.95; }
.cab-page--hist .lib-card--failed {
  border-color: rgba(255, 77, 94, 0.28);
  background: linear-gradient(180deg, rgba(255, 77, 94, 0.04), var(--cab-card) 40%);
}
.cab-page--hist .lib-card--unavailable {
  border-color: rgba(251, 191, 36, 0.28);
}

.cab-page--hist .lib-preview {
  aspect-ratio: 4 / 3;
  max-height: 180px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.cab-page--hist .lib-preview--open:focus-visible .lib-preview-play {
  background: rgba(168, 85, 247, 0.55);
  border-color: rgba(168, 85, 247, 0.7);
}
.cab-page--hist .lib-preview--open:active .lib-preview-play {
  background: rgba(168, 85, 247, 0.45);
  border-color: rgba(168, 85, 247, 0.65);
}
/* Touch devices keep sticky :hover — only apply purple hover on fine pointers. */
@media (hover: hover) and (pointer: fine) {
  .cab-page--hist .lib-preview--open:hover .lib-preview-play {
    background: rgba(168, 85, 247, 0.55);
    border-color: rgba(168, 85, 247, 0.7);
  }
}
.cab-page--hist .lib-preview--open:focus-visible {
  outline: none;
  box-shadow: var(--cab-glow-focus);
}
.cab-page--hist .lib-preview-hint {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted, #9aa0a6);
  text-align: center;
  padding: 0 10px;
  line-height: 1.35;
}
.cab-page--hist .lib-preview.is-unavailable-preview {
  background:
    radial-gradient(120% 80% at 50% 30%, rgba(251, 191, 36, 0.1), transparent 55%),
    #0a0a0c;
}

.cab-page--hist .lib-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cab-page--hist .lib-meta--row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
  margin: 0;
  font-size: 12px;
  color: var(--muted, #9aa0a6);
  line-height: 1.4;
}
.cab-page--hist .lib-kind-label {
  font-weight: 600;
  color: var(--text, #e4e4e7);
}
.cab-page--hist .lib-meta-dot {
  opacity: 0.55;
  margin: 0 2px;
}
.cab-page--hist .lib-id {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.55;
  color: var(--muted, #9aa0a6);
}
.cab-page--hist .lib-meta-price { color: #ffe566; font-weight: 600; }
.cab-page--hist .lib-prompt {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  -webkit-line-clamp: 2;
}

.cab-page--hist .lib-status {
  margin-left: 0;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.cab-page--hist .lib-status--ok {
  background: rgba(52, 211, 153, 0.1);
  color: #86efac;
}
.cab-page--hist .lib-status--run {
  background: rgba(0, 212, 255, 0.1);
  color: #7dd3fc;
}
.cab-page--hist .lib-status--queued {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}
.cab-page--hist .lib-status--fail {
  background: rgba(255, 77, 94, 0.12);
  color: #fda4af;
}
.cab-page--hist .lib-status--warn {
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
}

.cab-page--hist .lib-actions {
  gap: 8px;
  min-width: 0;
}
.cab-page--hist .lib-act {
  height: var(--cab-control-h);
  border-radius: 10px;
  border: 1px solid var(--cab-border);
  background: var(--cab-input);
  font-size: 12px;
  font-weight: 600;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.cab-page--hist .lib-act:hover {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.08);
  box-shadow: var(--cab-glow-hover);
}
.cab-page--hist .lib-act:focus-visible {
  outline: none;
  border-color: var(--cab-accent-border);
  box-shadow: var(--cab-glow-focus);
}
.cab-page--hist .lib-act--primary {
  border: 1px solid var(--cab-accent-border);
  background: var(--cab-accent-soft);
  color: #fff;
  box-shadow: none;
  filter: none;
}
.cab-page--hist .lib-act--primary:hover {
  background: rgba(168, 85, 247, 0.18);
  filter: none;
  box-shadow: var(--cab-glow-hover);
}
.cab-page--hist .lib-act--more {
  letter-spacing: 0.12em;
}
.cab-page--hist .lib-more-menu {
  border-color: var(--cab-border);
  background: var(--cab-surface);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  min-width: 200px;
  max-width: min(280px, 92vw);
}
.cab-page--hist .lib-more-item:hover:not(.lib-more-item--disabled) {
  background: rgba(168, 85, 247, 0.1);
}
.cab-page--hist .lib-more-item:focus-visible {
  outline: none;
  box-shadow: var(--cab-glow-focus);
}
.cab-page--hist .lib-more-item--danger {
  color: #fda4af !important;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 4px;
  border-radius: 0 0 8px 8px;
}
.cab-page--hist .lib-more-item--danger:hover,
.cab-page--hist .lib-more-item--danger:focus-visible {
  background: rgba(255, 77, 94, 0.12) !important;
  color: #fecdd3 !important;
}

.cab-page--hist .cab-empty--library,
.cab-page--hist .cab-empty--filter {
  padding: 28px 18px;
  max-width: 420px;
  margin: 24px auto;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
}
.cab-page--hist .cab-empty-title {
  font-size: 17px;
  font-weight: 650;
  color: var(--text, #fff);
}
.cab-page--hist .cab-empty p {
  font-size: 13px;
  line-height: 1.45;
}

.cab-page--hist .lib-media-viewer {
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}
.cab-page--hist .lib-media-viewer-panel {
  width: min(960px, 100%);
  max-height: min(92vh, 920px);
  border-radius: 16px;
  border: 1px solid var(--cab-border);
  background: #101012;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(168, 85, 247, 0.06);
}
.cab-page--hist .lib-media-viewer-head {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.cab-page--hist .lib-media-viewer-title {
  font-size: 15px;
  font-weight: 650;
  max-width: min(70vw, 720px);
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cab-page--hist .lib-media-viewer-meta {
  font-size: 12px;
  color: var(--muted, #9aa0a6);
}
.cab-page--hist .lib-media-viewer-x {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--cab-border);
  background: var(--cab-input);
  color: var(--text, #fff);
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.cab-page--hist .lib-media-viewer-x:hover {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.08);
  box-shadow: var(--cab-glow-hover);
}
.cab-page--hist .lib-media-viewer-x:focus-visible {
  outline: none;
  border-color: var(--cab-accent-border);
  box-shadow: var(--cab-glow-focus);
}
.cab-page--hist .lib-media-viewer-stage {
  padding: 12px 16px;
  background: #0a0a0c;
  min-height: 160px;
}
.cab-page--hist .lib-media-viewer-stage img,
.cab-page--hist .lib-media-viewer-stage video {
  max-width: 100%;
  max-height: min(68vh, 700px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
}
.cab-page--hist .lib-media-viewer-stage.is-audio {
  flex-direction: column;
  gap: 16px;
}
.cab-page--hist .lib-media-viewer-audio {
  width: min(100%, 520px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.cab-page--hist .lib-media-viewer-audio-art {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(120% 80% at 20% 20%, rgba(0, 212, 255, 0.12), transparent 50%),
    radial-gradient(100% 80% at 80% 80%, rgba(168, 85, 247, 0.16), transparent 55%),
    #0c0c10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.cab-page--hist .lib-media-viewer-audio-ico {
  font-size: 28px;
  opacity: 0.85;
}
.cab-page--hist .lib-media-viewer-stage audio {
  width: min(100%, 520px);
}
.cab-page--hist .lib-media-viewer-msg {
  font-size: 13px;
  color: var(--muted, #9aa0a6);
  text-align: center;
  padding: 24px 16px;
}
.cab-page--hist .lib-media-viewer-msg.is-error {
  color: #fda4af;
}
.cab-page--hist .lib-media-viewer-foot {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 12px 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
}
.cab-page--hist .lib-media-viewer-foot .lib-act {
  min-width: 0;
  padding: 0 14px;
}

@media (max-width: 1024px) {
  .cab-page--hist .lib-card {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .cab-page--hist .lib-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .cab-page--hist .cab-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .cab-page--hist .cab-toolbar-secondary {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
  .cab-page--hist .cab-chips--media {
    flex-wrap: wrap;
    overflow-x: visible;
    width: 100%;
    max-width: 100%;
  }
}
@media (max-width: 768px) {
  .cab-page--hist .lib-card {
    grid-template-columns: 1fr;
  }
  .cab-page--hist .lib-preview {
    max-height: none;
    aspect-ratio: 16 / 10;
  }
  .cab-page--hist .lib-media-viewer {
    padding: 0;
    align-items: stretch;
  }
  .cab-page--hist .lib-media-viewer-panel {
    width: 100%;
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
    border: 0;
  }
  .cab-page--hist .lib-media-viewer-stage img,
  .cab-page--hist .lib-media-viewer-stage video {
    max-height: min(52vh, 480px);
  }
  .cab-page--hist .lib-media-viewer-foot {
    position: sticky;
    bottom: 0;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
  .cab-page--hist .cab-toolbar-secondary .cab-dd {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }
  .cab-page--hist .cab-toolbar-secondary .cab-dd-btn {
    width: 100%;
    min-width: 0;
  }
  /* Prefer wrap over clipped horizontal scroll for kind filters (All/Images/Video/Audio/Text). */
  .cab-page--hist .cab-toolbar .cab-chips--media {
    flex-wrap: wrap;
    overflow-x: visible;
    row-gap: 8px;
  }
}

/* =============================================================================
   Account / Balance / Support visual consistency (Create V2 interaction language)
   Scoped under .cab-page--account / --buy / --support — no theme-magicbox edits.
   ============================================================================= */
.cab-page--account,
.cab-page--buy,
.cab-page--support {
  --cab-card-radius: 14px;
  --cab-control-h: 36px;
  --cab-gap: 12px;
  --cab-accent: #a855f7;
  --cab-accent-soft: rgba(168, 85, 247, 0.12);
  --cab-accent-border: var(--ui-focus-border, rgba(168, 85, 247, 0.55));
  --cab-surface: #121214;
  --cab-card: #141416;
  --cab-input: #0f0f12;
  --cab-border: rgba(255, 255, 255, 0.1);
}

.cab-page--account { max-width: 1080px; }
.cab-page--buy { max-width: 1280px; }
.cab-page--support { max-width: 1180px; }

.cab-page--account .cab-h1,
.cab-page--buy .cab-h1,
.cab-page--support .sup-intro .cab-h1 {
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.cab-page--support .sup-intro .cab-h1 { font-size: clamp(22px, 2.6vw, 28px); }
.cab-page--support .sup-intro { margin-bottom: 20px; }

.cab-page--account .account-panel {
  margin: 0 0 16px;
  padding: 16px 18px;
  border: 1px solid var(--cab-border);
  border-radius: var(--cab-card-radius);
  background: var(--cab-card);
}
.cab-page--account .account-panel h2 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.cab-page--account .account-dl dt {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.cab-page--account .account-dl dd {
  font-size: 14px;
  font-weight: 600;
}
.cab-page--account .account-identity-tg {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.cab-page--account .account-identity-tg-label {
  font-weight: 600;
}
.cab-page--account .account-identity-tg-meta {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.65;
}
.cab-page--account .account-settings-label {
  font-size: 13px;
  color: var(--muted);
}
.cab-page--account .account-lang-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--cab-control-h);
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--cab-border);
  background: var(--cab-input);
  font-size: 12px;
  font-weight: 600;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.cab-page--account .account-lang-link:hover {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.06);
  box-shadow: var(--cab-glow-hover);
}
.cab-page--account .account-lang-link.is-on {
  border-color: var(--cab-accent-border);
  background: var(--cab-accent-soft);
  box-shadow: var(--cab-glow-focus);
}
.cab-page--account .account-lang-link:focus-visible,
.cab-page--account .account-theme-btn:focus-visible,
.cab-page--account .cab-btn-secondary:focus-visible {
  outline: none;
  border-color: var(--cab-accent-border);
  box-shadow: var(--cab-glow-focus);
}
.cab-page--account .account-theme-btn,
.cab-page--account .cab-btn-secondary {
  height: var(--cab-control-h);
  min-height: var(--cab-control-h);
}
.cab-page--account .account-panel--actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cab-page--account .account-logout {
  color: var(--muted);
  border-color: var(--cab-border);
}
.cab-page--account .account-logout:hover {
  color: #fda4af;
  border-color: rgba(255, 77, 94, 0.35);
  background: rgba(255, 77, 94, 0.08);
  box-shadow: none;
}
.cab-page--account .account-logout:focus-visible {
  color: #fda4af;
  border-color: var(--ui-focus-danger-border, rgba(255, 77, 94, 0.35));
  background: var(--ui-focus-danger-bg, rgba(255, 77, 94, 0.08));
  box-shadow: var(--ui-focus-danger-glow, 0 0 0 2px rgba(255, 77, 94, 0.35));
  outline: none;
}

/* Balance / Buy */
.cab-page--buy .bal-summary,
.cab-page--hist .bal-summary {
  border-color: var(--cab-border, rgba(255, 255, 255, 0.1));
  background: linear-gradient(120deg, #141416 0%, #121218 55%, #101016 100%);
  border-radius: 16px;
}
.cab-page--buy .bal-summary-value {
  font-size: clamp(26px, 3vw, 32px);
  font-weight: 700;
}
.cab-page--buy .bal-tab:hover,
.cab-page--hist .bal-tab:hover {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.06);
  color: var(--text);
  box-shadow: var(--cab-glow-hover, 0 0 8px rgba(168, 85, 247, 0.1));
}
.cab-page--buy .bal-tab:focus-visible,
.cab-page--hist .bal-tab:focus-visible {
  outline: none;
  border-color: var(--cab-accent-border, rgba(168, 85, 247, 0.55));
  box-shadow: var(--cab-glow-focus, 0 0 0 1px rgba(168, 85, 247, 0.16), 0 0 10px rgba(168, 85, 247, 0.1));
}
.cab-page--buy .buy-page-h1 {
  font-size: clamp(22px, 2.6vw, 26px);
  font-weight: 700;
  margin-bottom: 10px;
}
.cab-page--buy .buy-packs {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.cab-page--buy .buy-pack {
  border-color: var(--cab-border);
  background: var(--cab-card);
  border-radius: var(--cab-card-radius);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.cab-page--buy .buy-pack:hover {
  border-color: rgba(168, 85, 247, 0.4);
  transform: translateY(-1px);
  box-shadow: var(--cab-glow-hover);
}
.cab-page--buy .buy-pack.is-hot {
  border-color: var(--cab-accent-border);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.14), var(--cab-glow-hover);
}
.cab-page--buy .buy-pack .cab-cta {
  margin-top: auto;
}
.cab-page--buy .cab-dd-opt:hover,
.cab-page--support .cab-dd-opt:hover {
  background: rgba(168, 85, 247, 0.1);
}
.cab-page--buy .cab-dd-opt:focus-visible,
.cab-page--support .cab-dd-opt:focus-visible {
  outline: none;
  background: rgba(168, 85, 247, 0.14);
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.35), var(--cab-glow-focus, var(--ui-focus-glow));
}

/* Support */
.cab-page--support .sup-card {
  border-color: var(--cab-border);
  background: var(--cab-card);
  border-radius: 16px;
  max-width: 980px;
}
.cab-page--support .sup-type {
  border-color: var(--cab-border);
  background: var(--cab-input);
  min-height: 64px;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.cab-page--support .sup-type:hover {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.06);
  box-shadow: var(--cab-glow-hover);
}
.cab-page--support .sup-type.is-on {
  border-color: var(--cab-accent-border);
  background: var(--cab-accent-soft);
}
.cab-page--support .sup-type:focus-visible {
  outline: none;
  border-color: var(--cab-accent-border);
  box-shadow: var(--cab-glow-focus);
}
.cab-page--support .sup-step-hint {
  font-size: 12px;
  line-height: 1.4;
}
.cab-page--support textarea,
.cab-page--support .sup-textarea-wrap textarea,
.cab-page--support input[type="text"],
.cab-page--support .cab-dd-btn {
  border-color: var(--cab-border);
  background: var(--cab-input);
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cab-page--support textarea:hover,
.cab-page--support .sup-textarea-wrap textarea:hover,
.cab-page--support input[type="text"]:hover,
.cab-page--support .cab-dd-btn:hover {
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow: var(--cab-glow-hover);
}
.cab-page--support textarea:focus,
.cab-page--support textarea:focus-visible,
.cab-page--support .sup-textarea-wrap textarea:focus,
.cab-page--support .sup-textarea-wrap textarea:focus-visible,
.cab-page--support input[type="text"]:focus,
.cab-page--support input[type="text"]:focus-visible,
.cab-page--support .cab-dd-btn:focus-visible {
  outline: none;
  border-color: var(--cab-accent-border);
  box-shadow: var(--cab-glow-focus);
}
.cab-page--support .sup-textarea-wrap textarea {
  min-height: 140px;
  max-height: 320px;
}
.cab-page--support .sup-ticket-cta:hover {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.06);
}
.cab-page--support .sup-success {
  border-color: rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.08);
}

@media (max-width: 1024px) {
  .cab-page--buy .buy-packs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 768px) {
  .cab-page--account,
  .cab-page--buy,
  .cab-page--support {
    padding-left: 14px;
    padding-right: 14px;
  }
  .cab-page--buy .buy-packs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cab-page--buy .bal-summary {
    grid-template-columns: 1fr;
  }
  .cab-page--buy .bal-summary .cab-cta {
    width: 100%;
    min-width: 0;
  }
}
@media (max-width: 419px) {
  .cab-page--buy .buy-packs {
    grid-template-columns: 1fr;
  }
  .cab-page--account .account-settings-row {
    flex-direction: column;
    align-items: stretch;
  }
}


