:root {
  --brand: #003dff;
  --brand-rgb: 0, 61, 255;
  --paper: #e8ecf3;
  --paper-deep: #dce3ef;
  --card: #ffffff;
  --ink: #12151c;
  --muted: #5c6370;
  --accent: #003dff;
  --accent-light: #3d6bff;
  --danger: #9f1239;
  --ok: #166534;
  --line: rgba(18, 24, 40, 0.09);
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.07);
  --shadow-brand: 0 8px 28px rgba(0, 45, 200, 0.18);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --sidebar-w: 320px;
  --sidebar-inset: 0.75rem;
  --sidebar-gap: 0.7rem;
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

body {
  height: 100vh;
  overflow: hidden;
}

body.is-auth {
  height: auto;
  min-height: 100vh;
  overflow: auto;
}

.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  margin: var(--sidebar-inset);
  padding: var(--sidebar-inset);
  border-radius: var(--radius-md);
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
  display: flex;
  flex-direction: column;
  gap: var(--sidebar-gap);
  overflow: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.sidebar-brand-logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}

.sidebar-brand-img-fresh {
  height: 18px;
  width: auto;
  display: block;
}

.sidebar-brand-img-bg {
  height: 28px;
  width: auto;
  display: block;
  border-radius: 6px;
}

.sidebar-brand-text {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.03em;
  opacity: 0.92;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-nav-link {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
}

.sidebar-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav-link.is-current {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.sidebar-nav-link.is-live {
  position: relative;
}

.sidebar-nav-link.is-live::after {
  content: "";
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}

.job-banner {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0, 61, 255, 0.18);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
}

.job-banner[hidden] {
  display: none;
}

.job-banner-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.22);
  flex-shrink: 0;
}

.job-banner.is-live .job-banner-dot {
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(0, 61, 255, 0.16);
  animation: job-dot-pulse 1.4s ease-in-out infinite;
}

@keyframes job-dot-pulse {
  50% {
    box-shadow: 0 0 0 7px rgba(0, 61, 255, 0.08);
  }
}

.job-banner-link {
  margin-left: auto;
  border: 0;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.job-banner-link:hover {
  color: #fff;
  filter: brightness(1.08);
}

.btn-new-job {
  font: inherit;
  font-weight: 700;
  font-size: 0.86rem;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.btn-new-job:hover {
  filter: brightness(1.08);
}

.session-boards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.session-jobs {
  margin: 0;
  padding: 0.85rem 0.95rem 0.7rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.session-jobs[hidden] {
  display: none;
}

.session-jobs-empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted, #64748b);
}

.session-jobs-empty[hidden] {
  display: none;
}

.session-jobs-head {
  margin: 0 0 0.65rem;
}

.session-jobs-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.session-jobs-sub {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted, #64748b);
}

.session-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.session-job {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  background: #f8fafc;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.session-job:hover {
  border-color: rgba(0, 61, 255, 0.28);
}

.session-job.is-current {
  border-color: var(--brand);
  background: rgba(0, 61, 255, 0.06);
}

.session-job-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.session-job.is-live .session-job-dot {
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(0, 61, 255, 0.16);
}

.session-job.is-queued {
  border-color: #eab308;
  background: #fefce8;
}

.session-job.is-queued.is-current {
  border-color: #ca8a04;
  background: #fef9c3;
}

.session-job.is-queued .session-job-dot {
  background: #eab308;
  box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.28);
}

.workspace-error {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.88rem;
}

.workspace-error[hidden] {
  display: none;
}

.session-job-text {
  min-width: 0;
}

.session-job-text strong {
  display: block;
  font-size: 0.86rem;
}

.session-job-text span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted, #64748b);
}

.btn-rerun {
  margin-top: 0.35rem;
  width: 100%;
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  padding: 0.65rem 1rem;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.btn-rerun:hover {
  background: rgba(255, 255, 255, 0.08);
}

.library-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.car-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 42vh;
  overflow: auto;
}

