:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: #1f2937;
  --bg-card-hover: #283548;
  --bg-input: #0f172a;
  --border-color: #374151;
  --border-focus: #3b82f6;

  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-green: #10b981;
  --accent-emerald: #057e05;
  --accent-amber: #f59e0b;
  --accent-error: #ef4444;
  --accent-error-bg: rgba(239, 68, 68, 0.12);
  --accent-error-border: rgba(239, 68, 68, 0.4);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  background: linear-gradient(180deg, rgba(31, 41, 55, 0.7) 0%, rgba(17, 24, 39, 0.5) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 18px 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #2563eb, #10b981);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-phase {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.header-links {
  display: flex;
  gap: 10px;
}

.header-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.header-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* Main Container */
.main-container {
  max-width: 1200px;
  width: 100%;
  margin: 28px auto;
  padding: 0 24px;
  flex: 1;
}

/* Cards */
.sheets-card, .input-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-md);
  margin-bottom: 28px;
}

.sheets-card {
  border-top: 3px solid var(--accent-green);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
  gap: 14px;
}

.card-header-text h2 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f3f4f6;
}

.card-header-text p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Badges */
.auth-status-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.badge-connected {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-disconnected {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-checking {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* Sheets Config Grid & Fixed Info Grid */
.sheets-fixed-info-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr;
  gap: 16px;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .sheets-fixed-info-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.sheet-info-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sheet-info-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sheet-info-value {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  flex-wrap: wrap;
}

.sheet-name-text {
  font-weight: 600;
  color: #f3f4f6;
}

.sheet-external-link {
  font-size: 12px;
  color: var(--color-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.2);
  transition: all 0.2s ease;
}

.sheet-external-link:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  text-decoration: none;
}

.sheet-worksheet-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: monospace;
  font-weight: 600;
}

.sheet-status-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.sheet-status-text.status-connected {
  color: #34d399;
}

.sheet-status-text.status-loading {
  color: #38bdf8;
}

.sheet-status-text.status-error {
  color: #f87171;
}

.sheet-status-text.status-disconnected {
  color: #fbbf24;
}

.sheets-config-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr auto;
  gap: 14px;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.25);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 20px;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

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

.select-control {
  padding-left: 14px !important;
  cursor: pointer;
}

/* Sheets Action Bar */
.sheets-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.primary-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-connect {
  background: linear-gradient(135deg, #0f9d58, #0b8043);
  color: #fff;
  box-shadow: 0 4px 12px rgba(15, 157, 88, 0.35);
}

.btn-connect:hover:not(:disabled) {
  background: linear-gradient(135deg, #10aa5f, #0f9d58);
  transform: translateY(-1px);
}

.btn-danger-mini {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-danger-mini:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
}

/* Batch Summary Bar */
.batch-summary-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #0f172a;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 18px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
  color: var(--text-muted);
}

.stat-val {
  font-weight: 700;
  color: #fff;
}

.text-pending { color: #fbbf24 !important; }
.text-generated { color: #34d399 !important; }
.text-error { color: #f87171 !important; }

/* Sheet Data Table */
.sheet-table-wrapper {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 10px;
}

.table-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #1e293b;
  border-bottom: 1px solid var(--border-color);
  font-size: 12.5px;
  color: var(--text-muted);
}

.table-tip {
  color: #93c5fd;
  font-size: 12px;
}

.table-scroll {
  max-height: 480px;
  overflow-y: auto;
}

.google-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.google-sheet-table th {
  background: #1e293b;
  color: #cbd5e1;
  padding: 10px 14px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.google-sheet-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  vertical-align: middle;
}

.google-sheet-table tr.clickable-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.google-sheet-table tr.clickable-row:hover {
  background: rgba(37, 99, 235, 0.12);
}

.google-sheet-table tr.active-inspect {
  background: rgba(37, 99, 235, 0.2) !important;
  border-left: 3px solid #3b82f6;
}

/* Status Badges in Table */
.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.status-badge-processing {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.5);
  animation: pulse 1.5s infinite;
}

.status-badge-generated {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.cell-url {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #60a5fa;
}

.cell-error {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fca5a5;
  font-size: 12px;
}

/* Preset Buttons */
.preset-buttons {
  display: flex;
  gap: 8px;
}

.btn-preset {
  background: rgba(37, 99, 235, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-preset:hover {
  background: rgba(37, 99, 235, 0.22);
  color: #93c5fd;
}

.btn-preset.text-muted {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-color: var(--border-color);
}

.btn-preset.text-muted:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Form */
.generator-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  gap: 4px;
}

.required-mark {
  color: var(--accent-error);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-subtle);
  font-size: 14px;
  pointer-events: none;
}

.form-control {
  width: 100%;
  padding: 12px 14px 12px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  transition: all 0.2s ease;
}

.sheets-config-grid .form-control {
  padding-left: 14px;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: #0d1527;
}

.field-hint {
  font-size: 12px;
  color: var(--text-subtle);
  padding-left: 2px;
}

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  animation: fadeIn 0.2s ease;
  margin-bottom: 16px;
}

.alert-error {
  background: var(--accent-error-bg);
  border: 1px solid var(--accent-error-border);
  color: #fca5a5;
}

.alert-icon {
  font-size: 16px;
  margin-top: 2px;
  color: var(--accent-error);
}

.alert-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Buttons */
.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: #f3f4f6;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.btn:active {
  transform: translateY(0);
}

/* Output Section */
.output-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin-bottom: 28px;
  animation: fadeIn 0.3s ease;
}

