
/* ── 1. CSS Variables ─────────────────────── */
:root {
  --brick:         #b22222;
  --coral:         #ff7f50;
  --coral-light:   #ff9a7a;
  --off-white:     #f8f5f3;
  --charcoal:      #333333;
  --border-coral:  #ffd7c2;
  --gray-light:    #f2f2f2;
  --gray-border:   #e2e2e2;
  --gray-mid:      #bfbfbf;
  --gray-text:     #666666;
  --radius:        6px;
  --font:          "Segoe UI", system-ui, Arial, sans-serif;
  --white:#ffffff;
  --bg:#f7f8fb;
  --border:#e5e7eb;
  --text:#111827;
  --muted:#6b7280;
  --accent:#2563eb;
  --accent-soft:#dbeafe;
  --shadow:0 8px 22px rgba(0,0,0,0.06);

}


/* ── 2. Base / Reset ──────────────────────── */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--off-white);
}


/* ── 3. Login Page ────────────────────────── */
body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: #ffffff;
}

.login-container {
  width: 380px;
  padding: 32px;
  border-radius: 26px;
  border: 1px solid var(--gray-border);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
  text-align: center;
}

.logo-box {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.logo-box img {
  width: 42px;
  height: 42px;
}

.title {
  font-size: 22px;
  font-weight: 700;
  color: var(--charcoal);
}

.subtitle {
  font-size: 13px;
  color: var(--gray-text);
  margin-bottom: 28px;
}

.input-field {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--gray-border);
  font-size: 14px;
  margin-bottom: 14px;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--brick);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

.footer-text {
  margin-top: 18px;
  font-size: 12px;
  color: var(--gray-text);
}


/* ── 4. Top Banner ────────────────────────── */
.top-banner {
  width: 100%;
  background: linear-gradient(90deg, var(--brick), var(--coral-light));
  color: white;
  padding: 14px 28px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.4px;
}


/* ── 5. Main Layout ───────────────────────── */
.layout {
  display: flex;
  width: 100%;
  height: calc(100vh - 48px);
  overflow: hidden;
}


/* ── 6. Left Nav ──────────────────────────── */
.left-nav {
  width: 72px;
  background: #ffffff;
  border-right: 1px solid var(--border-coral);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.nav-logo {
  width: 40px;
  height: 40px;
  background: var(--brick);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 12px;
  cursor: pointer;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.nav-code {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--off-white);
  border: 1px solid var(--border-coral);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--brick);
}

.nav-label-text {
  margin-top: 4px;
  font-size: 10px;
  color: var(--charcoal);
  text-align: center;
}


/* ── 7. Workspace (shared) ────────────────── */
.workspace {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  transition: width 0.2s ease;
  display: flex;
  flex-direction: column;
}

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

.workspace-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.workspace-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.workspace-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--charcoal);
}

.workspace-subtitle {
  font-size: 12px;
  color: var(--gray-mid);
}

.icon-button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--gray-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  cursor: pointer;
  font-size: 14px;
  color: var(--charcoal);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brick);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--charcoal);
  margin: 16px 0 8px;
}


/* ── 8. Workspace1 — Nav Buttons & Cards ──── */
.nav-buttons {
  display: flex;
  gap: 10px;
  margin: 10px 0 18px;
  flex-wrap: wrap;
}

.nav-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-coral);
  background: #ffffff;
  font-size: 12px;
  cursor: pointer;
  color: var(--charcoal);
  transition: 0.2s;
}

.nav-btn:hover {
  background: #fff3ee;
  border-color: var(--brick);
  color: var(--brick);
}

.nav-btn.active {
  background: var(--brick);
  color: white;
  border-color: var(--brick);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

.app-card {
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--border-coral);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--charcoal);
}

.app-type {
  font-size: 11px;
  color: var(--gray-mid);
  text-transform: uppercase;
}

.app-desc {
  font-size: 12px;
  color: var(--charcoal);
  line-height: 1.4;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.app-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff3ee;
  color: var(--brick);
  border: 1px solid var(--border-coral);
}

.app-button {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
}

.app-button.primary {
  background: var(--brick);
  color: #ffffff;
}

.app-button.secondary {
  background: #ffffff;
  color: var(--brick);
  border: 1px solid var(--brick);
}

.build-card {
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px dashed var(--border-coral);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--gray-mid);
  cursor: pointer;
  padding: 20px;
  min-height: 80px;
}


