body {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    margin: 0;
    background-color: #f7faff;
    color: #222;
}

.container {
    width: 80%;
    margin: auto;
    overflow: hidden;
    padding: 20px;
    background-color: #fff;
    min-height: calc(100vh - 120px); /* Full height minus header/footer approx */
    margin-left: 220px;
    width: calc(100% - 220px);
    transition: margin-left 0.2s, width 0.2s;
    padding-left: 20px;
    padding-right: 20px;
    text-align: left;
}

nav {
    background: #333;
    color: #fff;
    padding: 10px 0;
    border-bottom: #0779e4 3px solid;
}

nav h1 {
    float: left;
    margin: 0 0 0 20px;
}

nav ul {
    float: right;
    margin: 0 20px 0 0;
    padding: 0;
    list-style: none;
}

nav ul li {
    display: inline;
    margin-left: 20px;
    padding-top: 10px;
}

nav a {
    color: #fff;
    text-decoration: none;
    font-size: 1.1em;
}

nav a:hover {
    color: #0779e4;
}

footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 10px;
    position: relative;
    bottom: 0;
    width: 100%;
}

.login-page, .dashboard-page {
    padding: 20px;
    text-align: center;
}

.button, .google-login-button {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 1em;
    margin-top: 10px;
}

.google-login-button {
    background: #db4437; /* Google Red */
}

.button:hover, .google-login-button:hover {
    opacity: 0.9;
}

.error-messages {
    background-color: #ffdddd;
    border: 1px solid #f44336;
    color: #f44336;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.error-message {
    margin: 5px 0;
}

/* --- Dashboard & Navigation Modern Styles --- */
.admin-header {
    background: #fff;
    border-bottom: 1.5px solid #e5eaf2;
    box-shadow: 0 2px 8px rgba(30, 60, 120, 0.04);
    position: sticky;
    top: 0;
    z-index: 100;
    left: 0;
    right: 0;
    margin-left: 220px;
    transition: margin-left 0.2s;
}
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 32px 0 32px;
}
.logo-title {
    display: flex;
    align-items: center;
    gap: 18px;
}
.logo-title i {
    font-size: 2.2rem;
    color: #3b82f6;
}
.logo-title h1 {
    font-size: 2rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: -1px;
}
.subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin-top: 2px;
}
.env-switch {
    display: flex;
    align-items: center;
    gap: 12px;
}
.env-badge {
    background: #f3f4f6;
    color: #222;
    font-size: 0.95em;
    border-radius: 8px;
    padding: 4px 12px;
    font-weight: 600;
    margin-right: 8px;
}
.switch-prod-btn {
    background: #fff;
    color: #3b82f6;
    border: 2px solid #3b82f6;
    border-radius: 22px;
    padding: 7px 18px;
    font-weight: 600;
    font-size: 1em;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.switch-prod-btn:hover {
    background: #3b82f6;
    color: #fff;
}
.scrollable-nav {
    overflow-x: auto;
    background: #fff;
    border-bottom: 1.5px solid #e5eaf2;
    margin-top: 18px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #cbd5e1 transparent; /* Firefox */
}

/* Webkit scrollbar styling */
.scrollable-nav::-webkit-scrollbar {
    height: 6px;
}

.scrollable-nav::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable-nav::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 20px;
}

.scrollable-nav ul {
    display: flex;
    gap: 18px;
    padding: 0 32px;
    margin: 0;
    list-style: none;
    white-space: nowrap;
    width: max-content;
}
.scrollable-nav li {
    display: flex;
    align-items: center;
}
.scrollable-nav a {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #222;
    font-weight: 500;
    font-size: 1.08em;
    padding: 12px 0 10px 0;
    border-bottom: 2.5px solid transparent;
    transition: color 0.2s, border-bottom 0.2s;
    text-decoration: none;
}
.scrollable-nav a:hover, .scrollable-nav .active > a {
    color: #3b82f6;
    border-bottom: 2.5px solid #3b82f6;
}
.logout-link {
    margin-left: auto;
}