.car-nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 0.4rem 0.45rem;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.car-nav-item img {
  width: 2.4rem;
  height: 1.7rem;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.25);
}

.car-nav-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.car-nav-copy strong {
  font-size: 0.8rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.car-nav-copy small {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.62);
}

.car-nav-item:hover,
.car-nav-item.is-current,
.car-nav-item.is-open {
  background: rgba(255, 255, 255, 0.18);
}

.car-nav-item--nested {
  margin-left: 0.85rem;
  width: calc(100% - 0.85rem);
  background: rgba(255, 255, 255, 0.05);
}

.car-nav-item--deep {
  margin-left: 1.55rem;
  width: calc(100% - 1.55rem);
}

.bg-agg {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem 1.1rem;
  margin-bottom: 1rem;
}

.bg-agg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1.2rem;
}

.bg-agg-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.bg-agg-preview {
  width: 5.5rem;
  height: 3.4rem;
  object-fit: cover;
  border-radius: 10px;
  background: #0f1220;
  flex-shrink: 0;
}

.bg-agg-identity h2 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.bg-agg-identity p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.bg-agg-tools .field-label {
  color: var(--muted);
}

.bg-agg-tools .field {
  min-width: 16rem;
  margin: 0;
}

.bg-agg-packs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.bg-agg-pack-hint {
  color: var(--muted);
  font-size: 0.8rem;
}

.bg-agg-angles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
  margin-top: 0.95rem;
}

.angle-tile {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.angle-tile:hover {
  border-color: rgba(0, 61, 255, 0.35);
}

.angle-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0f1220;
}

.angle-tile-meta {
  padding: 0.45rem 0.55rem 0.55rem;
}

.angle-tile-meta strong {
  display: block;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.angle-tile-meta span {
  color: var(--muted);
  font-size: 0.72rem;
}

.bg-gens {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.bg-gens-title {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.bg-gen-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem 1rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  cursor: pointer;
  margin-bottom: 0.45rem;
}

.bg-gen-row:hover {
  border-color: rgba(0, 61, 255, 0.3);
  background: #fff;
}

.bg-gen-thumbs {
  display: flex;
  gap: 0.28rem;
}

.bg-gen-thumbs img {
  width: 2.6rem;
  height: 1.7rem;
  object-fit: cover;
  border-radius: 5px;
  background: #0f1220;
}

.bg-gen-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 10rem;
  flex: 1;
}

.bg-gen-info strong {
  font-size: 0.84rem;
}

.bg-gen-info span {
  color: var(--muted);
  font-size: 0.75rem;
}

.lora-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.lora-switch-btn {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0.22rem 0.5rem;
  cursor: pointer;
}

.lora-switch-btn:hover {
  border-color: rgba(0, 61, 255, 0.35);
}

.lora-switch-btn.is-current {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.bg-gen-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.car-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
}

.car-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 0;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
  font: inherit;
  color: inherit;
}

.car-card:hover {
  border-color: rgba(0, 61, 255, 0.35);
}

.car-card-cover {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #0f1220;
  cursor: pointer;
}

.car-card-cover img,
.car-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0f1220;
}

.car-card-body {
  padding: 0.75rem 0.85rem 0.9rem;
}

.car-card-title {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.car-card-body h3,
.car-card-title h3 {
  margin: 0;
  font-size: 0.98rem;
}

.car-card-body p,
.car-card-title p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.car-card-delete {
  margin-top: 0.65rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--danger);
  background: transparent;
  border: 1px solid rgba(220, 50, 50, 0.28);
  border-radius: 8px;
  padding: 0.28rem 0.55rem;
  cursor: pointer;
}

.car-card-delete:hover {
  background: rgba(220, 50, 50, 0.08);
}

