:root {
  --bg: #FFFFFF;
  --surface: #FDFDFC;
  --surface-soft: rgba(0, 0, 0, 0.03);
  --text: #171717;
  --text-soft: #404040;
  --muted: #737373;
  --muted-light: #A3A3A3;
  --placeholder: #888888;
  --line: rgba(0, 0, 0, 0.06);
  --line-strong: rgba(0, 0, 0, 0.10);
  --line-hover: rgba(0, 0, 0, 0.16);
  --primary: #000000;
  --primary-hover: rgba(0, 0, 0, 0.80);
  --primary-bg: #000000;
  --primary-hover-bg: rgba(0, 0, 0, 0.80);
  --primary-soft: rgba(0, 0, 0, 0.08);
  --primary-border: rgba(0, 0, 0, 0.16);
  --primary-inverse: #FFFFFF;
  --success: #166534;
  --success-soft: rgba(22, 101, 52, 0.08);
  --success-border: rgba(22, 101, 52, 0.12);
  --warning: #B54708;
  --warning-soft: rgba(181, 71, 8, 0.08);
  --warning-border: rgba(181, 71, 8, 0.12);
  --danger: #E53E3E;
  --danger-soft: rgba(229, 62, 62, 0.08);
  --danger-border: rgba(229, 62, 62, 0.14);
  --shadow: none;
  --shadow-soft: none;
  --shadow-lift: none;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --radius-full: 999px;
  --shell-gutter: 24px;
  --shell-max: 1152px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
  --ring: 0 0 0 3px rgba(0, 0, 0, 0.08);
  --font-sans: "Geist Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: -0.01em;
  text-rendering: optimizeLegibility;
}

body.has-dialog,
body.is-generating {
  overflow: hidden;
}

a {
  color: var(--text);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: inherit;
}

button {
  border: 0;
  background: none;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.hidden {
  display: none !important;
}

/* Global image loading */
img[data-image-loading],
img.is-image-loaded {
  transition: opacity 0.24s var(--ease-soft);
}

img[data-image-loading] {
  opacity: 0;
}

img.is-image-loaded {
  opacity: 1;
  animation: imageFadeIn 0.24s var(--ease-soft);
}

.image-loading-wrap {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.image-loading-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.68), transparent),
    linear-gradient(135deg, rgba(0, 0, 0, 0.045), rgba(0, 0, 0, 0.02));
  background-size: 180% 100%, 100% 100%;
  animation: imageLoadingSweep 1.15s linear infinite;
}

.image-loading-wrap>img {
  position: relative;
}

.image-loading-wrap.image-loaded::before {
  opacity: 0;
  animation: none;
  transition: opacity 0.2s ease;
}

.viewer-container.image-loading-wrap,
.viewer-container .image-loading-wrap,
.viewerjs-source-list.image-loading-wrap,
.viewerjs-source-list .image-loading-wrap {
  overflow: initial;
  isolation: auto;
}

.viewer-container.image-loading-wrap::before,
.viewer-container .image-loading-wrap::before,
.viewerjs-source-list.image-loading-wrap::before,
.viewerjs-source-list .image-loading-wrap::before {
  display: none;
}

/* Shell */
.app-shell {
  width: min(var(--shell-max), calc(100% - var(--shell-gutter)));
  margin: 0 auto;
  padding: 0 0 40px;
}

@media (min-width: 1400px) {
  :root {
    --shell-gutter: 40px;
    --shell-max: 1280px;
  }
}

/* Site Header */
.site-header {
  position: sticky;
  top: 12px;
  z-index: 1000;
  display: grid;
  grid-template-columns: minmax(160px, auto) minmax(200px, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  margin-bottom: 28px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(1.18);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
}

.site-brand {
  min-width: 0;
  display: inline-grid;
  grid-template-columns: 36px minmax(0, auto);
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s ease;
}

.site-brand:hover {
  transform: scale(1.03);
}

.site-brand-mark,
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  background: var(--primary-bg);
}

.site-brand-mark svg,
.brand-mark svg {
  width: 29px;
  height: 29px;
  display: block;
}

.site-brand-mark img,
.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.site-brand-mark .icon-frame,
.site-brand-mark .icon-line,
.site-brand-mark .icon-dot,
.brand-mark .icon-frame,
.brand-mark .icon-line,
.brand-mark .icon-dot {
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-brand-mark .ai-spark,
.brand-mark .ai-spark {
  fill: rgba(255, 255, 255, 0.45);
  stroke: #fff;
  stroke-width: 0.5;
}

.site-brand-mark .ai-spark.small,
.brand-mark .ai-spark.small {
  fill: #fff;
  stroke: none;
  opacity: 0.8;
}

.site-brand-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-nav {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-soft);
}

.site-nav a {
  height: 32px;
  min-width: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: background 0.2s ease, color 0.2s ease;
}

.site-nav a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.site-nav a.active {
  background: var(--primary-bg);
  color: var(--primary-inverse);
}

.site-action.active {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary-inverse);
}

.site-actions {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.site-balance {
  height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-action {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.site-action:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
  border-color: var(--line-hover);
}

.site-action-primary {
  border: 0;
  background: var(--primary-bg);
  color: var(--primary-inverse);
}

.site-action-primary:hover {
  background: var(--primary-hover-bg);
  color: var(--primary-inverse);
  border-color: transparent;
}

.site-invite-code {
  height: 32px;
  max-width: 150px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.site-invite-code:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
  border-color: var(--line-hover);
}

.site-notice-button,
.site-mobile-notice-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  -webkit-tap-highlight-color: transparent;
}

.site-notice-button {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
}

.site-notice-button svg,
.site-mobile-notice-button svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-notice-button em,
.site-mobile-notice-button em {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: var(--radius-full);
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}

.site-menu-button,
.site-mobile-top-balance,
.site-mobile-menu {
  display: none;
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: minmax(140px, 1fr) auto;
  }

  .site-nav {
    order: 3;
    grid-column: 1 / -1;
    justify-self: stretch;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
  }

  .site-actions {
    grid-column: 2;
  }
}

@media (max-width: 720px) {
  .site-header {
    position: fixed;
    top: 10px;
    right: 7px;
    left: 7px;
    z-index: 1000;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    justify-content: space-between;
    align-items: center;
    min-height: 56px;
    margin-bottom: 0;
    padding: 8px 12px 8px 16px;
    border-radius: var(--radius-full);
    overflow: visible !important;
    gap: 12px;
  }

  .site-brand {
    width: auto;
    grid-template-columns: 30px minmax(0, auto) !important;
    gap: 9px;
    padding: 0;
    align-items: center;
  }

  .site-brand-name {
    display: block;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .site-brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .site-brand-mark svg {
    width: 24px;
    height: 24px;
  }

  .site-nav,
  .site-actions {
    display: none;
  }

  .site-mobile-top-balance {
    max-width: min(42vw, 150px);
    width: 44px;
    height: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.56);
    -webkit-backdrop-filter: blur(12px) saturate(1.12);
    backdrop-filter: blur(12px) saturate(1.12);
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .site-mobile-notice-button {
    overflow: visible;
    padding: 0;
  }

  .site-mobile-notice-button em {
    top: -4px;
    right: -4px;
    z-index: 2;
  }

  .site-menu-button {
    width: 44px;
    height: 44px;
    display: grid;
    place-content: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.56);
    -webkit-backdrop-filter: blur(12px) saturate(1.12);
    backdrop-filter: blur(12px) saturate(1.12);
    cursor: pointer;
  }

  .site-menu-button span {
    width: 18px;
    height: 2px;
    border-radius: var(--radius-full);
    background: var(--text);
    transition: transform 0.18s ease, opacity 0.18s ease;
  }

  .site-header.is-menu-open .site-menu-button span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .site-header.is-menu-open .site-menu-button span:nth-child(2) {
    opacity: 0;
  }

  .site-header.is-menu-open .site-menu-button span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .site-mobile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(280px, calc(100vw - 24px));
    display: none;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: blur(16px) saturate(1.12);
    backdrop-filter: blur(16px) saturate(1.12);
  }

  .site-header.is-menu-open .site-mobile-menu {
    display: grid;
  }

  .site-mobile-balance {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-full);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .site-mobile-nav,
  .site-mobile-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .site-mobile-nav a,
  .site-mobile-actions a,
  .site-mobile-actions button {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
  }

  .site-mobile-nav a.active,
  .site-mobile-actions button {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary-inverse);
  }

  .site-mobile-nav a:not(.active):hover,
  .site-mobile-actions a:hover {
    border-color: var(--line-strong);
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
  }

  .app-shell {
    padding-top: 86px;
    padding-bottom: 96px;
  }
}

/* Mobile Bottom Nav */
.mobile-bottom-nav,
.mobile-account-sheet {
  display: none;
}

@media (max-width: 720px) {
  .mobile-bottom-nav {
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    z-index: 1100;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px) saturate(1.12);
    -webkit-backdrop-filter: blur(16px) saturate(1.12);
  }

  .mobile-bottom-nav.has-subsite {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .mobile-bottom-nav a,
  .mobile-bottom-nav button {
    min-width: 0;
    min-height: 44px;
    display: grid;
    place-items: center;
    gap: 1px;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: -0.01em;
  }

  .mobile-bottom-nav .mobile-nav-icon {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    line-height: 1;
  }

  .mobile-bottom-nav .mobile-nav-icon svg {
    width: 22px;
    height: 22px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-bottom-nav a.active,
  .mobile-bottom-nav button.active {
    background: var(--primary-bg);
    color: var(--primary-inverse);
  }

  .mobile-account-sheet {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    align-items: end;
    padding: 12px;
    background: rgba(0, 0, 0, 0.30);
  }

  .mobile-account-sheet.hidden {
    display: none;
  }

  .mobile-account-panel {
    width: 100%;
    display: grid;
    gap: 12px;
    border-radius: var(--radius);
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
  }

  .mobile-account-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .mobile-account-balance {
    min-height: 42px;
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-full);
    padding: 0 16px;
    color: var(--text-soft);
    font-weight: 600;
    font-size: 14px;
  }

  .mobile-account-invite {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-full);
    padding: 0 16px;
    background: transparent;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
  }

  .mobile-account-invite strong {
    font-family: var(--font-mono);
  }

  .mobile-account-actions {
    display: grid;
    gap: 8px;
  }

  .mobile-account-actions a,
  .mobile-account-actions button {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border: 1px solid var(--line);
    border-radius: var(--radius-full);
    padding: 0 16px;
    background: transparent;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
  }

  .mobile-account-actions button {
    border: 0;
    background: var(--primary-bg);
    color: var(--primary-inverse);
    font-weight: 600;
  }
}

/* Old Topbar compat */
.app-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 60px;
  margin-bottom: 20px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px) saturate(1.12);
  -webkit-backdrop-filter: blur(16px) saturate(1.12);
}

.topbar-brand {
  min-width: 0;
  width: fit-content;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-copy {
  min-width: 0;
}

.eyebrow,
.brand-copy .eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Typography */
h1,
h2 {
  margin: 0;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 36px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h2 {
  font-size: 20px;
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 16px;
}

.two-col {
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  align-items: stretch;
}

.narrow-left {
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}

/* Cards */
.card,
.stat-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px) saturate(1.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);
}

.card {
  padding: 20px;
}

.section-card {
  margin-top: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 50px;
  margin-bottom: 16px;
}

.card-head>div {
  min-width: 0;
}

.card-head h2 {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

/* Buttons */
.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: 0 24px;
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  text-align: center;
  letter-spacing: -0.01em;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.button.primary {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary-inverse);
}

.button.primary:hover {
  background: var(--primary-hover-bg);
  border-color: var(--primary-hover);
}

.button.secondary {
  border-color: var(--line);
  background: transparent;
  color: var(--text-soft);
}

.button.secondary:hover,
.button.secondary.active {
  border-color: var(--line-hover);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.button.danger {
  border-color: var(--danger-border);
  background: transparent;
  color: var(--danger);
}

.button.danger:hover {
  background: var(--danger-soft);
}

.button.small {
  min-height: 32px;
  padding: 0 16px;
  font-size: 13px;
}

.button.online-action {
  border-color: var(--line);
  background: transparent;
  color: var(--text-soft);
}

.button.online-action:hover {
  border-color: var(--line-hover);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.button.disabled {
  pointer-events: none;
  opacity: 0.4;
}

/* Badges & Status */
.badge,
.status {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 10px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.status.succeeded,
.alert.success,
.inline-message.success {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-border);
}

.status.failed,
.alert.error,
.inline-message.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}

.status.running,
.status.queued,
.alert.warning,
.inline-message.warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning-border);
}

.status.deleted {
  background: var(--surface-soft);
  color: var(--muted);
  border-color: var(--line);
}

.record-meta .status {
  flex: 0 0 auto;
  min-height: 22px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Alerts */
.alert,
.inline-message {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  background: transparent;
  color: var(--text-soft);
  font-weight: 500;
}

.inline-message {
  margin: 14px 0 0;
}

.generation-notice {
  margin-bottom: 14px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-xs);
  padding: 11px 12px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
}

/* Forms */
.form {
  display: grid;
  gap: 14px;
}

.mobile-form-toggle {
  display: none;
}

.field,
.field-grid {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.generation-options-grid.is-single-count {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.generation-options-grid.is-single-count .option-size {
  grid-column: 1 / -1;
}

.prompt-api-grid {
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 0.8fr) minmax(240px, 1fr);
}

.field span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.settings-help-box {
  height: 42px;
  min-height: 42px;
  display: flex;
  align-items: center;
  align-self: end;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  outline: none;
  background: var(--surface-soft);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 144px;
  padding: 12px;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-hover);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--text);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

input[readonly] {
  background: var(--surface-soft);
  color: var(--muted);
}

select {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

textarea::placeholder,
input::placeholder {
  color: var(--placeholder);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
  display: inline-grid;
  flex: 0 0 auto;
  place-content: center;
  border: 1.5px solid var(--line-hover);
  border-radius: var(--radius-full);
  padding: 0;
  overflow: hidden;
  background: #fff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 11px 9px;
  background-image: none;
  box-shadow: none;
  color-scheme: light;
  cursor: pointer;
  vertical-align: middle;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.switch-field,
.center-auth-options label,
.record-bulk-check,
.record-select {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input[type="checkbox"]::after {
  content: none;
}

input[type="checkbox"]:checked {
  border-color: var(--primary);
  background-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5.1 4.3 8.4 11 1.6' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 11px 9px;
}

input[type="checkbox"]:checked::after {
  content: none;
}

input[type="checkbox"]:focus {
  background-color: #fff;
  box-shadow: none;
}

input[type="checkbox"]:checked:focus {
  background-color: var(--primary);
}

input[type="checkbox"]:focus-visible {
  box-shadow: var(--ring);
}

/* Mode Toggle — segmented control */
.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-soft);
}

.mode-toggle label {
  min-height: 36px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease, color 0.2s ease;
}

.mode-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.mode-toggle label:has(input:checked) {
  background: var(--primary-bg);
  color: var(--primary-inverse);
}

/* Upload */
.edit-upload-box {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xs);
  padding: 12px;
  background: var(--surface-soft);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.edit-upload-box:hover {
  border-color: var(--text);
  background: rgba(0, 0, 0, 0.02);
}

.edit-upload-box input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.edit-upload-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
}

.edit-upload-box>div:not(.edit-upload-icon) {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.edit-upload-box strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
}

.edit-upload-box small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-upload-preview {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.edit-upload-field.has-preview {
  grid-template-columns: minmax(0, 1fr) 88px;
  align-items: start;
}

.edit-upload-field.has-preview>span {
  grid-column: 1 / -1;
}

.edit-upload-field.has-preview .edit-upload-preview {
  grid-column: 1;
  grid-row: 2;
}

.edit-upload-field.has-preview .edit-upload-box {
  grid-column: 2;
  grid-row: 2;
  width: 88px;
  min-width: 88px;
  height: 88px;
  min-height: 88px;
  padding: 10px;
}

.edit-upload-field.has-preview .edit-upload-box>div:not(.edit-upload-icon) {
  display: none;
}

.edit-preview-item {
  position: relative;
  width: 88px;
  min-width: 88px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
}

.edit-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.edit-preview-item button {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 3;
  border: 0;
  border-radius: 6px;
  padding: 4px 7px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Generate */
.generate-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.generate-actions .button {
  white-space: nowrap;
}

.prompt-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.prompt-optimize-button {
  width: auto;
  min-width: 88px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-soft);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.prompt-optimize-button:hover,
.prompt-optimize-button:focus-visible {
  border-color: var(--line-hover);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.prompt-optimize-button:disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

.prompt-optimize-button.is-loading {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text);
}

.prompt-optimize-button.is-loading::before {
  content: "";
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.72s linear infinite;
}

.prompt-extractor {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: rgba(255, 255, 255, 0.46);
}

.prompt-extractor.is-loading {
  border-color: var(--primary-border);
  background: rgba(255, 255, 255, 0.68);
}

.prompt-extractor.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.78) 45%, transparent 78%),
    rgba(255, 255, 255, 0.24);
  background-size: 170% 100%, 100% 100%;
  animation: imageLoadingSweep 1.1s linear infinite;
}

.prompt-extractor.is-loading::after {
  content: "正在提取提示词...";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
}

.prompt-extractor.is-loading .prompt-extractor-upload,
.prompt-extractor.is-loading .prompt-extractor-result {
  pointer-events: none;
  opacity: 0.45;
}

.prompt-extractor-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 4px 12px;
}

.prompt-extractor-head>div {
  min-width: 0;
  display: contents;
}

.prompt-extractor-head .badge {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  justify-self: end;
}