.dashboard-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 0 0 0;
}
.dashboard-cards {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}
.dashboard-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 12px rgba(30, 60, 120, 0.07);
    padding: 28px 32px 22px 32px;
    min-width: 220px;
    flex: 1 1 220px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
}
.dashboard-card .card-title {
    font-size: 1.1em;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 600;
}
.dashboard-card .card-value {
    font-size: 2.1em;
    font-weight: 700;
    margin-bottom: 8px;
    color: #222;
}
.dashboard-card .card-icon {
    position: absolute;
    top: 22px;
    right: 32px;
    font-size: 2.1em;
    opacity: 0.13;
}
.dashboard-card.users { border-top: 4px solid #6366f1; }
.dashboard-card.stories { border-top: 4px solid #3b82f6; }
.dashboard-card.reviews { border-top: 4px solid #f59e42; }
.dashboard-card.subscribers { border-top: 4px solid #10b981; }
.dashboard-card.monthly-subscribers { border-top: 4px solid #8b5cf6; }
.dashboard-card.annual-subscribers { border-top: 4px solid #f59e0b; }
.dashboard-card .card-trend {
    font-size: 0.98em;
    margin-top: 6px;
    font-weight: 500;
}
.card-trend.up { color: #10b981; }
.card-trend.down { color: #ef4444; }
.card-trend.warn { color: #f59e42; }
.card-trend.info { color: #6b7280; }

.dashboard-lists {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}
.dashboard-list {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 12px rgba(30, 60, 120, 0.07);
    padding: 24px 28px 18px 28px;
    flex: 1 1 350px;
    min-width: 320px;
    margin-bottom: 32px;
}
.list-title {
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 18px;
    color: #222;
}
.user-row, .story-row {
    display: flex;
    align-items: center;
    background: #f7faff;
    border-radius: 12px;
    margin-bottom: 14px;
    padding: 12px 16px;
    gap: 16px;
}
.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #6366f1;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    font-weight: 700;
}
.user-info {
    flex: 1;
}
.user-name {
    font-weight: 600;
    font-size: 1.08em;
}
.user-email {
    font-size: 0.98em;
    color: #6b7280;
}
.user-status {
    font-size: 0.98em;
    font-weight: 600;
    border-radius: 12px;
    padding: 4px 14px;
    text-transform: lowercase;
    margin-left: 8px;
}
.user-status-active {
    background: #10b98122;
    color: #10b981;
}
.user-status-pending {
    background: #f59e4222;
    color: #f59e42;
}
.user-status-suspended {
    background: #ef444422;
    color: #ef4444;
}
.story-row {
    background: #f7faff;
    border-radius: 12px;
    margin-bottom: 14px;
    padding: 12px 16px;
    gap: 16px;
}
.story-title {
    font-weight: 600;
    font-size: 1.08em;
    flex: 1;
}
.story-author {
    font-size: 0.98em;
    color: #6b7280;
    flex: 1;
}
.story-status {
    font-size: 0.98em;
    font-weight: 600;
    border-radius: 12px;
    padding: 4px 14px;
    text-transform: lowercase;
    margin-left: 8px;
}
.story-status-pending {
    background: #f59e4222;
    color: #f59e42;
}
.story-status-completed {
    background: #10b98122;
    color: #10b981;
}
.story-status-failed {
    background: #ef444422;
    color: #ef4444;
}
.story-status-flagged {
    background: #ef444422;
    color: #ef4444;
}

/* --- End Modern Dashboard Styles --- */

/* --- Sidebar Navigation Drawer (Apple UI Style) --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 220px;
  background: linear-gradient(180deg, #f8fafc 90%, #e5eaf2 100%);
  border-right: none;
  box-shadow: 2px 0 16px 0 rgba(30, 60, 120, 0.07);
  z-index: 200;
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 16px 8px 16px;
}
.logo-title {
  font-size: 1.15em;
  font-weight: 700;
  margin-left: 10px;
  color: #222;
  letter-spacing: -0.5px;
  transition: opacity 0.2s;
  text-decoration: none;
  gap: 12px;
}
.sidebar-title {
  color: #222;
}
.sidebar-nav {
  list-style: none;
  padding: 12px 0 0 0;
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav li {
  width: 100%;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  height: 48px;
  color: #222;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.88em;
  border-radius: 12px;
  margin: 2px 8px;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  position: relative;
}
.sidebar-nav a:hover, .sidebar-nav .active > a {
  background: #e0e7ef;
  color: #be185d;
  box-shadow: 0 2px 8px rgba(30, 60, 120, 0.04);
}
.sidebar-nav a:active {
  background: #d1d5db;
}
.sidebar-nav a i {
  min-width: 24px;
  text-align: center;
  font-size: 1.25em;
  color: #ec4899;
  transition: color 0.18s;
}
.sidebar-nav a:hover i, .sidebar-nav .active > a i {
  color: #be185d;
}
.sidebar-divider {
  height: 1px;
  background: #e5eaf2;
  margin: 10px 0 10px 0;
  border: none;
}

/* Navigation section headers and subsections */
.nav-section-header {
  margin-top: 20px !important;
  margin-bottom: 6px !important;
}

.nav-section-header .section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  height: 32px;
  color: #6b7280;
  font-weight: 600;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 2px 8px;
}

.nav-section-header .section-title i {
  min-width: 16px;
  text-align: center;
  font-size: 1em;
  color: #9ca3af;
}

.nav-subsection a {
  margin-left: 16px !important;
  padding-left: 14px !important;
  border-left: 2px solid #e5eaf2;
  height: 40px !important;
  font-size: 0.85em !important;
  color: #4b5563 !important;
  position: relative;
}

.nav-subsection a:hover {
  background: #f1f5f9 !important;
  border-left-color: #be185d !important;
  color: #be185d !important;
}

.nav-subsection a::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: #e5eaf2;
  border-radius: 50%;
  transition: background 0.18s;
}

.nav-subsection a:hover::before {
  background: #be185d;
}

/* --- Prompt Management Interface Styles --- */
.prompts-page {
  padding: 0;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  min-height: 100vh;
}

.page-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 32px 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  margin: 0;
  font-weight: 400;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.btn {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-primary {
  background: #10b981;
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Entity Selector Section */
.entity-selector-section {
  background: white;
  padding: 32px 40px 20px 40px;
  margin-bottom: 24px;
}

.selector-container {
  max-width: 1200px;
  margin: 0 auto 24px auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

.selector-label {
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.entity-type-select {
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  background: white;
  color: #374151;
  min-width: 280px;
  transition: all 0.2s;
}

.entity-type-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.stats-row {
  display: flex;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  padding: 20px 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-card {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  min-width: 120px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  color: #6b7280;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Prompt Editor Container */
.prompt-editor-container {
  background: white;
  margin: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.prompt-tabs {
  display: flex;
  background: #f8fafc;
  border-bottom: 2px solid #e5e7eb;
  overflow-x: auto;
  padding: 0 40px;
}

.tab-btn {
  padding: 16px 24px;
  border: none;
  background: transparent;
  color: #6b7280;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #374151;
  background: rgba(102, 126, 234, 0.05);
}

.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: rgba(102, 126, 234, 0.1);
}

.prompt-content {
  display: flex;
  min-height: 600px;
}

.prompt-panel {
  flex: 2;
  padding: 32px 40px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.panel-header h3 {
  font-size: 1.4rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.panel-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  background: #f3f4f6;
  color: #6b7280;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: #e5e7eb;
  color: #374151;
  transform: translateY(-1px);
}

/* Code Editor */
.code-editor-container {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.editor-toolbar {
  background: #f8fafc;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-info {
  display: flex;
  gap: 20px;
  font-size: 0.85rem;
  color: #6b7280;
}

.editor-tools {
  display: flex;
  gap: 8px;
}

.editor-tools button {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.editor-tools button:hover {
  background: #e5e7eb;
  color: #374151;
}

.prompt-textarea {
  width: 100%;
  min-height: 400px;
  padding: 20px;
  border: none;
  font-family: 'JetBrains Mono', 'Fira Code', Monaco, 'Cascadia Code', monospace;
  font-size: 14px;
  line-height: 1.6;
  background: #fefefe;
  color: #2d3748;
  resize: vertical;
  outline: none;
}

.prompt-textarea::placeholder {
  color: #9ca3af;
  font-style: italic;
}

/* Prompt Guidance */
.prompt-guidance {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 16px;
  margin-top: 24px;
}

.guidance-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #92400e;
  font-weight: 600;
  margin-bottom: 8px;
}

.guidance-content {
  color: #78350f;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Preview Panel */
.preview-panel {
  flex: 1;
  background: #f8fafc;
  border-left: 2px solid #e5e7eb;
  padding: 32px 24px;
}

.preview-content {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  min-height: 300px;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
}

/* Loading and Error States */
.loading-state, .error-state {
  text-align: center;
  padding: 80px 40px;
  background: white;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.error-icon {
  font-size: 3rem;
  color: #ef4444;
  margin-bottom: 20px;
}

.error-state h3 {
  color: #1f2937;
  margin-bottom: 12px;
}

.error-state p {
  color: #6b7280;
  margin-bottom: 24px;
}

/* Save Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal[style*="block"] {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 0;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
  padding: 24px 24px 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  color: #1f2937;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 24px;
}

.save-progress {
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  width: 0%;
  transition: width 0.3s;
}

/* Notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 20px;
  border-radius: 8px;
  color: white;
  z-index: 1100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease;
}

.notification-success {
  background: linear-gradient(135deg, #10b981, #059669);
}

.notification-error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.notification-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Mobile Hamburger Menu */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
  background: none;
  color: #222;
  border: none;
  padding: 12px;
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s;
}

.mobile-menu-toggle:hover {
  color: #1a50a0;
}

.mobile-close-btn {
  display: none;
  background: none;
  border: none;
  color: #666;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
  /* Hide sidebar by default on mobile - slide in from right */
  .sidebar {
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    background: white !important;
    background-image: none !important;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    right: 0;
    left: auto;
  }
  
  /* Show sidebar when mobile menu is open */
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  /* Show hamburger button on mobile */
  .mobile-menu-toggle {
    display: block;
  }
  
  /* Show close button in sidebar header on mobile */
  .mobile-close-btn {
    display: block;
  }
  
  /* Fix container positioning on mobile - remove left margin completely */
  .container {
    margin-left: 0 !important;
    width: 100% !important;
    padding-left: 20px;
    padding-right: 20px;
  }
  
  /* Fix any other elements that might have left margin */
  body > div:not(.sidebar):not(.admin-header):not(.breadcrumb-caret) {
    margin-left: 0 !important;
    max-width: 100% !important;
  }
  
  /* Override all margin-left: 220px rules on mobile */
  .admin-header {
    margin-left: 0 !important;
  }
  
  .breadcrumb-caret {
    margin-left: 0 !important;
  }
  
  /* Ensure all content containers are full width on mobile */
  .container-fluid {
    margin-left: 0 !important;
    width: 100% !important;
  }
  
  /* Enable horizontal scrolling on mobile */
  body {
    overflow-x: auto !important;
  }
  
  .container {
    overflow-x: auto !important;
    min-width: 100% !important;
  }
  
  /* Allow tables and content to scroll horizontally */
  .table-responsive {
    overflow-x: auto !important;
  }
  
  /* Ensure all tables can scroll horizontally */
  table {
    min-width: 100% !important;
  }
  
  /* Allow any content to extend beyond viewport width */
  * {
    overflow-x: visible !important;
  }
  
  /* Add overlay when mobile menu is open */
  .sidebar.mobile-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: -1;
  }
  
  .header-content {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
  
  .selector-container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .stats-row {
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .prompt-content {
    flex-direction: column;
  }
  
  .preview-panel {
    border-left: none;
    border-top: 2px solid #e5e7eb;
  }
  
  .prompt-tabs {
    padding: 0 20px;
  }
  
  .prompt-panel {
    padding: 24px 20px;
  }
}

/* --- Better Tag and Label Styling --- */
.tag, .badge, .label {
  display: inline-block;
  padding: 6px 12px;
  background: #667eea;
  color: white !important;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 6px;
  margin: 2px;
  border: none;
  text-shadow: none;
}

.tag.category, .badge.category {
  background: #10b981;
  color: white !important;
}

.tag.type, .badge.type {
  background: #f59e0b;
  color: white !important;
}

.tag.status, .badge.status {
  background: #8b5cf6;
  color: white !important;
}

/* Entity type specific colors with white text */
.entity-type-person { background: #ef4444; color: white !important; }
.entity-type-place { background: #3b82f6; color: white !important; }
.entity-type-event { background: #f59e0b; color: white !important; }
.entity-type-invention { background: #10b981; color: white !important; }
.entity-type-concept { background: #8b5cf6; color: white !important; }
.entity-type-myth { background: #ec4899; color: white !important; }
.entity-type-creations { background: #06b6d4; color: white !important; }
.entity-type-other { background: #6b7280; color: white !important; }

/* Enhanced selector styling with horizontal buttons */
.selector-container {
  max-width: 1200px;
  margin: 0 auto;
}

.entity-type-buttons {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: space-between;
  align-items: stretch;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.entity-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  min-width: 0;
  flex: 1;
  width: calc(12.5% - 7px);
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.entity-btn:hover {
  transform: translateY(-2px);
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.entity-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
  color: white;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
  transform: translateY(-1px);
}

.entity-btn.active:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.entity-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
  display: block;
  filter: none;
}

.entity-btn.active .entity-icon {
  filter: brightness(1.2);
}

.entity-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
  display: block;
  color: inherit;
}

.entity-desc {
  font-size: 0.75rem;
  opacity: 0.8;
  display: block;
  color: inherit;
  font-weight: 400;
  line-height: 1.2;
}

.entity-btn.active .entity-desc {
  opacity: 0.9;
}

/* Responsive design for entity buttons */
@media (max-width: 1024px) {
  .entity-type-buttons {
    gap: 6px;
  }
  
  .entity-btn {
    width: calc(12.5% - 5px);
    padding: 10px 6px;
  }
  
  .entity-icon {
    font-size: 1.25rem;
    margin-bottom: 6px;
  }
  
  .entity-name {
    font-size: 0.8rem;
  }
  
  .entity-desc {
    font-size: 0.65rem;
  }
}

/* Sortable table headers */
th a {
    transition: all 0.2s ease;
}

th a:hover {
    color: #1a50a0 !important;
    text-decoration: none !important;
}

th a:hover i {
    color: #1a50a0 !important;
}

@media (max-width: 768px) {
  .entity-type-buttons {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }
  
  .entity-btn {
    width: calc(25% - 5px);
    min-width: 80px;
    padding: 8px 4px;
  }
  
  .entity-icon {
    font-size: 1.1rem;
    margin-bottom: 4px;
  }
  
  .entity-name {
    font-size: 0.75rem;
  }
  
  .entity-desc {
    font-size: 0.6rem;
  }
}

@media (max-width: 480px) {
  .entity-type-buttons {
    gap: 4px;
  }
  
  .entity-btn {
    width: calc(50% - 2px);
    padding: 8px 4px;
  }
  
  .entity-icon {
    font-size: 1rem;
    margin-bottom: 3px;
  }
  
  .entity-name {
    font-size: 0.7rem;
  }
  
  .entity-desc {
    font-size: 0.55rem;
  }
}

/* Variables Section */
.variables-section {
  background: #f8f9fa;
  padding: 16px 24px;
  margin: 16px 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.variables-header {
  margin-bottom: 12px;
}

.variables-header h4 {
  color: #374151;
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.variables-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.variable-tag {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: 'JetBrains Mono', 'Fira Code', Monaco, 'Cascadia Code', monospace;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
  border: none;
  white-space: nowrap;
}

.no-variables {
  color: #9ca3af;
  font-style: italic;
  font-size: 0.9rem;
  padding: 8px 0;
}

.admin-header {
  left: 0;
  right: 0;
  position: sticky;
  z-index: 100;
  margin-left: 220px;
  transition: margin-left 0.2s;
}

/* --- Character Add Form Table Layout --- */
.character-form-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 12px;
    margin-bottom: 0;
}
.character-form-table td {
    padding: 8px 10px 8px 0;
    vertical-align: middle;
    font-size: 1.08em;
}
.character-form-table label {
    font-weight: 500;
    color: #222;
    min-width: 120px;
    display: inline-block;
}
.character-form-table input[type="text"],
.character-form-table input[type="color"],
.character-form-table textarea {
    width: 100%;
    min-width: 220px;
    min-height: 44px;
    font-size: 1.08em;
    border-radius: 10px;
    border: 1.5px solid #d1d5db;
    padding: 8px 12px;
    background: #f9fafb;
    transition: border 0.2s;
    box-sizing: border-box;
}
.character-form-table input[type="color"] {
    padding: 0;
    width: 60px;
    min-width: 44px;
    min-height: 44px;
    border: none;
    background: none;
}
.character-form-table input:focus,
.character-form-table textarea:focus {
    border: 1.5px solid #3b82f6;
    outline: none;
    background: #fff;
}
.character-form-table textarea {
    resize: vertical;
    min-height: 44px;
    max-height: 120px;
}
.character-form-table button[type="submit"] {
    width: 100%;
    height: 48px;
    font-size: 1.15em;
    border-radius: 12px;
    margin-top: 8px;
}
.character-form-table select {
    width: 100%;
    min-width: 220px;
    min-height: 44px;
    font-size: 1.08em;
    border-radius: 10px;
    border: 1.5px solid #d1d5db;
    padding: 8px 12px;
    background: #f9fafb;
    transition: border 0.2s;
    box-sizing: border-box;
    color: #222;
    appearance: none;
    outline: none;
}
.character-form-table select:focus {
    border: 1.5px solid #3b82f6;
    background: #fff;
}

/* --- Caret Breadcrumb --- */
.breadcrumb-caret {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.98em;
    margin-bottom: 0;
    margin-top: 2px;
    color: #6b7280;
    user-select: none;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0 32px 0 32px;
    min-height: 32px;
}
.admin-header .breadcrumb-caret {
    margin-bottom: 8px;
    margin-top: 0;
    padding-bottom: 0;
}
.breadcrumb-caret a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}
.breadcrumb-caret a:hover {
    color: #1a50a0;
    text-decoration: underline;
}
.breadcrumb-caret .caret {
    color: #b0b8c1;
    font-size: 1.1em;
    margin: 0 2px;
}
.breadcrumb-caret .active {
    color: #222;
    font-weight: 600;
}

body > div:not(.sidebar):not(.admin-header):not(.breadcrumb-caret) {
  max-width: 1200px;
  margin: 0 auto;
  margin-left: 220px;
  box-sizing: border-box;
  padding-left: 20px;
  padding-right: 20px;
}
