/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --border: #2a2a3d;
  --border-subtle: #1e1e2e;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a8;
  --text-muted: #555570;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.12);
  --accent-glow: rgba(59, 130, 246, 0.25);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --gold: #d4af37;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.6);
  --transition: 0.2s ease;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Layout ===== */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ===== Header ===== */
header {
  text-align: center;
  padding: 3rem 0 2.5rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: var(--accent-light);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 16px;
  margin-bottom: 1.25rem;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #e8e8f0 0%, #8888a8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ===== Card ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

/* ===== Form ===== */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
}

.form-group input[type="text"],
.form-group select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input[type="text"]::placeholder {
  color: var(--text-muted);
}

.select-wrapper {
  position: relative;
}

.select-wrapper select {
  padding-right: 2.5rem;
  cursor: pointer;
}

.select-arrow {
  position: absolute;
  right: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
}

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

.btn-primary {
  width: 100%;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  padding: 0.875rem 1.5rem;
  margin-top: 0.5rem;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  width: 100%;
  justify-content: center;
  margin-top: 1.25rem;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.download-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.btn-download {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  justify-content: center;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
}

.btn-download:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-copy-all {
  grid-column: 1 / -1;
  background: var(--success-light);
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--success);
}

.btn-copy-all:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--success);
  color: var(--success);
}

/* ===== Progress Section ===== */
.progress-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

#progress-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-bar-container {
  background: var(--bg-secondary);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  border-radius: 999px;
  transition: width 0.5s ease;
}

.progress-steps {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chapter-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

.chapter-item.done {
  color: var(--success);
}

.chapter-item.active {
  color: var(--text-primary);
}

.chapter-status {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chapter-item.done .chapter-status {
  background: var(--success);
  border-color: var(--success);
}

.chapter-item.active .chapter-status {
  border-color: var(--accent);
  animation: pulse-border 1s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 4px var(--accent-glow); }
}

/* ===== Book Info ===== */
.book-meta h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.book-meta p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.author-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ===== KDP Section ===== */
.kdp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding-bottom: 0;
}

.kdp-title-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.kdp-title-row svg {
  color: var(--warning);
}

.kdp-title-row h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.collapse-arrow {
  color: var(--text-muted);
  transition: transform var(--transition);
}

.kdp-section.collapsed .collapse-arrow {
  transform: rotate(-90deg);
}

.kdp-content {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow: hidden;
  transition: all var(--transition);
}

.kdp-section.collapsed .kdp-content {
  display: none;
}

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

.kdp-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.btn-copy-field {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-copy-field:hover {
  background: var(--accent-light);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--accent);
}

.kdp-value {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.6;
  word-break: break-word;
}

.kdp-description-preview {
  max-height: 240px;
  overflow-y: auto;
}

.kdp-description-preview::-webkit-scrollbar {
  width: 4px;
}

.kdp-description-preview::-webkit-scrollbar-track {
  background: transparent;
}

.kdp-description-preview::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.kdp-value p {
  margin-bottom: 0.75rem;
}

.kdp-value p:last-child {
  margin-bottom: 0;
}

.kdp-value b {
  color: var(--text-primary);
  font-weight: 600;
}

.kdp-value ul {
  padding-left: 1.25rem;
}

.kdp-value li {
  margin-bottom: 0.25rem;
}

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

.keyword-tag {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.category-tag {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.2);
  display: inline-block;
  margin-right: 0.5rem;
  margin-bottom: 0.25rem;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--success);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1000;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Utilities ===== */
.hidden {
  display: none !important;
}

.admin-hidden {
  display: none !important;
}

