.aibb-chapter-select{
  width:220px;
  max-width:220px;
}

/* Ensure the write chapter bar never overflows the portal container */
.aias-write-chapterbar{max-width:100%;}
.aias-write-chapterbar label{max-width:100%;}

/* Make action links look like small grey buttons across all portal pages */
.aibb-wrap a.button,
.aibb-wrap button.button{
  border-radius:12px;
  text-decoration:none;
}
.aibb-wrap a.button.button-small,
.aibb-wrap a.button-small,
.aibb-wrap a.aibb-action-btn{
  font-size:12px;
  padding:4px 10px;
  background: rgba(0,0,0,0.06);
  border:1px solid rgba(0,0,0,0.18);
  color:#1d2327;
}
.aibb-wrap a.button.button-small:hover,
.aibb-wrap a.button-small:hover,
.aibb-wrap a.aibb-action-btn:hover{
  background: rgba(0,0,0,0.10);
}

/* AI Author Studio — Portal UI */

body.aibb-page{background:#d7f3d6!important;}

/* Hide common theme headers */
body.aibb-page.aibb-hide-title .entry-header{display:none!important;}
body.aibb-page.aibb-hide-title .page-header{display:none!important;}
body.aibb-page.aibb-hide-title h1.entry-title{display:none!important;}
body.aibb-page.aibb-hide-title .storefront-breadcrumb{display:none!important;}
body.aibb-page.aibb-hide-title nav.woocommerce-breadcrumb{display:none!important;}
body.aibb-page.aibb-hide-title .woocommerce-breadcrumb{display:none!important;}
body.aibb-page.aibb-hide-title .woocommerce-products-header{display:none!important;}


/* Portal container with border (CAE-like) */
/* ------------------------------------------------------------
 * Portal width normalization
 *
 * Some themes (notably Divi) apply aggressive container widths and
 * side paddings that can push the portal off-screen or compress the
 * Write editor column.
 *
 * Requirement: cap ALL portal views to 1200px wide.
 * ------------------------------------------------------------ */

html, body{overflow-x:hidden;}

.aibb-wrap.aibb-frontend{
  max-width:1200px !important;
  width:calc(100% - 40px) !important;
  /* Left-align portal (do NOT center) so LTR and RTL share the same left edge */
  margin:18px 0 !important;
  padding:14px 14px 20px !important;
  background:#dcefff !important;
  border:3px solid rgba(0,0,0,0.12) !important;
  border-radius:14px !important;
  box-shadow:0 2px 10px rgba(0,0,0,0.06) !important;
  box-sizing:border-box !important;
}


/* --- Global portal typography + sizing consistency --- */
.aibb-wrap.aibb-frontend{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;color:#1d2327;}
.aibb-wrap.aibb-frontend *{box-sizing:border-box;}
.aibb-wrap.aibb-frontend p,.aibb-wrap.aibb-frontend li{line-height:1.5;}
.aibb-wrap.aibb-frontend h1,.aibb-wrap.aibb-frontend h2,.aibb-wrap.aibb-frontend h3{line-height:1.25;}
/* Non-Divi: slightly wider and left-aligned */
body.aibb-page.aibb-not-divi .aibb-wrap.aibb-frontend{
  max-width:1150px !important;
  width:calc(100% - 40px) !important;
  /* Non-Divi: keep left-aligned like hosted/subscription server */
  margin:18px 0 !important;
}

/* RTL/Hebrew: keep the portal centered and prevent any accidental horizontal shifting */
html[dir="rtl"] .aibb-wrap.aibb-frontend,
body.rtl .aibb-wrap.aibb-frontend{
  /* RTL should NOT change horizontal placement */
  margin:18px 0 !important;
  left:auto !important;
  right:auto !important;
}

/* Divi/container overrides: ensure portal can use full available width */
body.aibb-page .container,
body.aibb-page .et_pb_row,
body.aibb-page .et-l--body,
body.aibb-page .et_pb_section,
body.aibb-page .et_builder_inner_content{
  max-width:none !important;
  width:100% !important;
}

/* Write view: allow the editor to use as much width as possible on large monitors */
body.aibb-page .aibb-wrap.aibb-frontend .aibb-write-card,
body.aibb-page .aibb-wrap.aibb-frontend .aias-write-wrap{max-width:none!important;}


/* Write view: non-body-class fallback (some themes strip body classes) */
.aibb-wrap.aibb-frontend .aibb-write-card,
.aibb-wrap.aibb-frontend .aias-write-wrap{max-width:none !important; width:100% !important;}
.aibb-wrap.aibb-frontend #wp-aibb-chapter-content-wrap,
.aibb-wrap.aibb-frontend #wp-aibb-chapter-content-editor-container{max-width:none !important; width:100% !important;}
.aibb-wrap.aibb-frontend iframe#aibb-chapter-content_ifr{width:100% !important;}

/* Write view: non-body-class fallback (some themes remove body classes) */
.aibb-wrap.aibb-frontend .aibb-write-card,
.aibb-wrap.aibb-frontend .aias-write-wrap{max-width:none !important; width:100% !important;}
.aibb-wrap.aibb-frontend #wp-aibb-chapter-content-wrap,
.aibb-wrap.aibb-frontend #wp-aibb-chapter-content-editor-container{max-width:none !important; width:100% !important;}
.aibb-wrap.aibb-frontend #aibb-chapter-content_ifr{width:100% !important; max-width:none !important;}


/* Some themes do not preserve our body class; apply the same width unlock without relying on body.aibb-page */
.aibb-wrap.aibb-frontend .aibb-write-card,
.aibb-wrap.aibb-frontend .aias-write-wrap{max-width:none!important;width:100%!important;}
/* Ensure the WP editor wrapper fills the card (prevents ~820px clamp) */
.aibb-wrap.aibb-frontend .aibb-write-card .wp-editor-wrap,
.aibb-wrap.aibb-frontend .aibb-write-card .wp-editor-container,
.aibb-wrap.aibb-frontend .aibb-write-card .mce-tinymce{max-width:none!important;width:100%!important;box-sizing:border-box!important;}
.aibb-wrap.aibb-frontend .aibb-write-card iframe{width:100%!important;box-sizing:border-box!important;}

/* App-owned title bar */
.aibb-app-header{margin:0 0 10px 0;}
.aibb-app-header-line{font-size:20px;font-weight:700;line-height:1.2;}
.aibb-app-brand{display:none;}
.aibb-app-page{display:none;}
.aibb-app-brand-only{color:#000; font-weight:700; opacity:1;}

/* Top nav */
.aibb-nav{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  margin:0 0 12px 0;
  padding:10px 10px;
  background:rgba(255,255,255,0.6);
  border:1px solid rgba(0,0,0,0.10);
  border-radius:12px;
}

/* Make all portal nav links look like small green buttons; selected tab turns white */
/* High-specificity overrides for Divi */
body .aibb-wrap.aibb-frontend .aibb-nav a,
body .aibb-wrap.aibb-frontend a.aibb-primary-tab{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  text-decoration:none !important;
  /* +25% size boost for main portal menu buttons */
  padding:8px 15px !important;
  border-radius:8px !important;
  border:1px solid rgba(0,0,0,0.18) !important;
  background: rgba(120,200,110,0.92) !important;  /* darker green */
  color:#0a1a0a !important;
  font-size:15px !important;
  line-height:1.2 !important;
  font-weight:700 !important;
}

body .aibb-wrap.aibb-frontend .aibb-nav a:hover,
body .aibb-wrap.aibb-frontend a.aibb-primary-tab:hover{
  background: rgba(105,190,95,0.94) !important;
}

body .aibb-wrap.aibb-frontend .aibb-nav a.aibb-nav-active,
body .aibb-wrap.aibb-frontend a.aibb-primary-tab.aibb-nav-active,
body .aibb-wrap.aibb-frontend a.aibb-primary-tab.active{
  background:#ffffff !important; /* selected = white */
  font-weight:800 !important;
  border-color: rgba(127,191,99,0.95) !important;
}

.aibb-nav-spacer{flex:1;}
.aibb-pill{display:inline-block;padding:2px 8px;border-radius:999px;border:1px solid rgba(0,0,0,0.15);background:#f3f4f6;color:#1d2327;font-weight:700;line-height:1.4;vertical-align:middle;}
.aibb-pill.pro{background:#e3f2fd;border-color:#2196f3;color:#0d47a1;}
.aibb-pill.studio{background:#ffebee;border-color:#dc3232;color:#b71c1c;}
.aibb-pill.free{background:#f6f7f7;border-color:#c3c4c7;color:#1d2327;}

/* Primary writer-first tabs */ (Write / Organize / Publish) */
.aibb-primary-tabs{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:0 0 12px 0;padding:10px 10px;background:rgba(255,255,255,0.6);border:1px solid rgba(0,0,0,0.10);border-radius:12px;}
.aibb-primary-tab{display:inline-block;text-decoration:none;padding:5px 12px;border-radius:999px;border:1px solid rgba(0,0,0,0.12);background:#78c86e !important;color:#111;font-size:12px;line-height:1.2;}
.aibb-primary-tab.active{font-weight:900;background:#fff;}
.aibb-primary-spacer{flex:1;}

/* Smaller buttons everywhere inside portal */
body.aibb-page .aibb-wrap .button, body.aibb-page .aibb-wrap button.button{font-size:12px!important;padding:4px 10px!important;line-height:1.3!important;min-height:0!important;}

/* Convert plain action links (Open/Restore/Delete/etc.) into small grey buttons */
body.aibb-page .aibb-wrap a.button,
body.aibb-page .aibb-wrap .aias-build-table a,
body.aibb-page .aibb-wrap .aias-your-projects a{
  display:inline-block;
  text-decoration:none!important;
  padding:2px 8px!important;
  border-radius:6px!important;
  border:1px solid rgba(0,0,0,0.18)!important;
  background:#f0f0f1!important;
  color:#1d2327!important;
  font-size:12px!important;
  line-height:1.3!important;
}
body.aibb-page .aibb-wrap a.button:hover,
body.aibb-page .aibb-wrap .aias-build-table a:hover,
body.aibb-page .aibb-wrap .aias-your-projects a:hover{
  background:#e5e5e5!important;
}

/* Publish wizard pills (Book Details / Output / Generate) */
body.aibb-page .aibb-wrap .aias-step-pill{
  display:inline-block;
  text-decoration:none!important;
  padding:5px 12px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,0.12);
  background:#d7f3d6;
  color:#111;
  font-size:12px;
}
body.aibb-page .aibb-wrap .aias-step-pill.active{
  background:#fff;
  font-weight:900;
}
body.aibb-page .aibb-wrap input[type="text"], body.aibb-page .aibb-wrap select{font-size:13px!important;padding:4px 6px!important;}

/* Portal container with border (CAE-like) — keep LEFT-ALIGNED (no centering) */
.aibb-wrap.aibb-frontend{max-width:1200px;width:calc(100% - 40px);margin:18px 0;padding:14px 14px 20px;background:#dcefff;border:3px solid rgba(0,0,0,0.12);border-radius:14px;box-shadow:0 2px 10px rgba(0,0,0,0.06);}

/* App-owned title bar (single line) */
.aibb-app-header{margin:0 0 10px 0;}
.aibb-app-header-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;}
.aibb-app-header-line{font-size:20px;font-weight:700;line-height:1.2;}
.aibb-app-brand{margin-right:6px;}
.aibb-app-page{opacity:0.95;}

/* Help button */
.aibb-help-btn{border:1px solid rgba(0,0,0,0.12);background:#fff;border-radius:8px;padding:6px 10px;font-size:12px;cursor:pointer;}
.aibb-help-btn:hover{box-shadow:0 1px 8px rgba(0,0,0,0.08);}

/* Help modal (no separate Help page needed) */
.aibb-help-modal{display:none;position:fixed;inset:0;z-index:999999;}
.aibb-help-modal.is-open{display:block;}
.aibb-help-backdrop{position:absolute;inset:0;background:rgba(0,0,0,0.55);}
.aibb-help-panel{position:relative;max-width:980px;margin:6vh auto 0 auto;background:#fff;border-radius:16px;border:1px solid rgba(0,0,0,0.18);box-shadow:0 10px 40px rgba(0,0,0,0.35);overflow:hidden;}
.aibb-help-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid rgba(0,0,0,0.10);}
.aibb-help-title{font-size:16px;font-weight:800;}
.aibb-help-close{border:1px solid rgba(0,0,0,0.12);background:#fff;border-radius:8px;width:34px;height:34px;cursor:pointer;font-size:18px;line-height:1;}
.aibb-help-tabs{display:flex;gap:8px;flex-wrap:wrap;padding:10px 12px;border-bottom:1px solid rgba(0,0,0,0.08);background:rgba(255,255,255,0.65);}
.aibb-help-tab{border:1px solid rgba(0,0,0,0.18);background: rgba(165,226,150,0.98) !important;color:#0b2d12 !important;border-radius:999px;padding:6px 10px;font-size:12px;cursor:pointer;font-weight:700;}
.aibb-help-tab:hover{filter:brightness(0.98);}
.aibb-help-tab.is-active{font-weight:800;background:#fff !important;color:#1d6f42 !important;border-color: rgba(46,125,50,0.85) !important;}
.aibb-help-body{padding:12px 14px;max-height:70vh;overflow:auto;}
.aibb-help-pane{display:none;}
.aibb-help-pane.is-active{display:block;}
.aibb-help-pane h3{margin:10px 0 6px 0;font-size:14px;}
.aibb-help-pane p, .aibb-help-pane li{font-size:13px;line-height:1.45;}

/* Ticket 6: Next step guidance panel */
.aias-next-step{
  margin: 12px 0 14px 0;
  padding: 12px 12px;
  border:1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  background: rgba(0,0,0,0.02);
}
.aias-next-step-h{font-weight:700;margin:0 0 4px 0}
.aias-next-step-text{color:#646970;margin:0 0 10px 0}
.aias-next-step-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}

/* Next-step buttons should be green by default. When pressed, flip to white.
   This avoids the "active project" state showing as white unless clicked. */
.aias-next-step-actions .aias-next-step-btn,
.aias-next-step-actions .button.aias-next-step-btn{
  background:#1f6f2a !important;
  border-color:#1f6f2a !important;
  color:#fff !important;
  box-shadow:none !important;
}
.aias-next-step-actions .aias-next-step-btn.is-pressed{
  background:#fff !important;
  color:#1f6f2a !important;
}


/* Danger button for irreversible actions */
.aibb-danger{
  border-color:#b32d2e!important;
  background:#b32d2e!important;
  color:#ffffff!important;
}
.aibb-danger:hover{
  border-color:#8a1f20!important;
  background:#8a1f20!important;
  color:#ffffff!important;
}

/* Danger outline button (red text + outline, no fill) */
.aibb-danger-outline{
  border-color:#b32d2e!important;
  background:#ffffff!important;
  color:#b32d2e!important;
}
.aibb-danger-outline:hover{
  border-color:#8a1f20!important;
  background:rgba(179,45,46,0.08)!important;
  color:#8a1f20!important;
}

/* Page purpose banner (centered, green like main menu) */
.aibb-page-purpose{
  font-family: Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  text-align:center;
  font-size:18px;
  font-weight:800;
  margin:8px 0 14px 0;
  padding:10px 12px;
  border-radius:8px;
  background: rgba(165,226,150,0.35);
  border:1px solid rgba(127,191,99,0.95);
  color:#1b5e20;
}

/* Projects page: keep Saved + Archived lists stable at full portal width */
.aibb-projects-lists-wrap{clear:both;width:100%;}

/* Projects lists container: ensure the entire block (search + two lists) behaves as one stable unit */
.aibb-projects-lists-container{
  width:100%;
  max-width:none;
  padding:12px;
  border:1px solid #dcdcde;
  border-radius:12px;
  background:#ffffff;
}


/* Organize Builder (two-column)
   Many WP themes constrain the content column to ~700–900px.
   Keep two columns until the container is genuinely narrow. */
.aias-organize-builder{display:grid;grid-template-columns:minmax(0,1fr) minmax(240px,304px);gap:10px;align-items:start;width:100%;max-width:none;}
@media (max-width: 1100px){.aias-organize-builder{grid-template-columns:1fr;}}
.aias-card{background:#fff;border:1px solid #dcdcde;border-radius:12px;padding:10px 12px;box-shadow:0 1px 0 rgba(0,0,0,.02);}
.aias-card-title{font-weight:700;font-size:15px;margin-bottom:8px;}
.aias-card-body{color:#1d2327;}
.aias-notice{background:#f6f7f7;border:1px solid #dcdcde;border-radius:8px;padding:10px 12px;color:#50575e;margin:10px 0;}
.aias-badge{display:inline-block;font-size:12px;line-height:1;padding:4px 8px;border-radius:999px;border:1px solid #dcdcde;background:#f6f7f7;color:#50575e;margin-right:8px;white-space:nowrap;}
.aias-badge-chapter{background:#ecf7ed;border-color:#b8e0bb;color:#1f6f2a;}
.aias-badge-component{background:#eef2ff;border-color:#c7d2fe;color:#3730a3;}
.aias-build-table{width:100%;border-collapse:collapse;table-layout:fixed;}
.aias-build-table th{background:#f6f7f7;text-align:left;border-bottom:1px solid #dcdcde;padding:4px 6px;}
.aias-build-table td{border-bottom:1px solid #eee;padding:4px 6px;vertical-align:middle;}
/* Keep rows compact, but allow the Title column to wrap when needed. */
.aias-build-table th,.aias-build-table td{border-bottom:1px solid #eee;padding:4px 6px;vertical-align:middle;}
/* Column sizing: fixed layout so Actions column starts at a consistent position. */
.aias-build-table th.aias-col-drag,
.aias-build-table td:nth-child(1){width:30px;max-width:30px;}
.aias-build-table th.aias-col-select,
.aias-build-table td:nth-child(2){width:44px;max-width:44px;}
.aias-build-table th.aias-col-type,
.aias-build-table td:nth-child(3){width:110px;max-width:120px;}
/* Title (4) — fixed width to prevent table overflow */
.aias-build-table th.aias-col-title,
.aias-build-table td:nth-child(4){width:200px;max-width:220px;}

.aias-build-table th.aias-col-rename,
.aias-build-table td:nth-child(5){width:160px;max-width:180px;}
.aias-build-table th.aias-col-actions,
.aias-build-table td:nth-child(6){width:220px;max-width:240px;}
.aias-build-table td:nth-child(4){overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
/* Force all action buttons onto a single line.
   Some themes apply aggressive form/button styles; keep this specific. */
body.aibb-page .aibb-wrap .aias-build-actions{display:flex!important;gap:6px;align-items:center;flex-wrap:nowrap!important;overflow-x:visible;}
body.aibb-page .aibb-wrap .aias-build-actions > form{display:inline-flex!important;flex:0 0 auto!important;margin:0!important;}
body.aibb-page .aibb-wrap .aias-build-actions .button{padding:2px 8px!important;min-height:26px!important;line-height:1.2!important;font-size:12px!important;}
/* Ensure Organize action buttons stay compact even if body class differs */
.aibb-wrap .aias-build-actions{display:flex!important;gap:6px;align-items:center;flex-wrap:nowrap!important;overflow-x:visible;}
.aibb-wrap .aias-build-actions > form{display:inline-flex!important;flex:0 0 auto!important;margin:0!important;}
.aibb-wrap .aias-build-actions .button{padding:2px 8px!important;min-height:26px!important;line-height:1.2!important;font-size:12px!important;}


/* Organize builder enhancements: selection + drag */
body.aibb-page .aibb-wrap .aias-drag-cell{width:34px;padding:0 6px!important;text-align:center;}
body.aibb-page .aibb-wrap .aias-drag-handle{cursor:grab;user-select:none;font-weight:700;color:#646970;display:inline-block;width:20px;text-align:center;}
body.aibb-page .aibb-wrap .aias-build-row.aias-selected{outline:2px solid #2271b1;outline-offset:-2px;}
body.aibb-page .aibb-wrap .aias-build-row.aias-drop-target{outline:2px dashed #2271b1;outline-offset:-2px;}
body.aibb-page .aibb-wrap .aias-build-row.aias-dragging{opacity:0.6;}
body.aibb-page .aibb-wrap .aias-save-status{color:#646970;font-size:12px;margin:6px 0;}

/* Component settings panel */
body.aibb-page .aibb-wrap .aias-comp-settings{background:#fafafa;border:1px solid #dcdcde;border-radius:8px;padding:10px;}
body.aibb-page .aibb-wrap .aias-comp-settings-note{color:#646970;font-size:12px;margin:0 0 8px 0;}
body.aibb-page .aibb-wrap .aias-comp-settings-form{display:grid;grid-template-columns:1fr 1fr;gap:10px;align-items:end;}
body.aibb-page .aibb-wrap .aias-field-row{display:flex;flex-direction:column;gap:4px;}
body.aibb-page .aibb-wrap .aias-field-row label{font-weight:600;font-size:12px;}
body.aibb-page .aibb-wrap .aias-field-actions{grid-column:1/-1;display:flex;gap:10px;}
/* Component Library (right column) – two columns inside the pane */
.aias-comp-group{margin-top:10px;}
.aias-comp-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;}

.aias-comp-item{padding:4px;border:1px solid #eee;border-radius:8px;background:rgba(0,0,0,0.01);}
.aias-comp-label{font-weight:700;margin-bottom:2px;}
.aias-comp-desc{color:#646970;font-size:12px;margin:0 0 2px 0;}
/* Put component buttons UNDER each component (vertical stack). */
body.aibb-page .aibb-wrap .aias-comp-buttons{display:flex!important;gap:6px;align-items:stretch;flex-direction:column;}
body.aibb-page .aibb-wrap .aias-comp-buttons > form{display:flex!important;margin:0!important;}
body.aibb-page .aibb-wrap .aias-comp-buttons .button{width:100%;padding:2px 8px!important;min-height:26px!important;line-height:1.2!important;font-size:12px!important;}

/* Organize Builder tightening (do NOT override fixed layout) */
.aias-build-table{width:100%;table-layout:fixed;border-collapse:collapse;}
.aias-build-table th,.aias-build-table td{border-bottom:1px solid #eee;padding:4px 6px;vertical-align:middle;}
.aias-build-table td a,.aias-build-table td strong{font-size:13px;line-height:1.2;}

/* Actions column alignment: keep buttons in consistent "lanes" (compact so they stay visible) */
.aibb-wrap .aias-build-actions{display:grid!important;grid-template-columns:62px 62px;gap:6px;align-items:center;justify-content:start;}
.aibb-wrap .aias-build-actions .button,
.aibb-wrap .aias-build-actions a.button{min-width:62px;justify-content:center;text-align:center;box-sizing:border-box;}
.aibb-wrap .aias-build-actions > form{margin:0!important;}

/* Rename cells: keep inputs from forcing the table wider than the portal */
.aibb-wrap .aias-build-rename input[type="text"]{width:100%;max-width:100%;box-sizing:border-box;}
.aias-build-table input[type="text"]{font-size:13px;line-height:1.2;height:30px;padding:4px 6px;}
.aias-actions{white-space:nowrap;}

.aias-comp-draggable{cursor:grab;user-select:none;}
.aias-comp-draggable.aias-comp-dragging{opacity:0.6;}

.aias-write-toolbar{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin:6px 0 8px 0;}
.aias-write-toolbar .button{padding:2px 8px;line-height:1.6;}

.aias-build-title span{font-size:12px;font-weight:400;}


/* --- Organize overrides: keep build table inside portal + make room for Component Library --- */
body.aibb-page .aibb-wrap .aias-build-table{table-layout:fixed!important;}
body.aibb-page .aibb-wrap .aias-build-table th:nth-child(3),
body.aibb-page .aibb-wrap .aias-build-table td:nth-child(3){width:96px;max-width:96px;padding-left:4px;}
/* Title column reduced ~1/3 (may ellipsize) */
body.aibb-page .aibb-wrap .aias-build-table th:nth-child(4),
body.aibb-page .aibb-wrap .aias-build-table td:nth-child(4){width:150px;max-width:150px;}
/* Rename column tighter */
body.aibb-page .aibb-wrap .aias-build-table th:nth-child(5),
body.aibb-page .aibb-wrap .aias-build-table td:nth-child(5){width:150px;max-width:150px;}
/* Actions column (now mainly Delete/Edit) */
body.aibb-page .aibb-wrap .aias-build-table th:nth-child(6),
body.aibb-page .aibb-wrap .aias-build-table td:nth-child(6){width:120px;max-width:120px;}
/* Keep Actions visible without inner scrollbars */
body.aibb-page .aibb-wrap .aias-build-actions{overflow:visible!important;}



/* Extra compact build table */
body.aibb-page .aibb-wrap .aias-build-table th, body.aibb-page .aibb-wrap .aias-build-table td{padding:3px 5px;}
body.aibb-page .aibb-wrap .aias-build-table .button{padding:3px 8px!important;}

body.aibb-page .aibb-wrap .aias-build-actions{overflow:visible!important;}

/* Smaller font in Title + Rename fields to reduce width pressure */
body.aibb-page .aibb-wrap .aias-build-title span{font-size:12px!important;}
body.aibb-page .aibb-wrap .aias-build-rename input[type="text"]{font-size:12px!important;height:28px!important;}

body.aibb-page .aibb-wrap .aias-your-projects h4{text-decoration:underline!important;}


/* v0.9.8.6 tighten/normalize actions buttons */
.aias-build-actions .button,
.aias-build-actions button.button {
  padding: 1px 8px !important;
  line-height: 1.2 !important;
  font-size: 12px !important;
  min-height: 22px !important;
  height: 22px !important;
  vertical-align: middle !important;
}
.aias-build-actions { white-space: nowrap; }


/* Compact action buttons in Organize left pane + component rows */
.aibb-outline-row-actions .button,
.aibb-outline-row-actions button,
.aias-organize-builder .button.aibb-small,
.aias-organize-builder button.button {
  padding: 4px 10px !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
}

/* Keep Rename/Archive/Delete in one consistent size */
.aibb-outline-row-actions form { display:inline; }

/* ------------------------------------------------------------------
 * AI Coach Panel (v1) — unobtrusive right-side panel + preview modal
 * ------------------------------------------------------------------ */
.aias-ai-panel{position:fixed;top:0;right:0;height:100vh;z-index:99999;pointer-events:none;width:0;}
.aias-ai-panel *{box-sizing:border-box;}

/* Shell */
.aias-ai-shell{pointer-events:auto;position:fixed;top:52px;right:0;width:420px;max-width:92vw;transform:translateX(100%);transition:transform 0.18s ease;border-left:1px solid rgba(0,0,0,0.12);background:#fff;height:calc(100vh - 52px);min-height:calc(100vh - 52px);overflow:auto;padding-bottom:240px;}
.aias-ai-panel.aias-ai-open .aias-ai-shell{transform:translateX(0);}
.aias-ai-panel.aias-ai-expanded .aias-ai-shell{width:420px;}

/* Leonardo sidebar edge toggle (always visible) */
.aias-ai-tab{
  pointer-events:auto;
  position:absolute;
  top:190px;
  right:0;
  width:44px;
  height:160px;
  border-radius:14px 0 0 14px;
  border:1px solid #d7a92f;
  background:#f3c43b;
  color:#1f1f1f;
  cursor:pointer;
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 6px 18px rgba(0,0,0,.18);
}
.aias-ai-tab:hover{filter:brightness(0.97);}
.aias-ai-tab:active{transform:translateY(1px);}
.aias-ai-tab-text{writing-mode:vertical-rl;transform:rotate(180deg);font-weight:800;letter-spacing:.3px;font-size:12px;}

/* When open, keep the toggle on the *left edge* of the open sidebar */
.aias-ai-panel.aias-ai-open .aias-ai-tab{ right:460px; }
.aias-ai-panel.aias-ai-open.aias-ai-expanded .aias-ai-tab{ right:620px; }

.aias-ai-header{display:flex;justify-content:space-between;align-items:flex-start;padding:12px 12px 10px 12px;border-bottom:1px solid #eee;gap:10px;}
.aias-ai-title{font-weight:900;font-size:14px;color:#234;display:flex;align-items:center;gap:8px;}

.aias-ai-avatar{width:22px;height:22px;border-radius:50%;object-fit:cover;border:1px solid rgba(0,0,0,.12);}
.aias-ai-status{font-size:12px;color:#646970;margin-top:2px;}
.aias-ai-header-right{display:flex;align-items:center;gap:10px;}
.aias-ai-mute{display:flex;align-items:center;gap:6px;font-size:12px;color:#234;user-select:none;}
.aias-ai-expand,.aias-ai-close{border:1px solid #c3c4c7;background:#f6f7f7;border-radius:8px;padding:6px 8px;cursor:pointer;line-height:1;}

.aias-ai-card{padding:12px;}
.aias-ai-card-title{font-weight:800;margin:0 0 6px 0;color:#234;}
.aias-ai-card-body{color:#2c3338;font-size:13px;line-height:1.35;margin-bottom:10px;}
.aias-ai-card-actions{display:flex;gap:8px;flex-wrap:wrap;}
.aias-ai-card-actions .button{padding:5px 10px !important;font-size:12px !important;}

.aias-ai-actions{padding:0 12px 12px 12px;border-top:1px solid #f1f1f1;}
.aias-ai-actions-title{font-weight:800;font-size:12px;color:#234;margin:10px 0 8px 0;}
.aias-ai-actions-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;}
.aias-ai-action{display:flex;align-items:center;gap:8px;border:1px solid #c3c4c7;border-radius:8px;background:#f7fbf4;padding:8px 10px;cursor:pointer;font-weight:700;color:#234;font-size:12px;line-height:1.2;text-align:left;}
.aias-ai-action:hover{background:#eef8e8;}
.aias-ai-action .lock{font-size:12px;opacity:.7;}
.aias-ai-action[disabled]{opacity:.55;cursor:default;}
.aias-ai-more{margin-top:10px;width:100%;}

.aias-ai-accordions{padding:0 12px 12px 12px;overflow:auto;flex:1;}
.aias-ai-acc{border:1px solid #e5e5e5;border-radius:8px;background:#fff;margin:10px 0;}
.aias-ai-acc summary{cursor:pointer;padding:10px 12px;font-weight:800;font-size:12px;color:#234;}
.aias-ai-acc-body{padding:0 12px 12px 12px;color:#2c3338;font-size:12px;}

.aias-ai-footer{border-top:1px solid #eee;padding:10px 12px;display:flex;justify-content:space-between;gap:10px;align-items:center;}
.aias-ai-fewer{display:flex;gap:6px;align-items:center;font-size:12px;color:#234;user-select:none;}
.aias-ai-footer-links{display:flex;gap:10px;align-items:center;}
.button-link{border:0;background:transparent;color:#2271b1;cursor:pointer;padding:0;text-decoration:underline;font-size:12px;}

/* Modal */
.aias-ai-modal{position:fixed;inset:0;z-index:100000;}
.aias-ai-modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.35);}
.aias-ai-modal-dialog{position:relative;background:#fff;border:1px solid #dcdcde;border-radius:12px;max-width:1600px;width:min(95vw, calc(100% - 20px));max-height:calc(100% - 20px);margin:10px auto;display:flex;flex-direction:column;overflow:hidden;}
.aias-ai-modal-header{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;border-bottom:1px solid #eee;}
.aias-ai-modal-title{font-weight:900;color:#234;}
.aias-ai-modal-close{border:1px solid #c3c4c7;background:#f6f7f7;border-radius:8px;padding:6px 10px;cursor:pointer;}
.aias-ai-modal-body{padding:12px 14px;overflow:auto;}
.aias-ai-modal-note{color:#646970;font-size:12px;margin-bottom:10px;}
.aias-ai-diff{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
.aias-ai-diff-label{font-weight:800;font-size:12px;color:#234;margin:0 0 6px 0;}
.aias-ai-diff textarea{width:100%;min-height:320px;resize:vertical;font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-size:12px;line-height:1.35;}
.aias-ai-modal-footer{border-top:1px solid #eee;padding:12px 14px;display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap;}
.aias-ai-modal-footnote{color:#646970;font-size:12px;}
.aias-ai-modal-buttons{display:flex;gap:10px;align-items:center;}

@media (max-width: 900px){
  .aias-ai-panel.aias-ai-expanded .aias-ai-shell{width:420px;}
  .aias-ai-diff{grid-template-columns:1fr;}
}



/* Organize right column toggle */
.aias-right-tab.is-active{background:#4f8a3d;color:#fff;border-color:#3f7430;}

/* Cover rows are fixed-position in Structure */
.aias-build-row-fixed { background:#fbfbfc; }
.aias-drag-handle-disabled { opacity:0.35; cursor:not-allowed; }
.aias-build-row-fixed td { opacity:0.95; }

body.aibb-outline-fs #aibb-outline-text{ min-height:70vh !important; }
body.aibb-outline-fs .aias-outline-wrap{
  position:fixed;
  top:0;left:0;right:0;bottom:0;
  background:#eef8e8;
  padding:16px;
  z-index:999999;
  overflow:auto;
}
body.aibb-outline-fs .aias-outline-wrap > div:first-child{ display:none !important; }
body.aibb-outline-fs .aias-outline-wrap{ grid-template-columns:1fr !important; }

/* Draft preview images */
.aibb-draft-preview img{ max-width:100%; height:auto; }


/* Portal safety: enforce single active view */
#aias-portal-root > *{
    position: relative;
    clear: both;
}

/* Leonardo hero header */
.aias-ai-header-hero{align-items:flex-start;}
.aias-ai-hero-wrap{display:flex;align-items:flex-start;gap:12px;}
.aias-ai-avatar-hero{width:80px;height:auto;max-width:100px;border-radius:14px;object-fit:cover;border:1px solid rgba(0,0,0,.12);}
.aias-ai-hero-text{display:flex;flex-direction:column;gap:4px;min-width:0;}
.aias-ai-hero-caption{font-weight:900;color:#234;font-size:14px;line-height:1.2;}
@media (max-width: 1100px){
  .aias-ai-avatar-hero{width:72px;max-width:90px;}
}
@media (max-width: 600px){
  .aias-ai-avatar-hero{width:64px;max-width:84px;}
  .aias-ai-hero-caption{font-size:13px;}
}


/* AI panel helper text */
.aias-ai-actions-help{font-size:12px;color:#646970;margin-top:6px;line-height:1.35;}
.aias-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:#c3c4c7;vertical-align:middle;margin:0 4px 1px 0;}
.aias-dot-on{background:#2ca02c;}
.aias-dot-locked{background:#b42318;}
.aias-ai-actions-grid .button .aias-dot{margin-right:6px;}

/* Plan badges (FREE / PRO / STUDIO) */
.aibb-plan-badge{display:inline-block;font-size:11px;line-height:1;padding:4px 8px;border-radius:999px;border:1px solid #c3c4c7;background:#f6f7f7;color:#1d2327;vertical-align:middle;margin-left:8px;}
.aibb-plan-badge.is-free{background:#f6f7f7;}
.aibb-plan-badge.is-pro{background:#e7f5ff;border-color:#9ec5fe;}
.aibb-plan-badge.is-studio{background:#eaffea;border-color:#8fd19e;}
.aibb-plan-badge.is-locked{background:#fff1f0;border-color:#f5c2c7;color:#b42318;}

/* Leonardo dots */
.aias-dot-locked{background:#b42318;}

/* Avoid WP admin bar overlap */
.admin-bar .aias-ai-shell{top:32px;}
@media (max-width: 782px){.admin-bar .aias-ai-shell{top:46px;}}


/* Publish readiness checklist: prevent oversized icons/images */
.aibb-publish-checklist img, .aibb-publish-checklist svg { max-width: 24px !important; height: auto !important; }



/* Leonardo panel width defaults (wider by default) */
.aias-ai-panel { width: 460px; max-width: 460px; }
.aias-ai-panel.aias-ai-expanded { width: 620px; max-width: 620px; }
/* On large screens, allow a bit more room */
@media (min-width: 1400px){
  .aias-ai-panel { width: 460px; max-width: 460px; }
  .aias-ai-panel.aias-ai-expanded { width: 620px; max-width: 620px; }
}

/* AI preview modal: keep consistent sizing and avoid hiding under the Leonardo panel */
.aias-ai-modal .aias-ai-modal-inner{ max-width: 1200px !important; width: min(96vw, calc(100vw - 40px)) !important; }
body.aias-ai-open .aias-ai-modal .aias-ai-modal-inner{ width: min(1200px, calc(100vw - 460px - 56px)) !important; margin-right: 488px !important; }


/* Divi/container overrides: ensure portal can use full available width */
body.aibb-page .container,
body.aibb-page .et_pb_row,
body.aibb-page .et_pb_section,
body.aibb-page .et_pb_column,
body.aibb-page .et_builder_inner_content,
body.aibb-page .et-l--body{
  max-width:none !important;
  width:100% !important;
}

/* AAS portal background scheme (CAE-style) */
body.aibb-page{ background: #dff3df !important; }
body.aibb-page .aibb-wrap.aibb-frontend{ background:#dcefff !important; }

/* Increase height slightly so the bottom of the form is less likely to be clipped on shorter viewports. */
.aias-ai-panel .aias-ai-shell{ height: calc(100vh - 12px); }

/* Project selector width */
.aibb-active-project select, select#aibb-active-project{ max-width: 190px; width: 190px; }



/* Leonardo visibility is controlled by the panel state (aias-ai-open) via translateX.
   Keep the container mounted so the edge-toggle tab is always accessible. */
/* Bottom panels portal wrapper */
.aibb-frontend .aias-bottom-panels{background:#f6fbf6;border:1px solid #cfe3cf;border-radius:12px;padding:12px;max-width:1200px;}
.aibb-frontend .aias-bottom-panels details.aias-panel{background:#fff !important;}

/* Build table compact title column */
.aias-build-table td:nth-child(3){font-size:12px;line-height:1.2;}
.aias-build-table td, .aias-build-table th{padding-top:6px;padding-bottom:6px;}
 


/* GLOBAL narrow active project dropdown */
.aibb-frontend .aias-projectbar select,
.aibb-frontend select#aibb-active-project,
.aibb-frontend .aibb-active-project select{
  max-width: 190px !important;
  width: 190px !important;
}

/* Dashboard bottom panels forced inside portal */
.aibb-frontend .aias-dashboard-portal-wrap{
  max-width: 1800px;
  margin: 12px auto;
  background: #f6fbf6;
  border: 1px solid #cfe3cf;
  border-radius: 12px;
  padding: 12px;
}


/* Portal frame wrapper for dashboard sections */
.aibb-frontend .aibb-portal-frame{background:#f6fbf6;border:1px solid #cfe3cf;border-radius:12px;padding:12px;max-width:1300px;width:calc(100% - 24px);margin:12px 0;overflow:visible !important;height:auto !important;max-height:none !important;}

/* Global narrow project dropdown */
.aibb-frontend .aias-projectbar select{max-width:190px !important;min-width:190px !important;}
.aibb-frontend .aibb-active-project select, .aibb-frontend select#aibb-active-project{max-width:190px !important;min-width:190px !important;}




/* Revision history portal fix */
.aibb-frontend .aibb-revision-history, .aibb-frontend .aibb-revisions{background:#f6fbf6;border:1px solid #cfe3cf;border-radius:12px;padding:12px;max-width:1200px;margin:12px 0;}


/* Leonardo z-index + modal positioning */
.aibb-frontend .aias-ai-panel{z-index:999990;}
.aibb-frontend .aias-ai-modal{z-index:999999;right:auto !important;}


/* Leonardo docking helper */
.aibb-frontend .aias-ai-panel{right:0;}

/* Projects page compact action buttons */
.aibb-project-buttons{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    margin:12px 0;
}
.aibb-project-buttons .button{
    font-size:12px;
    padding:6px 10px;
    border-radius:8px;
    line-height:1.2;
}


/* Projects page mini action buttons (one row) */
.aibb-project-mini-actions{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 16px 0;align-items:center;}
.aibb-project-mini-actions .aibb-mini-btn{font-size:12px;line-height:1.2;padding:6px 10px;border-radius:8px;text-decoration:none;}
.aibb-project-mini-actions .aibb-mini-primary{font-weight:700;}

/* Mini action buttons (Projects "Next step")
   Requirement: green by default; when "pressed" (active tab) show white.
   Theme builders (e.g., Divi) can override WP .button styling, so we force with higher specificity.
*/
.aibb-frontend .aibb-project-mini-actions a.button{
  display:inline-block;
  background:#2e7d32 !important;
  border:1px solid #2e7d32 !important;
  color:#ffffff !important;
  padding:6px 10px !important;
  border-radius:8px !important;
  font-size:12px !important;
  line-height:1.2 !important;
  text-decoration:none !important;
  box-shadow:none !important;
}
.aibb-frontend .aibb-project-mini-actions a.button:hover{
  background:#256628 !important;
  border-color:#256628 !important;
}
.aibb-frontend .aibb-project-mini-actions a.button.aibb-mini-active{
  background:#ffffff !important;
  border-color:#c3c4c7 !important;
  color:#1d2327 !important;
}
.aibb-frontend .aibb-project-mini-actions a.button.aibb-mini-active:hover{
  background:#f6f7f7 !important;
}

.aibb-frontend .aias-ai-shell-docked{z-index:999990;}


/* AAS: make portal links look like buttons (requested) */
.aibb-portal a.aibb-link-btn,
.aibb-portal a.aibb-btn,
.aibb-portal a.button-like{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:8px;
  border:1px solid rgba(0,0,0,0.18);
  background: rgba(229,243,222,0.95);
  text-decoration:none;
  font-weight:700;
  font-size:12px;
  line-height:1;
}
.aibb-portal a.aibb-link-btn:hover,
.aibb-portal a.aibb-btn:hover,
.aibb-portal a.button-like:hover{
  background: rgba(214,237,203,0.95);
}
.aibb-portal a.aibb-link-btn.active,
.aibb-portal a.aibb-btn.active,
.aibb-portal a.button-like.active{
  background:#fff;
  border-color: rgba(127,191,99,0.95);
}


/* -------------------------------------------------------------------------
   Front-end button styling
   WordPress core .button styles are not loaded on the front-end for many themes.
   We provide a lightweight, consistent button look so all "links" can be rendered
   as buttons across the portal.
   ------------------------------------------------------------------------- */
.aibb-wrap a.button,
.aibb-wrap button.button,
.aibb-wrap input.button{
  display:inline-block;
  padding:6px 10px;
  border:1px solid #c3c4c7;
  border-radius:4px;
  background:#f6f7f7;
  color:#1d2327;
  text-decoration:none;
  font-size:13px;
  line-height:1.4;
  cursor:pointer;
}
.aibb-wrap a.button:hover,
.aibb-wrap button.button:hover,
.aibb-wrap input.button:hover{
  background:#f0f0f1;
}

.aibb-wrap a.button.button-small,
.aibb-wrap button.button.button-small,
.aibb-wrap input.button.button-small{
  padding:4px 8px;
  font-size:12px;
}

/* Primary actions should be green (site-wide request) */
.aibb-wrap a.button.button-primary,
.aibb-wrap button.button.button-primary,
.aibb-wrap input.button.button-primary,
.aibb-wrap a.button.aibb-mini-primary{
  background:#4f8a3d;
  border-color:#4f8a3d;
  color:#ffffff;
}
.aibb-wrap a.button.button-primary:hover,
.aibb-wrap button.button.button-primary:hover,
.aibb-wrap input.button.button-primary:hover,
.aibb-wrap a.button.aibb-mini-primary:hover{
  background:#3f7430;
  border-color:#3f7430;
}

/* Secondary portal navigation buttons: light green, active = white */
.aibb-wrap .aias-tab{
  background:#e5f3de !important;
  border-color:#9bb79a !important;
  color:#1d2327 !important;
}
.aibb-wrap .aias-tab.active,
.aibb-wrap .aias-tab:focus{
  background:#ffffff !important;
}

/* Any remaining action links should appear as small grey buttons */
.aibb-wrap .aibb-projects-table a:not(.button),
.aibb-wrap .aibb-actions a:not(.button){
  display:inline-block;
  padding:4px 8px;
  border:1px solid #c3c4c7;
  border-radius:4px;
  background:#f6f7f7;
  color:#1d2327;
  text-decoration:none;
  font-size:12px;
  line-height:1.2;
}
.aibb-wrap .aibb-projects-table a:not(.button):hover,
.aibb-wrap .aibb-actions a:not(.button):hover{background:#f0f0f1;}

/* AIBB template modal */
#aibb-tpl-modal input, #aibb-tpl-modal textarea { box-sizing: border-box; }


/* --- HOTFIX: Darker menu buttons (unselected) --- */
.aibb-nav a,
.aibb-primary-tabs a,
.aias-portal-tabs .aias-tab{
  background: rgba(120,200,110,0.95) !important;
  color: #111 !important;
}
.aibb-nav a.aibb-nav-active,
.aibb-primary-tabs a.active,
.aias-portal-tabs .aias-tab.active{
  background:#fff !important;
  color:#111 !important;
}



/* --- Divi override: ensure nav buttons are green when not active --- */
body.et_divi_theme .aibb-wrap.aibb-frontend .aibb-nav a,
body.et_divi_theme .aibb-wrap.aibb-frontend a.aibb-primary-tab,
body.et_divi_theme .aibb-wrap.aibb-frontend .aias-tab{
  background: rgba(120, 200, 110, 0.92) !important;
  color: #102010 !important;
}
body.et_divi_theme .aibb-wrap.aibb-frontend .aibb-nav a.aibb-nav-active,
body.et_divi_theme .aibb-wrap.aibb-frontend a.aibb-primary-tab.aibb-nav-active,
body.et_divi_theme .aibb-wrap.aibb-frontend .aias-tab.active{
  background: #ffffff !important;
  color: #102010 !important;
  border-color: rgba(127,191,99,0.95) !important;
}



/* === AAS Nav Button Color Overrides (Divi-safe) === */
body .aibb-wrap.aibb-frontend .aibb-nav a,
body .aibb-wrap.aibb-frontend .aibb-primary-tab,
body .aibb-wrap.aibb-frontend a.aibb-primary-tab,
body .aibb-wrap.aibb-frontend .aias-tab{
  background: rgba(120, 200, 110, 0.92) !important;
  color: #0b2a10 !important;
  border-color: rgba(0,0,0,0.18) !important;
}
body .aibb-wrap.aibb-frontend .aibb-nav a.active,
body .aibb-wrap.aibb-frontend .aibb-primary-tab.active,
body .aibb-wrap.aibb-frontend .aias-tab.active{
  background: #ffffff !important;
}


/* Write editor expansion (NOT fullscreen). Widen the editor card area. */
body.aias-editor-expanded .aias-write-wrap,
body.aias-editor-expanded .aibb-wrap.aibb-frontend .aibb-container{
  max-width: none !important;
}
body.aias-editor-expanded .aias-write-wrap > div[style*="max-width:1800px"],
body.aias-editor-expanded .aias-write-wrap > div[style*="max-width: 1100px"]{
  max-width: none !important;
  width: 100% !important;
}
body.aias-editor-expanded #aibb-editor-form{
  max-width: none !important;
}


/* Write editor card width + expand mode */
.aibb-write-card{max-width:1200px;background:#fff;padding:16px;border:1px solid #dcdcde;border-radius:8px;}
body.aibb-editor-expanded .aibb-write-card{max-width:none;width:100%;}
body.aibb-editor-expanded .wp-editor-wrap{max-width:none;}
body.aibb-editor-expanded .wp-editor-container{max-width:none;}
body.aibb-editor-expanded .mce-edit-area iframe{min-height:75vh;}

/* === Editor Focus Mode (Expand icon) ===
   Blank screen with only editor controls; user can shrink back. */
body.aibb-editor-focus{ overflow:hidden !important; }
#aibb-focus-overlay{
  position:fixed;
  inset:0;
  z-index:999999;
  background:#ffffff;
  padding:16px;
  overflow:auto;
}
/* Support both legacy (.aibb-focus-top) and current (.aibb-focus-topbar) class names */
#aibb-focus-overlay .aibb-focus-top,
#aibb-focus-overlay .aibb-focus-topbar{
  position:sticky;
  top:0;
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:8px 0 12px 0;
  background:#ffffff;
  border-bottom:1px solid #dcdcde;
  margin-bottom:12px;
}
#aibb-focus-overlay .aibb-focus-title{font-weight:800;color:#111;}
#aibb-focus-overlay .aibb-focus-close{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:42px;
  height:42px;
  border-radius:8px;
  border:1px solid #c3c4c7;
  background:#f6f7f7;
  cursor:pointer;
  font-size:18px;
  font-weight:900;
}

/* Always-visible close button for Focus Mode */
#aibb-focus-overlay .aibb-focus-close-fixed{
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid #c3c4c7;
  background: #f6f7f7;
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

/* In focus mode, make the writing surface wider (about 1/3 wider than normal) */
body.aibb-editor-focus #aibb-focus-overlay .aibb-write-card{
  max-width: 2000px;
  width: calc(100% - 20px);
  margin-left: auto;
  margin-right: auto;
}

#aibb-focus-overlay .aibb-focus-title{
  font-size:14px;
  font-weight:800;
  color:#111;
  align-self:center;
}
body.aibb-editor-focus #aias-portal-root,
body.aibb-editor-focus .aibb-wrap.aibb-frontend,
body.aibb-editor-focus #page-container,
body.aibb-editor-focus #main-content,
body.aibb-editor-focus .entry-content{
  /* hide the page layout behind the overlay; overlay is the UI */
  filter:none;
}

/* In Focus Mode the editor card should be wider (about 1/3 wider than normal). */
body.aibb-editor-focus #aibb-focus-overlay .aibb-write-card{
  max-width: 2000px;
  width:calc(100% - 20px);
  margin:0 auto;
}

/* === Fullscreen Mode (CSS-only; toggled by window.AIBB_FULLSCREEN) === */
html.aibb-fullscreen,
body.aibb-fullscreen{
  overflow: hidden !important;
}
body.aibb-fullscreen .aibb-write-card{
  position: fixed !important;
  inset: 10px !important;
  z-index: 1000000 !important;
  max-width: none !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  border-radius: 10px !important;
}
body.aibb-fullscreen .aibb-write-card .wp-editor-container iframe{
  min-height: calc(100vh - 220px) !important;
}
/* Remove the big "Close Fullscreen" button (we exit via the same fullscreen toggle or ESC). */
body.aibb-fullscreen .aibb-fullscreen-close,
body.aibb-fullscreen .aibb-close-fullscreen,
body.aibb-fullscreen .aibb-focus-close-fixed{
  display: none !important;
}

/* Leonardo panel: keep all content usable within viewport height */
.aias-ai-panel .aias-ai-shell{
  /* Make the panel ~1/3 taller by reducing reserved header space */
  max-height: calc(100vh - 80px);
  overflow: auto;
}
.aias-ai-panel .aias-ai-accordions{
  overflow: auto;
}
.aias-ai-panel .aias-ai-acc-body{
  max-height: 220px;
  overflow: auto;
}



/* Portal root: neutral wrapper (container frame is .aibb-wrap) */
#aias-portal-root{width:100% !important;max-width:none !important;margin:0 !important;padding:0 !important;box-sizing:border-box !important;display:block !important;}
@media (max-width: 782px){
  #aias-portal-root > .aias-ai-panel{ top: 46px; height: calc(100vh - 46px); }
}

/* Expanded editor should use full portal width */
.aibb-editor-expanded .aibb-frontend{max-width:none;width:calc(100% - 40px); }
.aibb-editor-expanded .aibb-write-card{max-width:none;width:100%;}
.aibb-editor-expanded .wp-editor-wrap{max-width:none;}
.aibb-editor-expanded .wp-editor-container{min-height:72vh;}
.aibb-editor-expanded iframe{min-height:68vh;}

/* TinyMCE expand button styling */
.mce-toolbar .mce-btn button span.mce-txt{font-weight:900;}

/* AI shell scroll within panel */
#aias-portal-root > .aias-ai-panel .aias-ai-shell{ height: 100%; overflow:auto; }


/* Portal main column wrapper created by JS when missing */
#aias-portal-root > .aias-portal-main{ min-width:0; }




/* ------------------------------------------------------------
 * Diagnostics + version badge (admin only button)
 * ------------------------------------------------------------ */
.aibb-app-header-line{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
.aibb-ver-badge{display:inline-block;padding:2px 8px;border:1px solid #dcdcde;border-radius:999px;background:#fff;color:#646970;font-size:12px;font-weight:600;line-height:1.6;}
.aibb-diag-btn{appearance:none;border:1px solid #1d2327;background:#1d2327;color:#fff;border-radius:8px;padding:6px 10px;font-size:12px;font-weight:700;cursor:pointer;}
.aibb-diag-btn:hover{filter:brightness(1.05);}
.aibb-diag-overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);z-index:999999;display:flex;align-items:flex-end;justify-content:flex-end;padding:16px;}
.aibb-diag-card{width:min(680px,92vw);max-height:80vh;overflow:auto;background:#fff;border-radius:14px;border:1px solid #dcdcde;box-shadow:0 10px 30px rgba(0,0,0,.25);}
.aibb-diag-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border-bottom:1px solid #dcdcde;}
.aibb-diag-close{border:1px solid #dcdcde;background:#f6f7f7;border-radius:8px;padding:4px 10px;cursor:pointer;font-size:18px;line-height:1;}
.aibb-diag-pre{margin:0;padding:12px;font-size:12px;line-height:1.35;white-space:pre-wrap;}

/* ------------------------------------------------------------
 * Write page: escape Divi narrow content column safely.
 * Keep portal max-width at 1300px, centered.
 * ------------------------------------------------------------ */
/* Leonardo floating rules live earlier in this file to avoid conflicts with width presets. */


/* Leonardo panel: keep Book context from flowing off-screen */
.aias-ai-panel{max-height: calc(100vh - 90px); overflow-y: auto;}

/* Write: TinyMCE expand button should be a small square with the double-arrow glyph */
/* Expand control is now outside TinyMCE (next to Save), to avoid duplicate buttons. */
.aibb-icon-square{
  width:30px !important;
  height:30px !important;
  padding:0 !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  border-radius:6px !important;
  border:1px solid #c3c4c7 !important;
  background:#f6f7f7 !important;
  cursor:pointer !important;
  font-weight:800 !important;
  line-height:1 !important;
  font-size:16px !important;
}
.aibb-icon-square:hover{ background:#ffffff !important; }

/* Project stats/activity alignment */
.aibb-project-stats-wrap, .aibb-project-activity-wrap{max-width: 1200px;margin:0 auto;}


/* -------------------------------------------------------------------------
   Write: Expand editor (toolbar button)
   ------------------------------------------------------------------------- */
body.aibb-editor-expanded .aibb-editor-breakout,
body.aibb-editor-expanded .aibb-editor-breakout .aibb-wrap{
  max-width: none !important;
  width: calc(100% - 40px) !important;
}
body.aibb-editor-expanded .aibb-editor-breakout .aibb-portal-frame{
  max-width: none !important;
}
/* Give the editor card more room when expanded */
body.aibb-editor-expanded .aibb-editor-breakout .aibb-editor-wrap,
body.aibb-editor-expanded .aibb-editor-breakout .aibb-editor,
body.aibb-editor-expanded .aibb-editor-breakout .mce-tinymce{
  max-width: none !important;
}

/* Leonardo quick actions: simple grid */
.aias-ai-actions-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
.aias-ai-action-btn{width:100%;}
.aias-ai-panel.aias-ai-busy{opacity:0.85;}


/* AAS: when Leonardo panel is open, keep portal content within viewport */
body.aias-ai-open.aibb-page .aibb-wrap.aibb-frontend{
  max-width: min(1200px, calc(100vw - 520px)) !important;
}
body.aias-ai-open.aibb-page .aibb-wrap.aibb-frontend.aibb-editor-expanded{
  max-width: min(1900px, calc(100vw - 520px)) !important;
}

/* AAS: when Editor Tools panel is open, keep portal content within viewport (match Leonardo behavior) */
body.aias-tools-open.aibb-page .aibb-wrap.aibb-frontend{
  max-width: min(1200px, calc(100vw - 520px)) !important;
}
body.aias-tools-open.aibb-page .aibb-wrap.aibb-frontend.aibb-editor-expanded{
  max-width: min(1900px, calc(100vw - 520px)) !important;
}

/* When Editor Tools is open, hide Leonardo's vertical edge tab to reduce clutter/overlap. */
body.aias-tools-open .aias-ai-panel .aias-ai-tab{ display:none !important; }


/* Outlines: keep chapter list/editor aligned with portal frame (Divi-safe) */
/* NOTE: In some themes/builders (e.g., Divi), the Outlines grid can render outside of
   .aibb-wrap. Keep this rule unscoped so the chapters column doesn't hug the left edge. */
.aias-outline-wrap,
.aibb-wrap.aibb-frontend .aias-outline-wrap{
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 14px;
  padding-right: 14px;
  box-sizing: border-box;
}


/* Boxed TinyMCE button for AAS fullscreen/expand */
.mce-container .mce-toolbar .mce-btn.aibb-mce-box{border:1px solid #111;border-radius:4px;box-shadow:none;}
.mce-container .mce-toolbar .mce-btn.aibb-mce-box button{padding:2px 6px;min-width:28px;}

/* Write page: fullscreen toggle next to Save */
.aibb-fullscreen-btn{
  min-width:44px;
  padding-left:10px;
  padding-right:10px;
  font-size:18px;
  line-height:1.2;
}


/* --- AAS Front-end TinyMCE (WP 6.9+/TinyMCE 6) --- */
/* Ensure the "second row" tools are visible for portal users by showing the overflow toolbar. */
.aibb-portal .tox .tox-toolbar__overflow{
  display:flex !important;
  visibility:visible !important;
  height:auto !important;
  opacity:1 !important;
}
.aibb-portal .tox .tox-toolbar__primary{
  flex-wrap:wrap !important;
}

/* AAS: Force TinyMCE toolbar to show full controls (row 2) for portal users */
.aibb-write-editor .tox .tox-toolbar__primary{flex-wrap:wrap!important;}
.aibb-write-editor .tox .tox-toolbar__overflow{display:none!important;}
.aibb-write-editor .tox .tox-toolbar__group{margin-bottom:4px!important;}



/* Admin bar offset so Leonardo panel is not clipped */
body.admin-bar .aias-ai-panel{top:32px;height:calc(100vh - 32px);}
body.admin-bar .aias-ai-shell{top:32px;height:calc(100vh - 18px);} 
body.admin-bar .aias-ai-tab{top:192px;} 

/* When Editor Tools is open, hide Leonardo's vertical edge tab (even if the panel is closed). */
body.aias-tools-open .aias-ai-tab{display:none !important;}


/* =====================================================
   Editor Tools Panel (overlay, like Leonardo)
   ===================================================== */
.aias-tools-panel{position:fixed;top:0;right:0;height:100vh;z-index:99998;pointer-events:none;width:0;}
.aias-tools-panel *{box-sizing:border-box;}
.aias-tools-shell{pointer-events:auto;position:fixed;top:0;right:0;width:420px;max-width:92vw;transform:translateX(100%);transition:transform 0.18s ease;border-left:1px solid rgba(0,0,0,0.12);background:#fff;height:100vh;overflow:auto;padding-bottom:40px;}
.aias-tools-panel.aias-tools-open .aias-tools-shell{transform:translateX(0);} 

/* Vertical edge toggle under Leonardo */
.aias-tools-tab{pointer-events:auto;position:absolute;top:490px;right:0;width:44px;height:160px;border-radius:14px 0 0 14px;border:1px solid #e89b9b;background:#f7c1c1;color:#4a1f1f;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;box-shadow:0 6px 18px rgba(0,0,0,.18);} 
.aias-tools-tab:hover{filter:brightness(0.97);} 
.aias-tools-tab:active{transform:translateY(1px);} 
.aias-tools-tab-text{writing-mode:vertical-rl;transform:rotate(180deg);font-weight:800;letter-spacing:.3px;font-size:13px;}

/* When open, hide the vertical tab and rely on the panel's close (×) control */
.aias-tools-panel.aias-tools-open .aias-tools-tab{ display:none; }

/* Header (fixed so Close (×) is always visible) */
.aias-tools-header{position:fixed;top:0;right:0;width:min(420px,92vw);z-index:99999;display:flex;align-items:flex-start;justify-content:space-between;padding:12px 12px 10px;border-bottom:1px solid rgba(0,0,0,0.08);background:linear-gradient(180deg,#fff, #fff8f8);} 
.aias-tools-title{font-weight:900;font-size:15px;}
.aias-tools-subtitle{margin-top:4px;font-size:12px;opacity:.8;display:flex;align-items:center;gap:6px;}
.aias-tools-close{background:transparent;border:1px solid rgba(0,0,0,0.18);border-radius:8px;width:34px;height:34px;cursor:pointer;font-size:18px;line-height:1;}

/* Tabs: fixed under the fixed header so they never scroll out of view */
.aias-tools-tabs{position:fixed;right:0;top:60px;width:min(420px,92vw);z-index:99998;display:flex;gap:6px;padding:10px 12px;border-bottom:1px solid rgba(0,0,0,0.06);background:#fafafa;}
.aias-tools-tabbtn{flex:1;border:1px solid rgba(0,0,0,0.16);border-radius:12px;background:#fff;padding:6px 8px;font-weight:900;font-size:11px;cursor:pointer;}
.aias-tools-tabbtn.is-active{border-color:#d77a7a;background:#fff0f0;}

/* Panes */
.aias-tools-pane{display:none;}
.aias-tools-pane.is-active{display:block;}

.aias-tools-body{padding:12px;padding-top:92px;}
.aias-tools-empty{padding:10px;border:1px dashed rgba(0,0,0,0.2);border-radius:12px;background:#fff;}

/* WP admin bar compatibility */
body.admin-bar .aias-tools-shell{top:32px;height:calc(100vh - 32px);} 
body.admin-bar .aias-tools-header{top:32px;}
body.admin-bar .aias-tools-tabs{top:92px;}
body.admin-bar .aias-tools-body{padding-top:124px;}
@media (max-width: 782px){body.admin-bar .aias-tools-shell{top:46px;height:calc(100vh - 46px);} }

/* Theme header offset (non-admin-bar). Many sites have a sticky header that overlaps fixed panels.
   We nudge the panel down a bit so the close (×) and tab buttons are never hidden.
   If a site doesn't need it, the extra whitespace is minimal.
*/
/* Default non-admin-bar offset tuned for common theme headers (Divi etc). */
/* Default non-admin-bar offset: keep the panel near the top, but not hidden by sticky theme headers. */
body:not(.admin-bar) .aias-tools-shell{top:28px;height:calc(100vh - 28px);} 
body:not(.admin-bar) .aias-tools-header{top:28px;}
body:not(.admin-bar) .aias-tools-tabs{margin-top:60px;}

/* Projects page: Next step buttons should be green by default, white when active/selected */
.aibb-mini-btn,
.aibb-mini-btn.button,
.aibb-frontend .button.aibb-mini-btn,
.aibb-frontend a.button.aibb-mini-btn{
  background:#63b95a !important;
  background-color:#63b95a !important;
  border-color:#4aa445 !important;
  color:#fff !important;
  font-weight:800 !important;
}
.aibb-mini-btn:hover{filter:brightness(0.98);} 
.aibb-mini-btn.aibb-mini-active{background:#fff !important;color:#234 !important;border-color:#4aa445 !important;}
.aibb-mini-btn.aibb-mini-primary{background:#3e8a34 !important;border-color:#2f6f28 !important;color:#fff !important;}

/* Extra specificity for Divi/Theme overrides (some themes set .button background with !important) */
body .aibb-view-projects .aibb-wrap.aibb-frontend .aias-next-step-actions a.button.aibb-mini-btn,
body .aibb-view-projects .aibb-wrap.aibb-frontend .aias-next-step-actions .button.aibb-mini-btn{
  background:#63b95a !important;
  background-color:#63b95a !important;
  border-color:#4aa445 !important;
  color:#fff !important;
}
body .aibb-view-projects .aibb-wrap.aibb-frontend .aias-next-step-actions a.button.aibb-mini-btn.aibb-mini-active{
  background:#fff !important;
  color:#234 !important;
}
body .aibb-view-projects .aibb-wrap.aibb-frontend .aias-next-step-actions a.button.aibb-mini-btn.aibb-mini-primary{
  background:#3e8a34 !important;
  border-color:#2f6f28 !important;
  color:#fff !important;
}

/* Hide the long "planned features" help block in Leonardo so it can't cover editor controls */
.aibb-view-write .aias-ai-actions-help{display:none !important;}

/* Write page: two-row chapter header (top row: chapter+rename+language, bottom row: actions on the left)
   NOTE: The write view slug is sometimes "editor" (aibb_view=editor). Support BOTH. */
.aibb-view-write .aias-write-chapterbar,
.aibb-view-editor .aias-write-chapterbar{display:flex;flex-direction:column;gap:8px;margin:0 0 12px 0;}
.aibb-view-write .aias-write-chapterbar-top,
.aibb-view-editor .aias-write-chapterbar-top{display:flex;align-items:center;gap:14px;flex-wrap:nowrap;overflow-x:auto;}
.aibb-view-write .aias-write-chapterbar-top > *,
.aibb-view-editor .aias-write-chapterbar-top > *{flex:0 0 auto;}
.aibb-view-write .aias-write-chapterbar-top form,
.aibb-view-editor .aias-write-chapterbar-top form{margin:0;display:flex !important;gap:8px !important;align-items:center !important;flex-wrap:nowrap !important;width:auto !important;}
.aibb-view-write .aias-write-chapterbar-top label,
.aibb-view-editor .aias-write-chapterbar-top label{display:inline-flex !important;align-items:center !important;gap:8px !important;margin:0 !important;white-space:nowrap;}
.aibb-view-write .aias-write-chapterbar-top strong,
.aibb-view-editor .aias-write-chapterbar-top strong{white-space:nowrap;}
.aibb-view-write .aias-write-chapterbar-top input,
.aibb-view-write .aias-write-chapterbar-top select,
.aibb-view-editor .aias-write-chapterbar-top input,
.aibb-view-editor .aias-write-chapterbar-top select{width:auto !important;display:inline-block !important;}
.aibb-view-write .aias-write-chapterbar-actions,
.aibb-view-editor .aias-write-chapterbar-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:flex-start;}
.aibb-view-write .aias-write-chapterbar-top .aibb-chapter-select,
.aibb-view-editor .aias-write-chapterbar-top .aibb-chapter-select{max-width:340px;width:340px;}


/* Main menu button (light red) */
.aias-editor-tools-btn{background:#f7c1c1 !important;border:1px solid #e89b9b !important;color:#4a1f1f !important;border-radius:12px;padding:6px 10px;font-weight:900;cursor:pointer;}
.aias-editor-tools-btn:hover{filter:brightness(0.98);} 

/* Dashboard: useful quick cards above the Projects tables */
/* Use full portal width (no max-width clamp) so cards can render as true 2-column layout. */
/* Dashboard main grid
   Keep 2 columns in typical portal widths; collapse only on small screens.
   IMPORTANT: Right-column items are positioned via classes (not inline styles) so
   we can safely force them back to column 1 when collapsed.
*/
.aibb-dashboard-grid,
.aias-dashboard-grid{display:grid !important;grid-template-columns:1fr 1fr !important;gap:12px;margin:12px 0 16px 0;width:100% !important;max-width:none !important;align-items:start;}
/* Keep 2-column dashboard on typical portal widths; collapse only on genuinely narrow screens */
@media (max-width: 520px){.aibb-dashboard-grid,.aias-dashboard-grid{grid-template-columns:1fr;}}

/* Explicit column placement helpers */
.aibb-dash-col-left{grid-column:1;}
.aibb-dash-col-right{grid-column:2;}
@media (max-width: 520px){
  .aibb-dash-col-left,.aibb-dash-col-right{grid-column:1 / -1;}
}

/* Dashboard: two stacked columns (left = Current Project lane, right = Language lane) */
.aibb-dash-stack{display:flex;flex-direction:column;gap:12px;min-width:0;}
/* Project bar should respect the column width when placed inside the left stack */
.aibb-dash-left .aias-projectbar{max-width:none !important;width:100% !important;}

/* Dashboard Projects row: Saved vs Archived side-by-side */
.aibb-projects-split{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px;align-items:start;}
@media (max-width: 520px){.aibb-projects-split{grid-template-columns:1fr;}}

/* FREE-theme failsafe: some themes/plugins accidentally hide dashboard cards. Force visible. */
body.aibb-page .aias-dash-card,
body.aibb-page .aibb-dash-col-left,
body.aibb-page .aibb-dash-col-right{
  display:block !important;
  visibility:visible !important;
  opacity:1 !important;
}
body.aibb-page .aias-dash-card{display:grid !important;}
body.aibb-page .aias-dash-card[hidden],
body.aibb-page .aibb-dash-col-left[hidden],
body.aibb-page .aibb-dash-col-right[hidden]{
  display:block !important;
}

/* Safety: clear any theme floats so the dashboard grid can take full width. */
.aias-projectbar:after{content:"";display:block;clear:both;}
.aias-dash-card{display:grid;grid-template-columns:1fr auto;gap:14px;align-items:start;background:#fff;border:1px solid #dcdcde;border-radius:12px;padding:12px 14px;}
.aias-dash-title{font-weight:900;font-size:14px;margin:0 0 4px 0;}
.aias-dash-sub{color:#646970;font-size:12px;line-height:1.4;margin:0 0 8px 0;max-width:720px;}
.aias-dash-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end;}
.aias-dash-kv{display:flex;justify-content:space-between;gap:12px;font-size:12px;border-top:1px solid rgba(0,0,0,0.06);padding:6px 0;max-width:420px;}
.aias-dash-kv:first-of-type{border-top:0;padding-top:0;}
.aias-dash-kv span{color:#646970;}
.aias-dash-kv strong{font-weight:900;}
.aias-dash-list{margin:0;padding-left:16px;color:#1d2327;font-size:12px;line-height:1.5;}
.aias-dash-card-right .button{white-space:nowrap;}
@media (max-width: 640px){
  .aias-dash-card{grid-template-columns:1fr;}
  .aias-dash-actions{justify-content:flex-start;}
}

/*
  Dashboard render failsafe (theme conflicts)
  If a theme/plugin applies accidental display/visibility/height clamps, the Dashboard
  HTML can exist in page source but not appear visually. Force key blocks visible.
*/
body.aibb-page .aibb-portal-frame,
body.aibb-page .aias-projectbar,
body.aibb-page .aias-your-projects{
  display:block !important;
  visibility:visible !important;
  opacity:1 !important;
  height:auto !important;
  max-height:none !important;
  overflow:visible !important;
}
/* Keep dashboard grid as grid (not block) even in failsafe mode. */
body.aibb-page .aias-dashboard-grid{
  display:grid !important;
  visibility:visible !important;
  opacity:1 !important;
  height:auto !important;
  max-height:none !important;
  overflow:visible !important;
  grid-template-columns: 1fr 1fr !important;
  gap:12px !important;
}
body.aibb-page .aias-dashboard-grid[hidden],
body.aibb-page .aias-your-projects[hidden]{
  display:block !important;
}

/* Red dot utility */
.aias-dot-red{display:inline-block;width:8px;height:8px;border-radius:99px;background:#d10000;}

/* When Leonardo is open, hide the Editor Tools edge tab to prevent overlap */
body.aias-ai-open .aias-tools-tab{display:none !important;}


/* Editor Tools: ensure tabs/buttons are clickable above Divi overlays */
.aias-tools-panel .aias-tools-tabs,
.aias-tools-panel .aias-tools-tabs button{
  pointer-events:auto !important;
}
.aias-tools-panel .aias-tools-tabs{
  position:relative;
  z-index:50;
}


/* -------------------------------------------------------------------------
 * Hebrew RTL (scoped)
 * - Applies RTL text flow inside the AAS portal only
 * - Does NOT move Leonardo / Editor Tools panels (keeps existing right-anchored layout)
 * ------------------------------------------------------------------------- */
.aibb-wrap.aibb-frontend.aibb-rtl{
  direction: rtl;
  text-align: right;
}
.aibb-wrap.aibb-frontend.aibb-rtl input,
.aibb-wrap.aibb-frontend.aibb-rtl textarea{
  direction: rtl;
  text-align: right;
}
.aibb-wrap.aibb-frontend.aibb-rtl .aibb-nav{
  /* keep nav layout stable; labels will still be translated */
  direction: ltr;
}

/* RTL: ensure the WP editor content flows right-to-left for Hebrew */
.aibb-wrap.aibb-frontend.aibb-rtl .wp-editor-area,
.aibb-wrap.aibb-frontend.aibb-rtl .mce-content-body{
  direction: rtl;
  text-align: right;
}
.aibb-wrap.aibb-frontend.aibb-rtl .aibb-nav a{
  direction: rtl;
}

/* Keep overlay panels anchored and stable */
.aibb-wrap.aibb-frontend.aibb-rtl .aias-ai-panel,
.aibb-wrap.aibb-frontend.aibb-rtl .aias-tools-panel{
  direction: rtl;
  text-align: right;
}

/* TinyMCE editor area (additional safety) */
.aibb-wrap.aibb-frontend.aibb-rtl iframe{
  direction: rtl;
}

/* Write editor toolbar: single line + horizontal scroll (Option A) */
.aibb-wrap .tox .tox-toolbar__primary,
.aibb-wrap .tox .tox-toolbar-overlord,
.aibb-wrap .tox .tox-toolbar__overflow{
  flex-wrap: nowrap !important;
}
.aibb-wrap .tox .tox-toolbar__primary{
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.aibb-wrap .tox .tox-toolbar__primary::-webkit-scrollbar{
  height: 8px;
}


/* Two-column layouts (Dashboard + Projects) */
.aibb-toprow{display:grid;grid-template-columns:1fr 1fr;gap:12px;align-items:start;}
@media (max-width: 980px){.aibb-toprow{grid-template-columns:1fr;}}

.aibb-two-col{display:grid;grid-template-columns:1.1fr .9fr;gap:14px;align-items:start;margin-top:12px;max-width:1300px;}
@media (max-width: 980px){.aibb-two-col{grid-template-columns:1fr;}}
.aibb-col-left,.aibb-col-right{min-width:0;}


/* --- Plan pills + locked UI (PRO / STUDIO) --- */
.aias-pill{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  line-height:1.4;
  vertical-align:middle;
  margin-left:6px;
  border:1px solid rgba(0,0,0,0.15);
  background:#f3f4f6;
}
/* Plan pill colors (consistent across AAS): FREE = grey, PRO = blue, STUDIO = red */
.aias-pill-free{background:#f6f7f7;border-color:#c3c4c7;color:#50575e;}
.aias-pill-pro{background:#e7f0ff;border-color:#72aee6;color:#0a4b78;}
.aias-pill-studio{background:#ffe9e9;border-color:#dc3232;color:#8a2424;}

.aias-lock-wrap.aias-locked{
  position:relative;
  opacity:0.72;
}
.aias-lock-wrap.aias-locked *{
  pointer-events:none;
}
.aias-lock-wrap.aias-locked .aias-pill,
.aias-lock-wrap.aias-locked .aias-locked-title,
.aias-lock-wrap.aias-locked .aias-locked-note{
  pointer-events:auto;
}
.aias-locked-title{
  margin:0 0 8px 0;
  font-weight:700;
  font-size:13px;
  opacity:1;
}
.aias-locked-note{
  margin:0 0 10px 0;
  font-size:12px;
  opacity:1;
}

/* Plan gating (FREE/PRO/STUDIO): grey out controls that aren't available yet */
.aibb-locked-control{
  opacity:0.45 !important;
  filter:grayscale(0.2);
  cursor:not-allowed !important;
}
.aibb-locked-control:focus{outline:none !important;}

/* Inline pill next to controls */
.aibb-inline-pill{margin-left:8px;vertical-align:middle;}


/* Non-Divi themes: make portal slightly wider and left-aligned (requested) */
body.aibb-page.aibb-not-divi .aibb-wrap.aibb-frontend{
  max-width:1150px !important;
  width:calc(100% - 40px) !important;
  /* Keep left-aligned across all views on non-Divi themes */
  margin:18px 0 !important;
}


/* Locked UI helper (show sections but disable actions) */
.aibb-locked{position:relative;opacity:0.65;}
.aibb-locked *{pointer-events:none;}
.aibb-locked:after{content:'';position:absolute;inset:0;border-radius:8px;background:rgba(255,255,255,0.25);}
.aibb-lock-badge{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:700;color:#b32d2e;background:#fff0f0;border:1px solid #f1aeb0;border-radius:999px;padding:4px 10px;}
.aibb-lock-badge:before{content:'🔒';}

/* RTL (Hebrew) portal alignment:
   Goal: RTL and LTR should start from the SAME left edge (same horizontal position).
   Therefore we DO NOT apply any RTL-only horizontal shift here.
   Centering is handled globally by the .aibb-wrap rules (margin: auto). */
body.aibb-page .aibb-wrap.aibb-frontend.aibb-rtl{
  position: relative;
  left: 0 !important;
  right: auto !important;
  /* RTL should not center; keep same left edge as LTR */
  margin: 18px 0 !important;
}

/* Small inline pill (used next to Language selector, etc.) */
.aibb-pill-inline{font-size:10px;line-height:1;padding:3px 7px;border-radius:999px;vertical-align:middle;font-weight:800;}

/* Dashboard layout failsafe: prevent theme wrappers from clipping content */
body.aibb-page .aibb-editor-breakout,
body.aibb-page .aibb-editor-breakout .aibb-wrap,
body.aibb-page .aibb-editor-breakout .aibb-portal-frame{overflow:visible !important;height:auto !important;max-height:none !important;}


/* Publish view: neutralize dashboard grid wrappers */

body.aibb-page.aibb-view-publish .aibb-portal-frame-publish{
  display:block !important;
  position:relative !important;
  width:100% !important;
  margin:0 !important;
  padding:0 !important;
}

body.aibb-page.aibb-view-publish .aibb-dashboard-grid-publish{
  display:block !important;          /* override any grid layout rules */
  grid-template-columns:none !important;
  gap:0 !important;
  width:100% !important;
  margin:0 !important;
  padding:0 !important;
}

body.aibb-page.aibb-view-publish .aibb-dashboard-grid-publish > *{
  max-width:none !important;
}

/* ===== AAS Danger buttons (Delete / destructive actions) ===== */
.aibb-danger-outline,
.aibb-danger-outline.button,
a.aibb-danger-outline.button,
button.aibb-danger-outline.button {
  color: #b42318 !important;
  background: #ffffff !important;
  border: 1px solid #b42318 !important;
}
.aibb-danger-outline:hover,
a.aibb-danger-outline.button:hover,
button.aibb-danger-outline.button:hover {
  color: #b42318 !important;
  background: #fff5f4 !important;
  border-color: #b42318 !important;
}

/* AAS_DELETE_OUTLINE_FORCE */
.aibb-wrap a.button.aibb-danger-outline,
.aibb-wrap a.button[href*="delete_project"]{
  background:#fff !important;
  color:#b32d2e !important;
  border:1px solid #b32d2e !important;
  box-shadow:none !important;
}
.aibb-wrap a.button.aibb-danger-outline:hover,
.aibb-wrap a.button[href*="delete_project"]:hover{
  background:#fff5f5 !important;
  color:#8a1f1f !important;
  border-color:#8a1f1f !important;
}

/* AAS_DELETE_BUTTON_INLINE_STYLE: backup style in case inline is stripped */
.aibb-wrap a.button[href*="delete_project"],
.aibb-wrap a.button[href*="aibb_action=delete_project"]{
  background:#fff !important;
  color:#b32d2e !important;
  border:1px solid #b32d2e !important;
}

/* AAS_STORAGE_FREE_LOCK_VISUAL */
.aibb-card-storage.aibb-locked,
.aibb-storage-locked{
  opacity:.6 !important;
}

/* AAS_DELETE_FORCE_ALL_STATES */
.aibb-wrap a.button[href*="aibb_delete_project"],
.aibb-wrap a.button[href*="delete_project"]{
  background:#fff !important;
  color:#b32d2e !important;
  border:1px solid #b32d2e !important;
}
.aibb-wrap a.button[href*="aibb_delete_project"]:hover,
.aibb-wrap a.button[href*="delete_project"]:hover{
  background:#fff5f5 !important;
  color:#8a1f1f !important;
  border-color:#8a1f1f !important;
}


/* Dashboard layout hardening (moved from inline <style> to avoid kses/plaintext issues) */
.aibb-portal-frame[data-aibb-dashboard-rendered="1"]{overflow:visible!important;height:auto!important;max-height:none!important;}
.aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aibb-dashboard-grid.aias-dashboard-grid{display:grid!important;grid-template-columns:1fr 1fr!important;gap:14px!important;align-items:start!important;width:100%!important;max-width:100%!important;}
.aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aibb-toprow-left{grid-column:1!important;}
.aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aibb-toprow-right{grid-column:2!important;}
.aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aibb-dash-col-left{grid-column:1!important;}
.aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aibb-dash-col-right{grid-column:2!important;}
.aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aias-dash-card{display:grid!important;visibility:visible!important;opacity:1!important;}
.aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aibb-projects-split{display:grid!important;grid-template-columns:1fr 1fr!important;gap:14px!important;}
@media (max-width: 640px){
  .aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aibb-dashboard-grid.aias-dashboard-grid{grid-template-columns:1fr!important;}
  .aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aibb-toprow-left,
  .aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aibb-toprow-right,
  .aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aibb-dash-col-left,
  .aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aibb-dash-col-right{grid-column:1!important;}
  .aibb-portal-frame[data-aibb-dashboard-rendered="1"] .aibb-projects-split{grid-template-columns:1fr!important;}
}



/* Ensure delete buttons are red even when WP core button styles load later */
.aibb-portal-frame .button.aibb-danger-outline,
.aibb-portal-frame a.button.aibb-danger-outline{
  border-color:#b32d2e!important;
  color:#b32d2e!important;
  background:#ffffff!important;
}


/* AAS delete buttons (dashboard/projects) - high specificity */
.aibb-wrap .aibb-btn-delete,
.aibb-portal-frame .aibb-btn-delete,
.aibb-wrap .button.aibb-btn-delete,
.aibb-portal-frame .button.aibb-btn-delete,
.aibb-wrap button.aibb-btn-delete,
.aibb-portal-frame button.aibb-btn-delete,
.aibb-wrap a.aibb-btn-delete,
.aibb-portal-frame a.aibb-btn-delete,
.aibb-wrap a.button.aibb-btn-delete,
.aibb-portal-frame a.button.aibb-btn-delete,
.aibb-wrap .aibb-delete,
.aibb-wrap button.aibb-delete,
.aibb-wrap a.aibb-delete,
.aibb-wrap .aibb-btn-danger,
.aibb-wrap button.aibb-btn-danger,
.aibb-wrap a.aibb-btn-danger {
  color: #b32d2e !important;
  background: #ffffff !important;
  border: 1px solid #b32d2e !important;
  border-radius: 10px !important;
}
.aibb-wrap .aibb-btn-delete:hover,
.aibb-portal-frame .aibb-btn-delete:hover,
.aibb-wrap .button.aibb-btn-delete:hover,
.aibb-portal-frame .button.aibb-btn-delete:hover,
.aibb-wrap button.aibb-btn-delete:hover,
.aibb-wrap a.aibb-btn-delete:hover,
.aibb-wrap a.button.aibb-btn-delete:hover,
.aibb-wrap .aibb-delete:hover,
.aibb-wrap button.aibb-delete:hover,
.aibb-wrap a.aibb-delete:hover,
.aibb-wrap .aibb-btn-danger:hover,
.aibb-wrap button.aibb-btn-danger:hover,
.aibb-wrap a.aibb-btn-danger:hover {
  filter: brightness(0.98);
}

/* Keep focus state readable, but allow hover to invert (red background). */
.aibb-wrap .aibb-btn-delete:focus,
.aibb-wrap .button.aibb-btn-delete:focus,
.aibb-wrap button.aibb-btn-delete:focus,
.aibb-wrap a.aibb-btn-delete:focus,
.aibb-wrap a.button.aibb-btn-delete:focus{
  outline: 2px solid rgba(211,45,46,0.35) !important;
  outline-offset: 2px !important;
}

/* === AAS: Inline Delete Buttons (Saved/Archived Projects) ===
   Force default state to match requested style: red text, white background, red border.
   Hover keeps stronger red background.
*/
.aibb-wrap a.aibb-btn-delete,
.aibb-wrap .aibb-btn-delete,
.aibb-portal-frame a.aibb-btn-delete,
.aibb-portal-frame .aibb-btn-delete,
.aibb-wrap a.button.aibb-btn-delete,
.aibb-wrap a.button.aibb-danger-outlined,
.aibb-wrap a.button[href*="aibb_delete_project"],
.aibb-wrap a.button[href*="aibb_delete_project"]:visited {
  background: #fff !important;
  color: #d32d2e !important;
  border: 1px solid #d32d2e !important;
  display: inline-block !important;
  padding: 6px 12px !important;
  line-height: 1.2 !important;
  text-decoration: none !important;
  font-weight: 600 !important;
}
.aibb-wrap a.aibb-btn-delete:hover,
.aibb-wrap .aibb-btn-delete:hover,
.aibb-portal-frame a.aibb-btn-delete:hover,
.aibb-wrap a.button.aibb-btn-delete:hover,
.aibb-wrap a.button.aibb-danger-outlined:hover,
.aibb-wrap a.button[href*="aibb_delete_project"]:hover {
  background: #d32d2e !important;
  color: #fff !important;
  border-color: #d32d2e !important;
}


/* AAS: Constrain warning emoji (prevents huge ⚠ icon on some non-English/RTL pages) */
.aibb-wrap .aibb-warning-emoji{display:inline-block;line-height:1;font-size:16px;vertical-align:middle;}
.aibb-wrap .aibb-warning-emoji img.emoji, .aibb-wrap img.emoji{width:16px !important;height:16px !important;}

/* AAS: Organize components/settings compact spacing */
.aibb-wrap .aias-comp-settings{padding:8px 10px !important;margin:6px 0 !important;}
.aibb-wrap .aias-comp-settings-note{font-size:12px !important;line-height:1.3 !important;margin-bottom:6px !important;}
.aibb-wrap .aias-comp-settings textarea{min-height:90px;}


/* AAS: Organize component tiles - compact vertical spacing (temporary) */
body.aibb-page .aibb-wrap .aias-comp-card,
body.aibb-page .aibb-wrap .aias-comp-item{
    padding:8px !important;
    margin:0 0 8px 0 !important;
}
body.aibb-page .aibb-wrap .aias-comp-title{margin:0 0 4px 0 !important;}
body.aibb-page .aibb-wrap .aias-comp-desc{margin:0 0 6px 0 !important;}
body.aibb-page .aibb-wrap .aias-comp-buttons{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px !important;}



/* Publish: keep Formatting + Included Sections side-by-side; allow wrap on narrow screens */
.aibb-publish-row2{flex-wrap:nowrap !important;}
.aibb-publish-row2 .aibb-publish-col{min-width:0 !important;}
@media (max-width: 980px){
  .aibb-publish-row2{flex-wrap:wrap !important;}
}

/* Dashboard quick stats pills (Last Edited Project / Projects) */
.aias-pb-pill{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid #dcdcde;
  background:#fff;
  font-size:12px;
  line-height:1.4;
  color:#1d2327;
  margin:0 6px 6px 0;
}
.aias-pb-pill strong{ font-weight:700; margin-right:4px; }


/* Wizard anchor helpers */
*[id^="aas-"]{scroll-margin-top:90px;}
.aibb-hash-highlight{box-shadow:0 0 0 3px rgba(76,175,80,.65);border-radius:10px;}