.btn-danger {
  border: 1px solid rgba(220, 50, 50, 0.35);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: #fff;
  color: var(--danger);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover {
  background: rgba(220, 50, 50, 0.08);
}

.btn-danger:disabled,
.car-card-delete:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.car-card-packs {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.7rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.car-card-pack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.car-card-pack-bg {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 2.8rem;
}

.btn-download--compact {
  font-size: 0.72rem;
  padding: 0.22rem 0.45rem;
}

.library-packs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.library-pack-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 1rem;
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.library-pack-title {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 12rem;
}

.library-pack-title strong {
  font-size: 0.92rem;
}

.library-pack-title span {
  color: var(--muted);
  font-size: 0.8rem;
}

.library-pack-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.library-tile {
  position: relative;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  background: #0f1220;
  cursor: pointer;
  text-align: left;
  color: #fff;
}

.library-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.library-tile-meta {
  padding: 0.45rem 0.55rem 0.55rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
  background: #fff;
}

.library-tile-meta strong {
  display: block;
  color: var(--ink);
  font-size: 0.78rem;
  margin-bottom: 0.15rem;
}

.library-tile.is-a {
  border-color: var(--brand);
}

.library-tile.is-b {
  border-color: #c2410c;
}

.library-tile-badge {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  z-index: 1;
  background: var(--brand);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
}

.library-tile.is-b .library-tile-badge {
  background: #c2410c;
}

.library-tile.is-h1:not(.is-a):not(.is-b) {
  border-color: rgba(15, 23, 42, 0.18);
}

.library-tile.is-h1 .library-tile-meta strong {
  color: #0f766e;
}

.library-empty {
  margin-top: 1rem;
  color: var(--muted);
}

.sidebar-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
}

.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.32);
  border-radius: var(--radius-md);
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.06);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.dragover {
  border-color: #fff;
  background: rgba(0, 61, 255, 0.14);
}

.dropzone input[type="file"] {
  display: none;
}

.dropzone-sidebar-inner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.dropzone-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  color: #dbe7ff;
  flex-shrink: 0;
}

.dropzone-sidebar-copy {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.dropzone-sidebar-copy label {
  cursor: pointer;
  font-weight: 600;
  color: #f0f5ff;
}

.dropzone-or {
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.75rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.field-row .field-input,
.field-row .field-select {
  padding: 0.5rem 0.45rem;
  font-size: 0.85rem;
}

.advanced {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 0.55rem;
}

.advanced-summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  cursor: pointer;
  user-select: none;
  min-height: 32px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.7);
}

.advanced-summary::-webkit-details-marker {
  display: none;
}

.advanced-summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
}

.advanced[open] .advanced-summary::before {
  transform: rotate(90deg);
}

.advanced-summary:hover {
  color: rgba(255, 255, 255, 0.92);
}

.advanced[open] .field-row {
  margin-top: 0.5rem;
}

.field-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.7);
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.field-label-row .field-label {
  margin: 0;
}

.flag-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.15rem 0 0.9rem;
  cursor: pointer;
}

.flag-row input {
  margin-top: 0.18rem;
  width: 1rem;
  height: 1rem;
  accent-color: #7eb6ff;
  flex-shrink: 0;
}

.flag-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.flag-hint {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.55);
}

.field-help-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  z-index: 3;
}

.field-help {
  width: 1.05rem;
  height: 1.05rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
  font: 700 0.68rem/1 var(--font-sans);
  cursor: help;
}

.field-help:hover,
.field-help:focus-visible,
.field-help-wrap.is-open .field-help {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  outline: none;
}

.field-help-tip {
  display: none;
}

.field-help-float {
  position: fixed;
  z-index: 80;
  width: 17rem;
  max-width: calc(100vw - 1.25rem);
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: #0b1224;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 32px rgba(8, 14, 30, 0.38);
  color: #eef3ff;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(2px);
  transition: opacity 0.12s ease, visibility 0.12s ease, transform 0.12s ease;
}

