.dhai-wrap { max-width: 1240px; }
.dhai-muted { color: #667085; }
.dhai-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 20px 0; }
.dhai-card { background: #fff; border: 1px solid #dfe5eb; border-radius: 16px; padding: 18px; box-shadow: 0 8px 22px rgba(16, 47, 74, .06); }
.dhai-card-label { color: #667085; font-size: 13px; }
.dhai-card-number { font-size: 32px; font-weight: 800; color: #12304a; margin-top: 6px; }
.dhai-actions { margin: 18px 0; }
.dhai-note { background: #f4f8fb; border-left: 4px solid #12304a; padding: 14px 16px; border-radius: 10px; margin: 16px 0 20px; }
.dhai-panel { background: #fff; border: 1px solid #dfe5eb; border-radius: 16px; padding: 18px 20px; margin: 18px 0; box-shadow: 0 8px 22px rgba(16,47,74,.05); }
.dhai-panel h2 { margin-top: 0; color: #12304a; }
.dhai-panel h3 { margin: 10px 0 0; padding-top: 12px; border-top: 1px solid #edf1f5; color: #12304a; }
.dhai-two-col { display: grid; grid-template-columns: minmax(380px, 0.95fr) minmax(420px, 1.05fr); gap: 18px; align-items: start; }
.dhai-badge { display: inline-block; background: #eef4f7; color: #12304a; border: 1px solid #dbe7ee; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 700; margin: 2px; }
.dhai-table td { vertical-align: middle; }
.dhai-form-table th { width: 240px; padding: 16px 10px 16px 0; }
.dhai-form-table td { padding: 12px 10px; }
.dhai-form-table input.regular-text,
.dhai-form-table select.regular-text,
.dhai-form-table textarea.large-text { max-width: 680px; width: 100%; }
.dhai-form-table select[multiple] { min-height: 138px; }
.dhai-select { min-width: 320px; }
@media (max-width: 900px) { .dhai-two-col { grid-template-columns: 1fr; } .dhai-grid { grid-template-columns: 1fr 1fr; } .dhai-form-table th, .dhai-form-table td { display:block; width:100%; padding:8px 0; } }
@media (max-width: 600px) { .dhai-grid { grid-template-columns: 1fr; } }

.dhai-code { background:#0f172a; color:#e5edf5; padding:16px; border-radius:12px; overflow:auto; }
.dhai-form-table h3 { font-size: 15px; }
.dhai-template-buttons { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.dhai-template-buttons .button { margin:0; }
.dhai-preview-row { background:#fff; border:1px solid #e3eaf0; border-radius:12px; padding:12px 14px; margin:10px 0; }
.dhai-warning { background:#fff8e5; border-left:4px solid #dba617; padding:12px 14px; border-radius:10px; margin:14px 0; }
.dhai-warning ul { margin:8px 0 0 22px; }
.dhai-success { background:#edf9f0; border-left:4px solid #20a455; padding:12px 14px; border-radius:10px; margin:14px 0; }

/* V1.0.5/V1.0.6 project preview/admin polish */
.dhai-top-actions { display:flex; flex-wrap:wrap; gap:8px; margin: 10px 0 16px; }
.dhai-preview-details { margin-top: 8px; }
.dhai-preview-details summary { cursor:pointer; display:inline-block; color:#2271b1; font-weight:700; margin-top:6px; }
.dhai-preview-details .dhai-result-card { margin-top: 10px; max-width: 360px; }
.dhai-result-card { background:#fff; border:1px solid #dbe6ee; border-radius:18px; overflow:hidden; box-shadow:0 10px 28px rgba(16,47,74,.10); max-width:430px; }
.dhai-result-image { background:#e9f0f5; min-height:150px; display:flex; align-items:center; justify-content:center; color:#667085; font-weight:700; }
.dhai-result-image img { width:100%; height:170px; object-fit:cover; display:block; }
.dhai-result-placeholder { border-bottom:1px solid #dbe6ee; }
.dhai-result-body { padding:16px; }
.dhai-result-title { color:#12304a; font-size:20px; line-height:1.25; font-weight:800; margin-bottom:4px; }
.dhai-result-meta { color:#496273; font-size:14px; font-weight:600; margin-bottom:10px; }
.dhai-result-price { color:#263f52; font-size:14px; margin-bottom:12px; }
.dhai-result-offer { background:#f2f8fb; border:1px solid #dce8ee; border-radius:14px; padding:10px 12px; color:#12304a; font-size:13px; margin: 8px 0; }
.dhai-result-disclaimer { color:#687d8d; font-size:12px; margin: 6px 0 12px; }
.dhai-result-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
.dhai-result-actions .button { border-radius:12px; }
@media (max-width: 600px) { .dhai-result-card { max-width:100%; } .dhai-result-image img { height:150px; } }

/* V1.0.6: smaller preview cards + usable details/WhatsApp buttons */
.dhai-result-card-small { max-width: 300px; border-radius: 14px; box-shadow:0 8px 20px rgba(16,47,74,.09); }
.dhai-result-card-small .dhai-result-image { min-height: 96px; }
.dhai-result-card-small .dhai-result-image img { height: 112px; }
.dhai-result-card-small .dhai-result-body { padding: 12px; }
.dhai-result-card-small .dhai-result-title { font-size: 16px; line-height: 1.2; margin-bottom: 3px; }
.dhai-result-card-small .dhai-result-meta { font-size: 12px; margin-bottom: 7px; }
.dhai-result-card-small .dhai-result-price { font-size: 12px; margin-bottom: 8px; }
.dhai-result-card-small .dhai-result-offer { font-size: 12px; border-radius: 10px; padding: 8px 9px; }
.dhai-result-card-small .dhai-result-disclaimer { font-size: 11px; margin-bottom: 8px; }
.dhai-result-actions .dhai-whatsapp-btn,
a.dhai-whatsapp-btn { background:#1fae5b !important; border-color:#168b47 !important; color:#fff !important; }
.dhai-result-actions .dhai-whatsapp-btn:hover,
a.dhai-whatsapp-btn:hover { background:#168b47 !important; color:#fff !important; }
.dhai-card-details { display:inline-block; margin:0; }
.dhai-card-details summary { list-style:none; cursor:pointer; }
.dhai-card-details summary::-webkit-details-marker { display:none; }
.dhai-card-details-box { margin-top:9px; padding:10px; border:1px solid #dbe6ee; border-radius:10px; background:#f8fbfd; color:#263f52; font-size:12px; line-height:1.45; }
.dhai-admin-header { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin-bottom:14px; }
.dhai-admin-header h1 { margin:0; }
.dhai-list-actions a { margin-right:8px; }
.dhai-compact-table td, .dhai-compact-table th { vertical-align:middle; }

/* V1.0.7 refinements */
.dhai-result-card-small { max-width: 285px; }
.dhai-result-card-small .dhai-result-image img { height: 105px; }
.dhai-result-card-small .dhai-result-title { font-size: 15px; }
.dhai-result-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:flex-start; }
.dhai-result-actions .button { min-height: 32px; line-height: 30px; padding: 0 12px; }
.dhai-card-details-wide { display: contents; }
.dhai-card-details-wide summary { order: 1; }
.dhai-result-actions > .dhai-whatsapp-btn { order: 2; }
.dhai-card-details-wide .dhai-card-details-box { order: 3; flex: 0 0 100%; width: 100%; max-height: 260px; overflow:auto; box-sizing:border-box; }
.dhai-result-offer { background: #fff7e8; border-color: #e8bf73; color:#4a3410; box-shadow: inset 3px 0 0 #d8a84f; }
.dhai-result-offer strong { color:#12304a; }
.dhai-offer-mini { display:inline-block; background:#fff7e8; border:1px solid #e8bf73; color:#4a3410; border-radius:999px; padding:3px 8px; margin-top:4px; font-size:12px; }
.dhai-list-actions { white-space: nowrap; }
.dhai-list-actions a { margin-right: 10px; }
.dhai-admin-header .page-title-action { top: 0; }


/* V1.0.8: clearer details toggle, full details, trash links, and brochure placeholder */
.dhai-tabs { margin: 10px 0 16px; display:flex; gap:8px; flex-wrap:wrap; }
.dhai-danger-link { color:#b42318 !important; }
.dhai-card-details-wide .dhai-card-details-box { max-height:none !important; overflow:visible !important; }
.dhai-card-details .dhai-less-label { display:none; }
.dhai-card-details[open] .dhai-view-label { display:none; }
.dhai-card-details[open] .dhai-less-label { display:inline; }
.dhai-brochure-btn { background:#eef4f7 !important; border-color:#cbd9e2 !important; color:#627486 !important; }
.dhai-result-card-small { max-width: 325px; }
.dhai-result-card-small .dhai-result-image img { height: 108px; }
.dhai-result-actions { display:flex; gap:8px; align-items:center; flex-wrap:nowrap; }
.dhai-card-details-wide { display:contents; }
.dhai-card-details-wide summary.button { order:1; flex:1 1 0; text-align:center; min-width:0; }
.dhai-result-actions > .dhai-whatsapp-btn { order:2; flex:1 1 0; text-align:center; min-width:0; }
.dhai-card-details-wide .dhai-card-details-box { order:3; flex:0 0 100%; width:100%; }
@media (max-width: 380px) { .dhai-result-actions { flex-wrap:wrap; } .dhai-card-details-wide summary.button, .dhai-result-actions > .dhai-whatsapp-btn { flex:1 1 100%; } }

/* V1.0.9: details appear above buttons; buttons remain centered on one line */
.dhai-details-toggle { position:absolute; opacity:0; pointer-events:none; }
.dhai-card-details-box-below { display:none; margin:12px 0 0; padding:12px; border:1px solid #dbe6ee; border-radius:12px; background:#f8fbfd; color:#263f52; font-size:12px; line-height:1.5; box-sizing:border-box; width:100%; }
.dhai-details-toggle:checked + .dhai-card-details-box-below { display:block; }
.dhai-details-toggle:checked ~ .dhai-result-actions-final .dhai-view-label { display:none; }
.dhai-details-toggle:checked ~ .dhai-result-actions-final .dhai-less-label { display:inline; }
.dhai-result-actions-final { display:grid !important; grid-template-columns:1fr 1fr; gap:10px; align-items:center; justify-content:center; margin-top:12px; width:100%; }
.dhai-result-actions-final .button,
.dhai-result-actions-final label.button { width:100%; text-align:center; box-sizing:border-box; margin:0 !important; min-height:36px; line-height:34px; border-radius:12px; font-weight:700; cursor:pointer; padding:0 10px; }
.dhai-result-actions-final .dhai-less-label { display:none; }
@media (max-width: 360px) { .dhai-result-actions-final { grid-template-columns:1fr; } }

/* V1.0.10: JS-based details toggle to avoid checkbox/label glitches */
.dhai-details-toggle { display:none !important; }
.dhai-card-details-box-below[hidden] { display:none !important; }
.dhai-card-details-box-below { display:block; margin:12px 0 0; padding:12px; border:1px solid #dbe6ee; border-radius:12px; background:#f8fbfd; color:#263f52; font-size:12px; line-height:1.5; box-sizing:border-box; width:100%; }
.dhai-result-actions-final { display:grid !important; grid-template-columns:1fr 1fr; gap:10px; align-items:center; justify-content:center; margin-top:12px; width:100%; }
.dhai-result-actions-final .button,
.dhai-result-actions-final button.button { width:100%; text-align:center; box-sizing:border-box; margin:0 !important; min-height:36px; line-height:34px; border-radius:12px; font-weight:700; cursor:pointer; padding:0 10px; }
.dhai-toggle-button { white-space:nowrap; }
@media (max-width: 360px) { .dhai-result-actions-final { grid-template-columns:1fr; } }

/* V2.0.0: Chat card renderer foundation */
.dhai-chat-stream { display:grid; grid-template-columns:repeat(auto-fit, minmax(285px, 360px)); gap:18px; align-items:start; margin-top:14px; }
.dhai-result-card-chat { max-width:360px; border-radius:20px; box-shadow:0 14px 34px rgba(16,47,74,.12); }
.dhai-result-card-chat .dhai-result-image img { height:160px; }
.dhai-result-card-chat .dhai-result-title { font-size:18px; }
.dhai-result-card-chat .dhai-result-body { padding:16px; }
.dhai-result-card-chat .dhai-card-details-box-below { font-size:13px; }
.dhai-inline-form { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.dhai-inline-form input, .dhai-inline-form select { min-height:34px; max-width:185px; }
.dhai-public-cards .dhai-chat-stream { margin: 18px 0; }
@media (max-width: 700px) { .dhai-chat-stream { grid-template-columns:1fr; } .dhai-result-card-chat { max-width:100%; } }

/* V2.2.1: clearer offer-only filter control */
.dhai-filter-check{display:inline-flex;align-items:center;gap:7px;margin:4px 8px 4px 0;padding:7px 11px;background:#eaf7ef;border:1px solid #bde6c8;border-radius:999px;font-weight:700;color:#176b36;min-height:34px;box-sizing:border-box}.dhai-filter-check input{margin:0}

/* V2.3.3: actual chat test widget behavior */
.dhai-chat-widget { max-width: 980px; border:1px solid #dbe6ee; border-radius:22px; background:#fff; overflow:hidden; box-shadow:0 12px 30px rgba(16,47,74,.08); }
.dhai-chat-head { padding:14px 16px; background:#f5f9fc; border-bottom:1px solid #e3edf3; display:flex; flex-direction:column; gap:2px; }
.dhai-chat-head strong { color:#12304a; font-size:16px; }
.dhai-chat-head span { color:#647789; font-size:12px; }
.dhai-chat-messages { padding:16px; max-height:760px; overflow:auto; background:#fbfdfe; }
.dhai-chat-bubble { margin:0 0 14px; max-width:100%; }
.dhai-chat-bubble-user { margin-left:auto; width:max-content; max-width:75%; background:#12304a; color:#fff; border-radius:18px 18px 4px 18px; padding:10px 13px; }
.dhai-chat-bubble-bot { background:#fff; border:1px solid #e1ebf1; border-radius:18px 18px 18px 4px; padding:12px; box-shadow:0 6px 18px rgba(16,47,74,.05); }
.dhai-chat-form { display:flex; gap:10px; padding:12px 16px; border-top:1px solid #e3edf3; background:#fff; }
.dhai-chat-form input { flex:1 1 auto; min-height:42px; border-radius:14px; padding:0 12px; }
.dhai-chat-form button { min-height:42px; border-radius:14px; padding:0 18px; background:#12304a; color:#fff; border:0; font-weight:700; cursor:pointer; }
.dhai-chat-note { color:#607487; font-size:12px; margin:8px 0 0; }
.dhai-chat-widget .dhai-chat-stream { grid-template-columns:repeat(auto-fit, minmax(250px, 320px)); }
.dhai-chat-widget .dhai-result-card-chat { max-width:320px; }
.dhai-chat-widget .dhai-result-card-chat .dhai-result-image img { height:130px; }
.dhai-chat-widget .dhai-result-card-chat .dhai-result-title { font-size:16px; }
.dhai-chat-widget .dhai-result-card-chat .dhai-result-body { padding:14px; }
@media (max-width: 700px) {
  .dhai-chat-bubble-user { max-width:90%; }
  .dhai-chat-form { flex-direction:column; }
  .dhai-chat-widget .dhai-chat-stream { grid-template-columns:1fr; }
  .dhai-chat-widget .dhai-result-card-chat { max-width:100%; }
}

/* V2.3.4: protect admin preview cards from giant-image/layout regressions */
.dhai-wrap .dhai-preview-details .dhai-result-card,
.dhai-wrap table .dhai-result-card-small,
.dhai-wrap #dhai-ai-preview .dhai-result-card-small {
  width: 325px !important;
  max-width: 325px !important;
  min-width: 0 !important;
  display: block !important;
  overflow: hidden !important;
  border: 1px solid #dbe6ee !important;
  border-radius: 18px !important;
  background: #fff !important;
  box-shadow: 0 10px 28px rgba(16,47,74,.10) !important;
}
.dhai-wrap .dhai-preview-details .dhai-result-image,
.dhai-wrap table .dhai-result-card-small .dhai-result-image,
.dhai-wrap #dhai-ai-preview .dhai-result-card-small .dhai-result-image {
  width: 100% !important;
  height: 108px !important;
  min-height: 108px !important;
  max-height: 108px !important;
  overflow: hidden !important;
  background: #e9f0f5 !important;
}
.dhai-wrap .dhai-preview-details .dhai-result-image img,
.dhai-wrap table .dhai-result-card-small .dhai-result-image img,
.dhai-wrap #dhai-ai-preview .dhai-result-card-small .dhai-result-image img {
  width: 100% !important;
  height: 108px !important;
  max-width: 100% !important;
  object-fit: cover !important;
  display: block !important;
}
.dhai-wrap .dhai-preview-details .dhai-result-body,
.dhai-wrap table .dhai-result-card-small .dhai-result-body,
.dhai-wrap #dhai-ai-preview .dhai-result-card-small .dhai-result-body { padding: 12px !important; }
.dhai-wrap .dhai-preview-details .dhai-result-title,
.dhai-wrap table .dhai-result-card-small .dhai-result-title,
.dhai-wrap #dhai-ai-preview .dhai-result-card-small .dhai-result-title { font-size: 15px !important; line-height: 1.25 !important; }
.dhai-wrap .dhai-preview-details .dhai-result-meta,
.dhai-wrap table .dhai-result-card-small .dhai-result-meta,
.dhai-wrap #dhai-ai-preview .dhai-result-card-small .dhai-result-meta,
.dhai-wrap .dhai-preview-details .dhai-result-price,
.dhai-wrap table .dhai-result-card-small .dhai-result-price,
.dhai-wrap #dhai-ai-preview .dhai-result-card-small .dhai-result-price { font-size: 12px !important; }

/* V2.3.4: real chatbot cards can be wider, but stay controlled */
.dhai-chat-widget .dhai-result-card-chat,
.dhai-public-cards .dhai-result-card-chat,
.dhai-chat-stream .dhai-result-card-chat {
  width: 100% !important;
  max-width: 320px !important;
}
.dhai-chat-widget .dhai-result-card-chat .dhai-result-image,
.dhai-public-cards .dhai-result-card-chat .dhai-result-image,
.dhai-chat-stream .dhai-result-card-chat .dhai-result-image { height: 130px !important; overflow: hidden !important; }
.dhai-chat-widget .dhai-result-card-chat .dhai-result-image img,
.dhai-public-cards .dhai-result-card-chat .dhai-result-image img,
.dhai-chat-stream .dhai-result-card-chat .dhai-result-image img { height: 130px !important; object-fit: cover !important; }

/* V2.3.4: keep action buttons clean and aligned */
.dhai-result-actions-final { display:grid !important; grid-template-columns:1fr 1fr !important; gap:10px !important; width:100% !important; }
.dhai-result-actions-final .button,
.dhai-result-actions-final button.button,
.dhai-result-actions-final a.button { width:100% !important; min-width:0 !important; text-align:center !important; margin:0 !important; box-sizing:border-box !important; }
@media (max-width: 380px) { .dhai-result-actions-final { grid-template-columns:1fr !important; } }

/* V2.5.0: Cards rendered underneath AI Engine chat replies */
.dhai-chat-card-rendered {
  margin: 12px 0 18px;
  max-width: 100%;
}
.dhai-chat-card-rendered .dhai-chat-stream {
  margin-top: 10px;
}
.mwai-chatbot .dhai-chat-card-rendered,
.mwai-conversation .dhai-chat-card-rendered {
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 700px) {
  .dhai-chat-card-rendered .dhai-chat-stream {
    grid-template-columns: 1fr !important;
  }
  .dhai-chat-card-rendered .dhai-result-card-chat {
    max-width: 100% !important;
  }
}

/* V2.5.1: frontend AI Engine card polish + duplicate-text cleanup */
.dhai-ai-card-intro {
  margin: 0 0 10px !important;
  font-weight: 600 !important;
  color: #15384d !important;
}
.dhai-chat-card-rendered {
  margin: 10px 0 22px !important;
  width: min(760px, 92vw) !important;
  max-width: 92vw !important;
  box-sizing: border-box !important;
}
.dhai-chat-card-rendered .dhai-chat-stream {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(300px, 380px)) !important;
  gap: 18px !important;
  align-items: start !important;
  margin-top: 8px !important;
}
.dhai-chat-card-rendered .dhai-result-card-chat {
  width: 100% !important;
  max-width: 380px !important;
  border-radius: 22px !important;
  border: 1px solid rgba(0, 139, 139, .16) !important;
  box-shadow: 0 16px 40px rgba(16,47,74,.13) !important;
}
.dhai-chat-card-rendered .dhai-result-card-chat .dhai-result-image,
.dhai-chat-card-rendered .dhai-result-card-chat .dhai-result-image img {
  height: 165px !important;
  min-height: 165px !important;
}
.dhai-chat-card-rendered .dhai-result-card-chat .dhai-result-title {
  font-size: 18px !important;
  line-height: 1.25 !important;
}
.dhai-chat-card-rendered .dhai-result-card-chat .dhai-result-meta,
.dhai-chat-card-rendered .dhai-result-card-chat .dhai-result-price {
  font-size: 13px !important;
  line-height: 1.45 !important;
}
@media (max-width: 700px) {
  .dhai-chat-card-rendered {
    width: 100% !important;
    max-width: 100% !important;
    margin: 10px 0 18px !important;
  }
  .dhai-chat-card-rendered .dhai-chat-stream {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .dhai-chat-card-rendered .dhai-result-card-chat {
    max-width: 100% !important;
    border-radius: 20px !important;
  }
  .dhai-chat-card-rendered .dhai-result-card-chat .dhai-result-image,
  .dhai-chat-card-rendered .dhai-result-card-chat .dhai-result-image img {
    height: 170px !important;
    min-height: 170px !important;
  }
}
