/* Hide Woodmart theme header, footer, title bars on AutoX side panel and ?app=1 */
header.whb-header,
.whb-header,
.whb-header_331220,
.whb-full-width,
.whb-sticky-shadow,
.whb-scroll-stick,
.whb-sticky-real,
.whb-hide-on-scroll,
.whb-sticky-prepared,
.whb-top-bar,
.whb-general-header,
.whb-header-bottom,
footer.wd-footer,
.wd-footer,
.footer-container,
.color-scheme-light,
.footer-sidebar,
.woodmart-footer,
.page-title,
.title-size-default {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.page:has(#bajhi-autox-app),
body.page:has(.bajhi-autox) {
  background: #0b0f17 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.bajhi-autox {
  --autox-bg: #0b0f17;
  --autox-surface: #131b26;
  --autox-surface-alt: #1a2433;
  --autox-ink: #f0f6fc;
  --autox-muted: #8b949e;
  --autox-line: #212e40;
  --autox-primary: #3b82f6;
  --autox-primary-hover: #2563eb;
  --autox-accent: #10b981;
  --autox-danger: #ef4444;
  --autox-radius: 10px;

  box-sizing: border-box;
  min-height: 100vh;
  margin: 0;
  padding: 12px 10px;
  background: var(--autox-bg);
  color: var(--autox-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.bajhi-autox *, .bajhi-autox *::before, .bajhi-autox *::after {
  box-sizing: border-box;
}

/* Guest Notice Banner on ?app=1 */
.autox-guest-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(30, 58, 138, 0.25));
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  animation: autox-fade-in 0.2s ease;
}

.autox-guest-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.autox-guest-msg {
  font-size: 11px;
  color: #bfdbfe;
  line-height: 1.35;
  font-weight: 500;
}

.autox-guest-login-btn {
  background: var(--autox-primary) !important;
  color: #fff !important;
  border: 1px solid var(--autox-primary) !important;
  border-radius: 5px !important;
  padding: 3px 10px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.autox-guest-login-btn:hover {
  background: var(--autox-primary-hover) !important;
}

/* Header - Ultra Compact Dark Mode for Side Panel & Mobile */
.autox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 8px;
  padding: 4px 6px;
  background: var(--autox-surface);
  border: 1px solid var(--autox-line);
  border-radius: 8px;
  min-height: 34px;
}

.autox-brand {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 0 1 auto;
}

.autox-mark {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 4px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.4);
}

.autox-brand-text {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.autox-brand-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  line-height: 1;
}

.autox-plan-badge {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--autox-accent);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1;
}

.autox-head-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

/* Connect / Disconnect Header Toggle Pill */
.autox-btn-connect {
  border: 1px solid var(--autox-line) !important;
  background: var(--autox-surface-alt) !important;
  color: var(--autox-muted) !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  font-size: 9.5px !important;
  font-weight: 700 !important;
  cursor: pointer;
  line-height: 1.3 !important;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.autox-btn-connect:hover {
  background: rgba(59, 130, 246, 0.15) !important;
  border-color: var(--autox-primary) !important;
  color: #93c5fd !important;
}

.autox-btn-connect.connected {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #34d399 !important;
}

.autox-btn-connect.connected:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #f87171 !important;
}

.autox-btn-upgrade {
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
  background: rgba(245, 158, 11, 0.12) !important;
  color: #fbbf24 !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  font-size: 9.5px !important;
  font-weight: 700 !important;
  cursor: pointer;
  line-height: 1.3 !important;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.autox-btn-upgrade:hover {
  background: #f59e0b !important;
  color: #0b0f17 !important;
}

.autox-status {
  display: none; /* Kept hidden to give more room in ultra-compact side panel */
}

.autox-btn-icon {
  display: inline-grid !important;
  place-items: center !important;
  width: 20px !important;
  height: 20px !important;
  min-height: 20px !important;
  max-height: 20px !important;
  border-radius: 4px !important;
  border: 1px solid var(--autox-line) !important;
  background: var(--autox-surface-alt) !important;
  color: var(--autox-muted) !important;
  cursor: pointer;
  font-size: 10px !important;
  padding: 0 !important;
  line-height: 1 !important;
  transition: all 0.15s ease;
}

.autox-btn-icon:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: var(--autox-danger) !important;
  color: #f87171 !important;
}

/* Woodmart Global Aggressive Reset for ALL buttons inside #bajhi-autox-app */
#bajhi-autox-app :is(.btn, .button, button, [type="button"], [type="submit"], a.btn, a.button) {
  min-height: unset !important;
  height: auto !important;
  box-shadow: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  font-family: inherit !important;
}

/* Tabs Navigation - Compact 5 Tab Dark Row */
.autox-tabs-nav {
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin-bottom: 8px;
  background: var(--autox-surface);
  padding: 2px;
  border: 1px solid var(--autox-line);
  border-radius: 6px;
  overflow-x: auto;
}