.field-help-float.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0.55rem 0.7rem;
  outline: none;
}

.field-input::placeholder,
.field-textarea::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.field-select option {
  color: var(--ink);
}

.field-input--light,
.field-select--light,
.field-textarea {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.field-textarea {
  resize: vertical;
  min-height: 96px;
}

.bg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.bg-tile {
  position: relative;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  aspect-ratio: 16 / 10;
}

.bg-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bg-tile span {
  position: absolute;
  left: 0.35rem;
  bottom: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}

.bg-tile.is-selected {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.btn-generate,
.btn-primary {
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}

.btn-generate {
  margin-top: 0.2rem;
  padding: 0.85rem 1rem;
  background: #fff;
  color: var(--brand);
  box-shadow: 0 8px 20px rgba(0, 20, 90, 0.18);
}

.btn-generate:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-generate:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-primary {
  padding: 0.7rem 1.1rem;
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-light);
}

.form-hint {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
}

.form-error {
  margin: 0;
  font-size: 0.82rem;
  color: #fecaca;
}

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.25rem 1.25rem;
  overflow: auto;
}

.photo-list {
  list-style: none;
  margin: -0.15rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.photo-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.photo-list-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.88);
}

.photo-list-remove {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  font-size: 1rem;
}

.photo-list-remove:hover {
  background: rgba(255, 80, 80, 0.35);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-batch-download {
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  background: var(--brand);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  box-shadow: var(--shadow-brand);
}

.btn-batch-download:hover {
  background: var(--accent-light);
}

.results-batch {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
}

.pack-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pack-card-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #0f1220;
}

.pack-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pack-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
}

.pack-card-badge {
  position: absolute;
  left: 0.55rem;
  bottom: 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: rgba(10, 14, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  backdrop-filter: blur(6px);
}

.pack-card-body {
  padding: 0.85rem 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.pack-card-body h3 {
  margin: 0;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pack-card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  flex: 1;
}

.pack-card-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.btn-secondary {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid rgba(0, 61, 255, 0.28);
  background: rgba(0, 61, 255, 0.08);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(0, 61, 255, 0.14);
}

.btn-secondary:disabled,
.btn-download.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.single-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.single-zoom-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.result-card img.is-zoomable {
  cursor: zoom-in;
}

.meta-dialog-close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: rgba(18, 24, 40, 0.06);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.meta-dialog-close:hover {
  background: rgba(18, 24, 40, 0.1);
}

.pack-dialog,
.zoom-dialog {
  border: none;
  padding: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  max-width: min(1100px, calc(100vw - 2rem));
  width: 100%;
}

.pack-dialog--wide {
  max-width: min(1280px, calc(100vw - 2rem));
}

.pack-dialog--wide .pack-dialog-inner {
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.pack-dialog--wide .results-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.pack-dialog-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.gen-viewer-hero {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.gen-viewer-hero img {
  width: 100%;
  max-height: min(72vh, 860px);
  object-fit: contain;
  background: #0f1220;
  border-radius: 12px;
  cursor: zoom-out;
}

.gen-viewer-back {
  align-self: flex-start;
}

.pack-dialog::backdrop,
.zoom-dialog::backdrop {
  background: rgba(10, 14, 24, 0.55);
  backdrop-filter: blur(4px);
}

.pack-dialog-inner,
.zoom-dialog-inner {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.15rem;
}

.pack-dialog-head,
.zoom-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.pack-dialog-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.pack-dialog-head h3 {
  margin: 0.1rem 0 0;
  font-size: 1.15rem;
}

.pack-dialog-actions,
.zoom-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.zoom-dialog {
  max-width: min(1200px, calc(100vw - 1.5rem));
}

.zoom-toolbar span {
  font-weight: 700;
}

.zoom-btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  min-width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.zoom-btn:hover {
  border-color: rgba(0, 61, 255, 0.35);
  color: var(--accent);
}

.zoom-viewport {
  position: relative;
  width: 100%;
  height: min(70vh, 720px);
  overflow: hidden;
  border-radius: 12px;
  background: #0f1220;
  cursor: grab;
  touch-action: none;
}

.zoom-viewport:active {
  cursor: grabbing;
}

.zoom-viewport img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  pointer-events: none;
}

.zoom-hint {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.photo-results {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.photo-results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.photo-results-head h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.photo-results-state {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.photo-results-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.84rem;
  white-space: pre-wrap;
}

.main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.main-title {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.main-sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  font-weight: 600;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15);
}

.status-pill.is-error .status-dot {
  background: var(--danger);
}

.status-pill.is-done .status-dot {
  background: var(--ok);
}

.status-pill.is-queued {
  border-color: #eab308;
  background: #fefce8;
  color: #854d0e;
}

.status-pill.is-queued .status-dot {
  background: #eab308;
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.28);
}

.workspace {
  flex: 1;
}

.empty-card {
  max-width: 36rem;
  margin: 4rem auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2rem;
  text-align: center;
}

.empty-logo {
  height: 22px;
  width: auto;
  margin-bottom: 1rem;
}

.empty-card h2 {
  margin: 0 0 0.4rem;
}

.empty-card p {
  margin: 0;
  color: var(--muted);
}

.progress-card,
.feedback-card,
.compare-card,
.result-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.compare-card {
  margin-top: 1rem;
  padding: 1.1rem 1.2rem 1.25rem;
}

.compare-head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}

.compare-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.compare-head p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.compare-badge {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 61, 255, 0.1);
  color: var(--brand);
  font-weight: 800;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.compare-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 0.95rem;
}

.compare-photo-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
}