.prompt-extractor-head strong {
  grid-column: 1;
  grid-row: 1;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.prompt-extractor-head span:not(.badge) {
  grid-column: 1 / -1;
  grid-row: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.prompt-extractor-upload {
  min-height: 74px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  border: 1px dashed var(--line-hover);
  border-radius: var(--radius-xs);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.prompt-extractor-upload:hover {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.prompt-extractor-upload input {
  display: none;
}

.prompt-extractor-plus {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--text);
  font-size: 24px;
  font-weight: 500;
}

.prompt-extractor-upload strong,
.prompt-extractor-upload small {
  display: block;
}

.prompt-extractor-upload strong {
  color: var(--text);
  font-size: 13px;
}

.prompt-extractor-upload small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-extractor-result {
  display: grid;
  gap: 10px;
}

.prompt-extractor-result textarea {
  min-height: 96px;
  resize: vertical;
}

.prompt-extractor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* Auth */
.auth-wrap {
  min-height: 62vh;
  display: grid;
  place-items: center;
}

.simple-auth {
  min-height: calc(100vh - 150px);
}

.auth-dashboard {
  min-height: calc(100vh - 142px);
  width: 100%;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 440px);
  gap: 24px;
  align-items: stretch;
  place-items: stretch;
}

.auth-info,
.auth-form-card {
  min-height: 520px;
}

.auth-info {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  background: var(--surface);
}

.auth-info-head,
.auth-metrics {
  position: relative;
  z-index: 2;
}

.auth-tag {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 14px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.auth-info h2 {
  max-width: 560px;
  margin-top: 24px;
  font-size: 40px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.auth-info p {
  max-width: 500px;
  margin: 14px 0 0;
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
}

.auth-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.auth-metrics div {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 14px;
  background: rgba(255, 255, 255, 0.6);
}

.auth-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.auth-metrics strong {
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-card {
  width: min(440px, 100%);
}

.auth-form-card {
  width: 100%;
  display: grid;
  align-content: center;
  align-self: stretch;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.auth-card.wide {
  width: min(640px, 100%);
}

.auth-card h2 {
  margin-bottom: 18px;
}

.auth-card-head {
  margin-bottom: 22px;
}

.auth-card-head h2 {
  margin-bottom: 8px;
  font-size: 26px;
  color: var(--text);
}

.auth-form-card .field input {
  background: #fff;
}

.auth-form-card .field input::placeholder {
  color: var(--placeholder);
}

.auth-card-head span,
.auth-switch {
  color: var(--muted);
  font-weight: 500;
}

.auth-form-card .button.primary {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
}

.auth-switch {
  margin: 18px 0 0;
  text-align: center;
}

/* Setup */
.setup-installed-main {
  width: 100%;
  display: grid;
}

.setup-installed-card.auth-card.wide {
  width: 100%;
}

.setup-installed-card p:last-child {
  margin-bottom: 0;
}

.setup-card {
  width: min(920px, 100%);
  margin: 0 auto;
}

.setup-form {
  gap: 18px;
}

.setup-section {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 16px;
  background: transparent;
}

.setup-section h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

/* Preview */
.preview-card {
  display: grid;
  grid-template-rows: auto minmax(390px, 1fr);
}

.preview-stage {
  min-height: 390px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: linear-gradient(45deg, rgba(0, 0, 0, 0.03) 25%, transparent 25%), linear-gradient(-45deg, rgba(0, 0, 0, 0.03) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.03) 75%), linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.03) 75%), #fff;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.preview-stage img {
  width: 100%;
  height: 100%;
  max-height: 620px;
  object-fit: contain;
  background: #fff;
}

.generated-image-grid {
  width: min(100% - 24px, 760px);
  max-height: calc(100% - 24px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  overflow: auto;
  padding: 4px;
}

.generated-image-carousel {
  width: min(100% - 24px, 820px);
  max-height: calc(100% - 24px);
  overflow: hidden;
}

.generated-image-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 76%);
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  padding: 4px 4px 12px;
}

.generated-image-slide,
.generated-image-tile {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: #fff;
  cursor: zoom-in;
  scroll-snap-align: center;
}

.generated-image-single {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 390px;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: #fff;
  cursor: zoom-in;
  overflow: hidden;
}

.generated-image-single img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 620px;
  object-fit: contain;
  background: #fff;
}

.generated-image-slide img,
.generated-image-tile img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  box-shadow: none;
}

.generated-image-slide > .generated-image-count,
.generated-image-tile > .generated-image-count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.empty-state,
.preview-loading {
  width: min(240px, 90%);
  min-height: 116px;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xs);
  padding: 18px;
  background: transparent;
  color: var(--muted);
  text-align: center;
  font-weight: 500;
}

.preview-loading span {
  font-size: 13px;
  font-weight: 500;
}

.generation-progress-card {
  width: min(520px, calc(100% - 28px));
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 18px;
  background: rgba(255, 255, 255, 0.96);
}

.generation-progress-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.generation-progress-head strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.generation-progress-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.generation-progress-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.generation-progress-grid>div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  background: var(--surface-soft);
}

.generation-progress-grid span,
.generation-summary-row span,
.generation-summary-prompt span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.generation-progress-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.generation-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--surface-soft);
}

.generation-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--text);
  transition: width 0.35s ease;
}

.generation-summary {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.generation-summary-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.generation-summary-row strong {
  min-width: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.generation-summary-prompt {
  display: grid;
  gap: 6px;
}

.generation-summary-prompt p {
  max-height: 112px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px;
  background: #fff;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.preview-error {
  width: min(360px, 92%);
  min-height: 128px;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-xs);
  padding: 18px;
  background: var(--danger-soft);
  color: var(--danger);
  text-align: center;
  font-weight: 500;
}

.preview-error span {
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.preview-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--text);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

/* Records / History */
.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  align-items: stretch;
}

body.page-records .history-list {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.history-list .record-card {
  height: 264px;
  min-height: 264px;
  display: grid;
  grid-template-rows: 128px 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px) saturate(1.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}

.history-list .record-card:hover {
  border-color: var(--line-hover);
  transform: translateY(-2px);
}

.history-list[data-latest-row] {
  max-height: 264px;
  overflow: hidden;
}

.admin-record-card-list {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.admin-record-card-toolbar {
  align-items: center;
  justify-content: flex-start;
}

.admin-record-card-toolbar .record-bulk-check {
  flex: 0 0 auto;
}

.history-list .admin-record-card {
  height: 274px;
  min-height: 274px;
  grid-template-rows: 122px 1fr;
}

.history-list .admin-record-card .record-body {
  gap: 3px;
  padding: 7px 10px 6px;
}

.history-list .admin-record-card .record-summary {
  min-height: 35px;
  max-height: 35px;
  line-height: 1.45;
  -webkit-line-clamp: 2;
}

.history-list .admin-record-card .record-foot {
  margin-top: 1px;
  gap: 4px;
  padding: 6px 0 0;
}

.admin-record-card.is-deleted {
  background: var(--surface-soft);
  opacity: 0.86;
}

.admin-record-card-id {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.46);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: var(--shadow-soft);
}

.admin-record-card-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.admin-record-card-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-record-card-user {
  color: var(--text);
}

.history-list .record-card.is-row-hidden {
  display: none;
}

.record-image {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 500;
  position: relative;
}

.record-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-list .record-image::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.10));
}

.record-body {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 10px;
}

.history-list .record-body {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px 6px;
  min-width: 0;
}

.record-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.history-list .record-meta {
  display: block;
}

.history-list .record-meta span {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-list .record-meta .status {
  display: none;
}

.record-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-body p {
  max-height: 42px;
  margin: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.history-list .record-body p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.record-body time {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Record foot — border-top, then time-row + button-row */
.history-list .record-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid var(--line);
  padding: 7px 0 3px;
}

/* Foot row — time left, duration right */
.record-foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.record-foot-row time {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.record-duration {
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Foot actions — buttons right-aligned second line */
.record-foot-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.record-delete,
.record-regenerate,
.record-edit-again,
.record-inspiration {
  min-width: 44px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1;
}

.record-delete {
  border: 1px solid var(--danger-border);
  background: transparent;
  color: var(--danger);
  transition: background 0.2s ease;
}

.record-delete:hover {
  background: var(--danger-soft);
}

.record-regenerate {
  border: 1px solid var(--success-border);
  background: var(--success-soft);
  color: var(--success);
  transition: background 0.2s ease;
}

.record-regenerate:hover {
  background: rgba(22, 101, 52, 0.12);
}

.inline-inspiration-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.inspiration-tag-input {
  width: 72px;
  height: 28px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  line-height: 1;
}

.inspiration-tag-pill {
  max-width: 82px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 9px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-inspiration {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text-soft);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.record-inspiration:hover,
.record-inspiration.is-active {
  border-color: var(--line-hover);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.record-edit-again {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text-soft);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.record-edit-again:hover {
  border-color: var(--line-hover);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

/* Record summary */
.record-summary {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.record-summary.is-remark::before {
  color: var(--text-soft);
  font-weight: 600;
}

.record-summary.is-prompt {
  color: var(--text-soft);
}

/* Record status overlay on image */
.record-status-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  min-width: 52px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-full);
  padding: 0 14px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  background: var(--muted-light);
}

.record-status-overlay.status.succeeded {
  background: var(--success);
  color: #fff;
}

.record-status-overlay.status.failed {
  background: var(--danger);
  color: #fff;
}

.record-status-overlay.status.running,
.record-status-overlay.status.queued {
  background: var(--warning);
  color: #fff;
}

.record-status-overlay.status.deleted {
  background: var(--muted);
  color: #fff;
}

/* Show overlay on record-image, hide duplicate inline status inside .record-image */
.history-list .record-image>.status:not(.record-status-overlay),
.history-list .record-image>span:not(.record-status-overlay):not(.record-image-empty) {
  display: none;
}

/* Hide the duplicate status span inside record-meta — overlay already shows it */
.history-list .record-meta .status {
  display: none;
}

.history-empty-inline {
  grid-column: 1 / -1;
  min-height: 92px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xs);
  color: var(--muted);
  background: transparent;
  font-weight: 500;
}

.pagination {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-top: 18px;
  padding-top: 2px;
}

.pagination span {
  min-width: 128px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

/* Admin Nav */
.admin-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-soft);
}

.admin-nav .button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 32px;
  border: 0;
  padding: 0 12px;
  font-size: 13px;
}

.admin-nav .button.secondary.active {
  background: var(--primary-bg);
  color: var(--primary-inverse);
}

.admin-version-footer {
  margin-top: 22px;
  padding: 14px 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.site-footer {
  margin-top: 22px;
  padding: 14px 0 4px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--text-soft);
  font-weight: 500;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 16px;
  min-height: 104px;
  display: grid;
  align-content: center;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 30px;
  line-height: 1.1;
  font-weight: 600;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.28) rgba(0, 0, 0, 0.045);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.table-wrap::-webkit-scrollbar {
  height: 10px;
}

.table-wrap::-webkit-scrollbar-track {
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.045);
}

.table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid #fff;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.28);
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.42);
}

table {
  width: 100%;
  min-width: max-content;
  max-width: none;
  table-layout: auto;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 44px;
  border-bottom-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

tbody tr {
  transition: background 0.16s ease;
}

tbody tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}

tr.is-deleted td {
  background: var(--surface-soft);
  color: var(--muted);
}

tr.is-deleted:hover td {
  background: rgba(0, 0, 0, 0.03);
}

.admin-prompt-cell {
  color: var(--text-soft);
  max-width: none;
  line-height: 1.45;
}

.admin-record-row td {
  vertical-align: middle;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.admin-user-cell {
  max-width: none;
  font-weight: 500;
}

.table-primary-text {
  min-width: 0;
  max-width: none;
  overflow: visible;
  color: var(--text);
  font-weight: 600;
  text-overflow: clip;
  white-space: nowrap;
}

.table-muted-cell {
  color: var(--muted);
}

.table-subtext {
  display: inline;
  margin-top: 0;
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
}

.table-primary-text + .table-subtext::before {
  content: "/ ";
}

.admin-record-id {
  display: inline-block;
  color: var(--text);
  font-weight: 600;
}

.admin-record-id-cell {
  line-height: 1.35;
}

.admin-record-id-cell .status {
  margin-top: 5px;
}

.deleted-time {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.admin-credit-cell {
  overflow: visible;
}

.admin-credit-cell .inline-admin-form {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) 58px;
  gap: 8px;
  align-items: center;
}

.admin-credit-cell .compact-input {
  width: 100%;
  min-width: 0;
}

.admin-contact-cell {
  min-width: 0;
  overflow: visible !important;
}

.admin-contact-form {
  display: grid;
  grid-template-columns: minmax(118px, 0.9fr) minmax(160px, 1.25fr) 58px;
  gap: 8px;
  align-items: end;
  width: 100%;
}

.admin-contact-form label {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.admin-contact-form label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.admin-contact-form .contact-input {
  width: 100%;
  min-width: 0;
}

.admin-contact-display {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
}

.admin-contact-display span {
  min-width: 0;
  display: inline;
  color: var(--text-soft);
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.table-primary-text:not(td):not(th) {
  display: inline;
}

.admin-contact-display span + span::before {
  content: " / ";
}

.admin-contact-inline,
.admin-table-inline {
  display: inline-block;
  white-space: nowrap;
}

.admin-table-actions {
  overflow: visible !important;
  white-space: nowrap !important;
  text-overflow: clip !important;
  position: relative;
}

.admin-table-actions>.button,
.admin-table-actions>.inline-delete-form,
.admin-table-actions>.table-action-group,
.admin-table-actions>.admin-user-row-actions {
  vertical-align: middle;
}

.admin-user-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.admin-user-row-actions .inline-admin-form {
  margin: 0;
}

.admin-real-name-trigger {
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.admin-real-name-trigger:hover,
.admin-real-name-trigger:focus-visible {
  border-color: rgba(22, 163, 74, 0.34);
  background: rgba(22, 163, 74, 0.14);
}

.admin-stats-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-stats-cell strong {
  color: var(--text);
  font-size: 13px;
}

.table-check-cell input,
[data-check-all-records] {
  width: 17px;
  height: 17px;
  min-width: 17px;
}

.admin-number-cell {
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.admin-number-cell strong {
  color: var(--text);
  font-weight: 600;
}

.table-thumb {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.table-thumb:hover {
  border-color: var(--line-hover);
  transform: translateY(-1px);
}

.table-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.inline-delete-form {
  display: inline-flex;
  margin: 0 0 0 6px;
}

.inline-admin-form,
.table-action-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin: 0;
  vertical-align: middle;
}

.table-action-group {
  flex-wrap: nowrap;
}

.compact-input {
  width: 88px;
  height: 36px;
  border-radius: var(--radius-xs);
  padding: 0 9px;
  font-size: 13px;
}

.compact-input.password-input {
  width: 146px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(140px, 180px) auto;
  gap: 10px;
  align-items: end;
  width: 100%;
  min-width: 0;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  padding: 14px;
}

.filter-actions {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.filter-bar.admin-record-filter {
  grid-template-columns: minmax(110px, 1fr) minmax(140px, 1fr) minmax(80px, 1fr) minmax(90px, 1fr) auto;
}

.filter-bar.user-record-filter {
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 1fr) minmax(120px, 1fr) minmax(80px, 1fr) minmax(90px, 1fr) auto;
}

.filter-bar.admin-user-filter {
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 1fr) minmax(120px, 1fr) minmax(104px, 136px) auto;
  display: grid;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: end;
  -webkit-overflow-scrolling: touch;
}

.filter-bar.admin-user-filter .field {
  min-width: 0;
}

.filter-bar.admin-user-filter .filter-actions {
  justify-content: flex-start;
}

.filter-bar.admin-log-filter {
  grid-template-columns: minmax(150px, 1.1fr) minmax(132px, 0.9fr) minmax(120px, 0.8fr) minmax(136px, 0.8fr) minmax(136px, 0.8fr) auto;
}

.filter-bar.admin-code-filter {
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 1fr) minmax(190px, 1fr);
}

.admin-record-bulk-form {
  margin-bottom: 14px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-xs);
  background: var(--danger-soft);
  padding: 10px 14px;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Unified page rhythm */
body.page-app .app-shell,
body.page-records .app-shell,
body.page-inspirations .app-shell,
body.page-credits .app-shell,
body.page-profile .app-shell,
body.page-admin .app-shell {
  width: min(var(--shell-max), calc(100% - var(--shell-gutter)));
}

body.page-app main,
body.page-records main,
body.page-inspirations main,
body.page-credits main,
body.page-profile main,
body.page-admin main {
  gap: 16px;
}

body.page-records .records-page-card,
body.page-inspirations .inspirations-page-card,
body.page-credits .credits-page-card {
  display: grid;
  gap: 10px;
  margin-top: 0;
}

body.page-records .records-page-card>.card-head,
body.page-inspirations .inspirations-page-card>.card-head,
body.page-credits .credits-page-card>.card-head {
  margin-bottom: 0;
}

body.page-records .records-page-card>.filter-bar,
body.page-credits .credits-page-card>.filter-bar {
  margin-bottom: 0;
}

body.page-records .records-page-card>.invite-link-panel,
body.page-credits .credits-page-card>.invite-link-panel {
  margin-bottom: 8px;
}

body.page-records .records-page-card>.table-wrap,
body.page-credits .credits-page-card>.table-wrap {
  margin-bottom: 0;
}

body.page-records .pagination,
body.page-credits .pagination,
body.page-admin .pagination {
  margin-top: 16px;
}

.code-create-card .card-head {
  margin-bottom: 12px;
}

.code-create-form {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
}

.code-create-form .button {
  min-width: 96px;
}

.code-export-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.code-export-actions span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

code {
  font-family: var(--font-mono);
  font-size: 13px;
}

.code-token {
  display: inline-flex;
  max-width: 100%;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  padding: 0 9px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-copy-button {
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.code-copy-button:hover,
.code-copy-button:focus-visible {
  border-color: var(--line-hover);
  background: rgba(0, 0, 0, 0.04);
}

/* Profile */
.profile-page {
  display: grid;
  gap: 16px;
}

.profile-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(340px, auto) minmax(180px, auto);
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: rgba(255, 255, 255, 0.85);
  overflow: hidden;
}

.profile-hero::before {
  content: "";
  position: absolute;
  inset: auto 28px -52px auto;
  width: 180px;
  height: 180px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, var(--primary-soft), transparent 66%);
  pointer-events: none;
}

.profile-hero-account {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.profile-avatar {
  position: relative;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--primary-bg);
  color: var(--primary-inverse);
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.profile-hero-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.profile-hero-copy h1 {
  font-size: 28px;
}

.profile-hero-copy>span {
  max-width: 440px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.profile-hero-metrics {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--text-soft);
  cursor: pointer;
  overflow: hidden;
}

.profile-hero-metrics span {
  min-height: 30px;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  border-radius: var(--radius-full);
  padding: 0 10px;
  background: rgba(0, 0, 0, 0.035);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.profile-hero-actions {
  position: relative;
  z-index: 1;
  min-width: 180px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-hero-actions .button,
.profile-logout-link {
  min-height: 34px;
  justify-content: center;
}

.profile-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.profile-stat-card,
.profile-section,
.profile-overview-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.85);
}

.profile-overview-section {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.profile-stat-card {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 16px;
}

.profile-stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.profile-stat-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.86fr);
  gap: 16px;
  align-items: stretch;
}

.profile-security-section {
  align-self: stretch;
}

.profile-section {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 20px;
  scroll-margin-top: 96px;
}

.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.profile-section-head>div {
  min-width: 0;
}

.profile-section-head h2 {
  font-size: 18px;
}

.profile-form {
  gap: 14px;
}

.profile-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-info-list {
  display: grid;
  grid-auto-rows: minmax(56px, 1fr);
  align-content: stretch;
  gap: 8px;
}

.profile-info-row {
  min-height: 56px;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.018);
}

.profile-info-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.profile-info-row strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.profile-info-action-row {
  grid-template-columns: 96px minmax(0, 1fr) auto;
}

.profile-info-action-row .button {
  min-height: 30px;
  justify-self: end;
  white-space: nowrap;
}

.profile-info-action-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.profile-manage-list {
  display: grid;
  grid-auto-rows: minmax(72px, 1fr);
  align-content: stretch;
  gap: 10px;
}

.profile-manage-item {
  min-width: 0;
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.018);
  overflow: hidden;
  scroll-margin-top: 96px;
}

.profile-manage-row {
  min-width: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.profile-manage-row>div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.profile-manage-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.profile-manage-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-manage-row small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.profile-manage-item:target {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.profile-empty-state {
  display: grid;
  gap: 6px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xs);
  padding: 16px;
  background: rgba(0, 0, 0, 0.018);
}

.profile-empty-state strong {
  color: var(--text);
  font-size: 15px;
}

.profile-empty-state span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.profile-invite-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: 16px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
  overflow: hidden;
}

.profile-invite-panel::before {
  content: "";
  position: absolute;
  inset: -80px auto auto -60px;
  width: 170px;
  height: 170px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, var(--primary-soft), transparent 68%);
  pointer-events: none;
}

