/* Sfera Opportunity Studio · 1.139 · mobile list + detail composition.
   Uses the already approved Sfera dashboard palette; no new design colors.
   Loaded after the older opportunity desktop / v4 / v5 skin. */

/* 1 · Small screens: native record cards, not a scaled-down desktop grid. */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  #opportunity-view[data-studio="v4"] .s4-table-head,
  #opportunity-view[data-studio="v4"] .opp-desk-list-labels,
  #opportunity-view[data-studio="v4"] #opportunity-management-pane > .opportunity-pane__header,
  #opportunity-view[data-studio="v4"] #opportunity-management-pane > :is(h1,h2,h3) {
    display:none!important;
  }
  #opportunity-view[data-studio="v4"] #opportunity-management-pane {
    box-sizing:border-box!important;
    min-width:0!important;
    width:100%!important;
    padding:10px 12px 20px!important;
    overflow:visible!important;
  }
  #opportunity-view[data-studio="v4"] #opportunity-results {
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:11px!important;
    margin:0!important;
    padding:0!important;
    min-width:0!important;
    overflow:visible!important;
  }
  #opportunity-view[data-desk][data-studio="v4"] #opportunity-results .opportunity-card.s4-row {
    position:relative!important;
    display:grid!important;
    box-sizing:border-box!important;
    grid-template-columns:minmax(0,1fr) minmax(0,.9fr)!important;
    grid-template-areas:
       "identity identity"
       "phase amount"
       "follow expiry"
       "owner owner"!important;
    align-items:start!important;
    gap:12px 10px!important;
    min-width:0!important;
    width:100%!important;
    padding:15px!important;
    margin:0!important;
    border:1px solid #e1eaf7!important;
    border-radius:14px!important;
    background:#fff!important;
    box-shadow:0 4px 17px rgba(14,33,102,.045)!important;
    transform:none!important;
    translate:none!important;
    transition:background .16s,border-color .16s,box-shadow .16s!important;
    cursor:pointer;
  }
  #opportunity-view[data-desk][data-studio="v4"] #opportunity-results .opportunity-card.s4-row:nth-child(even){
    background:#fff!important;
  }
  #opportunity-view[data-desk][data-studio="v4"] #opportunity-results .opportunity-card.s4-row:hover,
  #opportunity-view[data-desk][data-studio="v4"] #opportunity-results .opportunity-card.s4-row:focus-visible{
    background:#f8fbff!important;
    border-color:#bfD5f5!important;
    box-shadow:0 6px 18px rgba(14,33,102,.055)!important;
    transform:none!important;
    translate:none!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-id {
    grid-area:identity!important;
    display:flex!important;
    min-width:0!important;
    padding-right:35px!important;
    align-items:center!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-id>span:last-child {
    min-width:0!important;
    flex:1!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-id strong {
    display:block!important;
    font-size:12px!important;
    font-weight:750!important;
    line-height:1.45!important;
    color:#1c3d70!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-id small {
    font-size:11px!important;
    color:#869bb7!important;
    line-height:1.35!important;
  }
  #opportunity-view[data-studio="v4"] .s4-avatar{
    flex:0 0 34px!important;
    width:34px!important;
    height:34px!important;
    background:#edf4ff!important;
    color:#356bbd!important;
    border-radius:10px!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-phase {
    grid-area:phase!important;
    min-width:0!important;
    align-self:center!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-phase .s4-badge{
    white-space:normal!important;
    overflow-wrap:anywhere!important;
    text-align:left!important;
    line-height:1.4!important;
    font-size:10px!important;
    padding:5px 8px!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-amount {
    grid-area:amount!important;
    align-self:center!important;
    text-align:right!important;
    min-width:0!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-amount strong {
    color:#12346a!important;
    font:700 18px/1.15 Poppins,"Open Sans",sans-serif!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-amount small {
    display:block!important;
    font-size:10px!important;
    line-height:1.4!important;
    overflow-wrap:anywhere!important;
    color:#7894b5!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-follow,
  #opportunity-view[data-studio="v4"] .s4-row-expiry {
    display:flex!important;
    flex-direction:column!important;
    justify-content:flex-start!important;
    gap:5px!important;
    min-width:0!important;
    padding:10px 10px 8px!important;
    border:1px solid #edf1f8!important;
    border-radius:9px!important;
    background:#f8fbff!important;
    overflow-wrap:anywhere!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-follow {grid-area:follow!important}
  #opportunity-view[data-studio="v4"] .s4-row-expiry {grid-area:expiry!important}
  #opportunity-view[data-studio="v4"] .s4-row-follow::before {
    content:"Follow-up";
    font-size:9px!important;
    font-weight:700!important;
    color:#879bb5!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-expiry::before {
    content:"Scadenza offerta";
    font-size:9px!important;
    font-weight:700!important;
    color:#879bb5!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-follow :is(.s4-badge,.s4-muted-chip),
  #opportunity-view[data-studio="v4"] .s4-row-expiry :is(.s4-badge,.s4-muted-chip) {
    align-self:flex-start!important;
    width:auto!important;
    max-width:100%!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
    font-size:10px!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-owner {
    grid-area:owner!important;
    display:flex!important;
    align-items:center!important;
    min-width:0!important;
    padding-top:10px!important;
    border-top:1px solid #edf2fa!important;
    color:#718ba9!important;
    font-size:10px!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-owner::before{
    content:"Commerciale · ";
    margin-right:4px;
    font-weight:700;
    color:#8ea3ba;
  }
  #opportunity-view[data-studio="v4"] .s4-row-arrow {
    position:absolute!important;
    top:16px!important;
    right:13px!important;
    grid-area:auto!important;
    display:grid!important;
    place-items:center!important;
    width:28px!important;
    height:28px!important;
    border-radius:8px!important;
    background:#f2f7ff!important;
    color:#3b78eb!important;
  }
  #opportunity-view[data-studio="v4"] .s4-row-arrow svg{width:15px!important;height:15px!important}
  #opportunity-view[data-studio="v4"] .s4-workspace,
  #opportunity-view[data-studio="v4"] .s4-workspace-nav {
    min-width:0!important;
    max-width:100%!important;
  }
  #opportunity-view[data-studio="v4"] .s4-workspace-nav {
    display:flex!important;
    flex-wrap:wrap!important;
    padding:0 11px!important;
    gap:0!important;
  }
  #opportunity-view[data-studio="v4"] .opportunity-tabs{
    flex:1 1 100%!important;
    justify-content:flex-start!important;
    overflow-x:auto!important;
  }
  #opportunity-view[data-studio="v4"] .s4-toolbar {
    width:100%!important;
    flex:1 1 100%!important;
    justify-content:flex-start!important;
    gap:7px!important;
    padding:8px 0 11px!important;
    min-width:0!important;
    overflow-x:auto!important;
  }
  #opportunity-view[data-studio="v4"] .s4-loaded {
    display:inline-flex!important;
    flex:none!important;
    white-space:nowrap!important;
    font-size:10px!important;
    background:#edf4ff!important;
    color:#426d9d!important;
  }
  #opportunity-view[data-studio="v4"] .s4-tool,#opportunity-view[data-studio="v4"] .s4-new{flex:none!important}
}
@media(max-width:350px){
 #opportunity-view[data-desk][data-studio="v4"] #opportunity-results .opportunity-card.s4-row{
  padding:12px!important;
  gap:10px 7px!important;
 }
 #opportunity-view[data-studio="v4"] .s4-row-amount strong{font-size:16px!important}
 #opportunity-view[data-studio="v4"] .s4-row-follow,#opportunity-view[data-studio="v4"] .s4-row-expiry{padding:8px 7px!important}
}