/* ── 9. Workspace2 — Tabs, Summary, Table ─── */
.app-tabs {
  display: flex;
  gap: 10px;
  margin: 10px 0 20px;
  flex-wrap: wrap;
}

.app-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-coral);
  background: #ffffff;
  font-size: 12px;
  cursor: pointer;
  color: var(--charcoal);
  transition: 0.2s;
}

.app-tab:hover {
  background: #fff3ee;
  border-color: var(--brick);
  color: var(--brick);
}

.app-tab.active {
  background: var(--brick);
  color: white;
  border-color: var(--brick);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--border-coral);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-title {
  font-size: 12px;
  color: var(--gray-mid);
}

.summary-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--brick);
}

.table-wrapper {
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--border-coral);
  overflow: hidden;
  margin-bottom: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: var(--off-white);
  border-bottom: 2px solid var(--border-coral);
}

th {
  padding: 10px;
  text-align: left;
  color: var(--brick);
  font-weight: 600;
  border-bottom: 1px solid var(--border-coral);
}

td {
  padding: 10px;
  border-bottom: 1px solid var(--border-coral);
}

tbody tr:hover {
  background: #fff3ee;
}


/* ── 10. Agent Panel ──────────────────────── */
.agent-panel {
  width: 25%;
  min-width: 180px;
  background: #ffffff;
  border-left: 1px solid var(--border-coral);
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: width 0.2s ease;
  flex-shrink: 0;
}

.agent-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--brick);
  margin-bottom: 12px;
}

.agent-desc {
  font-size: 13px;
  margin-bottom: 16px;
  color: var(--charcoal);
  line-height: 1.4;
}

.agent-input {
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-mid);
  margin-bottom: 12px;
  font-size: 14px;
  width: 100%;
}

.agent-send {
  padding: 10px 16px;
  background: var(--brick);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  width: 120px;
  font-size: 14px;
}


/* ── 11. Draggable Divider ────────────────── */
.divider {
  width: 4px;
  background: var(--brick);
  cursor: col-resize;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.divider:hover {
  background: var(--coral);
}

/* App builder */

/* ── PAGE WRAPPER ── */
/* Must be flex column so step panels can stretch to fill remaining height */
.page-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;        /* no padding here — each step handles its own */
  height: calc(100vh - 48px); /* 48px = top-banner height; adjust if banner changes */
  box-sizing: border-box;
}

/* ── STEP PANELS ── */
.step-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}
.step-panel.active { display: flex; }


/* ═══════════════════════════════════════════════
   STEP 1 & 2  –  Form layout
   ═══════════════════════════════════════════════ */

.form-wrap {
  flex: 1;
  padding: 24px 16px;
  overflow-y: auto;
  display: flex;
  justify-content: center;
}

.form-card {
  background: #fff;
  border-radius: 10px;
  padding: 24px 28px 20px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  align-self: flex-start;
}

.step-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 16px;
}

.field-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 6px;
  display: block;
}