.profile-invite-main,
.profile-invite-link {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: grid;
}

.profile-invite-main {
  gap: 14px;
}

.profile-invite-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.profile-invite-copy>span,
.profile-invite-link>span,
.profile-invite-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.profile-invite-copy h2 {
  color: var(--text);
  font-size: 19px;
}

.profile-invite-copy p {
  max-width: 760px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.7;
}

.profile-invite-copy p strong {
  color: var(--text);
  font-weight: 800;
}

.profile-invite-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.profile-invite-stat {
  min-width: 0;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 12px;
  background: rgba(255, 255, 255, 0.58);
}

.profile-invite-stat strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-invite-link {
  align-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 14px;
  background: rgba(0, 0, 0, 0.024);
}

.profile-invite-link strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-invite-link small {
  color: var(--muted);
  font-size: 12px;
}

.profile-invite-link .button {
  justify-self: start;
  margin-top: 2px;
}

.profile-action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Dialogs */
.redeem-dialog,
.change-password-dialog,
.real-name-dialog,
.profile-edit-dialog,
.notice-dialog,
.admin-notice-dialog,
.admin-user-dialog,
.admin-detail-dialog,
.record-dialog,
.generation-overlay,
.legal-dialog {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.40);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.generation-overlay {
  z-index: 10002;
  pointer-events: auto;
}

.redeem-panel,
.change-password-panel,
.real-name-panel,
.profile-edit-dialog-panel,
.notice-panel,
.admin-notice-panel,
.admin-user-panel,
.admin-detail-panel,
.record-dialog-panel,
.legal-dialog-panel,
.generation-modal {
  width: min(430px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

.profile-edit-dialog-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(720px, calc(100vh - 40px));
}

.profile-dialog-form {
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
}

.profile-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.profile-code-row .button {
  min-width: 112px;
  min-height: 42px;
  white-space: nowrap;
}

.profile-captcha-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.40);
  animation: overlayIn 0.22s var(--ease-out);
}

.profile-captcha-panel {
  width: min(340px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 22px 20px;
  background: var(--surface);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
  animation: panelIn 0.28s var(--ease-soft);
}

.profile-captcha-panel strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.profile-captcha-panel img {
  height: 46px;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.profile-captcha-panel input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
  text-align: center;
  letter-spacing: 0.3em;
}

.profile-captcha-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 12px;
  text-align: center;
}

.profile-captcha-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.profile-captcha-actions .button {
  width: 100%;
  min-height: 42px;
}

.legal-dialog-panel {
  position: relative;
  width: min(860px, 100%);
  max-height: min(820px, calc(100vh - 40px));
  overflow: auto;
}

.notice-panel {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.admin-notice-panel {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.admin-user-panel {
  width: min(720px, 100%);
  max-height: min(780px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.admin-detail-panel {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.admin-user-edit-form {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  padding: 20px;
}

.admin-user-edit-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.02);
}

.admin-user-edit-summary strong {
  min-width: 0;
  color: var(--text);
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-edit-summary span,
.admin-user-edit-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.admin-user-edit-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.admin-user-edit-actions {
  display: flex;
  justify-content: flex-end;
}

.admin-detail-body {
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px 14px;
  align-items: center;
}

.admin-detail-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.admin-detail-grid strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.admin-log-context-panel {
  width: min(860px, 100%);
}

.admin-log-context-code {
  min-height: 280px;
  max-height: min(560px, calc(100vh - 180px));
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 14px;
  background: rgba(0, 0, 0, 0.035);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-notice-detail {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  padding: 20px 22px 24px;
}

.admin-notice-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-notice-meta span,
.admin-notice-meta time {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.admin-notice-detail p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.notice-timeline {
  min-height: 0;
  display: grid;
  gap: 0;
  overflow-y: auto;
  padding: 20px 22px 24px;
}

.notice-timeline-item {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 0 0 22px 24px;
}

.notice-timeline-item::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 4px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--text);
  border-radius: var(--radius-full);
  background: var(--surface);
}

.notice-timeline-item::after {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 0;
  left: 8px;
  width: 1px;
  background: var(--line-strong);
}

.notice-timeline-item:last-child {
  padding-bottom: 0;
}

.notice-timeline-item:last-child::after {
  display: none;
}

.notice-timeline-item time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.notice-timeline-item h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.notice-timeline-item p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.notice-empty {
  padding: 34px 22px;
  color: var(--muted);
  text-align: center;
}

.generation-modal {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 26px 22px;
  text-align: center;
}

.generation-modal h2 {
  font-size: 22px;
  font-weight: 600;
}

.generation-modal p {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.generation-loader {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  height: 42px;
}

.generation-loader span {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--text);
  animation: pulse 0.9s ease-in-out infinite;
}

.generation-loader span:nth-child(2) {
  animation-delay: 0.12s;
}

.generation-loader span:nth-child(3) {
  animation-delay: 0.24s;
}

.generation-progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--surface-soft);
}

.generation-progress i {
  width: 42%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--text);
  animation: progress 1.3s ease-in-out infinite;
}

.redeem-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
  background: var(--surface);
}

.redeem-form,
.recharge-form,
.change-password-form,
.real-name-form {
  padding: 20px;
}

.redeem-panel {
  width: min(520px, 100%);
}

.redeem-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
}

.redeem-tabs.is-single {
  grid-template-columns: 1fr;
}

.redeem-tabs button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.redeem-tabs button.active {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text);
}

.redeem-tab-panel[hidden] {
  display: none;
}

.recharge-form {
  max-height: min(68vh, 620px);
  overflow-y: auto;
}

.recharge-form.is-loading {
  opacity: 0.82;
}

