:root {
  --bg-page: #f3f4f6;
  --bg-card: #ffffff;
  --border-subtle: #e5e7eb;
  --text-main: #111827;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --primary-dark: #1d4ed8;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 4px 10px rgba(15, 23, 42, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.veo-body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #e0f2fe 0, #f3f4f6 45%, #f9fafb 100%);
  color: var(--text-main);
}

/* APP SHELL */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: linear-gradient(to right, rgba(255, 255, 255, 0.9), rgba(249, 250, 251, 0.9));
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #93c5fd 0, #2563eb 40%, #1d4ed8 70%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #eff6ff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.app-title-group {
  display: flex;
  flex-direction: column;
}

.app-title {
  font-size: 16px;
  font-weight: 600;
}

.app-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.app-nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.nav-link {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.15s ease-out;
}

.nav-link:hover {
  background: #e5e7eb;
  color: #111827;
}

.nav-link-active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: #bfdbfe;
}

.app-main {
  flex: 1;
  padding: 24px;
  display: flex;
  justify-content: center;
}

/* MAIN WRAPPER */

#veo-generator-advanced {
  width: 100%;
  max-width: 1220px;
}

/* CARDS & LAYOUT */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px 18px 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(229, 231, 235, 0.9);
}

.card-auth {
  max-width: 420px;
  width: 100%;
  margin: 32px auto;
}

.card-config {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 6px;
}

.card-desc {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* GRID LAYOUT */

.grid-two-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.grid-full-width {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

/* BLOCKS */

.veo-block h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 15px;
}

.block-desc {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.subsection {
  margin-bottom: 12px;
}

.inline-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.field-label {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  display: block;
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* INPUTS */
.input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  background: #f9fafb;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.input:focus {
  border-color: #60a5fa;
  background: #ffffff;
  box-shadow: 0 0 0 1px #bfdbfe;
}

.input.textarea {
  resize: vertical;
  min-height: 60px;
}


.short-input {
  max-width: 90px;
}

.options-group {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.options-group label {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

/* BUTTONS */

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease-out;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary.btn-outline {
  background: #eff6ff;
  color: var(--primary-dark);
  border-color: #bfdbfe;
  box-shadow: none;
}

.btn-primary.btn-outline:hover {
  background: #dbeafe;
}

.btn-secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn-secondary:hover {
  background: #d1d5db;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: wait;
}

.full-width-btn {
  width: 100%;
}

/* FORM HELPERS */

.form-row {
  margin-bottom: 14px;
}

.form-row label {
  font-size: 13px;
  font-weight: 500;
  display: block;
  margin-bottom: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px 18px;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-linklike {
  text-decoration: none;
  text-align: center;
}

/* AUTH PAGE */

.form-footer {
  margin-top: 10px;
}

.helper-text {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ALERTS */

.alert {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
}

.alert-success {
  background: #ecfdf5;
  border: 1px solid #22c55e;
  color: #166534;
}

.alert-danger {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  color: #991b1b;
}

/* TOAST */

#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #111827;
  color: #f9fafb;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}

#toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* FLOW ROW */

.flow-row {
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 10px;
  background: #f3f4f6;
  border: 1px dashed #e5e7eb;
}

.flow-row > div:first-child {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

/* RESPONSIVE */

@media (max-width: 960px) {
  .app-main {
    padding: 16px;
  }
  .grid-two-columns {
    grid-template-columns: minmax(0, 1fr);
  }
  .card {
    border-radius: 14px;
  }
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .app-nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .card-auth {
    margin-top: 24px;
  }
}


/* Character list grid */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.char-card-item {
  padding: 12px;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.char-thumb-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  max-height: 220px;
}

.char-thumb-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.char-card-text {
  font-size: 13px;
}

.char-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.char-short {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.char-meta {
  font-size: 11px;
  color: #9ca3af;
}

.char-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.char-btn-small {
  flex: 1;
  justify-content: center;
  font-size: 12px;
  padding: 6px 0;
}

.char-btn-danger {
  background: #fee2e2;
  color: #b91c1c;
}

/* Form preview */
.char-preview-box {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  max-width: 240px;
}

.char-preview-box img {
  display: block;
  width: 100%;
  height: auto;
}

/* Template pills */
.char-template-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.char-template-pills .pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  font-size: 11px;
  color: #374151;
  background: #f9fafb;
  text-decoration: none;
}

.char-template-pills .pill:hover {
  background: #e5f0ff;
  border-color: #bfdbfe;
}

/* Character picker di generator */
.char-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.char-picker-card {
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  padding: 8px;
  display: flex;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.char-picker-card input[type="checkbox"] {
  margin-right: 6px;
}

.char-picker-thumb {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.char-picker-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.char-picker-text {
  font-size: 12px;
  color: #374151;
}

.char-picker-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}

.char-picker-card.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #bfdbfe;
  background: #eff6ff;
}