.field-input,
.field-textarea,
.field-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #dde1e9;
  border-radius: 5px;
  font-size: 14px;
  font-family: var(--font, inherit);
  color: var(--charcoal, #1a1a1a);
  background: #fff;
  outline: none;
  box-sizing: border-box;
}
.field-input:focus,
.field-textarea:focus,
.field-select:focus { border-color: #7b9cda; }

.field-textarea {
  resize: vertical;
  min-height: 90px;
}

.field-group { margin-bottom: 18px; }

.field-row { display: flex; gap: 20px; }
.field-row .field-group { flex: 1; }

.divider {
  border: none;
  border-top: 1px solid #eee;
  margin: 0 0 18px;
}

/* Navigation buttons */
.btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.btn {
  padding: 7px 22px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font, inherit);
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}
.btn-next { background: #4a6fd4; color: white; }
.btn-next:hover { opacity: 0.88; }
.btn-back { background: transparent; color: #555; border: 1px solid #ccc; }
.btn-back:hover { background: #f0f0f0; }

/* Make panel3 fill viewport height properly */
#panel3 { height: 100%; display: none; flex-direction: column; }
#panel3.active { display: flex; }

.builder-outer {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e5e5;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  flex: 1;          /* fill #panel3 height */
  min-height: 0;    /* allow shrinking in flex context */
}
.builder-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.builder-topbar-left { display: flex; align-items: center; gap: 10px; }
.builder-topbar-title { font-size: 15px; font-weight: 600; color: #1a1a1a; }
.step3-badge {
  font-size: 11px; padding: 2px 8px;
  background: #ffeaea; border-radius: 10px;
  color: #b22222; border: 1px solid #ffd0d0; font-weight: 500;
}
.topbar-btns { display: flex; gap: 8px; }
.topbar-btn {
  padding: 5px 13px; font-size: 12px;
  border-radius: 6px; border: 1px solid #ddd;
  cursor: pointer; font-family: inherit;
  background: #fff; color: #333; font-weight: 500;
}
.topbar-btn:hover { background: #f5f5f5; }
.topbar-btn-primary { background: #b22222; color: #fff; border-color: #b22222; }
.topbar-btn-primary:hover { background: #9a1c1c; }

/* KEY FIX: builder-main must fill remaining height of builder-outer */
.builder-main {
  display: flex;
  flex: 1;
  min-height: 0;   /* critical — without this flex children ignore overflow */
  overflow: hidden;
}

/* Palette */
.s3-palette {
  width: 172px; border-right: 1px solid #eee;
  background: #fafafa; display: flex;
  flex-direction: column; overflow-y: auto; flex-shrink: 0;
  min-height: 0;
}
.s3-palette-head {
  padding: 10px 12px 6px; font-size: 11px;
  font-weight: 700; color: #888; letter-spacing: .5px;
  border-bottom: 1px solid #eee;
}
.s3-palette-section {
  padding: 10px 12px 4px; font-size: 10px;
  font-weight: 700; color: #aaa; letter-spacing: .6px; text-transform: uppercase;
}
.s3-pitem {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 8px; padding: 7px 10px;
  border-radius: 6px; border: 1px solid #e8e8e8;
  cursor: grab; background: #fff;
  font-size: 12px; font-weight: 500; user-select: none; color: #333;
}
.s3-pitem:hover { background: #fff5f5; border-color: #ffd0d0; }
.s3-pitem:active { cursor: grabbing; }
.s3-picon {
  width: 24px; height: 24px; display: flex; align-items: center;
  justify-content: center; border-radius: 4px; font-size: 13px;
  flex-shrink: 0; font-weight: 700;
}
.pi-label { background: #e8f4fd; color: #1a6fa8; }
.pi-text  { background: #e8f5ee; color: #1a7a45; }
.pi-table { background: #eeecfd; color: #5344b5; }
.pi-graph { background: #fef3e2; color: #b05e0a; }
.pi-image { background: #fce9e7; color: #a83020; }
.pi-btn   { background: #eaf5e2; color: #3a6e12; }

/* Canvas */
.s3-canvas-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.s3-canvas-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; background: #fff; border-bottom: 1px solid #eee;
}
.s3-ct-label { font-size: 11px; font-weight: 700; color: #aaa; letter-spacing: .5px; }
.s3-ct-meta  { font-size: 11px; color: #bbb; }
.s3-canvas-body {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; background: #f9f9f9;
}
.s3-canvas-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; color: #ccc; font-size: 13px; gap: 10px;
}
.s3-status-bar {
  padding: 5px 14px; font-size: 11px; color: #bbb;
  background: #fff; border-top: 1px solid #eee;
  display: flex; align-items: center; gap: 14px;
}
.s3-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #2e9e5b; display: inline-block; margin-right: 5px;
}

/* Layout row */
.s3-lrow { background: #fff; border: 1px solid #e5e5e5; border-radius: 8px; overflow: hidden; }
.s3-lrow-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: #fafafa; border-bottom: 1px solid #eee;
}
.s3-lrow-label { font-size: 11px; font-weight: 600; color: #999; }
.s3-lrow-controls { display: flex; align-items: center; gap: 6px; }
.s3-col-sel {
  font-size: 11px; padding: 2px 6px;
  border: 1px solid #ddd; border-radius: 4px;
  background: #fff; color: #333; font-family: inherit;
}
.s3-del-row {
  font-size: 11px; padding: 2px 8px;
  border: 1px solid #eee; border-radius: 4px;
  background: #fff; color: #999; cursor: pointer;
}
.s3-del-row:hover { border-color: #e24b4a; color: #e24b4a; background: #fff5f5; }
.s3-cols-wrap { display: flex; }
.s3-col-drop {
  flex: 1; min-height: 70px; padding: 6px;
  border-right: 1px dashed #eee;
  display: flex; flex-direction: column; gap: 5px;
}
.s3-col-drop:last-child { border-right: none; }
.s3-col-drop.over { background: rgba(178,34,34,.04); }
.s3-drop-hint {
  height: 54px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #ccc; border: 1px dashed #ddd; border-radius: 6px;
}

/* Component card */
.s3-cmp {
  position: relative; border: 1px solid #e5e5e5;
  border-radius: 6px; padding: 7px 26px 7px 8px;
  background: #fff; cursor: pointer; font-size: 12px; min-height: 36px;
}
.s3-cmp:hover { border-color: #ddd; }
.s3-cmp.sel { border-color: #b22222; border-width: 1.5px; background: #fff9f9; }
.s3-cmp-badge {
  display: inline-block; font-size: 10px; padding: 1px 6px;
  border-radius: 3px; font-weight: 600; margin-bottom: 3px;
}
.s3-badge-label { background: #e8f4fd; color: #1a6fa8; }
.s3-badge-text  { background: #e8f5ee; color: #1a7a45; }
.s3-badge-table { background: #eeecfd; color: #5344b5; }
.s3-badge-graph { background: #fef3e2; color: #b05e0a; }
.s3-badge-image { background: #fce9e7; color: #a83020; }
.s3-badge-btn   { background: #eaf5e2; color: #3a6e12; }
.s3-cmp-name { font-weight: 600; color: #222; font-size: 12px; }
.s3-cmp-del {
  position: absolute; top: 4px; right: 4px;
  background: none; border: none; cursor: pointer;
  font-size: 15px; line-height: 1; color: #ccc; padding: 1px 3px;
}
.s3-cmp-del:hover { color: #e24b4a; }
.s3-cmp-preview { margin-top: 5px; }
.s3-prev-input {
  width: 100%; padding: 3px 6px; border: 1px solid #ddd;
  border-radius: 4px; font-size: 11px; background: #fafafa; color: #999;
}
.s3-prev-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.s3-prev-table td, .s3-prev-table th { border: 1px solid #eee; padding: 2px 5px; }
.s3-prev-table th { background: #f5f5f5; font-weight: 600; }
.s3-prev-chart {
  height: 40px; background: #f8f8f8; border-radius: 4px;
  display: flex; align-items: flex-end; padding: 4px 6px; gap: 3px;
}
.s3-bar { background: #b22222; border-radius: 2px 2px 0 0; flex: 1; opacity: .75; }
.s3-prev-btn {
  display: inline-block; padding: 4px 10px;
  border-radius: 4px; border: 1px solid #ddd;
  font-size: 11px; background: #f5f5f5; color: #444;
}
.s3-prev-img {
  height: 32px; background: #f5f5f5; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #bbb; border: 1px dashed #ddd;
}

/* Properties panel */
.s3-editor {
  width: 200px; border-left: 1px solid #eee;
  background: #fff; display: flex; flex-direction: column;
  overflow: hidden; flex-shrink: 0; min-height: 0;
}
.s3-editor-head {
  padding: 10px 12px 8px; font-size: 11px; font-weight: 700;
  color: #aaa; letter-spacing: .5px; border-bottom: 1px solid #eee;
}
.s3-editor-body {
  padding: 10px 12px; display: flex;
  flex-direction: column; gap: 10px; overflow-y: auto;
}
.s3-efield { display: flex; flex-direction: column; gap: 4px; }
.s3-efield label { font-size: 11px; color: #888; font-weight: 600; }
.s3-efield input, .s3-efield select {
  padding: 5px 8px; font-size: 12px;
  border: 1px solid #ddd; border-radius: 5px;
  font-family: inherit; background: #fff; color: #1a1a1a;
}
.s3-efield input:focus, .s3-efield select:focus { outline: none; border-color: #b22222; }
.s3-apply-btn {
  padding: 6px 12px; background: #fff; border: 1px solid #ddd;
  border-radius: 6px; font-size: 12px; font-weight: 500;
  cursor: pointer; font-family: inherit; color: #333;
}
.s3-apply-btn:hover { background: #f5f5f5; }
.s3-apply-btn-primary { background: #b22222; color: #fff; border-color: #b22222; }
.s3-apply-btn-primary:hover { background: #9a1c1c; }
.s3-editor-empty { padding: 16px 12px; font-size: 12px; color: #bbb; text-align: center; line-height: 1.5; }

/* Export modal */
.s3-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 1000;
  align-items: center; justify-content: center;
}
.s3-modal-overlay.open { display: flex; }
.s3-modal {
  background: #fff; border-radius: 10px; border: 1px solid #ddd;
  width: 460px; max-height: 80vh; display: flex;
  flex-direction: column; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
}
.s3-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #eee;
}
.s3-modal-title { font-size: 15px; font-weight: 600; }
.s3-modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #999; line-height: 1; }
.s3-modal-close:hover { color: #333; }
.s3-modal-body { flex: 1; overflow-y: auto; padding: 14px 18px; }
.s3-modal-body pre {
  font-size: 11px; font-family: monospace; background: #f5f5f5;
  padding: 12px 14px; border-radius: 6px; border: 1px solid #e5e5e5;
  white-space: pre-wrap; word-break: break-all; color: #222;
}
.s3-modal-foot {
  padding: 10px 18px; border-top: 1px solid #eee;
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ══════════════════════════════════════════════
   AgentUSE — Chat Bubble Styles
   Add this block to your existing style.css
   ══════════════════════════════════════════════ */

/* ── Message rows ── */
.agent-msg-user {
  align-self: flex-end;
  background: #b22222;
  color: #fff;
  padding: 7px 13px;
  border-radius: 14px 14px 3px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  max-width: 78%;
}

.agent-msg-agent {
  align-self: flex-start;
  max-width: 92%;
}

/* ── Plain text bubble ── */
.agent-plain-bubble {
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-radius: 3px 12px 12px 12px;
  padding: 9px 13px;
  font-size: 12.5px;
  line-height: 1.65;
  color: #333333;
}

.agent-plain-bubble .agent-ol,
.agent-plain-bubble .agent-ul {
  margin: 6px 0 6px 16px;
  padding: 0;
}

.agent-plain-bubble .agent-ol li,
.agent-plain-bubble .agent-ul li {
  margin-bottom: 4px;
  line-height: 1.5;
}

.agent-plain-bubble .agent-hr {
  border: none;
  border-top: 1px solid #e2e2e2;
  margin: 8px 0;
}

/* ── Typing indicator ── */
.agent-typing {
  font-size: 18px;
  letter-spacing: 3px;
  color: #b22222;
  padding: 4px 8px;
  display: inline-block;
}

/* ── Shared intro line ── */
.agent-bubble-intro {
  font-size: 12px;
  color: #666666;
  margin-bottom: 7px;
  padding: 0 1px;
}

/* ── ACTION bubble ── */
.agent-action-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #ffd7c2;
  border-radius: 3px 12px 12px 12px;
  padding: 9px 13px;
}

.agent-action-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #fff4f0;
  border: 1px solid #ffd7c2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.agent-action-icon i {
  font-size: 15px;
  color: #b22222;
}

.agent-action-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #333333;
  line-height: 1.3;
}

.agent-action-sub {
  font-size: 11px;
  color: #666666;
  margin-top: 2px;
}

/* ── DATA bubble ── */
.agent-data-bubble {
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-radius: 3px 12px 12px 12px;
  overflow: hidden;
  padding: 9px 10px 10px;
}

.agent-data-card {
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  overflow: hidden;
}

.agent-data-head {
  background: #fff4f0;
  border-bottom: 1px solid #ffd7c2;
  padding: 6px 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.agent-data-head-id {
  font-size: 11px;
  font-weight: 600;
  color: #b22222;
}

.agent-data-badge {
  background: #ffffff;
  border: 1px solid #ffd7c2;
  color: #b22222;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.agent-data-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 11px;
  border-bottom: 1px solid #f2f2f2;
}

.agent-data-row:last-child {
  border-bottom: none;
}

.agent-data-key {
  font-size: 11.5px;
  color: #666666;
}

.agent-data-val {
  font-size: 11.5px;
  font-weight: 500;
  color: #333333;
  text-align: right;
  max-width: 60%;
}

.agent-data-val.highlight {
  color: #b22222;
  font-weight: 600;
}

/* ── STATS bubble ── */
.agent-stats-bubble {
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-radius: 3px 12px 12px 12px;
  padding: 9px 10px 10px;
}

.agent-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: #e2e2e2;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  overflow: hidden;
}

.agent-stat-cell {
  background: #ffffff;
  padding: 8px 11px;
}

.agent-stat-num {
  font-size: 20px;
  font-weight: 600;
  color: #b22222;
  line-height: 1;
}

.agent-stat-lbl {
  font-size: 10.5px;
  color: #666666;
  margin-top: 3px;
}