.api-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.api-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 1.25rem;
}

.api-sidebar {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  max-height: 70vh;
  overflow: auto;
}

.api-sidebar-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #2d3748;
}

.api-endpoints-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
}

.api-hint-item {
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  color: #4a5568;
}

.api-hint-item:hover {
  background: #edf2f7;
}

.api-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.api-form {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
}

.api-row {
  margin-bottom: 0.75rem;
}

.api-method {
  max-width: 120px;
}

.api-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.api-status {
  font-size: 0.85rem;
}

.api-status-ok {
  color: #276749;
}

.api-status-error {
  color: #c53030;
}

.api-status-running {
  color: #3182ce;
}

.api-response {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
}

.api-response-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: #2d3748;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #1a1a1a;
  background: linear-gradient(145deg, #f0f2f5 0%, #e4e8ec 100%);
  min-height: 100vh;
}

.layout {
  max-width: 420px;
  margin: 0 auto;
  padding: 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #2d3748;
}

.header-actions {
  font-size: 0.9rem;
  color: #4a5568;
}

.main {
  flex: 1;
}

/* Top navigation */
.nav {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2d3748;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo:hover {
  color: #3182ce;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.nav-link {
  padding: 0.5rem 0.75rem;
  color: #4a5568;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.nav-link:hover {
  background: #edf2f7;
  color: #2d3748;
}

.nav-link.active {
  background: #ebf8ff;
  color: #3182ce;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-dropdown-toggle::after {
  content: '';
  border: 4px solid transparent;
  border-top-color: currentColor;
  margin-top: 4px;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 220px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
  z-index: 50;
}

.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-item {
  display: block;
  padding: 0.5rem 0.75rem;
  color: #4a5568;
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: 6px;
}

.nav-dropdown-item:hover {
  background: #edf2f7;
  color: #2d3748;
}

.nav-user {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #4a5568;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.nav-user:hover {
  background: #3182ce;
  color: #fff;
}

.nav-user svg {
  width: 20px;
  height: 20px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.nav-balance {
  font-size: 0.9rem;
  font-weight: 600;
  color: #2d3748;
  padding: 0.25rem 0.5rem;
  background: #edf2f7;
  border-radius: 6px;
}

.cabinet-guest .btn-primary {
  margin-top: 1rem;
}

.cabinet-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cabinet-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.cabinet-section-title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #2d3748;
}

.cabinet-card p {
  margin: 0.5rem 0;
}

.cabinet-card strong {
  color: #4a5568;
  margin-right: 0.5rem;
}

.cabinet-actions {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-secondary {
  padding: 0.5rem 1rem;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  background: #fff;
  color: #4a5568;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-secondary:hover:not(:disabled) {
  background: #edf2f7;
  border-color: #a0aec0;
}

.resources-loading,
.resources-empty,
.resources-error {
  color: #718096;
  margin: 0;
}

.resources-error {
  color: #c53030;
}

.resources-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.resource-bar {
  margin: 0;
}

.resource-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.resource-bar-label {
  font-weight: 500;
  color: #2d3748;
}

.resource-bar-value {
  color: #4a5568;
}

.resource-bar-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.resource-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.resource-bar-fill--ok {
  background: #48bb78;
}

.resource-bar-fill--warn {
  background: #ecc94b;
}

.resource-bar-fill--low {
  background: #f56565;
}

.tariffs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tariff-card {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.75rem;
}

.tariff-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tariff-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.tariff-name-block {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tariff-name {
  font-weight: 600;
  color: #2d3748;
}

.tariff-price {
  font-weight: 600;
  color: #3182ce;
}

.tariff-tag-current {
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: #c6f6d5;
  color: #276749;
}

.tariff-resources {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: #4a5568;
}

.tariff-resources li {
  margin-bottom: 0.15rem;
}

.tariff-actions {
  margin-top: 0.5rem;
}

.tariffs-loading {
  color: #718096;
}

.tariffs-empty,
.tariffs-error {
  color: #718096;
  margin: 0.5rem 0;
}

.tariffs-error {
  color: #c53030;
}

/* Poses */
.pose-form {
  max-width: 600px;
}

.pose-form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.poses-loading {
  color: #718096;
  margin: 0.5rem 0;
}

.poses-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.pose-card {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.pose-card:last-child {
  border-bottom: none;
}

.pose-main {
  display: flex;
  gap: 0.75rem;
}

.pose-image img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.pose-info {
  flex: 1;
}

.pose-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.pose-name {
  font-weight: 600;
  color: #2d3748;
}

.pose-rule {
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #edf2f7;
  color: #4a5568;
}

.pose-description {
  margin: 0;
  font-size: 0.9rem;
  color: #4a5568;
}

.pose-actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pose-image-select {
  margin-top: 0.75rem;
}

.pose-image-select-title {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: #4a5568;
}

.pose-image-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pose-image-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}

.pose-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pose-image-thumb:hover {
  border-color: #cbd5e0;
  transform: translateY(-1px);
}

.pose-image-thumb.selected {
  border-color: #3182ce;
  box-shadow: 0 0 0 1px rgba(49, 130, 206, 0.4);
}

/* Custom prompts */
.custom-prompts-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.custom-prompt-card {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.custom-prompt-card:last-child {
  border-bottom: none;
}

.custom-prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.custom-prompt-name {
  font-weight: 600;
  color: #2d3748;
}

.custom-prompt-text {
  white-space: pre-wrap;
  font-size: 0.9rem;
  color: #4a5568;
  margin: 0.25rem 0 0;
}

.custom-prompt-actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Task templates */
.templates-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.template-card {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.template-card:last-child {
  border-bottom: none;
}

.template-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.template-name {
  font-weight: 600;
  color: #2d3748;
}

.template-type {
  font-size: 0.85rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: #edf2f7;
  color: #4a5568;
}

.template-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #718096;
  margin-bottom: 0.25rem;
}

.templates-items-list {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: #4a5568;
}

.templates-items-empty {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: #718096;
}

.template-actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.template-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.template-form-field {
  flex: 1 1 180px;
}

.template-items-caption {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: #718096;
}

.template-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.template-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.template-item-card:last-child {
  border-bottom: none;
}

.template-item-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.template-item-order {
  font-weight: 600;
  color: #4a5568;
  min-width: 2rem;
}

.template-item-body {
  color: #4a5568;
}

.template-item-actions {
  display: flex;
  gap: 0.25rem;
}

.template-item-actions button {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

.template-items-actions {
  margin-top: 0.75rem;
}

.billing-topup-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
  align-items: center;
}

.billing-topup-form .form-input {
  max-width: 200px;
}

.billing-topup-hint {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #718096;
}

.billing-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.billing-item {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.9rem;
}

.billing-item:last-child {
  border-bottom: none;
}

.billing-item-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.billing-amount {
  font-weight: 600;
  color: #2d3748;
}

.billing-status {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}

.billing-status--created {
  background: #edf2f7;
  color: #4a5568;
}

.billing-status--payment_pending {
  background: #ebf8ff;
  color: #3182ce;
}

.billing-status--paid {
  background: #c6f6d5;
  color: #276749;
}

.billing-status--canceled,
.billing-status--refunded,
.billing-status--unknown {
  background: #fed7d7;
  color: #c53030;
}

.billing-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: #718096;
}

.billing-item-error {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: #c53030;
}

.billing-loading {
  color: #718096;
}

.stub-page {
  text-align: center;
  padding: 4rem 2rem;
  color: #718096;
}

.stub-page h2 {
  color: #2d3748;
  margin-bottom: 0.5rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
}

.tab {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid #cbd5e0;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  color: #4a5568;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.tab:hover {
  background: #f7fafc;
  border-color: #a0aec0;
}

.tab.active {
  background: #3182ce;
  border-color: #3182ce;
  color: #fff;
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form input,
.form-input {
  padding: 0.75rem 1rem;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form input:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

.form input::placeholder {
  color: #a0aec0;
}

.form button {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: #3182ce;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.form button:hover {
  background: #2c5282;
}

.form button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.link {
  color: #3182ce;
  text-decoration: none;
  font-size: 0.9rem;
}

.link:hover {
  text-decoration: underline;
}

.message {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.message.error {
  background: #fed7d7;
  color: #c53030;
}

.message.success {
  background: #c6f6d5;
  color: #276749;
}

.hidden {
  display: none !important;
}

/* Me section */
.me-section h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  color: #2d3748;
}

.me-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.me-card p {
  margin: 0.5rem 0;
}

.me-card strong {
  color: #4a5568;
  margin-right: 0.5rem;
}

.me-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-primary {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: #3182ce;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #2c5282;
}

.btn-logout {
  padding: 0.6rem 1.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #4a5568;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-logout:hover {
  background: #fed7d7;
  color: #c53030;
  border-color: #feb2b2;
}

.header-link {
  color: #3182ce;
  text-decoration: none;
  font-weight: 500;
}

.header-link:hover {
  text-decoration: underline;
}

.auth-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Generate page */
.layout--wide {
  max-width: 720px;
}

.header-link {
  color: inherit;
  text-decoration: none;
}

.header-link:hover {
  color: #3182ce;
}

.page-title {
  margin: 0 0 1.5rem;
  font-size: 1.25rem;
  color: #2d3748;
}

.selected-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 560px) {
  .selected-images {
    grid-template-columns: 1fr;
  }
}

.selected-box {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.selected-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  text-align: center;
}

.selected-label {
  font-weight: 600;
  color: #2d3748;
}

.selected-hint {
  font-size: 0.85rem;
  color: #718096;
}

.selected-preview {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.selected-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.selected-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
  z-index: 10;
}

.selected-remove:hover {
  background: #c53030;
}

.selected-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.gallery-section {
  margin-top: 2rem;
}

.gallery-upload-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.gallery-upload-row .hidden {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.gallery-upload-hint {
  font-size: 0.9rem;
  color: #4a5568;
}

.gallery-title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: #2d3748;
}

.gallery-loading,
.gallery-empty {
  text-align: center;
  padding: 2rem;
  color: #718096;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.gallery-pagination {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: #4a5568;
}

.gallery-page-info {
  flex: 1;
  text-align: center;
}

.gallery-page-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #cbd5e0;
  background: #fff;
  color: #4a5568;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.gallery-page-btn:hover:not(:disabled) {
  background: #edf2f7;
}

.gallery-page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gallery-item {
  aspect-ratio: 1;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  background: #f7fafc;
  position: relative;
}

.gallery-item:hover {
  border-color: #3182ce;
  transform: scale(1.02);
}

.gallery-item.selected {
  border-color: #3182ce;
  border-width: 3px;
  box-shadow: 0 0 0 2px rgba(49, 130, 206, 0.2);
}

.gallery-item.selected-main::before {
  content: 'Основное';
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  background: #3182ce;
  color: #fff;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  z-index: 5;
  pointer-events: none;
}

.gallery-item.selected-template::before {
  content: 'Шаблон';
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  background: #38a169;
  color: #fff;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  z-index: 5;
  pointer-events: none;
}

.gallery-item-actions-btn {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.7);
  color: #e5e7eb;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  z-index: 6;
}

.gallery-item-actions-btn:hover {
  background: rgba(30, 64, 175, 0.9);
}

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

.generate-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

#newTaskSection {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.generate-form .form-input {
  padding: 0.75rem 1rem;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.generate-form .form-input:focus,
.generate-form .form-textarea:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

.form-label {
  display: block;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.35rem;
}

.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-select:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

.generate-actions {
  display: flex;
  justify-content: center;
}

.btn-generate {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  background: #3182ce;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-generate:hover:not(:disabled) {
  background: #2c5282;
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.task-status {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.task-status-content {
  text-align: center;
}

.task-status-text {
  font-size: 1rem;
  color: #2d3748;
  margin-bottom: 1rem;
}

.task-result {
  margin-top: 1rem;
}

.result-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-description {
  text-align: left;
}

.result-description-title {
  font-weight: 600;
  color: #2d3748;
  margin: 0 0 0.5rem;
}

.result-prompts {
  margin: 0;
  padding-left: 1.25rem;
}

.result-prompts li {
  margin-bottom: 0.5rem;
  color: #4a5568;
}

.result-json {
  margin: 0;
  padding: 1rem;
  background: #f7fafc;
  border-radius: 8px;
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.prompts-form {
  text-align: left;
}

.prompts-form-title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #2d3748;
}

.prompt-item {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.prompt-item:last-of-type {
  margin-bottom: 0;
}

.prompt-item-content {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.prompt-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.prompt-input:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

.prompt-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.prompt-status {
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

.prompt-status.status-created {
  color: #4a5568;
  background: #edf2f7;
}

.prompt-status.status-processing {
  color: #3182ce;
  background: #ebf8ff;
}

.prompt-status.status-success {
  color: #276749;
  background: #c6f6d5;
}

.prompt-status.status-error {
  color: #c53030;
  background: #fed7d7;
}

.btn-generate-single {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: #3182ce;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-generate-single:hover:not(:disabled) {
  background: #2c5282;
}

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

.btn-show-result {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: #38a169;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-show-result:hover {
  background: #2f855a;
}

.prompt-result {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.process-result-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.prompt-result .error {
  color: #c53030;
  margin: 0;
}

.prompts-actions {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.btn-generate-all {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  background: #38a169;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-generate-all:hover {
  background: #2f855a;
}

/* Gallery modal */
.gallery-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.gallery-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
}

.gallery-modal-content {
  position: relative;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 16px;
  max-width: 1100px;
  width: 100%;
  max-height: 90vh;
  margin: 0 1rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.gallery-modal-content--small {
  max-width: 420px;
}

.gallery-modal-body.gallery-modal-body--simple {
  padding: 1.5rem 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

.gallery-modal-simple-text p {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  text-align: center;
}

.gallery-modal-simple-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.gallery-modal-simple-actions .btn-secondary,
.gallery-modal-simple-actions .btn-danger {
  width: 100%;
}

.gallery-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-modal-close:hover {
  background: rgba(30, 64, 175, 0.9);
}

.gallery-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 1.6fr);
  gap: 0;
}

.gallery-modal-image-wrap {
  position: relative;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-modal-image-wrap--select {
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
}

.gallery-modal-image-wrap--select .gallery-albums-header {
  width: 100%;
  margin-bottom: 0.75rem;
}

.gallery-modal-image-wrap--select .gallery-loading,
.gallery-modal-image-wrap--select .gallery-empty {
  padding: 1rem;
}

.gallery-modal-image-wrap--select .gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
  max-height: 55vh;
  overflow-y: auto;
  margin-top: 0.75rem;
  align-content: flex-start;
}

.gallery-modal-image-wrap--select .gallery-pagination {
  margin-top: 0.75rem;
}

/* В модалке выбора изображений убираем верхнюю пагинацию — оставляем только нижнюю */
.gallery-modal-image-wrap--select .gallery-pagination:first-of-type {
  display: none;
}

.gallery-modal-image-wrap--select .gallery-item {
  flex: 0 0 180px;
}

.gallery-modal-image {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.gallery-modal-sidebar {
  padding: 1.5rem 1.5rem 1.75rem;
  border-left: 1px solid rgba(148, 163, 184, 0.4);
  background: linear-gradient(to bottom right, #020617, #020617 45%, #020617);
}

.gallery-modal-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: #e2e8f0;
}

.gallery-modal-albums {
  max-height: 260px;
  overflow-y: auto;
  padding-right: 0.25rem;
  margin-bottom: 1rem;
}

.gallery-album-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  padding: 0.25rem 0;
}

.gallery-album-checkbox input[type='checkbox'] {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.gallery-modal-save {
  width: 100%;
  margin-top: 0.25rem;
}

.gallery-modal-hint {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.gallery-albums-header {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  align-items: center;
}

.gallery-view-toggle {
  display: inline-flex;
  gap: 0.5rem;
  margin-left: auto;
}

.gallery-view-btn {
  font-size: 0.85rem;
  padding-inline: 0.75rem;
}

.gallery-view-btn--active {
  background: #3182ce;
  color: #fff;
  border-color: #3182ce;
}
