/* Nabdi v1.13.0 — smart search + internal clinical workspace refinement */

:root{
  --inner-shadow:0 12px 32px rgba(11,31,51,.06);
  --inner-border:#e5ebef;
  --inner-soft:#f8fafb;
}

/* ---------- Patient record panels ---------- */
.modern-record-grid{grid-template-columns:repeat(3,minmax(0,1fr));align-items:start}
.record-panel{padding:0!important;overflow:hidden;scroll-margin-top:104px;box-shadow:var(--inner-shadow)}
.record-panel-head{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:18px;border-bottom:1px solid var(--inner-border);background:linear-gradient(180deg,#fff,#fbfdfd)}
.record-panel-title{display:flex;gap:12px;align-items:center;min-width:0}
.record-panel-title>div{min-width:0}
.record-panel-title h2{margin:2px 0 4px;font-size:1.25rem}
.record-panel-title p{margin:0;color:#778592;font-size:.76rem}
.record-panel-icon{--tone:#16B8A6;width:46px;height:46px;padding:11px;border-radius:15px;color:var(--tone);background:color-mix(in srgb,var(--tone) 11%,white)}
.record-panel-icon svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.record-panel-icon.tone-rose{--tone:#e45f92}.record-panel-icon.tone-amber{--tone:#f79009}
.record-feed{display:grid}
.record-feed-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center;padding:15px 18px;border-bottom:1px solid #edf1f3;position:relative;background:#fff;transition:background .15s ease}
.record-feed-item:last-child{border-bottom:0}
.record-feed-item:hover{background:#fbfefe}
.record-feed-item.is-latest{background:linear-gradient(90deg,#fff,#f1fbf9)}
.record-feed-item.is-latest:before{content:"";position:absolute;inset:0 0 0 auto;width:4px;background:#16B8A6}
.record-feed-main{display:grid;gap:5px;min-width:0;color:#162233}
.record-feed-main:hover .record-number{text-decoration:underline}
.record-number{font-size:.8rem;font-weight:900;color:#07887d;direction:ltr;text-align:right;overflow-wrap:anywhere}
.record-feed-main strong{font-size:.9rem;color:#162233;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.record-date-line{display:flex;flex-wrap:wrap;gap:7px;align-items:center;color:#788794;font-size:.73rem}
.record-date-line b{font-weight:700;color:#536575}.record-date-line i{font-style:normal;color:#bdc6cd}
.record-feed-side{display:flex;align-items:center;gap:7px;flex-wrap:wrap;justify-content:flex-end}
.record-latest-pill{background:#eafaf6!important;color:#087f75!important;border:1px solid #cceee7}
.modern-empty{margin:16px;border:1px dashed #dfe7eb;border-radius:14px;background:#fbfcfd}

/* ---------- Smart search ---------- */
.smart-search-hero{grid-template-columns:auto minmax(0,1fr);row-gap:16px}
.smart-search-form{grid-column:1/-1}
.search-mode-switch{grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr;gap:10px;padding-top:4px}
.search-mode-btn{display:grid;grid-template-columns:38px minmax(0,1fr);grid-template-rows:auto auto;column-gap:10px;align-items:center;text-align:right;padding:12px 14px;border:1px solid #e2e8ed;background:#fff;border-radius:15px;color:#405569;min-height:0}
.search-mode-btn>span{grid-row:1/3;width:38px;height:38px;padding:9px;border-radius:12px;background:#f2f6f8;color:#677c8c}
.search-mode-btn>span svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.search-mode-btn b{font-size:.86rem}.search-mode-btn small{color:#81909c;font-size:.7rem;line-height:1.45}
.search-mode-btn.active{border-color:#bfe7e0;background:#f0fbf9;color:#087f75;box-shadow:0 7px 20px rgba(22,184,166,.07)}
.search-mode-btn.active>span{background:#dff7f2;color:#087f75}
.smart-search-badge{display:inline-flex;align-items:center;gap:7px;padding:7px 11px;border-radius:999px;background:#f1f8ff;color:#175cd3;font-size:.72rem;font-weight:800}
.smart-search-badge span{width:16px;height:16px}.smart-search-badge svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.8}
.search-result-title{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.match-pill{display:inline-flex;align-items:center;padding:4px 7px;border-radius:999px;font-style:normal;font-size:.64rem;font-weight:800}
.match-strong{background:#ecfdf3;color:#087443}.match-smart{background:#eff8ff;color:#175cd3}.match-near{background:#fff7e8;color:#a15c00}
.smart-result-card{border-color:#e5ebef}
.smart-result-card:hover{border-color:#b8e0da;box-shadow:0 10px 26px rgba(11,31,51,.06)}
.smart-search-tips .search-tip{border-top:3px solid #d6f0eb}

/* ---------- Internal clinical screens: consistent hero / card system ---------- */
.encounter-page-head,.rx-show-head,.echo-show-head,.document-show-head,.rx-page-head,.echo-form-head,.document-create-head{
  position:relative;overflow:hidden;padding:20px 22px;margin-bottom:18px;border:1px solid #e2e9ed;border-radius:20px;background:
  radial-gradient(circle at 90% 10%,rgba(22,184,166,.09),transparent 26%),linear-gradient(135deg,#fff,#f8fbfc);box-shadow:var(--inner-shadow)
}
.encounter-page-head:after,.rx-show-head:after,.echo-show-head:after,.document-show-head:after,.rx-page-head:after,.echo-form-head:after,.document-create-head:after{
  content:"";position:absolute;inset:0 auto 0 0;width:4px;background:linear-gradient(180deg,#16B8A6,#175cd3)
}
.encounter-page-head h1,.rx-show-head h1,.echo-show-head h1,.document-show-head h1,.rx-page-head h1,.echo-form-head h1,.document-create-head h1{font-size:clamp(1.45rem,2.2vw,1.9rem)}
.encounter-page-head p,.rx-show-head p,.echo-show-head p,.document-show-head p,.rx-page-head p,.echo-form-head p,.document-create-head p{color:#647687;line-height:1.75}
.encounter-page-head>.actions,.rx-toolbar,.echo-toolbar,.document-toolbar{justify-content:flex-end;align-items:center}

.visit-detail-date-grid{gap:12px!important;margin-bottom:18px}
.visit-date-tile{background:linear-gradient(180deg,#fff,#fbfdfd)!important;border:1px solid var(--inner-border)!important;box-shadow:0 6px 18px rgba(11,31,51,.04);border-radius:17px!important}
.encounter-detail-grid>.card,.rx-summary-grid>.card,.echo-report-grid>.card,.echo-report-grid>.stack>.card,.document-display-card,.share-card,.danger-zone{border-color:var(--inner-border);box-shadow:var(--inner-shadow)}
.encounter-detail-grid>.card h2,.rx-summary-grid>.card h2,.echo-report-grid h2,.document-display-card h2{font-size:1.1rem}
.encounter-prose,.rx-free-text,.echo-free-text,.rendered-document-body{line-height:2;color:#26384b}

/* Action bars: icons are injected by release JS only where they make sense */
.action-iconified{display:inline-flex;align-items:center;gap:7px}
.action-iconified .action-inline-icon{width:17px;height:17px;display:grid;place-items:center;flex:0 0 auto}
.action-iconified .action-inline-icon svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* cleaner forms */
.echo-form>.card,.document-form,.rx-form,.encounter-form{border-color:var(--inner-border);box-shadow:0 7px 24px rgba(11,31,51,.04)}
.section-head h2{letter-spacing:0}
.section-head p{color:#71808e}

/* ---------- Responsive ---------- */
@media(max-width:1250px){
  .modern-record-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .modern-record-grid>#documents{grid-column:1/-1}
}
@media(max-width:900px){
  .record-panel-head{align-items:flex-start;flex-direction:column}.record-panel-head>.btn{align-self:flex-start}
  .search-mode-switch{grid-template-columns:1fr 1fr}
  .encounter-page-head,.rx-show-head,.echo-show-head,.document-show-head,.rx-page-head,.echo-form-head,.document-create-head{padding:16px!important}
  .encounter-page-head>.actions,.rx-toolbar,.echo-toolbar,.document-toolbar{width:100%;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .encounter-page-head>.actions>*:first-child,.rx-toolbar>*:first-child,.echo-toolbar>*:first-child,.document-toolbar>*:first-child{grid-column:1/-1;justify-self:start}
  .encounter-page-head>.actions .btn,.rx-toolbar .btn,.echo-toolbar .btn,.document-toolbar .btn{width:100%}
}
@media(max-width:720px){
  .modern-record-grid{grid-template-columns:1fr}.modern-record-grid>#documents{grid-column:auto}
  .record-feed-item{grid-template-columns:1fr;padding:14px}.record-feed-side{justify-content:flex-start}
  .record-feed-main strong{white-space:normal}
  .search-mode-switch{grid-template-columns:1fr}
}
@media(max-width:520px){
  .record-panel-head{padding:14px}.record-feed-item{padding:13px 14px}
  .record-panel-title{align-items:flex-start}.record-panel-icon{width:42px;height:42px}
  .encounter-page-head>.actions,.rx-toolbar,.echo-toolbar,.document-toolbar{grid-template-columns:1fr}
  .search-mode-btn{grid-template-columns:34px minmax(0,1fr);padding:10px}.search-mode-btn>span{width:34px;height:34px}
}