/* 2 · Canonical opportunity detail: a more complete, useful Sfera drawer. */
#opportunity-detail-dialog.opp-desk-dialog[hidden],
#opportunity-detail-dialog.opp-desk-dialog #opportunity-detail[hidden]{display:none!important}
#opportunity-detail-dialog.opp-desk-dialog #opportunity-detail.opportunity-dialog__panel{
  width:min(610px,100vw)!important;
  max-width:100vw!important;
  background:#f7faff!important;
  overflow:hidden!important;
}
#opportunity-detail-dialog.opp-desk-dialog #opportunity-detail>header{
  padding:20px 23px 17px!important;
  background:#fff!important;
  border-bottom:1px solid #e4edf8!important;
}
#opportunity-detail-dialog.opp-desk-dialog #opportunity-detail>header h3 {
  color:#0e2166!important;
  font:650 20px/1.3 Poppins,"Open Sans",sans-serif!important;
  letter-spacing:-.035em!important;
}
#opportunity-detail-dialog.opp-desk-dialog #opportunity-detail-data.s6-detail-body{
  display:block!important;
  min-width:0!important;
  flex:1 1 auto!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain!important;
  scrollbar-width:thin;
  padding:16px 19px 22px!important;
  margin:0!important;
  background:#f7faff!important;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-intro{
  display:grid;
  gap:12px;
  min-width:0;
  margin:0 0 14px;
  padding:4px 2px 0;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-labels{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-company{
  display:flex;
  gap:10px;
  align-items:center;
  min-width:0;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-company-icon{
  display:grid;
  flex:0 0 37px;
  place-items:center;
  width:37px;height:37px;
  color:#3575d5;
  background:#e7f1ff;
  border-radius:11px;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-company-icon svg{width:18px;height:18px}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-company>div{display:grid;gap:4px;min-width:0}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-company strong{
  font:650 13px/1.45 Poppins,"Open Sans",sans-serif;
  color:#213e70;
  overflow-wrap:anywhere;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-company small{font-size:10px;color:#8499b7}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-highlights{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:10px;
  margin-bottom:12px;
  min-width:0;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-highlight{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:8px;
  justify-content:center;
  min-width:0;
  padding:17px 16px;
  border-radius:13px;
  border:1px solid #dbe8f9;
  background:#fff;
  box-shadow:0 3px 15px rgba(14,33,102,.035);
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-value{
  background:#f0f6ff;
  border-color:#d8e7fd;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-highlight-icon{
  display:grid;place-items:center;
  width:30px;height:30px;
  color:#3577d9;
  background:#e0edff;
  border-radius:9px;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-highlight-icon svg{width:17px;height:17px}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-highlight>small{
  font-size:10px;
  font-weight:650;
  color:#7791b4;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-highlight>strong{
  font:650 clamp(19px,2.2vw,25px)/1.2 Poppins,"Open Sans",sans-serif;
  color:#11366e;
  letter-spacing:-.035em;
  white-space:nowrap;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-prob{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:8px;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-prob-ring{
  position:relative;
  width:72px;
  height:72px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:conic-gradient(#3b78eb var(--prob),#e8effb 0);
  animation:s6-reveal .65s both;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-prob-ring::before{
  content:"";
  position:absolute;
  inset:9px;
  border-radius:50%;
  background:#fff;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-prob-ring>div{
  position:relative;
  z-index:1;
  text-align:center;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-prob-ring strong{
  display:block;
  font:650 15px Poppins,"Open Sans",sans-serif;
  color:#214c90;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-prob-ring small{font-size:8px;color:#859ab7}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-tiles{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:9px;
  margin-bottom:12px;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-tile{
  display:flex;align-items:center;gap:10px;
  min-width:0;
  padding:13px 12px;
  background:#fff;
  border:1px solid #e2eaf6;
  border-radius:12px;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-tile:last-child{grid-column:1/-1}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-tile-icon{
  display:grid;
  flex:0 0 30px;
  place-items:center;
  width:30px;height:30px;
  border-radius:9px;
  color:#3d78cf;
  background:#eaf3ff;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-tile-icon svg{width:17px;height:17px}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-tile>span:last-child{min-width:0;display:grid;gap:4px}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-tile small{font-size:9px;color:#8296b0}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-tile strong{
  font-size:11px;line-height:1.45;
  color:#2c507e;font-weight:700;overflow-wrap:anywhere;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-section{
  min-width:0;
  padding:16px 15px;
  margin-bottom:12px;
  border:1px solid #e0e9f6;
  border-radius:13px;
  background:#fff;
  box-shadow:0 3px 14px rgba(15,47,106,.025);
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-section-head{
  display:flex;
  align-items:center;
  gap:9px;
  min-height:24px;
  margin:0 0 16px;
  border:0;
  padding:0;
  background:transparent;
  color:#284976;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-head-icon{
  flex:none;display:grid;place-items:center;
  width:26px;height:26px;
  color:#3b78eb;background:#edf5ff;border-radius:8px;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-head-icon svg{width:15px;height:15px}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-section-head>strong,
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-section-head>span>strong{
  font:650 12px Poppins,"Open Sans",sans-serif;
  color:#284976;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-section-head>span:last-child{display:grid;gap:3px}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-section-head>span:last-child small{
  color:#8398b5;font-size:10px;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-steps{
  display:grid;
  position:relative;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:3px;
  align-items:start;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-steps::before{
  content:"";
  position:absolute;
  top:13px;
  left:10%;right:10%;
  height:2px;
  background:#e0e9f7;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-step{
  display:grid;justify-items:center;gap:9px;
  position:relative;z-index:1;min-width:0;
  text-align:center;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-step-dot{
  display:grid;place-items:center;
  width:27px;height:27px;
  border-radius:50%;
  border:1px solid #d7e4f5;
  background:#f7faff;
  color:#8da4c0;
  font-size:10px;font-weight:700;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-step.done .s6-detail-step-dot{
  color:#2d78d9;
  background:#e7f2ff;
  border-color:#bfd7f9;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-step.active .s6-detail-step-dot{
  color:#fff;background:#3278e4;border-color:#3278e4;
  box-shadow:0 0 0 4px #e9f3ff;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-step small{
  font-size:9px;
  line-height:1.3;
  color:#8699b2;
  overflow-wrap:anywhere;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-step.active small{
  color:#316fc3;font-weight:700;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-rows{
  display:grid;
  gap:0;
  margin:0;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);
  gap:10px;
  align-items:baseline;
  min-width:0;
  padding:10px 0;
  border-bottom:1px solid #edf2fa;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-row:last-child{border-bottom:0;padding-bottom:0}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-row dt{
  color:#8196b0;
  font-size:10px;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-row dd{
  margin:0;
  color:#2d507f;
  font-size:11px;
  font-weight:700;
  line-height:1.45;
  text-align:right;
  overflow-wrap:anywhere;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-note-text{
  color:#657d9b;
  font-size:11px;
  line-height:1.7;
  white-space:pre-wrap;
  margin:0!important;
  overflow-wrap:anywhere;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-detail-note-text.is-clamped{
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:4;
  line-clamp:4;
  overflow:hidden;
}
#opportunity-detail-dialog.opp-desk-dialog button.s6-detail-toggle{
  border:0!important;background:transparent!important;color:#3b78eb!important;
  font-size:11px;font-weight:700;padding:9px 0 0!important;
}
#opportunity-detail-dialog.opp-desk-dialog button.s6-detail-toggle:hover{
  text-decoration:underline;
}
#opportunity-detail-dialog.opp-desk-dialog #opportunity-customer-link{
  background:#f7faff!important;
  margin:0!important;
  padding:3px 20px 15px!important;
}
#opportunity-detail-dialog.opp-desk-dialog #opportunity-detail>footer.s6-detail-actions{
  display:flex!important;flex-wrap:nowrap!important;
  align-items:center!important;
  justify-content:space-around!important;
  gap:0!important;
  width:100%!important;
  padding:12px 8px calc(12px + env(safe-area-inset-bottom))!important;
  margin:0!important;
  border-top:1px solid #e5edf8!important;
  background:#fff!important;
}
#opportunity-detail-dialog.opp-desk-dialog #opportunity-detail>footer button.s6-detail-action:not([hidden]){
  display:flex!important;
  flex:1 1 25%!important;
  min-width:0!important;
  min-height:58px!important;
  max-width:25%!important;
  flex-direction:column!important;
  gap:5px!important;
  align-items:center!important;
  justify-content:center!important;
  padding:5px!important;
  margin:0!important;
  border:0!important;
  border-radius:8px!important;
  background:transparent!important;
  color:#3476d1!important;
  box-shadow:none!important;
  transition:background .16s!important;
}
#opportunity-detail-dialog.opp-desk-dialog #opportunity-detail>footer button.s6-detail-action:not([hidden]) + button.s6-detail-action:not([hidden]){
  border-left:1px solid #edf2fa!important;
  border-radius:0!important;
}
#opportunity-detail-dialog.opp-desk-dialog #opportunity-detail>footer button.s6-detail-action:not([hidden]):hover{
  background:#f5f9ff!important;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-action-icon{
  display:grid;place-items:center;
  width:27px;height:27px;
  color:inherit;
}
#opportunity-detail-dialog.opp-desk-dialog .s6-action-icon svg{width:20px;height:20px}
#opportunity-detail-dialog.opp-desk-dialog .s6-action-label{
  font-size:9px;
  font-weight:700;
  line-height:1.25;
  text-align:center;
}
#opportunity-detail-dialog.opp-desk-dialog #opportunity-detail>footer [data-close-phase="Vinta"].s6-detail-action{color:#23976c!important}
#opportunity-detail-dialog.opp-desk-dialog #opportunity-detail>footer [data-close-phase="Persa"].s6-detail-action{color:#be6369!important}
#opportunity-detail-dialog.opp-desk-dialog #opportunity-detail>footer #opportunity-delete.s6-detail-action{color:#c44755!important}
@media(max-width:760px){
 #opportunity-detail-dialog.opp-desk-dialog #opportunity-detail.opportunity-dialog__panel{width:100vw!important}
 #opportunity-detail-dialog.opp-desk-dialog #opportunity-detail-data.s6-detail-body{padding:13px 12px 18px!important}
 #opportunity-detail-dialog.opp-desk-dialog #opportunity-detail>header{padding:17px 16px!important}
 #opportunity-detail-dialog.opp-desk-dialog .s6-detail-section{padding:14px 12px!important}
 #opportunity-detail-dialog.opp-desk-dialog .s6-detail-step small{font-size:8px}
}
@media(max-width:355px){
 #opportunity-detail-dialog.opp-desk-dialog .s6-detail-tiles{grid-template-columns:minmax(0,1fr)}
 #opportunity-detail-dialog.opp-desk-dialog .s6-detail-tile:last-child{grid-column:1}
 #opportunity-detail-dialog.opp-desk-dialog .s6-detail-highlights{gap:7px}
 #opportunity-detail-dialog.opp-desk-dialog .s6-detail-highlight{padding:12px 9px}
 #opportunity-detail-dialog.opp-desk-dialog .s6-detail-highlight>strong{font-size:17px}
}
@keyframes s6-reveal{
 from{opacity:.5;transform:scale(.95)}
 to{opacity:1;transform:scale(1)}
}
@media(prefers-reduced-motion:reduce){
 #opportunity-detail-dialog.opp-desk-dialog *,
 #opportunity-view[data-studio="v4"] #opportunity-results .opportunity-card.s4-row{
  animation:none!important;transition:none!important;
 }
}