.autox-tab-btn {
  flex: 1 1 0;
  padding: 4px 2px !important;
  border: none !important;
  background: transparent !important;
  border-radius: 4px !important;
  font: inherit !important;
  font-size: 9.5px !important;
  font-weight: 600 !important;
  color: var(--autox-muted) !important;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.autox-tab-btn.active {
  background: var(--autox-primary) !important;
  color: #fff !important;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.4) !important;
}

.autox-tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--autox-ink) !important;
}

/* Execution Target Bar (Local vs Cloud Run) */
.autox-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 3px 6px;
  background: var(--autox-bg);
  border: 1px solid var(--autox-line);
  border-radius: 6px;
}

.autox-mode-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--autox-muted);
}

.autox-mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--autox-surface);
  padding: 2px;
  border-radius: 4px;
  border: 1px solid var(--autox-line);
}

.autox-mode-btn {
  padding: 2px 7px !important;
  border: none !important;
  background: transparent !important;
  color: var(--autox-muted) !important;
  font-size: 9.5px !important;
  font-weight: 600 !important;
  border-radius: 3px !important;
  cursor: pointer;
  transition: all 0.12s ease;
}

.autox-mode-btn.active {
  background: #3b82f6 !important;
  color: #fff !important;
}

/* Main Cards */
.autox-card {
  padding: 12px;
  border: 1px solid var(--autox-line);
  border-radius: var(--autox-radius);
  background: var(--autox-surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.autox-tab-panel {
  display: none;
}

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

/* Compact Input Form */
.autox-textarea-wrapper textarea {
  display: block;
  width: 100%;
  min-height: 74px;
  padding: 9px 10px;
  border: 1px solid var(--autox-line);
  border-radius: 8px;
  background: var(--autox-bg);
  color: var(--autox-ink);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.45;
  outline: none;
  resize: vertical;
}

.autox-textarea-wrapper textarea:focus {
  border-color: var(--autox-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.autox-controls {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

#bajhi-autox-app .autox-primary,
#bajhi-autox-app .autox-secondary,
#bajhi-autox-app .autox-link,
.autox-primary,
.autox-secondary,
.autox-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 32px !important;
  height: 32px !important;
  padding: 0 10px !important;
  border-radius: 6px !important;
  font: inherit !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
  text-transform: none !important;
  box-shadow: none !important;
}

#bajhi-autox-app .autox-primary,
.autox-primary {
  border: 1px solid var(--autox-primary) !important;
  background-color: var(--autox-primary) !important;
  color: #fff !important;
}

#bajhi-autox-app .autox-primary:hover:not(:disabled),
.autox-primary:hover:not(:disabled) {
  background-color: var(--autox-primary-hover) !important;
}

#bajhi-autox-app .autox-primary:disabled,
.autox-primary:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
}

#bajhi-autox-app .autox-secondary,
.autox-secondary {
  border: 1px solid var(--autox-line) !important;
  background-color: var(--autox-surface-alt) !important;
  color: var(--autox-ink) !important;
}

#bajhi-autox-app .autox-secondary:hover:not(:disabled),
.autox-secondary:hover:not(:disabled) {
  background-color: #253347 !important;
}

#bajhi-autox-app .autox-secondary:disabled,
.autox-secondary:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
}

#bajhi-autox-app .autox-link,
.autox-link {
  border: 1px solid transparent !important;
  background: transparent !important;
  background-color: transparent !important;
  color: var(--autox-primary) !important;
  min-height: unset !important;
  height: auto !important;
  padding: 2px 4px !important;
}

#bajhi-autox-app .autox-link:hover,
.autox-link:hover {
  text-decoration: underline !important;
}

#bajhi-autox-app .autox-history-rerun,
.autox-history-rerun {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--autox-line) !important;
  color: #cbd5e1 !important;
  border-radius: 4px !important;
  padding: 3px 8px !important;
  font-size: 10px !important;
  font-weight: 600 !important;
}

#bajhi-autox-app .autox-history-rerun:hover,
.autox-history-rerun:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  text-decoration: none !important;
}

#bajhi-autox-app .autox-history-save-wf,
.autox-history-save-wf {
  background: rgba(16, 185, 129, 0.1) !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  color: #34d399 !important;
  border-radius: 4px !important;
  padding: 3px 8px !important;
  font-size: 10px !important;
  font-weight: 600 !important;
}

#bajhi-autox-app .autox-history-save-wf:hover,
.autox-history-save-wf:hover {
  background: rgba(16, 185, 129, 0.22) !important;
  color: #6ee7b7 !important;
  text-decoration: none !important;
}

.autox-text-danger {
  color: #f87171 !important;
}

.autox-task-state {
  min-height: 34px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--autox-surface-alt);
  border: 1px solid var(--autox-line);
  color: #93c5fd;
  font-size: 11.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* Steps Feed */