.output-header {
  background: rgba(31, 41, 55, 0.7);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.tabs-nav {
  display: flex;
  gap: 6px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #fff;
  background: rgba(37, 99, 235, 0.25);
  border: 1px solid rgba(37, 99, 235, 0.5);
}

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

/* Tab Panels */
.tab-panel {
  display: none;
  padding: 24px;
}

.tab-panel.active {
  display: block;
}

/* Preview Toolbar */
.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.device-switcher {
  display: flex;
  gap: 4px;
  background: var(--bg-primary);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.device-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.device-btn.active {
  background: var(--bg-card);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.preview-frame-container {
  display: flex;
  justify-content: center;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 8px;
  min-height: 520px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

#previewIframe {
  width: 100%;
  height: 640px;
  border: none;
  background: #ffffff;
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Code Editor */
.code-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e293b;
  padding: 10px 16px;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-bottom: none;
}

.file-tag {
  color: #93c5fd;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-stats {
  color: var(--text-subtle);
}

.code-editor-wrapper {
  position: relative;
}

.code-textarea {
  width: 100%;
  height: 480px;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: #e2e8f0;
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}

.code-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Metadata Grid */
.metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.meta-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meta-card.full-width {
  grid-column: 1 / -1;
}

.meta-card-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-card-value {
  font-size: 14px;
  color: #fff;
  word-break: break-all;
  font-weight: 500;
}

.meta-card-value.code-font {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #93c5fa;
  background: rgba(0, 0, 0, 0.35);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-card-footer {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.btn-copy-mini, .btn-link-mini {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-copy-mini:hover, .btn-link-mini:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 16px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-instruction {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-footer {
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Footer */
.app-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 20px 24px;
  margin-top: auto;
  background: rgba(11, 15, 25, 0.8);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-subtle);
  flex-wrap: wrap;
  gap: 8px;
}

.footer-tag {
  color: #60a5fa;
}

/* ============================================================ */
/* WordPress Integration & Local Spreadsheet Styling            */
/* ============================================================ */
.wordpress-card {
  background: var(--bg-card);
  border: 1px solid rgba(56, 88, 233, 0.35);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.wordpress-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #21759b, #3858e9, #06b6d4);
}

.local-card {
  background: var(--bg-card);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.local-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #059669, #34d399);
}

.publishing-control-card {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.source-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.source-toggle-label {
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.source-radio-group {
  display: inline-flex;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 4px;
}

.source-radio-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  transition: all 0.2s ease;
  user-select: none;
}

.source-radio-item:hover {
  color: #fff;
}

.source-radio-item.active {
  background: var(--accent-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.source-radio-item input[type="radio"] {
  display: none;
}

.upload-dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  background: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: #38bdf8;
  background: rgba(14, 165, 233, 0.08);
}

.dropzone-icon {
  font-size: 28px;
  color: #38bdf8;
  margin-bottom: 8px;
}

.dropzone-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.dropzone-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.status-badge-draft {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-badge-published {
  background: rgba(6, 182, 212, 0.2);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.5);
}

.status-badge-creating {
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.5);
  animation: pulse 1.5s infinite;
}

.wp-url-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #38bdf8;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wp-url-link:hover {
  text-decoration: underline;
  color: #7dd3fc;
}

.wp-badge-connected {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.wp-badge-disconnected {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.wp-badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@media (max-width: 900px) {
  .sheets-config-grid {
    grid-template-columns: 1fr;
  }
  .metadata-grid {
    grid-template-columns: 1fr;
  }
}

/* =============================================================
   WordPress Config Section — Enhanced Form Styles
   ============================================================= */

/* Responsive 2-column grid; Site URL spans full width */
.wp-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  padding: 4px 0;
}

.wp-field-full {
  grid-column: 1 / -1;
}

/* Field hint text below each input */
.wp-field-hint {
  font-size: 11.5px;
  color: var(--text-subtle);
  margin-top: 5px;
  line-height: 1.5;
}

.wp-field-hint strong {
  color: var(--text-muted);
  font-weight: 600;
}

/* Warning callout inside hint */
.wp-hint-warn {
  display: block;
  margin-top: 5px;
  color: #fbbf24;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  flex-wrap: wrap;
}

.wp-hint-warn i {
  font-size: 10px;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Small badge next to label */
.wp-label-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1.6;
}

/* Password input wrapper with eye-toggle */
.wp-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.wp-password-input {
  flex: 1;
  padding-right: 44px !important; /* room for the eye button */
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* Eye toggle button */
.btn-eye-toggle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color 0.15s ease, background 0.15s ease;
  font-size: 13px;
  flex-shrink: 0;
}

.btn-eye-toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.btn-eye-toggle:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: -2px;
}

/* config-label icons */
.config-label i {
  width: 14px;
  text-align: center;
  color: var(--text-subtle);
}

@media (max-width: 700px) {
  .wp-config-grid {
    grid-template-columns: 1fr;
  }
  .wp-field-full {
    grid-column: 1;
  }
}