.compare-photo-row .field-select {
  flex: 1;
  min-width: 0;
}

.compare-photo-btn {
  width: 2.1rem;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.compare-photo-btn:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}

.compare-photo-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.compare-stage {
  width: 100%;
}

.compare-frame {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #0f1220;
  user-select: none;
  touch-action: none;
  aspect-ratio: 16 / 10;
}

.compare-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  background: #0f1220;
}

.compare-clip {
  position: absolute;
  inset: 0;
  width: 50%;
  overflow: hidden;
  z-index: 2;
}

.compare-img--a {
  width: var(--compare-frame-w, 100%);
  max-width: none;
}

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  z-index: 3;
  pointer-events: none;
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.1rem;
  height: 2.1rem;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #fff;
  border: 2px solid var(--brand);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

.compare-handle::before,
.compare-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transform: translateY(-50%);
}

.compare-handle::before {
  left: 0.35rem;
  border-right: 6px solid var(--brand);
}

.compare-handle::after {
  right: 0.35rem;
  border-left: 6px solid var(--brand);
}

.compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 4;
}

.compare-labels {
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.65rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  z-index: 5;
  pointer-events: none;
}

.compare-labels span {
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: rgba(10, 14, 24, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  backdrop-filter: blur(6px);
}

@media (max-width: 960px) {
  .compare-controls {
    grid-template-columns: 1fr;
  }
}

.progress-card {
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.progress-card.is-queued {
  background: #fefce8;
  border: 1px solid #facc15;
}

.progress-card.is-queued .progress-bar {
  background: #eab308;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--paper-deep);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--accent-light));
  transition: width 0.45s ease-out;
}

.progress-msg {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.result-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.result-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0f1220;
  display: block;
}

.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
}

.result-meta strong {
  font-size: 0.95rem;
  margin-right: auto;
}

.btn-download {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  border: 1px solid rgba(0, 61, 255, 0.28);
  background: rgba(0, 61, 255, 0.08);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
}

.btn-download:hover {
  background: rgba(0, 61, 255, 0.14);
}

.feedback-card {
  margin-top: 1rem;
  padding: 1.1rem 1.2rem 1.25rem;
}

.feedback-head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}