.autox-steps-container {
  margin-top: 10px;
  border: 1px solid var(--autox-line);
  border-radius: 8px;
  background: var(--autox-bg);
  overflow: hidden;
}

.autox-steps-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  background: var(--autox-surface-alt);
  font-size: 11.5px;
  border-bottom: 1px solid var(--autox-line);
}

.autox-steps-count {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #1e293b;
  color: #94a3b8;
  font-weight: 700;
}

.autox-steps-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.autox-step-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 11.5px;
  line-height: 1.4;
  padding: 6px 8px;
  background: var(--autox-surface);
  border: 1px solid var(--autox-line);
  border-radius: 6px;
}

.autox-step-badge {
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  background: #1e3a8a;
  color: #93c5fd;
  text-transform: uppercase;
}

.autox-step-msg {
  flex-grow: 1;
  overflow-wrap: anywhere;
}

.autox-step-empty {
  text-align: center;
  color: var(--autox-muted);
  font-size: 11px;
  padding: 16px 8px;
}

/* Footer & Options (Dark text fixed) */
.autox-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--autox-line);
}

.autox-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.autox-checkbox-label input {
  accent-color: var(--autox-primary);
  width: 13px;
  height: 13px;
}

.autox-label-text {
  color: #cbd5e1 !important; /* Fixed: High contrast light/dark mode readable */
  font-size: 11.5px;
  font-weight: 500;
}

.autox-panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.autox-panel-heading h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.autox-panel-heading p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--autox-muted);
}

/* Workflows & History List */
.autox-workflows-list, .autox-history-list, .autox-schedules-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.autox-wf-card, .autox-history-card, .autox-sched-card {
  padding: 9px 10px;
  border: 1px solid var(--autox-line);
  border-radius: 8px;
  background: var(--autox-surface-alt);
  font-size: 11.5px;
}

.autox-wf-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.autox-history-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--autox-muted);
  margin-bottom: 4px;
}

.autox-history-prompt {
  font-weight: 600;
  color: #fff;
  margin-bottom: 3px;
}

.autox-history-res {
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.35;
}

/* Schedules */
.autox-sched-form {
  margin-bottom: 12px;
}

.autox-sched-form textarea {
  display: block;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--autox-line);
  border-radius: 6px;
  background: var(--autox-bg);
  color: var(--autox-ink);
  font: inherit;
  font-size: 11.5px;
  outline: none;
  resize: vertical;
}

.autox-sched-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.autox-sched-row label {
  font-size: 11px;
  color: var(--autox-muted);
}

.autox-select {
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--autox-line);
  background: var(--autox-surface-alt);
  color: var(--autox-ink);
  font: inherit;
  font-size: 11px;
}

.autox-btn-sm {
  min-height: 28px;
  padding: 0 8px;
  font-size: 11px;
  margin-left: auto;
}

.autox-sched-del {
  background: none;
  border: none;
  color: #f87171;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

/* Upgrade Plan Modal */
.autox-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.autox-modal-backdrop.active {
  display: flex;
}

.autox-modal-content {
  width: 100%;
  max-width: 420px;
  background: var(--autox-surface);
  border: 1px solid var(--autox-line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6);
  max-height: 90vh;
  overflow-y: auto;
}

.autox-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.autox-modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: #fff;
}

.autox-modal-header p {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--autox-muted);
}

.autox-modal-close {
  background: transparent;
  border: 1px solid var(--autox-line);
  color: var(--autox-muted);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
}

.autox-modal-close:hover {
  color: #fff;
  border-color: #fff;
}

.autox-plans-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.autox-plan-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--autox-bg);
  border: 1px solid var(--autox-line);
  border-radius: 8px;
  transition: all 0.15s ease;
}

.autox-plan-item:hover {
  border-color: var(--autox-primary);
}

.autox-plan-title {
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.autox-plan-price {
  color: #60a5fa;
  font-weight: 700;
  font-size: 12px;
}

.autox-plan-desc {
  font-size: 10.5px;
  color: var(--autox-muted);
  margin-top: 2px;
}

.autox-cred-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: var(--autox-bg);
  border: 1px solid var(--autox-line);
  border-radius: 6px;
  margin-bottom: 6px;
}

.autox-cred-svc {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.autox-cred-user {
  font-size: 10px;
  color: var(--autox-muted);
}

.autox-cred-del {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 10px;
  cursor: pointer;
  padding: 2px 4px;
}

.autox-foot {
  text-align: center;
  margin-top: 10px;
  font-size: 10px;
  color: #475569;
}

/* Sidepanel & Mobile Breakpoint */
@media (max-width: 480px) {
  .bajhi-autox {
    padding: 8px 6px;
  }
  .autox-head {
    padding: 6px 8px;
    margin-bottom: 8px;
  }
  .autox-card {
    padding: 10px;
  }
  .autox-controls {
    grid-template-columns: 1fr 1fr;
  }
  .autox-primary {
    grid-column: span 2;
  }
}