/* ===== Top Nav ===== */
.top-nav {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.btn-nav-library {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.btn-nav-library:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.library-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

/* ===== Duplicate Warning ===== */
.duplicate-warning {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--warning);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== Library Section ===== */
.library-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.library-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}
.library-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.library-count-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}
.btn-back {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.82rem;
  padding: 0.45rem 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-back:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.btn-export {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.82rem;
  padding: 0.5rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-export:hover {
  background: var(--success-light);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.library-filters {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.library-search {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  padding: 0.6rem 0.875rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.library-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.library-filter-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}
.library-filter-selects .select-wrapper select {
  width: 100%;
  font-size: 0.85rem;
}

.library-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.library-empty p { font-size: 0.9rem; }

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

/* ===== Library Card ===== */
.library-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  transition: border-color var(--transition);
}
.library-card:hover { border-color: rgba(59, 130, 246, 0.25); }

.library-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.library-card-info { flex: 1; min-width: 0; }
.library-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-card-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}
.library-meta-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
}

.library-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}
.library-status-badge.Generated {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.2);
}
.library-status-badge.Published {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.library-status-badge.Unpublished {
  background: rgba(107, 114, 128, 0.1);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.library-card-topic {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.library-card-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.library-card-btns {
  display: flex;
  gap: 0.5rem;
}
.btn-lib {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  line-height: 1;
}
.btn-lib:hover {
  background: var(--accent-light);
  border-color: rgba(59,130,246,0.3);
  color: var(--accent);
}
.btn-lib.status-btn:hover {
  background: rgba(245,158,11,0.1);
  border-color: rgba(245,158,11,0.3);
  color: var(--warning);
}

@media (max-width: 480px) {
  .library-topbar { flex-direction: column; align-items: flex-start; }
  .library-filter-selects { grid-template-columns: 1fr; }
}

/* ===== Form Actions Row ===== */
.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-bulk {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  justify-content: center;
  font-size: 0.9rem;
  padding: 0.875rem 1rem;
}

.btn-bulk:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-secondary-inline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  justify-content: center;
}

.btn-secondary-inline:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ===== Bulk Form ===== */
.bulk-form-header {
  margin-bottom: 1.5rem;
}

.bulk-form-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.bulk-form-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===== Bulk Book List (progress) ===== */
.bulk-book-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.bulk-book-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.bulk-book-item:last-child { border-bottom: none; }
.bulk-book-item.done { color: var(--success); }
.bulk-book-item.active { color: var(--text-primary); }

.bulk-book-status {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bulk-book-item.done .bulk-book-status {
  background: var(--success);
  border-color: var(--success);
}

.bulk-book-item.active .bulk-book-status {
  border-color: var(--accent);
  animation: pulse-border 1s ease-in-out infinite;
}

.bulk-book-item-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-book-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
  flex-shrink: 0;
}

/* ===== Bulk Results ===== */
.bulk-results-header {
  margin-bottom: 1rem;
}

.bulk-results-title {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.bulk-results-title svg { flex-shrink: 0; margin-top: 3px; }

.bulk-results-title h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.bulk-results-title p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.bulk-book-results {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

.bulk-result-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.bulk-result-item-info {
  flex: 1;
  min-width: 0;
}

.bulk-result-item-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.2rem;
}

.bulk-result-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bulk-result-item-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bulk-result-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-bulk-action {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-bulk-action:hover {
  background: var(--accent-light);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--accent);
}

.btn-zip {
  width: 100%;
  justify-content: center;
  font-size: 1rem;
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

@media (max-width: 480px) {
  .form-actions {
    grid-template-columns: 1fr;
  }
  .bulk-result-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .bulk-result-actions {
    width: 100%;
  }
  .btn-bulk-action { flex: 1; justify-content: center; }
}

/* ===== Resume Banner ===== */
.resume-banner {
  background: var(--bg-card);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.resume-banner-body {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: var(--accent);
  flex: 1;
  min-width: 0;
}

.resume-banner-body svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.resume-banner-body div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.resume-banner-body strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.resume-banner-body span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.resume-banner-actions {
  display: flex;
  gap: 0.625rem;
  flex-shrink: 0;
}

.btn-resume {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.btn-resume:hover {
  background: var(--accent-hover);
}

.btn-discard {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
}

.btn-discard:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

@media (max-width: 520px) {
  .resume-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .resume-banner-actions {
    width: 100%;
  }
  .btn-resume, .btn-discard {
    flex: 1;
    justify-content: center;
  }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .container {
    padding: 1rem 1rem 3rem;
  }

  header {
    padding: 2rem 0 2rem;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .card {
    padding: 1.5rem;
  }

  .download-grid {
    grid-template-columns: 1fr;
  }

  .btn-copy-all {
    grid-column: 1;
  }
}

/* ===== Style Info Table ===== */
.style-table-wrap {
  margin-top: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  overflow-x: auto;
}

.style-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  line-height: 1.45;
  table-layout: fixed;
}

.style-info-table thead tr {
  background: var(--bg-secondary);
}

.style-info-table th {
  padding: 0.55rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.style-info-table th:nth-child(1) { width: 18%; }
.style-info-table th:nth-child(2) { width: 28%; }
.style-info-table th:nth-child(3) { width: 30%; }
.style-info-table th:nth-child(4) { width: 24%; }

.style-info-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

.style-info-table tbody tr:last-child {
  border-bottom: none;
}

.style-info-table tbody tr td {
  padding: 0.55rem 0.75rem;
  color: var(--text-secondary);
  vertical-align: top;
}

.style-info-table tbody tr td strong {
  color: var(--text-primary);
  font-weight: 600;
}

.style-info-table tbody tr.active {
  background: var(--accent-light);
}

.style-info-table tbody tr.active td {
  color: var(--text-primary);
}

.style-info-table tbody tr.active td strong {
  color: #93c5fd;
}

@media (max-width: 600px) {
  .style-info-table {
    font-size: 0.72rem;
  }
  .style-info-table th,
  .style-info-table tbody tr td {
    padding: 0.45rem 0.5rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LANDING PAGE — New dark design
   ═══════════════════════════════════════════════════════════════════════════ */

/* ===== Landing root vars ===== */
#landing-section {
  --lp-bg: #0d0d16;
  --lp-card: #13131f;
  --lp-border: rgba(139,92,246,0.12);
  --lp-purple: #8b5cf6;
  --lp-blue: #3b82f6;
  --lp-grad: linear-gradient(135deg, #8b5cf6, #3b82f6);
  background: var(--lp-bg);
  color: #e8e8f4;
  font-family: var(--font);
  min-height: 100vh;
}

/* ===== Nav ===== */
.lp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--lp-border);
  background: rgba(13,13,22,0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 200;
}
.lp-nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}
.lp-nav-actions { display: flex; align-items: center; gap: 0.75rem; }
.lp-btn-login {
  background: transparent;
  border: none;
  color: rgba(232,232,244,0.6);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: color 0.2s;
}
.lp-btn-login:hover { color: #e8e8f4; }
.lp-btn-cta {
  background: var(--lp-grad);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(139,92,246,0.4);
  transition: box-shadow 0.2s, opacity 0.2s;
}
.lp-btn-cta:hover { opacity: 0.9; box-shadow: 0 6px 28px rgba(139,92,246,0.55); }

/* ===== Hero ===== */
.lp-hero {
  padding: 5rem 2rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}
.lp-hero--centered {
  max-width: 720px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lp-badge {
  display: inline-block;
  background: rgba(139,92,246,0.15);
  color: #a78bfa;
  border: 1px solid rgba(139,92,246,0.3);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.875rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
  letter-spacing: 0.04em;
  align-self: flex-start;
  opacity: 0;
}
.lp-h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.12;
  color: #fff;
  margin-bottom: 1.25rem;
  opacity: 0;
}
.lp-h1-accent {
  background: var(--lp-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lp-sub {
  font-size: 1.1rem;
  color: rgba(232,232,244,0.65);
  line-height: 1.7;
  margin-bottom: 2rem;
  opacity: 0;
}
.lp-hero-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 2.5rem;
  opacity: 0;
}
.lp-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--lp-grad);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 32px rgba(139,92,246,0.45);
  transition: box-shadow 0.2s, opacity 0.2s, transform 0.15s;
}
.lp-cta-btn:hover { opacity: 0.92; box-shadow: 0 8px 40px rgba(139,92,246,0.6); transform: translateY(-1px); }
.lp-cta-note {
  font-size: 0.8rem;
  color: rgba(232,232,244,0.45);
  margin: 0;
}
.lp-social-proof {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  opacity: 0;
}
.lp-stat { display: flex; flex-direction: column; gap: 0.1rem; }
.lp-stat-num { font-size: 1.3rem; font-weight: 800; color: #fff; letter-spacing: -0.03em; }
.lp-stat-label { font-size: 0.72rem; color: rgba(232,232,244,0.5); }
.lp-stat-sep { width: 1px; height: 36px; background: rgba(232,232,244,0.12); }

/* ===== Book Mockup ===== */
.lp-hero-visual { position: relative; }
.lp-book-scene {
  position: relative;
  width: 240px;
  height: 320px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(20px) rotateY(-8deg);
  transform-style: preserve-3d;
  perspective: 800px;
}
.lp-book-mockup {
  position: absolute;
  top: 0; left: 20px;
  width: 200px;
  height: 280px;
  transform: rotateY(-6deg) rotateX(2deg);
  transform-style: preserve-3d;
  filter: drop-shadow(0 24px 48px rgba(0,0,0,0.6));
}
.lp-book-spine {
  position: absolute;
  left: -14px; top: 0;
  width: 14px; height: 100%;
  background: linear-gradient(90deg, #4c1d95, #5b21b6);
  border-radius: 2px 0 0 2px;
  transform: rotateY(-90deg) translateZ(7px);
}
.lp-book-front {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #2d1f5e 0%, #1e1040 60%, #160c38 100%);
  border-radius: 3px;
  border: 1px solid rgba(139,92,246,0.3);
  padding: 1.25rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.lp-book-front::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(139,92,246,0.25) 0%, transparent 70%);
  border-radius: 50%;
}
.lp-book-lines { display: flex; flex-direction: column; gap: 0.5rem; }
.lp-book-line {
  height: 10px;
  background: rgba(255,255,255,0.18);
  border-radius: 4px;
}
.lp-book-title-line { height: 14px; background: rgba(255,255,255,0.6); }
.lp-book-line--short { width: 60%; }
.lp-book-line--med { width: 75%; }
.lp-book-line--thin { height: 7px; background: rgba(255,255,255,0.12); }
.lp-book-deco-block {
  height: 56px;
  background: linear-gradient(135deg, rgba(139,92,246,0.35), rgba(59,130,246,0.2));
  border-radius: 6px;
  margin: 0.6rem 0;
  border: 1px solid rgba(139,92,246,0.25);
}
.lp-book-author-line {
  height: 8px;
  width: 50%;
  background: rgba(255,255,255,0.25);
  border-radius: 4px;
  align-self: flex-start;
}
.lp-book-shadow {
  position: absolute;
  bottom: -20px; left: 20px;
  width: 200px; height: 40px;
  background: radial-gradient(ellipse, rgba(139,92,246,0.3) 0%, transparent 70%);
  filter: blur(8px);
}
/* Floating tags */
.lp-floating-tag {
  position: absolute;
  background: rgba(19,19,31,0.95);
  border: 1px solid rgba(139,92,246,0.35);
  color: #c4b5fd;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
}
.lp-tag-1 { top: 10px;  right: -20px; animation: floatTag 3s ease-in-out 0.8s infinite alternate; }
.lp-tag-2 { top: 50%;   right: -30px; animation: floatTag 3s ease-in-out 1.2s infinite alternate; }
.lp-tag-3 { bottom: 30px; left: -20px; animation: floatTag 3s ease-in-out 1.6s infinite alternate; }
@keyframes floatTag {
  from { transform: translateY(0px); }
  to   { transform: translateY(-6px); }
}

/* ===== Section shared ===== */
.lp-section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
  color: #fff;
  margin-bottom: 0.5rem;
}
.lp-section-sub {
  text-align: center;
  color: rgba(232,232,244,0.55);
  font-size: 1rem;
  margin-bottom: 3rem;
}

/* ===== Steps ===== */
.lp-steps {
  max-width: 900px;
  margin: 0 auto;
  padding: 5rem 2rem;
}
.lp-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
@media (max-width: 640px) {
  .lp-steps-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}
.lp-step {
  background: var(--lp-card);
  border: 1px solid var(--lp-border);
  border-radius: 16px;
  padding: 1.75rem 1.5rem;
  position: relative;
  transition: border-color 0.2s, transform 0.2s;
}
.lp-step:hover { border-color: rgba(139,92,246,0.3); transform: translateY(-3px); }
.lp-step-num {
  font-size: 0.7rem;
  font-weight: 700;
  color: #8b5cf6;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}
.lp-step-icon { font-size: 1.75rem; margin-bottom: 0.75rem; }
.lp-step h3 { font-size: 1rem; font-weight: 700; color: #fff; margin-bottom: 0.5rem; }
.lp-step p { font-size: 0.88rem; color: rgba(232,232,244,0.55); line-height: 1.6; }

/* ===== Features ===== */
.lp-features {
  background: rgba(139,92,246,0.04);
  border-top: 1px solid var(--lp-border);
  border-bottom: 1px solid var(--lp-border);
  padding: 5rem 2rem;
}
.lp-features-grid {
  max-width: 860px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
@media (max-width: 480px) {
  .lp-features-grid { grid-template-columns: 1fr; }
}
.lp-feature-card {
  background: var(--lp-card);
  border: 1px solid var(--lp-border);
  border-radius: 14px;
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
}
.lp-feature-card:hover { border-color: rgba(139,92,246,0.3); transform: translateY(-2px); }
.lp-feature-icon { font-size: 1.6rem; margin-bottom: 0.75rem; }
.lp-feature-card h3 { font-size: 0.95rem; font-weight: 700; color: #fff; margin-bottom: 0.4rem; }
.lp-feature-card p { font-size: 0.83rem; color: rgba(232,232,244,0.5); line-height: 1.6; }

/* ===== Reviews ===== */
.lp-reviews {
  max-width: 1100px;
  margin: 0 auto;
  padding: 5rem 2rem;
  overflow: hidden;
}
.lp-reviews-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
@media (max-width: 720px) {
  .lp-reviews-track { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .lp-reviews-track { grid-template-columns: 1fr; }
}
.lp-review-card {
  background: var(--lp-card);
  border: 1px solid var(--lp-border);
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.lp-review-stars { color: #f59e0b; font-size: 0.85rem; letter-spacing: 0.05em; }
.lp-review-card > p { font-size: 0.875rem; color: rgba(232,232,244,0.7); line-height: 1.65; flex: 1; }
.lp-reviewer { display: flex; align-items: center; gap: 0.75rem; }
.lp-reviewer-avatar {
  width: 36px; height: 36px;
  background: var(--lp-grad);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.lp-reviewer strong { display: block; font-size: 0.85rem; color: #e8e8f4; }
.lp-reviewer span { font-size: 0.75rem; color: rgba(232,232,244,0.4); }

/* ===== Pricing ===== */
.lp-pricing {
  background: rgba(139,92,246,0.04);
  border-top: 1px solid var(--lp-border);
  padding: 5rem 2rem;
}
.lp-pricing-intro {
  max-width: 520px;
  margin: 0 auto 3.5rem;
  text-align: center;
  background: var(--lp-card);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  position: relative;
  overflow: hidden;
}
.lp-pricing-intro::before {
  content: '';
  position: absolute;
  top: -80px; left: 50%;
  transform: translateX(-50%);
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(139,92,246,0.18) 0%, transparent 70%);
  border-radius: 50%;
}
.lp-intro-badge {
  display: inline-block;
  background: rgba(139,92,246,0.15);
  color: #a78bfa;
  border: 1px solid rgba(139,92,246,0.3);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.875rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}
.lp-intro-price {
  font-size: 3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.05em;
  margin-bottom: 0.5rem;
  line-height: 1;
}
.lp-intro-price span:first-child {
  background: var(--lp-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lp-intro-per { font-size: 1rem; color: rgba(232,232,244,0.5); font-weight: 400; }
.lp-intro-desc {
  font-size: 0.875rem;
  color: rgba(232,232,244,0.55);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}
.lp-pricing-plans {
  max-width: 860px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}
@media (max-width: 640px) {
  .lp-pricing-plans { grid-template-columns: 1fr; }
}
.lp-plan-card {
  background: var(--lp-card);
  border: 1px solid var(--lp-border);
  border-radius: 16px;
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  transition: border-color 0.2s;
}
.lp-plan-card:hover { border-color: rgba(139,92,246,0.3); }
.lp-plan-popular {
  border-color: rgba(139,92,246,0.5);
  box-shadow: 0 0 0 1px rgba(139,92,246,0.25), 0 12px 40px rgba(139,92,246,0.12);
}
.lp-plan-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--lp-grad);
  color: #fff;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 0.25rem;
}
.lp-plan-name { font-size: 1rem; font-weight: 700; color: #e8e8f4; }
.lp-plan-price {
  font-size: 1.9rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.04em;
}
.lp-plan-price span { font-size: 0.85rem; color: rgba(232,232,244,0.45); font-weight: 400; }
.lp-plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}
.lp-plan-features li { font-size: 0.82rem; color: rgba(232,232,244,0.6); }
.lp-plan-btn {
  background: transparent;
  color: #a78bfa;
  border: 1px solid rgba(139,92,246,0.35);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}
.lp-plan-btn:hover { background: rgba(139,92,246,0.1); border-color: rgba(139,92,246,0.6); }
.lp-plan-btn--primary {
  background: var(--lp-grad);
  color: #fff;
  border-color: transparent;
}
.lp-plan-btn--primary:hover { opacity: 0.9; background: var(--lp-grad); border-color: transparent; }
.lp-pricing-note {
  text-align: center;
  font-size: 0.85rem;
  color: rgba(232,232,244,0.4);
  max-width: 860px;
  margin: 0 auto;
}
.lp-pricing-note strong { color: rgba(232,232,244,0.7); }

/* ===== Footer ===== */
.lp-footer {
  border-top: 1px solid var(--lp-border);
  padding: 2rem;
}
.lp-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
@media (max-width: 480px) {
  .lp-footer-inner { flex-direction: column; text-align: center; }
}
.lp-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: rgba(232,232,244,0.7);
}
.lp-footer p { font-size: 0.8rem; color: rgba(232,232,244,0.3); margin: 0; }
.lp-footer a { color: #a78bfa; text-decoration: none; }

/* ===== Intro Gate Modal ===== */
.intro-gate-card {
  max-width: 420px;
  text-align: center;
}
.intro-gate-emoji { font-size: 2.5rem; margin-bottom: 0.5rem; }
.intro-gate-card h2 { font-size: 1.35rem; font-weight: 800; margin-bottom: 0.5rem; }
.intro-gate-sub { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 1.25rem; }
.intro-gate-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  text-align: left;
}
.intro-gate-features li { font-size: 0.875rem; color: var(--text-secondary); }
.intro-gate-pay-btn { width: 100%; justify-content: center; font-size: 0.95rem; }
.intro-gate-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  margin-bottom: 1rem;
}
.intro-gate-logout {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== SAAS LAYER — Auth, User Profile, Pricing, Modals ===== */

/* ===== Landing Nav (legacy alias kept) ===== */
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* ===== Auth Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.auth-modal-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.35rem;
}

.auth-modal-sub {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.auth-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171;
  font-size: 0.82rem;
  padding: 0.6rem 0.875rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 1rem;
}
.btn-google:hover {
  background: var(--bg-card-hover);
  border-color: rgba(59,130,246,0.3);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.auth-switch {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 1rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.btn-link:hover { color: var(--accent-hover); }

/* ===== User Profile Bar (in app header) ===== */
header {
  position: relative;
}

.user-bar {
  position: absolute;
  top: 1.5rem;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-credits {
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  white-space: nowrap;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
}
.user-profile-btn:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.user-initials {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  overflow: hidden;
  z-index: 200;
}

.user-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.user-menu button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

.user-menu-logout {
  color: #f87171 !important;
}
.user-menu-logout:hover {
  background: rgba(239,68,68,0.1) !important;
  color: #f87171 !important;
}
/* ===== Plan Badge (in account / profile) ===== */
.plan-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.plan-badge.none    { background: rgba(107,114,128,0.15); color: #9ca3af; }
.plan-badge.starter { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(59,130,246,0.2); }
.plan-badge.pro     { background: rgba(16,185,129,0.12); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.plan-badge.diamond { background: rgba(212,175,55,0.12); color: var(--gold); border: 1px solid rgba(212,175,55,0.2); }
.plan-badge.admin   { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }

/* ===== Account Section ===== */
.account-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 640px) {
  .account-grid { grid-template-columns: 1fr; }
}

.account-card h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 0.875rem;
}

.account-plan-info {
  font-size: 0.9rem;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.875rem;
}

.account-plan-info .plan-name-display {
  font-size: 1.1rem;
  font-weight: 700;
}

.account-usage-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.usage-bar-container {
  background: var(--bg-secondary);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.usage-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  transition: width 0.5s ease;
}

.usage-bar.high { background: linear-gradient(90deg, var(--warning), #f59e0b); }
.usage-bar.full { background: linear-gradient(90deg, #ef4444, #f87171); }

.account-credits-info {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.875rem;
}

.account-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ===== Modal Titles ===== */
.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  text-align: center;
}

.modal-sub {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* ===== Credits Exhausted Modal ===== */
.credits-options {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.credits-option {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  position: relative;
}

.credits-option--best {
  border-color: rgba(59,130,246,0.3);
  background: var(--accent-light);
}

.credits-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--success);
  color: #fff;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  position: absolute;
  top: -10px;
  right: 1rem;
}

.credits-option-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.credits-option-price {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.625rem;
}

.credits-option-btns {
  display: flex;
  gap: 0.5rem;
}

.modal-close-btn {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}
.modal-close-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ===== Upgrade / Buy Credits Modal ===== */
.upgrade-plans {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.upgrade-plan {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  position: relative;
}

.upgrade-plan--popular {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upgrade-plan .popular-badge {
  position: absolute;
  top: -10px;
  right: 1rem;
}

.upgrade-plan-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.upgrade-plan-price {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.625rem;
}

.upgrade-plan-btns {
  display: flex;
  gap: 0.5rem;
}

/* ===== Payment Buttons (Stripe / PayPal) ===== */
.btn-pay-stripe,
.btn-pay-paypal {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  cursor: pointer;
  transition: all var(--transition);
  flex: 1;
  justify-content: center;
}

.btn-pay-stripe {
  background: rgba(99,91,255,0.1);
  border-color: rgba(99,91,255,0.3);
  color: #a89fff;
}
.btn-pay-stripe:hover {
  background: rgba(99,91,255,0.18);
  border-color: #7c71ff;
  color: #c5beff;
}

.btn-pay-full {
  flex: none;
  width: 100%;
}

@media (max-width: 480px) {
  .lp-nav { padding: 0.875rem 1rem; }
  .lp-hero { padding: 3rem 1rem 3rem; }
  .user-bar { top: 1rem; }
  .user-name { display: none; }
  .user-credits { display: none; }
}