.recharge-estimate,
.field-hint {
  margin: -6px 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.recharge-package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.recharge-package-card {
  position: relative;
  min-height: 96px;
  display: grid;
  gap: 6px;
  justify-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.04);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.recharge-package-card:hover,
.recharge-package-card.active {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.recharge-package-card strong {
  font-size: 14px;
  font-weight: 700;
}

.recharge-package-card span {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.recharge-package-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.recharge-channel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.recharge-channel-grid.is-single {
  grid-template-columns: 1fr;
}

.recharge-channel {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.42);
  cursor: pointer;
}

.recharge-channel input {
  width: 16px;
  height: 16px;
}

.recharge-payment-result {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 12px;
  background: rgba(255, 255, 255, 0.48);
}

.recharge-payment-result strong {
  color: var(--text);
  font-size: 14px;
}

.recharge-payment-result p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.recharge-payment-result.is-paid {
  border-color: var(--success);
  background: var(--success-soft);
}

.recharge-payment-result.is-failed {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.real-name-mobile {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 14px;
  background: rgba(0, 0, 0, 0.018);
}

.real-name-mobile span,
.real-name-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.real-name-mobile strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.real-name-note {
  margin: 0;
}

.dialog-close {
  min-width: 72px;
  flex: 0 0 auto;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 14px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.dialog-close:hover {
  border-color: var(--line-hover);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

/* Toast & Layer */
.jpt-layer-root {
  position: relative;
  z-index: 10040;
}

.jpt-toast-stack {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 10060;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.jpt-toast {
  min-height: 46px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 10px 16px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
  pointer-events: auto;
  animation: toastIn 0.28s var(--ease-soft);
}

.jpt-toast.is-leaving {
  animation: toastOut 0.18s var(--ease-out) forwards;
}

.jpt-toast-icon,
.jpt-layer-icon {
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.jpt-toast-icon {
  width: 18px;
  height: 18px;
  background: var(--muted-light);
}

.jpt-toast-icon::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: #fff;
}

.jpt-toast.success {
  border-color: var(--success-border);
  color: var(--success);
}

.jpt-toast.success .jpt-toast-icon {
  background: var(--success);
}

.jpt-toast.success .jpt-toast-icon::after {
  content: "✓";
  width: auto;
  height: auto;
  background: none;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.jpt-toast.error {
  border-color: var(--danger-border);
  color: var(--danger);
}

.jpt-toast.error .jpt-toast-icon {
  background: var(--danger);
}

.jpt-toast.error .jpt-toast-icon::after {
  content: "✕";
  width: auto;
  height: auto;
  background: none;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.jpt-toast.warning {
  border-color: var(--warning-border);
  color: var(--warning);
}

.jpt-toast.warning .jpt-toast-icon {
  background: var(--warning);
}

.jpt-toast.warning .jpt-toast-icon::after {
  content: "!";
  width: auto;
  height: auto;
  background: none;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.jpt-toast.info {
  border-color: var(--line);
}

.jpt-toast.info .jpt-toast-icon {
  background: var(--text-soft);
}

.jpt-toast.info .jpt-toast-icon::after {
  content: "i";
  width: auto;
  height: auto;
  background: none;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-style: italic;
}

.jpt-layer-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px) saturate(1.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);
  animation: overlayIn 0.22s var(--ease-out);
}

.jpt-layer-overlay.is-leaving {
  animation: overlayOut 0.18s var(--ease-out) forwards;
}

.jpt-layer-panel {
  width: min(440px, 100%);
  display: grid;
  grid-template-rows: auto auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  backdrop-filter: blur(16px) saturate(1.08);
  -webkit-backdrop-filter: blur(16px) saturate(1.08);
  animation: panelIn 0.28s var(--ease-soft);
}

.jpt-layer-overlay.is-leaving .jpt-layer-panel {
  animation: panelOut 0.18s var(--ease-out) forwards;
}

.jpt-layer-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 20px;
  background: var(--surface);
}

.jpt-layer-icon {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--text);
}

.jpt-layer-icon::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: #fff;
}

.jpt-layer-panel.info .jpt-layer-icon {
  border-color: transparent;
  background: var(--text-soft);
}

.jpt-layer-panel.info .jpt-layer-icon::after {
  content: "?";
  width: auto;
  height: auto;
  background: none;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

.jpt-layer-panel.success .jpt-layer-icon {
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success);
}

.jpt-layer-panel.success .jpt-layer-icon::after {
  content: "✓";
  width: auto;
  height: auto;
  background: none;
  color: var(--success);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.jpt-layer-panel.error .jpt-layer-icon {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger);
}

.jpt-layer-panel.error .jpt-layer-icon::after {
  content: "✕";
  width: auto;
  height: auto;
  background: none;
  color: var(--danger);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.jpt-layer-panel.warning .jpt-layer-icon {
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning);
}

.jpt-layer-panel.warning .jpt-layer-icon::after {
  content: "!";
  width: auto;
  height: auto;
  background: none;
  color: var(--warning);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.jpt-layer-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.jpt-layer-head p {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.jpt-layer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.015);
}

.jpt-layer-actions .button {
  min-width: 88px;
  min-height: 38px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
}

.inspiration-tag-dialog {
  grid-template-rows: auto auto auto;
}

.inspiration-tag-dialog-field {
  display: grid;
  gap: 8px;
  margin: 18px 20px 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.018);
}

.inspiration-tag-dialog-field span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.inspiration-tag-dialog-field input {
  width: 100%;
  min-height: 42px;
  border-radius: var(--radius-xs);
  background: #fff;
  font-size: 14px;
}

/* Settings */
.logo-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.logo-preview img {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  object-fit: cover;
}

.user-identity {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.user-identity strong,
.user-identity span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity strong {
  color: var(--text);
  font-weight: 600;
  line-height: 1.2;
}

.user-identity>span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.settings-page {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
}

.settings-tabs-page {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.settings-tab-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-soft);
  box-shadow: none;
}

.settings-tab-nav button {
  min-height: 32px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.settings-tab-nav button:hover,
.settings-tab-nav button.active {
  background: var(--primary-bg);
  color: var(--primary-inverse);
}

.settings-tab-panel {
  grid-column: 1 / -1;
}

.settings-tab-panel[hidden] {
  display: none !important;
}

.runtime-settings-form,
.settings-basic-form,
.text-ai-settings-form {
  gap: 18px;
}

.settings-section {
  min-width: 0;
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.settings-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.settings-section-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.settings-section-head>div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.settings-section-head strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.settings-section-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.settings-section-head em {
  flex: 0 0 auto;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-full);
  padding: 4px 9px;
  background: var(--primary-soft);
  color: var(--text-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 650;
  line-height: 1;
}

.settings-form-actions {
  min-width: 0;
  display: block;
}

.settings-form-actions .button {
  width: 100%;
}

.runtime-settings-actions {
  margin-top: 18px;
}

.text-ai-section textarea {
  min-height: 150px;
}

.text-ai-module-toggle {
  display: grid;
  grid-template-columns: minmax(180px, 0.65fr) minmax(180px, 0.35fr);
  gap: 12px;
  align-items: end;
}

.theme-settings-form {
  gap: 16px;
}

.theme-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.theme-custom-grid {
  grid-template-columns: minmax(140px, 1fr) minmax(110px, 0.8fr) minmax(110px, 0.8fr);
  align-items: end;
}

.theme-preset-swatch {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-soft);
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.theme-preset-swatch:hover,
.theme-preset-swatch.active {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text);
  transform: translateY(-1px);
}

.theme-preset-swatch span {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 0 0 1px var(--line);
}

.theme-preset-swatch strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-color-field input[type="color"] {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  padding: 4px;
  background: #fff;
}

.theme-preview {
  --theme-preview-bg: var(--primary-bg);
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(0, 0, 0, 0.018);
}

.theme-preview span {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.theme-preview strong,
.theme-preview em {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  padding: 0 16px;
  background: var(--theme-preview-bg);
  color: var(--primary-inverse);
  font-size: 13px;
  font-style: normal;
  font-weight: 650;
}

.theme-preview em {
  min-height: 30px;
  padding: 0 12px;
}

.settings-page>.card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.settings-page>.card>.form {
  flex: 1;
}

.settings-page>.card>.runtime-settings-form {
  flex: 0 0 auto;
}

.settings-page>.card>.form>.button:last-child {
  margin-top: auto;
}

.cloud-storage-card {
  grid-column: 1 / -1;
}

.cloud-storage-form {
  align-content: start;
}

.cloud-storage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.storage-options-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.switch-field {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: end;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: transparent;
  padding: 0 12px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
}

.switch-field input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
}

.settings-switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.settings-verify-toggle {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.prompt-switch-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-switch-grid .switch-field {
  align-self: stretch;
  min-width: 0;
}

.settings-switch-grid .switch-field span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-verify-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.settings-verify-item .switch-field {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  min-width: 0;
  align-self: stretch;
}

.switch-help {
  grid-column: 2;
  grid-row: 1;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  align-self: center;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.02);
  color: var(--muted);
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.switch-help:hover,
.switch-help:focus-visible {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text);
}

.switch-help svg {
  width: 15px;
  height: 15px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-verify-item.is-help-open {
  z-index: 3;
}

.switch-help-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: min(280px, calc(100vw - 48px));
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.settings-page textarea {
  min-height: 104px;
}

.settings-inline-switch {
  width: fit-content;
  min-height: 38px;
  margin-bottom: 12px;
}

.recharge-switch-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-subtabs {
  min-width: 0;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.30);
}

.settings-subtab-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 4px;
  background: rgba(255, 255, 255, 0.58);
}

.settings-subtab-nav button {
  min-width: 0;
  min-height: 32px;
  border: 0;
  border-radius: var(--radius-full);
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.settings-subtab-nav button:hover,
.settings-subtab-nav button.active {
  background: var(--primary-bg);
  color: var(--primary-inverse);
}

.settings-subtab-panel {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.settings-subtab-panel[hidden] {
  display: none !important;
}

.settings-section-head.is-inner {
  padding-bottom: 2px;
}

.alipay-product-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.recharge-package-list {
  display: grid;
  gap: 12px;
}

.recharge-package-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(100px, 0.8fr) minmax(100px, 0.8fr) 86px 88px auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 12px;
  background: rgba(255, 255, 255, 0.38);
}

.recharge-package-row .field {
  gap: 5px;
}

.recharge-package-row .switch-field {
  min-height: 42px;
}

.recharge-package-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.recharge-package-row.is-new {
  border-style: dashed;
}

.recharge-package-delete-form {
  display: flex;
  justify-content: flex-end;
  margin-top: -8px;
}

/* Dashboard */
.dashboard-main {
  gap: 16px;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.dashboard-today {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 4px 0 8px;
}

.dashboard-today-item {
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 80px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  padding: 14px 10px;
}

.dashboard-today-item strong {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: center;
  font-size: 32px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  font-family: var(--font-mono);
}

.dashboard-today-item .dashboard-worker-state {
  font-family: var(--font-sans);
  font-size: 24px;
  letter-spacing: 0;
  line-height: 1.15;
}

.dashboard-today-item strong.is-success {
  color: var(--success);
}

.dashboard-today-item strong.is-failed {
  color: var(--danger);
}

.dashboard-today-item strong.is-warning {
  color: var(--warning);
}

.dashboard-today-item span {
  max-width: 100%;
  min-width: 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.dashboard-worker-meta {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(120px, 0.7fr) minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 10px;
  margin-top: 4px;
}

.dashboard-worker-meta span {
  min-width: 0;
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  background: #fff;
}

.dashboard-worker-meta small {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.dashboard-worker-meta strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.system-info-page {
  gap: 16px;
}

.system-info-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.system-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.system-info-grid > .card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.system-info-list,
.system-update-box,
.system-stat-grid,
.system-check-list {
  display: grid;
  gap: 10px;
}

.system-info-list,
.system-update-box,
.system-stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.system-update-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.system-update-form label {
  min-width: 0;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.system-update-form input,
.system-update-form select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
}

.system-update-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.system-update-actions form,
.system-update-actions .button {
  width: 100%;
}

.system-update-log {
  max-height: 152px;
  display: grid;
  gap: 5px;
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
}

.system-update-log strong {
  color: var(--text);
}

.system-update-log span {
  color: var(--muted);
}

.system-info-list div,
.system-update-box div,
.system-stat-grid div,
.system-check-list div {
  min-width: 0;
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.system-check-list div {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.system-info-grid > .card > .system-check-list {
  flex: 1;
  grid-auto-rows: minmax(48px, 1fr);
}

.system-info-list span,
.system-update-box span,
.system-stat-grid span,
.system-check-list span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.system-check-list small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-info-list strong,
.system-update-box strong,
.system-stat-grid strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-stat-grid strong {
  font-family: var(--font-mono);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.dashboard-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 160px;
  padding: 10px 4px 0;
}

.chart-bar-wrap {
  display: grid;
  grid-template-rows: 20px minmax(40px, 1fr) 22px;
  justify-items: center;
  gap: 4px;
  min-width: 0;
}

.chart-bar-wrap .chart-value {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.chart-bar-wrap .chart-bar {
  width: min(44px, 100%);
  border-radius: 6px 6px 0 0;
  background: var(--text);
  transition: height 0.35s var(--ease-soft);
}

.chart-bar-wrap .chart-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

/* Dashboard admin table */
[data-admin-dashboard-recent] {
  width: 100%;
  min-width: max-content;
}

[data-admin-dashboard-recent] th:nth-child(1),
[data-admin-dashboard-recent] td:nth-child(1) {
  width: 72px;
}

[data-admin-dashboard-recent] th:nth-child(2),
[data-admin-dashboard-recent] td:nth-child(2) {
  width: 100px;
}

[data-admin-dashboard-recent] th:nth-child(3),
[data-admin-dashboard-recent] td:nth-child(3) {
  width: 72px;
}

[data-admin-dashboard-recent] th:nth-child(4),
[data-admin-dashboard-recent] td:nth-child(4) {
  width: 96px;
}

[data-admin-dashboard-recent] th:nth-child(5),
[data-admin-dashboard-recent] td:nth-child(5) {
  width: 88px;
}

[data-admin-dashboard-recent] th:nth-child(6),
[data-admin-dashboard-recent] td:nth-child(6) {
  width: 160px;
}

/* Admin Tables */
table[data-admin-records] {
  min-width: 1240px;
}

table[data-admin-records] th:nth-child(1),
table[data-admin-records] td:nth-child(1) {
  width: 64px;
  text-align: center;
}

table[data-admin-records] th:nth-child(2),
table[data-admin-records] td:nth-child(2) {
  width: 110px;
}

table[data-admin-records] th:nth-child(3),
table[data-admin-records] td:nth-child(3) {
  width: 92px;
}

table[data-admin-records] th:nth-child(4),
table[data-admin-records] td:nth-child(4) {
  width: 130px;
}

table[data-admin-records] th:nth-child(5),
table[data-admin-records] td:nth-child(5) {
  width: 88px;
}

table[data-admin-records] th:nth-child(6),
table[data-admin-records] td:nth-child(6) {
  width: 92px;
}

table[data-admin-records] th:nth-child(8),
table[data-admin-records] td:nth-child(8) {
  width: 176px;
}

table[data-admin-records] th:nth-child(9),
table[data-admin-records] td:nth-child(9) {
  width: 150px;
}

table[data-admin-recharge-orders] {
  min-width: 1380px;
  table-layout: auto;
}

table[data-admin-recharge-orders] th,
table[data-admin-recharge-orders] td {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  vertical-align: middle;
  word-break: normal;
}

table[data-admin-recharge-orders] .table-primary-text {
  display: inline;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  word-break: normal;
}

table[data-admin-recharge-orders] .table-subtext {
  white-space: nowrap;
  word-break: normal;
}

table[data-admin-recharge-orders] th:nth-child(10),
table[data-admin-recharge-orders] td:nth-child(10) {
  width: 170px;
}

[data-admin-users] {
  min-width: 1760px;
  table-layout: auto;
}

[data-admin-users] th,
[data-admin-users] td {
  overflow: visible;
  text-overflow: clip;
}

[data-admin-users] .table-primary-text {
  display: inline;
  overflow: visible;
  text-overflow: clip;
}

[data-admin-users] th:nth-child(1),
[data-admin-users] td:nth-child(1) {
  width: 160px;
}

[data-admin-users] th:nth-child(2),
[data-admin-users] td:nth-child(2) {
  width: 360px;
}

[data-admin-users] th:nth-child(3),
[data-admin-users] td:nth-child(3),
[data-admin-users] th:nth-child(4),
[data-admin-users] td:nth-child(4),
[data-admin-users] th:nth-child(5),
[data-admin-users] td:nth-child(5) {
  width: 96px;
}

[data-admin-users] th:nth-child(6),
[data-admin-users] td:nth-child(6) {
  width: 100px;
}

[data-admin-users] th:nth-child(7),
[data-admin-users] td:nth-child(7) {
  width: 220px;
}

[data-admin-users] th:nth-child(8),
[data-admin-users] td:nth-child(8) {
  width: 260px;
}

[data-admin-users] th:nth-child(9),
[data-admin-users] td:nth-child(9) {
  width: 330px;
}

[data-admin-users] th:nth-child(10),
[data-admin-users] td:nth-child(10) {
  width: 180px;
}

[data-admin-users] th:nth-child(11),
[data-admin-users] td:nth-child(11) {
  width: 210px;
}

[data-admin-logs] {
  min-width: 1180px;
}

[data-admin-logs] th:nth-child(1),
[data-admin-logs] td:nth-child(1) {
  width: 76px;
}

[data-admin-logs] th:nth-child(2),
[data-admin-logs] td:nth-child(2) {
  width: 170px;
}

[data-admin-logs] th:nth-child(3),
[data-admin-logs] td:nth-child(3) {
  width: 140px;
}

[data-admin-logs] th:nth-child(4),
[data-admin-logs] td:nth-child(4) {
  width: 300px;
}

[data-admin-logs] th:nth-child(5),
[data-admin-logs] td:nth-child(5) {
  width: 150px;
}

[data-admin-logs] th:nth-child(6),
[data-admin-logs] td:nth-child(6) {
  width: 96px;
}

[data-admin-logs] th:nth-child(7),
[data-admin-logs] td:nth-child(7) {
  width: 180px;
}

[data-admin-logs] th,
[data-admin-logs] td {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  vertical-align: middle;
  word-break: normal;
}

[data-admin-codes] {
  min-width: 1160px;
}

[data-admin-codes] th:nth-child(1),
[data-admin-codes] td:nth-child(1) {
  width: 230px;
}

[data-admin-codes] th:nth-child(2),
[data-admin-codes] td:nth-child(2),
[data-admin-codes] th:nth-child(3),
[data-admin-codes] td:nth-child(3),
[data-admin-codes] th:nth-child(4),
[data-admin-codes] td:nth-child(4),
[data-admin-codes] th:nth-child(5),
[data-admin-codes] td:nth-child(5) {
  width: 96px;
}

[data-admin-codes] th:nth-child(6),
[data-admin-codes] td:nth-child(6),
[data-admin-codes] th:nth-child(8),
[data-admin-codes] td:nth-child(8) {
  width: 170px;
}

[data-admin-codes] th:nth-child(7),
[data-admin-codes] td:nth-child(7) {
  width: 120px;
}

[data-admin-codes] th:nth-child(9),
[data-admin-codes] td:nth-child(9) {
  width: 150px;
}

[data-admin-notices] {
  min-width: 960px;
}

[data-admin-notices] th:nth-child(1),
[data-admin-notices] td:nth-child(1) {
  width: 82px;
}

[data-admin-notices] th:nth-child(2),
[data-admin-notices] td:nth-child(2) {
  width: 300px;
}

[data-admin-notices] th:nth-child(3),
[data-admin-notices] td:nth-child(3) {
  width: 100px;
}

[data-admin-notices] th:nth-child(4),
[data-admin-notices] td:nth-child(4) {
  width: 120px;
}

[data-admin-notices] th:nth-child(5),
[data-admin-notices] td:nth-child(5) {
  width: 170px;
}

[data-admin-notices] th:nth-child(6),
[data-admin-notices] td:nth-child(6) {
  width: 280px;
}

.notice-create-form {
  grid-template-columns: minmax(420px, 1fr) minmax(220px, 0.42fr);
  align-items: stretch;
  gap: 16px;
}

.notice-create-aside {
  min-width: 0;
  display: grid;
  align-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 18px;
  background: var(--surface-soft);
}

.notice-create-aside strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.notice-create-aside span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.notice-create-aside .button {
  width: 100%;
  align-self: end;
}

.notice-editor-fields {
  min-width: 0;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 18px;
  background: rgba(255, 255, 255, 0.48);
}

.notice-create-form .field textarea {
  min-height: 156px;
  resize: vertical;
}

[data-admin-credit-transactions] {
  min-width: 1160px;
}

[data-admin-credit-transactions] th:nth-child(1),
[data-admin-credit-transactions] td:nth-child(1) {
  width: 140px;
}

[data-admin-credit-transactions] th:nth-child(2),
[data-admin-credit-transactions] td:nth-child(2) {
  width: 132px;
}

[data-admin-credit-transactions] th:nth-child(3),
[data-admin-credit-transactions] td:nth-child(3),
[data-admin-credit-transactions] th:nth-child(4),
[data-admin-credit-transactions] td:nth-child(4),
[data-admin-credit-transactions] th:nth-child(5),
[data-admin-credit-transactions] td:nth-child(5) {
  width: 92px;
}

[data-admin-credit-transactions] th:nth-child(6),
[data-admin-credit-transactions] td:nth-child(6) {
  width: 140px;
}

[data-admin-credit-transactions] th:nth-child(8),
[data-admin-credit-transactions] td:nth-child(8) {
  width: 170px;
}

[data-user-credit-transactions] {
  min-width: 1040px;
}

[data-user-credit-transactions] th:nth-child(1),
[data-user-credit-transactions] td:nth-child(1) {
  width: 132px;
}

[data-user-credit-transactions] th:nth-child(2),
[data-user-credit-transactions] td:nth-child(2),
[data-user-credit-transactions] th:nth-child(3),
[data-user-credit-transactions] td:nth-child(3),
[data-user-credit-transactions] th:nth-child(4),
[data-user-credit-transactions] td:nth-child(4) {
  width: 92px;
}

[data-user-credit-transactions] th:nth-child(5),
[data-user-credit-transactions] td:nth-child(5) {
  width: 140px;
}

[data-user-credit-transactions] th:nth-child(7),
[data-user-credit-transactions] td:nth-child(7) {
  width: 170px;
}

.credit-positive strong {
  color: var(--success);
}

.credit-negative strong {
  color: var(--danger);
}

.user-credit-filter {
  grid-template-columns: minmax(110px, 1fr) minmax(90px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr) auto;
}

.admin-credit-filter {
  grid-template-columns: minmax(120px, 1fr) minmax(110px, 1fr) minmax(90px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr) auto;
}

.invite-table-cell {
  max-width: 170px;
  display: grid;
  gap: 4px;
  line-height: 1.3;
}

.invite-table-cell strong {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-table-cell span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-link-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 12px;
  background: transparent;
}

.invite-link-panel div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.invite-link-panel span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
}

.invite-link-panel strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Center Auth */
body.page-auth:has(.center-auth-page) {
  min-height: 100vh;
  background: var(--bg);
}

body.page-auth:has(.center-auth-page) .app-shell {
  width: min(100% - 36px, 430px);
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding: 28px 0 34px;
}

body.page-auth:has(.center-auth-register) .app-shell {
  width: min(100% - 36px, 460px);
}

.center-auth-page {
  width: 100%;
  align-self: center;
  display: grid;
  place-items: center;
  padding: 0;
}

.center-auth-panel {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px;
  background: var(--surface);
}

.center-auth-top {
  margin-bottom: 28px;
  padding: 0;
  background: transparent;
}

.center-auth-brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto 24px;
  color: var(--text);
  text-align: center;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.center-auth-brand:hover {
  opacity: 0.8;
}

.center-auth-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  background: var(--text);
  color: #fff;
  font-size: 19px;
  font-weight: 600;
}

.center-auth-mark svg {
  width: 34px;
  height: 34px;
  display: block;
}

.center-auth-mark .icon-frame,
.center-auth-mark .icon-line,
.center-auth-mark .icon-dot {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.center-auth-mark .ai-spark {
  fill: rgba(255, 255, 255, 0.45);
  stroke: #fff;
  stroke-width: 0.5;
}

.center-auth-mark .ai-spark.small {
  fill: #fff;
  stroke: none;
  opacity: 0.8;
}

.center-auth-brand strong {
  display: block;
  color: var(--text);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.center-auth-brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
}

.center-auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 4px;
  background: var(--surface-soft);
}

.center-auth-tabs .center-auth-tab {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.center-auth-tabs .center-auth-tab.active {
  background: var(--primary-bg);
  color: var(--primary-inverse);
}

.center-auth-tabs .center-auth-tab:not(.active):hover {
  color: var(--text);
}

.center-auth-body {
  padding: 0;
  margin-top: 24px;
  min-height: 320px;
}

.center-auth-form {
  display: grid;
  gap: 14px;
}

.center-auth-register .center-auth-form {
  gap: 12px;
}

.center-auth-field {
  display: grid;
  gap: 7px;
}

.center-auth-field span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.center-auth-field input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.center-auth-field input::placeholder {
  color: var(--placeholder);
}

.center-auth-field input:hover {
  border-color: var(--line-hover);
}

.center-auth-field input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.center-auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 8px;
}

.center-auth-code-row button {
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.center-auth-code-row button:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.center-auth-code-row button:disabled {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted-light);
  cursor: not-allowed;
}

.center-auth-captcha {
  display: flex;
  align-items: center;
  gap: 8px;
}

.center-auth-captcha img {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  height: 44px;
  flex-shrink: 0;
  cursor: pointer;
}

.center-auth-captcha input {
  height: 44px;
  flex: 1;
  min-width: 0;
}

.center-auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -4px;
}

.center-auth-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.center-auth-options input {
  width: 16px;
  height: 16px;
  min-width: 16px;
}

.center-auth-options button {
  flex: 0 0 auto;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.center-auth-options button:hover {
  color: var(--muted);
}

.center-auth-submit {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--primary-bg);
  color: var(--primary-inverse);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
  letter-spacing: -0.01em;
}

.center-auth-submit:hover {
  opacity: 0.88;
}

.center-auth-submit:active {
  transform: scale(0.985);
}

.center-auth-agreement {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.7;
  text-align: center;
}

.center-auth-agreement a {
  color: var(--text-soft);
  font-weight: 500;
  text-decoration: none;
}

.center-auth-agreement a:hover {
  color: var(--text);
}

.reset-password-dialog {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.40);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: overlayIn 0.22s var(--ease-out);
}

.reset-password-panel {
  width: min(430px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
  animation: panelIn 0.28s var(--ease-soft);
}

.reset-password-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
  background: var(--surface);
}

.reset-password-form {
  padding: 20px;
}

.reset-method-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-soft);
}

.reset-method-toggle button {
  min-height: 36px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

.reset-method-toggle button.active {
  background: var(--primary-bg);
  color: var(--primary-inverse);
}

.reset-method-panel {
  display: grid;
  gap: 14px;
}

/* Legal */
.legal-dialog-close {
  position: sticky;
  top: 14px;
  z-index: 2;
  float: right;
  margin: 14px 14px -48px 0;
  background: rgba(255, 255, 255, 0.94);
}

.legal-dialog-section {
  clear: both;
}

.legal-page {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 24px 0 48px;
}

.legal-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.legal-head {
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 32px 34px 26px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.025), rgba(0, 0, 0, 0));
}

.legal-head h1 {
  margin: 0;
  color: var(--text);
  font-size: 30px;
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.legal-head p {
  max-width: 760px;
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.85;
}

.legal-updated {
  color: var(--muted) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
}

.legal-content {
  display: grid;
  gap: 18px;
  padding: 28px 34px 36px;
}

.legal-note {
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 13px 14px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.75;
}

.legal-section {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.legal-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.legal-content h2 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.35;
}

.legal-content p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.9;
}

.legal-section-lead {
  color: var(--text-soft);
}

.legal-clause-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legal-clause-list li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.85;
}

.legal-clause-index {
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.legal-dialog .legal-head {
  padding-right: 92px;
}

/* Animations */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes imageLoadingSweep {
  to {
    background-position: -180% 0, 0 0;
  }
}

@keyframes imageFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes inspirationPromptBorder {
  0%,
  100% {
    border-color: rgba(0, 0, 0, 0.065);
  }

  50% {
    border-color: rgba(0, 0, 0, 0.16);
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }

  50% {
    transform: translateY(-7px);
    opacity: 1;
  }
}

@keyframes progress {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(260%);
  }
}

@keyframes fadeLift {
  from {
    transform: translateY(8px) scale(0.985);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes overlayIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes overlayOut {
  to {
    opacity: 0;
  }
}

@keyframes panelIn {
  from {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes panelOut {
  to {
    transform: translateY(10px) scale(0.985);
    opacity: 0;
  }
}

@keyframes viewerIn {
  from {
    transform: scale(0.985);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes toastIn {
  from {
    transform: translateX(18px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastOut {
  to {
    transform: translateX(18px);
    opacity: 0;
  }
}

/* Transitions */
a,
button,
.button,
.site-nav a,
.site-action:not(.site-action-primary),
.mode-toggle label,
.theme-preset-option,
.record-card,
.stat-card,
.table-thumb,
.record-input-image-button,
.record-dialog-image-button,
.dialog-close,
input,
select,
textarea {
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.record-card:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.redeem-dialog,
.change-password-dialog,
.real-name-dialog,
.profile-edit-dialog,
.admin-user-dialog,
.notice-dialog,
.admin-notice-dialog,
.record-dialog,
.generation-overlay,
.legal-dialog {
  animation: overlayIn 0.22s var(--ease-out);
}

.redeem-panel,
.change-password-panel,
.real-name-panel,
.profile-edit-dialog-panel,
.admin-user-panel,
.notice-panel,
.admin-notice-panel,
.record-dialog-panel,
.legal-dialog-panel,
.generation-modal {
  animation: panelIn 0.28s var(--ease-soft);
}

.preview-stage img {
  animation: fadeLift 0.42s var(--ease-soft);
}

.preview-stage {
  position: relative;
  box-shadow: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .image-loading-wrap::before {
    animation: none;
  }
}

/* Responsive */
@media (max-width: 1280px) {
  body.page-records .history-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-record-card-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media (max-width: 1180px) {
  .app-shell {
    --shell-gutter: 24px;
  }

  .history-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .code-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-topbar {
    grid-template-columns: 1fr;
    gap: 12px;
    position: static;
  }

  .topbar-right {
    justify-content: flex-start;
  }

  .two-col,
  .narrow-left,
  .auth-dashboard,
  .settings-page,
  .dashboard-row {
    grid-template-columns: 1fr;
  }

  .auth-info,
  .auth-form-card {
    min-height: auto;
  }

  .auth-info {
    gap: 28px;
  }

  .preview-card {
    grid-template-rows: auto minmax(300px, auto);
  }

  .preview-stage {
    min-height: 300px;
  }

  .code-create-form .button {
    width: 100%;
  }

  .notice-create-form {
    grid-template-columns: 1fr;
  }

  .notice-create-aside,
  .notice-editor-fields {
    padding: 14px;
  }

  .notice-create-form .button {
    width: 100%;
  }

  .cloud-storage-card {
    grid-column: auto;
  }

  .cloud-storage-grid,
  .storage-options-grid {
    grid-template-columns: 1fr;
  }

  .settings-tab-nav {
    gap: 4px;
    padding: 4px;
  }

  .settings-tab-nav button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
  }
}

@media (max-width: 980px) {
  body.page-admin .mobile-form-toggle {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-full);
    padding: 0 14px;
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: left;
  }

  body.page-admin .mobile-form-toggle:hover,
  body.page-admin .mobile-form-toggle:focus-visible {
    border-color: var(--line-hover);
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
  }

  body.page-admin .mobile-form-toggle::after {
    content: "";
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
  }

  body.page-admin .mobile-form-toggle[aria-expanded="true"]::after {
    transform: rotate(225deg) translateY(-2px);
  }

  body.page-admin .mobile-collapsible-form.is-mobile-collapsed {
    display: none !important;
  }

  body.page-admin .mobile-collapsible-form.is-mobile-expanded {
    margin-top: 10px;
    margin-bottom: 12px;
  }

  body.page-admin .filter-bar.mobile-collapsible-form.is-mobile-expanded {
    margin-bottom: 12px;
  }

  body.page-admin .filter-bar,
  body.page-admin .filter-bar.admin-record-filter,
  body.page-admin .filter-bar.admin-user-filter,
  body.page-admin .filter-bar.admin-log-filter,
  body.page-admin .filter-bar.admin-code-filter,
  body.page-admin .admin-credit-filter {
    grid-template-columns: 1fr;
    gap: 10px;
    max-width: 100%;
    padding: 12px;
  }

  body.page-admin .filter-bar .field,
  body.page-admin .filter-bar .filter-actions {
    width: 100%;
    max-width: 100%;
  }

  body.page-admin .filter-bar input,
  body.page-admin .filter-bar select,
  body.page-admin .filter-bar textarea {
    min-width: 0;
    max-width: 100%;
  }

  body.page-admin .filter-bar input[type="date"],
  body.page-admin .filter-bar input[type="datetime-local"],
  body.page-admin .filter-bar input[type="time"] {
    appearance: none;
    -webkit-appearance: none;
  }
}

@media (max-width: 720px) {

  /* ── Shell & Page ── */
  body.page-app,
  body.page-records,
  body.page-inspirations,
  body.page-credits,
  body.page-profile,
  body.page-admin {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    position: relative;
    touch-action: pan-y;
  }

  .app-shell {
    --shell-gutter: 14px;
    padding: 86px 0 100px;
    max-width: 100%;
    overflow-x: hidden;
  }

  body.page-admin .section-card {
    margin-top: 0;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 18px;
  }

  .eyebrow {
    font-size: 9px;
  }

  /* ── Cards ── */
  .card,
  .stat-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    padding: 14px;
    border-radius: var(--radius-sm);
  }

  .card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 0;
    margin-bottom: 12px;
    flex-wrap: wrap;
  }

  .card-head-actions {
    width: auto;
    min-width: 0;
    justify-self: end;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  /* ── Forms & Fields ── */
  .mobile-form-toggle {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-full);
    padding: 0 14px;
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: left;
  }

  .card-head+.mobile-form-toggle,
  .generation-notice+.mobile-form-toggle,
  .invite-link-panel+.mobile-form-toggle {
    margin-top: 0;
  }

  .mobile-form-toggle:hover,
  .mobile-form-toggle:focus-visible {
    border-color: var(--line-hover);
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
  }

  .mobile-form-toggle::after {
    content: "";
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
  }

  .mobile-form-toggle[aria-expanded="true"]::after {
    transform: rotate(225deg) translateY(-2px);
  }

  .mobile-collapsible-form.is-mobile-collapsed {
    display: none !important;
  }

  .mobile-collapsible-form.is-mobile-expanded {
    margin-top: 10px;
    margin-bottom: 12px;
  }

  .filter-bar.mobile-collapsible-form.is-mobile-expanded {
    margin-bottom: 12px;
  }

  body.page-records .records-page-card>.mobile-form-toggle,
  body.page-credits .credits-page-card>.mobile-form-toggle {
    margin-bottom: 2px;
  }

  body.page-records .records-page-card>.filter-bar.mobile-collapsible-form.is-mobile-expanded,
  body.page-credits .credits-page-card>.filter-bar.mobile-collapsible-form.is-mobile-expanded {
    margin-top: 0;
    margin-bottom: 2px;
  }

  .field-grid,
  .prompt-api-grid,
  .auth-metrics,
  .filter-bar,
  .filter-bar.user-record-filter,
  .filter-bar.admin-user-filter,
  .filter-bar.admin-log-filter,
  .filter-bar.admin-code-filter,
  .filter-bar.admin-record-filter,
  .code-create-form,
  .user-credit-filter,
  .admin-credit-filter,
  .invite-link-panel {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    gap: 10px;
    max-width: 100%;
    padding: 12px;
  }

  .filter-bar .field,
  .filter-bar .filter-actions {
    width: 100%;
    max-width: 100%;
  }

  .filter-bar input,
  .filter-bar select,
  .filter-bar textarea {
    min-width: 0;
    max-width: 100%;
  }

  .filter-bar input[type="date"],
  .filter-bar input[type="datetime-local"],
  .filter-bar input[type="time"] {
    appearance: none;
    -webkit-appearance: none;
  }

  .generation-options-grid.is-single-count {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .generation-options-grid.is-single-count .option-size {
    grid-column: 1 / -1;
  }

  .filter-actions {
    width: auto;
    min-width: 0;
    justify-self: end;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
    white-space: normal;
  }

  .filter-actions .button {
    max-width: 100%;
    min-width: 0;
    white-space: nowrap;
  }

  .generate-actions .button {
    font-size: 13px;
    padding: 0 12px;
  }

  input,
  select {
    height: 44px;
  }

  textarea {
    min-height: 138px;
  }

  .button {
    min-height: 44px;
    width: auto;
    font-size: 14px;
  }

  .mode-toggle label {
    min-height: 40px;
    font-size: 14px;
  }

  .invite-link-panel {
    gap: 10px;
  }

  .invite-link-panel .button {
    width: 100%;
  }

  .profile-hero {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }

  .profile-hero-account {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
  }

  .profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    font-size: 22px;
  }

  .profile-hero-copy h1 {
    font-size: 22px;
  }

  .profile-hero-copy>span {
    font-size: 12px;
  }

  .profile-hero-metrics {
    width: 100%;
    justify-self: stretch;
    min-height: 42px;
    justify-content: stretch;
    gap: 6px;
    overflow: hidden;
    padding: 6px;
  }

  .profile-hero-metrics span {
    flex: 1 1 0;
    min-width: 0;
    min-height: 28px;
    padding: 0 9px;
    font-size: 11px;
  }

  .profile-hero-actions {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .profile-hero-actions .button {
    min-width: 0;
    justify-content: center;
    padding-right: 10px;
    padding-left: 10px;
  }

  .profile-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .profile-stat-card {
    padding: 14px;
  }

  .profile-content-grid {
    grid-template-columns: 1fr;
  }

  .profile-section {
    padding: 16px;
    gap: 14px;
  }

  .profile-overview-section {
    padding: 16px;
  }

  .profile-section-head {
    align-items: flex-start;
  }

  .profile-form-actions,
  .profile-action-list {
    display: grid;
    grid-template-columns: 1fr;
  }

  .profile-form-actions .button,
  .profile-action-list .button {
    width: 100%;
  }

  .profile-info-row {
    grid-template-columns: 82px minmax(0, 1fr);
    min-height: 52px;
    gap: 10px;
  }

  .profile-info-action-row {
    grid-template-columns: 82px minmax(0, 1fr) auto;
  }

  .profile-info-action-row .button {
    grid-column: auto;
    justify-self: end;
    padding-right: 10px;
    padding-left: 10px;
  }

  .profile-info-action-row em {
    grid-column: auto;
    justify-self: end;
  }

  .profile-manage-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
  }

  .profile-manage-row small {
    display: none;
  }

  .profile-invite-panel {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }

  .profile-invite-copy h2 {
    font-size: 18px;
  }

  .profile-invite-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-invite-stat {
    padding: 10px;
  }

  .profile-invite-link {
    padding: 12px;
  }

  .profile-invite-panel .button {
    width: 100%;
    justify-self: stretch;
  }

  .generation-notice {
    font-size: 12px;
    padding: 10px;
    line-height: 1.6;
  }

  .edit-upload-field {
    min-width: 0;
  }

  .edit-upload-field>span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .edit-upload-box {
    min-height: 76px;
  }

  .edit-upload-preview {
    flex-wrap: nowrap;
    min-width: 0;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .edit-preview-item {
    width: 76px;
    min-width: 76px;
    flex: 0 0 76px;
  }

  .edit-upload-field.has-preview {
    grid-template-columns: minmax(0, 1fr) 76px;
    align-items: start;
  }

  .edit-upload-field.has-preview .edit-upload-box {
    width: 76px;
    min-width: 76px;
    height: 76px;
    min-height: 76px;
    padding: 8px;
  }

  .edit-upload-field.has-preview .edit-upload-icon {
    width: 32px;
    height: 32px;
    font-size: 22px;
  }

  .edit-upload-field.has-preview .edit-upload-box>div:not(.edit-upload-icon) {
    display: none;
  }

  .edit-preview-item button {
    right: 4px;
    bottom: 4px;
    padding: 3px 6px;
    font-size: 10px;
  }

  /* ── Records List ── */
  .history-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body.page-records .history-list {
    grid-template-columns: 1fr;
  }

  .admin-record-card-list {
    grid-template-columns: 1fr;
  }

  .history-list .record-card {
    height: auto;
    min-height: 148px;
    grid-template-columns: 100px minmax(0, 1fr);
    grid-template-rows: 1fr;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
  }

  .history-list .admin-record-card {
    height: auto;
    min-height: 148px;
    grid-template-rows: 1fr;
    align-items: stretch;
  }

  .history-list .admin-record-card .record-image {
    height: 100%;
    max-height: 128px;
    min-height: 0;
    align-self: stretch;
  }

  .history-list .admin-record-card .record-body {
    gap: 3px;
    padding-top: 2px;
    padding-bottom: 0;
  }

  .history-list .admin-record-card .admin-record-card-head {
    min-height: 12px;
    font-size: 10px;
    line-height: 1.2;
  }

  .history-list .admin-record-card .record-summary {
    min-height: 0;
    max-height: none;
    line-height: 1.4;
  }

  .history-list .record-image {
    width: 100px;
    height: 128px;
    min-height: 128px;
    border-radius: var(--radius-xs);
  }

  .history-list.admin-record-card-list .admin-record-card {
    grid-template-columns: 100px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
  }

  .history-list.admin-record-card-list .admin-record-card .record-image {
    width: 100px;
    height: 100%;
    max-height: 128px;
    min-height: 0 !important;
    align-self: stretch;
  }

  .history-list.admin-record-card-list .admin-record-card .record-image img {
    height: 100%;
    object-fit: cover;
  }

  .admin-record-card-id {
    top: 6px;
    right: 6px;
    padding: 2px 7px;
    font-size: 10px;
  }

  .history-list .record-image::after {
    display: none;
  }

  .history-list .record-body {
    gap: 5px;
    padding: 4px 4px 2px;
  }

  .history-list .record-body p {
    font-size: 12px;
    line-height: 1.5;
  }

  .history-list .record-meta span {
    font-size: 10px;
  }

  .history-list .record-foot {
    gap: 7px;
    padding: 8px 0 2px;
  }

  .history-list .record-foot-row {
    gap: 4px;
  }

  .history-list .record-foot-row time {
    font-size: 10px;
  }

  .record-duration {
    font-size: 9px;
  }

  .history-list .record-delete,
  .history-list .record-regenerate,
  .history-list .record-edit-again,
  .history-list .record-inspiration {
    min-width: 48px;
    min-height: 30px;
    padding: 0 11px;
    font-size: 12px;
    line-height: 1;
    border-radius: var(--radius-full);
  }

  .history-list .record-foot-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }

  .history-list .admin-record-card .record-foot {
    gap: 4px;
    padding: 5px 0 0;
  }

  .history-list .admin-record-card .record-foot-actions {
    gap: 4px;
  }

  .history-list .admin-record-card .record-delete,
  .history-list .admin-record-card .record-regenerate,
  .history-list .admin-record-card .record-inspiration {
    min-height: 28px;
    padding-right: 9px;
    padding-left: 9px;
    font-size: 11px;
  }

  .inline-inspiration-form {
    flex-wrap: nowrap;
  }

  .inspiration-tag-input {
    width: 64px;
    min-height: 30px;
    height: 30px;
  }

  .record-status-overlay {
    min-width: 44px;
    min-height: 20px;
    padding: 0 10px;
    font-size: 10px;
  }

  /* ── Bulk Actions ── */
  .record-bulk-actions {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px;
  }

  .record-bulk-check {
    min-width: 0;
    flex: 1 1 auto;
    white-space: nowrap;
  }

  .record-bulk-actions .button.danger.small {
    width: auto;
    min-height: 34px;
    flex: 0 0 auto;
    justify-content: center;
    padding: 0 14px;
  }

  .record-select {
    top: 6px;
    left: 6px;
    width: 18px;
    height: 18px;
  }

  .record-select::after {
    width: 7px;
    height: 4px;
  }

  /* ── Pagination ── */
  .pagination {
    gap: 8px;
    margin-top: 14px;
    padding-top: 2px;
  }

  .pagination .button {
    flex: 1 1 0;
    min-width: 112px;
    max-width: 168px;
    min-height: 38px;
    padding: 0 14px;
    font-size: 13px;
  }

  .pagination span {
    min-width: 100%;
    order: -1;
    font-size: 13px;
    text-align: center;
  }

  /* ── All Dialogs Mobile ── */
  .record-dialog,
  .legal-dialog,
  .generation-overlay {
    align-items: start;
    justify-items: stretch;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }

  .redeem-dialog,
  .change-password-dialog,
  .real-name-dialog,
  .profile-edit-dialog,
  .admin-user-dialog,
  .admin-detail-dialog {
    align-items: end;
    justify-items: stretch;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }

  /* ── Append Dialog ── */
  .record-append-dialog {
    align-items: end;
    padding: 8px;
  }

  .record-append-panel {
    width: 100%;
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  .record-append-form {
    padding: 14px;
    gap: 12px;
  }

  .record-append-reference-image {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
    padding: 6px;
  }

  .record-append-reference-image img {
    width: 64px;
    height: 64px;
  }

  .record-append-result-head {
    align-items: flex-start;
  }

  .record-append-result-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .record-append-result-option {
    width: 88px;
    min-width: 88px;
    flex: 0 0 88px;
  }

  .record-append-charge {
    align-items: flex-start;
    padding: 10px;
  }

  .record-append-charge strong {
    font-size: 14px;
  }

  .record-append-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .record-append-actions .button {
    min-width: 0;
    width: 100%;
    min-height: 42px;
  }

  /* ── Redeem ── */
  .redeem-panel,
  .change-password-panel,
  .real-name-panel,
  .profile-edit-dialog-panel,
  .admin-user-panel,
  .admin-detail-panel {
    width: 100%;
    max-height: calc(100dvh - 20px - env(safe-area-inset-bottom));
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  .generation-modal {
    width: 100%;
    border-radius: var(--radius-sm);
  }

  .redeem-head {
    padding: 14px;
  }

  .redeem-form,
  .recharge-form,
  .change-password-form,
  .real-name-form,
  .profile-dialog-form {
    padding: 14px;
  }

  .redeem-tabs {
    padding: 10px 14px;
  }

  .recharge-package-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .recharge-package-grid > .recharge-package-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .recharge-package-card {
    min-height: 86px;
    padding: 11px 12px;
  }

  .recharge-package-card strong {
    font-size: 12px;
  }

  .recharge-package-card span {
    font-size: 18px;
  }

  .recharge-package-card em {
    font-size: 11px;
  }

  .recharge-channel-grid {
    grid-template-columns: 1fr;
  }

  .profile-code-row {
    grid-template-columns: 1fr;
  }

  .profile-code-row .button {
    width: 100%;
    min-width: 0;
  }

  .admin-user-edit-form {
    padding: 14px;
  }

  .admin-user-edit-grid {
    grid-template-columns: 1fr;
  }

  .admin-detail-body {
    padding: 14px calc(14px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  }

  .admin-detail-grid {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .admin-log-context-code {
    max-height: calc(100dvh - 170px - env(safe-area-inset-bottom));
    font-size: 12px;
  }

  /* ── Preview Stage ── */
  .preview-card {
    grid-template-rows: auto minmax(220px, auto);
  }

  .preview-stage {
    min-height: 220px;
  }

  .generation-progress-card {
    width: calc(100% - 16px);
    padding: 14px;
  }

  .generation-progress-grid strong {
    font-size: 18px;
  }

  /* ── Auth ── */
  .auth-dashboard {
    gap: 12px;
  }

  .auth-info,
  .auth-form-card {
    padding: 18px;
    min-height: auto;
  }

  .auth-info h2 {
    font-size: 24px;
  }

  .auth-metrics {
    gap: 10px;
  }

  .auth-metrics div {
    min-height: 76px;
    padding: 12px;
  }

  /* ── Admin ── */
  body.page-admin .admin-nav {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .system-info-metrics,
  .system-info-grid,
  .system-info-list,
  .system-update-box,
  .system-update-form,
  .system-update-actions,
  .system-stat-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-row {
    grid-template-columns: 1fr;
  }

  .dashboard-today {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .dashboard-today-item strong {
    font-size: 24px;
  }

  .dashboard-today-item .dashboard-worker-state {
    font-size: 18px;
  }

  .dashboard-today-item {
    min-height: 64px;
    padding: 10px 8px;
  }

  .dashboard-worker-meta {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .dashboard-worker-meta span {
    padding: 9px 10px;
  }

  .dashboard-worker-meta strong {
    font-size: 12px;
  }

  .chart-bar-wrap .chart-bar {
    width: min(28px, 100%);
  }

  .settings-tab-nav {
    gap: 4px;
    padding: 4px;
  }

  .settings-tab-nav button {
    padding: 0 8px;
    font-size: 12px;
    min-height: 36px;
  }

  .runtime-settings-form,
  .settings-basic-form,
  .text-ai-settings-form {
    gap: 16px;
  }

  .settings-section {
    gap: 12px;
    padding-top: 16px;
  }

  .settings-section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .settings-section-head em {
    align-self: flex-start;
  }

  .settings-switch-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .settings-verify-toggle {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .recharge-switch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-subtabs {
    gap: 12px;
    padding: 12px;
    border-radius: calc(var(--radius-xs) + 2px);
    background: rgba(255, 255, 255, 0.42);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(14px) saturate(140%);
  }

  .alipay-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-subtab-nav {
    display: flex;
    grid-template-columns: none;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px;
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.68);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .settings-subtab-nav button {
    flex: 0 0 auto;
    min-height: 40px;
    min-width: 108px;
    padding: 6px 8px;
    border-radius: calc(var(--radius-xs) - 1px);
    white-space: nowrap;
    text-align: center;
    line-height: 1.2;
  }

  .settings-subtab-panel {
    gap: 12px;
  }

  .settings-subtab-panel .field-grid {
    gap: 10px;
  }

  .settings-subtab-panel .field span {
    line-height: 1.25;
  }

  .settings-inline-switch {
    width: 100%;
    margin-bottom: 10px;
  }

  .recharge-switch-grid .switch-field,
  .alipay-product-grid .switch-field {
    min-height: 40px;
    justify-content: center;
    gap: 6px;
    padding: 0 8px;
    font-size: 12px;
  }

  .recharge-switch-grid .switch-field input,
  .alipay-product-grid .switch-field input {
    width: 16px;
    height: 16px;
    min-width: 16px;
    background-size: 10px 8px;
  }

  .alipay-product-grid {
    gap: 8px;
  }

  .alipay-product-grid > .switch-field:last-child {
    grid-column: 1 / -1;
  }

  .recharge-package-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    gap: 8px;
  }

  .recharge-package-actions .button {
    width: 100%;
    min-width: 0;
  }

  .recharge-package-row.is-new .recharge-package-actions {
    grid-template-columns: 1fr;
  }

  .recharge-package-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
    padding: 10px;
    background: rgba(255, 255, 255, 0.46);
  }

  .recharge-package-row .field {
    gap: 6px;
  }

  .recharge-package-row .switch-field {
    min-height: 40px;
    grid-column: 1 / -1;
    justify-content: center;
    gap: 6px;
    padding: 0 8px;
    font-size: 12px;
  }

  .settings-verify-item {
    grid-template-columns: minmax(0, 1fr) 30px;
    gap: 6px 6px;
  }

  .settings-verify-item .switch-field {
    min-height: 40px;
    justify-content: center;
    gap: 6px;
    padding: 0 8px;
    font-size: 12px;
  }

  .settings-verify-item .switch-field input {
    width: 16px;
    height: 16px;
    min-width: 16px;
    background-size: 10px 8px;
  }

  .text-ai-module-toggle {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .prompt-extractor-head {
    gap: 5px 10px;
  }

  .prompt-extractor-head .badge {
    min-height: 24px;
    padding: 0 8px;
    font-size: 11px;
  }

  .prompt-extractor-actions .button {
    flex: 1 1 120px;
  }

  .prompt-switch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .prompt-switch-grid .switch-field {
    min-height: 40px;
    justify-content: center;
    gap: 6px;
    padding: 0 8px;
    font-size: 12px;
  }

  .prompt-switch-grid .switch-field input {
    width: 16px;
    height: 16px;
    min-width: 16px;
    background-size: 10px 8px;
  }

  .switch-help {
    width: 30px;
    height: 30px;
  }

  .switch-help svg {
    width: 14px;
    height: 14px;
  }

  .switch-help-panel {
    top: calc(100% + 6px);
    width: min(240px, calc(100vw - 32px));
    padding: 9px 10px;
    font-size: 11px;
  }

  .theme-preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-preview {
    align-items: stretch;
    flex-direction: column;
  }

  .theme-preview span {
    margin-right: 0;
  }

  .code-export-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .code-export-actions .button {
    width: 100%;
  }

  /* ── Toasts & Layers ── */
  .jpt-toast-stack {
    top: 10px;
    right: 8px;
    left: 8px;
    width: auto;
  }

  .jpt-toast {
    padding: 10px 14px;
    font-size: 13px;
  }

  .jpt-layer-overlay {
    align-items: end;
    padding: 8px;
  }

  .jpt-layer-panel {
    width: 100%;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  .jpt-layer-head {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
    padding: 16px 16px 12px;
  }

  .jpt-layer-icon {
    width: 32px;
    height: 32px;
  }

  .jpt-layer-head h2 {
    font-size: 16px;
  }

  .jpt-layer-head p {
    font-size: 13px;
  }

  .jpt-layer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 14px;
  }

  .jpt-layer-actions .button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .jpt-layer-actions .button:only-child {
    grid-column: 1 / -1;
  }

  /* ── Center Auth ── */
  body.page-auth:has(.center-auth-page) .app-shell {
    width: min(100% - 32px, 390px);
    padding: 14px 0 20px;
  }

  body.page-auth:has(.center-auth-register) .app-shell {
    width: min(100% - 32px, 400px);
  }

  .center-auth-page {
    padding: 0;
    align-self: start;
    padding-top: clamp(12px, 5vh, 40px);
  }

  .center-auth-panel {
    padding: 24px 18px;
    border-radius: var(--radius-sm);
  }

  .center-auth-top {
    margin-bottom: 18px;
  }

  .center-auth-brand {
    gap: 8px;
    margin-bottom: 18px;
  }

  .center-auth-mark {
    width: 40px;
    height: 40px;
  }

  .center-auth-mark svg {
    width: 28px;
    height: 28px;
  }

  .center-auth-brand strong {
    font-size: 22px;
  }

  .center-auth-brand small {
    margin-top: 3px;
    font-size: 11px;
  }

  .center-auth-tabs {
    min-height: 40px;
    border-radius: var(--radius-full);
  }

  .center-auth-tabs .center-auth-tab {
    font-size: 13px;
  }

  .center-auth-body {
    margin-top: 18px;
    min-height: 280px;
  }

  .center-auth-form {
    gap: 11px;
  }

  .center-auth-field {
    gap: 6px;
  }

  .center-auth-field span {
    font-size: 12px;
  }

  .center-auth-field input {
    height: 44px;
    border-radius: var(--radius-xs);
    font-size: 14px;
  }

  .center-auth-code-row {
    grid-template-columns: minmax(0, 1fr) 96px;
  }

  .center-auth-code-row button {
    height: 44px;
    font-size: 12px;
  }

  .center-auth-options {
    gap: 8px;
  }

  .center-auth-options label,
  .center-auth-options button {
    font-size: 12px;
  }

  .center-auth-submit {
    min-height: 44px;
    margin-top: 4px;
    font-size: 14px;
  }

  .reset-password-dialog {
    align-items: end;
    justify-items: stretch;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .reset-password-panel {
    width: 100%;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  .reset-password-head {
    padding: 14px;
  }

  .reset-password-form {
    padding: 14px;
  }

  /* ── Legal ── */
  .legal-page {
    padding: 14px 0 28px;
  }

  .legal-head {
    padding: 24px 18px 18px;
  }

  .legal-content {
    gap: 14px;
    padding: 18px;
  }

  .legal-dialog .legal-head {
    padding-right: 76px;
  }

  .legal-dialog-close {
    top: 10px;
    margin: 10px 10px -44px 0;
  }

  .legal-head h1 {
    font-size: 24px;
  }

  .legal-head p {
    font-size: 13px;
    line-height: 1.75;
  }

  .legal-note {
    padding: 11px 12px;
    font-size: 12px;
    line-height: 1.7;
  }

  .legal-section {
    gap: 8px;
    padding-top: 14px;
  }

  .legal-content h2 {
    font-size: 16px;
  }

  .legal-content p,
  .legal-clause-list li {
    font-size: 13px;
    line-height: 1.8;
  }

  .legal-clause-list li {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
  }

  .legal-clause-index {
    height: 22px;
    font-size: 11px;
  }

  .legal-dialog-panel {
    max-height: calc(100vh - 16px);
  }
}

@media (max-width: 380px) {
  .topbar-account {
    grid-template-columns: 1fr 1fr;
  }

  .topbar-account .balance {
    grid-column: 1 / -1;
  }

  .mobile-topbar-menu {
    width: min(260px, calc(100vw - 18px)) !important;
  }
}

/* ━━━ Record Detail Dialog ━━━ */

.record-dialog {
  place-items: center;
  padding: 18px;
}

.record-dialog-panel {
  --record-actions-height: 68px;
  width: min(1080px, 100%);
  height: min(820px, calc(100dvh - 36px));
  max-height: calc(100dvh - 36px);
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.record-dialog-panel:focus {
  outline: none;
}

.record-dialog-head {
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 2;
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
  background: var(--surface);
}

.record-dialog-head>div {
  min-width: 0;
  flex: 1 1 auto;
}

.record-dialog-head .eyebrow {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-dialog-head h2 {
  font-size: 20px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Body: two-column desktop */
.record-dialog-body {
  grid-row: 2;
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-columns: minmax(340px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  padding: 18px 18px calc(18px + var(--record-actions-height));
  overflow: hidden;
}

.record-dialog-body>* {
  min-width: 0;
}

.record-detail-media,
.record-detail-info {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 14px;
}

.record-detail-media {
  grid-template-rows: minmax(0, 1fr) auto;
}

.record-detail-info {
  align-content: start;
  grid-auto-rows: max-content;
  grid-template-rows: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Image */
.record-dialog-image {
  width: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: #fff;
}

.record-dialog-image-button {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border: 0;
  padding: 8px;
  background: transparent;
  position: relative;
  cursor: zoom-in;
  overflow: hidden;
}

.record-dialog-image-button > .record-image-count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 42px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.record-dialog-image-button img,
.record-dialog-image img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  background: transparent;
}

.record-dialog-image-empty {
  min-width: 92px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 16px;
  background: #fff;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

.record-dialog-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.record-dialog-image-grid {
  height: 100%;
  width: 100%;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 78%);
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  touch-action: pan-x pinch-zoom;
  padding: 0 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.record-dialog-image-grid::-webkit-scrollbar {
  display: none;
}

.record-dialog-image-grid .record-dialog-image-button {
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: var(--radius-xs);
  overflow: hidden;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.record-dialog-carousel .record-dialog-image-button > .record-image-count {
  top: 10px;
  right: 10px;
  bottom: auto;
}

.record-dialog-carousel-controls {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 2;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.record-dialog-carousel-nav,
.record-dialog-carousel-dots button {
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

.record-dialog-carousel-nav {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  font-size: 24px;
  line-height: 1;
  padding-bottom: 3px;
}

.record-dialog-carousel-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.record-dialog-carousel-dots {
  min-width: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}

.record-dialog-carousel-dots button {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: var(--radius-full);
  padding: 0;
  opacity: 0.58;
}

.record-dialog-carousel-dots button.is-active {
  width: 18px;
  opacity: 1;
}

/* Reference / input images */
.record-input-images {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.record-input-images>span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
  min-width: 0;
}

.record-input-images [data-dialog-input-list] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 10px;
  max-height: 168px;
  overflow: auto;
  padding-right: 2px;
  min-width: 0;
}

.record-input-image-button {
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  padding: 0;
  cursor: zoom-in;
}

.record-input-image-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Detail info grid */
.record-detail-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
}

.record-detail-grid div {
  min-width: 0;
  min-height: 56px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 9px 10px;
  background: transparent;
}

.record-detail-grid>div:nth-child(1) {
  grid-column: 1 / -1;
}

.record-detail-grid>div:nth-child(2),
.record-detail-grid>div:nth-child(3) {
  grid-column: span 2;
}

.record-detail-grid>div:nth-child(4),
.record-detail-grid>div:nth-child(5) {
  grid-column: span 2;
}

.record-detail-grid span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.record-detail-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

/* Prompt / remark */
.record-full-prompt {
  min-width: 0;
  min-height: 0;
  display: block;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 12px;
  background: #fff;
  overflow: visible;
}

.record-full-prompt.hidden {
  display: none;
}

.record-full-prompt>span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.record-full-prompt p {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: visible;
  margin: 0;
  color: var(--text-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.75;
}

.record-main-prompt {
  min-height: 0;
}

/* Usage */
.record-usage {
  min-width: 0;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 12px;
  background: #fff;
}

.record-usage.hidden {
  display: none;
}

.record-usage-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.record-usage-head span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.record-usage-head strong {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.record-usage-summary {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.record-usage-metric,
.record-usage-empty {
  min-width: 0;
  min-height: 54px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 9px 10px;
  background: var(--surface-soft);
}

.record-usage-metric span,
.record-usage-empty {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.record-usage-metric strong {
  min-width: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.record-usage-detail-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.record-usage-detail {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px;
  background: transparent;
}

.record-usage-detail>span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.record-usage-detail>div {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.record-usage-detail-metric {
  min-width: 0;
  min-height: 44px;
  display: grid;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 8px 9px;
  background: var(--surface-soft);
}

.record-usage-detail-metric span {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.record-usage-detail-metric strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* Error box */
.record-error {
  min-width: 0;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-xs);
  padding: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  overflow-wrap: anywhere;
  word-break: break-word;
  max-height: none;
  overflow: visible;
  font-size: 13px;
  line-height: 1.55;
}

.record-dialog.is-failed-record .record-error {
  order: -1;
}

/* Actions bar */
.record-dialog-actions {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  min-width: 0;
  min-height: var(--record-actions-height);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 14px 18px;
  background: var(--surface);
  z-index: 5;
  overflow-x: auto;
  overflow-y: hidden;
}

.record-dialog-actions .button {
  width: auto;
  min-width: 88px;
  max-width: none;
  min-height: 38px;
  flex: 0 0 auto;
  padding-right: 12px;
  padding-left: 12px;
  white-space: nowrap;
}

/* Viewer.js plugin */
.viewer-container {
  z-index: 10030 !important;
}

.viewer-backdrop {
  background-color: rgba(0, 0, 0, 0.88);
}

.viewer-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.viewerjs-source-list {
  display: none !important;
}

/* ━━━ Edit Upload Small (≤ 340px) ━━━ */
@media (max-width: 340px) {
  .edit-upload-field.has-preview {
    grid-template-columns: 1fr;
  }

  .edit-upload-field.has-preview .edit-upload-preview,
  .edit-upload-field.has-preview .edit-upload-box {
    grid-column: 1;
    grid-row: auto;
  }

  .edit-upload-field.has-preview .edit-upload-box {
    width: 100%;
    min-width: 0;
    height: 54px;
    min-height: 54px;
  }
}

/* Authoritative mobile record detail dialog */
@media (max-width: 720px) {
  .record-dialog {
    place-items: center;
    align-items: center;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.46);
  }

  .record-dialog-panel {
    --record-actions-height: 62px;
    width: 100%;
    height: min(760px, calc(100dvh - 20px - env(safe-area-inset-bottom)));
    max-height: calc(100dvh - 20px - env(safe-area-inset-bottom));
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
  }

  .record-dialog-head {
    position: relative;
    top: auto;
    z-index: 2;
    min-height: 58px;
    padding: 12px 14px;
    gap: 10px;
    background: var(--surface);
  }

  .record-dialog-head>div {
    min-width: 0;
  }

  .record-dialog-head .eyebrow {
    margin: 0 0 2px;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .record-dialog-head h2 {
    margin: 0;
    overflow: hidden;
    font-size: 17px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .record-dialog-head .dialog-close {
    width: auto;
    min-width: 56px;
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
  }

  .record-dialog-body {
    grid-row: 2;
    min-height: 0;
    max-height: 100%;
    display: block;
    padding: 12px 12px calc(12px + var(--record-actions-height));
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .record-detail-media,
  .record-detail-info {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: none;
    gap: 12px;
    overflow: visible;
  }

  .record-detail-media {
    margin-bottom: 12px;
  }

  .record-dialog-image,
  .record-dialog.is-failed-record .record-dialog-image {
    width: 100%;
    height: clamp(188px, 36dvh, 300px);
    min-height: 0;
    max-height: none;
    border-radius: var(--radius-xs);
  }

  .record-dialog-image-grid {
    height: 100%;
    grid-auto-columns: minmax(190px, 84%);
    gap: 6px;
    padding: 0 6px;
  }

  .record-dialog-image-button {
    padding: 6px;
  }

  .record-dialog-carousel-controls {
    right: 8px;
    bottom: 8px;
    left: 8px;
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 6px;
  }

  .record-dialog-carousel-nav {
    width: 32px;
    height: 32px;
    font-size: 22px;
  }

  .record-input-images {
    overflow: visible;
  }

  .record-input-images [data-dialog-input-list] {
    display: flex;
    gap: 8px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 2px;
    -webkit-overflow-scrolling: touch;
  }

  .record-input-image-button {
    width: 68px;
    min-width: 68px;
    flex: 0 0 68px;
  }

  .record-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .record-detail-grid>div,
  .record-detail-grid>div:nth-child(1),
  .record-detail-grid>div:nth-child(2),
  .record-detail-grid>div:nth-child(3),
  .record-detail-grid>div:nth-child(4),
  .record-detail-grid>div:nth-child(5) {
    grid-column: auto;
    min-height: auto;
    align-content: start;
    padding: 9px 10px;
  }

  .record-detail-grid>div:nth-child(1) {
    grid-column: 1 / -1;
  }

  .record-detail-grid strong {
    overflow: visible;
    max-height: none;
    white-space: normal;
  }

  .record-full-prompt {
    display: block;
    min-height: 0;
    max-height: none;
    padding: 11px;
    overflow: visible;
  }

  .record-full-prompt.hidden {
    display: none;
  }

  .record-full-prompt>span {
    display: block;
    margin-bottom: 8px;
  }

  .record-full-prompt p {
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    font-size: 13px;
    line-height: 1.65;
  }

  .record-main-prompt {
    min-height: 0;
  }

  .record-usage {
    padding: 11px;
  }

  .record-usage-head {
    align-items: flex-start;
  }

  .record-usage-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .record-usage-detail-grid {
    grid-template-columns: 1fr;
  }

  .record-usage-metric,
  .record-usage-empty {
    min-height: 50px;
    padding: 8px 7px;
  }

  .record-usage-metric strong {
    font-size: 14px;
  }

  .record-usage-detail {
    padding: 9px;
  }

  .record-error {
    order: 0;
    max-height: none;
    overflow: visible;
    padding: 11px;
    font-size: 13px;
    line-height: 1.55;
  }

  .record-dialog.is-failed-record .record-error {
    order: -1;
  }

  .record-dialog-actions {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: var(--record-actions-height);
    display: flex;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 0;
    border-top: 1px solid var(--line);
    padding: 10px 12px;
    background: var(--surface);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .record-dialog-actions .button {
    width: auto;
    min-width: 74px;
    max-width: none;
    min-height: 40px;
    flex: 0 0 auto;
    padding-right: 12px;
    padding-left: 12px;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .record-dialog {
    padding: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .record-dialog-panel {
    --record-actions-height: 60px;
    height: min(720px, calc(100dvh - 16px - env(safe-area-inset-bottom)));
    max-height: calc(100dvh - 16px - env(safe-area-inset-bottom));
  }

  .record-dialog-body {
    padding: 10px 10px calc(10px + var(--record-actions-height));
  }

  .record-dialog-image,
  .record-dialog.is-failed-record .record-dialog-image {
    height: clamp(168px, 32dvh, 250px);
  }

  .record-dialog-image-button {
    padding: 5px;
  }

  .record-detail-grid {
    grid-template-columns: 1fr;
  }

  .record-detail-grid>div,
  .record-detail-grid>div:nth-child(1),
  .record-detail-grid>div:nth-child(2),
  .record-detail-grid>div:nth-child(3),
  .record-detail-grid>div:nth-child(4),
  .record-detail-grid>div:nth-child(5) {
    grid-column: 1 / -1;
  }

  .record-dialog-actions .button {
    min-width: 68px;
    padding-right: 10px;
    padding-left: 10px;
  }
}

/* Gradients & Glass - Component Overrides */
.preview-stage::after {
  content: none;
}

.preview-stage>* {
  position: relative;
  z-index: 1;
}

.edit-upload-box.is-dragging,
.edit-upload-box.is-paste-ready,
.edit-upload-box.is-active {
  border-color: var(--text);
  background: rgba(0, 0, 0, 0.02);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.generation-progress-grid strong,
.stat-card strong {
  font-variant-numeric: tabular-nums;
}

body.page-admin [data-admin-users] {
  min-width: 1760px;
  table-layout: auto;
}

body.page-admin [data-admin-users] th,
body.page-admin [data-admin-users] td {
  overflow: visible;
  text-overflow: clip;
}

body.page-admin [data-admin-users] .table-primary-text {
  display: inline;
  overflow: visible;
  text-overflow: clip;
}

body.page-admin [data-admin-users] th:nth-child(1),
body.page-admin [data-admin-users] td:nth-child(1) {
  width: 160px;
}

body.page-admin [data-admin-users] th:nth-child(2),
body.page-admin [data-admin-users] td:nth-child(2) {
  width: 360px;
}

body.page-admin [data-admin-users] th:nth-child(3),
body.page-admin [data-admin-users] td:nth-child(3),
body.page-admin [data-admin-users] th:nth-child(4),
body.page-admin [data-admin-users] td:nth-child(4),
body.page-admin [data-admin-users] th:nth-child(5),
body.page-admin [data-admin-users] td:nth-child(5) {
  width: 96px;
}

body.page-admin [data-admin-users] th:nth-child(6),
body.page-admin [data-admin-users] td:nth-child(6) {
  width: 100px;
}

body.page-admin [data-admin-users] th:nth-child(7),
body.page-admin [data-admin-users] td:nth-child(7) {
  width: 220px;
}

body.page-admin [data-admin-users] th:nth-child(8),
body.page-admin [data-admin-users] td:nth-child(8) {
  width: 260px;
}

body.page-admin [data-admin-users] th:nth-child(9),
body.page-admin [data-admin-users] td:nth-child(9) {
  width: 330px;
}

body.page-admin [data-admin-users] th:nth-child(10),
body.page-admin [data-admin-users] td:nth-child(10) {
  width: 180px;
}

body.page-admin [data-admin-users] th:nth-child(11),
body.page-admin [data-admin-users] td:nth-child(11) {
  width: 210px;
}

/* Legacy dialog overlays */
.record-append-dialog {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.40);
}

.record-append-panel {
  width: min(620px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.record-append-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.record-append-form .generation-options-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.record-append-form .generation-options-grid.is-single-count .option-size {
  grid-column: 1 / -1;
}

.record-append-reference {
  display: grid;
  gap: 8px;
}

.record-append-reference>span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
}

.record-append-reference-note {
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.record-append-result-picker {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.record-append-result-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.record-append-result-head span {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.record-append-result-head small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
}

.record-append-result-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
}

.record-append-result-option {
  min-width: 0;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 6px;
  background: var(--surface);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.record-append-result-option.is-selected {
  border-color: var(--text);
  background: var(--surface-soft);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.035);
}

.record-append-result-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: block;
  overflow: hidden;
  border: 0;
  padding: 0;
  border-radius: 6px;
  background: var(--surface-soft);
  cursor: zoom-in;
}

.record-append-result-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.record-append-result-check {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.record-append-result-check span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-append-reference-image {
  width: 100%;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 8px;
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.record-append-reference-image:hover {
  border-color: var(--line-hover);
}

.record-append-reference-image img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.record-append-reference-options {
  display: grid;
  gap: 8px;
}

.record-append-check {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 12px;
  background: var(--surface);
}

.record-append-check span {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.record-append-check strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.record-append-check small {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.record-append-upload {
  transition: opacity 0.2s ease;
}

.record-append-upload.is-disabled {
  opacity: 0.58;
}

.record-append-upload.is-disabled .edit-upload-box {
  pointer-events: none;
}

.record-append-charge {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  background: var(--surface-soft);
}

.record-append-charge>div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.record-append-charge>div>span {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.record-append-charge small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.record-append-charge strong {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.record-append-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.record-append-actions .button {
  min-width: 88px;
}

.record-edit-again {
  min-height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  padding: 0 10px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
}

.record-edit-again:hover {
  border-color: var(--line-hover);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

/* Record batch selection */
.record-select {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 4;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(255, 255, 255, 0.48);
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.16);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0.58;
  cursor: pointer;
  transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.record-select:hover,
.record-card:hover .record-select {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(0, 0, 0, 0.28);
}

.record-select:has(input:checked) {
  opacity: 1;
  border-color: var(--text);
  background: var(--text);
}

.record-select input {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.record-select::after {
  content: "";
  display: block;
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.record-select:has(input:checked)::after {
  opacity: 1;
}

.record-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  background: transparent;
}

.record-bulk-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
}

.record-bulk-check input {
  width: 16px;
  height: 16px;
  min-width: 16px;
}

/* Inspirations */
.inspirations-page-main {
  position: relative;
  display: block;
}

.inspirations-page-main::before {
  content: "灵感";
  position: fixed;
  top: 108px;
  right: max(24px, calc((100vw - var(--shell-max)) / 2));
  z-index: -1;
  color: rgba(0, 0, 0, 0.035);
  font-size: clamp(74px, 11vw, 156px);
  font-weight: 750;
  line-height: 0.9;
  pointer-events: none;
  user-select: none;
}

.inspirations-page-card {
  overflow: hidden;
  border-color: rgba(0, 0, 0, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.88)),
    var(--surface);
}

.inspirations-page-card>.card-head {
  position: relative;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.inspirations-page-card>.card-head::before {
  content: "灵感";
  position: absolute;
  right: 92px;
  bottom: 4px;
  color: rgba(0, 0, 0, 0.05);
  font-size: 54px;
  font-weight: 750;
  line-height: 1;
  pointer-events: none;
}

.inspirations-page-card .card-head h2 {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-size: 28px;
  letter-spacing: 0;
}

.inspiration-dialog-head h2 span,
.inspirations-page-card .card-head h2 span {
  font-weight: 750;
}

.inspiration-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
}

.inspiration-eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: var(--radius-full);
  background: var(--primary-bg);
  box-shadow: 0 0 0 4px var(--primary-soft);
  animation: inspiration-eyebrow-pulse 2.4s ease-in-out infinite;
  transform-origin: center;
}

@keyframes inspiration-eyebrow-pulse {
  0%,
  100% {
    opacity: 0.78;
    transform: scale(0.92);
    box-shadow: 0 0 0 3px var(--primary-soft);
  }

  50% {
    opacity: 1;
    transform: scale(1.08);
    box-shadow: 0 0 0 8px var(--primary-soft);
  }
}

.inspiration-page-desc {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.inspiration-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: var(--radius);
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.055), rgba(255, 255, 255, 0.94) 46%, rgba(0, 0, 0, 0.025)),
    var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.inspiration-search-box {
  min-width: 0;
  height: 48px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: var(--radius-full);
  padding: 0 16px 0 8px;
  background: rgba(255, 255, 255, 0.92);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.inspiration-search-box:focus-within {
  border-color: rgba(0, 0, 0, 0.2);
  background: #fff;
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.07),
    0 0 0 3px rgba(0, 0, 0, 0.045),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.inspiration-search-box span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.42), transparent 30%),
    var(--primary-bg);
  color: var(--primary-inverse);
}

.inspiration-search-box svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.inspiration-search-box input {
  width: 100%;
  min-width: 0;
  height: 46px;
  border: 0;
  padding: 0;
  background: transparent;
  font-weight: 500;
}

.inspiration-search-box input:focus,
.inspiration-search-box input:focus-visible {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.inspiration-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 2px 1px 4px;
}

@media (max-width: 720px) {
  .inspiration-tags {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .inspiration-tags::-webkit-scrollbar {
    display: none;
  }
}

.inspiration-tags a {
  min-height: 34px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-full);
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.inspiration-tags a.active,
.inspiration-tags a:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary-inverse);
  transform: translateY(-1px);
}

.inspiration-tags em {
  font-style: normal;
  opacity: 0.7;
}

.inspiration-masonry {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 8px;
  gap: 12px;
  align-items: start;
}

.inspiration-masonry.is-masonry-loading {
  opacity: 0;
}

.inspiration-masonry.is-masonry-ready {
  opacity: 1;
  transition: opacity 0.18s ease;
}

.inspiration-load-more {
  min-height: 52px;
  display: grid;
  place-items: center;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.inspiration-load-more span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.62);
}

.inspiration-load-more.is-loading span::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: var(--radius-full);
  background: currentColor;
  animation: pulse 0.9s ease-in-out infinite;
}

.inspiration-load-more.is-done {
  opacity: 0.72;
}

.inspiration-card {
  position: relative;
  display: grid;
  align-content: start;
  width: 100%;
  overflow: hidden;
  contain: layout paint;
  border: 1px solid rgba(0, 0, 0, 0.075);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  color: inherit;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.025);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.inspiration-card:hover {
  border-color: rgba(0, 0, 0, 0.18);
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.08);
}

.inspiration-cover {
  position: relative;
  width: 100%;
  display: block;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: var(--surface-soft);
  text-align: left;
}

.inspiration-cover::after {
  content: "灵感";
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.46);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.inspiration-card:hover .inspiration-cover::after {
  opacity: 1;
  transform: translateY(0);
}

.inspiration-cover img {
  width: 100%;
  height: auto;
  min-height: 180px;
  max-height: 460px;
  display: block;
  object-fit: cover;
  transition: transform 0.32s var(--ease-soft), filter 0.32s ease;
}

.inspiration-card:hover .inspiration-cover img {
  transform: scale(1.025);
  filter: saturate(1.04) contrast(1.02);
}

.inspiration-cover[style*="aspect-ratio"] img {
  height: 100%;
}

.inspiration-cover .inspiration-count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  border-radius: var(--radius-full);
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.56);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.inspiration-body {
  display: grid;
  gap: 8px;
  padding: 11px 10px 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9)),
    var(--surface);
}

.inspiration-body .inspiration-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
}

.inspiration-body .inspiration-meta span {
  flex: 0 1 auto;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspiration-body .inspiration-meta span:last-child {
  margin-left: auto;
}

.inspiration-prompt,
.inspiration-dialog-prompt {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  padding: 0;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.inspiration-prompt {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.inspiration-prompt:hover,
.inspiration-dialog-prompt:hover {
  color: var(--text);
}

.inspiration-dialog-prompt {
  display: block;
  align-self: stretch;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  gap: 8px;
  border-color: rgba(0, 0, 0, 0.075);
  padding: 12px 14px 18px;
  background: transparent;
  box-shadow: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  line-height: 1.75;
  word-break: break-word;
  animation: inspirationPromptBorder 2.8s ease-in-out infinite;
}

.inspiration-dialog-prompt:hover {
  border-color: rgba(0, 0, 0, 0.18);
  animation: none;
}

.inspiration-prompt.is-remark::before {
  content: "备注 ";
  color: var(--muted);
  font-weight: 700;
}

.inspiration-prompt.is-prompt::before {
  content: "提示词 ";
  color: var(--muted);
  font-weight: 700;
}

.inspiration-meta,
.inspiration-dialog-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.inspiration-meta span,
.inspiration-dialog-meta span {
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.075);
  border-radius: var(--radius-full);
  padding: 3px 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}

.inspiration-meta .is-tag,
.inspiration-dialog-meta span:first-child {
  border-color: var(--primary-border);
  background: var(--primary-bg);
  color: var(--primary-inverse);
}

.inspiration-use {
  width: 100%;
}

.inspiration-dialog {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.50);
  animation: overlayIn 0.22s var(--ease-out);
}

.inspiration-dialog.hidden {
  display: none;
}

.inspiration-dialog-panel {
  --inspiration-actions-height: 68px;
  width: min(1080px, 100%);
  height: min(820px, calc(100dvh - 36px));
  max-height: calc(100dvh - 36px);
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.92)),
    var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  animation: panelIn 0.28s var(--ease-soft);
}

.inspiration-dialog-panel::before {
  content: "灵感";
  position: absolute;
  top: 84px;
  right: 22px;
  z-index: 0;
  color: rgba(0, 0, 0, 0.06);
  font-size: clamp(58px, 8vw, 116px);
  font-weight: 750;
  line-height: 1;
  pointer-events: none;
}

.inspiration-dialog-watermark {
  position: absolute;
  right: 24px;
  bottom: calc(var(--inspiration-actions-height) + 18px);
  z-index: 1;
  color: rgba(0, 0, 0, 0.075);
  font-size: clamp(72px, 10vw, 144px);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: 0;
  pointer-events: none;
  user-select: none;
}

.inspiration-dialog-head {
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 2;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.075);
  padding: 18px 20px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.035), rgba(255, 255, 255, 0.98) 34%),
    rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.inspiration-dialog-head>div {
  min-width: 0;
  flex: 1 1 auto;
}

.inspiration-dialog-head h2,
.inspiration-dialog-head .eyebrow {
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspiration-dialog-head h2 {
  font-size: 22px;
  letter-spacing: 0;
}

.inspiration-dialog-content {
  position: relative;
  z-index: 1;
  grid-row: 2;
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-columns: minmax(340px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  align-items: stretch;
  padding: 18px 18px calc(18px + var(--inspiration-actions-height));
  overflow: hidden;
}

.inspiration-dialog-content>* {
  min-width: 0;
}

.inspiration-detail-media,
.inspiration-detail-info {
  position: relative;
  z-index: 2;
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 14px;
  background: transparent;
}

.inspiration-detail-media {
  grid-template-rows: auto minmax(0, 1fr);
}

.inspiration-detail-info {
  height: 100%;
  max-height: 100%;
  align-content: start;
  grid-template-rows: auto minmax(0, 1fr) minmax(0, auto);
  overflow: hidden;
  overflow-x: hidden;
  padding-right: 2px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.inspiration-detail-label {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.inspiration-detail-label::before {
  content: "";
  width: 18px;
  height: 1px;
  flex: 0 0 auto;
  background: rgba(0, 0, 0, 0.28);
}

.inspiration-dialog-image {
  min-width: 0;
  min-height: 0;
  max-height: 420px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  box-shadow: none;
}

.inspiration-dialog-image:has(.inspiration-dialog-carousel) {
  max-height: none;
  height: 100%;
  overflow: visible;
  place-items: stretch;
}

.inspiration-dialog-image > button,
.inspiration-dialog-image-button {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border: 0;
  padding: 8px;
  background: transparent;
  cursor: zoom-in;
  overflow: hidden;
}

.inspiration-dialog-image img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  object-fit: contain;
  background: transparent;
}

.inspiration-dialog-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.inspiration-dialog-image-grid {
  height: 100%;
  width: 100%;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 78%);
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  touch-action: pan-x pinch-zoom;
  padding: 0 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.inspiration-dialog-image-grid::-webkit-scrollbar {
  display: none;
}

.inspiration-dialog-image-grid .inspiration-dialog-image-button {
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: var(--radius-xs);
  overflow: hidden;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.inspiration-dialog-image-button {
  height: 100%;
  min-height: 0;
  width: 100%;
  min-width: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-xs);
  padding: 8px;
  background: transparent;
  cursor: zoom-in;
  overflow: hidden;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.inspiration-dialog-image-button span {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 42px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.inspiration-dialog-image-button img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  background: transparent;
}

.inspiration-dialog-carousel .inspiration-dialog-image-button span {
  top: 10px;
  right: 10px;
  bottom: auto;
}

.inspiration-dialog-carousel-controls {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 2;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.inspiration-dialog-carousel-nav,
.inspiration-dialog-carousel-dots button {
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

.inspiration-dialog-carousel-nav {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  font-size: 24px;
  line-height: 1;
  padding-bottom: 3px;
}

.inspiration-dialog-carousel-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.inspiration-dialog-carousel-dots {
  min-width: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}

.inspiration-dialog-carousel-dots button {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: var(--radius-full);
  padding: 0;
  opacity: 0.58;
}

.inspiration-dialog-carousel-dots button.is-active {
  width: 18px;
  opacity: 1;
}

.inspiration-dialog-image-button span.is-reference {
  background: rgba(84, 58, 183, 0.78);
}

.inspiration-dialog-reference {
  min-width: 0;
  min-height: 0;
  max-height: 150px;
  overflow: hidden;
  border-radius: var(--radius-xs);
}

.inspiration-dialog-reference .inspiration-dialog-carousel {
  max-height: 150px;
}

.inspiration-dialog-reference .inspiration-dialog-image-grid {
  grid-auto-columns: minmax(120px, 38%);
}

.inspiration-dialog-reference .inspiration-dialog-image-button span {
  top: 6px;
  right: 6px;
  bottom: auto;
  min-width: auto;
  height: 18px;
  padding: 0 6px;
  font-size: 10px;
}

.inspiration-dialog-remark {
  min-width: 0;
  max-height: min(180px, 28dvh);
  border: 0;
  border-radius: var(--radius-xs);
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inspiration-dialog-remark::before {
  content: "备注";
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.inspiration-dialog-actions {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  min-width: 0;
  min-height: var(--inspiration-actions-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.075);
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 5;
  overflow-x: auto;
  overflow-y: hidden;
}

.inspiration-dialog-actions .inspiration-dialog-meta {
  flex: 1 1 auto;
  justify-content: flex-start;
  overflow: hidden;
}

.inspiration-dialog-actions .inspiration-dialog-meta span {
  flex: 0 1 auto;
  max-width: min(180px, 40vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspiration-dialog-actions .button {
  width: auto;
  min-width: 88px;
  max-width: none;
  min-height: 38px;
  flex: 0 0 auto;
  padding-right: 12px;
  padding-left: 12px;
  white-space: nowrap;
}

.inspiration-dialog-action-buttons {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.inspiration-dialog-action-buttons .button.primary {
  border-color: var(--primary);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 42%),
    var(--primary-bg);
}

@media (max-width: 980px) {
  .inspiration-dialog-content {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(180px, 42dvh) minmax(0, 1fr);
  }

  .inspiration-dialog-image img {
    max-height: 52vh;
  }
}

@media (max-width: 720px) {
  .inspirations-page-main::before {
    top: 84px;
    right: 10px;
    font-size: 76px;
  }

  .inspirations-page-card {
    border-radius: var(--radius-sm);
  }

  .inspirations-page-card>.card-head {
    min-height: 0;
    padding-bottom: 12px;
  }

  .inspirations-page-card>.card-head::before {
    right: 8px;
    bottom: 8px;
    font-size: 38px;
  }

  .inspirations-page-card .card-head h2 {
    font-size: 22px;
  }

  .inspiration-page-desc {
    font-size: 12px;
  }

  .inspiration-masonry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .inspiration-card {
    border-radius: var(--radius-sm);
  }

  .inspiration-search {
    grid-template-columns: 1fr;
    border-radius: var(--radius-sm);
    padding: 10px;
  }

  .inspiration-search .button {
    width: 100%;
  }

  .inspiration-cover img {
    min-height: 150px;
    max-height: 320px;
  }

  .inspiration-body {
    padding: 9px;
  }

  .inspiration-dialog {
    place-items: center;
    align-items: center;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.46);
  }

  .inspiration-dialog-panel {
    --inspiration-actions-height: 62px;
    width: 100%;
    height: min(760px, calc(100dvh - 20px - env(safe-area-inset-bottom)));
    max-height: calc(100dvh - 20px - env(safe-area-inset-bottom));
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    border-radius: var(--radius-sm);
  }

  .inspiration-dialog-panel::before {
    top: 62px;
    right: 12px;
    font-size: 54px;
  }

  .inspiration-dialog-watermark {
    right: 12px;
    bottom: calc(var(--inspiration-actions-height) + 12px);
    font-size: 72px;
    color: rgba(0, 0, 0, 0.055);
  }

  .inspiration-dialog-head {
    position: relative;
    top: auto;
    min-height: 58px;
    padding: 12px 14px;
    gap: 10px;
  }

  .inspiration-dialog-head .eyebrow {
    margin: 0 0 2px;
    font-size: 10px;
    line-height: 1.2;
  }

  .inspiration-dialog-head h2 {
    font-size: 17px;
    line-height: 1.25;
  }

  .inspiration-dialog-head .dialog-close {
    width: auto;
    min-width: 56px;
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
  }

  .inspiration-dialog-content {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 7fr 3fr;
    gap: 10px;
    padding: 12px 12px calc(12px + var(--inspiration-actions-height));
    overflow: hidden;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .inspiration-detail-media,
  .inspiration-detail-info {
    min-width: 0;
    min-height: 0;
    display: grid;
    gap: 10px;
    overflow: hidden;
  }

  .inspiration-detail-media {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }

  .inspiration-detail-label {
    font-size: 11px;
  }

  .inspiration-detail-media {
    margin-bottom: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .inspiration-detail-info {
    height: 100%;
    max-height: 100%;
    align-content: start;
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding-right: 0;
    overflow: hidden;
  }

  .inspiration-dialog-remark {
    max-height: min(220px, 36dvh);
  }

  .inspiration-dialog-image {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    border-radius: var(--radius-xs);
  }

  .inspiration-dialog-image:has(.inspiration-dialog-carousel) {
    overflow: visible;
    place-items: stretch;
  }

  .inspiration-dialog-image > button,
  .inspiration-dialog-image-button {
    padding: 6px;
  }

  .inspiration-dialog-carousel-nav {
    width: 32px;
    height: 32px;
    font-size: 22px;
  }

  .inspiration-dialog-prompt {
    height: auto;
    max-height: min(180px, 38dvh);
    min-height: 0;
    padding-bottom: calc(34px + env(safe-area-inset-bottom));
    overflow-y: auto;
    touch-action: pan-y;
  }

  .inspiration-dialog-actions {
    min-height: var(--inspiration-actions-height);
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px 12px;
  }

  .inspiration-dialog-actions .inspiration-dialog-meta {
    flex-wrap: nowrap;
  }

  .inspiration-dialog-actions .inspiration-dialog-meta span {
    max-width: 30vw;
  }

  .inspiration-dialog-actions .button {
    width: auto;
    min-width: 74px;
    max-width: none;
    min-height: 40px;
    flex: 0 0 auto;
    padding-right: 12px;
    padding-left: 12px;
    white-space: nowrap;
  }

  .inspiration-dialog-action-buttons {
    gap: 6px;
  }
}

@media (max-width: 420px) {
  .inspiration-masonry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* body override - no green gradient */
body {
  background: var(--bg);
}

html {
  background: var(--bg);
}

/* ═══════════════════════════════════════════
   Welcome / Landing Page
   ═══════════════════════════════════════════ */
body.page-welcome .site-header {
  margin-bottom: 0;
}

body.page-welcome .site-nav {
  display: none;
}

body.page-welcome .site-actions {
  display: inline-flex !important;
}

/* ── Hero ── */
.welcome-hero {
  display: grid;
  place-items: center;
  min-height: 70vh;
  padding: 48px 0 56px;
  text-align: center;
}

.welcome-hero-content {
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 680px;
}

.welcome-hero-eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.welcome-hero-title {
  font-size: 44px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--text);
  margin: 0;
}

.welcome-hero-desc {
  margin: 0;
  color: var(--text-soft);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.75;
  max-width: 520px;
}

.welcome-hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.welcome-hero-actions .button {
  min-height: 50px;
  padding: 0 32px;
  font-size: 15px;
  font-weight: 600;
}

.welcome-hero-actions .button.primary {
  background: var(--primary-bg);
  color: var(--primary-inverse);
}

.welcome-hero-actions .button.primary:hover {
  opacity: 0.88;
}

.welcome-hero-actions .button.secondary {
  border-color: var(--line-strong);
}

/* Hero stats row */
.welcome-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.welcome-hero-stats div {
  min-height: 72px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  padding: 12px 10px;
}

.welcome-hero-stats div+div {
  border-left: 1px solid var(--line);
}

.welcome-hero-stats strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.welcome-hero-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

/* ── Features ── */
.welcome-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 1000px;
  margin: 0 auto 64px;
  padding: 0;
}

.welcome-feature-card {
  min-height: 200px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 22px;
  background: var(--surface);
  text-align: center;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.welcome-feature-card:hover {
  border-color: var(--line-hover);
  transform: translateY(-3px);
}

.welcome-feature-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  background: var(--text);
}

.welcome-feature-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.welcome-feature-card strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.welcome-feature-card>span:last-child {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  max-width: 260px;
}

/* ── How It Works ── */
.welcome-section-eyebrow {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.welcome-section-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 36px;
  color: var(--text);
}

.welcome-section-head {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 28px;
  text-align: center;
}

.welcome-section-head .welcome-section-title {
  margin-bottom: 6px;
}

.welcome-section-head .button {
  min-height: 38px;
  padding: 0 18px;
  font-size: 13px;
}

.welcome-inspiration {
  max-width: 1100px;
  margin: 0 auto 64px;
  padding: 0;
}

.welcome-inspiration-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.welcome-inspiration-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 3 / 4;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: #fff;
}

.welcome-inspiration-card:nth-child(2n) {
  aspect-ratio: 1 / 1.28;
}

.welcome-inspiration-card:nth-child(3n) {
  margin-top: 26px;
}

.welcome-inspiration-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.36s var(--ease-soft);
}

.welcome-inspiration-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 58%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.64));
  pointer-events: none;
}

.welcome-inspiration-card .welcome-inspiration-label {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.welcome-inspiration-card strong,
.welcome-inspiration-card em {
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.welcome-inspiration-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.welcome-inspiration-card:hover img {
  transform: scale(1.05);
}

.welcome-steps {
  max-width: 960px;
  margin: 0 auto 64px;
  padding: 0;
}

.welcome-steps-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 0;
  align-items: start;
}

.welcome-step {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 24px 16px;
  text-align: center;
}

.welcome-step-num {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: var(--text);
  color: var(--primary-inverse);
  font-size: 18px;
  font-weight: 700;
}

.welcome-step strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.welcome-step>span:last-child {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  max-width: 220px;
}

.welcome-step-arrow {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding-top: 40px;
  color: var(--muted-light);
  font-size: 26px;
  font-weight: 300;
}

/* ── CTA ── */
.welcome-cta {
  text-align: center;
  padding: 48px 20px 56px;
  border-top: 1px solid var(--line);
}

.welcome-cta h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.welcome-cta p {
  color: var(--muted);
  margin: 0 0 22px;
  font-size: 15px;
}

.welcome-cta .button {
  min-height: 50px;
  padding: 0 36px;
  font-size: 15px;
  font-weight: 600;
}

/* ── Footer ── */
.welcome-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 0 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.welcome-footer a {
  color: var(--muted);
  text-decoration: none;
}

.welcome-footer a:hover {
  color: var(--text-soft);
}

@media (max-width: 720px) {
  body.page-welcome .app-shell {
    padding-bottom: 24px;
  }

  body.page-welcome .site-header {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 12px;
  }

  body.page-welcome .site-actions {
    gap: 6px;
  }

  body.page-welcome .site-action {
    font-size: 12px;
    padding: 0 12px;
    height: 34px;
  }

  .welcome-hero {
    min-height: 54vh;
    padding: 32px 16px 40px;
  }

  .welcome-hero-title {
    font-size: 28px;
  }

  .welcome-hero-desc {
    font-size: 15px;
  }

  .welcome-hero-actions {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
  }

  .welcome-hero-actions .button {
    width: 100%;
  }

  .welcome-hero-stats {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-radius: var(--radius);
  }

  .welcome-hero-stats div+div {
    border-left: 1px solid var(--line);
    border-top: 0;
  }

  .welcome-hero-stats div {
    min-height: 64px;
    padding: 10px 6px;
  }

  .welcome-hero-stats strong {
    font-size: 12px;
  }

  .welcome-hero-stats span {
    font-size: 10px;
    line-height: 1.35;
  }

  .welcome-features {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0 16px;
  }

  .welcome-inspiration {
    margin-bottom: 48px;
    padding: 0 16px;
  }

  .welcome-section-head {
    margin-bottom: 20px;
  }

  .welcome-inspiration-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .welcome-inspiration-card:nth-child(n) {
    margin-top: 0;
  }

  .welcome-inspiration-card:nth-child(2n) {
    margin-top: 18px;
  }

  .welcome-feature-card {
    min-height: auto;
    padding: 22px 18px;
  }

  .welcome-steps-grid {
    grid-template-columns: 1fr;
  }

  .welcome-step-arrow {
    display: none;
  }

  .welcome-step {
    padding: 14px 12px;
    gap: 6px;
  }

  .welcome-section-title {
    font-size: 22px;
    margin-bottom: 24px;
  }

  .welcome-cta {
    padding: 40px 16px 48px;
  }

  .welcome-cta h2 {
    font-size: 22px;
  }

  .welcome-footer {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
}

/* Global glass polish */
:root {
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-strong: rgba(255, 255, 255, 0.84);
  --glass-bg-soft: rgba(255, 255, 255, 0.52);
  --glass-border: rgba(0, 0, 0, 0.075);
  --glass-blur: blur(18px) saturate(1.16);
  --glass-blur-soft: blur(12px) saturate(1.1);
}

body {
  background:
    radial-gradient(circle at 18% 8%, rgba(0, 0, 0, 0.045), transparent 24vw),
    radial-gradient(circle at 82% 18%, rgba(22, 101, 52, 0.045), transparent 26vw),
    linear-gradient(180deg, rgba(0, 0, 0, 0.018), transparent 280px),
    var(--bg);
}

.site-header,
.app-topbar,
.card,
.stat-card,
.profile-hero,
.profile-stat-card,
.profile-section,
.profile-overview-section,
.auth-info,
.auth-form-card,
.center-auth-panel,
.setup-section,
.history-list .record-card,
.table-wrap,
.filter-bar,
.invite-link-panel,
.mobile-account-panel,
.welcome-feature-card,
.welcome-hero-stats,
.welcome-cta {
  border-color: var(--glass-border);
  background-color: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

.site-nav,
.center-auth-tabs,
.mode-toggle,
.settings-tab-nav,
.inspiration-search-box,
.inspiration-tags a,
.badge,
.status,
.alert,
.inline-message,
.mobile-account-balance,
.mobile-account-invite,
.mobile-account-actions a,
.site-action:not(.site-action-primary),
.site-invite-code,
.site-balance,
.table-action-group,
.record-select,
.record-bulk-check,
.inspiration-tag-input,
.inspiration-dialog-meta span,
.inspiration-meta span,
.record-meta span,
.record-duration,
.profile-hero-metrics,
.profile-info-row,
.profile-invite-panel,
.profile-manage-item {
  background-color: var(--glass-bg-soft);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  backdrop-filter: var(--glass-blur-soft);
}

input,
select,
textarea,
.compact-input,
.center-auth-field input,
.auth-form-card .field input,
.inspiration-tag-dialog-field input {
  background-color: rgba(255, 255, 255, 0.62);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  backdrop-filter: var(--glass-blur-soft);
}

input:focus,
select:focus,
textarea:focus,
.center-auth-field input:focus,
.inspiration-search-box:focus-within {
  background-color: rgba(255, 255, 255, 0.88);
}

.table-wrap table,
table {
  background-color: rgba(255, 255, 255, 0.64);
}

.preview-stage {
  background-color: rgba(255, 255, 255, 0.42);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  backdrop-filter: var(--glass-blur-soft);
}

.site-menu-button,
.site-mobile-top-balance,
.site-mobile-menu,
.mobile-bottom-nav,
.jpt-toast {
  background-color: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

.viewer-container,
.viewer-container *,
.viewerjs-source-list,
.viewerjs-source-list * {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.redeem-panel,
.change-password-panel,
.real-name-panel,
.profile-edit-dialog-panel,
.notice-panel,
.admin-notice-panel,
.record-dialog-panel,
.legal-dialog-panel,
.generation-modal,
.record-append-panel,
.reset-password-panel,
.jpt-layer-panel,
.inspiration-dialog-panel,
.redeem-head,
.notice-panel .redeem-head,
.admin-notice-panel .redeem-head,
.record-dialog-head,
.record-dialog-actions,
.jpt-layer-head,
.inspiration-dialog-actions,
.legal-panel,
.record-append-panel .redeem-head,
.record-dialog-image,
.record-dialog-image-empty,
.record-input-image-button,
.inspiration-dialog-image,
.inspiration-dialog-reference {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.redeem-panel,
.change-password-panel,
.real-name-panel,
.profile-edit-dialog-panel,
.notice-panel,
.admin-notice-panel,
.record-dialog-panel,
.legal-dialog-panel,
.generation-modal,
.record-append-panel,
.reset-password-panel,
.jpt-layer-panel,
.inspiration-dialog-panel,
.redeem-head,
.notice-panel .redeem-head,
.admin-notice-panel .redeem-head,
.record-dialog-head,
.record-dialog-actions,
.jpt-layer-head,
.inspiration-dialog-actions,
.legal-panel,
.record-append-panel .redeem-head {
  background-color: var(--surface) !important;
}

.record-dialog-image,
.record-dialog-image-empty,
.record-input-image-button,
.inspiration-dialog-image,
.inspiration-dialog-reference {
  background-color: #fff !important;
}

.subsite-page {
  gap: 18px;
}

.subsite-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.subsite-hero h1 {
  margin: 4px 0 6px;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
}

.subsite-hero span,
.subsite-hero-balance span,
.admin-subsite-card-head span,
.admin-subsite-stats span {
  color: var(--muted);
}

.subsite-hero-balance {
  min-width: 150px;
  padding: 14px 18px;
  border: 1px solid var(--primary-border);
  border-radius: 8px;
  background: var(--primary-soft);
  text-align: right;
}

.subsite-hero-balance strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
  line-height: 1;
}

.subsite-metrics {
  margin: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.subsite-tabs {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.subsite-tabs .settings-subtab-panel {
  gap: 12px;
}

.subsite-tabs .settings-subtab-panel > .section-card:first-child {
  margin-top: 0;
}

.subsite-tabs .settings-subtab-nav {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.subsite-overview-grid,
.subsite-balance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.subsite-info-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
}

.subsite-info-list,
.subsite-price-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: stretch;
  gap: 10px;
}

.subsite-info-list div,
.subsite-price-summary div {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 86px;
  padding: 12px;
  background: var(--surface-soft);
}

.subsite-info-list span,
.subsite-price-summary span,
.subsite-price-summary em,
.subsite-balance-summary span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.4;
}

.subsite-info-list strong,
.subsite-price-summary strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subsite-balance-summary {
  display: grid;
  gap: 8px;
  border: 1px solid var(--primary-border);
  border-radius: 8px;
  padding: 18px;
  background: var(--primary-soft);
}

.subsite-balance-summary strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 34px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.subsite-footer-html-field,
.admin-subsite-footer-field {
  grid-column: 1 / -1;
}

.subsite-footer-html-field textarea,
.admin-subsite-footer-field textarea {
  min-height: 96px;
}

.subsite-two-col {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
}

.color-field input[type="color"] {
  width: 100%;
  min-height: 42px;
  padding: 4px;
}

[data-admin-subsites] {
  width: 100%;
  min-width: 1280px;
  table-layout: auto;
}

[data-admin-subsites] th,
[data-admin-subsites] td {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

[data-admin-subsites] .table-primary-text,
[data-admin-subsites] .table-subtext {
  display: inline;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

[data-admin-subsites] .table-subtext::before {
  content: " / ";
}

[data-admin-subsites] .inline-delete-form {
  margin: 0;
}

[data-admin-subsites] th:nth-child(1),
[data-admin-subsites] td:nth-child(1) {
  width: 190px;
}

[data-admin-subsites] th:nth-child(5),
[data-admin-subsites] td:nth-child(5),
[data-admin-subsites] th:nth-child(6),
[data-admin-subsites] td:nth-child(6) {
  width: 150px;
}

[data-admin-subsites] th:nth-child(8),
[data-admin-subsites] td:nth-child(8) {
  width: 96px;
  text-align: right;
}

.admin-subsite-panel {
  width: min(860px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 32px));
}

.admin-subsite-panel .redeem-head {
  padding: 16px 18px;
}

.admin-subsite-form {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.admin-subsite-form-body {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  overflow-y: auto;
  padding: 18px 20px 20px;
}

.admin-subsite-form-section {
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.admin-subsite-form-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.admin-subsite-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.admin-subsite-section-head strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.admin-subsite-section-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.admin-subsite-field-grid,
.admin-subsite-price-grid {
  align-items: end;
}

.admin-subsite-active-field {
  justify-content: space-between;
}

.admin-subsite-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 14px 20px;
  background: var(--surface);
}

.admin-subsite-form-footer .button {
  min-width: 96px;
}

.admin-subsite-theme-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.theme-preset-option {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 9px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}

.theme-preset-option:hover,
.theme-preset-option.active {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text);
}

.theme-preset-option:has(input:checked) {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--text);
}

.theme-preset-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.subsite-theme-preset-swatch {
  width: 30px;
  height: 30px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--swatch-a), var(--swatch-b));
  box-shadow: 0 0 0 1px var(--line);
  pointer-events: none;
}

.theme-preset-option em {
  min-width: 0;
  overflow: hidden;
  font-style: normal;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.admin-subsite-theme-custom {
  grid-template-columns: minmax(140px, 0.8fr) minmax(120px, 1fr) minmax(120px, 1fr);
  align-items: end;
  margin-top: 2px;
}

.admin-subsite-theme-custom.is-locked {
  opacity: 0.68;
}

.admin-subsite-theme-custom .field.is-disabled span,
.admin-subsite-theme-custom .field.is-disabled small {
  color: var(--muted);
}

.filter-bar.subsite-table-filter {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.filter-bar.subsite-table-filter .filter-actions {
  justify-content: flex-start;
}

.admin-subsite-list {
  display: grid;
  gap: 16px;
}

.admin-subsite-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-subsite-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-subsite-card-head strong {
  display: block;
  margin-bottom: 4px;
  font-size: 17px;
}

.admin-subsite-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.admin-subsite-stats span {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.admin-subsite-stats strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
}

.admin-subsite-inline-form {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.admin-withdrawal-actions {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.admin-withdrawal-actions input {
  min-width: 0;
}

.status.pending {
  color: #92400e;
  background: #fffbeb;
}

.status.paid {
  color: #047857;
  background: #ecfdf5;
}

.status.rejected {
  color: #b91c1c;
  background: #fef2f2;
}

[data-subsite-ledger],
[data-subsite-withdrawals],
[data-subsite-users],
[data-admin-subsite-withdrawals] {
  min-width: 860px;
}

@media (max-width: 860px) {
  .subsite-hero {
    display: grid;
  }

  .subsite-two-col {
    grid-template-columns: 1fr;
  }

  .subsite-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .subsite-overview-grid,
  .subsite-balance-grid {
    grid-template-columns: 1fr;
  }

  .subsite-info-list,
  .subsite-price-summary {
    grid-template-columns: 1fr;
  }

  .subsite-hero-balance {
    width: 100%;
    text-align: left;
  }

  .admin-subsite-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-subsite-panel {
    width: 100%;
    max-height: calc(100dvh - 20px - env(safe-area-inset-bottom));
  }

  .admin-subsite-form-body {
    gap: 14px;
    padding: 14px;
  }

  .admin-subsite-form-section {
    padding-bottom: 14px;
  }

  .admin-subsite-section-head {
    display: grid;
    gap: 4px;
  }

  .admin-subsite-field-grid,
  .admin-subsite-price-grid {
    grid-template-columns: 1fr;
  }

  .admin-subsite-theme-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-subsite-theme-custom {
    grid-template-columns: 1fr;
  }

  .admin-subsite-form-footer {
    grid-template-columns: 1fr 1fr;
    display: grid;
    padding: 12px 14px;
  }

  .admin-subsite-form-footer .button {
    width: 100%;
    min-width: 0;
  }

  .admin-withdrawal-actions {
    grid-template-columns: 1fr;
  }
}
