@font-face { font-family:'Manrope'; font-style:normal; font-weight:400 800; font-display:swap; src:url('fonts/manrope-latin-variable.woff2') format('woff2'); }
.mdbot { --bot-ink:#162D42; --bot-accent:#536F9F; font-family:'Manrope','Avenir Next','DM Sans',sans-serif; font-weight:500; color:var(--bot-ink); }
.mdbot *, .mdbot *::before, .mdbot *::after { box-sizing:border-box; }
.mdbot [hidden] { display:none !important; }
.mdbot button, .mdbot textarea, .mdbot select { font:inherit; }
.mdbot button { cursor:pointer; }
.mdbot button:focus-visible, .mdbot a:focus-visible, .mdbot textarea:focus-visible { outline:3px solid #536F9F; outline-offset:3px; }
.mdbot-fab { position:fixed; right:20px; bottom:max(20px, env(safe-area-inset-bottom)); z-index:900; display:flex; align-items:center; gap:12px; max-width:calc(100% - 32px); padding:9px 16px 9px 9px; border:2px solid #fff; border-radius:22px; background:#435D8A; color:#fff; box-shadow:0 8px 32px #162d4240; text-align:left; transition:transform .18s; }
.mdbot-fab:hover { transform:translateY(-3px); }
.mdbot-fab img { flex-shrink:0; }
.mdbot-fab strong { display:block; font-size:15px; font-weight:750; letter-spacing:-.025em; line-height:1.5; }
.mdbot-fab small { display:block; font-size:13px; line-height:1.5; color:#fff; }
.mdbot-fab-arrow { font-size:24px; }
.mdbot-panel { position:fixed; right:20px; bottom:104px; z-index:901; width:420px; max-width:calc(100% - 32px); height:760px; max-height:calc(100dvh - 128px); display:flex; flex-direction:column; padding:0; margin:0; overflow:hidden; border:1px solid #DFE7F1; border-radius:20px; background:#fff; box-shadow:0 16px 64px #162d4238; }
.mdbot-head { display:flex; align-items:center; gap:10px; flex-shrink:0; padding:16px; background:#162D42; color:#fff; }
.mdbot-head img { flex-shrink:0; }
.mdbot-identity { flex:1; min-width:0; }
.mdbot-head h2 { font-family:inherit; margin:0; font-size:20px; font-weight:800; line-height:1.3; color:#fff; letter-spacing:-.04em; }
.mdbot-head .mdbot-status { display:flex; align-items:center; gap:7px; height:36px; margin:3px 0 0; padding:0; font-size:13px; line-height:1.35; font-weight:500; color:#DFE7F1; }
.mdbot-thinking { align-self:flex-start; display:flex; align-items:center; gap:4px; padding:14px 12px; min-height:38px; flex:0 0 auto; border-radius:4px 13px 13px 13px; background:#EDEFF2; }
.mdbot-thinking span { width:4px; height:4px; background:#4D535B; border-radius:50%; animation:mdbot-thinking 1.3s infinite ease-in-out; }
.mdbot-thinking span:nth-child(2) { animation-delay:.16s; }
.mdbot-thinking span:nth-child(3) { animation-delay:.32s; }
@keyframes mdbot-thinking { 0%,70%,100% { opacity:.35; transform:translateY(0); } 35% { opacity:1; transform:translateY(-2px); } }
.mdbot-trap { position:absolute; left:-10000px; width:1px; height:1px; opacity:0; }
.mdbot-icon-button { flex-shrink:0; margin-left:auto; width:44px; height:44px; background:#ffffff15; color:#fff; border:1px solid #ffffff40; border-radius:12px; font-size:26px !important; }
.mdbot-context { display:flex; align-items:center; gap:8px; padding:10px 16px; background:#EFF4FA; font-size:13px; line-height:1.4; }
.mdbot-context span { flex:1; }
.mdbot-context button { background:transparent; color:#435D8A; border:0; padding:6px 0; font-size:14px; text-decoration:underline; font-weight:600; min-height:36px; }
.mdbot-tools { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; padding:0 14px 10px; flex-shrink:0; border-bottom:1px solid #DFE7F1; }
.mdbot-tools a { display:flex; align-items:center; justify-content:center; min-height:46px; padding:7px 5px; border:1px solid #DFE7F1; border-radius:10px; background:#EFF4FA; color:#435D8A; font-size:14px; font-weight:750; text-align:center; text-decoration:none; line-height:1.4; }
.mdbot-tools a:hover { background:#DFE7F1; }
.mdbot-controls { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:7px 14px; flex-shrink:0; }
.mdbot-controls button { background:none; border:0; color:#435D8A; text-decoration:underline; text-underline-offset:3px; font-size:14px; font-weight:700; padding:5px 0; min-height:44px; }
.mdbot-controls select { max-width:48%; min-width:0; min-height:44px; font-size:14px; color:#162D42; border:1px solid #DFE7F1; border-radius:9px; padding:6px; background:#fff; }
.mdbot select:focus-visible { outline:3px solid #536F9F; outline-offset:2px; }
.mdbot-starters { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:14px; }
.mdbot-starters button { min-height:44px; padding:9px; border:1px solid #DFE7F1; border-radius:10px; color:#435D8A; background:#EFF4FA; text-align:left; font-size:14px; font-weight:700; line-height:1.4; }
.mdbot-starters button:hover { background:#EFF4FA; border-color:#536F9F; }
.mdbot-actions small:empty { display:none; }
.mdbot-tools button, .mdbot-inline-button { flex-shrink:0; min-height:40px; border:1px solid #DFE7F1; background:#fff; border-radius:10px; color:#435D8A; padding:7px 10px; font-size:14px; font-weight:700; letter-spacing:-.025em; }
.mdbot-tools button { min-width:0; padding:7px 3px; white-space:normal; }
.mdbot-tools button:hover, .mdbot-inline-button:hover { background:#EFF4FA; border-color:#536F9F; }
.mdbot-body { position:relative; min-height:0; flex:1; overflow-y:auto; overscroll-behavior:contain; padding:16px; background:#EFF4FA; display:flex; flex-direction:column; gap:14px; scroll-behavior:auto; overflow-anchor:none; }
.mdbot-msg { max-width:94%; padding:13px 15px; border:1px solid #DFE7F1; border-radius:15px 15px 15px 4px; background:#fff; font-size:16px; font-weight:500; letter-spacing:-.015em; line-height:1.65; overflow-wrap:anywhere; flex-shrink:0; }
.mdbot-msg.user { align-self:flex-end; background:#536F9F; border-color:#536F9F; color:#fff; border-radius:15px 15px 4px 15px; }
.mdbot-text { white-space:pre-wrap; }
.mdbot-msg a { color:#435D8A; text-decoration:underline; text-underline-offset:3px; }
.mdbot-actions { display:grid; gap:8px; margin-top:12px; }
.mdbot-actions a { display:block; padding:10px 12px; min-height:44px; border:1px solid #DFE7F1; border-radius:10px; text-decoration:none; background:#EFF4FA; }
.mdbot-actions a:hover { border-color:#536F9F; background:#EFF4FA; }
.mdbot-actions strong { display:block; font-size:14px; font-weight:750; letter-spacing:-.025em; }
.mdbot-actions small { display:block; margin-top:3px; color:#526276; font-size:13px; line-height:1.4; }
.mdbot-inline-button { margin-top:10px; white-space:normal; text-align:left; }
.mdbot-foot { display:flex; gap:8px; padding:12px 14px 8px; margin:0; border-top:1px solid #DFE7F1; background:#fff; flex-shrink:0; }
.mdbot-foot textarea { flex:1; min-width:0; min-height:46px; max-height:100px; resize:none; border:1px solid #DFE7F1; border-radius:12px; padding:11px 12px; font-size:16px; line-height:1.4; background:#fff; color:#162D42; }
.mdbot-foot button { width:46px; height:46px; flex-shrink:0; border:0; border-radius:12px; background:#536F9F; color:#fff; font-size:26px; }
.mdbot button:disabled { cursor:wait; opacity:.6; }
.mdbot-footer { display:flex; align-items:center; gap:12px; padding:4px 14px 12px; background:#fff; flex-shrink:0; }
.mdbot-footer p { flex:1; margin:0; font-size:13px; line-height:1.4; color:#526276; }
.mdbot-footer button { border:0; background:transparent; padding:6px 0; color:#435D8A; text-decoration:underline; font-size:13px; min-height:44px; }
.mdbot-sr { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.mdbot-highlight { outline:3px solid #536F9F !important; outline-offset:6px; scroll-margin:160px; }
@media(max-width:600px) {
  .mdbot-fab { right:12px; bottom:max(12px, env(safe-area-inset-bottom)); gap:9px; padding:7px 12px 7px 7px; }
  .mdbot-fab img { width:42px; height:42px; }
  .mdbot-fab small { display:none; }
  .mdbot-fab strong { font-size:14px; }
  .mdbot-panel { right:12px; bottom:82px; max-width:calc(100% - 24px); height:760px; max-height:calc(100dvh - 98px); }
  .mdbot-head { padding:12px; }
  .mdbot-head h2 { font-size:19px; }
  .mdbot-tools button, .mdbot-context button { min-height:44px; }
  .mdbot-body { padding:12px; }
  .mdbot-msg { max-width:96%; }
}
@media(prefers-reduced-motion:reduce) { .mdbot *, .mdbot *::before { scroll-behavior:auto !important; transition:none !important; animation:none !important; } }

/* Tools own the workspace. Chat gets a separate dock, or an explicit mobile view. */
.mdbot-fab { gap: 9px; border-radius: 16px; background: #536F9F; box-shadow: 0 5px 20px #162d421a; }
.mdbot-fab img { width: 36px; height: 36px; }
.mdbot-fab strong { font-size: 14px; }
.mdbot-fab small { font-size: 12px; }
.mdbot-head { flex-wrap: wrap; background: #536F9F; padding: 14px; }
.mdbot-head h2 { font-size: 16px; }
.mdbot-head > img { width: 36px; height: 36px; }
.mdbot-icon-button { width: auto; height: 38px; padding: 0 10px; font-size: 13px !important; display: flex; align-items: center; gap: 10px; }
.mdbot-icon-button span { font-size: 24px; }
.mdbot-work-page .mdbot { display: flex; justify-content: flex-end; align-items: center; min-height: 54px; padding: 4px 24px; background: #EFF4FA; border-bottom: 1px solid #DFE7F1; }
.mdbot-work-page .mdbot-fab { position: static; padding: 4px 10px; border: 0; box-shadow: none; background: transparent; color: #536F9F; border-radius: 10px; }
.mdbot-work-page .mdbot-fab small { display: none; }
.mdbot-work-page .mdbot-fab:hover { transform: none; background: #DFE7F1; }
@media (min-width: 1440px) {
  body.mdbot-is-open { padding-right: 400px; }
  .mdbot-is-open .mdbot-panel { top: 0; right: 0; bottom: 0; width: 400px; height: 100dvh; max-height: none; max-width: none; border-radius: 0; border-width: 0 0 0 1px; box-shadow: -8px 0 30px #162d4208; }
  .mdbot-is-open .nav-v3 { width: auto; right: 400px; }
  .mdbot-is-open .refi-intake-grid { grid-template-columns: 190px minmax(0, 1fr); gap: 24px; }
  .mdbot-is-open .mdc-workbench { grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); }
  .mdbot-is-open .cd-layout { grid-template-columns: 320px minmax(0, 1fr); }
  .mdbot-is-open .cd-field-grid { grid-template-columns: 1fr; }
  .mdbot-is-open .cd-table-wrap { overflow-x: auto; }
  .mdbot-is-open .cd-cost-table { min-width: 860px; }
  .mdbot-is-open .calc-shell-inner { grid-template-columns: minmax(260px, .7fr) minmax(0, 1fr); }
  .mdbot-is-open .nav-primary-v3 { display: none; }
}
@media (max-width: 1439px) {
  body.mdbot-is-open { overflow: hidden; }
  .mdbot-is-open .mdbot-panel { inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; border: 0; border-radius: 0; z-index: 10000; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .mdbot-head > div { flex: 1; }
  .mdbot-is-open .mdbot-body { padding-left: max(16px, calc((100% - 720px) / 2)); padding-right: max(16px, calc((100% - 720px) / 2)); }
}
@media(prefers-reduced-motion:reduce) { .mdbot-thinking span { animation:none; } }
