.aib-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  background: var(--bg);
}
.aib-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.aib-header h2 { font-size: 16px; font-weight: 700; margin: 0; }
.aib-header .aib-beta {
  background: #fef3c7; color: #92400e;
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.aib-back {
  background: none; border: none; cursor: pointer;
  font-size: 13px; color: var(--accent); font-weight: 600;
}
.aib-stages {
  display: flex; gap: 8px; margin-left: auto; align-items: center;
  font-size: 11.5px; color: var(--text-secondary);
}
.aib-stage { padding: 4px 10px; border-radius: 12px; background: #f3f4f6; }
.aib-stage.active { background: var(--accent); color: #fff; font-weight: 600; }
.aib-stage.done { background: #d1fae5; color: #065f46; }

.aib-body {
  display: grid;
  grid-template-columns: 380px 1fr;
  overflow: hidden;
  height: 100%;
}

/* CHAT PANEL */
.aib-chat {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: #fff;
  min-height: 0;
}
.aib-chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.aib-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.aib-msg.assistant { background: #f3f4f6; color: #111; align-self: flex-start; border-bottom-left-radius: 4px; }
.aib-msg.user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.aib-msg.thinking { background: #f3f4f6; color: #6b7280; font-style: italic; align-self: flex-start; }

.aib-chat-input {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex; gap: 8px;
  background: #fafafa;
}
.aib-chat-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  min-height: 76px;
  max-height: 200px;
  outline: none;
}
.aib-chat-input textarea:focus { border-color: var(--accent); }
.aib-chat-actions {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  display: flex; gap: 8px;
  background: #fff;
}
.aib-chat-actions button { font-size: 12px; }

/* RIGHT PANEL */
.aib-right {
  display: flex; flex-direction: column;
  background: #f9fafb;
  min-height: 0;
}
.aib-tabs {
  display: flex; gap: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}
.aib-tab {
  padding: 12px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  background: none; border-left: none; border-right: none; border-top: none;
}
.aib-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.aib-tab:hover:not(.active) { color: #111; }

.aib-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 0;
}

/* PREVIEW */
.aib-preview-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.aib-toggle-group { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.aib-toggle-group button {
  background: #fff; border: none; padding: 5px 12px; cursor: pointer; font-size: 12px;
}
.aib-toggle-group button.active { background: var(--accent); color: #fff; }
.aib-pers-pills { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; }
.aib-pers-group { display: inline-flex; align-items: center; gap: 4px; }
.aib-pers-group strong { font-weight: 600; color: #555; margin-right: 4px; }
.aib-pers-pill {
  padding: 3px 9px; border-radius: 12px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 11.5px;
}
.aib-pers-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.aib-preview-stage {
  flex: 1; overflow: auto;
  background: #e8e8e8;
  padding: 24px;
  display: flex; justify-content: center; align-items: flex-start;
}
.aib-preview-stage iframe {
  background: #fff; border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  width: 600px; max-width: 100%;
  height: calc(100vh - 200px);
}
.aib-preview-stage iframe.mobile { width: 320px; }

/* CONTENT/STYLE TABS */
.aib-empty { color: var(--text-secondary); font-size: 13px; padding: 32px 0; text-align: center; }
.aib-section-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.aib-section-card h4 { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: #111; }
.aib-field {
  margin-bottom: 10px;
}
.aib-field label {
  display: block; font-size: 11.5px; font-weight: 600; color: #555; margin-bottom: 4px;
}
.aib-field input[type=text],
.aib-field input[type=url],
.aib-field input[type=color],
.aib-field textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.aib-field input[type=color] { padding: 2px; height: 32px; cursor: pointer; }
.aib-field textarea { min-height: 70px; resize: vertical; }

.aib-pers-accordion { margin-top: 6px; border: 1px dashed var(--border); border-radius: 6px; padding: 8px 10px; background: #f9fafb; }
.aib-pers-accordion summary { font-size: 11.5px; cursor: pointer; color: #555; font-weight: 600; }
.aib-pers-accordion .aib-variant { margin-top: 6px; }
.aib-pers-accordion .aib-variant label { font-size: 11px; }

.aib-style-section { margin-bottom: 16px; }
.aib-style-section h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.aib-style-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; font-size: 13px; }
.aib-style-row label { flex: 1; color: #444; }
.aib-style-row input[type=color] { width: 40px; height: 28px; padding: 2px; cursor: pointer; border: 1px solid var(--border); border-radius: 4px; }

/* SETTINGS / PERSONALIZATION */
.aib-settings-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 14px; }
.aib-settings-card h4 { margin: 0 0 4px; font-size: 14px; }
.aib-settings-card p.muted { font-size: 12px; color: var(--text-secondary); margin: 0 0 12px; }
.aib-dim-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.aib-dim-row:first-of-type { border-top: none; }
.aib-dim-row input[type=checkbox] { width: 16px; height: 16px; }
.aib-dim-chips { margin-left: 26px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.aib-chip { padding: 3px 9px; border-radius: 12px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 11.5px; }
.aib-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* MODAL CHOICE CARDS */
.aib-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.aib-choice-card {
  border: 2px solid var(--border); border-radius: 10px; padding: 14px;
  cursor: pointer; transition: border-color 0.15s, transform 0.15s;
  background: #fff;
}
.aib-choice-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.aib-choice-card.selected { border-color: var(--accent); background: #eff6ff; }
.aib-choice-card h4 { margin: 0 0 4px; font-size: 14px; }
.aib-choice-card p { margin: 0; font-size: 12px; color: var(--text-secondary); }
.aib-choice-card .aib-choice-icon { font-size: 22px; margin-bottom: 6px; }

.aib-logo-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.aib-logo-card { border: 1px solid var(--border); border-radius: 8px; padding: 14px 10px; text-align: center; }
.aib-logo-card img { background: transparent; }
.aib-logo-label { margin-top: 8px; font-size: 11px; font-weight: 600; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.aib-logo-card[style*="#FFFFFF"] .aib-logo-label,
.aib-logo-card[style*="#ffffff"] .aib-logo-label { color: #333; text-shadow: none; }
.aib-logo-actions { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