.feedback-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.feedback-head p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.feedback-badge {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 61, 255, 0.1);
  color: var(--brand);
  font-weight: 800;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.feedback-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.feedback-form .field:nth-child(3),
.feedback-form .field:nth-child(4),
.feedback-actions {
  grid-column: 1 / -1;
}

.feedback-form .field-label {
  color: var(--muted);
}

.stars {
  display: flex;
  gap: 0.25rem;
}

.star {
  border: none;
  background: transparent;
  color: #c5cad6;
  font-size: 1.35rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.star.is-active {
  color: #f59e0b;
}

.feedback-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.feedback-ok {
  margin: 0;
  color: var(--ok);
  font-weight: 600;
}

.auth-gate {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  overflow: hidden;
  background: #0b0f18;
}

.auth-gate-bg {
  position: absolute;
  inset: -24px;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(8, 12, 22, 0.28) 0%, rgba(8, 12, 22, 0.42) 55%, rgba(8, 12, 22, 0.55) 100%),
    url("/static/assets/img/auth-bg.jpg") center / cover no-repeat;
  filter: blur(16px) saturate(1.05) brightness(0.92);
  transform: scale(1.08);
  pointer-events: none;
}

/* Правила display иначе перекроют атрибут hidden. */
.auth-gate[hidden],
.app-shell[hidden],
.user-chip[hidden] {
  display: none !important;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 2rem 1.75rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px rgba(7, 13, 24, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.auth-logo-fresh {
  display: block;
  height: 28px;
  width: auto;
}

.auth-logo-bg {
  display: block;
  height: 34px;
  width: auto;
  margin-left: auto;
}

.auth-title {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.auth-sub {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-forgot {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.auth-forgot:hover {
  text-decoration: underline;
}

.auth-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.auth-field input {
  width: 100%;
  font: inherit;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: #12151c;
  caret-color: #12151c;
  -webkit-text-fill-color: #12151c;
  outline: none;
}

.auth-field input::placeholder {
  color: #5c6370;
  -webkit-text-fill-color: #5c6370;
  opacity: 1;
}

.auth-field input:focus {
  outline: 2px solid rgba(0, 61, 255, 0.25);
  border-color: var(--brand);
}

.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: #12151c;
  caret-color: #12151c;
  box-shadow: 0 0 0 1000px #fff inset;
  transition: background-color 99999s ease-in-out 0s;
}

.auth-hint {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.auth-hint[hidden] {
  display: none !important;
}

.auth-error {
  margin: 0.75rem 0 0;
  color: var(--danger);
  font-size: 0.88rem;
}

.auth-error[hidden] {
  display: none !important;
}

.auth-ok {
  margin: 0.75rem 0 0;
  color: var(--ok);
  font-size: 0.88rem;
  line-height: 1.4;
}

.auth-ok[hidden] {
  display: none !important;
}

.auth-card-footer {
  margin-top: 1.25rem;
}

.auth-footer-actions-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.5rem;
}

.auth-actions {
  flex: 1 1 auto;
  min-width: 190px;
}

.auth-mode-switch {
  display: flex;
  gap: 0.5rem;
  flex: 0 0 118px;
  min-width: 0;
  position: relative;
  z-index: 2;
}

.auth-mode-switch[hidden] {
  display: none !important;
}

.auth-btn {
  width: 100%;
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

.auth-btn:hover {
  filter: brightness(1.06);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-mode-secondary {
  width: 100%;
  font: inherit;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.auth-mode-secondary:hover {
  border-color: rgba(0, 61, 255, 0.35);
  background: rgba(0, 61, 255, 0.04);
}

.auth-mode-secondary[hidden] {
  display: none !important;
}

@media (max-width: 420px) {
  .auth-footer-actions-row {
    flex-direction: column;
  }

  .auth-actions,
  .auth-mode-switch {
    flex: 1 1 auto;
    min-width: 0;
  }
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.35rem 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(18, 24, 40, 0.05);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 340px;
}

.user-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-badge {
  flex-shrink: 0;
  overflow: visible;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
  background: rgba(0, 61, 255, 0.1);
  border-radius: 999px;
  padding: 0.12rem 0.4rem;
}

.btn-logout {
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
}

.btn-logout:hover {
  border-color: rgba(0, 61, 255, 0.35);
  color: var(--brand);
}

@media (max-width: 960px) {
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    width: auto;
    max-height: none;
  }

  .results-grid,
  .feedback-form {
    grid-template-columns: 1fr;
  }
}

.detail-back {
  margin-bottom: 0.75rem;
}

.job-params {
  margin-top: 0.35rem;
  font-size: 0.85rem;
}

.job-params-summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  width: fit-content;
}

.job-params-body {
  margin-top: 0.5rem;
  padding: 0.75rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 60vh;
  overflow: auto;
}

.job-params-job + .job-params-job {
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.job-params-job h3 {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
}

.job-params-note {
  margin: 0;
  color: var(--muted);
}

.job-params-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 0.9rem;
  margin: 0;
}

.job-params-list dt {
  color: var(--muted);
}

.job-params-list dd {
  margin: 0;
  word-break: break-word;
}

.job-params-photos {
  margin-top: 0.6rem;
  border-collapse: collapse;
  width: 100%;
}

.job-params-photos th,
.job-params-photos td {
  text-align: left;
  padding: 0.2rem 0.5rem 0.2rem 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.job-params-photos th {
  color: var(--muted);
  font-weight: 600;
}

.compare-edit {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.compare-edit[hidden] {
  display: none;
}

.regen-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin: 0 0 0.9rem;
}
.regen-row[hidden] {
  display: none;
}
.regen-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.regen-model {
  width: auto;
  min-width: 14rem;
  max-width: 100%;
}
.regen-settings-btn {
  font: inherit;
  font-size: 0.82rem;
  color: var(--brand);
  background: none;
  border: 0;
  padding: 0.2rem 0.3rem;
  cursor: pointer;
  text-decoration: underline;
}
.regen-quota {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}
.regen-status {
  font-size: 0.82rem;
  color: var(--muted);
}
.regen-status.is-ok {
  color: #166534;
}
.regen-status.is-warn {
  color: #92400e;
}
.regen-status.is-bad {
  color: var(--danger);
}
.regen-toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%) translateY(1rem);
  max-width: min(32rem, 92vw);
  padding: 0.65rem 1rem;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
}
.regen-toast.is-on {
  opacity: 1;
  transform: translateX(-50%);
}
.regen-toast.is-bad {
  background: var(--danger);
}
.regen-dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  width: min(36rem, 94vw);
  max-height: 90vh;
  overflow: auto;
}
.regen-dialog::backdrop {
  background: rgba(17, 24, 39, 0.45);
}
.regen-form h3 {
  margin: 0 0 0.35rem;
}
.regen-hint {
  margin: 0 0 0.8rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.regen-field {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
}
.regen-models {
  display: grid;
  gap: 0.3rem;
  max-height: 14rem;
  overflow: auto;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.regen-model-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
}
.regen-custom,
.regen-row2,
.regen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.7rem;
}
.regen-custom input {
  flex: 1;
  min-width: 14rem;
}
.regen-row2 .regen-field {
  flex: 1;
  min-width: 12rem;
  margin-bottom: 0;
}
.regen-actions .btn-link {
  font: inherit;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
}

.upload-box {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.45rem;
}

.upload-box[hidden] {
  display: none;
}

.upload-bar {
  width: 100%;
  height: 10px;
  accent-color: #fff;
}

.upload-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.35;
  color: #fff;
  overflow-wrap: anywhere;
}

.btn-upload-cancel {
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.btn-upload-cancel:hover {
  background: rgba(255, 255, 255, 0.15);
}
